From 106aa18b39c74b234a0cb668b79ce39985611a39 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Fri, 11 Feb 2022 15:33:21 -0700 Subject: [PATCH] chore: use gapic-generator-python 0.63.2 (#182) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * chore: use gapic-generator-python 0.63.2 docs: add generated snippets PiperOrigin-RevId: 427792504 Source-Link: https://github.com/googleapis/googleapis/commit/55b9e1e0b3106c850d13958352bc0751147b6b15 Source-Link: https://github.com/googleapis/googleapis-gen/commit/bf4e86b753f42cb0edb1fd51fbe840d7da0a1cde 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 --- .../services/trace_service/async_client.py | 58 ++++ .../trace_v1/services/trace_service/client.py | 61 ++++ .../services/trace_service/async_client.py | 42 +++ .../trace_v2/services/trace_service/client.py | 44 +++ ..._trace_v1_trace_service_get_trace_async.py | 46 +++ ...d_trace_v1_trace_service_get_trace_sync.py | 46 +++ ...race_v1_trace_service_list_traces_async.py | 46 +++ ...trace_v1_trace_service_list_traces_sync.py | 46 +++ ...ace_v1_trace_service_patch_traces_async.py | 43 +++ ...race_v1_trace_service_patch_traces_sync.py | 43 +++ ...2_trace_service_batch_write_spans_async.py | 48 ++++ ...v2_trace_service_batch_write_spans_sync.py | 48 ++++ ...race_v2_trace_service_create_span_async.py | 46 +++ ...trace_v2_trace_service_create_span_sync.py | 46 +++ .../snippet_metadata_trace_v1.json | 267 ++++++++++++++++++ .../snippet_metadata_trace_v2.json | 178 ++++++++++++ 16 files changed, 1108 insertions(+) create mode 100644 packages/google-cloud-trace/samples/generated_samples/cloudtrace_generated_trace_v1_trace_service_get_trace_async.py create mode 100644 packages/google-cloud-trace/samples/generated_samples/cloudtrace_generated_trace_v1_trace_service_get_trace_sync.py create mode 100644 packages/google-cloud-trace/samples/generated_samples/cloudtrace_generated_trace_v1_trace_service_list_traces_async.py create mode 100644 packages/google-cloud-trace/samples/generated_samples/cloudtrace_generated_trace_v1_trace_service_list_traces_sync.py create mode 100644 packages/google-cloud-trace/samples/generated_samples/cloudtrace_generated_trace_v1_trace_service_patch_traces_async.py create mode 100644 packages/google-cloud-trace/samples/generated_samples/cloudtrace_generated_trace_v1_trace_service_patch_traces_sync.py create mode 100644 packages/google-cloud-trace/samples/generated_samples/cloudtrace_generated_trace_v2_trace_service_batch_write_spans_async.py create mode 100644 packages/google-cloud-trace/samples/generated_samples/cloudtrace_generated_trace_v2_trace_service_batch_write_spans_sync.py create mode 100644 packages/google-cloud-trace/samples/generated_samples/cloudtrace_generated_trace_v2_trace_service_create_span_async.py create mode 100644 packages/google-cloud-trace/samples/generated_samples/cloudtrace_generated_trace_v2_trace_service_create_span_sync.py create mode 100644 packages/google-cloud-trace/samples/generated_samples/snippet_metadata_trace_v1.json create mode 100644 packages/google-cloud-trace/samples/generated_samples/snippet_metadata_trace_v2.json diff --git a/packages/google-cloud-trace/google/cloud/trace_v1/services/trace_service/async_client.py b/packages/google-cloud-trace/google/cloud/trace_v1/services/trace_service/async_client.py index 422db0c9b53a..4bfc469c532c 100644 --- a/packages/google-cloud-trace/google/cloud/trace_v1/services/trace_service/async_client.py +++ b/packages/google-cloud-trace/google/cloud/trace_v1/services/trace_service/async_client.py @@ -214,6 +214,27 @@ async def list_traces( r"""Returns of a list of traces that match the specified filter conditions. + + .. code-block:: + + from google.cloud import trace_v1 + + def sample_list_traces(): + # Create a client + client = trace_v1.TraceServiceClient() + + # Initialize request argument(s) + request = trace_v1.ListTracesRequest( + project_id="project_id_value", + ) + + # Make the request + page_result = client.list_traces(request=request) + + # Handle the response + for response in page_result: + print(response) + Args: request (Union[google.cloud.trace_v1.types.ListTracesRequest, dict]): The request object. The request message for the @@ -299,6 +320,26 @@ async def get_trace( ) -> trace.Trace: r"""Gets a single trace by its ID. + .. code-block:: + + from google.cloud import trace_v1 + + def sample_get_trace(): + # Create a client + client = trace_v1.TraceServiceClient() + + # Initialize request argument(s) + request = trace_v1.GetTraceRequest( + project_id="project_id_value", + trace_id="trace_id_value", + ) + + # Make the request + response = client.get_trace(request=request) + + # Handle the response + print(response) + Args: request (Union[google.cloud.trace_v1.types.GetTraceRequest, dict]): The request object. The request message for the @@ -391,6 +432,23 @@ async def patch_traces( with the existing trace data. If the ID does not match, a new trace is created. + + .. code-block:: + + from google.cloud import trace_v1 + + def sample_patch_traces(): + # Create a client + client = trace_v1.TraceServiceClient() + + # Initialize request argument(s) + request = trace_v1.PatchTracesRequest( + project_id="project_id_value", + ) + + # Make the request + client.patch_traces(request=request) + Args: request (Union[google.cloud.trace_v1.types.PatchTracesRequest, dict]): The request object. The request message for the diff --git a/packages/google-cloud-trace/google/cloud/trace_v1/services/trace_service/client.py b/packages/google-cloud-trace/google/cloud/trace_v1/services/trace_service/client.py index ec22ddde56ad..1b83fe2bdfc0 100644 --- a/packages/google-cloud-trace/google/cloud/trace_v1/services/trace_service/client.py +++ b/packages/google-cloud-trace/google/cloud/trace_v1/services/trace_service/client.py @@ -399,6 +399,28 @@ def list_traces( r"""Returns of a list of traces that match the specified filter conditions. + + + .. code-block:: + + from google.cloud import trace_v1 + + def sample_list_traces(): + # Create a client + client = trace_v1.TraceServiceClient() + + # Initialize request argument(s) + request = trace_v1.ListTracesRequest( + project_id="project_id_value", + ) + + # Make the request + page_result = client.list_traces(request=request) + + # Handle the response + for response in page_result: + print(response) + Args: request (Union[google.cloud.trace_v1.types.ListTracesRequest, dict]): The request object. The request message for the @@ -474,6 +496,27 @@ def get_trace( ) -> trace.Trace: r"""Gets a single trace by its ID. + + .. code-block:: + + from google.cloud import trace_v1 + + def sample_get_trace(): + # Create a client + client = trace_v1.TraceServiceClient() + + # Initialize request argument(s) + request = trace_v1.GetTraceRequest( + project_id="project_id_value", + trace_id="trace_id_value", + ) + + # Make the request + response = client.get_trace(request=request) + + # Handle the response + print(response) + Args: request (Union[google.cloud.trace_v1.types.GetTraceRequest, dict]): The request object. The request message for the @@ -556,6 +599,24 @@ def patch_traces( with the existing trace data. If the ID does not match, a new trace is created. + + + .. code-block:: + + from google.cloud import trace_v1 + + def sample_patch_traces(): + # Create a client + client = trace_v1.TraceServiceClient() + + # Initialize request argument(s) + request = trace_v1.PatchTracesRequest( + project_id="project_id_value", + ) + + # Make the request + client.patch_traces(request=request) + Args: request (Union[google.cloud.trace_v1.types.PatchTracesRequest, dict]): The request object. The request message for the diff --git a/packages/google-cloud-trace/google/cloud/trace_v2/services/trace_service/async_client.py b/packages/google-cloud-trace/google/cloud/trace_v2/services/trace_service/async_client.py index b2f5f29d5e06..046d88344ec9 100644 --- a/packages/google-cloud-trace/google/cloud/trace_v2/services/trace_service/async_client.py +++ b/packages/google-cloud-trace/google/cloud/trace_v2/services/trace_service/async_client.py @@ -220,6 +220,28 @@ async def batch_write_spans( r"""Sends new spans to new or existing traces. You cannot update existing spans. + + .. code-block:: + + from google.cloud import trace_v2 + + def sample_batch_write_spans(): + # Create a client + client = trace_v2.TraceServiceClient() + + # Initialize request argument(s) + spans = trace_v2.Span() + spans.name = "name_value" + spans.span_id = "span_id_value" + + request = trace_v2.BatchWriteSpansRequest( + name="name_value", + spans=spans, + ) + + # Make the request + client.batch_write_spans(request=request) + Args: request (Union[google.cloud.trace_v2.types.BatchWriteSpansRequest, dict]): The request object. The request message for the @@ -293,6 +315,26 @@ async def create_span( ) -> trace.Span: r"""Creates a new span. + .. code-block:: + + from google.cloud import trace_v2 + + def sample_create_span(): + # Create a client + client = trace_v2.TraceServiceClient() + + # Initialize request argument(s) + request = trace_v2.Span( + name="name_value", + span_id="span_id_value", + ) + + # Make the request + response = client.create_span(request=request) + + # Handle the response + print(response) + Args: request (Union[google.cloud.trace_v2.types.Span, dict]): The request object. A span represents a single operation diff --git a/packages/google-cloud-trace/google/cloud/trace_v2/services/trace_service/client.py b/packages/google-cloud-trace/google/cloud/trace_v2/services/trace_service/client.py index b98d19a045df..d74f296f5c33 100644 --- a/packages/google-cloud-trace/google/cloud/trace_v2/services/trace_service/client.py +++ b/packages/google-cloud-trace/google/cloud/trace_v2/services/trace_service/client.py @@ -419,6 +419,29 @@ def batch_write_spans( r"""Sends new spans to new or existing traces. You cannot update existing spans. + + + .. code-block:: + + from google.cloud import trace_v2 + + def sample_batch_write_spans(): + # Create a client + client = trace_v2.TraceServiceClient() + + # Initialize request argument(s) + spans = trace_v2.Span() + spans.name = "name_value" + spans.span_id = "span_id_value" + + request = trace_v2.BatchWriteSpansRequest( + name="name_value", + spans=spans, + ) + + # Make the request + client.batch_write_spans(request=request) + Args: request (Union[google.cloud.trace_v2.types.BatchWriteSpansRequest, dict]): The request object. The request message for the @@ -492,6 +515,27 @@ def create_span( ) -> trace.Span: r"""Creates a new span. + + .. code-block:: + + from google.cloud import trace_v2 + + def sample_create_span(): + # Create a client + client = trace_v2.TraceServiceClient() + + # Initialize request argument(s) + request = trace_v2.Span( + name="name_value", + span_id="span_id_value", + ) + + # Make the request + response = client.create_span(request=request) + + # Handle the response + print(response) + Args: request (Union[google.cloud.trace_v2.types.Span, dict]): The request object. A span represents a single operation diff --git a/packages/google-cloud-trace/samples/generated_samples/cloudtrace_generated_trace_v1_trace_service_get_trace_async.py b/packages/google-cloud-trace/samples/generated_samples/cloudtrace_generated_trace_v1_trace_service_get_trace_async.py new file mode 100644 index 000000000000..c458d4f456cf --- /dev/null +++ b/packages/google-cloud-trace/samples/generated_samples/cloudtrace_generated_trace_v1_trace_service_get_trace_async.py @@ -0,0 +1,46 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for GetTrace +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-trace + + +# [START cloudtrace_generated_trace_v1_TraceService_GetTrace_async] +from google.cloud import trace_v1 + + +async def sample_get_trace(): + # Create a client + client = trace_v1.TraceServiceAsyncClient() + + # Initialize request argument(s) + request = trace_v1.GetTraceRequest( + project_id="project_id_value", + trace_id="trace_id_value", + ) + + # Make the request + response = await client.get_trace(request=request) + + # Handle the response + print(response) + +# [END cloudtrace_generated_trace_v1_TraceService_GetTrace_async] diff --git a/packages/google-cloud-trace/samples/generated_samples/cloudtrace_generated_trace_v1_trace_service_get_trace_sync.py b/packages/google-cloud-trace/samples/generated_samples/cloudtrace_generated_trace_v1_trace_service_get_trace_sync.py new file mode 100644 index 000000000000..2439ca6f474a --- /dev/null +++ b/packages/google-cloud-trace/samples/generated_samples/cloudtrace_generated_trace_v1_trace_service_get_trace_sync.py @@ -0,0 +1,46 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for GetTrace +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-trace + + +# [START cloudtrace_generated_trace_v1_TraceService_GetTrace_sync] +from google.cloud import trace_v1 + + +def sample_get_trace(): + # Create a client + client = trace_v1.TraceServiceClient() + + # Initialize request argument(s) + request = trace_v1.GetTraceRequest( + project_id="project_id_value", + trace_id="trace_id_value", + ) + + # Make the request + response = client.get_trace(request=request) + + # Handle the response + print(response) + +# [END cloudtrace_generated_trace_v1_TraceService_GetTrace_sync] diff --git a/packages/google-cloud-trace/samples/generated_samples/cloudtrace_generated_trace_v1_trace_service_list_traces_async.py b/packages/google-cloud-trace/samples/generated_samples/cloudtrace_generated_trace_v1_trace_service_list_traces_async.py new file mode 100644 index 000000000000..6c7549724947 --- /dev/null +++ b/packages/google-cloud-trace/samples/generated_samples/cloudtrace_generated_trace_v1_trace_service_list_traces_async.py @@ -0,0 +1,46 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for ListTraces +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-trace + + +# [START cloudtrace_generated_trace_v1_TraceService_ListTraces_async] +from google.cloud import trace_v1 + + +async def sample_list_traces(): + # Create a client + client = trace_v1.TraceServiceAsyncClient() + + # Initialize request argument(s) + request = trace_v1.ListTracesRequest( + project_id="project_id_value", + ) + + # Make the request + page_result = client.list_traces(request=request) + + # Handle the response + async for response in page_result: + print(response) + +# [END cloudtrace_generated_trace_v1_TraceService_ListTraces_async] diff --git a/packages/google-cloud-trace/samples/generated_samples/cloudtrace_generated_trace_v1_trace_service_list_traces_sync.py b/packages/google-cloud-trace/samples/generated_samples/cloudtrace_generated_trace_v1_trace_service_list_traces_sync.py new file mode 100644 index 000000000000..5a4ab7f16ace --- /dev/null +++ b/packages/google-cloud-trace/samples/generated_samples/cloudtrace_generated_trace_v1_trace_service_list_traces_sync.py @@ -0,0 +1,46 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for ListTraces +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-trace + + +# [START cloudtrace_generated_trace_v1_TraceService_ListTraces_sync] +from google.cloud import trace_v1 + + +def sample_list_traces(): + # Create a client + client = trace_v1.TraceServiceClient() + + # Initialize request argument(s) + request = trace_v1.ListTracesRequest( + project_id="project_id_value", + ) + + # Make the request + page_result = client.list_traces(request=request) + + # Handle the response + for response in page_result: + print(response) + +# [END cloudtrace_generated_trace_v1_TraceService_ListTraces_sync] diff --git a/packages/google-cloud-trace/samples/generated_samples/cloudtrace_generated_trace_v1_trace_service_patch_traces_async.py b/packages/google-cloud-trace/samples/generated_samples/cloudtrace_generated_trace_v1_trace_service_patch_traces_async.py new file mode 100644 index 000000000000..f98d84dc4fad --- /dev/null +++ b/packages/google-cloud-trace/samples/generated_samples/cloudtrace_generated_trace_v1_trace_service_patch_traces_async.py @@ -0,0 +1,43 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for PatchTraces +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-trace + + +# [START cloudtrace_generated_trace_v1_TraceService_PatchTraces_async] +from google.cloud import trace_v1 + + +async def sample_patch_traces(): + # Create a client + client = trace_v1.TraceServiceAsyncClient() + + # Initialize request argument(s) + request = trace_v1.PatchTracesRequest( + project_id="project_id_value", + ) + + # Make the request + await client.patch_traces(request=request) + + +# [END cloudtrace_generated_trace_v1_TraceService_PatchTraces_async] diff --git a/packages/google-cloud-trace/samples/generated_samples/cloudtrace_generated_trace_v1_trace_service_patch_traces_sync.py b/packages/google-cloud-trace/samples/generated_samples/cloudtrace_generated_trace_v1_trace_service_patch_traces_sync.py new file mode 100644 index 000000000000..22a3d77b79c7 --- /dev/null +++ b/packages/google-cloud-trace/samples/generated_samples/cloudtrace_generated_trace_v1_trace_service_patch_traces_sync.py @@ -0,0 +1,43 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for PatchTraces +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-trace + + +# [START cloudtrace_generated_trace_v1_TraceService_PatchTraces_sync] +from google.cloud import trace_v1 + + +def sample_patch_traces(): + # Create a client + client = trace_v1.TraceServiceClient() + + # Initialize request argument(s) + request = trace_v1.PatchTracesRequest( + project_id="project_id_value", + ) + + # Make the request + client.patch_traces(request=request) + + +# [END cloudtrace_generated_trace_v1_TraceService_PatchTraces_sync] diff --git a/packages/google-cloud-trace/samples/generated_samples/cloudtrace_generated_trace_v2_trace_service_batch_write_spans_async.py b/packages/google-cloud-trace/samples/generated_samples/cloudtrace_generated_trace_v2_trace_service_batch_write_spans_async.py new file mode 100644 index 000000000000..e5e9e5ab5d65 --- /dev/null +++ b/packages/google-cloud-trace/samples/generated_samples/cloudtrace_generated_trace_v2_trace_service_batch_write_spans_async.py @@ -0,0 +1,48 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for BatchWriteSpans +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-trace + + +# [START cloudtrace_generated_trace_v2_TraceService_BatchWriteSpans_async] +from google.cloud import trace_v2 + + +async def sample_batch_write_spans(): + # Create a client + client = trace_v2.TraceServiceAsyncClient() + + # Initialize request argument(s) + spans = trace_v2.Span() + spans.name = "name_value" + spans.span_id = "span_id_value" + + request = trace_v2.BatchWriteSpansRequest( + name="name_value", + spans=spans, + ) + + # Make the request + await client.batch_write_spans(request=request) + + +# [END cloudtrace_generated_trace_v2_TraceService_BatchWriteSpans_async] diff --git a/packages/google-cloud-trace/samples/generated_samples/cloudtrace_generated_trace_v2_trace_service_batch_write_spans_sync.py b/packages/google-cloud-trace/samples/generated_samples/cloudtrace_generated_trace_v2_trace_service_batch_write_spans_sync.py new file mode 100644 index 000000000000..2cca7e84f9e3 --- /dev/null +++ b/packages/google-cloud-trace/samples/generated_samples/cloudtrace_generated_trace_v2_trace_service_batch_write_spans_sync.py @@ -0,0 +1,48 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for BatchWriteSpans +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-trace + + +# [START cloudtrace_generated_trace_v2_TraceService_BatchWriteSpans_sync] +from google.cloud import trace_v2 + + +def sample_batch_write_spans(): + # Create a client + client = trace_v2.TraceServiceClient() + + # Initialize request argument(s) + spans = trace_v2.Span() + spans.name = "name_value" + spans.span_id = "span_id_value" + + request = trace_v2.BatchWriteSpansRequest( + name="name_value", + spans=spans, + ) + + # Make the request + client.batch_write_spans(request=request) + + +# [END cloudtrace_generated_trace_v2_TraceService_BatchWriteSpans_sync] diff --git a/packages/google-cloud-trace/samples/generated_samples/cloudtrace_generated_trace_v2_trace_service_create_span_async.py b/packages/google-cloud-trace/samples/generated_samples/cloudtrace_generated_trace_v2_trace_service_create_span_async.py new file mode 100644 index 000000000000..483deac0dc05 --- /dev/null +++ b/packages/google-cloud-trace/samples/generated_samples/cloudtrace_generated_trace_v2_trace_service_create_span_async.py @@ -0,0 +1,46 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for CreateSpan +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-trace + + +# [START cloudtrace_generated_trace_v2_TraceService_CreateSpan_async] +from google.cloud import trace_v2 + + +async def sample_create_span(): + # Create a client + client = trace_v2.TraceServiceAsyncClient() + + # Initialize request argument(s) + request = trace_v2.Span( + name="name_value", + span_id="span_id_value", + ) + + # Make the request + response = await client.create_span(request=request) + + # Handle the response + print(response) + +# [END cloudtrace_generated_trace_v2_TraceService_CreateSpan_async] diff --git a/packages/google-cloud-trace/samples/generated_samples/cloudtrace_generated_trace_v2_trace_service_create_span_sync.py b/packages/google-cloud-trace/samples/generated_samples/cloudtrace_generated_trace_v2_trace_service_create_span_sync.py new file mode 100644 index 000000000000..338261b85380 --- /dev/null +++ b/packages/google-cloud-trace/samples/generated_samples/cloudtrace_generated_trace_v2_trace_service_create_span_sync.py @@ -0,0 +1,46 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for CreateSpan +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-trace + + +# [START cloudtrace_generated_trace_v2_TraceService_CreateSpan_sync] +from google.cloud import trace_v2 + + +def sample_create_span(): + # Create a client + client = trace_v2.TraceServiceClient() + + # Initialize request argument(s) + request = trace_v2.Span( + name="name_value", + span_id="span_id_value", + ) + + # Make the request + response = client.create_span(request=request) + + # Handle the response + print(response) + +# [END cloudtrace_generated_trace_v2_TraceService_CreateSpan_sync] diff --git a/packages/google-cloud-trace/samples/generated_samples/snippet_metadata_trace_v1.json b/packages/google-cloud-trace/samples/generated_samples/snippet_metadata_trace_v1.json new file mode 100644 index 000000000000..8e55b812e6be --- /dev/null +++ b/packages/google-cloud-trace/samples/generated_samples/snippet_metadata_trace_v1.json @@ -0,0 +1,267 @@ +{ + "snippets": [ + { + "clientMethod": { + "async": true, + "method": { + "service": { + "shortName": "TraceService" + }, + "shortName": "GetTrace" + } + }, + "file": "cloudtrace_generated_trace_v1_trace_service_get_trace_async.py", + "regionTag": "cloudtrace_generated_trace_v1_TraceService_GetTrace_async", + "segments": [ + { + "end": 45, + "start": 27, + "type": "FULL" + }, + { + "end": 45, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 39, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 42, + "start": 40, + "type": "REQUEST_EXECUTION" + }, + { + "end": 46, + "start": 43, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "method": { + "service": { + "shortName": "TraceService" + }, + "shortName": "GetTrace" + } + }, + "file": "cloudtrace_generated_trace_v1_trace_service_get_trace_sync.py", + "regionTag": "cloudtrace_generated_trace_v1_TraceService_GetTrace_sync", + "segments": [ + { + "end": 45, + "start": 27, + "type": "FULL" + }, + { + "end": 45, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 39, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 42, + "start": 40, + "type": "REQUEST_EXECUTION" + }, + { + "end": 46, + "start": 43, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "async": true, + "method": { + "service": { + "shortName": "TraceService" + }, + "shortName": "ListTraces" + } + }, + "file": "cloudtrace_generated_trace_v1_trace_service_list_traces_async.py", + "regionTag": "cloudtrace_generated_trace_v1_TraceService_ListTraces_async", + "segments": [ + { + "end": 45, + "start": 27, + "type": "FULL" + }, + { + "end": 45, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 38, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 41, + "start": 39, + "type": "REQUEST_EXECUTION" + }, + { + "end": 46, + "start": 42, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "method": { + "service": { + "shortName": "TraceService" + }, + "shortName": "ListTraces" + } + }, + "file": "cloudtrace_generated_trace_v1_trace_service_list_traces_sync.py", + "regionTag": "cloudtrace_generated_trace_v1_TraceService_ListTraces_sync", + "segments": [ + { + "end": 45, + "start": 27, + "type": "FULL" + }, + { + "end": 45, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 38, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 41, + "start": 39, + "type": "REQUEST_EXECUTION" + }, + { + "end": 46, + "start": 42, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "async": true, + "method": { + "service": { + "shortName": "TraceService" + }, + "shortName": "PatchTraces" + } + }, + "file": "cloudtrace_generated_trace_v1_trace_service_patch_traces_async.py", + "regionTag": "cloudtrace_generated_trace_v1_TraceService_PatchTraces_async", + "segments": [ + { + "end": 42, + "start": 27, + "type": "FULL" + }, + { + "end": 42, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 38, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "start": 39, + "type": "REQUEST_EXECUTION" + }, + { + "end": 43, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "method": { + "service": { + "shortName": "TraceService" + }, + "shortName": "PatchTraces" + } + }, + "file": "cloudtrace_generated_trace_v1_trace_service_patch_traces_sync.py", + "regionTag": "cloudtrace_generated_trace_v1_TraceService_PatchTraces_sync", + "segments": [ + { + "end": 42, + "start": 27, + "type": "FULL" + }, + { + "end": 42, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 38, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "start": 39, + "type": "REQUEST_EXECUTION" + }, + { + "end": 43, + "type": "RESPONSE_HANDLING" + } + ] + } + ] +} diff --git a/packages/google-cloud-trace/samples/generated_samples/snippet_metadata_trace_v2.json b/packages/google-cloud-trace/samples/generated_samples/snippet_metadata_trace_v2.json new file mode 100644 index 000000000000..6445bdc6eda6 --- /dev/null +++ b/packages/google-cloud-trace/samples/generated_samples/snippet_metadata_trace_v2.json @@ -0,0 +1,178 @@ +{ + "snippets": [ + { + "clientMethod": { + "async": true, + "method": { + "service": { + "shortName": "TraceService" + }, + "shortName": "BatchWriteSpans" + } + }, + "file": "cloudtrace_generated_trace_v2_trace_service_batch_write_spans_async.py", + "regionTag": "cloudtrace_generated_trace_v2_TraceService_BatchWriteSpans_async", + "segments": [ + { + "end": 47, + "start": 27, + "type": "FULL" + }, + { + "end": 47, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 43, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "start": 44, + "type": "REQUEST_EXECUTION" + }, + { + "end": 48, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "method": { + "service": { + "shortName": "TraceService" + }, + "shortName": "BatchWriteSpans" + } + }, + "file": "cloudtrace_generated_trace_v2_trace_service_batch_write_spans_sync.py", + "regionTag": "cloudtrace_generated_trace_v2_TraceService_BatchWriteSpans_sync", + "segments": [ + { + "end": 47, + "start": 27, + "type": "FULL" + }, + { + "end": 47, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 43, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "start": 44, + "type": "REQUEST_EXECUTION" + }, + { + "end": 48, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "async": true, + "method": { + "service": { + "shortName": "TraceService" + }, + "shortName": "CreateSpan" + } + }, + "file": "cloudtrace_generated_trace_v2_trace_service_create_span_async.py", + "regionTag": "cloudtrace_generated_trace_v2_TraceService_CreateSpan_async", + "segments": [ + { + "end": 45, + "start": 27, + "type": "FULL" + }, + { + "end": 45, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 39, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 42, + "start": 40, + "type": "REQUEST_EXECUTION" + }, + { + "end": 46, + "start": 43, + "type": "RESPONSE_HANDLING" + } + ] + }, + { + "clientMethod": { + "method": { + "service": { + "shortName": "TraceService" + }, + "shortName": "CreateSpan" + } + }, + "file": "cloudtrace_generated_trace_v2_trace_service_create_span_sync.py", + "regionTag": "cloudtrace_generated_trace_v2_TraceService_CreateSpan_sync", + "segments": [ + { + "end": 45, + "start": 27, + "type": "FULL" + }, + { + "end": 45, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 39, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 42, + "start": 40, + "type": "REQUEST_EXECUTION" + }, + { + "end": 46, + "start": 43, + "type": "RESPONSE_HANDLING" + } + ] + } + ] +}