Source code for ads.opctl.distributed.certificates
#!/usr/bin/env python# -*- coding: utf-8; -*-# Copyright (c) 2022 Oracle and/or its affiliates.# Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl/importociimportos
[docs]defdownload_certificates(auth,ca_file_name,cert_file_name,key_file_name):""" """client=oci.certificates.CertificatesClient(**auth)# Download Cert and Private Keyprint("Fetching certificate details")response=client.get_certificate_bundle(certificate_id=os.environ["OCI__CERTIFICATE_OCID"],certificate_bundle_type="CERTIFICATE_CONTENT_WITH_PRIVATE_KEY",)withopen(cert_file_name,"w")asf:print(f"writing {cert_file_name}")f.write(response.data.certificate_pem)withopen(key_file_name,"w")asf:print(f"writing {key_file_name}")f.write(response.data.private_key_pem)# Download CA Certresponse=client.get_certificate_authority_bundle(certificate_authority_id=os.environ["OCI__CERTIFICATE_AUTHORITY_OCID"])withopen(ca_file_name,"w")asf:print(f"writing {ca_file_name}")f.write(response.data.cert_chain_pem)