Best Python code snippet using localstack_python
iam_rule_helpers.py
Source:iam_rule_helpers.py
...69 if not more_data:70 return result['ServicesLastAccessed']71 all_service_info = result['ServicesLastAccessed'][:]72 while more_data:73 page = iam.get_service_last_accessed_details(JobId=job['JobId'], Marker=marker)74 more_data, marker = page['IsTruncated'], page['Marker']75 all_service_info.extend(page['ServicesLastAccessed'])...
iam_access_advisor_permissions.py
Source:iam_access_advisor_permissions.py
...14 # returns job id15 job_id_response = iam.generate_service_last_accessed_details(Arn=role_arn)16 role_job_id = job_id_response['JobId']17 # returns service last accessed details18 service_response = iam.get_service_last_accessed_details(JobId=role_job_id)19 while service_response['JobStatus'] != 'COMPLETED':20 service_response = iam.get_service_last_accessed_details(JobId=role_job_id)21 # getting last accessed services22 last_accessed_services = service_response['ServicesLastAccessed']23 print('- - - Role: ' + role_arn.split("/")[-1] + ' - - -')24 for service in last_accessed_services:25 try:26 last_access_day = service['LastAuthenticated']27 days_difference = int((current_time - last_access_day).days)28 # iam roles with services older than 180 days29 if days_difference > 180:30 print(f"{service['ServiceName']} - Last accessed {days_difference} days ago.")31 except Exception as e:32 continue33def main():34 role_arns = list_roles()...
reader.py
Source:reader.py
...18 job = self.iam.generate_service_last_accessed_details(19 Arn = role['Arn'],20 Granularity = 'SERVICE_LEVEL'21 )22 services = self.iam.get_service_last_accessed_details(23 JobId = job['JobId']24 )25 while services['JobStatus'] != 'COMPLETED':26 time.sleep(1.0)27 services = self.iam.get_service_last_accessed_details(28 JobId = job['JobId']29 )30 for service in services['ServicesLastAccessed']:31 if 'LastAuthenticated' not in service:32 unused.append(service['ServiceName'])33 34 if unused:35 print(f'\"{role["RoleName"]}\": {unused}')36 return unused37 def __exit__(self):...
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!!