Best Python code snippet using localstack_python
aws_mgh_info.py
Source:aws_mgh_info.py  
...122                    MigrationTaskName=module.params['name'],123                    ProgressUpdateStream=module.params['progress_update_stream']124                ), True125            else:126                return client.list_discovered_resources(127                    MigrationTaskName=module.params['name'],128                    ProgressUpdateStream=module.params['progress_update_stream']129                ), False130        elif module.params['list_migration_tasks']:131            if client.can_paginate('list_migration_tasks'):132                paginator = client.get_paginator('list_migration_tasks')133                return paginator.paginate(), True134            else:135                return client.list_migration_tasks(), False136        else:137            return None, False138    except (BotoCoreError, ClientError) as e:139        module.fail_json_aws(e, msg='Failed to fetch AWS Migration Hub details')140def main():...aws_client.py
Source:aws_client.py  
...42    return complete_resources_list43def find_resources(service_name, next_token=None, aggregator=None):44    client = boto3.client('config', region_name='us-east-2' ) # 'us-east-2' 'ap-southeast-1'45    if next_token:46        response = client.list_discovered_resources(resourceType=service_name, nextToken=next_token)47    else:48        response = client.list_discovered_resources(resourceType=service_name)49    resources = response['resourceIdentifiers']50    if len(resources) > 0:51        aggregator(resources)52        if 'nextToken' in response:...list_services_by_config_svc.py
Source:list_services_by_config_svc.py  
...27    page_iterator = paginator.paginate(resourceType=res_type)28    ## List of all resources, in case of multiple pages29    all_resources = []30    for page in page_iterator:31        # response = config.list_discovered_resources(32        #     resourceType=res_type33        # )34        resources = page['resourceIdentifiers']35        all_resources += resources36    ## Now we have all resources, print them37    num_resources = len(all_resources)38    if num_resources != 0:39        print "---> There are %d Resources in %s ResourceType" % (num_resources, res_type)40        for res in all_resources:41            pp.pprint(res)42    # else:43    #     print("---> There are NO resources in %s ResourceType" % (res_type))...Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!
