Skip to content

Commit

Permalink
new: added policy ecc-aws-578-reserved_ec2_instance_payment_pending
Browse files Browse the repository at this point in the history
  • Loading branch information
anna-shcherbak committed Sep 26, 2023
1 parent 4ad2fb0 commit cf8785b
Show file tree
Hide file tree
Showing 5 changed files with 152 additions and 0 deletions.
17 changes: 17 additions & 0 deletions policies/ecc-aws-578-reserved_ec2_instance_payment_pending.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Copyright (c) 2023 EPAM Systems, Inc.
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.


policies:
- name: ecc-aws-578-reserved_ec2_instance_payment_pending
comment: '010008032000'
description: |
Amazon EC2 reserved instance payment pending
resource: aws.ec2-reserved
filters:
- type: value
key: State
value: payment-pending
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"ec2:DescribeReservedInstances"
],
"Resource": "*"
}
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
{
"status_code": 200,
"data": {
"ReservedInstances": [
{
"Duration": 31536000,
"End": {
"__class__": "datetime",
"year": 2020,
"month": 2,
"day": 23,
"hour": 11,
"minute": 25,
"second": 2,
"microsecond": 0
},
"FixedPrice": 30.0,
"InstanceCount": 1,
"InstanceType": "t2.micro",
"ProductDescription": "Linux/UNIX",
"ReservedInstancesId": "32881ecb-6734-4b79-94a0-26c759c2da38",
"Start": {
"__class__": "datetime",
"year": 2019,
"month": 2,
"day": 23,
"hour": 11,
"minute": 25,
"second": 3,
"microsecond": 340000
},
"State": "active",
"UsagePrice": 0.0,
"CurrencyCode": "USD",
"InstanceTenancy": "default",
"OfferingClass": "standard",
"OfferingType": "Partial Upfront",
"RecurringCharges": [
{
"Amount": 0.0034,
"Frequency": "Hourly"
}
],
"Scope": "Region"
}
],
"ResponseMetadata": {
"RequestId": "cfd41aad-88c0-4975-9725-f2385aaa5852",
"HTTPStatusCode": 200,
"HTTPHeaders": {
"content-type": "text/xml;charset=UTF-8",
"content-length": "1267",
"date": "Sat, 23 Feb 2019 11:45:27 GMT",
"server": "AmazonEC2"
},
"RetryAttempts": 0
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
{
"status_code": 200,
"data": {
"ReservedInstances": [
{
"Duration": 31536000,
"End": {
"__class__": "datetime",
"year": 2020,
"month": 2,
"day": 23,
"hour": 11,
"minute": 25,
"second": 2,
"microsecond": 0
},
"FixedPrice": 30.0,
"InstanceCount": 1,
"InstanceType": "t2.micro",
"ProductDescription": "Linux/UNIX",
"ReservedInstancesId": "32881ecb-6734-4b79-94a0-26c759c2da38",
"Start": {
"__class__": "datetime",
"year": 2019,
"month": 2,
"day": 23,
"hour": 11,
"minute": 25,
"second": 3,
"microsecond": 340000
},
"State": "payment-pending",
"UsagePrice": 0.0,
"CurrencyCode": "USD",
"InstanceTenancy": "default",
"OfferingClass": "standard",
"OfferingType": "Partial Upfront",
"RecurringCharges": [
{
"Amount": 0.0034,
"Frequency": "Hourly"
}
],
"Scope": "Region"
}
],
"ResponseMetadata": {
"RequestId": "cfd41aad-88c0-4975-9725-f2385aaa5852",
"HTTPStatusCode": 200,
"HTTPHeaders": {
"content-type": "text/xml;charset=UTF-8",
"content-length": "1267",
"date": "Sat, 23 Feb 2019 11:45:27 GMT",
"server": "AmazonEC2"
},
"RetryAttempts": 0
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
class PolicyTest(object):

def test_resources_with_client(self, base_test, resources, local_session):
base_test.assertEqual(len(resources), 1)
base_test.assertEqual(resources[0]['State'], "payment-pending")

0 comments on commit cf8785b

Please sign in to comment.