Skip to content

Commit

Permalink
docs: add generated snippets (#532)
Browse files Browse the repository at this point in the history
* 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

* chore: use gapic-generator-python 0.63.4

chore: fix snippet region tag format
chore: fix docstring code block formatting
PiperOrigin-RevId: 430730865

Source-Link: googleapis/googleapis@ea58002

Source-Link: googleapis/googleapis-gen@ca893ff
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiY2E4OTNmZjhhZjI1ZmM3ZmUwMDFkZTE0MDVhNTE3ZDgwNDQ2ZWNjYSJ9

* 🦉 Updates from OwlBot post-processor

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

* 🦉 Updates from OwlBot post-processor

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>
Co-authored-by: Mariatta Wijaya <[email protected]>
Co-authored-by: Anthonios Partheniou <[email protected]>
  • Loading branch information
4 people authored Feb 26, 2022
1 parent 3f1fd36 commit aea2af9
Show file tree
Hide file tree
Showing 4 changed files with 1,150 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,30 @@ async def create_index(
metadata for the operation will be the type
[IndexOperationMetadata][google.firestore.admin.v1.IndexOperationMetadata].
.. code-block:: python
from google.cloud import firestore_admin_v1
def sample_create_index():
# Create a client
client = firestore_admin_v1.FirestoreAdminClient()
# Initialize request argument(s)
request = firestore_admin_v1.CreateIndexRequest(
parent="parent_value",
)
# Make the request
operation = client.create_index(request=request)
print("Waiting for operation to complete...")
response = operation.result()
# Handle the response
print(response)
Args:
request (Union[google.cloud.firestore_admin_v1.types.CreateIndexRequest, dict]):
The request object. The request for
Expand Down Expand Up @@ -358,6 +382,26 @@ async def list_indexes(
) -> pagers.ListIndexesAsyncPager:
r"""Lists composite indexes.
.. code-block:: python
from google.cloud import firestore_admin_v1
def sample_list_indexes():
# Create a client
client = firestore_admin_v1.FirestoreAdminClient()
# Initialize request argument(s)
request = firestore_admin_v1.ListIndexesRequest(
parent="parent_value",
)
# Make the request
page_result = client.list_indexes(request=request)
# Handle the response
for response in page_result:
print(response)
Args:
request (Union[google.cloud.firestore_admin_v1.types.ListIndexesRequest, dict]):
The request object. The request for
Expand Down Expand Up @@ -449,6 +493,25 @@ async def get_index(
) -> index.Index:
r"""Gets a composite index.
.. code-block:: python
from google.cloud import firestore_admin_v1
def sample_get_index():
# Create a client
client = firestore_admin_v1.FirestoreAdminClient()
# Initialize request argument(s)
request = firestore_admin_v1.GetIndexRequest(
name="name_value",
)
# Make the request
response = client.get_index(request=request)
# Handle the response
print(response)
Args:
request (Union[google.cloud.firestore_admin_v1.types.GetIndexRequest, dict]):
The request object. The request for
Expand Down Expand Up @@ -532,6 +595,22 @@ async def delete_index(
) -> None:
r"""Deletes a composite index.
.. code-block:: python
from google.cloud import firestore_admin_v1
def sample_delete_index():
# Create a client
client = firestore_admin_v1.FirestoreAdminClient()
# Initialize request argument(s)
request = firestore_admin_v1.DeleteIndexRequest(
name="name_value",
)
# Make the request
client.delete_index(request=request)
Args:
request (Union[google.cloud.firestore_admin_v1.types.DeleteIndexRequest, dict]):
The request object. The request for
Expand Down Expand Up @@ -607,6 +686,25 @@ async def get_field(
) -> field.Field:
r"""Gets the metadata and configuration for a Field.
.. code-block:: python
from google.cloud import firestore_admin_v1
def sample_get_field():
# Create a client
client = firestore_admin_v1.FirestoreAdminClient()
# Initialize request argument(s)
request = firestore_admin_v1.GetFieldRequest(
name="name_value",
)
# Make the request
response = client.get_field(request=request)
# Handle the response
print(response)
Args:
request (Union[google.cloud.firestore_admin_v1.types.GetFieldRequest, dict]):
The request object. The request for
Expand Down Expand Up @@ -707,6 +805,33 @@ async def update_field(
the special ``Field`` with resource name:
``projects/{project_id}/databases/{database_id}/collectionGroups/__default__/fields/*``.
.. code-block:: python
from google.cloud import firestore_admin_v1
def sample_update_field():
# Create a client
client = firestore_admin_v1.FirestoreAdminClient()
# Initialize request argument(s)
field = firestore_admin_v1.Field()
field.name = "name_value"
request = firestore_admin_v1.UpdateFieldRequest(
field=field,
)
# Make the request
operation = client.update_field(request=request)
print("Waiting for operation to complete...")
response = operation.result()
# Handle the response
print(response)
Args:
request (Union[google.cloud.firestore_admin_v1.types.UpdateFieldRequest, dict]):
The request object. The request for
Expand Down Expand Up @@ -801,6 +926,27 @@ async def list_fields(
with the filter set to ``indexConfig.usesAncestorConfig:false``
.
.. code-block:: python
from google.cloud import firestore_admin_v1
def sample_list_fields():
# Create a client
client = firestore_admin_v1.FirestoreAdminClient()
# Initialize request argument(s)
request = firestore_admin_v1.ListFieldsRequest(
parent="parent_value",
)
# Make the request
page_result = client.list_fields(request=request)
# Handle the response
for response in page_result:
print(response)
Args:
request (Union[google.cloud.firestore_admin_v1.types.ListFieldsRequest, dict]):
The request object. The request for
Expand Down Expand Up @@ -905,6 +1051,30 @@ async def export_documents(
refer to:
https://cloud.google.com/firestore/docs/manage-data/export-import
.. code-block:: python
from google.cloud import firestore_admin_v1
def sample_export_documents():
# Create a client
client = firestore_admin_v1.FirestoreAdminClient()
# Initialize request argument(s)
request = firestore_admin_v1.ExportDocumentsRequest(
name="name_value",
)
# Make the request
operation = client.export_documents(request=request)
print("Waiting for operation to complete...")
response = operation.result()
# Handle the response
print(response)
Args:
request (Union[google.cloud.firestore_admin_v1.types.ExportDocumentsRequest, dict]):
The request object. The request for
Expand Down Expand Up @@ -995,6 +1165,30 @@ async def import_documents(
cancelled, it is possible that a subset of the data has
already been imported to Cloud Firestore.
.. code-block:: python
from google.cloud import firestore_admin_v1
def sample_import_documents():
# Create a client
client = firestore_admin_v1.FirestoreAdminClient()
# Initialize request argument(s)
request = firestore_admin_v1.ImportDocumentsRequest(
name="name_value",
)
# Make the request
operation = client.import_documents(request=request)
print("Waiting for operation to complete...")
response = operation.result()
# Handle the response
print(response)
Args:
request (Union[google.cloud.firestore_admin_v1.types.ImportDocumentsRequest, dict]):
The request object. The request for
Expand Down Expand Up @@ -1087,6 +1281,25 @@ async def get_database(
) -> database.Database:
r"""Gets information about a database.
.. code-block:: python
from google.cloud import firestore_admin_v1
def sample_get_database():
# Create a client
client = firestore_admin_v1.FirestoreAdminClient()
# Initialize request argument(s)
request = firestore_admin_v1.GetDatabaseRequest(
name="name_value",
)
# Make the request
response = client.get_database(request=request)
# Handle the response
print(response)
Args:
request (Union[google.cloud.firestore_admin_v1.types.GetDatabaseRequest, dict]):
The request object. The request for
Expand Down Expand Up @@ -1160,6 +1373,25 @@ async def list_databases(
) -> firestore_admin.ListDatabasesResponse:
r"""List all the databases in the project.
.. code-block:: python
from google.cloud import firestore_admin_v1
def sample_list_databases():
# Create a client
client = firestore_admin_v1.FirestoreAdminClient()
# Initialize request argument(s)
request = firestore_admin_v1.ListDatabasesRequest(
parent="parent_value",
)
# Make the request
response = client.list_databases(request=request)
# Handle the response
print(response)
Args:
request (Union[google.cloud.firestore_admin_v1.types.ListDatabasesRequest, dict]):
The request object. A request to list the Firestore
Expand Down Expand Up @@ -1230,6 +1462,28 @@ async def update_database(
) -> operation_async.AsyncOperation:
r"""Updates a database.
.. code-block:: python
from google.cloud import firestore_admin_v1
def sample_update_database():
# Create a client
client = firestore_admin_v1.FirestoreAdminClient()
# Initialize request argument(s)
request = firestore_admin_v1.UpdateDatabaseRequest(
)
# Make the request
operation = client.update_database(request=request)
print("Waiting for operation to complete...")
response = operation.result()
# Handle the response
print(response)
Args:
request (Union[google.cloud.firestore_admin_v1.types.UpdateDatabaseRequest, dict]):
The request object. The request for
Expand Down
Loading

0 comments on commit aea2af9

Please sign in to comment.