How to use list_server_certificates method in localstack

Best Python code snippet using localstack_python

iam_cert_facts.py

Source:iam_cert_facts.py Github

copy

Full Screen

...83 raise84 except Exception as e:85 module.fail_json(msg="Unable to get server certificate :: %s" % str(e), exception=format_exc())86 return response87def list_server_certificates(client, module, path_prefix):88 """ Lists the server certificates stored in IAM that have the specified path prefix.89 If none exist, the action returns an empty list.90 """91 try:92 if path_prefix:93 response = client.list_server_certificates(PathPrefix=path_prefix)94 else:95 response = client.list_server_certificates()96 except Exception as e:97 module.fail_json(msg="Unable to get server certificates :: %s" % str(e), exception=format_exc())98 return response99def main():100 argument_spec = ec2_argument_spec()101 argument_spec.update(dict(102 certificate_name=dict(type='str', default=None),103 path_prefix=dict(type='str', default=None),104 ))105 module = AnsibleModule(106 argument_spec=argument_spec,107 mutually_exclusive=[108 ['certificate_name', 'path_prefix'],109 ],110 supports_check_mode=False,111 )112 if not HAS_BOTO3:113 module.fail_json(msg="boto3 is required")114 try:115 region, ec2_url, aws_connect_kwargs = get_aws_connection_info(module, boto3=True)116 iam_cert = boto3_conn(module, conn_type='client', resource='iam',117 region=region, endpoint=ec2_url, **aws_connect_kwargs)118 except Exception as e:119 module.fail_json(msg="Can't authorize connection - %s " % str(e), exception=format_exc())120 certificate_name = module.params['certificate_name']121 path_prefix = module.params['path_prefix']122 if certificate_name:123 results = get_server_certificate(124 client=iam_cert, module=module, server_certificate_name=certificate_name)125 else:126 results = list_server_certificates(client=iam_cert, module=module, path_prefix=path_prefix)127 module.exit_json(**camel_dict_to_snake_dict(results))128if __name__ == '__main__':...

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