Google Cloud Certificate Manager

1.13.0 · active · verified Wed Apr 15

The `google-cloud-certificate-manager` library is the official Python client for the Google Cloud Certificate Manager API. It allows developers to programmatically acquire and manage TLS (SSL) certificates for use with Cloud Load Balancing. Currently at version 1.13.0, it is part of the larger `google-cloud-python` monorepo, which undergoes frequent updates, ensuring ongoing feature development and maintenance.

Warnings

Install

Imports

Quickstart

This quickstart demonstrates how to initialize the `CertificateManagerClient` and list existing certificates within a specified Google Cloud project and location. Ensure your `GOOGLE_CLOUD_PROJECT` environment variable is set or replace 'your-project-id' with your actual project ID. Authentication is handled automatically via Application Default Credentials (ADC) if configured.

import os
from google.cloud import certificate_manager_v1

# Set your Google Cloud Project ID
project_id = os.environ.get('GOOGLE_CLOUD_PROJECT', 'your-project-id')
location = 'global' # Certificate Manager resources are often global

def list_certificates():
    client = certificate_manager_v1.CertificateManagerClient()
    parent = client.common_location_path(project_id, location)

    print(f"Listing certificates in project {project_id} in location {location}:")
    try:
        for certificate in client.list_certificates(parent=parent):
            print(f"- Certificate: {certificate.name} (DNS names: {', '.join(certificate.managed.dns_authorizations or ['N/A'])})")
    except Exception as e:
        print(f"Error listing certificates: {e}")

if __name__ == "__main__":
    list_certificates()

view raw JSON →