Skip to content

Commit 0a9ea6d

Browse files
new: added policy ecc-aws-577-reserved_ec2_instance_payment_failed
1 parent 4ad2fb0 commit 0a9ea6d

File tree

5 files changed

+152
-0
lines changed

5 files changed

+152
-0
lines changed
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Copyright (c) 2023 EPAM Systems, Inc.
2+
#
3+
# This Source Code Form is subject to the terms of the Mozilla Public
4+
# License, v. 2.0. If a copy of the MPL was not distributed with this
5+
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
6+
7+
8+
policies:
9+
- name: ecc-aws-577-reserved_ec2_instance_payment_failed
10+
comment: '010008032000'
11+
description: |
12+
Amazon EC2 reserved instance payment failed
13+
resource: aws.ec2-reserved
14+
filters:
15+
- type: value
16+
key: State
17+
value: payment-failed
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"Version": "2012-10-17",
3+
"Statement": [
4+
{
5+
"Effect": "Allow",
6+
"Action": [
7+
"ec2:DescribeReservedInstances"
8+
],
9+
"Resource": "*"
10+
}
11+
]
12+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
{
2+
"status_code": 200,
3+
"data": {
4+
"ReservedInstances": [
5+
{
6+
"Duration": 31536000,
7+
"End": {
8+
"__class__": "datetime",
9+
"year": 2020,
10+
"month": 2,
11+
"day": 23,
12+
"hour": 11,
13+
"minute": 25,
14+
"second": 2,
15+
"microsecond": 0
16+
},
17+
"FixedPrice": 30.0,
18+
"InstanceCount": 1,
19+
"InstanceType": "t2.micro",
20+
"ProductDescription": "Linux/UNIX",
21+
"ReservedInstancesId": "32881ecb-6734-4b79-94a0-26c759c2da38",
22+
"Start": {
23+
"__class__": "datetime",
24+
"year": 2019,
25+
"month": 2,
26+
"day": 23,
27+
"hour": 11,
28+
"minute": 25,
29+
"second": 3,
30+
"microsecond": 340000
31+
},
32+
"State": "active",
33+
"UsagePrice": 0.0,
34+
"CurrencyCode": "USD",
35+
"InstanceTenancy": "default",
36+
"OfferingClass": "standard",
37+
"OfferingType": "Partial Upfront",
38+
"RecurringCharges": [
39+
{
40+
"Amount": 0.0034,
41+
"Frequency": "Hourly"
42+
}
43+
],
44+
"Scope": "Region"
45+
}
46+
],
47+
"ResponseMetadata": {
48+
"RequestId": "cfd41aad-88c0-4975-9725-f2385aaa5852",
49+
"HTTPStatusCode": 200,
50+
"HTTPHeaders": {
51+
"content-type": "text/xml;charset=UTF-8",
52+
"content-length": "1267",
53+
"date": "Sat, 23 Feb 2019 11:45:27 GMT",
54+
"server": "AmazonEC2"
55+
},
56+
"RetryAttempts": 0
57+
}
58+
}
59+
}
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
{
2+
"status_code": 200,
3+
"data": {
4+
"ReservedInstances": [
5+
{
6+
"Duration": 31536000,
7+
"End": {
8+
"__class__": "datetime",
9+
"year": 2020,
10+
"month": 2,
11+
"day": 23,
12+
"hour": 11,
13+
"minute": 25,
14+
"second": 2,
15+
"microsecond": 0
16+
},
17+
"FixedPrice": 30.0,
18+
"InstanceCount": 1,
19+
"InstanceType": "t2.micro",
20+
"ProductDescription": "Linux/UNIX",
21+
"ReservedInstancesId": "32881ecb-6734-4b79-94a0-26c759c2da38",
22+
"Start": {
23+
"__class__": "datetime",
24+
"year": 2019,
25+
"month": 2,
26+
"day": 23,
27+
"hour": 11,
28+
"minute": 25,
29+
"second": 3,
30+
"microsecond": 340000
31+
},
32+
"State": "payment-failed",
33+
"UsagePrice": 0.0,
34+
"CurrencyCode": "USD",
35+
"InstanceTenancy": "default",
36+
"OfferingClass": "standard",
37+
"OfferingType": "Partial Upfront",
38+
"RecurringCharges": [
39+
{
40+
"Amount": 0.0034,
41+
"Frequency": "Hourly"
42+
}
43+
],
44+
"Scope": "Region"
45+
}
46+
],
47+
"ResponseMetadata": {
48+
"RequestId": "cfd41aad-88c0-4975-9725-f2385aaa5852",
49+
"HTTPStatusCode": 200,
50+
"HTTPHeaders": {
51+
"content-type": "text/xml;charset=UTF-8",
52+
"content-length": "1267",
53+
"date": "Sat, 23 Feb 2019 11:45:27 GMT",
54+
"server": "AmazonEC2"
55+
},
56+
"RetryAttempts": 0
57+
}
58+
}
59+
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
class PolicyTest(object):
2+
3+
def test_resources_with_client(self, base_test, resources, local_session):
4+
base_test.assertEqual(len(resources), 1)
5+
base_test.assertEqual(resources[0]['State'], "payment-failed")

0 commit comments

Comments
 (0)