Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expose operations_client #640

Closed
busunkim96 opened this issue Oct 8, 2020 · 0 comments · Fixed by #645 or #1133
Closed

Expose operations_client #640

busunkim96 opened this issue Oct 8, 2020 · 0 comments · Fixed by #645 or #1133
Assignees
Labels
triage me I really want to be triaged.

Comments

@busunkim96
Copy link
Contributor

busunkim96 commented Oct 8, 2020

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?

@yoshi-automation yoshi-automation added the triage me I really want to be triaged. label Oct 9, 2020
software-dov added a commit to software-dov/gapic-generator-python that referenced this issue Oct 9, 2020
Sometimes it's useful to get a reference to the transport for a client object.

Closes googleapis#640
software-dov added a commit that referenced this issue Oct 9, 2020
Sometimes it's useful to get a reference to the transport for a client object.

Closes #640
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment