@@ -0,0 +1,2321 @@
+import boto3%0Afrom aws_config import AwsConfig%0Afrom aws_config import OrcaConfig%0A%0A%0Aclass AwsAppAutoscaling(object):%0A    '''%0A    The class provides a simpler abstraction to the AWS boto3%0A    Autoscaling client interface%0A    '''%0A    def __init__(self,%0A                 profile_names=None,%0A                 access_key_id=None,%0A                 secret_access_key=None):%0A        %22%22%22%0A        Create a Autoscaling service client to one ore more environments%0A        by name.%0A        %22%22%22%0A        service = 'application-autoscaling'%0A%0A        orca_config = OrcaConfig()%0A        self.regions = orca_config.get_regions()%0A        self.clients = %7B%7D%0A%0A        if profile_names is not None:%0A            for profile_name in profile_names:%0A                session = boto3.Session(profile_name=profile_name)%0A                self.clients%5Bprofile_name%5D = session.client(service)%0A        elif access_key_id is not None and secret_access_key is not None:%0A            self.clients%5B'default'%5D = boto3.client(%0A                service,%0A                aws_access_key_id=access_key_id,%0A                aws_secret_access_key=secret_access_key)%0A        else:%0A            awsconfig = AwsConfig()%0A            profiles = awsconfig.get_profiles()%0A%0A            for profile in profiles:%0A                session = boto3.Session(profile_name=profile)%0A                self.clients%5Bprofile%5D = %7B%7D%0A                for region in self.regions:%0A                    self.clients%5Bprofile%5D%5Bregion%5D = %5C%0A                        session.client(service, region_name=region)%0A%0A    def list_scaling_policies(self, service, profile_names=None, regions=None):%0A        scaling_policies = list()%0A        for profile in self.clients.keys():%0A            if profile_names is not None and profile not in profile_names:%0A                continue%0A            for region in self.regions:%0A                if regions is not None and region not in regions:%0A                    continue%0A%0A                client = self.clients%5Bprofile%5D%5Bregion%5D%0A                policies = client.describe_scaling_policies(%0A                    ServiceNamespace=service)%0A%0A                for policy in policies%5B'ScalingPolicies'%5D:%0A                    policy%5B'region'%5D = region%0A                    policy%5B'profile_name'%5D = profile%0A                    scaling_policies.append(policy)%0A%0A        return scaling_policies%0A

Add `list_scaling_policies` for App Autoscaling service