Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 2 additions & 11 deletions gapic/templates/examples/feature_fragments.j2
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ request=request
{# Note: this doesn't deal with enums or unions #}
{# LROs return operation objects and paged requests return pager objects #}
{% if transport == "grpc-async" and calling_form not in
[calling_form_enum.LongRunningRequestPromise, calling_form_enum.RequestPagedAll] %}
[calling_form_enum.RequestPaged, calling_form_enum.RequestPagedAll] %}
await{{ " "}}
{%- endif -%}
{% if calling_form in [calling_form_enum.RequestStreamingBidi,
Expand All @@ -242,13 +242,6 @@ client.{{ render_method_name(sample)|trim }}({{ render_request_params_unary(samp
{% endif %}
{% endmacro %}

{% macro operation_text(transport) %}
{% if transport == "grpc-async" %}
(await operation)
{% else %}
operation
{% endif %}
{% endmacro %}

{# Setting up the method invocation is the responsibility of the caller: #}
{# it's just easier to set up client side streaming and other things from outside this macro. #}
Expand Down Expand Up @@ -294,9 +287,7 @@ operation = {{ method_invocation_text|trim }}

print("Waiting for operation to complete...")

{% with operation_text = operation_text(transport) %}
response = {{ operation_text|trim }}.result()
{% endwith %}
response = {% if transport == "grpc-async" %}await {% endif %}operation.result()

# Handle the response
{% for statement in response_statements %}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -322,11 +322,11 @@ async def sample_export_assets():
)
# Make the request
operation = client.export_assets(request=request)
operation = await client.export_assets(request=request)
print("Waiting for operation to complete...")
response = (await operation).result()
response = await operation.result()
# Handle the response
print(response)
Expand Down Expand Up @@ -1727,11 +1727,11 @@ async def sample_analyze_iam_policy_longrunning():
)
# Make the request
operation = client.analyze_iam_policy_longrunning(request=request)
operation = await client.analyze_iam_policy_longrunning(request=request)
print("Waiting for operation to complete...")
response = (await operation).result()
response = await operation.result()
# Handle the response
print(response)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,11 @@ async def sample_analyze_iam_policy_longrunning():
)

# Make the request
operation = client.analyze_iam_policy_longrunning(request=request)
operation = await client.analyze_iam_policy_longrunning(request=request)

print("Waiting for operation to complete...")

response = (await operation).result()
response = await operation.result()

# Handle the response
print(response)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,11 @@ async def sample_export_assets():
)

# Make the request
operation = client.export_assets(request=request)
operation = await client.export_assets(request=request)

print("Waiting for operation to complete...")

response = (await operation).result()
response = await operation.result()

# Handle the response
print(response)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -564,11 +564,11 @@ async def sample_create_trigger():
)
# Make the request
operation = client.create_trigger(request=request)
operation = await client.create_trigger(request=request)
print("Waiting for operation to complete...")
response = (await operation).result()
response = await operation.result()
# Handle the response
print(response)
Expand Down Expand Up @@ -703,11 +703,11 @@ async def sample_update_trigger():
)
# Make the request
operation = client.update_trigger(request=request)
operation = await client.update_trigger(request=request)
print("Waiting for operation to complete...")
response = (await operation).result()
response = await operation.result()
# Handle the response
print(response)
Expand Down Expand Up @@ -845,11 +845,11 @@ async def sample_delete_trigger():
)
# Make the request
operation = client.delete_trigger(request=request)
operation = await client.delete_trigger(request=request)
print("Waiting for operation to complete...")
response = (await operation).result()
response = await operation.result()
# Handle the response
print(response)
Expand Down Expand Up @@ -1218,11 +1218,11 @@ async def sample_create_channel():
)
# Make the request
operation = client.create_channel(request=request)
operation = await client.create_channel(request=request)
print("Waiting for operation to complete...")
response = (await operation).result()
response = await operation.result()
# Handle the response
print(response)
Expand Down Expand Up @@ -1359,11 +1359,11 @@ async def sample_update_channel():
)
# Make the request
operation = client.update_channel(request=request)
operation = await client.update_channel(request=request)
print("Waiting for operation to complete...")
response = (await operation).result()
response = await operation.result()
# Handle the response
print(response)
Expand Down Expand Up @@ -1493,11 +1493,11 @@ async def sample_delete_channel():
)
# Make the request
operation = client.delete_channel(request=request)
operation = await client.delete_channel(request=request)
print("Waiting for operation to complete...")
response = (await operation).result()
response = await operation.result()
# Handle the response
print(response)
Expand Down Expand Up @@ -2084,11 +2084,11 @@ async def sample_create_channel_connection():
)
# Make the request
operation = client.create_channel_connection(request=request)
operation = await client.create_channel_connection(request=request)
print("Waiting for operation to complete...")
response = (await operation).result()
response = await operation.result()
# Handle the response
print(response)
Expand Down Expand Up @@ -2225,11 +2225,11 @@ async def sample_delete_channel_connection():
)
# Make the request
operation = client.delete_channel_connection(request=request)
operation = await client.delete_channel_connection(request=request)
print("Waiting for operation to complete...")
response = (await operation).result()
response = await operation.result()
# Handle the response
print(response)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,11 @@ async def sample_create_channel():
)

