How to use list_ssh_public_keys method in localstack

Best Python code snippet using localstack_python

app.py

Source:app.py Github

copy

Full Screen

...87 )88 return json.dumps(response, default=datetime_handler)89 except botocore.exceptions.ClientError as e:90 return f'{e}'91 def list_ssh_public_keys(self, access_key, secret_key, region, username, marker, max_items):92 self.iam = self.auth_iam(access_key, secret_key, region)93 client = self.iam.meta.client94 try:95 response = client.list_ssh_public_keys(96 UserName= str(username)97 )98 if marker:99 response = client.list_ssh_public_keys(100 UserName= str(username),101 Marker = str(marker)102 )103 if max_items:104 response = client.list_ssh_public_keys(105 UserName= str(username),106 MaxItems = int(max_items)107 ) 108 if marker and max_items:109 response = client.list_ssh_public_keys(110 UserName= str(username),111 MaxItems = int(max_items),112 Marker = str(marker) 113 ) 114 return json.dumps(response, default=datetime_handler)115 except botocore.exceptions.ClientError as e:116 return f'{e}' 117 def get_instance_profile(self, access_key, secret_key, region, instance_profile_name):118 self.iam = self.auth_iam(access_key, secret_key, region)119 client = self.iam.meta.client120 try:121 response = client.get_instance_profile(122 InstanceProfileName= str(instance_profile_name)123 )...

Full Screen

Full Screen

aws-delete-users.py

Source:aws-delete-users.py Github

copy

Full Screen

...46 UserName=row[1]) # Listing signing certificates47 if list_signing_certificates['Certificates']: # Deleting if any48 delete_signing_certificate = [client.delete_signing_certificate(49 UserName=row[1], CertificateId=Id['CertificateId']) for Id in list_signing_certificates['Certificates'] ]50 list_ssh_public_keys = client.list_ssh_public_keys(UserName=row[1]) # Listing public keys51 if list_ssh_public_keys['SSHPublicKeys']:52 delete_ssh_public_key = [client.delete_ssh_public_key(53 UserName=row[1], SSHPublicKeyId= Id['SSHPublicKeyId']) for Id in list_ssh_public_keys['SSHPublicKeys'] ] # Deleting if any54 list_service_specific_credentials = client.list_service_specific_credentials(55 UserName=row[1]) # Listing service specific credentials 56 if list_service_specific_credentials['ServiceSpecificCredentials']: # Deleting if any57 delete_service_specific_credential = [client.delete_service_specific_credential(58 UserName=row[1], ServiceSpecificCredentialId= Id['ServiceSpecificCredentialId']) for Id in list_service_specific_credentials['ServiceSpecificCredentials'] ]59 list_mfa_devices = client.list_mfa_devices(60 UserName=row[1]61 ) # Listing MFA devices62 if list_mfa_devices['MFADevices']: # Deleting if any63 deactivate_mfa_device = [client.deactivate_mfa_device( UserName=row[1],64 SerialNumber= Id['SerialNumber']...

Full Screen

Full Screen

get_pub_keys.py

Source:get_pub_keys.py Github

copy

Full Screen

1import boto32user_name = 'your-name'3# Create IAM client4iam = boto3.client('iam')5ssh_public_keys_response = iam.list_ssh_public_keys(6 UserName = user_name,7 MaxItems = 100,8)9# Get SSH public key10for ssh_public_key in ssh_public_keys_response['SSHPublicKeys']:11 ssh_public_key = ssh_public_key['SSHPublicKeyId']12 ssh_public_key_response = iam.get_ssh_public_key(13 UserName = user_name,14 SSHPublicKeyId = ssh_public_key,15 Encoding = 'SSH',16 )...

Full Screen

Full Screen

Automation Testing Tutorials

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.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run localstack automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful