Skip to content

Commit

Permalink
aws autoscaling
Browse files Browse the repository at this point in the history
  • Loading branch information
fsignorini committed Oct 15, 2018
1 parent 89d4738 commit 97900d7
Show file tree
Hide file tree
Showing 3 changed files with 126 additions and 0 deletions.
4 changes: 4 additions & 0 deletions app/services/translate/aws.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
from .aws_mapper.aws_describe_snapshots import rules as rules_aws_describe_snapshots
from .aws_mapper.aws_describe_cdns import rules as rules_describe_cdns
from .aws_mapper.aws_describe_db_list import rules as rules_describe_db_list
from .aws_mapper.aws_describe_autoscaling_group import rules as rules_describe_autoscaling_group
from .aws_mapper.aws_describe_scaling_plans import rules as rules_aws_describe_scaling_plans


class MapperAWS(Mapper):
Expand Down Expand Up @@ -65,6 +67,8 @@ def mapp(self, command, conn):
'describe_nat_gateways': rules_aws_describe_nat_gateways(conn),
'describe_network_acls': rules_aws_describe_network_acls(conn),
'describe_security_groups': rules_aws_describe_security_groups(conn),
'describe_auto_scaling_groups': rules_describe_autoscaling_group(conn),
'describe_scaling_plans': rules_aws_describe_scaling_plans(conn)
}