# Make the request
operation = client.create_channel(request=request)
operation = await client.create_channel(request=request)

print("Waiting for operation to complete...")

response = (await operation).result()
response = await operation.result()

# Handle the response
print(response)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,11 @@ async def sample_create_channel_connection():
)

# Make the request
operation = client.create_channel_connection(request=request)
operation = await client.create_channel_connection(request=request)

print("Waiting for operation to complete...")

response = (await operation).result()
response = await operation.result()

# Handle the response
print(response)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,11 @@ async def sample_create_trigger():
)

# Make the request
operation = client.create_trigger(request=request)
operation = await client.create_trigger(request=request)

print("Waiting for operation to complete...")

response = (await operation).result()
response = await operation.result()

# Handle the response
print(response)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,11 @@ async def sample_delete_channel():
)

# Make the request
operation = client.delete_channel(request=request)
operation = await client.delete_channel(request=request)

print("Waiting for operation to complete...")

response = (await operation).result()
response = await operation.result()

# Handle the response
print(response)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,11 @@ async def sample_delete_channel_connection():
)

# Make the request
operation = client.delete_channel_connection(request=request)
operation = await client.delete_channel_connection(request=request)

print("Waiting for operation to complete...")

response = (await operation).result()
response = await operation.result()

# Handle the response
print(response)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,11 @@ async def sample_delete_trigger():
)

# Make the request
operation = client.delete_trigger(request=request)
operation = await client.delete_trigger(request=request)

print("Waiting for operation to complete...")

response = (await operation).result()
response = await operation.result()

# Handle the response
print(response)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,11 @@ async def sample_update_channel():
)

# Make the request
operation = client.update_channel(request=request)
operation = await client.update_channel(request=request)

print("Waiting for operation to complete...")

response = (await operation).result()
response = await operation.result()

# Handle the response
print(response)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,11 @@ async def sample_update_trigger():
)

# Make the request
operation = client.update_trigger(request=request)
operation = await client.update_trigger(request=request)

print("Waiting for operation to complete...")

response = (await operation).result()
response = await operation.result()

# Handle the response
print(response)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -520,11 +520,11 @@ async def sample_create_bucket_async():
)
# Make the request
operation = client.create_bucket_async(request=request)
operation = await client.create_bucket_async(request=request)
print("Waiting for operation to complete...")
response = (await operation).result()
response = await operation.result()
# Handle the response
print(response)
Expand Down Expand Up @@ -625,11 +625,11 @@ async def sample_update_bucket_async():
)
# Make the request
operation = client.update_bucket_async(request=request)
operation = await client.update_bucket_async(request=request)
print("Waiting for operation to complete...")
response = (await operation).result()
response = await operation.result()
# Handle the response
print(response)
Expand Down Expand Up @@ -2177,11 +2177,11 @@ async def sample_create_link():
)
# Make the request
operation = client.create_link(request=request)
operation = await client.create_link(request=request)
print("Waiting for operation to complete...")
response = (await operation).result()
response = await operation.result()
# Handle the response
print(response)
Expand Down Expand Up @@ -2322,11 +2322,11 @@ async def sample_delete_link():
)
# Make the request
operation = client.delete_link(request=request)
operation = await client.delete_link(request=request)
print("Waiting for operation to complete...")
response = (await operation).result()
response = await operation.result()
# Handle the response
print(response)
Expand Down Expand Up @@ -3840,11 +3840,11 @@ async def sample_copy_log_entries():
)
# Make the request
operation = client.copy_log_entries(request=request)
operation = await client.copy_log_entries(request=request)
print("Waiting for operation to complete...")
response = (await operation).result()
response = await operation.result()
# Handle the response
print(response)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,11 @@ async def sample_copy_log_entries():
)

# Make the request
operation = client.copy_log_entries(request=request)
operation = await client.copy_log_entries(request=request)

print("Waiting for operation to complete...")

response = (await operation).result()
response = await operation.result()

# Handle the response
print(response)
Expand Down
Loading
Loading