Best Python code snippet using localstack_python
ec2.py
Source: ec2.py
...23 print('VPC endpoints deleted')24 # VPC endpoints connections25 print('Deleting VPC endpoint connections')26 service_ids = []27 for connection in ec2.describe_vpc_endpoint_connections()['VpcEndpointConnections']:28 service_id = connection['ServiceId']29 state = connection['VpcEndpointState']30 if state in ['PendingAcceptance', 'Pending', 'Available', 'Rejected', 'Failed', 'Expired']:31 print('Deleting VPC Endpoint Service - {}'.format(service_id))32 service_ids.append(service_id)33 ec2.reject_vpc_endpoint_connections(34 ServiceId=service_id,35 VpcEndpointIds=[36 connection['VpcEndpointId'],37 ]38 )39 if service_ids:40 ec2.delete_vpc_endpoint_service_configurations(41 ServiceIds=service_ids42 )43 print('Waiting for VPC endpoint services to be destroyed')44 while ec2.describe_vpc_endpoint_connections()['VpcEndpointConnections']:45 time.sleep(5)46 print('VPC endpoint connections deleted')47#48# NAT gateways49#50def delete_nat_gateways():51 """Delete all the NAT gateways52 :return: None53 """54 print('Deleting NAT gateways')55 ec2 = boto3.client('ec2')56 for page in ec2.get_paginator('describe_nat_gateways').paginate():57 for nat_gateway in page['NatGateways']:58 nat_gateway_id = nat_gateway['NatGatewayId']...
commands.py
Source: commands.py
1xcommands = [2["iam","get_account_authorization_details",['UserDetailList','GroupDetailList','RoleDetailList','Policies','IsTruncated',3 'Marker','ResponseMetadata']],4["iam","list_account_aliases",['AccountAliases','IsTruncated','ResponseMetadata']],5["route53","list_hosted_zones",['ResponseMetadata','HostedZones','IsTruncated','MaxItems']],6["ec2","describe_vpcs",['Vpcs','ResponseMetadata']],7["ec2","describe_subnets",['Subnets','ResponseMetadata']],8["ec2","describe_instances",['Reservations','ResponseMetadata']],9["ec2","describe_volumes",['Volumes','ResponseMetadata']],10["rds","describe_db_instances",['DBInstances','ResponseMetadata']],11["rds","describe_db_snapshots",['DBSnapshots','ResponseMetadata']],12["elb","describe_load_balancers",['LoadBalancerDescriptions','ResponseMetadata']],13["elbv2","describe_load_balancers",['LoadBalancers','ResponseMetadata']],14["redshift","describe_clusters",['Clusters','ResponseMetadata']],15["redshift","describe_cluster_subnet_groups",['ClusterSubnetGroups','ResponseMetadata']],16["sqs","list_queues",['ResponseMetadata']],17["sns","list_topics",['Topics','ResponseMetadata']],18["ec2","describe_security_groups",['SecurityGroups','ResponseMetadata']],19["ec2","describe_network_interfaces",['NetworkInterfaces','ResponseMetadata']],20["ec2","describe_vpc_peering_connections",['VpcPeeringConnections','ResponseMetadata']],21["autoscaling","describe_policies",['ScalingPolicies','ResponseMetadata']],22["autoscaling","describe_auto_scaling_groups",['AutoScalingGroups','ResponseMetadata']],23["cloudformation","describe_stacks",['Stacks','ResponseMetadata']],24["cloudfront","list_distributions",['ResponseMetadata','DistributionList']],25["cloudwatch","describe_alarms",['CompositeAlarms','MetricAlarms','ResponseMetadata']],26["config","describe_config_rules",['ConfigRules','ResponseMetadata']],27["ec2","describe_network_acls",['NetworkAcls','ResponseMetadata']],28["ec2","describe_route_tables",['RouteTables','ResponseMetadata']],29["ec2","describe_flow_logs",['FlowLogs','ResponseMetadata']],30["ec2","describe_vpc_endpoint_connections",['VpcEndpointConnections','ResponseMetadata']],31["ec2","describe_vpc_endpoints",['VpcEndpoints','ResponseMetadata']],32["ecr","describe_repositories",['repositories','ResponseMetadata']],33["elasticache","describe_cache_clusters",['CacheClusters','ResponseMetadata']],34["efs","describe_file_systems",['ResponseMetadata','FileSystems']],35["events","list_rules",['Rules','ResponseMetadata']],36["kms","list_keys",['Keys','Truncated','ResponseMetadata']],37["lambda","list_functions",['ResponseMetadata','Functions']],38["ecs","list_clusters",['clusterArns','ResponseMetadata']],39["logs","describe_destinations",['destinations','ResponseMetadata']],40["logs","describe_log_groups",['logGroups','ResponseMetadata']],41["logs","describe_resource_policies",['resourcePolicies','ResponseMetadata']],42["apigateway","get_rest_apis",['ResponseMetadata','items']],43["accessanalyzer","list_analyzers",['ResponseMetadata','analyzers']]44]45xcommands = [46 # nothing: ["iam", "get_account_password_policy",{}],47 # bucket policy got48 # nothing: ["ecr", "get_repository_policy",{"repositoryName":"ecr_describe_repositories.json|.[] | .repositories[] | .repositoryName"}],49 # nothing in glacier50 # kms empty51]52#policy_53xcommands = [54# ["sns","list_topics",{}],55# ["sns","list_tags_for_resource",{"ResourceArn":"sns_list_topics.json|.[] |.Topics[]?|.TopicArn"}],56]57commands = [58# ["iam","get_account_authorization_details",{}],59# ["iam","list_account_aliases",{}],60# cert additions61["acm", "list_certificates",{}],62["acm", "list_tags_for_certificate",{"CertificateArn":"acm_list_certificates.json|.[] | .CertificateSummaryList | .[] | .CertificateArn"}],63# sns additions64["sns","list_topics",{}],65["sns","get_topic_attributes",{"TopicArn":"sns_list_topics.json|.[] |.Topics[]?|.TopicArn"}],66["sns", "list_subscriptions",{}],67["sns", "get_subscription_attributes",{"SubscriptionArn":"sns_list_subscriptions.json|.[] | .Subscriptions[] | .SubscriptionArn"}], # ok!68# ["sns", "list_platform_applications",{}], # useless, returns nothing69["secretsmanager","list_secrets",{}],70["secretsmanager","get_resource_policy",{"SecretId":"secretsmanager_list_secrets.json|.[]|.SecretList[]|.ARN"}], # not very useful... https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/secretsmanager.html#SecretsManager.Client.get_resource_policy71# goes off name...72["s3","list_buckets",{}],73["s3","get_bucket_acl",{"Bucket":"s3_list_buckets.json|.[] | .Buckets[]?|.Name"}], # bucket id not in response :(74["s3", "get_bucket_policy", {"Bucket":"s3_list_buckets.json|.[]|.Buckets[]?|.Name"}], # no bucket id75["s3", "get_bucket_logging", {"Bucket":"s3_list_buckets.json|.[]|.Buckets[]?|.Name"}], # empty76["s3", "get_bucket_location", {"Bucket": "s3_list_buckets.json|.[]|.Buckets[]?|.Name"}], # no bucket id77["s3", "get_bucket_encryption", {"Bucket": "s3_list_buckets.json|.[]|.Buckets[]?|.Name"}], # empty78["s3","get_bucket_tagging",{"Bucket":"s3_list_buckets.json|.[] | .Buckets[] | .Name"}],79# new cool stuff!80["ecr", "describe_repositories",{}],81["lambda", "get_policy", {"FunctionName":"lambda_list_functions.json|.[] | .Functions[]? | .FunctionName"}],82# cool policy stuff!83["iam", "list_groups",{}],84["iam", "list_attached_group_policies",{"GroupName":"iam_list_groups.json|.[] | .Groups[] | .GroupName"}],85["iam", "list_users",{}],86["iam", "list_attached_user_policies",{"UserName":"iam_list_users.json|.[] | .Users[] | .UserName"}],87["iam", "list_roles",{}],88["iam", "list_attached_role_policies",{"RoleName":"iam_list_roles.json|.[] | .Roles[] | .RoleName"}],89["resourcegroupstaggingapi","get_resources",{}],90["route53","list_hosted_zones",{}],91["ec2","describe_vpcs",{}],92["ec2","describe_subnets",{}],93["ec2","describe_instances",{}],94["ec2","describe_volumes",{}],95["rds","describe_db_instances",{}],96["rds","describe_db_snapshots",{}],97["elb","describe_load_balancers",{}],98["elbv2","describe_load_balancers",{}],99["redshift","describe_clusters",{}],100["redshift","describe_cluster_subnet_groups",{}],101["sqs","list_queues",{}],102["ec2","describe_security_groups",{}],103["ec2","describe_network_interfaces",{}],104["ec2","describe_vpc_peering_connections",{}],105["autoscaling","describe_policies",{}],106["autoscaling","describe_auto_scaling_groups",{}],107["cloudformation","describe_stacks",{}],108["cloudfront","list_distributions",{}],109# ["cloudwatch","describe_alarms",['CompositeAlarms','MetricAlarms','ResponseMetadata']],110# ["config","describe_config_rules",['ConfigRules','ResponseMetadata']],111["ec2","describe_network_acls",{}],112["ec2","describe_route_tables",{}],113["ec2","describe_flow_logs",{}],114["ec2","describe_vpc_endpoint_connections",{}],115["ec2","describe_vpc_endpoints",{}],116["ecr","describe_repositories",{}],117["elasticache","describe_cache_clusters",{}],118["efs","describe_file_systems",{}],119# ["events","list_rules",['Rules','ResponseMetadata']],120# ["kms","list_keys",['Keys','Truncated','ResponseMetadata']],121["lambda","list_functions",{}],122["ecs","list_clusters",{}],123# ["logs","describe_destinations",['destinations','ResponseMetadata']],124# ["logs","describe_log_groups",['logGroups','ResponseMetadata']],125# ["logs","describe_resource_policies",['resourcePolicies','ResponseMetadata']],126# ["apigateway","get_rest_apis",['ResponseMetadata','items']],127# ["accessanalyzer","list_analyzers",['ResponseMetadata','analyzers']]...
api.py
Source: api.py
...113 l_info(msg)114 def accept_vpc_endpoint(self, account_id):115 msg = f"Accepting the VPC Endpoint for '{account_id}'"116 l_info(msg)117 vpc_endpoints_data = self.__ec2_api.describe_vpc_endpoint_connections(118 Filters = [119 {120 "Name": "vpc-endpoint-state",121 "Values": [122 "pendingAcceptance"123 ]124 },125 {126 "Name": "vpc-endpoint-owner",127 "Values": [128 account_id129 ]130 }131 ]...
Check out the latest blogs from LambdaTest on this topic:
The fact is not alien to us anymore that cross browser testing is imperative to enhance your application’s user experience. Enhanced knowledge of popular and highly acclaimed testing frameworks goes a long way in developing a new app. It holds more significance if you are a full-stack developer or expert programmer.
QA testers have a unique role and responsibility to serve the customer. Serving the customer in software testing means protecting customers from application defects, failures, and perceived failures from missing or misunderstood requirements. Testing for known requirements based on documentation or discussion is the core of the testing profession. One unique way QA testers can both differentiate themselves and be innovative occurs when senseshaping is used to improve the application user experience.
Having a good web design can empower business and make your brand stand out. According to a survey by Top Design Firms, 50% of users believe that website design is crucial to an organization’s overall brand. Therefore, businesses should prioritize website design to meet customer expectations and build their brand identity. Your website is the face of your business, so it’s important that it’s updated regularly as per the current web design trends.
Enterprise resource planning (ERP) is a form of business process management software—typically a suite of integrated applications—that assists a company in managing its operations, interpreting data, and automating various back-office processes. The introduction of a new ERP system is analogous to the introduction of a new product into the market. If the product is not handled appropriately, it will fail, resulting in significant losses for the business. Most significantly, the employees’ time, effort, and morale would suffer as a result of the procedure.
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!!