class BackupSelection (construct)
Language | Type name |
---|---|
.NET | Amazon.CDK.AWS.Backup.BackupSelection |
Go | github.com/aws/aws-cdk-go/awscdk/v2/awsbackup#BackupSelection |
Java | software.amazon.awscdk.services.backup.BackupSelection |
Python | aws_cdk.aws_backup.BackupSelection |
TypeScript (source) | aws-cdk-lib » aws_backup » BackupSelection |
Implements
IConstruct
, IDependable
, IResource
, IGrantable
A backup selection.
Example
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import { aws_backup as backup } from 'aws-cdk-lib';
import { aws_iam as iam } from 'aws-cdk-lib';
declare const backupPlan: backup.BackupPlan;
declare const backupResource: backup.BackupResource;
declare const role: iam.Role;
const backupSelection = new backup.BackupSelection(this, 'MyBackupSelection', {
backupPlan: backupPlan,
resources: [backupResource],
// the properties below are optional
allowRestores: false,
backupSelectionName: 'backupSelectionName',
disableDefaultBackupPolicy: false,
role: role,
});
Initializer
new BackupSelection(scope: Construct, id: string, props: BackupSelectionProps)
Parameters
- scope
Construct
- id
string
- props
Backup
Selection Props
Construct Props
Name | Type | Description |
---|---|---|
backup | IBackup | The backup plan for this selection. |
resources | Backup [] | The resources to backup. |
allow | boolean | Whether to automatically give restores permissions to the role that AWS Backup uses. |
backup | string | The name for this selection. |
disable | boolean | Whether to disable automatically assigning default backup permissions to the role that AWS Backup uses. |
role? | IRole | The role that AWS Backup uses to authenticate when backuping or restoring the resources. |
backupPlan
Type:
IBackup
The backup plan for this selection.
resources
Type:
Backup
[]
The resources to backup.
Use the helper static methods defined on BackupResource
.
allowRestores?
Type:
boolean
(optional, default: false)
Whether to automatically give restores permissions to the role that AWS Backup uses.
If true
, the AWSBackupServiceRolePolicyForRestores
managed
policy will be attached to the role.
backupSelectionName?
Type:
string
(optional, default: a CDK generated name)
The name for this selection.
disableDefaultBackupPolicy?
Type:
boolean
(optional, default: false)
Whether to disable automatically assigning default backup permissions to the role that AWS Backup uses.
If false
, the AWSBackupServiceRolePolicyForBackup
managed policy will be
attached to the role.
role?
Type:
IRole
(optional, default: a new role will be created)
The role that AWS Backup uses to authenticate when backuping or restoring the resources.
The AWSBackupServiceRolePolicyForBackup
managed policy
will be attached to this role unless disableDefaultBackupPolicy
is set to true
.
Properties
Name | Type | Description |
---|---|---|
backup | string | The identifier of the backup plan. |
env | Resource | The environment this resource belongs to. |
grant | IPrincipal | The principal to grant permissions to. |
node | Node | The tree node. |
selection | string | The identifier of the backup selection. |
stack | Stack | The stack in which this resource is defined. |
backupPlanId
Type:
string
The identifier of the backup plan.
env
Type:
Resource
The environment this resource belongs to.
For resources that are created and managed by the CDK (generally, those created by creating new class instances like Role, Bucket, etc.), this is always the same as the environment of the stack they belong to; however, for imported resources (those obtained from static methods like fromRoleArn, fromBucketName, etc.), that might be different than the stack they were imported into.
grantPrincipal
Type:
IPrincipal
The principal to grant permissions to.
node
Type:
Node
The tree node.
selectionId
Type:
string
The identifier of the backup selection.
stack
Type:
Stack
The stack in which this resource is defined.
Methods
Name | Description |
---|---|
apply | Apply the given removal policy to this resource. |
to | Returns a string representation of this construct. |
RemovalPolicy(policy)
applypublic applyRemovalPolicy(policy: RemovalPolicy): void
Parameters
- policy
Removal
Policy
Apply the given removal policy to this resource.
The Removal Policy controls what happens to this resource when it stops being managed by CloudFormation, either because you've removed it from the CDK application or because you've made a change that requires the resource to be replaced.
The resource can be deleted (RemovalPolicy.DESTROY
), or left in your AWS
account for data recovery and cleanup later (RemovalPolicy.RETAIN
).
String()
topublic toString(): string
Returns
string
Returns a string representation of this construct.