added: enable/disable/modify redshift snapshot copy methods

This commit is contained in:
captainkerk 2018-01-28 03:06:57 +00:00
commit d8b124fbf4
4 changed files with 191 additions and 2 deletions

View file

@ -1042,3 +1042,75 @@ def test_tagged_resource_not_found_error():
ResourceName='bad:arn'
).should.throw(ClientError, "Tagging is not supported for this type of resource")
@mock_redshift
def test_enable_snapshot_copy():
client = boto3.client('redshift', region_name='us-east-1')
client.create_cluster(
DBName='test',
ClusterIdentifier='test',
ClusterType='single-node',
NodeType='ds2.xlarge',
MasterUsername='user',
MasterUserPassword='password',
)
client.enable_snapshot_copy(
ClusterIdentifier='test',
DestinationRegion='us-west-2',
RetentionPeriod=3,
SnapshotCopyGrantName='copy-us-east-1-to-us-west-2'
)
response = client.describe_clusters(ClusterIdentifier='test')
cluster_snapshot_copy_status = response['Clusters'][0]['ClusterSnapshotCopyStatus']
cluster_snapshot_copy_status['RetentionPeriod'].should.equal(3)
cluster_snapshot_copy_status['DestinationRegion'].should.equal('us-west-2')
cluster_snapshot_copy_status['SnapshotCopyGrantName'].should.equal('copy-us-east-1-to-us-west-2')
@mock_redshift
def test_disable_snapshot_copy():
client = boto3.client('redshift', region_name='us-east-1')
client.create_cluster(
DBName='test',
ClusterIdentifier='test',
ClusterType='single-node',
NodeType='ds2.xlarge',
MasterUsername='user',
MasterUserPassword='password',
)
client.enable_snapshot_copy(
ClusterIdentifier='test',
DestinationRegion='us-west-2',
RetentionPeriod=3,
SnapshotCopyGrantName='copy-us-east-1-to-us-west-2',
)
client.disable_snapshot_copy(
ClusterIdentifier='test',
)
response = client.describe_clusters(ClusterIdentifier='test')
response['Clusters'][0].shouldnt.contain('ClusterSnapshotCopyStatus')
@mock_redshift
def test_modify_snapshot_copy_retention_period():
client = boto3.client('redshift', region_name='us-east-1')
client.create_cluster(
DBName='test',
ClusterIdentifier='test',
ClusterType='single-node',
NodeType='ds2.xlarge',
MasterUsername='user',
MasterUserPassword='password',
)
client.enable_snapshot_copy(
ClusterIdentifier='test',
DestinationRegion='us-west-2',
RetentionPeriod=3,
SnapshotCopyGrantName='copy-us-east-1-to-us-west-2',
)
client.modify_snapshot_copy_retention_period(
ClusterIdentifier='test',
RetentionPeriod=5,
)
response = client.describe_clusters(ClusterIdentifier='test')
cluster_snapshot_copy_status = response['Clusters'][0]['ClusterSnapshotCopyStatus']
cluster_snapshot_copy_status['RetentionPeriod'].should.equal(5)