Skip to content

Commit

Permalink
feat: add generated sample comment (#1417)
Browse files Browse the repository at this point in the history
* add generated sample comment

* update golden files

* update tests/unit/samplegen/golden_snippets

* update tests/snippetgen/goldens

* update tests/integration/goldens/eventarc/samples/generated_samples

* update golden clients and metadata

Co-authored-by: Anthonios Partheniou <partheniou@google.com>
  • Loading branch information
dizcology and parthea authored Sep 6, 2022
1 parent d30a80e commit ef55bce
Show file tree
Hide file tree
Showing 167 changed files with 3,175 additions and 1,248 deletions.
7 changes: 7 additions & 0 deletions gapic/templates/examples/_generated_sample_comment.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
# client as shown in:
# https://googleapis.dev/python/google-api-core/latest/client_options.html
2 changes: 2 additions & 0 deletions gapic/templates/examples/sample.py.j2
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@
{{ frags.sample_header(sample, calling_form) }}

# [START {{ sample.id }}]
{% include "examples/_generated_sample_comment.j2" %}

{# python code is responsible for all transformations: all we do here is render #}
{% for import_statement in imports %}
{{ import_statement }}
Expand Down
84 changes: 84 additions & 0 deletions tests/integration/goldens/asset/google/cloud/asset_v1/services/asset_service/async_client.py
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,13 @@ async def export_assets(self,
.. code-block:: python
# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
# client as shown in:
# https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import asset_v1
async def sample_export_assets():
Expand Down Expand Up @@ -308,6 +315,13 @@ async def list_assets(self,
.. code-block:: python
# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
# client as shown in:
# https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import asset_v1
async def sample_list_assets():
Expand Down Expand Up @@ -421,6 +435,13 @@ async def batch_get_assets_history(self,
.. code-block:: python
# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
# client as shown in:
# https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import asset_v1
async def sample_batch_get_assets_history():
Expand Down Expand Up @@ -502,6 +523,13 @@ async def create_feed(self,
.. code-block:: python
# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
# client as shown in:
# https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import asset_v1
async def sample_create_feed():
Expand Down Expand Up @@ -612,6 +640,13 @@ async def get_feed(self,
.. code-block:: python
# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
# client as shown in:
# https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import asset_v1
async def sample_get_feed():
Expand Down Expand Up @@ -720,6 +755,13 @@ async def list_feeds(self,
.. code-block:: python
# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
# client as shown in:
# https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import asset_v1
async def sample_list_feeds():
Expand Down Expand Up @@ -822,6 +864,13 @@ async def update_feed(self,
.. code-block:: python
# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
# client as shown in:
# https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import asset_v1
async def sample_update_feed():
Expand Down Expand Up @@ -926,6 +975,13 @@ async def delete_feed(self,
.. code-block:: python
# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
# client as shown in:
# https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import asset_v1
async def sample_delete_feed():
Expand Down Expand Up @@ -1021,6 +1077,13 @@ async def search_all_resources(self,
.. code-block:: python
# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
# client as shown in:
# https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import asset_v1
async def sample_search_all_resources():
Expand Down Expand Up @@ -1227,6 +1290,13 @@ async def search_all_iam_policies(self,
.. code-block:: python
# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
# client as shown in:
# https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import asset_v1
async def sample_search_all_iam_policies():
Expand Down Expand Up @@ -1409,6 +1479,13 @@ async def analyze_iam_policy(self,
.. code-block:: python
# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
# client as shown in:
# https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import asset_v1
async def sample_analyze_iam_policy():
Expand Down Expand Up @@ -1503,6 +1580,13 @@ async def analyze_iam_policy_longrunning(self,
.. code-block:: python
# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
# client as shown in:
# https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import asset_v1
async def sample_analyze_iam_policy_longrunning():
Expand Down
84 changes: 84 additions & 0 deletions tests/integration/goldens/asset/google/cloud/asset_v1/services/asset_service/client.py
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -409,6 +409,13 @@ def export_assets(self,
.. code-block:: python
# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
# client as shown in:
# https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import asset_v1
def sample_export_assets():
Expand Down Expand Up @@ -506,6 +513,13 @@ def list_assets(self,
.. code-block:: python
# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
# client as shown in:
# https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import asset_v1
def sample_list_assets():
Expand Down Expand Up @@ -619,6 +633,13 @@ def batch_get_assets_history(self,
.. code-block:: python
# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
# client as shown in:
# https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import asset_v1
def sample_batch_get_assets_history():
Expand Down Expand Up @@ -694,6 +715,13 @@ def create_feed(self,
.. code-block:: python
# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
# client as shown in:
# https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import asset_v1
def sample_create_feed():
Expand Down Expand Up @@ -804,6 +832,13 @@ def get_feed(self,
.. code-block:: python
# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
# client as shown in:
# https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import asset_v1
def sample_get_feed():
Expand Down Expand Up @@ -905,6 +940,13 @@ def list_feeds(self,
.. code-block:: python
# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
# client as shown in:
# https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import asset_v1
def sample_list_feeds():
Expand Down Expand Up @@ -1000,6 +1042,13 @@ def update_feed(self,
.. code-block:: python
# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
# client as shown in:
# https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import asset_v1
def sample_update_feed():
Expand Down Expand Up @@ -1104,6 +1153,13 @@ def delete_feed(self,
.. code-block:: python
# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
# client as shown in:
# https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import asset_v1
def sample_delete_feed():
Expand Down Expand Up @@ -1192,6 +1248,13 @@ def search_all_resources(self,
.. code-block:: python
# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
# client as shown in:
# https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import asset_v1
def sample_search_all_resources():
Expand Down Expand Up @@ -1391,6 +1454,13 @@ def search_all_iam_policies(self,
.. code-block:: python
# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
# client as shown in:
# https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import asset_v1
def sample_search_all_iam_policies():
Expand Down Expand Up @@ -1566,6 +1636,13 @@ def analyze_iam_policy(self,
.. code-block:: python
# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
# client as shown in:
# https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import asset_v1
def sample_analyze_iam_policy():
Expand Down Expand Up @@ -1655,6 +1732,13 @@ def analyze_iam_policy_longrunning(self,
.. code-block:: python
# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
# client as shown in:
# https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import asset_v1
def sample_analyze_iam_policy_longrunning():
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,13 @@


# [START cloudasset_v1_generated_AssetService_AnalyzeIamPolicy_async]
# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
# client as shown in:
# https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import asset_v1


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,13 @@


# [START cloudasset_v1_generated_AssetService_AnalyzeIamPolicyLongrunning_async]
# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
# client as shown in:
# https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import asset_v1


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,13 @@


# [START cloudasset_v1_generated_AssetService_AnalyzeIamPolicyLongrunning_sync]
# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
# client as shown in:
# https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import asset_v1


Expand Down
Loading

0 comments on commit ef55bce

Please sign in to comment.