Skip to content

Certificate type missing usedBy field in certificate_manager_v1 #17134

@mervin008

Description

@mervin008

Determine this is the right repository

  • I determined this is the correct repository in which to report this bug.

Summary of the issue

Context

I was trying to access the used_by field on a Certificate object returned by CertificateManagerClient.get_certificate() / list_certificates() to determine which resources (target HTTPS proxies, certificate map entries) are consuming a given certificate. The REST API (reference) exposes a usedBy[] field on the Certificate resource, but the Python client (reference) does not have the corresponding used_by attribute or UsedBy inner class.

Expected Behavior:

google.cloud.certificate_manager_v1.types.Certificate should expose a used_by repeated field of type Certificate.UsedBy, matching the REST API's usedBy[] field (field number 10). The UsedBy message should contain a name string field representing the full resource name (AIP-122) of the consuming resource.

Actual Behavior:

The Certificate type in google-cloud-certificate-manager does not have a used_by field or a UsedBy inner class. Accessing certificate.used_by raises AttributeError. Users must fall back to the REST API or gcloud CLI to determine which resources use a certificate.

API client name and version

google-cloud-certificate-manager v1.13.0

Reproduction steps: code

file: main.py

  from google.cloud import certificate_manager_v1

def reproduce():
    client = certificate_manager_v1.CertificateManagerClient()

    # List certificates in a project
    request = certificate_manager_v1.ListCertificatesRequest(
        parent="projects/my-project/locations/global"
    )
    for certificate in client.list_certificates(request=request):
        # Try to access used_by field - available in REST API but missing in Python client
        print(f"Certificate: {certificate.name}")
        print(f"Used by: {certificate.used_by}")  # AttributeError: no 'used_by'

reproduce()

Reproduction steps: supporting files

N/A — no additional files needed.

Reproduction steps: actual results

AttributeError: Unknown field for Certificate: used_by

The Certificate type does not expose the used_by field or the UsedBy inner class. The field is silently absent from the Python client, despite being present in the REST API and the RPC reference.

Reproduction steps: expected results

Certificate: projects/my-project/locations/global/certificates/my-cert
Used by: [name: "//compute.googleapis.com/projects/my-project/locations/global/targetHttpsProxies/my-proxy"]

The Certificate type should expose a used_by repeated field of type Certificate.UsedBy, matching the REST API's usedBy[] (field number 10).

OS & version + platform

No response

Python environment

Python 3.11.5

Python dependencies

google-cloud-certificate-manager 1.13.0

Additional context

The REST API Certificate resource defines usedBy[] as an output-only repeated field of type UsedBy, which contains a single name string field representing the full resource name of the consuming resource (e.g. target HTTPS proxy or certificate map entry).

The Python client reference does not list this field, making it impossible to determine which resources consume a certificate without falling back to the REST API or gcloud CLI.

Metadata

Metadata

Assignees

No one assigned

    Labels

    triage meI really want to be triaged.type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions