Skip to content

Commit 106aa18

Browse files
chore: use gapic-generator-python 0.63.2 (#182)
* chore: use gapic-generator-python 0.63.2 docs: add generated snippets PiperOrigin-RevId: 427792504 Source-Link: googleapis/googleapis@55b9e1e Source-Link: googleapis/googleapis-gen@bf4e86b Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiYmY0ZTg2Yjc1M2Y0MmNiMGVkYjFmZDUxZmJlODQwZDdkYTBhMWNkZSJ9 * 🦉 Updates from OwlBot See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
1 parent c00037b commit 106aa18

16 files changed

+1108
-0
lines changed

packages/google-cloud-trace/google/cloud/trace_v1/services/trace_service/async_client.py

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,27 @@ async def list_traces(
214214
r"""Returns of a list of traces that match the specified
215215
filter conditions.
216216
217+
218+
.. code-block::
219+
220+
from google.cloud import trace_v1
221+
222+
def sample_list_traces():
223+
# Create a client
224+
client = trace_v1.TraceServiceClient()
225+
226+
# Initialize request argument(s)
227+
request = trace_v1.ListTracesRequest(
228+
project_id="project_id_value",
229+
)
230+
231+
# Make the request
232+
page_result = client.list_traces(request=request)
233+
234+
# Handle the response
235+
for response in page_result:
236+
print(response)
237+
217238
Args:
218239
request (Union[google.cloud.trace_v1.types.ListTracesRequest, dict]):
219240
The request object. The request message for the
@@ -299,6 +320,26 @@ async def get_trace(
299320
) -> trace.Trace:
300321
r"""Gets a single trace by its ID.
301322
323+
.. code-block::
324+
325+
from google.cloud import trace_v1
326+
327+
def sample_get_trace():
328+
# Create a client
329+
client = trace_v1.TraceServiceClient()
330+
331+
# Initialize request argument(s)
332+
request = trace_v1.GetTraceRequest(
333+
project_id="project_id_value",
334+
trace_id="trace_id_value",
335+
)
336+
337+
# Make the request
338+
response = client.get_trace(request=request)
339+
340+
# Handle the response
341+
print(response)
342+
302343
Args:
303344
request (Union[google.cloud.trace_v1.types.GetTraceRequest, dict]):
304345
The request object. The request message for the
@@ -391,6 +432,23 @@ async def patch_traces(
391432
with the existing trace data. If the ID does not match,
392433
a new trace is created.
393434
435+
436+
.. code-block::
437+
438+
from google.cloud import trace_v1
439+
440+
def sample_patch_traces():
441+
# Create a client
442+
client = trace_v1.TraceServiceClient()
443+
444+
# Initialize request argument(s)
445+
request = trace_v1.PatchTracesRequest(
446+
project_id="project_id_value",
447+
)
448+
449+
# Make the request
450+
client.patch_traces(request=request)
451+
394452
Args:
395453
request (Union[google.cloud.trace_v1.types.PatchTracesRequest, dict]):
396454
The request object. The request message for the

packages/google-cloud-trace/google/cloud/trace_v1/services/trace_service/client.py

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -399,6 +399,28 @@ def list_traces(
399399
r"""Returns of a list of traces that match the specified
400400
filter conditions.
401401
402+
403+
404+
.. code-block::
405+
406+
from google.cloud import trace_v1
407+
408+
def sample_list_traces():
409+
# Create a client
410+
client = trace_v1.TraceServiceClient()
411+
412+
# Initialize request argument(s)
413+
request = trace_v1.ListTracesRequest(
414+
project_id="project_id_value",
415+
)
416+
417+
# Make the request
418+
page_result = client.list_traces(request=request)
419+
420+
# Handle the response
421+
for response in page_result:
422+
print(response)
423+
402424
Args:
403425
request (Union[google.cloud.trace_v1.types.ListTracesRequest, dict]):
404426
The request object. The request message for the
@@ -474,6 +496,27 @@ def get_trace(
474496
) -> trace.Trace:
475497
r"""Gets a single trace by its ID.
476498
499+
500+
.. code-block::
501+
502+
from google.cloud import trace_v1
503+
504+
def sample_get_trace():
505+
# Create a client
506+
client = trace_v1.TraceServiceClient()
507+
508+
# Initialize request argument(s)
509+
request = trace_v1.GetTraceRequest(
510+
project_id="project_id_value",
511+
trace_id="trace_id_value",
512+
)
513+
514+
# Make the request
515+
response = client.get_trace(request=request)
516+
517+
# Handle the response
518+
print(response)
519+
477520
Args:
478521
request (Union[google.cloud.trace_v1.types.GetTraceRequest, dict]):
479522
The request object. The request message for the
@@ -556,6 +599,24 @@ def patch_traces(
556599
with the existing trace data. If the ID does not match,
557600
a new trace is created.
558601
602+
603+
604+
.. code-block::
605+
606+
from google.cloud import trace_v1
607+
608+
def sample_patch_traces():
609+
# Create a client
610+
client = trace_v1.TraceServiceClient()
611+
612+
# Initialize request argument(s)
613+
request = trace_v1.PatchTracesRequest(
614+
project_id="project_id_value",
615+
)
616+
617+
# Make the request
618+
client.patch_traces(request=request)
619+
559620
Args:
560621
request (Union[google.cloud.trace_v1.types.PatchTracesRequest, dict]):
561622
The request object. The request message for the

packages/google-cloud-trace/google/cloud/trace_v2/services/trace_service/async_client.py

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,28 @@ async def batch_write_spans(
220220
r"""Sends new spans to new or existing traces. You cannot
221221
update existing spans.
222222
223+
224+
.. code-block::
225+
226+
from google.cloud import trace_v2
227+
228+
def sample_batch_write_spans():
229+
# Create a client
230+
client = trace_v2.TraceServiceClient()
231+
232+
# Initialize request argument(s)
233+
spans = trace_v2.Span()
234+
spans.name = "name_value"
235+
spans.span_id = "span_id_value"
236+
237+
request = trace_v2.BatchWriteSpansRequest(
238+
name="name_value",
239+
spans=spans,
240+
)
241+
242+
# Make the request
243+
client.batch_write_spans(request=request)
244+
223245
Args:
224246
request (Union[google.cloud.trace_v2.types.BatchWriteSpansRequest, dict]):
225247
The request object. The request message for the
@@ -293,6 +315,26 @@ async def create_span(
293315
) -> trace.Span:
294316
r"""Creates a new span.
295317
318+
.. code-block::
319+
320+
from google.cloud import trace_v2
321+
322+
def sample_create_span():
323+
# Create a client
324+
client = trace_v2.TraceServiceClient()
325+
326+
# Initialize request argument(s)
327+
request = trace_v2.Span(
328+
name="name_value",
329+
span_id="span_id_value",
330+
)
331+
332+
# Make the request
333+
response = client.create_span(request=request)
334+
335+
# Handle the response
336+
print(response)
337+
296338
Args:
297339
request (Union[google.cloud.trace_v2.types.Span, dict]):
298340
The request object. A span represents a single operation

packages/google-cloud-trace/google/cloud/trace_v2/services/trace_service/client.py

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -419,6 +419,29 @@ def batch_write_spans(
419419
r"""Sends new spans to new or existing traces. You cannot
420420
update existing spans.
421421
422+
423+
424+
.. code-block::
425+
426+
from google.cloud import trace_v2
427+
428+
def sample_batch_write_spans():
429+
# Create a client
430+
client = trace_v2.TraceServiceClient()
431+
432+
# Initialize request argument(s)
433+
spans = trace_v2.Span()
434+
spans.name = "name_value"
435+
spans.span_id = "span_id_value"
436+
437+
request = trace_v2.BatchWriteSpansRequest(
438+
name="name_value",
439+
spans=spans,
440+
)
441+
442+
# Make the request
443+
client.batch_write_spans(request=request)
444+
422445
Args:
423446
request (Union[google.cloud.trace_v2.types.BatchWriteSpansRequest, dict]):
424447
The request object. The request message for the
@@ -492,6 +515,27 @@ def create_span(
492515
) -> trace.Span:
493516
r"""Creates a new span.
494517
518+
519+
.. code-block::
520+
521+
from google.cloud import trace_v2
522+
523+
def sample_create_span():
524+
# Create a client
525+
client = trace_v2.TraceServiceClient()
526+
527+
# Initialize request argument(s)
528+
request = trace_v2.Span(
529+
name="name_value",
530+
span_id="span_id_value",
531+
)
532+
533+
# Make the request
534+
response = client.create_span(request=request)
535+
536+
# Handle the response
537+
print(response)
538+
495539
Args:
496540
request (Union[google.cloud.trace_v2.types.Span, dict]):
497541
The request object. A span represents a single operation
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
# -*- coding: utf-8 -*-
2+
# Copyright 2020 Google LLC
3+
#
4+
# Licensed under the Apache License, Version 2.0 (the "License");
5+
# you may not use this file except in compliance with the License.
6+
# You may obtain a copy of the License at
7+
#
8+
# http://www.apache.org/licenses/LICENSE-2.0
9+
#
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
# See the License for the specific language governing permissions and
14+
# limitations under the License.
15+
#
16+
# Generated code. DO NOT EDIT!
17+
#
18+
# Snippet for GetTrace
19+
# NOTE: This snippet has been automatically generated for illustrative purposes only.
20+
# It may require modifications to work in your environment.
21+
22+
# To install the latest published package dependency, execute the following:
23+
# python3 -m pip install google-cloud-trace
24+
25+
26+
# [START cloudtrace_generated_trace_v1_TraceService_GetTrace_async]
27+
from google.cloud import trace_v1
28+
29+
30+
async def sample_get_trace():
31+
# Create a client
32+
client = trace_v1.TraceServiceAsyncClient()
33+
34+
# Initialize request argument(s)
35+
request = trace_v1.GetTraceRequest(
36+
project_id="project_id_value",
37+
trace_id="trace_id_value",
38+
)
39+
40+
# Make the request
41+
response = await client.get_trace(request=request)
42+
43+
# Handle the response
44+
print(response)
45+
46+
# [END cloudtrace_generated_trace_v1_TraceService_GetTrace_async]
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
# -*- coding: utf-8 -*-
2+
# Copyright 2020 Google LLC
3+
#
4+
# Licensed under the Apache License, Version 2.0 (the "License");
5+
# you may not use this file except in compliance with the License.
6+
# You may obtain a copy of the License at
7+
#
8+
# http://www.apache.org/licenses/LICENSE-2.0
9+
#
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
# See the License for the specific language governing permissions and
14+
# limitations under the License.
15+
#
16+
# Generated code. DO NOT EDIT!
17+
#
18+
# Snippet for GetTrace
19+
# NOTE: This snippet has been automatically generated for illustrative purposes only.
20+
# It may require modifications to work in your environment.
21+
22+
# To install the latest published package dependency, execute the following:
23+
# python3 -m pip install google-cloud-trace
24+
25+
26+
# [START cloudtrace_generated_trace_v1_TraceService_GetTrace_sync]
27+
from google.cloud import trace_v1
28+
29+
30+
def sample_get_trace():
31+
# Create a client
32+
client = trace_v1.TraceServiceClient()
33+
34+
# Initialize request argument(s)
35+
request = trace_v1.GetTraceRequest(
36+
project_id="project_id_value",
37+
trace_id="trace_id_value",
38+
)
39+
40+
# Make the request
41+
response = client.get_trace(request=request)
42+
43+
# Handle the response
44+
print(response)
45+
46+
# [END cloudtrace_generated_trace_v1_TraceService_GetTrace_sync]

0 commit comments

Comments
 (0)