return mapper[command]
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
def rules(conn):
return {
'name': {'call': 'switch', 'source': 'DBInstanceIdentifier'},
'engine': {'call': 'switch', 'source': 'Engine'},
'unique_id': {'call': 'switch', 'source': 'DBInstanceIdentifier'},


'role': {'call': 'batch',
'source': {
'dbname': {'call': 'switch', 'source': 'DBName'},
'endpoint': {'call': 'switch', 'source': 'Endpoint'},
'allocated_storage': {'call': 'switch', 'source': 'AllocatedStorage'},
'backup_window': {'call': 'switch', 'source': 'PreferredBackupWindow'},
'backup_retention': {'call': 'switch', 'source': 'BackupRetentionPeriod'},
'security_group': {'call': 'switch', 'source': 'DBSecurityGroups'},
'class': {'call': 'switch', 'source': 'DBInstanceClass'},
'parameter': {'call': 'switch', 'source': 'DBParameterGroups'},
'vpc_security': {'call': 'switch', 'source': 'VpcSecurityGroups'},
'subnet_group': {'call': 'switch', 'source': 'DBSubnetGroup'},
'availability_zone': {'call': 'switch', 'source': 'AvailabilityZone'},
'read_replica': {'call': 'switch', 'source': 'ReadReplicaDBClusterIdentifiers'},
'license_model': {'call': 'switch', 'source': 'LicenseModel'},
'iops': {'call': 'switch', 'source': 'Iops'},
'secondary_availability_zone': {'call': 'switch', 'source': 'SecondaryAvailabilityZone'},
'storage_type': {'call': 'switch', 'source': 'StorageType'},
'instance_port': {'call': 'switch', 'source': 'DbInstancePort'},
'cluster_name': {'call': 'switch', 'source': 'DBClusterIdentifier'},
'storage_encrypted': {'call': 'switch', 'source': 'StorageEncrypted'},
'domain': {'call': 'switch', 'source': 'DomainMemberships'},
'monitoring_interval': {'call': 'switch', 'source': 'MonitoringInterval'},
'instance_arn': {'call': 'switch', 'source': 'DBInstanceArn'},
'timezone': {'call': 'switch', 'source': 'Timezone'},
'cloudwatch_export': {'call': 'switch', 'source': 'EnabledCloudwatchLogsExports'}
}
},


'status': {'call': 'switch', 'source': 'DBInstanceStatus'},
'read_status': {'call': 'switch', 'source': 'StatusInfos.Status'},

'datacenters': {'call': 'fctDcApp',
'source': {**conn}},
'active': {'call': 'switchOptions',
'source': {'field': 'DBInstanceStatus',
'options': {'stopping': False, 'stopped': False, 'failed': False, 'deleting': False, 'inaccessible-encryption-credentials': False, 'incompatible-network': False},
'default': True
}},
'environment': {'call': 'arrCatcher',
'source': {'field': 'Tags', 'sKey': 'Key', 's': 'environment', 'catcher': 'Value'}},
'created_at': {'call': 'switch', 'source': 'CreatedTime'},
'provider': {'call': 'setV', 'source': 'RDS (AWS)'},
'own': {'call': 'setV', 'source': 1},
'tags': {'call': 'fctTags', 'source': 'Tags'},
'family': {'call': 'setV', 'source': 'Database'},
'owner': {'call': 'fctOwner',
'source': {**conn}},
'roles': {'call': 'fctRoles',
'source': {**conn}},
'checksum': {'call': 'checksum',
'source': None}
}
61 changes: 61 additions & 0 deletions app/services/translate/aws_mapper/aws_describe_scaling_plans.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
def rules(conn):
return {
'name': {'call': 'switch', 'source': 'DBInstanceIdentifier'},
'engine': {'call': 'switch', 'source': 'Engine'},
'unique_id': {'call': 'switch', 'source': 'DBInstanceIdentifier'},


'role': {'call': 'batch',
'source': {
'dbname': {'call': 'switch', 'source': 'DBName'},
'endpoint': {'call': 'switch', 'source': 'Endpoint'},
'allocated_storage': {'call': 'switch', 'source': 'AllocatedStorage'},
'backup_window': {'call': 'switch', 'source': 'PreferredBackupWindow'},
'backup_retention': {'call': 'switch', 'source': 'BackupRetentionPeriod'},
'security_group': {'call': 'switch', 'source': 'DBSecurityGroups'},
'class': {'call': 'switch', 'source': 'DBInstanceClass'},
'parameter': {'call': 'switch', 'source': 'DBParameterGroups'},
'vpc_security': {'call': 'switch', 'source': 'VpcSecurityGroups'},
'subnet_group': {'call': 'switch', 'source': 'DBSubnetGroup'},
'availability_zone': {'call': 'switch', 'source': 'AvailabilityZone'},
'read_replica': {'call': 'switch', 'source': 'ReadReplicaDBClusterIdentifiers'},
'license_model': {'call': 'switch', 'source': 'LicenseModel'},
'iops': {'call': 'switch', 'source': 'Iops'},
'secondary_availability_zone': {'call': 'switch', 'source': 'SecondaryAvailabilityZone'},
'storage_type': {'call': 'switch', 'source': 'StorageType'},
'instance_port': {'call': 'switch', 'source': 'DbInstancePort'},
'cluster_name': {'call': 'switch', 'source': 'DBClusterIdentifier'},
'storage_encrypted': {'call': 'switch', 'source': 'StorageEncrypted'},
'domain': {'call': 'switch', 'source': 'DomainMemberships'},
'monitoring_interval': {'call': 'switch', 'source': 'MonitoringInterval'},
'instance_arn': {'call': 'switch', 'source': 'DBInstanceArn'},
'timezone': {'call': 'switch', 'source': 'Timezone'},
'cloudwatch_export': {'call': 'switch', 'source': 'EnabledCloudwatchLogsExports'}
}
},


'status': {'call': 'switch', 'source': 'DBInstanceStatus'},
'read_status': {'call': 'switch', 'source': 'StatusInfos.Status'},

'datacenters': {'call': 'fctDcApp',
'source': {**conn}},
'active': {'call': 'switchOptions',
'source': {'field': 'DBInstanceStatus',
'options': {'stopping': False, 'stopped': False, 'failed': False, 'deleting': False, 'inaccessible-encryption-credentials': False, 'incompatible-network': False},
'default': True
}},
'environment': {'call': 'arrCatcher',
'source': {'field': 'Tags', 'sKey': 'Key', 's': 'environment', 'catcher': 'Value'}},
'created_at': {'call': 'switch', 'source': 'CreatedTime'},
'provider': {'call': 'setV', 'source': 'RDS (AWS)'},
'own': {'call': 'setV', 'source': 1},
'tags': {'call': 'fctTags', 'source': 'Tags'},
'family': {'call': 'setV', 'source': 'Database'},
'owner': {'call': 'fctOwner',
'source': {**conn}},
'roles': {'call': 'fctRoles',
'source': {**conn}},
'checksum': {'call': 'checksum',
'source': None}
}

0 comments on commit 97900d7

Please sign in to comment.