Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Expose operations_client #640

Closed
@busunkim96

Description

@busunkim96

To use the operations client that you have to go through client._transport. It feels weird to recommend using a variable that looks like it's intended for internal use only.

Published AutoML sample: https://github.com/googleapis/python-automl/blob/master/samples/snippets/get_operation_status.py

def get_operation_status(operation_full_id):
    """Get operation status."""
    # [START automl_get_operation_status]
    from google.cloud import automl

    # TODO(developer): Uncomment and set the following variables
    # operation_full_id = \
    #     "projects/[projectId]/locations/us-central1/operations/[operationId]"

    client = automl.AutoMlClient()
    # Get the latest state of a long-running operation.
    response = client._transport.operations_client.get_operation(
        operation_full_id
    )

    print("Name: {}".format(response.name))
    print("Operation details:")
    print(response)
    # [END automl_get_operation_status]

It looks like the old generator lefttransport public. Was that changed intentionally? https://github.com/googleapis/gapic-generator/blob/17fbb3b38a20d13e69879d845a045dc1f8448a3d/src/test/java/com/google/api/codegen/gapic/testdata/py/python_multiple_services.baseline#L999

If we want to keep transport private, could we make operations_client public somewhere else?

Metadata

Metadata

Assignees

Labels

triage meI really want to be triaged.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions