Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

aws - rds - remove tag augmentation where builtin #6332

Merged
merged 1 commit into from
Dec 9, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
10 changes: 6 additions & 4 deletions c7n/resources/rds.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,9 @@
class DescribeRDS(DescribeSource):

def augment(self, dbs):
return universal_augment(
self.manager, super(DescribeRDS, self).augment(dbs))
for d in dbs:
d['Tags'] = d.pop('TagList', ())
return dbs


@resources.register('rds')
Expand Down Expand Up @@ -953,8 +954,9 @@ def process(self, resources):
class DescribeRDSSnapshot(DescribeSource):

def augment(self, snaps):
return universal_augment(
self.manager, super(DescribeRDSSnapshot, self).augment(snaps))
for s in snaps:
s['Tags'] = s.pop('TagList', ())
return snaps


@resources.register('rds-snapshot')
Expand Down
9 changes: 6 additions & 3 deletions c7n/resources/rdscluster.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
import c7n.filters.vpc as net_filters
from c7n.manager import resources
from c7n.query import ConfigSource, QueryResourceManager, TypeInfo, DescribeSource
from c7n import tags
from .aws import shape_validate
from c7n.exceptions import PolicyValidationError
from c7n.utils import (
Expand All @@ -24,7 +23,9 @@
class DescribeCluster(DescribeSource):

def augment(self, resources):
return tags.universal_augment(self.manager, resources)
for r in resources:
r['Tags'] = r.pop('TagList', ())
return resources


@resources.register('rds-cluster')
Expand Down Expand Up @@ -355,7 +356,9 @@ def get_resources(self, resource_ids, cache=True):
'Values': resource_ids}]).get('DBClusterSnapshots', ())

def augment(self, resources):
return tags.universal_augment(self.manager, resources)
for r in resources:
r['Tags'] = r.pop('TagList', ())
return resources


class ConfigClusterSnapshot(ConfigSource):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,13 @@
"StorageEncrypted": true,
"KmsKeyId": "arn:aws:kms:us-east-1:644160558196:key/b10f842a-feb7-4318-92d5-0640a75b7688",
"DBClusterSnapshotArn": "arn:aws:rds:us-east-1:644160558196:cluster-snapshot:rds:database-1-2020-04-27-05-58",
"IAMDatabaseAuthenticationEnabled": false
"IAMDatabaseAuthenticationEnabled": false,
"TagList": [
{
"Key": "Owner",
"Value": "kapil"
}
]
},
{
"AvailabilityZones": [
Expand Down Expand Up @@ -94,4 +100,4 @@
],
"ResponseMetadata": {}
}
}
}

This file was deleted.

22 changes: 20 additions & 2 deletions tests/data/placebo/test_rds_delete/rds.DescribeDBInstances_1.json
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,25 @@
"KmsKeyId": "arn:aws:kms:us-west-2:644160558196:key/1ec621db-4406-4cb9-8e85-812386071791",
"DBInstanceClass": "db.m4.xlarge",
"DbInstancePort": 0,
"DBInstanceIdentifier": "test-test"
"DBInstanceIdentifier": "test-test",
"TagList": [
{
"Value": "test",
"Key": "Owner"
},
{
"Value": "postgres",
"Key": "Platform"
},
{
"Value": "Resource does not meet policy: delete@2017/09/14",
"Key": "custodian_next"
},
{
"Value": "yes",
"Key": "custodian_upgrade"
}
]
}
],
"ResponseMetadata": {
Expand All @@ -124,4 +142,4 @@
}
}
}
}
}
40 changes: 0 additions & 40 deletions tests/data/placebo/test_rds_delete/tagging.GetResources_1.json

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,45 @@
"SnapshotType": "manual",
"IAMDatabaseAuthenticationEnabled": false,
"Port": 5432,
"DBInstanceIdentifier": "mxtest"
"DBInstanceIdentifier": "mxtest",
"TagList": [
{
"Value": "gp2",
"Key": "StorageType"
},
{
"Value": "default.postgres9.5",
"Key": "ParameterGroupName"
},
{
"Value": "sg-aa6c90c3",
"Key": "VPCSecurityGroups"
},
{
"Value": "default:postgres-9-5",
"Key": "OptionGroupName"
},
{
"Value": "db.m4.large",
"Key": "InstanceClass"
},
{
"Value": "default",
"Key": "DBSubnetGroupName"
},
{
"Value": "other",
"Key": "workload-type"
},
{
"Value": "False",
"Key": "MultiAZ"
},
{
"Value": "Testing",
"Key": "AppName"
}
]
}
]
}
Expand Down

This file was deleted.

This file was deleted.