Skip to content

Commit

Permalink
aws_s3_bucket.lifecycle_rules should return an array, not a single fi…
Browse files Browse the repository at this point in the history
…eld object. Closes #26 (#29)
  • Loading branch information
LalitLab committed Feb 2, 2021
1 parent 6770036 commit 62ee84e
Show file tree
Hide file tree
Showing 3 changed files with 121 additions and 125 deletions.
122 changes: 60 additions & 62 deletions aws-test/tests/aws_s3_bucket/test-hydrate-expected.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,71 +19,69 @@
}
},
"bucket_policy_is_public": false,
"lifecycle_rules": {
"Rules": [
{
"AbortIncompleteMultipartUpload": null,
"Expiration": {
"Date": null,
"Days": 90,
"ExpiredObjectDeleteMarker": null
},
"Filter": {
"And": {
"Prefix": "log/",
"Tags": [
{
"Key": "rule",
"Value": "log"
},
{
"Key": "autoclean",
"Value": "true"
}
]
},
"Prefix": null,
"Tag": null
"lifecycle_rules": [
{
"AbortIncompleteMultipartUpload": null,
"Expiration": {
"Date": null,
"Days": 90,
"ExpiredObjectDeleteMarker": null
},
"Filter": {
"And": {
"Prefix": "log/",
"Tags": [
{
"Key": "rule",
"Value": "log"
},
{
"Key": "autoclean",
"Value": "true"
}
]
},
"ID": "log",
"NoncurrentVersionExpiration": null,
"NoncurrentVersionTransitions": null,
"Prefix": null,
"Status": "Enabled",
"Transitions": [
{
"Date": null,
"Days": 30,
"StorageClass": "STANDARD_IA"
},
{
"Date": null,
"Days": 60,
"StorageClass": "GLACIER"
}
]
"Tag": null
},
{
"AbortIncompleteMultipartUpload": null,
"Expiration": {
"Date": "2022-01-12T00:00:00Z",
"Days": null,
"ExpiredObjectDeleteMarker": null
},
"Filter": {
"And": null,
"Prefix": "tmp/",
"Tag": null
"ID": "log",
"NoncurrentVersionExpiration": null,
"NoncurrentVersionTransitions": null,
"Prefix": null,
"Status": "Enabled",
"Transitions": [
{
"Date": null,
"Days": 30,
"StorageClass": "STANDARD_IA"
},
"ID": "tmp",
"NoncurrentVersionExpiration": null,
"NoncurrentVersionTransitions": null,
"Prefix": null,
"Status": "Enabled",
"Transitions": null
}
]
},
{
"Date": null,
"Days": 60,
"StorageClass": "GLACIER"
}
]
},
{
"AbortIncompleteMultipartUpload": null,
"Expiration": {
"Date": "2022-01-12T00:00:00Z",
"Days": null,
"ExpiredObjectDeleteMarker": null
},
"Filter": {
"And": null,
"Prefix": "tmp/",
"Tag": null
},
"ID": "tmp",
"NoncurrentVersionExpiration": null,
"NoncurrentVersionTransitions": null,
"Prefix": null,
"Status": "Enabled",
"Transitions": null
}
],
"logging": null,
"name": "{{ resourceName }}",
"policy": {
Expand Down Expand Up @@ -147,4 +145,4 @@
"versioning_enabled": true,
"versioning_mfa_delete": false
}
]
]
122 changes: 60 additions & 62 deletions aws-test/tests/aws_s3_bucket/test-list-expected.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,71 +7,69 @@
"block_public_policy": false,
"bucket_policy_is_public": false,
"ignore_public_acls": false,
"lifecycle_rules": {
"Rules": [
{
"AbortIncompleteMultipartUpload": null,
"Expiration": {
"Date": null,
"Days": 90,
"ExpiredObjectDeleteMarker": null
},
"Filter": {
"And": {
"Prefix": "log/",
"Tags": [
{
"Key": "rule",
"Value": "log"
},
{
"Key": "autoclean",
"Value": "true"
}
]
},
"Prefix": null,
"Tag": null
"lifecycle_rules": [
{
"AbortIncompleteMultipartUpload": null,
"Expiration": {
"Date": null,
"Days": 90,
"ExpiredObjectDeleteMarker": null
},
"Filter": {
"And": {
"Prefix": "log/",
"Tags": [
{
"Key": "rule",
"Value": "log"
},
{
"Key": "autoclean",
"Value": "true"
}
]
},
"ID": "log",
"NoncurrentVersionExpiration": null,
"NoncurrentVersionTransitions": null,
"Prefix": null,
"Status": "Enabled",
"Transitions": [
{
"Date": null,
"Days": 30,
"StorageClass": "STANDARD_IA"
},
{
"Date": null,
"Days": 60,
"StorageClass": "GLACIER"
}
]
"Tag": null
},
{
"AbortIncompleteMultipartUpload": null,
"Expiration": {
"Date": "2022-01-12T00:00:00Z",
"Days": null,
"ExpiredObjectDeleteMarker": null
},
"Filter": {
"And": null,
"Prefix": "tmp/",
"Tag": null
"ID": "log",
"NoncurrentVersionExpiration": null,
"NoncurrentVersionTransitions": null,
"Prefix": null,
"Status": "Enabled",
"Transitions": [
{
"Date": null,
"Days": 30,
"StorageClass": "STANDARD_IA"
},
"ID": "tmp",
"NoncurrentVersionExpiration": null,
"NoncurrentVersionTransitions": null,
"Prefix": null,
"Status": "Enabled",
"Transitions": null
}
]
},
{
"Date": null,
"Days": 60,
"StorageClass": "GLACIER"
}
]
},
{
"AbortIncompleteMultipartUpload": null,
"Expiration": {
"Date": "2022-01-12T00:00:00Z",
"Days": null,
"ExpiredObjectDeleteMarker": null
},
"Filter": {
"And": null,
"Prefix": "tmp/",
"Tag": null
},
"ID": "tmp",
"NoncurrentVersionExpiration": null,
"NoncurrentVersionTransitions": null,
"Prefix": null,
"Status": "Enabled",
"Transitions": null
}
],
"logging": null,
"name": "{{resourceName}}",
"partition": "{{ output.aws_partition.value }}",
Expand Down Expand Up @@ -100,4 +98,4 @@
"versioning_enabled": true,
"versioning_mfa_delete": false
}
]
]
2 changes: 1 addition & 1 deletion aws/table_aws_s3_bucket.go
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ func tableAwsS3Bucket(_ context.Context) *plugin.Table {
Description: "The lifecycle configuration information of the bucket",
Type: proto.ColumnType_JSON,
Hydrate: getBucketLifecycle,
Transform: transform.FromValue(),
Transform: transform.FromField("Rules"),
},
{
Name: "logging",
Expand Down

0 comments on commit 62ee84e

Please sign in to comment.