diff --git a/.flake8 b/.flake8
index 1a7e4989e..7f85294c9 100644
--- a/.flake8
+++ b/.flake8
@@ -16,7 +16,7 @@
# Generated by synthtool. DO NOT EDIT!
[flake8]
-ignore = E203, E266, E501, W503
+ignore = E203, E231, E266, E501, W503
exclude =
# Exclude environment test code.
tests/environment/**
diff --git a/.github/.OwlBot.lock.yaml b/.github/.OwlBot.lock.yaml
index fa15cb546..757c9dca7 100644
--- a/.github/.OwlBot.lock.yaml
+++ b/.github/.OwlBot.lock.yaml
@@ -13,5 +13,5 @@
# limitations under the License.
docker:
image: gcr.io/cloud-devrel-public-resources/owlbot-python:latest
- digest: sha256:ed1f9983d5a935a89fe8085e8bb97d94e41015252c5b6c9771257cf8624367e6
-
+ digest: sha256:81ed5ecdfc7cac5b699ba4537376f3563f6f04122c4ec9e735d3b3dc1d43dd32
+# created: 2022-05-05T22:08:23.383410683Z
diff --git a/.github/auto-approve.yml b/.github/auto-approve.yml
new file mode 100644
index 000000000..311ebbb85
--- /dev/null
+++ b/.github/auto-approve.yml
@@ -0,0 +1,3 @@
+# https://github.com/googleapis/repo-automation-bots/tree/main/packages/auto-approve
+processes:
+ - "OwlBotTemplateChanges"
diff --git a/.github/auto-label.yaml b/.github/auto-label.yaml
index 1e4706499..ccad49b4e 100644
--- a/.github/auto-label.yaml
+++ b/.github/auto-label.yaml
@@ -1,4 +1,16 @@
-product: true
+# Copyright 2022 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.
requestsize:
enabled: true
staleness:
diff --git a/.github/blunderbuss.yml b/.github/blunderbuss.yml
index 148ebf4e8..28438484f 100644
--- a/.github/blunderbuss.yml
+++ b/.github/blunderbuss.yml
@@ -1,4 +1,4 @@
assign_issues:
- - Daniel-Sanche
+ - arbrown
assign_prs:
- - Daniel-Sanche
+ - arbrown
diff --git a/.github/release-please.yml b/.github/release-please.yml
index 466597e5b..5161ab347 100644
--- a/.github/release-please.yml
+++ b/.github/release-please.yml
@@ -1,2 +1,14 @@
releaseType: python
handleGHRelease: true
+# NOTE: this section is generated by synthtool.languages.python
+# See https://github.com/googleapis/synthtool/blob/master/synthtool/languages/python.py
+branches:
+- branch: v2
+ handleGHRelease: true
+ releaseType: python
+- branch: v1
+ handleGHRelease: true
+ releaseType: python
+- branch: v0
+ handleGHRelease: true
+ releaseType: python
diff --git a/.kokoro/docker/docs/Dockerfile b/.kokoro/docker/docs/Dockerfile
index 4e1b1fb8b..238b87b9d 100644
--- a/.kokoro/docker/docs/Dockerfile
+++ b/.kokoro/docker/docs/Dockerfile
@@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-from ubuntu:20.04
+from ubuntu:22.04
ENV DEBIAN_FRONTEND noninteractive
@@ -60,8 +60,24 @@ RUN apt-get update \
&& rm -rf /var/lib/apt/lists/* \
&& rm -f /var/cache/apt/archives/*.deb
+###################### Install python 3.8.11
+
+# Download python 3.8.11
+RUN wget https://www.python.org/ftp/python/3.8.11/Python-3.8.11.tgz
+
+# Extract files
+RUN tar -xvf Python-3.8.11.tgz
+
+# Install python 3.8.11
+RUN ./Python-3.8.11/configure --enable-optimizations
+RUN make altinstall
+
+###################### Install pip
RUN wget -O /tmp/get-pip.py 'https://bootstrap.pypa.io/get-pip.py' \
- && python3.8 /tmp/get-pip.py \
+ && python3 /tmp/get-pip.py \
&& rm /tmp/get-pip.py
+# Test pip
+RUN python3 -m pip
+
CMD ["python3.8"]
diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
index 62eb5a77d..46d237160 100644
--- a/.pre-commit-config.yaml
+++ b/.pre-commit-config.yaml
@@ -22,7 +22,7 @@ repos:
- id: end-of-file-fixer
- id: check-yaml
- repo: https://github.com/psf/black
- rev: 19.10b0
+ rev: 22.3.0
hooks:
- id: black
- repo: https://gitlab.com/pycqa/flake8
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 9bfce6bf1..f859d7236 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -4,6 +4,34 @@
[1]: https://pypi.org/project/google-cloud-logging/#history
+## [3.1.0](https://github.com/googleapis/python-logging/compare/v3.0.0...v3.1.0) (2022-05-08)
+
+
+### Features
+
+* KMS configuration in settings ([#489](https://github.com/googleapis/python-logging/issues/489)) ([6699f8c](https://github.com/googleapis/python-logging/commit/6699f8c545d1a9904a945a9d789d7220da9433bf))
+* Update Logging API with latest changes ([6699f8c](https://github.com/googleapis/python-logging/commit/6699f8c545d1a9904a945a9d789d7220da9433bf))
+
+
+### Bug Fixes
+
+* **deps:** require google-api-core>=1.31.5, >=2.3.2 ([#494](https://github.com/googleapis/python-logging/issues/494)) ([ab14563](https://github.com/googleapis/python-logging/commit/ab145630ffbb25a88cc058569b9e425e62b32ced))
+* fix system test for mtls ([#485](https://github.com/googleapis/python-logging/issues/485)) ([96bb6f7](https://github.com/googleapis/python-logging/commit/96bb6f786c91656b52624fbbf52e036b1a908d53))
+* Reenable staleness bot ([#535](https://github.com/googleapis/python-logging/issues/535)) ([1595e42](https://github.com/googleapis/python-logging/commit/1595e4203faeb3d46b28a7d98f68761998e3aa26))
+* remove unnecessary detect_resource calls from CloudLoggingHandler ([#484](https://github.com/googleapis/python-logging/issues/484)) ([def7440](https://github.com/googleapis/python-logging/commit/def7440ac6964451f3202b5117e3060ec62045b0))
+* resolve DuplicateCredentialArgs error when using credentials_file ([265061e](https://github.com/googleapis/python-logging/commit/265061eae8396caaef3fdfeae80e0a120f9a5cda))
+
+
+### Dependencies
+
+* Pin jinja2 version to fix CI ([#522](https://github.com/googleapis/python-logging/issues/522)) ([383f2f0](https://github.com/googleapis/python-logging/commit/383f2f0062d3703dfc7e2c331562fb88327cdf38))
+
+
+### Documentation
+
+* add generated snippets ([6699f8c](https://github.com/googleapis/python-logging/commit/6699f8c545d1a9904a945a9d789d7220da9433bf))
+* Add link to interactive walkthrough ([#541](https://github.com/googleapis/python-logging/issues/541)) ([422a77d](https://github.com/googleapis/python-logging/commit/422a77d93655fba3406ecf397cf417ad37dd1ce1))
+
## [3.0.0](https://github.com/googleapis/python-logging/compare/v2.7.0...v3.0.0) (2022-01-27)
diff --git a/README.rst b/README.rst
index e5017619e..93b601ba9 100644
--- a/README.rst
+++ b/README.rst
@@ -34,6 +34,14 @@ In order to use this library, you first need to go through the following steps:
.. _Enable the Cloud Logging API.: https://cloud.google.com/logging
.. _Setup Authentication.: https://googleapis.dev/python/google-api-core/latest/auth.html
+For an interactive walkthrough on how to use this library in a python application, click the Guide Me button below:
+
+.. raw:: html
+
+
+
+
+
Installation
~~~~~~~~~~~~
diff --git a/docs/_static/guide-me.svg b/docs/_static/guide-me.svg
new file mode 100644
index 000000000..c0196b96b
--- /dev/null
+++ b/docs/_static/guide-me.svg
@@ -0,0 +1,45 @@
+
diff --git a/docs/conf.py b/docs/conf.py
index 743981d3a..04f5d0ef5 100644
--- a/docs/conf.py
+++ b/docs/conf.py
@@ -361,7 +361,10 @@
intersphinx_mapping = {
"python": ("https://python.readthedocs.org/en/latest/", None),
"google-auth": ("https://googleapis.dev/python/google-auth/latest/", None),
- "google.api_core": ("https://googleapis.dev/python/google-api-core/latest/", None,),
+ "google.api_core": (
+ "https://googleapis.dev/python/google-api-core/latest/",
+ None,
+ ),
"grpc": ("https://grpc.github.io/grpc/python/", None),
"proto-plus": ("https://proto-plus-python.readthedocs.io/en/latest/", None),
"protobuf": ("https://googleapis.dev/python/protobuf/latest/", None),
diff --git a/google/cloud/logging_v2/_gapic.py b/google/cloud/logging_v2/_gapic.py
index 3661d3d09..4b5429f2f 100644
--- a/google/cloud/logging_v2/_gapic.py
+++ b/google/cloud/logging_v2/_gapic.py
@@ -299,7 +299,12 @@ def sink_get(self, sink_name):
)
def sink_update(
- self, sink_name, filter_, destination, *, unique_writer_identity=False,
+ self,
+ sink_name,
+ filter_,
+ destination,
+ *,
+ unique_writer_identity=False,
):
"""Update a sink resource.
@@ -326,7 +331,11 @@ def sink_update(
protobuf to a dictionary).
"""
name = sink_name.split("/")[-1] # parse name out of full resoure name
- sink_pb = LogSink(name=name, filter=filter_, destination=destination,)
+ sink_pb = LogSink(
+ name=name,
+ filter=filter_,
+ destination=destination,
+ )
request = UpdateSinkRequest(
sink_name=sink_name,
@@ -362,7 +371,7 @@ def sink_delete(self, sink_name):
class _MetricsAPI(object):
- """Helper mapping sink-related APIs. """
+ """Helper mapping sink-related APIs."""
def __init__(self, gapic_api, client):
self._gapic_api = gapic_api
@@ -389,7 +398,9 @@ def list_metrics(
"""
path = f"projects/{project}"
request = ListLogMetricsRequest(
- parent=path, page_size=page_size, page_token=page_token,
+ parent=path,
+ page_size=page_size,
+ page_token=page_token,
)
response = self._gapic_api.list_log_metrics(request=request)
metric_iter = iter(response)
@@ -449,7 +460,11 @@ def metric_get(self, project, metric_name):
)
def metric_update(
- self, project, metric_name, filter_, description,
+ self,
+ project,
+ metric_name,
+ filter_,
+ description,
):
"""Update a metric resource.
@@ -465,7 +480,11 @@ def metric_update(
protobuf to a dictionary).
"""
path = f"projects/{project}/metrics/{metric_name}"
- metric_pb = LogMetric(name=path, filter=filter_, description=description,)
+ metric_pb = LogMetric(
+ name=path,
+ filter=filter_,
+ description=description,
+ )
metric_pb = self._gapic_api.update_log_metric(
metric_name=path, metric=metric_pb
)
diff --git a/google/cloud/logging_v2/_helpers.py b/google/cloud/logging_v2/_helpers.py
index 51cc64868..75f84e50c 100644
--- a/google/cloud/logging_v2/_helpers.py
+++ b/google/cloud/logging_v2/_helpers.py
@@ -89,7 +89,7 @@ def entry_from_resource(resource, client, loggers):
return LogEntry.from_api_repr(resource, client, loggers=loggers)
-def retrieve_metadata_server(metadata_key):
+def retrieve_metadata_server(metadata_key, timeout=5):
"""Retrieve the metadata key in the metadata server.
See: https://cloud.google.com/compute/docs/storing-retrieving-metadata
@@ -99,6 +99,7 @@ def retrieve_metadata_server(metadata_key):
Key of the metadata which will form the url. You can
also supply query parameters after the metadata key.
e.g. "tags?alt=json"
+ timeout (number): number of seconds to wait for the HTTP request
Returns:
str: The value of the metadata key returned by the metadata server.
@@ -106,7 +107,7 @@ def retrieve_metadata_server(metadata_key):
url = METADATA_URL + metadata_key
try:
- response = requests.get(url, headers=METADATA_HEADERS)
+ response = requests.get(url, headers=METADATA_HEADERS, timeout=timeout)
if response.status_code == requests.codes.ok:
return response.text
diff --git a/google/cloud/logging_v2/_http.py b/google/cloud/logging_v2/_http.py
index 21fb38606..cb5fd61eb 100644
--- a/google/cloud/logging_v2/_http.py
+++ b/google/cloud/logging_v2/_http.py
@@ -454,18 +454,18 @@ def metric_get(self, project, metric_name):
def metric_update(self, project, metric_name, filter_, description):
"""Update a metric resource.
- See
- https://cloud.google.com/logging/docs/reference/v2/rest/v2/projects.metrics/update
-
- Args:
- project (str): ID of the project containing the metric.
- metric_name (str): the name of the metric
- filter_ (str): the advanced logs filter expression defining the
- entries exported by the metric.
- description (str): description of the metric.
+ See
+ https://cloud.google.com/logging/docs/reference/v2/rest/v2/projects.metrics/update
- Returns:
- dict: The returned (updated) resource.
+ Args:
+ project (str): ID of the project containing the metric.
+ metric_name (str): the name of the metric
+ filter_ (str): the advanced logs filter expression defining the
+ entries exported by the metric.
+ description (str): description of the metric.
+
+ Returns:
+ dict: The returned (updated) resource.
"""
target = f"/projects/{project}/metrics/{metric_name}"
data = {"name": metric_name, "filter": filter_, "description": description}
diff --git a/google/cloud/logging_v2/client.py b/google/cloud/logging_v2/client.py
index 3d5ea24fc..049737861 100644
--- a/google/cloud/logging_v2/client.py
+++ b/google/cloud/logging_v2/client.py
@@ -118,7 +118,7 @@ def __init__(
client_options (Optional[Union[dict, google.api_core.client_options.ClientOptions]]):
Client options used to set user options
on the client. API Endpoint should be set through client_options.
- """
+ """
super(Client, self).__init__(
project=project,
credentials=credentials,
diff --git a/google/cloud/logging_v2/gapic_metadata.json b/google/cloud/logging_v2/gapic_metadata.json
index da4eefd47..a629e5a50 100644
--- a/google/cloud/logging_v2/gapic_metadata.json
+++ b/google/cloud/logging_v2/gapic_metadata.json
@@ -10,6 +10,11 @@
"grpc": {
"libraryClient": "ConfigServiceV2Client",
"rpcs": {
+ "CopyLogEntries": {
+ "methods": [
+ "copy_log_entries"
+ ]
+ },
"CreateBucket": {
"methods": [
"create_bucket"
@@ -65,6 +70,11 @@
"get_exclusion"
]
},
+ "GetSettings": {
+ "methods": [
+ "get_settings"
+ ]
+ },
"GetSink": {
"methods": [
"get_sink"
@@ -115,6 +125,11 @@
"update_exclusion"
]
},
+ "UpdateSettings": {
+ "methods": [
+ "update_settings"
+ ]
+ },
"UpdateSink": {
"methods": [
"update_sink"
@@ -130,6 +145,11 @@
"grpc-async": {
"libraryClient": "ConfigServiceV2AsyncClient",
"rpcs": {
+ "CopyLogEntries": {
+ "methods": [
+ "copy_log_entries"
+ ]
+ },
"CreateBucket": {
"methods": [
"create_bucket"
@@ -185,6 +205,11 @@
"get_exclusion"
]
},
+ "GetSettings": {
+ "methods": [
+ "get_settings"
+ ]
+ },
"GetSink": {
"methods": [
"get_sink"
@@ -235,6 +260,11 @@
"update_exclusion"
]
},
+ "UpdateSettings": {
+ "methods": [
+ "update_settings"
+ ]
+ },
"UpdateSink": {
"methods": [
"update_sink"
diff --git a/google/cloud/logging_v2/handlers/handlers.py b/google/cloud/logging_v2/handlers/handlers.py
index 769146007..f6fa90d71 100644
--- a/google/cloud/logging_v2/handlers/handlers.py
+++ b/google/cloud/logging_v2/handlers/handlers.py
@@ -179,7 +179,7 @@ def __init__(
resource = detect_resource(client.project)
self.name = name
self.client = client
- self.transport = transport(client, name)
+ self.transport = transport(client, name, resource=resource)
self.project_id = client.project
self.resource = resource
self.labels = labels
diff --git a/google/cloud/logging_v2/handlers/transports/background_thread.py b/google/cloud/logging_v2/handlers/transports/background_thread.py
index 1097830a8..f361e043c 100644
--- a/google/cloud/logging_v2/handlers/transports/background_thread.py
+++ b/google/cloud/logging_v2/handlers/transports/background_thread.py
@@ -29,6 +29,7 @@
from google.cloud.logging_v2 import _helpers
from google.cloud.logging_v2.handlers.transports.base import Transport
+from google.cloud.logging_v2.logger import _GLOBAL_RESOURCE
_DEFAULT_GRACE_PERIOD = 5.0 # Seconds
_DEFAULT_MAX_BATCH_SIZE = 10
@@ -260,6 +261,8 @@ def __init__(
grace_period=_DEFAULT_GRACE_PERIOD,
batch_size=_DEFAULT_MAX_BATCH_SIZE,
max_latency=_DEFAULT_MAX_LATENCY,
+ resource=_GLOBAL_RESOURCE,
+ **kwargs,
):
"""
Args:
@@ -275,9 +278,11 @@ def __init__(
than the grace_period. This means this is effectively the longest
amount of time the background thread will hold onto log entries
before sending them to the server.
+ resource (Optional[Resource|dict]): The default monitored resource to associate
+ with logs when not specified
"""
self.client = client
- logger = self.client.logger(name)
+ logger = self.client.logger(name, resource=resource)
self.worker = _Worker(
logger,
grace_period=grace_period,
diff --git a/google/cloud/logging_v2/handlers/transports/base.py b/google/cloud/logging_v2/handlers/transports/base.py
index bd52b4e75..a0c9aafa4 100644
--- a/google/cloud/logging_v2/handlers/transports/base.py
+++ b/google/cloud/logging_v2/handlers/transports/base.py
@@ -14,6 +14,8 @@
"""Module containing base class for logging transport."""
+from google.cloud.logging_v2.logger import _GLOBAL_RESOURCE
+
class Transport(object):
"""Base class for Google Cloud Logging handler transports.
@@ -22,6 +24,17 @@ class Transport(object):
client and name object, and must override :meth:`send`.
"""
+ def __init__(self, client, name, resource=_GLOBAL_RESOURCE, **kwargs):
+ """
+ Args:
+ client (~logging_v2.client.Client):
+ The Logging client.
+ name (str): The name of the lgoger.
+ resource (Optional[Resource|dict]): The default monitored resource to associate
+ with logs when not specified
+ """
+ super().__init__()
+
def send(self, record, message, **kwargs):
"""Transport send to be implemented by subclasses.
diff --git a/google/cloud/logging_v2/handlers/transports/sync.py b/google/cloud/logging_v2/handlers/transports/sync.py
index 796f0d2ff..6f93b2e57 100644
--- a/google/cloud/logging_v2/handlers/transports/sync.py
+++ b/google/cloud/logging_v2/handlers/transports/sync.py
@@ -18,6 +18,7 @@
"""
from google.cloud.logging_v2 import _helpers
from google.cloud.logging_v2.handlers.transports.base import Transport
+from google.cloud.logging_v2.logger import _GLOBAL_RESOURCE
class SyncTransport(Transport):
@@ -26,8 +27,16 @@ class SyncTransport(Transport):
Uses this library's Logging client to directly make the API call.
"""
- def __init__(self, client, name):
- self.logger = client.logger(name)
+ def __init__(self, client, name, resource=_GLOBAL_RESOURCE, **kwargs):
+ """
+ Args:
+ client (~logging_v2.client.Client):
+ The Logging client.
+ name (str): The name of the lgoger.
+ resource (Optional[Resource|dict]): The default monitored resource to associate
+ with logs when not specified
+ """
+ self.logger = client.logger(name, resource=resource)
def send(self, record, message, **kwargs):
"""Overrides transport.send().
diff --git a/google/cloud/logging_v2/metric.py b/google/cloud/logging_v2/metric.py
index 2959bacc2..167165c97 100644
--- a/google/cloud/logging_v2/metric.py
+++ b/google/cloud/logging_v2/metric.py
@@ -20,8 +20,8 @@
class Metric(object):
"""Metrics represent named filters for log entries.
- See
- https://cloud.google.com/logging/docs/reference/v2/rest/v2/projects.metrics
+ See
+ https://cloud.google.com/logging/docs/reference/v2/rest/v2/projects.metrics
"""
def __init__(self, name, *, filter_=None, client=None, description=""):
diff --git a/google/cloud/logging_v2/services/__init__.py b/google/cloud/logging_v2/services/__init__.py
index 4de65971c..e8e1c3845 100644
--- a/google/cloud/logging_v2/services/__init__.py
+++ b/google/cloud/logging_v2/services/__init__.py
@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
-# Copyright 2020 Google LLC
+# Copyright 2022 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
diff --git a/google/cloud/logging_v2/services/config_service_v2/__init__.py b/google/cloud/logging_v2/services/config_service_v2/__init__.py
index e7f604280..6eb3681ce 100644
--- a/google/cloud/logging_v2/services/config_service_v2/__init__.py
+++ b/google/cloud/logging_v2/services/config_service_v2/__init__.py
@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
-# Copyright 2020 Google LLC
+# Copyright 2022 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
diff --git a/google/cloud/logging_v2/services/config_service_v2/async_client.py b/google/cloud/logging_v2/services/config_service_v2/async_client.py
index 664f10ada..0a325ce86 100644
--- a/google/cloud/logging_v2/services/config_service_v2/async_client.py
+++ b/google/cloud/logging_v2/services/config_service_v2/async_client.py
@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
-# Copyright 2020 Google LLC
+# Copyright 2022 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -16,7 +16,7 @@
from collections import OrderedDict
import functools
import re
-from typing import Dict, Optional, Sequence, Tuple, Type, Union
+from typing import Dict, Mapping, Optional, Sequence, Tuple, Type, Union
import pkg_resources
from google.api_core.client_options import ClientOptions
@@ -31,6 +31,8 @@
except AttributeError: # pragma: NO COVER
OptionalRetry = Union[retries.Retry, object] # type: ignore
+from google.api_core import operation # type: ignore
+from google.api_core import operation_async # type: ignore
from google.cloud.logging_v2.services.config_service_v2 import pagers
from google.cloud.logging_v2.types import logging_config
from google.protobuf import field_mask_pb2 # type: ignore
@@ -62,6 +64,8 @@ class ConfigServiceV2AsyncClient:
parse_log_sink_path = staticmethod(ConfigServiceV2Client.parse_log_sink_path)
log_view_path = staticmethod(ConfigServiceV2Client.log_view_path)
parse_log_view_path = staticmethod(ConfigServiceV2Client.parse_log_view_path)
+ settings_path = staticmethod(ConfigServiceV2Client.settings_path)
+ parse_settings_path = staticmethod(ConfigServiceV2Client.parse_settings_path)
common_billing_account_path = staticmethod(
ConfigServiceV2Client.common_billing_account_path
)
@@ -225,7 +229,27 @@ async def list_buckets(
timeout: float = None,
metadata: Sequence[Tuple[str, str]] = (),
) -> pagers.ListBucketsAsyncPager:
- r"""Lists buckets.
+ r"""Lists log buckets.
+
+ .. code-block:: python
+
+ from google.cloud import logging_v2
+
+ async def sample_list_buckets():
+ # Create a client
+ client = logging_v2.ConfigServiceV2AsyncClient()
+
+ # Initialize request argument(s)
+ request = logging_v2.ListBucketsRequest(
+ parent="parent_value",
+ )
+
+ # Make the request
+ page_result = client.list_buckets(request=request)
+
+ # Handle the response
+ async for response in page_result:
+ print(response)
Args:
request (Union[google.cloud.logging_v2.types.ListBucketsRequest, dict]):
@@ -263,7 +287,7 @@ async def list_buckets(
"""
# Create or coerce a protobuf request object.
- # Sanity check: If we got a request object, we should *not* have
+ # Quick check: If we got a request object, we should *not* have
# gotten any keyword arguments that map to the request.
has_flattened_params = any([parent])
if request is not None and has_flattened_params:
@@ -294,12 +318,20 @@ async def list_buckets(
)
# Send the request.
- response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,)
+ response = await rpc(
+ request,
+ retry=retry,
+ timeout=timeout,
+ metadata=metadata,
+ )
# This method is paged; wrap the response in a pager, which provides
# an `__aiter__` convenience method.
response = pagers.ListBucketsAsyncPager(
- method=rpc, request=request, response=response, metadata=metadata,
+ method=rpc,
+ request=request,
+ response=response,
+ metadata=metadata,
)
# Done; return the response.
@@ -313,7 +345,26 @@ async def get_bucket(
timeout: float = None,
metadata: Sequence[Tuple[str, str]] = (),
) -> logging_config.LogBucket:
- r"""Gets a bucket.
+ r"""Gets a log bucket.
+
+ .. code-block:: python
+
+ from google.cloud import logging_v2
+
+ async def sample_get_bucket():
+ # Create a client
+ client = logging_v2.ConfigServiceV2AsyncClient()
+
+ # Initialize request argument(s)
+ request = logging_v2.GetBucketRequest(
+ name="name_value",
+ )
+
+ # Make the request
+ response = await client.get_bucket(request=request)
+
+ # Handle the response
+ print(response)
Args:
request (Union[google.cloud.logging_v2.types.GetBucketRequest, dict]):
@@ -326,7 +377,9 @@ async def get_bucket(
Returns:
google.cloud.logging_v2.types.LogBucket:
- Describes a repository of logs.
+ Describes a repository in which log
+ entries are stored.
+
"""
# Create or coerce a protobuf request object.
request = logging_config.GetBucketRequest(request)
@@ -346,7 +399,12 @@ async def get_bucket(
)
# Send the request.
- response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,)
+ response = await rpc(
+ request,
+ retry=retry,
+ timeout=timeout,
+ metadata=metadata,
+ )
# Done; return the response.
return response
@@ -359,9 +417,29 @@ async def create_bucket(
timeout: float = None,
metadata: Sequence[Tuple[str, str]] = (),
) -> logging_config.LogBucket:
- r"""Creates a bucket that can be used to store log
- entries. Once a bucket has been created, the region
- cannot be changed.
+ r"""Creates a log bucket that can be used to store log
+ entries. After a bucket has been created, the bucket's
+ location cannot be changed.
+
+ .. code-block:: python
+
+ from google.cloud import logging_v2
+
+ async def sample_create_bucket():
+ # Create a client
+ client = logging_v2.ConfigServiceV2AsyncClient()
+
+ # Initialize request argument(s)
+ request = logging_v2.CreateBucketRequest(
+ parent="parent_value",
+ bucket_id="bucket_id_value",
+ )
+
+ # Make the request
+ response = await client.create_bucket(request=request)
+
+ # Handle the response
+ print(response)
Args:
request (Union[google.cloud.logging_v2.types.CreateBucketRequest, dict]):
@@ -374,7 +452,9 @@ async def create_bucket(
Returns:
google.cloud.logging_v2.types.LogBucket:
- Describes a repository of logs.
+ Describes a repository in which log
+ entries are stored.
+
"""
# Create or coerce a protobuf request object.
request = logging_config.CreateBucketRequest(request)
@@ -394,7 +474,12 @@ async def create_bucket(
)
# Send the request.
- response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,)
+ response = await rpc(
+ request,
+ retry=retry,
+ timeout=timeout,
+ metadata=metadata,
+ )
# Done; return the response.
return response
@@ -407,17 +492,37 @@ async def update_bucket(
timeout: float = None,
metadata: Sequence[Tuple[str, str]] = (),
) -> logging_config.LogBucket:
- r"""Updates a bucket. This method replaces the following fields in
- the existing bucket with values from the new bucket:
+ r"""Updates a log bucket. This method replaces the following fields
+ in the existing bucket with values from the new bucket:
``retention_period``
If the retention period is decreased and the bucket is locked,
- FAILED_PRECONDITION will be returned.
+ ``FAILED_PRECONDITION`` will be returned.
- If the bucket has a LifecycleState of DELETE_REQUESTED,
- FAILED_PRECONDITION will be returned.
+ If the bucket has a ``lifecycle_state`` of ``DELETE_REQUESTED``,
+ then ``FAILED_PRECONDITION`` will be returned.
- A buckets region may not be modified after it is created.
+ After a bucket has been created, the bucket's location cannot be
+ changed.
+
+ .. code-block:: python
+
+ from google.cloud import logging_v2
+
+ async def sample_update_bucket():
+ # Create a client
+ client = logging_v2.ConfigServiceV2AsyncClient()
+
+ # Initialize request argument(s)
+ request = logging_v2.UpdateBucketRequest(
+ name="name_value",
+ )
+
+ # Make the request
+ response = await client.update_bucket(request=request)
+
+ # Handle the response
+ print(response)
Args:
request (Union[google.cloud.logging_v2.types.UpdateBucketRequest, dict]):
@@ -430,7 +535,9 @@ async def update_bucket(
Returns:
google.cloud.logging_v2.types.LogBucket:
- Describes a repository of logs.
+ Describes a repository in which log
+ entries are stored.
+
"""
# Create or coerce a protobuf request object.
request = logging_config.UpdateBucketRequest(request)
@@ -450,7 +557,12 @@ async def update_bucket(
)
# Send the request.
- response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,)
+ response = await rpc(
+ request,
+ retry=retry,
+ timeout=timeout,
+ metadata=metadata,
+ )
# Done; return the response.
return response
@@ -463,9 +575,28 @@ async def delete_bucket(
timeout: float = None,
metadata: Sequence[Tuple[str, str]] = (),
) -> None:
- r"""Deletes a bucket. Moves the bucket to the DELETE_REQUESTED
- state. After 7 days, the bucket will be purged and all logs in
- the bucket will be permanently deleted.
+ r"""Deletes a log bucket.
+
+ Changes the bucket's ``lifecycle_state`` to the
+ ``DELETE_REQUESTED`` state. After 7 days, the bucket will be
+ purged and all log entries in the bucket will be permanently
+ deleted.
+
+ .. code-block:: python
+
+ from google.cloud import logging_v2
+
+ async def sample_delete_bucket():
+ # Create a client
+ client = logging_v2.ConfigServiceV2AsyncClient()
+
+ # Initialize request argument(s)
+ request = logging_v2.DeleteBucketRequest(
+ name="name_value",
+ )
+
+ # Make the request
+ await client.delete_bucket(request=request)
Args:
request (Union[google.cloud.logging_v2.types.DeleteBucketRequest, dict]):
@@ -495,7 +626,10 @@ async def delete_bucket(
# Send the request.
await rpc(
- request, retry=retry, timeout=timeout, metadata=metadata,
+ request,
+ retry=retry,
+ timeout=timeout,
+ metadata=metadata,
)
async def undelete_bucket(
@@ -506,8 +640,25 @@ async def undelete_bucket(
timeout: float = None,
metadata: Sequence[Tuple[str, str]] = (),
) -> None:
- r"""Undeletes a bucket. A bucket that has been deleted
- may be undeleted within the grace period of 7 days.
+ r"""Undeletes a log bucket. A bucket that has been
+ deleted can be undeleted within the grace period of 7
+ days.
+
+ .. code-block:: python
+
+ from google.cloud import logging_v2
+
+ async def sample_undelete_bucket():
+ # Create a client
+ client = logging_v2.ConfigServiceV2AsyncClient()
+
+ # Initialize request argument(s)
+ request = logging_v2.UndeleteBucketRequest(
+ name="name_value",
+ )
+
+ # Make the request
+ await client.undelete_bucket(request=request)
Args:
request (Union[google.cloud.logging_v2.types.UndeleteBucketRequest, dict]):
@@ -537,7 +688,10 @@ async def undelete_bucket(
# Send the request.
await rpc(
- request, retry=retry, timeout=timeout, metadata=metadata,
+ request,
+ retry=retry,
+ timeout=timeout,
+ metadata=metadata,
)
async def list_views(
@@ -549,7 +703,27 @@ async def list_views(
timeout: float = None,
metadata: Sequence[Tuple[str, str]] = (),
) -> pagers.ListViewsAsyncPager:
- r"""Lists views on a bucket.
+ r"""Lists views on a log bucket.
+
+ .. code-block:: python
+
+ from google.cloud import logging_v2
+
+ async def sample_list_views():
+ # Create a client
+ client = logging_v2.ConfigServiceV2AsyncClient()
+
+ # Initialize request argument(s)
+ request = logging_v2.ListViewsRequest(
+ parent="parent_value",
+ )
+
+ # Make the request
+ page_result = client.list_views(request=request)
+
+ # Handle the response
+ async for response in page_result:
+ print(response)
Args:
request (Union[google.cloud.logging_v2.types.ListViewsRequest, dict]):
@@ -579,7 +753,7 @@ async def list_views(
"""
# Create or coerce a protobuf request object.
- # Sanity check: If we got a request object, we should *not* have
+ # Quick check: If we got a request object, we should *not* have
# gotten any keyword arguments that map to the request.
has_flattened_params = any([parent])
if request is not None and has_flattened_params:
@@ -610,12 +784,20 @@ async def list_views(
)
# Send the request.
- response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,)
+ response = await rpc(
+ request,
+ retry=retry,
+ timeout=timeout,
+ metadata=metadata,
+ )
# This method is paged; wrap the response in a pager, which provides
# an `__aiter__` convenience method.
response = pagers.ListViewsAsyncPager(
- method=rpc, request=request, response=response, metadata=metadata,
+ method=rpc,
+ request=request,
+ response=response,
+ metadata=metadata,
)
# Done; return the response.
@@ -629,7 +811,26 @@ async def get_view(
timeout: float = None,
metadata: Sequence[Tuple[str, str]] = (),
) -> logging_config.LogView:
- r"""Gets a view.
+ r"""Gets a view on a log bucket..
+
+ .. code-block:: python
+
+ from google.cloud import logging_v2
+
+ async def sample_get_view():
+ # Create a client
+ client = logging_v2.ConfigServiceV2AsyncClient()
+
+ # Initialize request argument(s)
+ request = logging_v2.GetViewRequest(
+ name="name_value",
+ )
+
+ # Make the request
+ response = await client.get_view(request=request)
+
+ # Handle the response
+ print(response)
Args:
request (Union[google.cloud.logging_v2.types.GetViewRequest, dict]):
@@ -642,8 +843,8 @@ async def get_view(
Returns:
google.cloud.logging_v2.types.LogView:
- Describes a view over logs in a
- bucket.
+ Describes a view over log entries in
+ a bucket.
"""
# Create or coerce a protobuf request object.
@@ -664,7 +865,12 @@ async def get_view(
)
# Send the request.
- response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,)
+ response = await rpc(
+ request,
+ retry=retry,
+ timeout=timeout,
+ metadata=metadata,
+ )
# Done; return the response.
return response
@@ -677,8 +883,28 @@ async def create_view(
timeout: float = None,
metadata: Sequence[Tuple[str, str]] = (),
) -> logging_config.LogView:
- r"""Creates a view over logs in a bucket. A bucket may
- contain a maximum of 50 views.
+ r"""Creates a view over log entries in a log bucket. A
+ bucket may contain a maximum of 30 views.
+
+ .. code-block:: python
+
+ from google.cloud import logging_v2
+
+ async def sample_create_view():
+ # Create a client
+ client = logging_v2.ConfigServiceV2AsyncClient()
+
+ # Initialize request argument(s)
+ request = logging_v2.CreateViewRequest(
+ parent="parent_value",
+ view_id="view_id_value",
+ )
+
+ # Make the request
+ response = await client.create_view(request=request)
+
+ # Handle the response
+ print(response)
Args:
request (Union[google.cloud.logging_v2.types.CreateViewRequest, dict]):
@@ -691,8 +917,8 @@ async def create_view(
Returns:
google.cloud.logging_v2.types.LogView:
- Describes a view over logs in a
- bucket.
+ Describes a view over log entries in
+ a bucket.
"""
# Create or coerce a protobuf request object.
@@ -713,7 +939,12 @@ async def create_view(
)
# Send the request.
- response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,)
+ response = await rpc(
+ request,
+ retry=retry,
+ timeout=timeout,
+ metadata=metadata,
+ )
# Done; return the response.
return response
@@ -726,8 +957,30 @@ async def update_view(
timeout: float = None,
metadata: Sequence[Tuple[str, str]] = (),
) -> logging_config.LogView:
- r"""Updates a view. This method replaces the following fields in the
- existing view with values from the new view: ``filter``.
+ r"""Updates a view on a log bucket. This method replaces the
+ following fields in the existing view with values from the new
+ view: ``filter``. If an ``UNAVAILABLE`` error is returned, this
+ indicates that system is not in a state where it can update the
+ view. If this occurs, please try again in a few minutes.
+
+ .. code-block:: python
+
+ from google.cloud import logging_v2
+
+ async def sample_update_view():
+ # Create a client
+ client = logging_v2.ConfigServiceV2AsyncClient()
+
+ # Initialize request argument(s)
+ request = logging_v2.UpdateViewRequest(
+ name="name_value",
+ )
+
+ # Make the request
+ response = await client.update_view(request=request)
+
+ # Handle the response
+ print(response)
Args:
request (Union[google.cloud.logging_v2.types.UpdateViewRequest, dict]):
@@ -740,8 +993,8 @@ async def update_view(
Returns:
google.cloud.logging_v2.types.LogView:
- Describes a view over logs in a
- bucket.
+ Describes a view over log entries in
+ a bucket.
"""
# Create or coerce a protobuf request object.
@@ -762,7 +1015,12 @@ async def update_view(
)
# Send the request.
- response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,)
+ response = await rpc(
+ request,
+ retry=retry,
+ timeout=timeout,
+ metadata=metadata,
+ )
# Done; return the response.
return response
@@ -775,7 +1033,26 @@ async def delete_view(
timeout: float = None,
metadata: Sequence[Tuple[str, str]] = (),
) -> None:
- r"""Deletes a view from a bucket.
+ r"""Deletes a view on a log bucket. If an ``UNAVAILABLE`` error is
+ returned, this indicates that system is not in a state where it
+ can delete the view. If this occurs, please try again in a few
+ minutes.
+
+ .. code-block:: python
+
+ from google.cloud import logging_v2
+
+ async def sample_delete_view():
+ # Create a client
+ client = logging_v2.ConfigServiceV2AsyncClient()
+
+ # Initialize request argument(s)
+ request = logging_v2.DeleteViewRequest(
+ name="name_value",
+ )
+
+ # Make the request
+ await client.delete_view(request=request)
Args:
request (Union[google.cloud.logging_v2.types.DeleteViewRequest, dict]):
@@ -805,7 +1082,10 @@ async def delete_view(
# Send the request.
await rpc(
- request, retry=retry, timeout=timeout, metadata=metadata,
+ request,
+ retry=retry,
+ timeout=timeout,
+ metadata=metadata,
)
async def list_sinks(
@@ -819,6 +1099,26 @@ async def list_sinks(
) -> pagers.ListSinksAsyncPager:
r"""Lists sinks.
+ .. code-block:: python
+
+ from google.cloud import logging_v2
+
+ async def sample_list_sinks():
+ # Create a client
+ client = logging_v2.ConfigServiceV2AsyncClient()
+
+ # Initialize request argument(s)
+ request = logging_v2.ListSinksRequest(
+ parent="parent_value",
+ )
+
+ # Make the request
+ page_result = client.list_sinks(request=request)
+
+ # Handle the response
+ async for response in page_result:
+ print(response)
+
Args:
request (Union[google.cloud.logging_v2.types.ListSinksRequest, dict]):
The request object. The parameters to `ListSinks`.
@@ -851,7 +1151,7 @@ async def list_sinks(
"""
# Create or coerce a protobuf request object.
- # Sanity check: If we got a request object, we should *not* have
+ # Quick check: If we got a request object, we should *not* have
# gotten any keyword arguments that map to the request.
has_flattened_params = any([parent])
if request is not None and has_flattened_params:
@@ -893,12 +1193,20 @@ async def list_sinks(
)
# Send the request.
- response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,)
+ response = await rpc(
+ request,
+ retry=retry,
+ timeout=timeout,
+ metadata=metadata,
+ )
# This method is paged; wrap the response in a pager, which provides
# an `__aiter__` convenience method.
response = pagers.ListSinksAsyncPager(
- method=rpc, request=request, response=response, metadata=metadata,
+ method=rpc,
+ request=request,
+ response=response,
+ metadata=metadata,
)
# Done; return the response.
@@ -915,6 +1223,25 @@ async def get_sink(
) -> logging_config.LogSink:
r"""Gets a sink.
+ .. code-block:: python
+
+ from google.cloud import logging_v2
+
+ async def sample_get_sink():
+ # Create a client
+ client = logging_v2.ConfigServiceV2AsyncClient()
+
+ # Initialize request argument(s)
+ request = logging_v2.GetSinkRequest(
+ sink_name="sink_name_value",
+ )
+
+ # Make the request
+ response = await client.get_sink(request=request)
+
+ # Handle the response
+ print(response)
+
Args:
request (Union[google.cloud.logging_v2.types.GetSinkRequest, dict]):
The request object. The parameters to `GetSink`.
@@ -928,7 +1255,9 @@ async def get_sink(
"billingAccounts/[BILLING_ACCOUNT_ID]/sinks/[SINK_ID]"
"folders/[FOLDER_ID]/sinks/[SINK_ID]"
- Example: ``"projects/my-project-id/sinks/my-sink-id"``.
+ For example:
+
+ ``"projects/my-project/sinks/my-sink"``
This corresponds to the ``sink_name`` field
on the ``request`` instance; if ``request`` is provided, this
@@ -944,16 +1273,16 @@ async def get_sink(
Describes a sink used to export log
entries to one of the following
destinations in any project: a Cloud
- Storage bucket, a BigQuery dataset, or a
- Cloud Pub/Sub topic. A logs filter
- controls which log entries are exported.
- The sink must be created within a
- project, organization, billing account,
- or folder.
+ Storage bucket, a BigQuery dataset, a
+ Pub/Sub topic or a Cloud Logging log
+ bucket. A logs filter controls which log
+ entries are exported. The sink must be
+ created within a project, organization,
+ billing account, or folder.
"""
# Create or coerce a protobuf request object.
- # Sanity check: If we got a request object, we should *not* have
+ # Quick check: If we got a request object, we should *not* have
# gotten any keyword arguments that map to the request.
has_flattened_params = any([sink_name])
if request is not None and has_flattened_params:
@@ -997,7 +1326,12 @@ async def get_sink(
)
# Send the request.
- response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,)
+ response = await rpc(
+ request,
+ retry=retry,
+ timeout=timeout,
+ metadata=metadata,
+ )
# Done; return the response.
return response
@@ -1018,6 +1352,30 @@ async def create_sink(
permitted to write to the destination. A sink can export log
entries only from the resource owning the sink.
+ .. code-block:: python
+
+ from google.cloud import logging_v2
+
+ async def sample_create_sink():
+ # Create a client
+ client = logging_v2.ConfigServiceV2AsyncClient()
+
+ # Initialize request argument(s)
+ sink = logging_v2.LogSink()
+ sink.name = "name_value"
+ sink.destination = "destination_value"
+
+ request = logging_v2.CreateSinkRequest(
+ parent="parent_value",
+ sink=sink,
+ )
+
+ # Make the request
+ response = await client.create_sink(request=request)
+
+ # Handle the response
+ print(response)
+
Args:
request (Union[google.cloud.logging_v2.types.CreateSinkRequest, dict]):
The request object. The parameters to `CreateSink`.
@@ -1031,8 +1389,9 @@ async def create_sink(
"billingAccounts/[BILLING_ACCOUNT_ID]"
"folders/[FOLDER_ID]"
- Examples: ``"projects/my-logging-project"``,
- ``"organizations/123456789"``.
+ For examples:
+
+ ``"projects/my-project"`` ``"organizations/123456789"``
This corresponds to the ``parent`` field
on the ``request`` instance; if ``request`` is provided, this
@@ -1055,16 +1414,16 @@ async def create_sink(
Describes a sink used to export log
entries to one of the following
destinations in any project: a Cloud
- Storage bucket, a BigQuery dataset, or a
- Cloud Pub/Sub topic. A logs filter
- controls which log entries are exported.
- The sink must be created within a
- project, organization, billing account,
- or folder.
+ Storage bucket, a BigQuery dataset, a
+ Pub/Sub topic or a Cloud Logging log
+ bucket. A logs filter controls which log
+ entries are exported. The sink must be
+ created within a project, organization,
+ billing account, or folder.
"""
# Create or coerce a protobuf request object.
- # Sanity check: If we got a request object, we should *not* have
+ # Quick check: If we got a request object, we should *not* have
# gotten any keyword arguments that map to the request.
has_flattened_params = any([parent, sink])
if request is not None and has_flattened_params:
@@ -1097,7 +1456,12 @@ async def create_sink(
)
# Send the request.
- response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,)
+ response = await rpc(
+ request,
+ retry=retry,
+ timeout=timeout,
+ metadata=metadata,
+ )
# Done; return the response.
return response
@@ -1120,6 +1484,30 @@ async def update_sink(
The updated sink might also have a new ``writer_identity``; see
the ``unique_writer_identity`` field.
+ .. code-block:: python
+
+ from google.cloud import logging_v2
+
+ async def sample_update_sink():
+ # Create a client
+ client = logging_v2.ConfigServiceV2AsyncClient()
+
+ # Initialize request argument(s)
+ sink = logging_v2.LogSink()
+ sink.name = "name_value"
+ sink.destination = "destination_value"
+
+ request = logging_v2.UpdateSinkRequest(
+ sink_name="sink_name_value",
+ sink=sink,
+ )
+
+ # Make the request
+ response = await client.update_sink(request=request)
+
+ # Handle the response
+ print(response)
+
Args:
request (Union[google.cloud.logging_v2.types.UpdateSinkRequest, dict]):
The request object. The parameters to `UpdateSink`.
@@ -1134,7 +1522,9 @@ async def update_sink(
"billingAccounts/[BILLING_ACCOUNT_ID]/sinks/[SINK_ID]"
"folders/[FOLDER_ID]/sinks/[SINK_ID]"
- Example: ``"projects/my-project-id/sinks/my-sink-id"``.
+ For example:
+
+ ``"projects/my-project/sinks/my-sink"``
This corresponds to the ``sink_name`` field
on the ``request`` instance; if ``request`` is provided, this
@@ -1152,16 +1542,18 @@ async def update_sink(
overwritten if, and only if, it is in the update mask.
``name`` and output only fields cannot be updated.
- An empty updateMask is temporarily treated as using the
- following mask for backwards compatibility purposes:
- destination,filter,includeChildren At some point in the
- future, behavior will be removed and specifying an empty
- updateMask will be an error.
+ An empty ``updateMask`` is temporarily treated as using
+ the following mask for backwards compatibility purposes:
+
+ ``destination,filter,includeChildren``
+
+ At some point in the future, behavior will be removed
+ and specifying an empty ``updateMask`` will be an error.
For a detailed ``FieldMask`` definition, see
https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#google.protobuf.FieldMask
- Example: ``updateMask=filter``.
+ For example: ``updateMask=filter``
This corresponds to the ``update_mask`` field
on the ``request`` instance; if ``request`` is provided, this
@@ -1177,16 +1569,16 @@ async def update_sink(
Describes a sink used to export log
entries to one of the following
destinations in any project: a Cloud
- Storage bucket, a BigQuery dataset, or a
- Cloud Pub/Sub topic. A logs filter
- controls which log entries are exported.
- The sink must be created within a
- project, organization, billing account,
- or folder.
+ Storage bucket, a BigQuery dataset, a
+ Pub/Sub topic or a Cloud Logging log
+ bucket. A logs filter controls which log
+ entries are exported. The sink must be
+ created within a project, organization,
+ billing account, or folder.
"""
# Create or coerce a protobuf request object.
- # Sanity check: If we got a request object, we should *not* have
+ # Quick check: If we got a request object, we should *not* have
# gotten any keyword arguments that map to the request.
has_flattened_params = any([sink_name, sink, update_mask])
if request is not None and has_flattened_params:
@@ -1234,7 +1626,12 @@ async def update_sink(
)
# Send the request.
- response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,)
+ response = await rpc(
+ request,
+ retry=retry,
+ timeout=timeout,
+ metadata=metadata,
+ )
# Done; return the response.
return response
@@ -1251,6 +1648,22 @@ async def delete_sink(
r"""Deletes a sink. If the sink has a unique ``writer_identity``,
then that service account is also deleted.
+ .. code-block:: python
+
+ from google.cloud import logging_v2
+
+ async def sample_delete_sink():
+ # Create a client
+ client = logging_v2.ConfigServiceV2AsyncClient()
+
+ # Initialize request argument(s)
+ request = logging_v2.DeleteSinkRequest(
+ sink_name="sink_name_value",
+ )
+
+ # Make the request
+ await client.delete_sink(request=request)
+
Args:
request (Union[google.cloud.logging_v2.types.DeleteSinkRequest, dict]):
The request object. The parameters to `DeleteSink`.
@@ -1265,7 +1678,9 @@ async def delete_sink(
"billingAccounts/[BILLING_ACCOUNT_ID]/sinks/[SINK_ID]"
"folders/[FOLDER_ID]/sinks/[SINK_ID]"
- Example: ``"projects/my-project-id/sinks/my-sink-id"``.
+ For example:
+
+ ``"projects/my-project/sinks/my-sink"``
This corresponds to the ``sink_name`` field
on the ``request`` instance; if ``request`` is provided, this
@@ -1277,7 +1692,7 @@ async def delete_sink(
sent along with the request as metadata.
"""
# Create or coerce a protobuf request object.
- # Sanity check: If we got a request object, we should *not* have
+ # Quick check: If we got a request object, we should *not* have
# gotten any keyword arguments that map to the request.
has_flattened_params = any([sink_name])
if request is not None and has_flattened_params:
@@ -1322,7 +1737,10 @@ async def delete_sink(
# Send the request.
await rpc(
- request, retry=retry, timeout=timeout, metadata=metadata,
+ request,
+ retry=retry,
+ timeout=timeout,
+ metadata=metadata,
)
async def list_exclusions(
@@ -1334,7 +1752,28 @@ async def list_exclusions(
timeout: float = None,
metadata: Sequence[Tuple[str, str]] = (),
) -> pagers.ListExclusionsAsyncPager:
- r"""Lists all the exclusions in a parent resource.
+ r"""Lists all the exclusions on the \_Default sink in a parent
+ resource.
+
+ .. code-block:: python
+
+ from google.cloud import logging_v2
+
+ async def sample_list_exclusions():
+ # Create a client
+ client = logging_v2.ConfigServiceV2AsyncClient()
+
+ # Initialize request argument(s)
+ request = logging_v2.ListExclusionsRequest(
+ parent="parent_value",
+ )
+
+ # Make the request
+ page_result = client.list_exclusions(request=request)
+
+ # Handle the response
+ async for response in page_result:
+ print(response)
Args:
request (Union[google.cloud.logging_v2.types.ListExclusionsRequest, dict]):
@@ -1368,7 +1807,7 @@ async def list_exclusions(
"""
# Create or coerce a protobuf request object.
- # Sanity check: If we got a request object, we should *not* have
+ # Quick check: If we got a request object, we should *not* have
# gotten any keyword arguments that map to the request.
has_flattened_params = any([parent])
if request is not None and has_flattened_params:
@@ -1410,12 +1849,20 @@ async def list_exclusions(
)
# Send the request.
- response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,)
+ response = await rpc(
+ request,
+ retry=retry,
+ timeout=timeout,
+ metadata=metadata,
+ )
# This method is paged; wrap the response in a pager, which provides
# an `__aiter__` convenience method.
response = pagers.ListExclusionsAsyncPager(
- method=rpc, request=request, response=response, metadata=metadata,
+ method=rpc,
+ request=request,
+ response=response,
+ metadata=metadata,
)
# Done; return the response.
@@ -1430,7 +1877,26 @@ async def get_exclusion(
timeout: float = None,
metadata: Sequence[Tuple[str, str]] = (),
) -> logging_config.LogExclusion:
- r"""Gets the description of an exclusion.
+ r"""Gets the description of an exclusion in the \_Default sink.
+
+ .. code-block:: python
+
+ from google.cloud import logging_v2
+
+ async def sample_get_exclusion():
+ # Create a client
+ client = logging_v2.ConfigServiceV2AsyncClient()
+
+ # Initialize request argument(s)
+ request = logging_v2.GetExclusionRequest(
+ name="name_value",
+ )
+
+ # Make the request
+ response = await client.get_exclusion(request=request)
+
+ # Handle the response
+ print(response)
Args:
request (Union[google.cloud.logging_v2.types.GetExclusionRequest, dict]):
@@ -1445,8 +1911,9 @@ async def get_exclusion(
"billingAccounts/[BILLING_ACCOUNT_ID]/exclusions/[EXCLUSION_ID]"
"folders/[FOLDER_ID]/exclusions/[EXCLUSION_ID]"
- Example:
- ``"projects/my-project-id/exclusions/my-exclusion-id"``.
+ For example:
+
+ ``"projects/my-project/exclusions/my-exclusion"``
This corresponds to the ``name`` field
on the ``request`` instance; if ``request`` is provided, this
@@ -1459,21 +1926,17 @@ async def get_exclusion(
Returns:
google.cloud.logging_v2.types.LogExclusion:
- Specifies a set of log entries that
- are not to be stored in Logging. If your
- GCP resource receives a large volume of
- logs, you can use exclusions to reduce
- your chargeable logs. Exclusions are
- processed after log sinks, so you can
- export log entries before they are
- excluded. Note that organization-level
- and folder-level exclusions don't apply
- to child resources, and that you can't
- exclude audit log entries.
+ Specifies a set of log entries that are filtered out by a sink. If
+ your Google Cloud resource receives a large volume of
+ log entries, you can use exclusions to reduce your
+ chargeable logs. Note that exclusions on
+ organization-level and folder-level sinks don't apply
+ to child resources. Note also that you cannot modify
+ the \_Required sink or exclude logs from it.
"""
# Create or coerce a protobuf request object.
- # Sanity check: If we got a request object, we should *not* have
+ # Quick check: If we got a request object, we should *not* have
# gotten any keyword arguments that map to the request.
has_flattened_params = any([name])
if request is not None and has_flattened_params:
@@ -1515,7 +1978,12 @@ async def get_exclusion(
)
# Send the request.
- response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,)
+ response = await rpc(
+ request,
+ retry=retry,
+ timeout=timeout,
+ metadata=metadata,
+ )
# Done; return the response.
return response
@@ -1530,10 +1998,33 @@ async def create_exclusion(
timeout: float = None,
metadata: Sequence[Tuple[str, str]] = (),
) -> logging_config.LogExclusion:
- r"""Creates a new exclusion in a specified parent
- resource. Only log entries belonging to that resource
- can be excluded. You can have up to 10 exclusions in a
- resource.
+ r"""Creates a new exclusion in the \_Default sink in a specified
+ parent resource. Only log entries belonging to that resource can
+ be excluded. You can have up to 10 exclusions in a resource.
+
+ .. code-block:: python
+
+ from google.cloud import logging_v2
+
+ async def sample_create_exclusion():
+ # Create a client
+ client = logging_v2.ConfigServiceV2AsyncClient()
+
+ # Initialize request argument(s)
+ exclusion = logging_v2.LogExclusion()
+ exclusion.name = "name_value"
+ exclusion.filter = "filter_value"
+
+ request = logging_v2.CreateExclusionRequest(
+ parent="parent_value",
+ exclusion=exclusion,
+ )
+
+ # Make the request
+ response = await client.create_exclusion(request=request)
+
+ # Handle the response
+ print(response)
Args:
request (Union[google.cloud.logging_v2.types.CreateExclusionRequest, dict]):
@@ -1549,8 +2040,10 @@ async def create_exclusion(
"billingAccounts/[BILLING_ACCOUNT_ID]"
"folders/[FOLDER_ID]"
- Examples: ``"projects/my-logging-project"``,
- ``"organizations/123456789"``.
+ For examples:
+
+ ``"projects/my-logging-project"``
+ ``"organizations/123456789"``
This corresponds to the ``parent`` field
on the ``request`` instance; if ``request`` is provided, this
@@ -1571,21 +2064,17 @@ async def create_exclusion(
Returns:
google.cloud.logging_v2.types.LogExclusion:
- Specifies a set of log entries that
- are not to be stored in Logging. If your
- GCP resource receives a large volume of
- logs, you can use exclusions to reduce
- your chargeable logs. Exclusions are
- processed after log sinks, so you can
- export log entries before they are
- excluded. Note that organization-level
- and folder-level exclusions don't apply
- to child resources, and that you can't
- exclude audit log entries.
+ Specifies a set of log entries that are filtered out by a sink. If
+ your Google Cloud resource receives a large volume of
+ log entries, you can use exclusions to reduce your
+ chargeable logs. Note that exclusions on
+ organization-level and folder-level sinks don't apply
+ to child resources. Note also that you cannot modify
+ the \_Required sink or exclude logs from it.
"""
# Create or coerce a protobuf request object.
- # Sanity check: If we got a request object, we should *not* have
+ # Quick check: If we got a request object, we should *not* have
# gotten any keyword arguments that map to the request.
has_flattened_params = any([parent, exclusion])
if request is not None and has_flattened_params:
@@ -1618,7 +2107,12 @@ async def create_exclusion(
)
# Send the request.
- response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,)
+ response = await rpc(
+ request,
+ retry=retry,
+ timeout=timeout,
+ metadata=metadata,
+ )
# Done; return the response.
return response
@@ -1634,8 +2128,32 @@ async def update_exclusion(
timeout: float = None,
metadata: Sequence[Tuple[str, str]] = (),
) -> logging_config.LogExclusion:
- r"""Changes one or more properties of an existing
- exclusion.
+ r"""Changes one or more properties of an existing exclusion in the
+ \_Default sink.
+
+ .. code-block:: python
+
+ from google.cloud import logging_v2
+
+ async def sample_update_exclusion():
+ # Create a client
+ client = logging_v2.ConfigServiceV2AsyncClient()
+
+ # Initialize request argument(s)
+ exclusion = logging_v2.LogExclusion()
+ exclusion.name = "name_value"
+ exclusion.filter = "filter_value"
+
+ request = logging_v2.UpdateExclusionRequest(
+ name="name_value",
+ exclusion=exclusion,
+ )
+
+ # Make the request
+ response = await client.update_exclusion(request=request)
+
+ # Handle the response
+ print(response)
Args:
request (Union[google.cloud.logging_v2.types.UpdateExclusionRequest, dict]):
@@ -1650,8 +2168,9 @@ async def update_exclusion(
"billingAccounts/[BILLING_ACCOUNT_ID]/exclusions/[EXCLUSION_ID]"
"folders/[FOLDER_ID]/exclusions/[EXCLUSION_ID]"
- Example:
- ``"projects/my-project-id/exclusions/my-exclusion-id"``.
+ For example:
+
+ ``"projects/my-project/exclusions/my-exclusion"``
This corresponds to the ``name`` field
on the ``request`` instance; if ``request`` is provided, this
@@ -1686,21 +2205,17 @@ async def update_exclusion(
Returns:
google.cloud.logging_v2.types.LogExclusion:
- Specifies a set of log entries that
- are not to be stored in Logging. If your
- GCP resource receives a large volume of
- logs, you can use exclusions to reduce
- your chargeable logs. Exclusions are
- processed after log sinks, so you can
- export log entries before they are
- excluded. Note that organization-level
- and folder-level exclusions don't apply
- to child resources, and that you can't
- exclude audit log entries.
+ Specifies a set of log entries that are filtered out by a sink. If
+ your Google Cloud resource receives a large volume of
+ log entries, you can use exclusions to reduce your
+ chargeable logs. Note that exclusions on
+ organization-level and folder-level sinks don't apply
+ to child resources. Note also that you cannot modify
+ the \_Required sink or exclude logs from it.
"""
# Create or coerce a protobuf request object.
- # Sanity check: If we got a request object, we should *not* have
+ # Quick check: If we got a request object, we should *not* have
# gotten any keyword arguments that map to the request.
has_flattened_params = any([name, exclusion, update_mask])
if request is not None and has_flattened_params:
@@ -1735,7 +2250,12 @@ async def update_exclusion(
)
# Send the request.
- response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,)
+ response = await rpc(
+ request,
+ retry=retry,
+ timeout=timeout,
+ metadata=metadata,
+ )
# Done; return the response.
return response
@@ -1749,7 +2269,23 @@ async def delete_exclusion(
timeout: float = None,
metadata: Sequence[Tuple[str, str]] = (),
) -> None:
- r"""Deletes an exclusion.
+ r"""Deletes an exclusion in the \_Default sink.
+
+ .. code-block:: python
+
+ from google.cloud import logging_v2
+
+ async def sample_delete_exclusion():
+ # Create a client
+ client = logging_v2.ConfigServiceV2AsyncClient()
+
+ # Initialize request argument(s)
+ request = logging_v2.DeleteExclusionRequest(
+ name="name_value",
+ )
+
+ # Make the request
+ await client.delete_exclusion(request=request)
Args:
request (Union[google.cloud.logging_v2.types.DeleteExclusionRequest, dict]):
@@ -1765,8 +2301,9 @@ async def delete_exclusion(
"billingAccounts/[BILLING_ACCOUNT_ID]/exclusions/[EXCLUSION_ID]"
"folders/[FOLDER_ID]/exclusions/[EXCLUSION_ID]"
- Example:
- ``"projects/my-project-id/exclusions/my-exclusion-id"``.
+ For example:
+
+ ``"projects/my-project/exclusions/my-exclusion"``
This corresponds to the ``name`` field
on the ``request`` instance; if ``request`` is provided, this
@@ -1778,7 +2315,7 @@ async def delete_exclusion(
sent along with the request as metadata.
"""
# Create or coerce a protobuf request object.
- # Sanity check: If we got a request object, we should *not* have
+ # Quick check: If we got a request object, we should *not* have
# gotten any keyword arguments that map to the request.
has_flattened_params = any([name])
if request is not None and has_flattened_params:
@@ -1821,7 +2358,10 @@ async def delete_exclusion(
# Send the request.
await rpc(
- request, retry=retry, timeout=timeout, metadata=metadata,
+ request,
+ retry=retry,
+ timeout=timeout,
+ metadata=metadata,
)
async def get_cmek_settings(
@@ -1832,23 +2372,43 @@ async def get_cmek_settings(
timeout: float = None,
metadata: Sequence[Tuple[str, str]] = (),
) -> logging_config.CmekSettings:
- r"""Gets the Logs Router CMEK settings for the given resource.
+ r"""Gets the Logging CMEK settings for the given resource.
- Note: CMEK for the Logs Router can currently only be configured
- for GCP organizations. Once configured, it applies to all
- projects and folders in the GCP organization.
+ Note: CMEK for the Log Router can be configured for Google Cloud
+ projects, folders, organizations and billing accounts. Once
+ configured for an organization, it applies to all projects and
+ folders in the Google Cloud organization.
- See `Enabling CMEK for Logs
+ See `Enabling CMEK for Log
Router `__
for more information.
+ .. code-block:: python
+
+ from google.cloud import logging_v2
+
+ async def sample_get_cmek_settings():
+ # Create a client
+ client = logging_v2.ConfigServiceV2AsyncClient()
+
+ # Initialize request argument(s)
+ request = logging_v2.GetCmekSettingsRequest(
+ name="name_value",
+ )
+
+ # Make the request
+ response = await client.get_cmek_settings(request=request)
+
+ # Handle the response
+ print(response)
+
Args:
request (Union[google.cloud.logging_v2.types.GetCmekSettingsRequest, dict]):
The request object. The parameters to
[GetCmekSettings][google.logging.v2.ConfigServiceV2.GetCmekSettings].
- See [Enabling CMEK for Logs
- Router](https://cloud.google.com/logging/docs/routing/managed-
- encryption) for more information.
+ See [Enabling CMEK for Log
+ Router](https://cloud.google.com/logging/docs/routing/managed-encryption)
+ for more information.
retry (google.api_core.retry.Retry): Designation of what errors, if any,
should be retried.
timeout (float): The timeout for this request.
@@ -1861,12 +2421,12 @@ async def get_cmek_settings(
a project, folder, organization, billing account, or
flexible resource.
- Note: CMEK for the Logs Router can currently only be
- configured for GCP organizations. Once configured, it
- applies to all projects and folders in the GCP
- organization.
+ Note: CMEK for the Log Router can currently only be
+ configured for Google Cloud organizations. Once
+ configured, it applies to all projects and folders in
+ the Google Cloud organization.
- See [Enabling CMEK for Logs
+ See [Enabling CMEK for Log
Router](\ https://cloud.google.com/logging/docs/routing/managed-encryption)
for more information.
@@ -1889,7 +2449,12 @@ async def get_cmek_settings(
)
# Send the request.
- response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,)
+ response = await rpc(
+ request,
+ retry=retry,
+ timeout=timeout,
+ metadata=metadata,
+ )
# Done; return the response.
return response
@@ -1902,11 +2467,11 @@ async def update_cmek_settings(
timeout: float = None,
metadata: Sequence[Tuple[str, str]] = (),
) -> logging_config.CmekSettings:
- r"""Updates the Logs Router CMEK settings for the given resource.
+ r"""Updates the Log Router CMEK settings for the given resource.
- Note: CMEK for the Logs Router can currently only be configured
- for GCP organizations. Once configured, it applies to all
- projects and folders in the GCP organization.
+ Note: CMEK for the Log Router can currently only be configured
+ for Google Cloud organizations. Once configured, it applies to
+ all projects and folders in the Google Cloud organization.
[UpdateCmekSettings][google.logging.v2.ConfigServiceV2.UpdateCmekSettings]
will fail if 1) ``kms_key_name`` is invalid, or 2) the
@@ -1914,17 +2479,36 @@ async def update_cmek_settings(
``roles/cloudkms.cryptoKeyEncrypterDecrypter`` role assigned for
the key, or 3) access to the key is disabled.
- See `Enabling CMEK for Logs
+ See `Enabling CMEK for Log
Router `__
for more information.
+ .. code-block:: python
+
+ from google.cloud import logging_v2
+
+ async def sample_update_cmek_settings():
+ # Create a client
+ client = logging_v2.ConfigServiceV2AsyncClient()
+
+ # Initialize request argument(s)
+ request = logging_v2.UpdateCmekSettingsRequest(
+ name="name_value",
+ )
+
+ # Make the request
+ response = await client.update_cmek_settings(request=request)
+
+ # Handle the response
+ print(response)
+
Args:
request (Union[google.cloud.logging_v2.types.UpdateCmekSettingsRequest, dict]):
The request object. The parameters to
[UpdateCmekSettings][google.logging.v2.ConfigServiceV2.UpdateCmekSettings].
- See [Enabling CMEK for Logs
- Router](https://cloud.google.com/logging/docs/routing/managed-
- encryption) for more information.
+ See [Enabling CMEK for Log
+ Router](https://cloud.google.com/logging/docs/routing/managed-encryption)
+ for more information.
retry (google.api_core.retry.Retry): Designation of what errors, if any,
should be retried.
timeout (float): The timeout for this request.
@@ -1937,12 +2521,12 @@ async def update_cmek_settings(
a project, folder, organization, billing account, or
flexible resource.
- Note: CMEK for the Logs Router can currently only be
- configured for GCP organizations. Once configured, it
- applies to all projects and folders in the GCP
- organization.
+ Note: CMEK for the Log Router can currently only be
+ configured for Google Cloud organizations. Once
+ configured, it applies to all projects and folders in
+ the Google Cloud organization.
- See [Enabling CMEK for Logs
+ See [Enabling CMEK for Log
Router](\ https://cloud.google.com/logging/docs/routing/managed-encryption)
for more information.
@@ -1965,7 +2549,358 @@ async def update_cmek_settings(
)
# Send the request.
- response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,)
+ response = await rpc(
+ request,
+ retry=retry,
+ timeout=timeout,
+ metadata=metadata,
+ )
+
+ # Done; return the response.
+ return response
+
+ async def get_settings(
+ self,
+ request: Union[logging_config.GetSettingsRequest, dict] = None,
+ *,
+ name: str = None,
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
+ timeout: float = None,
+ metadata: Sequence[Tuple[str, str]] = (),
+ ) -> logging_config.Settings:
+ r"""Gets the Log Router settings for the given resource.
+
+ Note: Settings for the Log Router can be get for Google Cloud
+ projects, folders, organizations and billing accounts. Currently
+ it can only be configured for organizations. Once configured for
+ an organization, it applies to all projects and folders in the
+ Google Cloud organization.
+
+ See `Enabling CMEK for Log
+ Router `__
+ for more information.
+
+ .. code-block:: python
+
+ from google.cloud import logging_v2
+
+ async def sample_get_settings():
+ # Create a client
+ client = logging_v2.ConfigServiceV2AsyncClient()
+
+ # Initialize request argument(s)
+ request = logging_v2.GetSettingsRequest(
+ name="name_value",
+ )
+
+ # Make the request
+ response = await client.get_settings(request=request)
+
+ # Handle the response
+ print(response)
+
+ Args:
+ request (Union[google.cloud.logging_v2.types.GetSettingsRequest, dict]):
+ The request object. The parameters to
+ [GetSettings][google.logging.v2.ConfigServiceV2.GetSettings].
+ See [Enabling CMEK for Log
+ Router](https://cloud.google.com/logging/docs/routing/managed-encryption)
+ for more information.
+ name (:class:`str`):
+ Required. The resource for which to retrieve settings.
+
+ ::
+
+ "projects/[PROJECT_ID]/settings"
+ "organizations/[ORGANIZATION_ID]/settings"
+ "billingAccounts/[BILLING_ACCOUNT_ID]/settings"
+ "folders/[FOLDER_ID]/settings"
+
+ For example:
+
+ ``"organizations/12345/settings"``
+
+ Note: Settings for the Log Router can be get for Google
+ Cloud projects, folders, organizations and billing
+ accounts. Currently it can only be configured for
+ organizations. Once configured for an organization, it
+ applies to all projects and folders in the Google Cloud
+ organization.
+
+ This corresponds to the ``name`` field
+ on the ``request`` instance; if ``request`` is provided, this
+ should not be set.
+ retry (google.api_core.retry.Retry): Designation of what errors, if any,
+ should be retried.
+ timeout (float): The timeout for this request.
+ metadata (Sequence[Tuple[str, str]]): Strings which should be
+ sent along with the request as metadata.
+
+ Returns:
+ google.cloud.logging_v2.types.Settings:
+ Describes the settings associated
+ with a project, folder, organization,
+ billing account, or flexible resource.
+
+ """
+ # Create or coerce a protobuf request object.
+ # Quick check: If we got a request object, we should *not* have
+ # gotten any keyword arguments that map to the request.
+ has_flattened_params = any([name])
+ if request is not None and has_flattened_params:
+ raise ValueError(
+ "If the `request` argument is set, then none of "
+ "the individual field arguments should be set."
+ )
+
+ request = logging_config.GetSettingsRequest(request)
+
+ # If we have keyword arguments corresponding to fields on the
+ # request, apply these.
+ if name is not None:
+ request.name = name
+
+ # Wrap the RPC method; this adds retry and timeout information,
+ # and friendly error handling.
+ rpc = gapic_v1.method_async.wrap_method(
+ self._client._transport.get_settings,
+ default_timeout=None,
+ client_info=DEFAULT_CLIENT_INFO,
+ )
+
+ # Certain fields should be provided within the metadata header;
+ # add these here.
+ metadata = tuple(metadata) + (
+ gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)),
+ )
+
+ # Send the request.
+ response = await rpc(
+ request,
+ retry=retry,
+ timeout=timeout,
+ metadata=metadata,
+ )
+
+ # Done; return the response.
+ return response
+
+ async def update_settings(
+ self,
+ request: Union[logging_config.UpdateSettingsRequest, dict] = None,
+ *,
+ settings: logging_config.Settings = None,
+ update_mask: field_mask_pb2.FieldMask = None,
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
+ timeout: float = None,
+ metadata: Sequence[Tuple[str, str]] = (),
+ ) -> logging_config.Settings:
+ r"""Updates the Log Router settings for the given resource.
+
+ Note: Settings for the Log Router can currently only be
+ configured for Google Cloud organizations. Once configured, it
+ applies to all projects and folders in the Google Cloud
+ organization.
+
+ [UpdateSettings][google.logging.v2.ConfigServiceV2.UpdateSettings]
+ will fail if 1) ``kms_key_name`` is invalid, or 2) the
+ associated service account does not have the required
+ ``roles/cloudkms.cryptoKeyEncrypterDecrypter`` role assigned for
+ the key, or 3) access to the key is disabled. 4) ``location_id``
+ is not supported by Logging. 5) ``location_id`` violate
+ OrgPolicy.
+
+ See `Enabling CMEK for Log
+ Router `__
+ for more information.
+
+ .. code-block:: python
+
+ from google.cloud import logging_v2
+
+ async def sample_update_settings():
+ # Create a client
+ client = logging_v2.ConfigServiceV2AsyncClient()
+
+ # Initialize request argument(s)
+ request = logging_v2.UpdateSettingsRequest(
+ name="name_value",
+ )
+
+ # Make the request
+ response = await client.update_settings(request=request)
+
+ # Handle the response
+ print(response)
+
+ Args:
+ request (Union[google.cloud.logging_v2.types.UpdateSettingsRequest, dict]):
+ The request object. The parameters to
+ [UpdateSettings][google.logging.v2.ConfigServiceV2.UpdateSettings].
+ See [Enabling CMEK for Log
+ Router](https://cloud.google.com/logging/docs/routing/managed-encryption)
+ for more information.
+ settings (:class:`google.cloud.logging_v2.types.Settings`):
+ Required. The settings to update.
+
+ See `Enabling CMEK for Log
+ Router `__
+ for more information.
+
+ This corresponds to the ``settings`` field
+ on the ``request`` instance; if ``request`` is provided, this
+ should not be set.
+ update_mask (:class:`google.protobuf.field_mask_pb2.FieldMask`):
+ Optional. Field mask identifying which fields from
+ ``settings`` should be updated. A field will be
+ overwritten if and only if it is in the update mask.
+ Output only fields cannot be updated.
+
+ See [FieldMask][google.protobuf.FieldMask] for more
+ information.
+
+ For example: ``"updateMask=kmsKeyName"``
+
+ This corresponds to the ``update_mask`` field
+ on the ``request`` instance; if ``request`` is provided, this
+ should not be set.
+ retry (google.api_core.retry.Retry): Designation of what errors, if any,
+ should be retried.
+ timeout (float): The timeout for this request.
+ metadata (Sequence[Tuple[str, str]]): Strings which should be
+ sent along with the request as metadata.
+
+ Returns:
+ google.cloud.logging_v2.types.Settings:
+ Describes the settings associated
+ with a project, folder, organization,
+ billing account, or flexible resource.
+
+ """
+ # Create or coerce a protobuf request object.
+ # Quick check: If we got a request object, we should *not* have
+ # gotten any keyword arguments that map to the request.
+ has_flattened_params = any([settings, update_mask])
+ if request is not None and has_flattened_params:
+ raise ValueError(
+ "If the `request` argument is set, then none of "
+ "the individual field arguments should be set."
+ )
+
+ request = logging_config.UpdateSettingsRequest(request)
+
+ # If we have keyword arguments corresponding to fields on the
+ # request, apply these.
+ if settings is not None:
+ request.settings = settings
+ if update_mask is not None:
+ request.update_mask = update_mask
+
+ # Wrap the RPC method; this adds retry and timeout information,
+ # and friendly error handling.
+ rpc = gapic_v1.method_async.wrap_method(
+ self._client._transport.update_settings,
+ default_timeout=None,
+ client_info=DEFAULT_CLIENT_INFO,
+ )
+
+ # Certain fields should be provided within the metadata header;
+ # add these here.
+ metadata = tuple(metadata) + (
+ gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)),
+ )
+
+ # Send the request.
+ response = await rpc(
+ request,
+ retry=retry,
+ timeout=timeout,
+ metadata=metadata,
+ )
+
+ # Done; return the response.
+ return response
+
+ async def copy_log_entries(
+ self,
+ request: Union[logging_config.CopyLogEntriesRequest, dict] = None,
+ *,
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
+ timeout: float = None,
+ metadata: Sequence[Tuple[str, str]] = (),
+ ) -> operation_async.AsyncOperation:
+ r"""Copies a set of log entries from a log bucket to a
+ Cloud Storage bucket.
+
+ .. code-block:: python
+
+ from google.cloud import logging_v2
+
+ async def sample_copy_log_entries():
+ # Create a client
+ client = logging_v2.ConfigServiceV2AsyncClient()
+
+ # Initialize request argument(s)
+ request = logging_v2.CopyLogEntriesRequest(
+ name="name_value",
+ destination="destination_value",
+ )
+
+ # Make the request
+ operation = client.copy_log_entries(request=request)
+
+ print("Waiting for operation to complete...")
+
+ response = await operation.result()
+
+ # Handle the response
+ print(response)
+
+ Args:
+ request (Union[google.cloud.logging_v2.types.CopyLogEntriesRequest, dict]):
+ The request object. The parameters to CopyLogEntries.
+ retry (google.api_core.retry.Retry): Designation of what errors, if any,
+ should be retried.
+ timeout (float): The timeout for this request.
+ metadata (Sequence[Tuple[str, str]]): Strings which should be
+ sent along with the request as metadata.
+
+ Returns:
+ google.api_core.operation_async.AsyncOperation:
+ An object representing a long-running operation.
+
+ The result type for the operation will be
+ :class:`google.cloud.logging_v2.types.CopyLogEntriesResponse`
+ Response type for CopyLogEntries long running
+ operations.
+
+ """
+ # Create or coerce a protobuf request object.
+ request = logging_config.CopyLogEntriesRequest(request)
+
+ # Wrap the RPC method; this adds retry and timeout information,
+ # and friendly error handling.
+ rpc = gapic_v1.method_async.wrap_method(
+ self._client._transport.copy_log_entries,
+ default_timeout=None,
+ client_info=DEFAULT_CLIENT_INFO,
+ )
+
+ # Send the request.
+ response = await rpc(
+ request,
+ retry=retry,
+ timeout=timeout,
+ metadata=metadata,
+ )
+
+ # Wrap the response in an operation future.
+ response = operation_async.from_gapic(
+ response,
+ self._client._transport.operations_client,
+ logging_config.CopyLogEntriesResponse,
+ metadata_type=logging_config.CopyLogEntriesMetadata,
+ )
# Done; return the response.
return response
@@ -1979,7 +2914,9 @@ async def __aexit__(self, exc_type, exc, tb):
try:
DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo(
- gapic_version=pkg_resources.get_distribution("google-cloud-logging",).version,
+ gapic_version=pkg_resources.get_distribution(
+ "google-cloud-logging",
+ ).version,
)
except pkg_resources.DistributionNotFound:
DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo()
diff --git a/google/cloud/logging_v2/services/config_service_v2/client.py b/google/cloud/logging_v2/services/config_service_v2/client.py
index f4a1be57c..35e511abd 100644
--- a/google/cloud/logging_v2/services/config_service_v2/client.py
+++ b/google/cloud/logging_v2/services/config_service_v2/client.py
@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
-# Copyright 2020 Google LLC
+# Copyright 2022 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -16,7 +16,7 @@
from collections import OrderedDict
import os
import re
-from typing import Dict, Optional, Sequence, Tuple, Type, Union
+from typing import Dict, Mapping, Optional, Sequence, Tuple, Type, Union
import pkg_resources
from google.api_core import client_options as client_options_lib
@@ -34,6 +34,8 @@
except AttributeError: # pragma: NO COVER
OptionalRetry = Union[retries.Retry, object] # type: ignore
+from google.api_core import operation # type: ignore
+from google.api_core import operation_async # type: ignore
from google.cloud.logging_v2.services.config_service_v2 import pagers
from google.cloud.logging_v2.types import logging_config
from google.protobuf import field_mask_pb2 # type: ignore
@@ -57,7 +59,10 @@ class ConfigServiceV2ClientMeta(type):
_transport_registry["grpc"] = ConfigServiceV2GrpcTransport
_transport_registry["grpc_asyncio"] = ConfigServiceV2GrpcAsyncIOTransport
- def get_transport_class(cls, label: str = None,) -> Type[ConfigServiceV2Transport]:
+ def get_transport_class(
+ cls,
+ label: str = None,
+ ) -> Type[ConfigServiceV2Transport]:
"""Returns an appropriate transport class.
Args:
@@ -162,9 +167,13 @@ def transport(self) -> ConfigServiceV2Transport:
return self._transport
@staticmethod
- def cmek_settings_path(project: str,) -> str:
+ def cmek_settings_path(
+ project: str,
+ ) -> str:
"""Returns a fully-qualified cmek_settings string."""
- return "projects/{project}/cmekSettings".format(project=project,)
+ return "projects/{project}/cmekSettings".format(
+ project=project,
+ )
@staticmethod
def parse_cmek_settings_path(path: str) -> Dict[str, str]:
@@ -173,10 +182,16 @@ def parse_cmek_settings_path(path: str) -> Dict[str, str]:
return m.groupdict() if m else {}
@staticmethod
- def log_bucket_path(project: str, location: str, bucket: str,) -> str:
+ def log_bucket_path(
+ project: str,
+ location: str,
+ bucket: str,
+ ) -> str:
"""Returns a fully-qualified log_bucket string."""
return "projects/{project}/locations/{location}/buckets/{bucket}".format(
- project=project, location=location, bucket=bucket,
+ project=project,
+ location=location,
+ bucket=bucket,
)
@staticmethod
@@ -189,10 +204,14 @@ def parse_log_bucket_path(path: str) -> Dict[str, str]:
return m.groupdict() if m else {}
@staticmethod
- def log_exclusion_path(project: str, exclusion: str,) -> str:
+ def log_exclusion_path(
+ project: str,
+ exclusion: str,
+ ) -> str:
"""Returns a fully-qualified log_exclusion string."""
return "projects/{project}/exclusions/{exclusion}".format(
- project=project, exclusion=exclusion,
+ project=project,
+ exclusion=exclusion,
)
@staticmethod
@@ -202,9 +221,15 @@ def parse_log_exclusion_path(path: str) -> Dict[str, str]:
return m.groupdict() if m else {}
@staticmethod
- def log_sink_path(project: str, sink: str,) -> str:
+ def log_sink_path(
+ project: str,
+ sink: str,
+ ) -> str:
"""Returns a fully-qualified log_sink string."""
- return "projects/{project}/sinks/{sink}".format(project=project, sink=sink,)
+ return "projects/{project}/sinks/{sink}".format(
+ project=project,
+ sink=sink,
+ )
@staticmethod
def parse_log_sink_path(path: str) -> Dict[str, str]:
@@ -213,10 +238,18 @@ def parse_log_sink_path(path: str) -> Dict[str, str]:
return m.groupdict() if m else {}
@staticmethod
- def log_view_path(project: str, location: str, bucket: str, view: str,) -> str:
+ def log_view_path(
+ project: str,
+ location: str,
+ bucket: str,
+ view: str,
+ ) -> str:
"""Returns a fully-qualified log_view string."""
return "projects/{project}/locations/{location}/buckets/{bucket}/views/{view}".format(
- project=project, location=location, bucket=bucket, view=view,
+ project=project,
+ location=location,
+ bucket=bucket,
+ view=view,
)
@staticmethod
@@ -229,7 +262,24 @@ def parse_log_view_path(path: str) -> Dict[str, str]:
return m.groupdict() if m else {}
@staticmethod
- def common_billing_account_path(billing_account: str,) -> str:
+ def settings_path(
+ project: str,
+ ) -> str:
+ """Returns a fully-qualified settings string."""
+ return "projects/{project}/settings".format(
+ project=project,
+ )
+
+ @staticmethod
+ def parse_settings_path(path: str) -> Dict[str, str]:
+ """Parses a settings path into its component segments."""
+ m = re.match(r"^projects/(?P.+?)/settings$", path)
+ return m.groupdict() if m else {}
+
+ @staticmethod
+ def common_billing_account_path(
+ billing_account: str,
+ ) -> str:
"""Returns a fully-qualified billing_account string."""
return "billingAccounts/{billing_account}".format(
billing_account=billing_account,
@@ -242,9 +292,13 @@ def parse_common_billing_account_path(path: str) -> Dict[str, str]:
return m.groupdict() if m else {}
@staticmethod
- def common_folder_path(folder: str,) -> str:
+ def common_folder_path(
+ folder: str,
+ ) -> str:
"""Returns a fully-qualified folder string."""
- return "folders/{folder}".format(folder=folder,)
+ return "folders/{folder}".format(
+ folder=folder,
+ )
@staticmethod
def parse_common_folder_path(path: str) -> Dict[str, str]:
@@ -253,9 +307,13 @@ def parse_common_folder_path(path: str) -> Dict[str, str]:
return m.groupdict() if m else {}
@staticmethod
- def common_organization_path(organization: str,) -> str:
+ def common_organization_path(
+ organization: str,
+ ) -> str:
"""Returns a fully-qualified organization string."""
- return "organizations/{organization}".format(organization=organization,)
+ return "organizations/{organization}".format(
+ organization=organization,
+ )
@staticmethod
def parse_common_organization_path(path: str) -> Dict[str, str]:
@@ -264,9 +322,13 @@ def parse_common_organization_path(path: str) -> Dict[str, str]:
return m.groupdict() if m else {}
@staticmethod
- def common_project_path(project: str,) -> str:
+ def common_project_path(
+ project: str,
+ ) -> str:
"""Returns a fully-qualified project string."""
- return "projects/{project}".format(project=project,)
+ return "projects/{project}".format(
+ project=project,
+ )
@staticmethod
def parse_common_project_path(path: str) -> Dict[str, str]:
@@ -275,10 +337,14 @@ def parse_common_project_path(path: str) -> Dict[str, str]:
return m.groupdict() if m else {}
@staticmethod
- def common_location_path(project: str, location: str,) -> str:
+ def common_location_path(
+ project: str,
+ location: str,
+ ) -> str:
"""Returns a fully-qualified location string."""
return "projects/{project}/locations/{location}".format(
- project=project, location=location,
+ project=project,
+ location=location,
)
@staticmethod
@@ -461,7 +527,27 @@ def list_buckets(
timeout: float = None,
metadata: Sequence[Tuple[str, str]] = (),
) -> pagers.ListBucketsPager:
- r"""Lists buckets.
+ r"""Lists log buckets.
+
+ .. code-block:: python
+
+ from google.cloud import logging_v2
+
+ def sample_list_buckets():
+ # Create a client
+ client = logging_v2.ConfigServiceV2Client()
+
+ # Initialize request argument(s)
+ request = logging_v2.ListBucketsRequest(
+ parent="parent_value",
+ )
+
+ # Make the request
+ page_result = client.list_buckets(request=request)
+
+ # Handle the response
+ for response in page_result:
+ print(response)
Args:
request (Union[google.cloud.logging_v2.types.ListBucketsRequest, dict]):
@@ -499,7 +585,7 @@ def list_buckets(
"""
# Create or coerce a protobuf request object.
- # Sanity check: If we got a request object, we should *not* have
+ # Quick check: If we got a request object, we should *not* have
# gotten any keyword arguments that map to the request.
has_flattened_params = any([parent])
if request is not None and has_flattened_params:
@@ -530,12 +616,20 @@ def list_buckets(
)
# Send the request.
- response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,)
+ response = rpc(
+ request,
+ retry=retry,
+ timeout=timeout,
+ metadata=metadata,
+ )
# This method is paged; wrap the response in a pager, which provides
# an `__iter__` convenience method.
response = pagers.ListBucketsPager(
- method=rpc, request=request, response=response, metadata=metadata,
+ method=rpc,
+ request=request,
+ response=response,
+ metadata=metadata,
)
# Done; return the response.
@@ -549,7 +643,26 @@ def get_bucket(
timeout: float = None,
metadata: Sequence[Tuple[str, str]] = (),
) -> logging_config.LogBucket:
- r"""Gets a bucket.
+ r"""Gets a log bucket.
+
+ .. code-block:: python
+
+ from google.cloud import logging_v2
+
+ def sample_get_bucket():
+ # Create a client
+ client = logging_v2.ConfigServiceV2Client()
+
+ # Initialize request argument(s)
+ request = logging_v2.GetBucketRequest(
+ name="name_value",
+ )
+
+ # Make the request
+ response = client.get_bucket(request=request)
+
+ # Handle the response
+ print(response)
Args:
request (Union[google.cloud.logging_v2.types.GetBucketRequest, dict]):
@@ -562,7 +675,9 @@ def get_bucket(
Returns:
google.cloud.logging_v2.types.LogBucket:
- Describes a repository of logs.
+ Describes a repository in which log
+ entries are stored.
+
"""
# Create or coerce a protobuf request object.
# Minor optimization to avoid making a copy if the user passes
@@ -583,7 +698,12 @@ def get_bucket(
)
# Send the request.
- response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,)
+ response = rpc(
+ request,
+ retry=retry,
+ timeout=timeout,
+ metadata=metadata,
+ )
# Done; return the response.
return response
@@ -596,9 +716,29 @@ def create_bucket(
timeout: float = None,
metadata: Sequence[Tuple[str, str]] = (),
) -> logging_config.LogBucket:
- r"""Creates a bucket that can be used to store log
- entries. Once a bucket has been created, the region
- cannot be changed.
+ r"""Creates a log bucket that can be used to store log
+ entries. After a bucket has been created, the bucket's
+ location cannot be changed.
+
+ .. code-block:: python
+
+ from google.cloud import logging_v2
+
+ def sample_create_bucket():
+ # Create a client
+ client = logging_v2.ConfigServiceV2Client()
+
+ # Initialize request argument(s)
+ request = logging_v2.CreateBucketRequest(
+ parent="parent_value",
+ bucket_id="bucket_id_value",
+ )
+
+ # Make the request
+ response = client.create_bucket(request=request)
+
+ # Handle the response
+ print(response)
Args:
request (Union[google.cloud.logging_v2.types.CreateBucketRequest, dict]):
@@ -611,7 +751,9 @@ def create_bucket(
Returns:
google.cloud.logging_v2.types.LogBucket:
- Describes a repository of logs.
+ Describes a repository in which log
+ entries are stored.
+
"""
# Create or coerce a protobuf request object.
# Minor optimization to avoid making a copy if the user passes
@@ -632,7 +774,12 @@ def create_bucket(
)
# Send the request.
- response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,)
+ response = rpc(
+ request,
+ retry=retry,
+ timeout=timeout,
+ metadata=metadata,
+ )
# Done; return the response.
return response
@@ -645,17 +792,37 @@ def update_bucket(
timeout: float = None,
metadata: Sequence[Tuple[str, str]] = (),
) -> logging_config.LogBucket:
- r"""Updates a bucket. This method replaces the following fields in
- the existing bucket with values from the new bucket:
+ r"""Updates a log bucket. This method replaces the following fields
+ in the existing bucket with values from the new bucket:
``retention_period``
If the retention period is decreased and the bucket is locked,
- FAILED_PRECONDITION will be returned.
+ ``FAILED_PRECONDITION`` will be returned.
- If the bucket has a LifecycleState of DELETE_REQUESTED,
- FAILED_PRECONDITION will be returned.
+ If the bucket has a ``lifecycle_state`` of ``DELETE_REQUESTED``,
+ then ``FAILED_PRECONDITION`` will be returned.
- A buckets region may not be modified after it is created.
+ After a bucket has been created, the bucket's location cannot be
+ changed.
+
+ .. code-block:: python
+
+ from google.cloud import logging_v2
+
+ def sample_update_bucket():
+ # Create a client
+ client = logging_v2.ConfigServiceV2Client()
+
+ # Initialize request argument(s)
+ request = logging_v2.UpdateBucketRequest(
+ name="name_value",
+ )
+
+ # Make the request
+ response = client.update_bucket(request=request)
+
+ # Handle the response
+ print(response)
Args:
request (Union[google.cloud.logging_v2.types.UpdateBucketRequest, dict]):
@@ -668,7 +835,9 @@ def update_bucket(
Returns:
google.cloud.logging_v2.types.LogBucket:
- Describes a repository of logs.
+ Describes a repository in which log
+ entries are stored.
+
"""
# Create or coerce a protobuf request object.
# Minor optimization to avoid making a copy if the user passes
@@ -689,7 +858,12 @@ def update_bucket(
)
# Send the request.
- response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,)
+ response = rpc(
+ request,
+ retry=retry,
+ timeout=timeout,
+ metadata=metadata,
+ )
# Done; return the response.
return response
@@ -702,9 +876,28 @@ def delete_bucket(
timeout: float = None,
metadata: Sequence[Tuple[str, str]] = (),
) -> None:
- r"""Deletes a bucket. Moves the bucket to the DELETE_REQUESTED
- state. After 7 days, the bucket will be purged and all logs in
- the bucket will be permanently deleted.
+ r"""Deletes a log bucket.
+
+ Changes the bucket's ``lifecycle_state`` to the
+ ``DELETE_REQUESTED`` state. After 7 days, the bucket will be
+ purged and all log entries in the bucket will be permanently
+ deleted.
+
+ .. code-block:: python
+
+ from google.cloud import logging_v2
+
+ def sample_delete_bucket():
+ # Create a client
+ client = logging_v2.ConfigServiceV2Client()
+
+ # Initialize request argument(s)
+ request = logging_v2.DeleteBucketRequest(
+ name="name_value",
+ )
+
+ # Make the request
+ client.delete_bucket(request=request)
Args:
request (Union[google.cloud.logging_v2.types.DeleteBucketRequest, dict]):
@@ -735,7 +928,10 @@ def delete_bucket(
# Send the request.
rpc(
- request, retry=retry, timeout=timeout, metadata=metadata,
+ request,
+ retry=retry,
+ timeout=timeout,
+ metadata=metadata,
)
def undelete_bucket(
@@ -746,8 +942,25 @@ def undelete_bucket(
timeout: float = None,
metadata: Sequence[Tuple[str, str]] = (),
) -> None:
- r"""Undeletes a bucket. A bucket that has been deleted
- may be undeleted within the grace period of 7 days.
+ r"""Undeletes a log bucket. A bucket that has been
+ deleted can be undeleted within the grace period of 7
+ days.
+
+ .. code-block:: python
+
+ from google.cloud import logging_v2
+
+ def sample_undelete_bucket():
+ # Create a client
+ client = logging_v2.ConfigServiceV2Client()
+
+ # Initialize request argument(s)
+ request = logging_v2.UndeleteBucketRequest(
+ name="name_value",
+ )
+
+ # Make the request
+ client.undelete_bucket(request=request)
Args:
request (Union[google.cloud.logging_v2.types.UndeleteBucketRequest, dict]):
@@ -778,7 +991,10 @@ def undelete_bucket(
# Send the request.
rpc(
- request, retry=retry, timeout=timeout, metadata=metadata,
+ request,
+ retry=retry,
+ timeout=timeout,
+ metadata=metadata,
)
def list_views(
@@ -790,7 +1006,27 @@ def list_views(
timeout: float = None,
metadata: Sequence[Tuple[str, str]] = (),
) -> pagers.ListViewsPager:
- r"""Lists views on a bucket.
+ r"""Lists views on a log bucket.
+
+ .. code-block:: python
+
+ from google.cloud import logging_v2
+
+ def sample_list_views():
+ # Create a client
+ client = logging_v2.ConfigServiceV2Client()
+
+ # Initialize request argument(s)
+ request = logging_v2.ListViewsRequest(
+ parent="parent_value",
+ )
+
+ # Make the request
+ page_result = client.list_views(request=request)
+
+ # Handle the response
+ for response in page_result:
+ print(response)
Args:
request (Union[google.cloud.logging_v2.types.ListViewsRequest, dict]):
@@ -820,7 +1056,7 @@ def list_views(
"""
# Create or coerce a protobuf request object.
- # Sanity check: If we got a request object, we should *not* have
+ # Quick check: If we got a request object, we should *not* have
# gotten any keyword arguments that map to the request.
has_flattened_params = any([parent])
if request is not None and has_flattened_params:
@@ -851,12 +1087,20 @@ def list_views(
)
# Send the request.
- response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,)
+ response = rpc(
+ request,
+ retry=retry,
+ timeout=timeout,
+ metadata=metadata,
+ )
# This method is paged; wrap the response in a pager, which provides
# an `__iter__` convenience method.
response = pagers.ListViewsPager(
- method=rpc, request=request, response=response, metadata=metadata,
+ method=rpc,
+ request=request,
+ response=response,
+ metadata=metadata,
)
# Done; return the response.
@@ -870,7 +1114,26 @@ def get_view(
timeout: float = None,
metadata: Sequence[Tuple[str, str]] = (),
) -> logging_config.LogView:
- r"""Gets a view.
+ r"""Gets a view on a log bucket..
+
+ .. code-block:: python
+
+ from google.cloud import logging_v2
+
+ def sample_get_view():
+ # Create a client
+ client = logging_v2.ConfigServiceV2Client()
+
+ # Initialize request argument(s)
+ request = logging_v2.GetViewRequest(
+ name="name_value",
+ )
+
+ # Make the request
+ response = client.get_view(request=request)
+
+ # Handle the response
+ print(response)
Args:
request (Union[google.cloud.logging_v2.types.GetViewRequest, dict]):
@@ -883,8 +1146,8 @@ def get_view(
Returns:
google.cloud.logging_v2.types.LogView:
- Describes a view over logs in a
- bucket.
+ Describes a view over log entries in
+ a bucket.
"""
# Create or coerce a protobuf request object.
@@ -906,7 +1169,12 @@ def get_view(
)
# Send the request.
- response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,)
+ response = rpc(
+ request,
+ retry=retry,
+ timeout=timeout,
+ metadata=metadata,
+ )
# Done; return the response.
return response
@@ -919,8 +1187,28 @@ def create_view(
timeout: float = None,
metadata: Sequence[Tuple[str, str]] = (),
) -> logging_config.LogView:
- r"""Creates a view over logs in a bucket. A bucket may
- contain a maximum of 50 views.
+ r"""Creates a view over log entries in a log bucket. A
+ bucket may contain a maximum of 30 views.
+
+ .. code-block:: python
+
+ from google.cloud import logging_v2
+
+ def sample_create_view():
+ # Create a client
+ client = logging_v2.ConfigServiceV2Client()
+
+ # Initialize request argument(s)
+ request = logging_v2.CreateViewRequest(
+ parent="parent_value",
+ view_id="view_id_value",
+ )
+
+ # Make the request
+ response = client.create_view(request=request)
+
+ # Handle the response
+ print(response)
Args:
request (Union[google.cloud.logging_v2.types.CreateViewRequest, dict]):
@@ -933,8 +1221,8 @@ def create_view(
Returns:
google.cloud.logging_v2.types.LogView:
- Describes a view over logs in a
- bucket.
+ Describes a view over log entries in
+ a bucket.
"""
# Create or coerce a protobuf request object.
@@ -956,7 +1244,12 @@ def create_view(
)
# Send the request.
- response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,)
+ response = rpc(
+ request,
+ retry=retry,
+ timeout=timeout,
+ metadata=metadata,
+ )
# Done; return the response.
return response
@@ -969,8 +1262,30 @@ def update_view(
timeout: float = None,
metadata: Sequence[Tuple[str, str]] = (),
) -> logging_config.LogView:
- r"""Updates a view. This method replaces the following fields in the
- existing view with values from the new view: ``filter``.
+ r"""Updates a view on a log bucket. This method replaces the
+ following fields in the existing view with values from the new
+ view: ``filter``. If an ``UNAVAILABLE`` error is returned, this
+ indicates that system is not in a state where it can update the
+ view. If this occurs, please try again in a few minutes.
+
+ .. code-block:: python
+
+ from google.cloud import logging_v2
+
+ def sample_update_view():
+ # Create a client
+ client = logging_v2.ConfigServiceV2Client()
+
+ # Initialize request argument(s)
+ request = logging_v2.UpdateViewRequest(
+ name="name_value",
+ )
+
+ # Make the request
+ response = client.update_view(request=request)
+
+ # Handle the response
+ print(response)
Args:
request (Union[google.cloud.logging_v2.types.UpdateViewRequest, dict]):
@@ -983,8 +1298,8 @@ def update_view(
Returns:
google.cloud.logging_v2.types.LogView:
- Describes a view over logs in a
- bucket.
+ Describes a view over log entries in
+ a bucket.
"""
# Create or coerce a protobuf request object.
@@ -1006,7 +1321,12 @@ def update_view(
)
# Send the request.
- response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,)
+ response = rpc(
+ request,
+ retry=retry,
+ timeout=timeout,
+ metadata=metadata,
+ )
# Done; return the response.
return response
@@ -1019,7 +1339,26 @@ def delete_view(
timeout: float = None,
metadata: Sequence[Tuple[str, str]] = (),
) -> None:
- r"""Deletes a view from a bucket.
+ r"""Deletes a view on a log bucket. If an ``UNAVAILABLE`` error is
+ returned, this indicates that system is not in a state where it
+ can delete the view. If this occurs, please try again in a few
+ minutes.
+
+ .. code-block:: python
+
+ from google.cloud import logging_v2
+
+ def sample_delete_view():
+ # Create a client
+ client = logging_v2.ConfigServiceV2Client()
+
+ # Initialize request argument(s)
+ request = logging_v2.DeleteViewRequest(
+ name="name_value",
+ )
+
+ # Make the request
+ client.delete_view(request=request)
Args:
request (Union[google.cloud.logging_v2.types.DeleteViewRequest, dict]):
@@ -1050,7 +1389,10 @@ def delete_view(
# Send the request.
rpc(
- request, retry=retry, timeout=timeout, metadata=metadata,
+ request,
+ retry=retry,
+ timeout=timeout,
+ metadata=metadata,
)
def list_sinks(
@@ -1064,6 +1406,26 @@ def list_sinks(
) -> pagers.ListSinksPager:
r"""Lists sinks.
+ .. code-block:: python
+
+ from google.cloud import logging_v2
+
+ def sample_list_sinks():
+ # Create a client
+ client = logging_v2.ConfigServiceV2Client()
+
+ # Initialize request argument(s)
+ request = logging_v2.ListSinksRequest(
+ parent="parent_value",
+ )
+
+ # Make the request
+ page_result = client.list_sinks(request=request)
+
+ # Handle the response
+ for response in page_result:
+ print(response)
+
Args:
request (Union[google.cloud.logging_v2.types.ListSinksRequest, dict]):
The request object. The parameters to `ListSinks`.
@@ -1096,7 +1458,7 @@ def list_sinks(
"""
# Create or coerce a protobuf request object.
- # Sanity check: If we got a request object, we should *not* have
+ # Quick check: If we got a request object, we should *not* have
# gotten any keyword arguments that map to the request.
has_flattened_params = any([parent])
if request is not None and has_flattened_params:
@@ -1127,12 +1489,20 @@ def list_sinks(
)
# Send the request.
- response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,)
+ response = rpc(
+ request,
+ retry=retry,
+ timeout=timeout,
+ metadata=metadata,
+ )
# This method is paged; wrap the response in a pager, which provides
# an `__iter__` convenience method.
response = pagers.ListSinksPager(
- method=rpc, request=request, response=response, metadata=metadata,
+ method=rpc,
+ request=request,
+ response=response,
+ metadata=metadata,
)
# Done; return the response.
@@ -1149,6 +1519,25 @@ def get_sink(
) -> logging_config.LogSink:
r"""Gets a sink.
+ .. code-block:: python
+
+ from google.cloud import logging_v2
+
+ def sample_get_sink():
+ # Create a client
+ client = logging_v2.ConfigServiceV2Client()
+
+ # Initialize request argument(s)
+ request = logging_v2.GetSinkRequest(
+ sink_name="sink_name_value",
+ )
+
+ # Make the request
+ response = client.get_sink(request=request)
+
+ # Handle the response
+ print(response)
+
Args:
request (Union[google.cloud.logging_v2.types.GetSinkRequest, dict]):
The request object. The parameters to `GetSink`.
@@ -1162,7 +1551,9 @@ def get_sink(
"billingAccounts/[BILLING_ACCOUNT_ID]/sinks/[SINK_ID]"
"folders/[FOLDER_ID]/sinks/[SINK_ID]"
- Example: ``"projects/my-project-id/sinks/my-sink-id"``.
+ For example:
+
+ ``"projects/my-project/sinks/my-sink"``
This corresponds to the ``sink_name`` field
on the ``request`` instance; if ``request`` is provided, this
@@ -1178,16 +1569,16 @@ def get_sink(
Describes a sink used to export log
entries to one of the following
destinations in any project: a Cloud
- Storage bucket, a BigQuery dataset, or a
- Cloud Pub/Sub topic. A logs filter
- controls which log entries are exported.
- The sink must be created within a
- project, organization, billing account,
- or folder.
+ Storage bucket, a BigQuery dataset, a
+ Pub/Sub topic or a Cloud Logging log
+ bucket. A logs filter controls which log
+ entries are exported. The sink must be
+ created within a project, organization,
+ billing account, or folder.
"""
# Create or coerce a protobuf request object.
- # Sanity check: If we got a request object, we should *not* have
+ # Quick check: If we got a request object, we should *not* have
# gotten any keyword arguments that map to the request.
has_flattened_params = any([sink_name])
if request is not None and has_flattened_params:
@@ -1220,7 +1611,12 @@ def get_sink(
)
# Send the request.
- response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,)
+ response = rpc(
+ request,
+ retry=retry,
+ timeout=timeout,
+ metadata=metadata,
+ )
# Done; return the response.
return response
@@ -1241,6 +1637,30 @@ def create_sink(
permitted to write to the destination. A sink can export log
entries only from the resource owning the sink.
+ .. code-block:: python
+
+ from google.cloud import logging_v2
+
+ def sample_create_sink():
+ # Create a client
+ client = logging_v2.ConfigServiceV2Client()
+
+ # Initialize request argument(s)
+ sink = logging_v2.LogSink()
+ sink.name = "name_value"
+ sink.destination = "destination_value"
+
+ request = logging_v2.CreateSinkRequest(
+ parent="parent_value",
+ sink=sink,
+ )
+
+ # Make the request
+ response = client.create_sink(request=request)
+
+ # Handle the response
+ print(response)
+
Args:
request (Union[google.cloud.logging_v2.types.CreateSinkRequest, dict]):
The request object. The parameters to `CreateSink`.
@@ -1254,8 +1674,9 @@ def create_sink(
"billingAccounts/[BILLING_ACCOUNT_ID]"
"folders/[FOLDER_ID]"
- Examples: ``"projects/my-logging-project"``,
- ``"organizations/123456789"``.
+ For examples:
+
+ ``"projects/my-project"`` ``"organizations/123456789"``
This corresponds to the ``parent`` field
on the ``request`` instance; if ``request`` is provided, this
@@ -1278,16 +1699,16 @@ def create_sink(
Describes a sink used to export log
entries to one of the following
destinations in any project: a Cloud
- Storage bucket, a BigQuery dataset, or a
- Cloud Pub/Sub topic. A logs filter
- controls which log entries are exported.
- The sink must be created within a
- project, organization, billing account,
- or folder.
+ Storage bucket, a BigQuery dataset, a
+ Pub/Sub topic or a Cloud Logging log
+ bucket. A logs filter controls which log
+ entries are exported. The sink must be
+ created within a project, organization,
+ billing account, or folder.
"""
# Create or coerce a protobuf request object.
- # Sanity check: If we got a request object, we should *not* have
+ # Quick check: If we got a request object, we should *not* have
# gotten any keyword arguments that map to the request.
has_flattened_params = any([parent, sink])
if request is not None and has_flattened_params:
@@ -1320,7 +1741,12 @@ def create_sink(
)
# Send the request.
- response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,)
+ response = rpc(
+ request,
+ retry=retry,
+ timeout=timeout,
+ metadata=metadata,
+ )
# Done; return the response.
return response
@@ -1343,6 +1769,30 @@ def update_sink(
The updated sink might also have a new ``writer_identity``; see
the ``unique_writer_identity`` field.
+ .. code-block:: python
+
+ from google.cloud import logging_v2
+
+ def sample_update_sink():
+ # Create a client
+ client = logging_v2.ConfigServiceV2Client()
+
+ # Initialize request argument(s)
+ sink = logging_v2.LogSink()
+ sink.name = "name_value"
+ sink.destination = "destination_value"
+
+ request = logging_v2.UpdateSinkRequest(
+ sink_name="sink_name_value",
+ sink=sink,
+ )
+
+ # Make the request
+ response = client.update_sink(request=request)
+
+ # Handle the response
+ print(response)
+
Args:
request (Union[google.cloud.logging_v2.types.UpdateSinkRequest, dict]):
The request object. The parameters to `UpdateSink`.
@@ -1357,7 +1807,9 @@ def update_sink(
"billingAccounts/[BILLING_ACCOUNT_ID]/sinks/[SINK_ID]"
"folders/[FOLDER_ID]/sinks/[SINK_ID]"
- Example: ``"projects/my-project-id/sinks/my-sink-id"``.
+ For example:
+
+ ``"projects/my-project/sinks/my-sink"``
This corresponds to the ``sink_name`` field
on the ``request`` instance; if ``request`` is provided, this
@@ -1375,16 +1827,18 @@ def update_sink(
overwritten if, and only if, it is in the update mask.
``name`` and output only fields cannot be updated.
- An empty updateMask is temporarily treated as using the
- following mask for backwards compatibility purposes:
- destination,filter,includeChildren At some point in the
- future, behavior will be removed and specifying an empty
- updateMask will be an error.
+ An empty ``updateMask`` is temporarily treated as using
+ the following mask for backwards compatibility purposes:
+
+ ``destination,filter,includeChildren``
+
+ At some point in the future, behavior will be removed
+ and specifying an empty ``updateMask`` will be an error.
For a detailed ``FieldMask`` definition, see
https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#google.protobuf.FieldMask
- Example: ``updateMask=filter``.
+ For example: ``updateMask=filter``
This corresponds to the ``update_mask`` field
on the ``request`` instance; if ``request`` is provided, this
@@ -1400,16 +1854,16 @@ def update_sink(
Describes a sink used to export log
entries to one of the following
destinations in any project: a Cloud
- Storage bucket, a BigQuery dataset, or a
- Cloud Pub/Sub topic. A logs filter
- controls which log entries are exported.
- The sink must be created within a
- project, organization, billing account,
- or folder.
+ Storage bucket, a BigQuery dataset, a
+ Pub/Sub topic or a Cloud Logging log
+ bucket. A logs filter controls which log
+ entries are exported. The sink must be
+ created within a project, organization,
+ billing account, or folder.
"""
# Create or coerce a protobuf request object.
- # Sanity check: If we got a request object, we should *not* have
+ # Quick check: If we got a request object, we should *not* have
# gotten any keyword arguments that map to the request.
has_flattened_params = any([sink_name, sink, update_mask])
if request is not None and has_flattened_params:
@@ -1446,7 +1900,12 @@ def update_sink(
)
# Send the request.
- response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,)
+ response = rpc(
+ request,
+ retry=retry,
+ timeout=timeout,
+ metadata=metadata,
+ )
# Done; return the response.
return response
@@ -1463,6 +1922,22 @@ def delete_sink(
r"""Deletes a sink. If the sink has a unique ``writer_identity``,
then that service account is also deleted.
+ .. code-block:: python
+
+ from google.cloud import logging_v2
+
+ def sample_delete_sink():
+ # Create a client
+ client = logging_v2.ConfigServiceV2Client()
+
+ # Initialize request argument(s)
+ request = logging_v2.DeleteSinkRequest(
+ sink_name="sink_name_value",
+ )
+
+ # Make the request
+ client.delete_sink(request=request)
+
Args:
request (Union[google.cloud.logging_v2.types.DeleteSinkRequest, dict]):
The request object. The parameters to `DeleteSink`.
@@ -1477,7 +1952,9 @@ def delete_sink(
"billingAccounts/[BILLING_ACCOUNT_ID]/sinks/[SINK_ID]"
"folders/[FOLDER_ID]/sinks/[SINK_ID]"
- Example: ``"projects/my-project-id/sinks/my-sink-id"``.
+ For example:
+
+ ``"projects/my-project/sinks/my-sink"``
This corresponds to the ``sink_name`` field
on the ``request`` instance; if ``request`` is provided, this
@@ -1489,7 +1966,7 @@ def delete_sink(
sent along with the request as metadata.
"""
# Create or coerce a protobuf request object.
- # Sanity check: If we got a request object, we should *not* have
+ # Quick check: If we got a request object, we should *not* have
# gotten any keyword arguments that map to the request.
has_flattened_params = any([sink_name])
if request is not None and has_flattened_params:
@@ -1523,7 +2000,10 @@ def delete_sink(
# Send the request.
rpc(
- request, retry=retry, timeout=timeout, metadata=metadata,
+ request,
+ retry=retry,
+ timeout=timeout,
+ metadata=metadata,
)
def list_exclusions(
@@ -1535,7 +2015,28 @@ def list_exclusions(
timeout: float = None,
metadata: Sequence[Tuple[str, str]] = (),
) -> pagers.ListExclusionsPager:
- r"""Lists all the exclusions in a parent resource.
+ r"""Lists all the exclusions on the \_Default sink in a parent
+ resource.
+
+ .. code-block:: python
+
+ from google.cloud import logging_v2
+
+ def sample_list_exclusions():
+ # Create a client
+ client = logging_v2.ConfigServiceV2Client()
+
+ # Initialize request argument(s)
+ request = logging_v2.ListExclusionsRequest(
+ parent="parent_value",
+ )
+
+ # Make the request
+ page_result = client.list_exclusions(request=request)
+
+ # Handle the response
+ for response in page_result:
+ print(response)
Args:
request (Union[google.cloud.logging_v2.types.ListExclusionsRequest, dict]):
@@ -1569,7 +2070,7 @@ def list_exclusions(
"""
# Create or coerce a protobuf request object.
- # Sanity check: If we got a request object, we should *not* have
+ # Quick check: If we got a request object, we should *not* have
# gotten any keyword arguments that map to the request.
has_flattened_params = any([parent])
if request is not None and has_flattened_params:
@@ -1600,12 +2101,20 @@ def list_exclusions(
)
# Send the request.
- response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,)
+ response = rpc(
+ request,
+ retry=retry,
+ timeout=timeout,
+ metadata=metadata,
+ )
# This method is paged; wrap the response in a pager, which provides
# an `__iter__` convenience method.
response = pagers.ListExclusionsPager(
- method=rpc, request=request, response=response, metadata=metadata,
+ method=rpc,
+ request=request,
+ response=response,
+ metadata=metadata,
)
# Done; return the response.
@@ -1620,7 +2129,26 @@ def get_exclusion(
timeout: float = None,
metadata: Sequence[Tuple[str, str]] = (),
) -> logging_config.LogExclusion:
- r"""Gets the description of an exclusion.
+ r"""Gets the description of an exclusion in the \_Default sink.
+
+ .. code-block:: python
+
+ from google.cloud import logging_v2
+
+ def sample_get_exclusion():
+ # Create a client
+ client = logging_v2.ConfigServiceV2Client()
+
+ # Initialize request argument(s)
+ request = logging_v2.GetExclusionRequest(
+ name="name_value",
+ )
+
+ # Make the request
+ response = client.get_exclusion(request=request)
+
+ # Handle the response
+ print(response)
Args:
request (Union[google.cloud.logging_v2.types.GetExclusionRequest, dict]):
@@ -1635,8 +2163,9 @@ def get_exclusion(
"billingAccounts/[BILLING_ACCOUNT_ID]/exclusions/[EXCLUSION_ID]"
"folders/[FOLDER_ID]/exclusions/[EXCLUSION_ID]"
- Example:
- ``"projects/my-project-id/exclusions/my-exclusion-id"``.
+ For example:
+
+ ``"projects/my-project/exclusions/my-exclusion"``
This corresponds to the ``name`` field
on the ``request`` instance; if ``request`` is provided, this
@@ -1649,21 +2178,17 @@ def get_exclusion(
Returns:
google.cloud.logging_v2.types.LogExclusion:
- Specifies a set of log entries that
- are not to be stored in Logging. If your
- GCP resource receives a large volume of
- logs, you can use exclusions to reduce
- your chargeable logs. Exclusions are
- processed after log sinks, so you can
- export log entries before they are
- excluded. Note that organization-level
- and folder-level exclusions don't apply
- to child resources, and that you can't
- exclude audit log entries.
+ Specifies a set of log entries that are filtered out by a sink. If
+ your Google Cloud resource receives a large volume of
+ log entries, you can use exclusions to reduce your
+ chargeable logs. Note that exclusions on
+ organization-level and folder-level sinks don't apply
+ to child resources. Note also that you cannot modify
+ the \_Required sink or exclude logs from it.
"""
# Create or coerce a protobuf request object.
- # Sanity check: If we got a request object, we should *not* have
+ # Quick check: If we got a request object, we should *not* have
# gotten any keyword arguments that map to the request.
has_flattened_params = any([name])
if request is not None and has_flattened_params:
@@ -1694,7 +2219,12 @@ def get_exclusion(
)
# Send the request.
- response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,)
+ response = rpc(
+ request,
+ retry=retry,
+ timeout=timeout,
+ metadata=metadata,
+ )
# Done; return the response.
return response
@@ -1709,10 +2239,33 @@ def create_exclusion(
timeout: float = None,
metadata: Sequence[Tuple[str, str]] = (),
) -> logging_config.LogExclusion:
- r"""Creates a new exclusion in a specified parent
- resource. Only log entries belonging to that resource
- can be excluded. You can have up to 10 exclusions in a
- resource.
+ r"""Creates a new exclusion in the \_Default sink in a specified
+ parent resource. Only log entries belonging to that resource can
+ be excluded. You can have up to 10 exclusions in a resource.
+
+ .. code-block:: python
+
+ from google.cloud import logging_v2
+
+ def sample_create_exclusion():
+ # Create a client
+ client = logging_v2.ConfigServiceV2Client()
+
+ # Initialize request argument(s)
+ exclusion = logging_v2.LogExclusion()
+ exclusion.name = "name_value"
+ exclusion.filter = "filter_value"
+
+ request = logging_v2.CreateExclusionRequest(
+ parent="parent_value",
+ exclusion=exclusion,
+ )
+
+ # Make the request
+ response = client.create_exclusion(request=request)
+
+ # Handle the response
+ print(response)
Args:
request (Union[google.cloud.logging_v2.types.CreateExclusionRequest, dict]):
@@ -1728,8 +2281,10 @@ def create_exclusion(
"billingAccounts/[BILLING_ACCOUNT_ID]"
"folders/[FOLDER_ID]"
- Examples: ``"projects/my-logging-project"``,
- ``"organizations/123456789"``.
+ For examples:
+
+ ``"projects/my-logging-project"``
+ ``"organizations/123456789"``
This corresponds to the ``parent`` field
on the ``request`` instance; if ``request`` is provided, this
@@ -1750,21 +2305,17 @@ def create_exclusion(
Returns:
google.cloud.logging_v2.types.LogExclusion:
- Specifies a set of log entries that
- are not to be stored in Logging. If your
- GCP resource receives a large volume of
- logs, you can use exclusions to reduce
- your chargeable logs. Exclusions are
- processed after log sinks, so you can
- export log entries before they are
- excluded. Note that organization-level
- and folder-level exclusions don't apply
- to child resources, and that you can't
- exclude audit log entries.
+ Specifies a set of log entries that are filtered out by a sink. If
+ your Google Cloud resource receives a large volume of
+ log entries, you can use exclusions to reduce your
+ chargeable logs. Note that exclusions on
+ organization-level and folder-level sinks don't apply
+ to child resources. Note also that you cannot modify
+ the \_Required sink or exclude logs from it.
"""
# Create or coerce a protobuf request object.
- # Sanity check: If we got a request object, we should *not* have
+ # Quick check: If we got a request object, we should *not* have
# gotten any keyword arguments that map to the request.
has_flattened_params = any([parent, exclusion])
if request is not None and has_flattened_params:
@@ -1797,7 +2348,12 @@ def create_exclusion(
)
# Send the request.
- response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,)
+ response = rpc(
+ request,
+ retry=retry,
+ timeout=timeout,
+ metadata=metadata,
+ )
# Done; return the response.
return response
@@ -1813,8 +2369,32 @@ def update_exclusion(
timeout: float = None,
metadata: Sequence[Tuple[str, str]] = (),
) -> logging_config.LogExclusion:
- r"""Changes one or more properties of an existing
- exclusion.
+ r"""Changes one or more properties of an existing exclusion in the
+ \_Default sink.
+
+ .. code-block:: python
+
+ from google.cloud import logging_v2
+
+ def sample_update_exclusion():
+ # Create a client
+ client = logging_v2.ConfigServiceV2Client()
+
+ # Initialize request argument(s)
+ exclusion = logging_v2.LogExclusion()
+ exclusion.name = "name_value"
+ exclusion.filter = "filter_value"
+
+ request = logging_v2.UpdateExclusionRequest(
+ name="name_value",
+ exclusion=exclusion,
+ )
+
+ # Make the request
+ response = client.update_exclusion(request=request)
+
+ # Handle the response
+ print(response)
Args:
request (Union[google.cloud.logging_v2.types.UpdateExclusionRequest, dict]):
@@ -1829,8 +2409,9 @@ def update_exclusion(
"billingAccounts/[BILLING_ACCOUNT_ID]/exclusions/[EXCLUSION_ID]"
"folders/[FOLDER_ID]/exclusions/[EXCLUSION_ID]"
- Example:
- ``"projects/my-project-id/exclusions/my-exclusion-id"``.
+ For example:
+
+ ``"projects/my-project/exclusions/my-exclusion"``
This corresponds to the ``name`` field
on the ``request`` instance; if ``request`` is provided, this
@@ -1865,21 +2446,17 @@ def update_exclusion(
Returns:
google.cloud.logging_v2.types.LogExclusion:
- Specifies a set of log entries that
- are not to be stored in Logging. If your
- GCP resource receives a large volume of
- logs, you can use exclusions to reduce
- your chargeable logs. Exclusions are
- processed after log sinks, so you can
- export log entries before they are
- excluded. Note that organization-level
- and folder-level exclusions don't apply
- to child resources, and that you can't
- exclude audit log entries.
+ Specifies a set of log entries that are filtered out by a sink. If
+ your Google Cloud resource receives a large volume of
+ log entries, you can use exclusions to reduce your
+ chargeable logs. Note that exclusions on
+ organization-level and folder-level sinks don't apply
+ to child resources. Note also that you cannot modify
+ the \_Required sink or exclude logs from it.
"""
# Create or coerce a protobuf request object.
- # Sanity check: If we got a request object, we should *not* have
+ # Quick check: If we got a request object, we should *not* have
# gotten any keyword arguments that map to the request.
has_flattened_params = any([name, exclusion, update_mask])
if request is not None and has_flattened_params:
@@ -1914,7 +2491,12 @@ def update_exclusion(
)
# Send the request.
- response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,)
+ response = rpc(
+ request,
+ retry=retry,
+ timeout=timeout,
+ metadata=metadata,
+ )
# Done; return the response.
return response
@@ -1928,7 +2510,23 @@ def delete_exclusion(
timeout: float = None,
metadata: Sequence[Tuple[str, str]] = (),
) -> None:
- r"""Deletes an exclusion.
+ r"""Deletes an exclusion in the \_Default sink.
+
+ .. code-block:: python
+
+ from google.cloud import logging_v2
+
+ def sample_delete_exclusion():
+ # Create a client
+ client = logging_v2.ConfigServiceV2Client()
+
+ # Initialize request argument(s)
+ request = logging_v2.DeleteExclusionRequest(
+ name="name_value",
+ )
+
+ # Make the request
+ client.delete_exclusion(request=request)
Args:
request (Union[google.cloud.logging_v2.types.DeleteExclusionRequest, dict]):
@@ -1944,8 +2542,9 @@ def delete_exclusion(
"billingAccounts/[BILLING_ACCOUNT_ID]/exclusions/[EXCLUSION_ID]"
"folders/[FOLDER_ID]/exclusions/[EXCLUSION_ID]"
- Example:
- ``"projects/my-project-id/exclusions/my-exclusion-id"``.
+ For example:
+
+ ``"projects/my-project/exclusions/my-exclusion"``
This corresponds to the ``name`` field
on the ``request`` instance; if ``request`` is provided, this
@@ -1957,7 +2556,7 @@ def delete_exclusion(
sent along with the request as metadata.
"""
# Create or coerce a protobuf request object.
- # Sanity check: If we got a request object, we should *not* have
+ # Quick check: If we got a request object, we should *not* have
# gotten any keyword arguments that map to the request.
has_flattened_params = any([name])
if request is not None and has_flattened_params:
@@ -1989,7 +2588,10 @@ def delete_exclusion(
# Send the request.
rpc(
- request, retry=retry, timeout=timeout, metadata=metadata,
+ request,
+ retry=retry,
+ timeout=timeout,
+ metadata=metadata,
)
def get_cmek_settings(
@@ -2000,23 +2602,43 @@ def get_cmek_settings(
timeout: float = None,
metadata: Sequence[Tuple[str, str]] = (),
) -> logging_config.CmekSettings:
- r"""Gets the Logs Router CMEK settings for the given resource.
+ r"""Gets the Logging CMEK settings for the given resource.
- Note: CMEK for the Logs Router can currently only be configured
- for GCP organizations. Once configured, it applies to all
- projects and folders in the GCP organization.
+ Note: CMEK for the Log Router can be configured for Google Cloud
+ projects, folders, organizations and billing accounts. Once
+ configured for an organization, it applies to all projects and
+ folders in the Google Cloud organization.
- See `Enabling CMEK for Logs
+ See `Enabling CMEK for Log
Router `__
for more information.
+ .. code-block:: python
+
+ from google.cloud import logging_v2
+
+ def sample_get_cmek_settings():
+ # Create a client
+ client = logging_v2.ConfigServiceV2Client()
+
+ # Initialize request argument(s)
+ request = logging_v2.GetCmekSettingsRequest(
+ name="name_value",
+ )
+
+ # Make the request
+ response = client.get_cmek_settings(request=request)
+
+ # Handle the response
+ print(response)
+
Args:
request (Union[google.cloud.logging_v2.types.GetCmekSettingsRequest, dict]):
The request object. The parameters to
[GetCmekSettings][google.logging.v2.ConfigServiceV2.GetCmekSettings].
- See [Enabling CMEK for Logs
- Router](https://cloud.google.com/logging/docs/routing/managed-
- encryption) for more information.
+ See [Enabling CMEK for Log
+ Router](https://cloud.google.com/logging/docs/routing/managed-encryption)
+ for more information.
retry (google.api_core.retry.Retry): Designation of what errors, if any,
should be retried.
timeout (float): The timeout for this request.
@@ -2029,12 +2651,12 @@ def get_cmek_settings(
a project, folder, organization, billing account, or
flexible resource.
- Note: CMEK for the Logs Router can currently only be
- configured for GCP organizations. Once configured, it
- applies to all projects and folders in the GCP
- organization.
+ Note: CMEK for the Log Router can currently only be
+ configured for Google Cloud organizations. Once
+ configured, it applies to all projects and folders in
+ the Google Cloud organization.
- See [Enabling CMEK for Logs
+ See [Enabling CMEK for Log
Router](\ https://cloud.google.com/logging/docs/routing/managed-encryption)
for more information.
@@ -2058,7 +2680,12 @@ def get_cmek_settings(
)
# Send the request.
- response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,)
+ response = rpc(
+ request,
+ retry=retry,
+ timeout=timeout,
+ metadata=metadata,
+ )
# Done; return the response.
return response
@@ -2071,11 +2698,11 @@ def update_cmek_settings(
timeout: float = None,
metadata: Sequence[Tuple[str, str]] = (),
) -> logging_config.CmekSettings:
- r"""Updates the Logs Router CMEK settings for the given resource.
+ r"""Updates the Log Router CMEK settings for the given resource.
- Note: CMEK for the Logs Router can currently only be configured
- for GCP organizations. Once configured, it applies to all
- projects and folders in the GCP organization.
+ Note: CMEK for the Log Router can currently only be configured
+ for Google Cloud organizations. Once configured, it applies to
+ all projects and folders in the Google Cloud organization.
[UpdateCmekSettings][google.logging.v2.ConfigServiceV2.UpdateCmekSettings]
will fail if 1) ``kms_key_name`` is invalid, or 2) the
@@ -2083,17 +2710,36 @@ def update_cmek_settings(
``roles/cloudkms.cryptoKeyEncrypterDecrypter`` role assigned for
the key, or 3) access to the key is disabled.
- See `Enabling CMEK for Logs
+ See `Enabling CMEK for Log
Router `__
for more information.
+ .. code-block:: python
+
+ from google.cloud import logging_v2
+
+ def sample_update_cmek_settings():
+ # Create a client
+ client = logging_v2.ConfigServiceV2Client()
+
+ # Initialize request argument(s)
+ request = logging_v2.UpdateCmekSettingsRequest(
+ name="name_value",
+ )
+
+ # Make the request
+ response = client.update_cmek_settings(request=request)
+
+ # Handle the response
+ print(response)
+
Args:
request (Union[google.cloud.logging_v2.types.UpdateCmekSettingsRequest, dict]):
The request object. The parameters to
[UpdateCmekSettings][google.logging.v2.ConfigServiceV2.UpdateCmekSettings].
- See [Enabling CMEK for Logs
- Router](https://cloud.google.com/logging/docs/routing/managed-
- encryption) for more information.
+ See [Enabling CMEK for Log
+ Router](https://cloud.google.com/logging/docs/routing/managed-encryption)
+ for more information.
retry (google.api_core.retry.Retry): Designation of what errors, if any,
should be retried.
timeout (float): The timeout for this request.
@@ -2106,12 +2752,12 @@ def update_cmek_settings(
a project, folder, organization, billing account, or
flexible resource.
- Note: CMEK for the Logs Router can currently only be
- configured for GCP organizations. Once configured, it
- applies to all projects and folders in the GCP
- organization.
+ Note: CMEK for the Log Router can currently only be
+ configured for Google Cloud organizations. Once
+ configured, it applies to all projects and folders in
+ the Google Cloud organization.
- See [Enabling CMEK for Logs
+ See [Enabling CMEK for Log
Router](\ https://cloud.google.com/logging/docs/routing/managed-encryption)
for more information.
@@ -2135,7 +2781,359 @@ def update_cmek_settings(
)
# Send the request.
- response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,)
+ response = rpc(
+ request,
+ retry=retry,
+ timeout=timeout,
+ metadata=metadata,
+ )
+
+ # Done; return the response.
+ return response
+
+ def get_settings(
+ self,
+ request: Union[logging_config.GetSettingsRequest, dict] = None,
+ *,
+ name: str = None,
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
+ timeout: float = None,
+ metadata: Sequence[Tuple[str, str]] = (),
+ ) -> logging_config.Settings:
+ r"""Gets the Log Router settings for the given resource.
+
+ Note: Settings for the Log Router can be get for Google Cloud
+ projects, folders, organizations and billing accounts. Currently
+ it can only be configured for organizations. Once configured for
+ an organization, it applies to all projects and folders in the
+ Google Cloud organization.
+
+ See `Enabling CMEK for Log
+ Router `__
+ for more information.
+
+ .. code-block:: python
+
+ from google.cloud import logging_v2
+
+ def sample_get_settings():
+ # Create a client
+ client = logging_v2.ConfigServiceV2Client()
+
+ # Initialize request argument(s)
+ request = logging_v2.GetSettingsRequest(
+ name="name_value",
+ )
+
+ # Make the request
+ response = client.get_settings(request=request)
+
+ # Handle the response
+ print(response)
+
+ Args:
+ request (Union[google.cloud.logging_v2.types.GetSettingsRequest, dict]):
+ The request object. The parameters to
+ [GetSettings][google.logging.v2.ConfigServiceV2.GetSettings].
+ See [Enabling CMEK for Log
+ Router](https://cloud.google.com/logging/docs/routing/managed-encryption)
+ for more information.
+ name (str):
+ Required. The resource for which to retrieve settings.
+
+ ::
+
+ "projects/[PROJECT_ID]/settings"
+ "organizations/[ORGANIZATION_ID]/settings"
+ "billingAccounts/[BILLING_ACCOUNT_ID]/settings"
+ "folders/[FOLDER_ID]/settings"
+
+ For example:
+
+ ``"organizations/12345/settings"``
+
+ Note: Settings for the Log Router can be get for Google
+ Cloud projects, folders, organizations and billing
+ accounts. Currently it can only be configured for
+ organizations. Once configured for an organization, it
+ applies to all projects and folders in the Google Cloud
+ organization.
+
+ This corresponds to the ``name`` field
+ on the ``request`` instance; if ``request`` is provided, this
+ should not be set.
+ retry (google.api_core.retry.Retry): Designation of what errors, if any,
+ should be retried.
+ timeout (float): The timeout for this request.
+ metadata (Sequence[Tuple[str, str]]): Strings which should be
+ sent along with the request as metadata.
+
+ Returns:
+ google.cloud.logging_v2.types.Settings:
+ Describes the settings associated
+ with a project, folder, organization,
+ billing account, or flexible resource.
+
+ """
+ # Create or coerce a protobuf request object.
+ # Quick check: If we got a request object, we should *not* have
+ # gotten any keyword arguments that map to the request.
+ has_flattened_params = any([name])
+ if request is not None and has_flattened_params:
+ raise ValueError(
+ "If the `request` argument is set, then none of "
+ "the individual field arguments should be set."
+ )
+
+ # Minor optimization to avoid making a copy if the user passes
+ # in a logging_config.GetSettingsRequest.
+ # There's no risk of modifying the input as we've already verified
+ # there are no flattened fields.
+ if not isinstance(request, logging_config.GetSettingsRequest):
+ request = logging_config.GetSettingsRequest(request)
+ # If we have keyword arguments corresponding to fields on the
+ # request, apply these.
+ if name is not None:
+ request.name = name
+
+ # Wrap the RPC method; this adds retry and timeout information,
+ # and friendly error handling.
+ rpc = self._transport._wrapped_methods[self._transport.get_settings]
+
+ # Certain fields should be provided within the metadata header;
+ # add these here.
+ metadata = tuple(metadata) + (
+ gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)),
+ )
+
+ # Send the request.
+ response = rpc(
+ request,
+ retry=retry,
+ timeout=timeout,
+ metadata=metadata,
+ )
+
+ # Done; return the response.
+ return response
+
+ def update_settings(
+ self,
+ request: Union[logging_config.UpdateSettingsRequest, dict] = None,
+ *,
+ settings: logging_config.Settings = None,
+ update_mask: field_mask_pb2.FieldMask = None,
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
+ timeout: float = None,
+ metadata: Sequence[Tuple[str, str]] = (),
+ ) -> logging_config.Settings:
+ r"""Updates the Log Router settings for the given resource.
+
+ Note: Settings for the Log Router can currently only be
+ configured for Google Cloud organizations. Once configured, it
+ applies to all projects and folders in the Google Cloud
+ organization.
+
+ [UpdateSettings][google.logging.v2.ConfigServiceV2.UpdateSettings]
+ will fail if 1) ``kms_key_name`` is invalid, or 2) the
+ associated service account does not have the required
+ ``roles/cloudkms.cryptoKeyEncrypterDecrypter`` role assigned for
+ the key, or 3) access to the key is disabled. 4) ``location_id``
+ is not supported by Logging. 5) ``location_id`` violate
+ OrgPolicy.
+
+ See `Enabling CMEK for Log
+ Router `__
+ for more information.
+
+ .. code-block:: python
+
+ from google.cloud import logging_v2
+
+ def sample_update_settings():
+ # Create a client
+ client = logging_v2.ConfigServiceV2Client()
+
+ # Initialize request argument(s)
+ request = logging_v2.UpdateSettingsRequest(
+ name="name_value",
+ )
+
+ # Make the request
+ response = client.update_settings(request=request)
+
+ # Handle the response
+ print(response)
+
+ Args:
+ request (Union[google.cloud.logging_v2.types.UpdateSettingsRequest, dict]):
+ The request object. The parameters to
+ [UpdateSettings][google.logging.v2.ConfigServiceV2.UpdateSettings].
+ See [Enabling CMEK for Log
+ Router](https://cloud.google.com/logging/docs/routing/managed-encryption)
+ for more information.
+ settings (google.cloud.logging_v2.types.Settings):
+ Required. The settings to update.
+
+ See `Enabling CMEK for Log
+ Router `__
+ for more information.
+
+ This corresponds to the ``settings`` field
+ on the ``request`` instance; if ``request`` is provided, this
+ should not be set.
+ update_mask (google.protobuf.field_mask_pb2.FieldMask):
+ Optional. Field mask identifying which fields from
+ ``settings`` should be updated. A field will be
+ overwritten if and only if it is in the update mask.
+ Output only fields cannot be updated.
+
+ See [FieldMask][google.protobuf.FieldMask] for more
+ information.
+
+ For example: ``"updateMask=kmsKeyName"``
+
+ This corresponds to the ``update_mask`` field
+ on the ``request`` instance; if ``request`` is provided, this
+ should not be set.
+ retry (google.api_core.retry.Retry): Designation of what errors, if any,
+ should be retried.
+ timeout (float): The timeout for this request.
+ metadata (Sequence[Tuple[str, str]]): Strings which should be
+ sent along with the request as metadata.
+
+ Returns:
+ google.cloud.logging_v2.types.Settings:
+ Describes the settings associated
+ with a project, folder, organization,
+ billing account, or flexible resource.
+
+ """
+ # Create or coerce a protobuf request object.
+ # Quick check: If we got a request object, we should *not* have
+ # gotten any keyword arguments that map to the request.
+ has_flattened_params = any([settings, update_mask])
+ if request is not None and has_flattened_params:
+ raise ValueError(
+ "If the `request` argument is set, then none of "
+ "the individual field arguments should be set."
+ )
+
+ # Minor optimization to avoid making a copy if the user passes
+ # in a logging_config.UpdateSettingsRequest.
+ # There's no risk of modifying the input as we've already verified
+ # there are no flattened fields.
+ if not isinstance(request, logging_config.UpdateSettingsRequest):
+ request = logging_config.UpdateSettingsRequest(request)
+ # If we have keyword arguments corresponding to fields on the
+ # request, apply these.
+ if settings is not None:
+ request.settings = settings
+ if update_mask is not None:
+ request.update_mask = update_mask
+
+ # Wrap the RPC method; this adds retry and timeout information,
+ # and friendly error handling.
+ rpc = self._transport._wrapped_methods[self._transport.update_settings]
+
+ # Certain fields should be provided within the metadata header;
+ # add these here.
+ metadata = tuple(metadata) + (
+ gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)),
+ )
+
+ # Send the request.
+ response = rpc(
+ request,
+ retry=retry,
+ timeout=timeout,
+ metadata=metadata,
+ )
+
+ # Done; return the response.
+ return response
+
+ def copy_log_entries(
+ self,
+ request: Union[logging_config.CopyLogEntriesRequest, dict] = None,
+ *,
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
+ timeout: float = None,
+ metadata: Sequence[Tuple[str, str]] = (),
+ ) -> operation.Operation:
+ r"""Copies a set of log entries from a log bucket to a
+ Cloud Storage bucket.
+
+ .. code-block:: python
+
+ from google.cloud import logging_v2
+
+ def sample_copy_log_entries():
+ # Create a client
+ client = logging_v2.ConfigServiceV2Client()
+
+ # Initialize request argument(s)
+ request = logging_v2.CopyLogEntriesRequest(
+ name="name_value",
+ destination="destination_value",
+ )
+
+ # Make the request
+ operation = client.copy_log_entries(request=request)
+
+ print("Waiting for operation to complete...")
+
+ response = operation.result()
+
+ # Handle the response
+ print(response)
+
+ Args:
+ request (Union[google.cloud.logging_v2.types.CopyLogEntriesRequest, dict]):
+ The request object. The parameters to CopyLogEntries.
+ retry (google.api_core.retry.Retry): Designation of what errors, if any,
+ should be retried.
+ timeout (float): The timeout for this request.
+ metadata (Sequence[Tuple[str, str]]): Strings which should be
+ sent along with the request as metadata.
+
+ Returns:
+ google.api_core.operation.Operation:
+ An object representing a long-running operation.
+
+ The result type for the operation will be
+ :class:`google.cloud.logging_v2.types.CopyLogEntriesResponse`
+ Response type for CopyLogEntries long running
+ operations.
+
+ """
+ # Create or coerce a protobuf request object.
+ # Minor optimization to avoid making a copy if the user passes
+ # in a logging_config.CopyLogEntriesRequest.
+ # There's no risk of modifying the input as we've already verified
+ # there are no flattened fields.
+ if not isinstance(request, logging_config.CopyLogEntriesRequest):
+ request = logging_config.CopyLogEntriesRequest(request)
+
+ # Wrap the RPC method; this adds retry and timeout information,
+ # and friendly error handling.
+ rpc = self._transport._wrapped_methods[self._transport.copy_log_entries]
+
+ # Send the request.
+ response = rpc(
+ request,
+ retry=retry,
+ timeout=timeout,
+ metadata=metadata,
+ )
+
+ # Wrap the response in an operation future.
+ response = operation.from_gapic(
+ response,
+ self._transport.operations_client,
+ logging_config.CopyLogEntriesResponse,
+ metadata_type=logging_config.CopyLogEntriesMetadata,
+ )
# Done; return the response.
return response
@@ -2156,7 +3154,9 @@ def __exit__(self, type, value, traceback):
try:
DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo(
- gapic_version=pkg_resources.get_distribution("google-cloud-logging",).version,
+ gapic_version=pkg_resources.get_distribution(
+ "google-cloud-logging",
+ ).version,
)
except pkg_resources.DistributionNotFound:
DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo()
diff --git a/google/cloud/logging_v2/services/config_service_v2/pagers.py b/google/cloud/logging_v2/services/config_service_v2/pagers.py
index b0be053e4..3c5ce7754 100644
--- a/google/cloud/logging_v2/services/config_service_v2/pagers.py
+++ b/google/cloud/logging_v2/services/config_service_v2/pagers.py
@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
-# Copyright 2020 Google LLC
+# Copyright 2022 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
diff --git a/google/cloud/logging_v2/services/config_service_v2/transports/__init__.py b/google/cloud/logging_v2/services/config_service_v2/transports/__init__.py
index b1e24fc64..93a29df09 100644
--- a/google/cloud/logging_v2/services/config_service_v2/transports/__init__.py
+++ b/google/cloud/logging_v2/services/config_service_v2/transports/__init__.py
@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
-# Copyright 2020 Google LLC
+# Copyright 2022 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
diff --git a/google/cloud/logging_v2/services/config_service_v2/transports/base.py b/google/cloud/logging_v2/services/config_service_v2/transports/base.py
index 90e305488..685f174b4 100644
--- a/google/cloud/logging_v2/services/config_service_v2/transports/base.py
+++ b/google/cloud/logging_v2/services/config_service_v2/transports/base.py
@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
-# Copyright 2020 Google LLC
+# Copyright 2022 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -22,15 +22,19 @@
from google.api_core import exceptions as core_exceptions
from google.api_core import gapic_v1
from google.api_core import retry as retries
+from google.api_core import operations_v1
from google.auth import credentials as ga_credentials # type: ignore
from google.oauth2 import service_account # type: ignore
from google.cloud.logging_v2.types import logging_config
+from google.longrunning import operations_pb2 # type: ignore
from google.protobuf import empty_pb2 # type: ignore
try:
DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo(
- gapic_version=pkg_resources.get_distribution("google-cloud-logging",).version,
+ gapic_version=pkg_resources.get_distribution(
+ "google-cloud-logging",
+ ).version,
)
except pkg_resources.DistributionNotFound:
DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo()
@@ -84,6 +88,7 @@ def __init__(
always_use_jwt_access (Optional[bool]): Whether self signed JWT should
be used for service account credentials.
"""
+
# Save the hostname. Default to port 443 (HTTPS) if none is specified.
if ":" not in host:
host += ":443"
@@ -125,37 +130,59 @@ def _prep_wrapped_messages(self, client_info):
# Precompute the wrapped methods.
self._wrapped_methods = {
self.list_buckets: gapic_v1.method.wrap_method(
- self.list_buckets, default_timeout=None, client_info=client_info,
+ self.list_buckets,
+ default_timeout=None,
+ client_info=client_info,
),
self.get_bucket: gapic_v1.method.wrap_method(
- self.get_bucket, default_timeout=None, client_info=client_info,
+ self.get_bucket,
+ default_timeout=None,
+ client_info=client_info,
),
self.create_bucket: gapic_v1.method.wrap_method(
- self.create_bucket, default_timeout=None, client_info=client_info,
+ self.create_bucket,
+ default_timeout=None,
+ client_info=client_info,
),
self.update_bucket: gapic_v1.method.wrap_method(
- self.update_bucket, default_timeout=None, client_info=client_info,
+ self.update_bucket,
+ default_timeout=None,
+ client_info=client_info,
),
self.delete_bucket: gapic_v1.method.wrap_method(
- self.delete_bucket, default_timeout=None, client_info=client_info,
+ self.delete_bucket,
+ default_timeout=None,
+ client_info=client_info,
),
self.undelete_bucket: gapic_v1.method.wrap_method(
- self.undelete_bucket, default_timeout=None, client_info=client_info,
+ self.undelete_bucket,
+ default_timeout=None,
+ client_info=client_info,
),
self.list_views: gapic_v1.method.wrap_method(
- self.list_views, default_timeout=None, client_info=client_info,
+ self.list_views,
+ default_timeout=None,
+ client_info=client_info,
),
self.get_view: gapic_v1.method.wrap_method(
- self.get_view, default_timeout=None, client_info=client_info,
+ self.get_view,
+ default_timeout=None,
+ client_info=client_info,
),
self.create_view: gapic_v1.method.wrap_method(
- self.create_view, default_timeout=None, client_info=client_info,
+ self.create_view,
+ default_timeout=None,
+ client_info=client_info,
),
self.update_view: gapic_v1.method.wrap_method(
- self.update_view, default_timeout=None, client_info=client_info,
+ self.update_view,
+ default_timeout=None,
+ client_info=client_info,
),
self.delete_view: gapic_v1.method.wrap_method(
- self.delete_view, default_timeout=None, client_info=client_info,
+ self.delete_view,
+ default_timeout=None,
+ client_info=client_info,
),
self.list_sinks: gapic_v1.method.wrap_method(
self.list_sinks,
@@ -190,7 +217,9 @@ def _prep_wrapped_messages(self, client_info):
client_info=client_info,
),
self.create_sink: gapic_v1.method.wrap_method(
- self.create_sink, default_timeout=120.0, client_info=client_info,
+ self.create_sink,
+ default_timeout=120.0,
+ client_info=client_info,
),
self.update_sink: gapic_v1.method.wrap_method(
self.update_sink,
@@ -257,10 +286,14 @@ def _prep_wrapped_messages(self, client_info):
client_info=client_info,
),
self.create_exclusion: gapic_v1.method.wrap_method(
- self.create_exclusion, default_timeout=120.0, client_info=client_info,
+ self.create_exclusion,
+ default_timeout=120.0,
+ client_info=client_info,
),
self.update_exclusion: gapic_v1.method.wrap_method(
- self.update_exclusion, default_timeout=120.0, client_info=client_info,
+ self.update_exclusion,
+ default_timeout=120.0,
+ client_info=client_info,
),
self.delete_exclusion: gapic_v1.method.wrap_method(
self.delete_exclusion,
@@ -279,24 +312,46 @@ def _prep_wrapped_messages(self, client_info):
client_info=client_info,
),
self.get_cmek_settings: gapic_v1.method.wrap_method(
- self.get_cmek_settings, default_timeout=None, client_info=client_info,
+ self.get_cmek_settings,
+ default_timeout=None,
+ client_info=client_info,
),
self.update_cmek_settings: gapic_v1.method.wrap_method(
self.update_cmek_settings,
default_timeout=None,
client_info=client_info,
),
+ self.get_settings: gapic_v1.method.wrap_method(
+ self.get_settings,
+ default_timeout=None,
+ client_info=client_info,
+ ),
+ self.update_settings: gapic_v1.method.wrap_method(
+ self.update_settings,
+ default_timeout=None,
+ client_info=client_info,
+ ),
+ self.copy_log_entries: gapic_v1.method.wrap_method(
+ self.copy_log_entries,
+ default_timeout=None,
+ client_info=client_info,
+ ),
}
def close(self):
"""Closes resources associated with the transport.
- .. warning::
- Only call this method if the transport is NOT shared
- with other clients - this may cause errors in other clients!
+ .. warning::
+ Only call this method if the transport is NOT shared
+ with other clients - this may cause errors in other clients!
"""
raise NotImplementedError()
+ @property
+ def operations_client(self):
+ """Return the client designed to process long-running operations."""
+ raise NotImplementedError()
+
@property
def list_buckets(
self,
@@ -516,5 +571,36 @@ def update_cmek_settings(
]:
raise NotImplementedError()
+ @property
+ def get_settings(
+ self,
+ ) -> Callable[
+ [logging_config.GetSettingsRequest],
+ Union[logging_config.Settings, Awaitable[logging_config.Settings]],
+ ]:
+ raise NotImplementedError()
+
+ @property
+ def update_settings(
+ self,
+ ) -> Callable[
+ [logging_config.UpdateSettingsRequest],
+ Union[logging_config.Settings, Awaitable[logging_config.Settings]],
+ ]:
+ raise NotImplementedError()
+
+ @property
+ def copy_log_entries(
+ self,
+ ) -> Callable[
+ [logging_config.CopyLogEntriesRequest],
+ Union[operations_pb2.Operation, Awaitable[operations_pb2.Operation]],
+ ]:
+ raise NotImplementedError()
+
+ @property
+ def kind(self) -> str:
+ raise NotImplementedError()
+
__all__ = ("ConfigServiceV2Transport",)
diff --git a/google/cloud/logging_v2/services/config_service_v2/transports/grpc.py b/google/cloud/logging_v2/services/config_service_v2/transports/grpc.py
index b34d0a121..25de48851 100644
--- a/google/cloud/logging_v2/services/config_service_v2/transports/grpc.py
+++ b/google/cloud/logging_v2/services/config_service_v2/transports/grpc.py
@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
-# Copyright 2020 Google LLC
+# Copyright 2022 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -17,6 +17,7 @@
from typing import Callable, Dict, Optional, Sequence, Tuple, Union
from google.api_core import grpc_helpers
+from google.api_core import operations_v1
from google.api_core import gapic_v1
import google.auth # type: ignore
from google.auth import credentials as ga_credentials # type: ignore
@@ -25,6 +26,7 @@
import grpc # type: ignore
from google.cloud.logging_v2.types import logging_config
+from google.longrunning import operations_pb2 # type: ignore
from google.protobuf import empty_pb2 # type: ignore
from .base import ConfigServiceV2Transport, DEFAULT_CLIENT_INFO
@@ -111,6 +113,7 @@ def __init__(
self._grpc_channel = None
self._ssl_channel_credentials = ssl_channel_credentials
self._stubs: Dict[str, Callable] = {}
+ self._operations_client: Optional[operations_v1.OperationsClient] = None
if api_mtls_endpoint:
warnings.warn("api_mtls_endpoint is deprecated", DeprecationWarning)
@@ -159,8 +162,11 @@ def __init__(
if not self._grpc_channel:
self._grpc_channel = type(self).create_channel(
self._host,
+ # use the credentials which are saved
credentials=self._credentials,
- credentials_file=credentials_file,
+ # Set ``credentials_file`` to ``None`` here as
+ # the credentials that we saved earlier should be used.
+ credentials_file=None,
scopes=self._scopes,
ssl_credentials=self._ssl_channel_credentials,
quota_project_id=quota_project_id,
@@ -222,10 +228,23 @@ def create_channel(
@property
def grpc_channel(self) -> grpc.Channel:
- """Return the channel designed to connect to this service.
- """
+ """Return the channel designed to connect to this service."""
return self._grpc_channel
+ @property
+ def operations_client(self) -> operations_v1.OperationsClient:
+ """Create the client designed to process long-running operations.
+
+ This property caches on the instance; repeated calls return the same
+ client.
+ """
+ # Quick check: Only create a new client if we do not already have one.
+ if self._operations_client is None:
+ self._operations_client = operations_v1.OperationsClient(self.grpc_channel)
+
+ # Return the client from cache.
+ return self._operations_client
+
@property
def list_buckets(
self,
@@ -234,7 +253,7 @@ def list_buckets(
]:
r"""Return a callable for the list buckets method over gRPC.
- Lists buckets.
+ Lists log buckets.
Returns:
Callable[[~.ListBucketsRequest],
@@ -260,7 +279,7 @@ def get_bucket(
) -> Callable[[logging_config.GetBucketRequest], logging_config.LogBucket]:
r"""Return a callable for the get bucket method over gRPC.
- Gets a bucket.
+ Gets a log bucket.
Returns:
Callable[[~.GetBucketRequest],
@@ -286,9 +305,9 @@ def create_bucket(
) -> Callable[[logging_config.CreateBucketRequest], logging_config.LogBucket]:
r"""Return a callable for the create bucket method over gRPC.
- Creates a bucket that can be used to store log
- entries. Once a bucket has been created, the region
- cannot be changed.
+ Creates a log bucket that can be used to store log
+ entries. After a bucket has been created, the bucket's
+ location cannot be changed.
Returns:
Callable[[~.CreateBucketRequest],
@@ -314,17 +333,18 @@ def update_bucket(
) -> Callable[[logging_config.UpdateBucketRequest], logging_config.LogBucket]:
r"""Return a callable for the update bucket method over gRPC.
- Updates a bucket. This method replaces the following fields in
- the existing bucket with values from the new bucket:
+ Updates a log bucket. This method replaces the following fields
+ in the existing bucket with values from the new bucket:
``retention_period``
If the retention period is decreased and the bucket is locked,
- FAILED_PRECONDITION will be returned.
+ ``FAILED_PRECONDITION`` will be returned.
- If the bucket has a LifecycleState of DELETE_REQUESTED,
- FAILED_PRECONDITION will be returned.
+ If the bucket has a ``lifecycle_state`` of ``DELETE_REQUESTED``,
+ then ``FAILED_PRECONDITION`` will be returned.
- A buckets region may not be modified after it is created.
+ After a bucket has been created, the bucket's location cannot be
+ changed.
Returns:
Callable[[~.UpdateBucketRequest],
@@ -350,9 +370,12 @@ def delete_bucket(
) -> Callable[[logging_config.DeleteBucketRequest], empty_pb2.Empty]:
r"""Return a callable for the delete bucket method over gRPC.
- Deletes a bucket. Moves the bucket to the DELETE_REQUESTED
- state. After 7 days, the bucket will be purged and all logs in
- the bucket will be permanently deleted.
+ Deletes a log bucket.
+
+ Changes the bucket's ``lifecycle_state`` to the
+ ``DELETE_REQUESTED`` state. After 7 days, the bucket will be
+ purged and all log entries in the bucket will be permanently
+ deleted.
Returns:
Callable[[~.DeleteBucketRequest],
@@ -378,8 +401,9 @@ def undelete_bucket(
) -> Callable[[logging_config.UndeleteBucketRequest], empty_pb2.Empty]:
r"""Return a callable for the undelete bucket method over gRPC.
- Undeletes a bucket. A bucket that has been deleted
- may be undeleted within the grace period of 7 days.
+ Undeletes a log bucket. A bucket that has been
+ deleted can be undeleted within the grace period of 7
+ days.
Returns:
Callable[[~.UndeleteBucketRequest],
@@ -405,7 +429,7 @@ def list_views(
) -> Callable[[logging_config.ListViewsRequest], logging_config.ListViewsResponse]:
r"""Return a callable for the list views method over gRPC.
- Lists views on a bucket.
+ Lists views on a log bucket.
Returns:
Callable[[~.ListViewsRequest],
@@ -431,7 +455,7 @@ def get_view(
) -> Callable[[logging_config.GetViewRequest], logging_config.LogView]:
r"""Return a callable for the get view method over gRPC.
- Gets a view.
+ Gets a view on a log bucket..
Returns:
Callable[[~.GetViewRequest],
@@ -457,8 +481,8 @@ def create_view(
) -> Callable[[logging_config.CreateViewRequest], logging_config.LogView]:
r"""Return a callable for the create view method over gRPC.
- Creates a view over logs in a bucket. A bucket may
- contain a maximum of 50 views.
+ Creates a view over log entries in a log bucket. A
+ bucket may contain a maximum of 30 views.
Returns:
Callable[[~.CreateViewRequest],
@@ -484,8 +508,11 @@ def update_view(
) -> Callable[[logging_config.UpdateViewRequest], logging_config.LogView]:
r"""Return a callable for the update view method over gRPC.
- Updates a view. This method replaces the following fields in the
- existing view with values from the new view: ``filter``.
+ Updates a view on a log bucket. This method replaces the
+ following fields in the existing view with values from the new
+ view: ``filter``. If an ``UNAVAILABLE`` error is returned, this
+ indicates that system is not in a state where it can update the
+ view. If this occurs, please try again in a few minutes.
Returns:
Callable[[~.UpdateViewRequest],
@@ -511,7 +538,10 @@ def delete_view(
) -> Callable[[logging_config.DeleteViewRequest], empty_pb2.Empty]:
r"""Return a callable for the delete view method over gRPC.
- Deletes a view from a bucket.
+ Deletes a view on a log bucket. If an ``UNAVAILABLE`` error is
+ returned, this indicates that system is not in a state where it
+ can delete the view. If this occurs, please try again in a few
+ minutes.
Returns:
Callable[[~.DeleteViewRequest],
@@ -679,7 +709,8 @@ def list_exclusions(
]:
r"""Return a callable for the list exclusions method over gRPC.
- Lists all the exclusions in a parent resource.
+ Lists all the exclusions on the \_Default sink in a parent
+ resource.
Returns:
Callable[[~.ListExclusionsRequest],
@@ -705,7 +736,7 @@ def get_exclusion(
) -> Callable[[logging_config.GetExclusionRequest], logging_config.LogExclusion]:
r"""Return a callable for the get exclusion method over gRPC.
- Gets the description of an exclusion.
+ Gets the description of an exclusion in the \_Default sink.
Returns:
Callable[[~.GetExclusionRequest],
@@ -731,10 +762,9 @@ def create_exclusion(
) -> Callable[[logging_config.CreateExclusionRequest], logging_config.LogExclusion]:
r"""Return a callable for the create exclusion method over gRPC.
- Creates a new exclusion in a specified parent
- resource. Only log entries belonging to that resource
- can be excluded. You can have up to 10 exclusions in a
- resource.
+ Creates a new exclusion in the \_Default sink in a specified
+ parent resource. Only log entries belonging to that resource can
+ be excluded. You can have up to 10 exclusions in a resource.
Returns:
Callable[[~.CreateExclusionRequest],
@@ -760,8 +790,8 @@ def update_exclusion(
) -> Callable[[logging_config.UpdateExclusionRequest], logging_config.LogExclusion]:
r"""Return a callable for the update exclusion method over gRPC.
- Changes one or more properties of an existing
- exclusion.
+ Changes one or more properties of an existing exclusion in the
+ \_Default sink.
Returns:
Callable[[~.UpdateExclusionRequest],
@@ -787,7 +817,7 @@ def delete_exclusion(
) -> Callable[[logging_config.DeleteExclusionRequest], empty_pb2.Empty]:
r"""Return a callable for the delete exclusion method over gRPC.
- Deletes an exclusion.
+ Deletes an exclusion in the \_Default sink.
Returns:
Callable[[~.DeleteExclusionRequest],
@@ -813,13 +843,14 @@ def get_cmek_settings(
) -> Callable[[logging_config.GetCmekSettingsRequest], logging_config.CmekSettings]:
r"""Return a callable for the get cmek settings method over gRPC.
- Gets the Logs Router CMEK settings for the given resource.
+ Gets the Logging CMEK settings for the given resource.
- Note: CMEK for the Logs Router can currently only be configured
- for GCP organizations. Once configured, it applies to all
- projects and folders in the GCP organization.
+ Note: CMEK for the Log Router can be configured for Google Cloud
+ projects, folders, organizations and billing accounts. Once
+ configured for an organization, it applies to all projects and
+ folders in the Google Cloud organization.
- See `Enabling CMEK for Logs
+ See `Enabling CMEK for Log
Router `__
for more information.
@@ -849,11 +880,11 @@ def update_cmek_settings(
]:
r"""Return a callable for the update cmek settings method over gRPC.
- Updates the Logs Router CMEK settings for the given resource.
+ Updates the Log Router CMEK settings for the given resource.
- Note: CMEK for the Logs Router can currently only be configured
- for GCP organizations. Once configured, it applies to all
- projects and folders in the GCP organization.
+ Note: CMEK for the Log Router can currently only be configured
+ for Google Cloud organizations. Once configured, it applies to
+ all projects and folders in the Google Cloud organization.
[UpdateCmekSettings][google.logging.v2.ConfigServiceV2.UpdateCmekSettings]
will fail if 1) ``kms_key_name`` is invalid, or 2) the
@@ -861,7 +892,7 @@ def update_cmek_settings(
``roles/cloudkms.cryptoKeyEncrypterDecrypter`` role assigned for
the key, or 3) access to the key is disabled.
- See `Enabling CMEK for Logs
+ See `Enabling CMEK for Log
Router `__
for more information.
@@ -883,8 +914,118 @@ def update_cmek_settings(
)
return self._stubs["update_cmek_settings"]
+ @property
+ def get_settings(
+ self,
+ ) -> Callable[[logging_config.GetSettingsRequest], logging_config.Settings]:
+ r"""Return a callable for the get settings method over gRPC.
+
+ Gets the Log Router settings for the given resource.
+
+ Note: Settings for the Log Router can be get for Google Cloud
+ projects, folders, organizations and billing accounts. Currently
+ it can only be configured for organizations. Once configured for
+ an organization, it applies to all projects and folders in the
+ Google Cloud organization.
+
+ See `Enabling CMEK for Log
+ Router `__
+ for more information.
+
+ Returns:
+ Callable[[~.GetSettingsRequest],
+ ~.Settings]:
+ A function that, when called, will call the underlying RPC
+ on the server.
+ """
+ # Generate a "stub function" on-the-fly which will actually make
+ # the request.
+ # gRPC handles serialization and deserialization, so we just need
+ # to pass in the functions for each.
+ if "get_settings" not in self._stubs:
+ self._stubs["get_settings"] = self.grpc_channel.unary_unary(
+ "/google.logging.v2.ConfigServiceV2/GetSettings",
+ request_serializer=logging_config.GetSettingsRequest.serialize,
+ response_deserializer=logging_config.Settings.deserialize,
+ )
+ return self._stubs["get_settings"]
+
+ @property
+ def update_settings(
+ self,
+ ) -> Callable[[logging_config.UpdateSettingsRequest], logging_config.Settings]:
+ r"""Return a callable for the update settings method over gRPC.
+
+ Updates the Log Router settings for the given resource.
+
+ Note: Settings for the Log Router can currently only be
+ configured for Google Cloud organizations. Once configured, it
+ applies to all projects and folders in the Google Cloud
+ organization.
+
+ [UpdateSettings][google.logging.v2.ConfigServiceV2.UpdateSettings]
+ will fail if 1) ``kms_key_name`` is invalid, or 2) the
+ associated service account does not have the required
+ ``roles/cloudkms.cryptoKeyEncrypterDecrypter`` role assigned for
+ the key, or 3) access to the key is disabled. 4) ``location_id``
+ is not supported by Logging. 5) ``location_id`` violate
+ OrgPolicy.
+
+ See `Enabling CMEK for Log
+ Router `__
+ for more information.
+
+ Returns:
+ Callable[[~.UpdateSettingsRequest],
+ ~.Settings]:
+ A function that, when called, will call the underlying RPC
+ on the server.
+ """
+ # Generate a "stub function" on-the-fly which will actually make
+ # the request.
+ # gRPC handles serialization and deserialization, so we just need
+ # to pass in the functions for each.
+ if "update_settings" not in self._stubs:
+ self._stubs["update_settings"] = self.grpc_channel.unary_unary(
+ "/google.logging.v2.ConfigServiceV2/UpdateSettings",
+ request_serializer=logging_config.UpdateSettingsRequest.serialize,
+ response_deserializer=logging_config.Settings.deserialize,
+ )
+ return self._stubs["update_settings"]
+
+ @property
+ def copy_log_entries(
+ self,
+ ) -> Callable[[logging_config.CopyLogEntriesRequest], operations_pb2.Operation]:
+ r"""Return a callable for the copy log entries method over gRPC.
+
+ Copies a set of log entries from a log bucket to a
+ Cloud Storage bucket.
+
+ Returns:
+ Callable[[~.CopyLogEntriesRequest],
+ ~.Operation]:
+ A function that, when called, will call the underlying RPC
+ on the server.
+ """
+ # Generate a "stub function" on-the-fly which will actually make
+ # the request.
+ # gRPC handles serialization and deserialization, so we just need
+ # to pass in the functions for each.
+ if "copy_log_entries" not in self._stubs:
+ self._stubs["copy_log_entries"] = self.grpc_channel.unary_unary(
+ "/google.logging.v2.ConfigServiceV2/CopyLogEntries",
+ request_serializer=logging_config.CopyLogEntriesRequest.serialize,
+ response_deserializer=operations_pb2.Operation.FromString,
+ )
+ return self._stubs["copy_log_entries"]
+
def close(self):
self.grpc_channel.close()
+ @property
+ def kind(self) -> str:
+ return "grpc"
+
__all__ = ("ConfigServiceV2GrpcTransport",)
diff --git a/google/cloud/logging_v2/services/config_service_v2/transports/grpc_asyncio.py b/google/cloud/logging_v2/services/config_service_v2/transports/grpc_asyncio.py
index 1cf4f3121..86e67253c 100644
--- a/google/cloud/logging_v2/services/config_service_v2/transports/grpc_asyncio.py
+++ b/google/cloud/logging_v2/services/config_service_v2/transports/grpc_asyncio.py
@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
-# Copyright 2020 Google LLC
+# Copyright 2022 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -18,6 +18,7 @@
from google.api_core import gapic_v1
from google.api_core import grpc_helpers_async
+from google.api_core import operations_v1
from google.auth import credentials as ga_credentials # type: ignore
from google.auth.transport.grpc import SslCredentials # type: ignore
@@ -25,6 +26,7 @@
from grpc.experimental import aio # type: ignore
from google.cloud.logging_v2.types import logging_config
+from google.longrunning import operations_pb2 # type: ignore
from google.protobuf import empty_pb2 # type: ignore
from .base import ConfigServiceV2Transport, DEFAULT_CLIENT_INFO
from .grpc import ConfigServiceV2GrpcTransport
@@ -157,6 +159,7 @@ def __init__(
self._grpc_channel = None
self._ssl_channel_credentials = ssl_channel_credentials
self._stubs: Dict[str, Callable] = {}
+ self._operations_client: Optional[operations_v1.OperationsAsyncClient] = None
if api_mtls_endpoint:
warnings.warn("api_mtls_endpoint is deprecated", DeprecationWarning)
@@ -204,8 +207,11 @@ def __init__(
if not self._grpc_channel:
self._grpc_channel = type(self).create_channel(
self._host,
+ # use the credentials which are saved
credentials=self._credentials,
- credentials_file=credentials_file,
+ # Set ``credentials_file`` to ``None`` here as
+ # the credentials that we saved earlier should be used.
+ credentials_file=None,
scopes=self._scopes,
ssl_credentials=self._ssl_channel_credentials,
quota_project_id=quota_project_id,
@@ -228,6 +234,22 @@ def grpc_channel(self) -> aio.Channel:
# Return the channel from cache.
return self._grpc_channel
+ @property
+ def operations_client(self) -> operations_v1.OperationsAsyncClient:
+ """Create the client designed to process long-running operations.
+
+ This property caches on the instance; repeated calls return the same
+ client.
+ """
+ # Quick check: Only create a new client if we do not already have one.
+ if self._operations_client is None:
+ self._operations_client = operations_v1.OperationsAsyncClient(
+ self.grpc_channel
+ )
+
+ # Return the client from cache.
+ return self._operations_client
+
@property
def list_buckets(
self,
@@ -237,7 +259,7 @@ def list_buckets(
]:
r"""Return a callable for the list buckets method over gRPC.
- Lists buckets.
+ Lists log buckets.
Returns:
Callable[[~.ListBucketsRequest],
@@ -265,7 +287,7 @@ def get_bucket(
]:
r"""Return a callable for the get bucket method over gRPC.
- Gets a bucket.
+ Gets a log bucket.
Returns:
Callable[[~.GetBucketRequest],
@@ -293,9 +315,9 @@ def create_bucket(
]:
r"""Return a callable for the create bucket method over gRPC.
- Creates a bucket that can be used to store log
- entries. Once a bucket has been created, the region
- cannot be changed.
+ Creates a log bucket that can be used to store log
+ entries. After a bucket has been created, the bucket's
+ location cannot be changed.
Returns:
Callable[[~.CreateBucketRequest],
@@ -323,17 +345,18 @@ def update_bucket(
]:
r"""Return a callable for the update bucket method over gRPC.
- Updates a bucket. This method replaces the following fields in
- the existing bucket with values from the new bucket:
+ Updates a log bucket. This method replaces the following fields
+ in the existing bucket with values from the new bucket:
``retention_period``
If the retention period is decreased and the bucket is locked,
- FAILED_PRECONDITION will be returned.
+ ``FAILED_PRECONDITION`` will be returned.
- If the bucket has a LifecycleState of DELETE_REQUESTED,
- FAILED_PRECONDITION will be returned.
+ If the bucket has a ``lifecycle_state`` of ``DELETE_REQUESTED``,
+ then ``FAILED_PRECONDITION`` will be returned.
- A buckets region may not be modified after it is created.
+ After a bucket has been created, the bucket's location cannot be
+ changed.
Returns:
Callable[[~.UpdateBucketRequest],
@@ -359,9 +382,12 @@ def delete_bucket(
) -> Callable[[logging_config.DeleteBucketRequest], Awaitable[empty_pb2.Empty]]:
r"""Return a callable for the delete bucket method over gRPC.
- Deletes a bucket. Moves the bucket to the DELETE_REQUESTED
- state. After 7 days, the bucket will be purged and all logs in
- the bucket will be permanently deleted.
+ Deletes a log bucket.
+
+ Changes the bucket's ``lifecycle_state`` to the
+ ``DELETE_REQUESTED`` state. After 7 days, the bucket will be
+ purged and all log entries in the bucket will be permanently
+ deleted.
Returns:
Callable[[~.DeleteBucketRequest],
@@ -387,8 +413,9 @@ def undelete_bucket(
) -> Callable[[logging_config.UndeleteBucketRequest], Awaitable[empty_pb2.Empty]]:
r"""Return a callable for the undelete bucket method over gRPC.
- Undeletes a bucket. A bucket that has been deleted
- may be undeleted within the grace period of 7 days.
+ Undeletes a log bucket. A bucket that has been
+ deleted can be undeleted within the grace period of 7
+ days.
Returns:
Callable[[~.UndeleteBucketRequest],
@@ -416,7 +443,7 @@ def list_views(
]:
r"""Return a callable for the list views method over gRPC.
- Lists views on a bucket.
+ Lists views on a log bucket.
Returns:
Callable[[~.ListViewsRequest],
@@ -442,7 +469,7 @@ def get_view(
) -> Callable[[logging_config.GetViewRequest], Awaitable[logging_config.LogView]]:
r"""Return a callable for the get view method over gRPC.
- Gets a view.
+ Gets a view on a log bucket..
Returns:
Callable[[~.GetViewRequest],
@@ -470,8 +497,8 @@ def create_view(
]:
r"""Return a callable for the create view method over gRPC.
- Creates a view over logs in a bucket. A bucket may
- contain a maximum of 50 views.
+ Creates a view over log entries in a log bucket. A
+ bucket may contain a maximum of 30 views.
Returns:
Callable[[~.CreateViewRequest],
@@ -499,8 +526,11 @@ def update_view(
]:
r"""Return a callable for the update view method over gRPC.
- Updates a view. This method replaces the following fields in the
- existing view with values from the new view: ``filter``.
+ Updates a view on a log bucket. This method replaces the
+ following fields in the existing view with values from the new
+ view: ``filter``. If an ``UNAVAILABLE`` error is returned, this
+ indicates that system is not in a state where it can update the
+ view. If this occurs, please try again in a few minutes.
Returns:
Callable[[~.UpdateViewRequest],
@@ -526,7 +556,10 @@ def delete_view(
) -> Callable[[logging_config.DeleteViewRequest], Awaitable[empty_pb2.Empty]]:
r"""Return a callable for the delete view method over gRPC.
- Deletes a view from a bucket.
+ Deletes a view on a log bucket. If an ``UNAVAILABLE`` error is
+ returned, this indicates that system is not in a state where it
+ can delete the view. If this occurs, please try again in a few
+ minutes.
Returns:
Callable[[~.DeleteViewRequest],
@@ -701,7 +734,8 @@ def list_exclusions(
]:
r"""Return a callable for the list exclusions method over gRPC.
- Lists all the exclusions in a parent resource.
+ Lists all the exclusions on the \_Default sink in a parent
+ resource.
Returns:
Callable[[~.ListExclusionsRequest],
@@ -729,7 +763,7 @@ def get_exclusion(
]:
r"""Return a callable for the get exclusion method over gRPC.
- Gets the description of an exclusion.
+ Gets the description of an exclusion in the \_Default sink.
Returns:
Callable[[~.GetExclusionRequest],
@@ -757,10 +791,9 @@ def create_exclusion(
]:
r"""Return a callable for the create exclusion method over gRPC.
- Creates a new exclusion in a specified parent
- resource. Only log entries belonging to that resource
- can be excluded. You can have up to 10 exclusions in a
- resource.
+ Creates a new exclusion in the \_Default sink in a specified
+ parent resource. Only log entries belonging to that resource can
+ be excluded. You can have up to 10 exclusions in a resource.
Returns:
Callable[[~.CreateExclusionRequest],
@@ -788,8 +821,8 @@ def update_exclusion(
]:
r"""Return a callable for the update exclusion method over gRPC.
- Changes one or more properties of an existing
- exclusion.
+ Changes one or more properties of an existing exclusion in the
+ \_Default sink.
Returns:
Callable[[~.UpdateExclusionRequest],
@@ -815,7 +848,7 @@ def delete_exclusion(
) -> Callable[[logging_config.DeleteExclusionRequest], Awaitable[empty_pb2.Empty]]:
r"""Return a callable for the delete exclusion method over gRPC.
- Deletes an exclusion.
+ Deletes an exclusion in the \_Default sink.
Returns:
Callable[[~.DeleteExclusionRequest],
@@ -843,13 +876,14 @@ def get_cmek_settings(
]:
r"""Return a callable for the get cmek settings method over gRPC.
- Gets the Logs Router CMEK settings for the given resource.
+ Gets the Logging CMEK settings for the given resource.
- Note: CMEK for the Logs Router can currently only be configured
- for GCP organizations. Once configured, it applies to all
- projects and folders in the GCP organization.
+ Note: CMEK for the Log Router can be configured for Google Cloud
+ projects, folders, organizations and billing accounts. Once
+ configured for an organization, it applies to all projects and
+ folders in the Google Cloud organization.
- See `Enabling CMEK for Logs
+ See `Enabling CMEK for Log
Router `__
for more information.
@@ -880,11 +914,11 @@ def update_cmek_settings(
]:
r"""Return a callable for the update cmek settings method over gRPC.
- Updates the Logs Router CMEK settings for the given resource.
+ Updates the Log Router CMEK settings for the given resource.
- Note: CMEK for the Logs Router can currently only be configured
- for GCP organizations. Once configured, it applies to all
- projects and folders in the GCP organization.
+ Note: CMEK for the Log Router can currently only be configured
+ for Google Cloud organizations. Once configured, it applies to
+ all projects and folders in the Google Cloud organization.
[UpdateCmekSettings][google.logging.v2.ConfigServiceV2.UpdateCmekSettings]
will fail if 1) ``kms_key_name`` is invalid, or 2) the
@@ -892,7 +926,7 @@ def update_cmek_settings(
``roles/cloudkms.cryptoKeyEncrypterDecrypter`` role assigned for
the key, or 3) access to the key is disabled.
- See `Enabling CMEK for Logs
+ See `Enabling CMEK for Log
Router `__
for more information.
@@ -914,6 +948,118 @@ def update_cmek_settings(
)
return self._stubs["update_cmek_settings"]
+ @property
+ def get_settings(
+ self,
+ ) -> Callable[
+ [logging_config.GetSettingsRequest], Awaitable[logging_config.Settings]
+ ]:
+ r"""Return a callable for the get settings method over gRPC.
+
+ Gets the Log Router settings for the given resource.
+
+ Note: Settings for the Log Router can be get for Google Cloud
+ projects, folders, organizations and billing accounts. Currently
+ it can only be configured for organizations. Once configured for
+ an organization, it applies to all projects and folders in the
+ Google Cloud organization.
+
+ See `Enabling CMEK for Log
+ Router `__
+ for more information.
+
+ Returns:
+ Callable[[~.GetSettingsRequest],
+ Awaitable[~.Settings]]:
+ A function that, when called, will call the underlying RPC
+ on the server.
+ """
+ # Generate a "stub function" on-the-fly which will actually make
+ # the request.
+ # gRPC handles serialization and deserialization, so we just need
+ # to pass in the functions for each.
+ if "get_settings" not in self._stubs:
+ self._stubs["get_settings"] = self.grpc_channel.unary_unary(
+ "/google.logging.v2.ConfigServiceV2/GetSettings",
+ request_serializer=logging_config.GetSettingsRequest.serialize,
+ response_deserializer=logging_config.Settings.deserialize,
+ )
+ return self._stubs["get_settings"]
+
+ @property
+ def update_settings(
+ self,
+ ) -> Callable[
+ [logging_config.UpdateSettingsRequest], Awaitable[logging_config.Settings]
+ ]:
+ r"""Return a callable for the update settings method over gRPC.
+
+ Updates the Log Router settings for the given resource.
+
+ Note: Settings for the Log Router can currently only be
+ configured for Google Cloud organizations. Once configured, it
+ applies to all projects and folders in the Google Cloud
+ organization.
+
+ [UpdateSettings][google.logging.v2.ConfigServiceV2.UpdateSettings]
+ will fail if 1) ``kms_key_name`` is invalid, or 2) the
+ associated service account does not have the required
+ ``roles/cloudkms.cryptoKeyEncrypterDecrypter`` role assigned for
+ the key, or 3) access to the key is disabled. 4) ``location_id``
+ is not supported by Logging. 5) ``location_id`` violate
+ OrgPolicy.
+
+ See `Enabling CMEK for Log
+ Router `__
+ for more information.
+
+ Returns:
+ Callable[[~.UpdateSettingsRequest],
+ Awaitable[~.Settings]]:
+ A function that, when called, will call the underlying RPC
+ on the server.
+ """
+ # Generate a "stub function" on-the-fly which will actually make
+ # the request.
+ # gRPC handles serialization and deserialization, so we just need
+ # to pass in the functions for each.
+ if "update_settings" not in self._stubs:
+ self._stubs["update_settings"] = self.grpc_channel.unary_unary(
+ "/google.logging.v2.ConfigServiceV2/UpdateSettings",
+ request_serializer=logging_config.UpdateSettingsRequest.serialize,
+ response_deserializer=logging_config.Settings.deserialize,
+ )
+ return self._stubs["update_settings"]
+
+ @property
+ def copy_log_entries(
+ self,
+ ) -> Callable[
+ [logging_config.CopyLogEntriesRequest], Awaitable[operations_pb2.Operation]
+ ]:
+ r"""Return a callable for the copy log entries method over gRPC.
+
+ Copies a set of log entries from a log bucket to a
+ Cloud Storage bucket.
+
+ Returns:
+ Callable[[~.CopyLogEntriesRequest],
+ Awaitable[~.Operation]]:
+ A function that, when called, will call the underlying RPC
+ on the server.
+ """
+ # Generate a "stub function" on-the-fly which will actually make
+ # the request.
+ # gRPC handles serialization and deserialization, so we just need
+ # to pass in the functions for each.
+ if "copy_log_entries" not in self._stubs:
+ self._stubs["copy_log_entries"] = self.grpc_channel.unary_unary(
+ "/google.logging.v2.ConfigServiceV2/CopyLogEntries",
+ request_serializer=logging_config.CopyLogEntriesRequest.serialize,
+ response_deserializer=operations_pb2.Operation.FromString,
+ )
+ return self._stubs["copy_log_entries"]
+
def close(self):
return self.grpc_channel.close()
diff --git a/google/cloud/logging_v2/services/logging_service_v2/__init__.py b/google/cloud/logging_v2/services/logging_service_v2/__init__.py
index bd7a79820..41b2a2d15 100644
--- a/google/cloud/logging_v2/services/logging_service_v2/__init__.py
+++ b/google/cloud/logging_v2/services/logging_service_v2/__init__.py
@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
-# Copyright 2020 Google LLC
+# Copyright 2022 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
diff --git a/google/cloud/logging_v2/services/logging_service_v2/async_client.py b/google/cloud/logging_v2/services/logging_service_v2/async_client.py
index e14453424..32a1d1808 100644
--- a/google/cloud/logging_v2/services/logging_service_v2/async_client.py
+++ b/google/cloud/logging_v2/services/logging_service_v2/async_client.py
@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
-# Copyright 2020 Google LLC
+# Copyright 2022 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -18,6 +18,7 @@
import re
from typing import (
Dict,
+ Mapping,
Optional,
AsyncIterable,
Awaitable,
@@ -223,11 +224,27 @@ async def delete_log(
timeout: float = None,
metadata: Sequence[Tuple[str, str]] = (),
) -> None:
- r"""Deletes all the log entries in a log. The log
- reappears if it receives new entries. Log entries
- written shortly before the delete operation might not be
- deleted. Entries received after the delete operation
- with a timestamp before the operation will be deleted.
+ r"""Deletes all the log entries in a log for the \_Default Log
+ Bucket. The log reappears if it receives new entries. Log
+ entries written shortly before the delete operation might not be
+ deleted. Entries received after the delete operation with a
+ timestamp before the operation will be deleted.
+
+ .. code-block:: python
+
+ from google.cloud import logging_v2
+
+ async def sample_delete_log():
+ # Create a client
+ client = logging_v2.LoggingServiceV2AsyncClient()
+
+ # Initialize request argument(s)
+ request = logging_v2.DeleteLogRequest(
+ log_name="log_name_value",
+ )
+
+ # Make the request
+ await client.delete_log(request=request)
Args:
request (Union[google.cloud.logging_v2.types.DeleteLogRequest, dict]):
@@ -235,16 +252,15 @@ async def delete_log(
log_name (:class:`str`):
Required. The resource name of the log to delete:
- ::
-
- "projects/[PROJECT_ID]/logs/[LOG_ID]"
- "organizations/[ORGANIZATION_ID]/logs/[LOG_ID]"
- "billingAccounts/[BILLING_ACCOUNT_ID]/logs/[LOG_ID]"
- "folders/[FOLDER_ID]/logs/[LOG_ID]"
+ - ``projects/[PROJECT_ID]/logs/[LOG_ID]``
+ - ``organizations/[ORGANIZATION_ID]/logs/[LOG_ID]``
+ - ``billingAccounts/[BILLING_ACCOUNT_ID]/logs/[LOG_ID]``
+ - ``folders/[FOLDER_ID]/logs/[LOG_ID]``
``[LOG_ID]`` must be URL-encoded. For example,
``"projects/my-project-id/logs/syslog"``,
- ``"organizations/1234567890/logs/cloudresourcemanager.googleapis.com%2Factivity"``.
+ ``"organizations/123/logs/cloudaudit.googleapis.com%2Factivity"``.
+
For more information about log names, see
[LogEntry][google.logging.v2.LogEntry].
@@ -258,7 +274,7 @@ async def delete_log(
sent along with the request as metadata.
"""
# Create or coerce a protobuf request object.
- # Sanity check: If we got a request object, we should *not* have
+ # Quick check: If we got a request object, we should *not* have
# gotten any keyword arguments that map to the request.
has_flattened_params = any([log_name])
if request is not None and has_flattened_params:
@@ -301,7 +317,10 @@ async def delete_log(
# Send the request.
await rpc(
- request, retry=retry, timeout=timeout, metadata=metadata,
+ request,
+ retry=retry,
+ timeout=timeout,
+ metadata=metadata,
)
async def write_log_entries(
@@ -310,7 +329,7 @@ async def write_log_entries(
*,
log_name: str = None,
resource: monitored_resource_pb2.MonitoredResource = None,
- labels: Sequence[logging.WriteLogEntriesRequest.LabelsEntry] = None,
+ labels: Mapping[str, str] = None,
entries: Sequence[log_entry.LogEntry] = None,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: float = None,
@@ -324,6 +343,28 @@ async def write_log_entries(
maximum of 1000 different resources (projects,
organizations, billing accounts or folders)
+ .. code-block:: python
+
+ from google.cloud import logging_v2
+
+ async def sample_write_log_entries():
+ # Create a client
+ client = logging_v2.LoggingServiceV2AsyncClient()
+
+ # Initialize request argument(s)
+ entries = logging_v2.LogEntry()
+ entries.log_name = "log_name_value"
+
+ request = logging_v2.WriteLogEntriesRequest(
+ entries=entries,
+ )
+
+ # Make the request
+ response = await client.write_log_entries(request=request)
+
+ # Handle the response
+ print(response)
+
Args:
request (Union[google.cloud.logging_v2.types.WriteLogEntriesRequest, dict]):
The request object. The parameters to WriteLogEntries.
@@ -332,19 +373,17 @@ async def write_log_entries(
to all log entries in ``entries`` that do not specify a
value for ``log_name``:
- ::
-
- "projects/[PROJECT_ID]/logs/[LOG_ID]"
- "organizations/[ORGANIZATION_ID]/logs/[LOG_ID]"
- "billingAccounts/[BILLING_ACCOUNT_ID]/logs/[LOG_ID]"
- "folders/[FOLDER_ID]/logs/[LOG_ID]"
+ - ``projects/[PROJECT_ID]/logs/[LOG_ID]``
+ - ``organizations/[ORGANIZATION_ID]/logs/[LOG_ID]``
+ - ``billingAccounts/[BILLING_ACCOUNT_ID]/logs/[LOG_ID]``
+ - ``folders/[FOLDER_ID]/logs/[LOG_ID]``
``[LOG_ID]`` must be URL-encoded. For example:
::
"projects/my-project-id/logs/syslog"
- "organizations/1234567890/logs/cloudresourcemanager.googleapis.com%2Factivity"
+ "organizations/123/logs/cloudaudit.googleapis.com%2Factivity"
The permission ``logging.logEntries.create`` is needed
on each project, organization, billing account, or
@@ -371,7 +410,7 @@ async def write_log_entries(
This corresponds to the ``resource`` field
on the ``request`` instance; if ``request`` is provided, this
should not be set.
- labels (:class:`Sequence[google.cloud.logging_v2.types.WriteLogEntriesRequest.LabelsEntry]`):
+ labels (:class:`Mapping[str, str]`):
Optional. Default labels that are added to the
``labels`` field of all log entries in ``entries``. If a
log entry already has a label with the same key as a
@@ -400,17 +439,17 @@ async def write_log_entries(
Log entries with timestamps that are more than the `logs
retention
- period `__
- in the past or more than 24 hours in the future will not
- be available when calling ``entries.list``. However,
- those log entries can still be `exported with
+ period `__ in
+ the past or more than 24 hours in the future will not be
+ available when calling ``entries.list``. However, those
+ log entries can still be `exported with
LogSinks `__.
To improve throughput and to avoid exceeding the `quota
- limit `__
- for calls to ``entries.write``, you should try to
- include several log entries in this list, rather than
- calling this method for each individual log entry.
+ limit `__ for
+ calls to ``entries.write``, you should try to include
+ several log entries in this list, rather than calling
+ this method for each individual log entry.
This corresponds to the ``entries`` field
on the ``request`` instance; if ``request`` is provided, this
@@ -426,7 +465,7 @@ async def write_log_entries(
Result returned from WriteLogEntries.
"""
# Create or coerce a protobuf request object.
- # Sanity check: If we got a request object, we should *not* have
+ # Quick check: If we got a request object, we should *not* have
# gotten any keyword arguments that map to the request.
has_flattened_params = any([log_name, resource, labels, entries])
if request is not None and has_flattened_params:
@@ -469,7 +508,12 @@ async def write_log_entries(
)
# Send the request.
- response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,)
+ response = await rpc(
+ request,
+ retry=retry,
+ timeout=timeout,
+ metadata=metadata,
+ )
# Done; return the response.
return response
@@ -490,6 +534,26 @@ async def list_log_entries(
For ways to export log entries, see `Exporting
Logs `__.
+ .. code-block:: python
+
+ from google.cloud import logging_v2
+
+ async def sample_list_log_entries():
+ # Create a client
+ client = logging_v2.LoggingServiceV2AsyncClient()
+
+ # Initialize request argument(s)
+ request = logging_v2.ListLogEntriesRequest(
+ resource_names=['resource_names_value_1', 'resource_names_value_2'],
+ )
+
+ # Make the request
+ page_result = client.list_log_entries(request=request)
+
+ # Handle the response
+ async for response in page_result:
+ print(response)
+
Args:
request (Union[google.cloud.logging_v2.types.ListLogEntriesRequest, dict]):
The request object. The parameters to `ListLogEntries`.
@@ -497,18 +561,17 @@ async def list_log_entries(
Required. Names of one or more parent resources from
which to retrieve log entries:
- ::
+ - ``projects/[PROJECT_ID]``
+ - ``organizations/[ORGANIZATION_ID]``
+ - ``billingAccounts/[BILLING_ACCOUNT_ID]``
+ - ``folders/[FOLDER_ID]``
- "projects/[PROJECT_ID]"
- "organizations/[ORGANIZATION_ID]"
- "billingAccounts/[BILLING_ACCOUNT_ID]"
- "folders/[FOLDER_ID]"
+ May alternatively be one or more views:
- May alternatively be one or more views
- projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]
- organization/[ORGANIZATION_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]
- billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]
- folders/[FOLDER_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]
+ - ``projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]``
+ - ``organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]``
+ - ``billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]``
+ - ``folders/[FOLDER_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]``
Projects listed in the ``project_ids`` field are added
to this list.
@@ -558,7 +621,7 @@ async def list_log_entries(
"""
# Create or coerce a protobuf request object.
- # Sanity check: If we got a request object, we should *not* have
+ # Quick check: If we got a request object, we should *not* have
# gotten any keyword arguments that map to the request.
has_flattened_params = any([resource_names, filter, order_by])
if request is not None and has_flattened_params:
@@ -598,12 +661,20 @@ async def list_log_entries(
)
# Send the request.
- response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,)
+ response = await rpc(
+ request,
+ retry=retry,
+ timeout=timeout,
+ metadata=metadata,
+ )
# This method is paged; wrap the response in a pager, which provides
# an `__aiter__` convenience method.
response = pagers.ListLogEntriesAsyncPager(
- method=rpc, request=request, response=response, metadata=metadata,
+ method=rpc,
+ request=request,
+ response=response,
+ metadata=metadata,
)
# Done; return the response.
@@ -620,6 +691,25 @@ async def list_monitored_resource_descriptors(
r"""Lists the descriptors for monitored resource types
used by Logging.
+ .. code-block:: python
+
+ from google.cloud import logging_v2
+
+ async def sample_list_monitored_resource_descriptors():
+ # Create a client
+ client = logging_v2.LoggingServiceV2AsyncClient()
+
+ # Initialize request argument(s)
+ request = logging_v2.ListMonitoredResourceDescriptorsRequest(
+ )
+
+ # Make the request
+ page_result = client.list_monitored_resource_descriptors(request=request)
+
+ # Handle the response
+ async for response in page_result:
+ print(response)
+
Args:
request (Union[google.cloud.logging_v2.types.ListMonitoredResourceDescriptorsRequest, dict]):
The request object. The parameters to
@@ -662,12 +752,20 @@ async def list_monitored_resource_descriptors(
)
# Send the request.
- response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,)
+ response = await rpc(
+ request,
+ retry=retry,
+ timeout=timeout,
+ metadata=metadata,
+ )
# This method is paged; wrap the response in a pager, which provides
# an `__aiter__` convenience method.
response = pagers.ListMonitoredResourceDescriptorsAsyncPager(
- method=rpc, request=request, response=response, metadata=metadata,
+ method=rpc,
+ request=request,
+ response=response,
+ metadata=metadata,
)
# Done; return the response.
@@ -686,18 +784,36 @@ async def list_logs(
or billing accounts. Only logs that have entries are
listed.
+ .. code-block:: python
+
+ from google.cloud import logging_v2
+
+ async def sample_list_logs():
+ # Create a client
+ client = logging_v2.LoggingServiceV2AsyncClient()
+
+ # Initialize request argument(s)
+ request = logging_v2.ListLogsRequest(
+ parent="parent_value",
+ )
+
+ # Make the request
+ page_result = client.list_logs(request=request)
+
+ # Handle the response
+ async for response in page_result:
+ print(response)
+
Args:
request (Union[google.cloud.logging_v2.types.ListLogsRequest, dict]):
The request object. The parameters to ListLogs.
parent (:class:`str`):
Required. The resource name that owns the logs:
- ::
-
- "projects/[PROJECT_ID]"
- "organizations/[ORGANIZATION_ID]"
- "billingAccounts/[BILLING_ACCOUNT_ID]"
- "folders/[FOLDER_ID]"
+ - ``projects/[PROJECT_ID]``
+ - ``organizations/[ORGANIZATION_ID]``
+ - ``billingAccounts/[BILLING_ACCOUNT_ID]``
+ - ``folders/[FOLDER_ID]``
This corresponds to the ``parent`` field
on the ``request`` instance; if ``request`` is provided, this
@@ -717,7 +833,7 @@ async def list_logs(
"""
# Create or coerce a protobuf request object.
- # Sanity check: If we got a request object, we should *not* have
+ # Quick check: If we got a request object, we should *not* have
# gotten any keyword arguments that map to the request.
has_flattened_params = any([parent])
if request is not None and has_flattened_params:
@@ -759,12 +875,20 @@ async def list_logs(
)
# Send the request.
- response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,)
+ response = await rpc(
+ request,
+ retry=retry,
+ timeout=timeout,
+ metadata=metadata,
+ )
# This method is paged; wrap the response in a pager, which provides
# an `__aiter__` convenience method.
response = pagers.ListLogsAsyncPager(
- method=rpc, request=request, response=response, metadata=metadata,
+ method=rpc,
+ request=request,
+ response=response,
+ metadata=metadata,
)
# Done; return the response.
@@ -782,6 +906,36 @@ def tail_log_entries(
Until the stream is terminated, it will continue reading
logs.
+ .. code-block:: python
+
+ from google.cloud import logging_v2
+
+ async def sample_tail_log_entries():
+ # Create a client
+ client = logging_v2.LoggingServiceV2AsyncClient()
+
+ # Initialize request argument(s)
+ request = logging_v2.TailLogEntriesRequest(
+ resource_names=['resource_names_value_1', 'resource_names_value_2'],
+ )
+
+ # This method expects an iterator which contains
+ # 'logging_v2.TailLogEntriesRequest' objects
+ # Here we create a generator that yields a single `request` for
+ # demonstrative purposes.
+ requests = [request]
+
+ def request_generator():
+ for request in requests:
+ yield request
+
+ # Make the request
+ stream = await client.tail_log_entries(requests=request_generator())
+
+ # Handle the response
+ async for response in stream:
+ print(response)
+
Args:
requests (AsyncIterator[`google.cloud.logging_v2.types.TailLogEntriesRequest`]):
The request object AsyncIterator. The parameters to `TailLogEntries`.
@@ -816,7 +970,12 @@ def tail_log_entries(
)
# Send the request.
- response = rpc(requests, retry=retry, timeout=timeout, metadata=metadata,)
+ response = rpc(
+ requests,
+ retry=retry,
+ timeout=timeout,
+ metadata=metadata,
+ )
# Done; return the response.
return response
@@ -830,7 +989,9 @@ async def __aexit__(self, exc_type, exc, tb):
try:
DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo(
- gapic_version=pkg_resources.get_distribution("google-cloud-logging",).version,
+ gapic_version=pkg_resources.get_distribution(
+ "google-cloud-logging",
+ ).version,
)
except pkg_resources.DistributionNotFound:
DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo()
diff --git a/google/cloud/logging_v2/services/logging_service_v2/client.py b/google/cloud/logging_v2/services/logging_service_v2/client.py
index 5815c8d19..47c5bfe82 100644
--- a/google/cloud/logging_v2/services/logging_service_v2/client.py
+++ b/google/cloud/logging_v2/services/logging_service_v2/client.py
@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
-# Copyright 2020 Google LLC
+# Copyright 2022 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -16,7 +16,17 @@
from collections import OrderedDict
import os
import re
-from typing import Dict, Optional, Iterable, Iterator, Sequence, Tuple, Type, Union
+from typing import (
+ Dict,
+ Mapping,
+ Optional,
+ Iterable,
+ Iterator,
+ Sequence,
+ Tuple,
+ Type,
+ Union,
+)
import pkg_resources
from google.api_core import client_options as client_options_lib
@@ -57,7 +67,10 @@ class LoggingServiceV2ClientMeta(type):
_transport_registry["grpc"] = LoggingServiceV2GrpcTransport
_transport_registry["grpc_asyncio"] = LoggingServiceV2GrpcAsyncIOTransport
- def get_transport_class(cls, label: str = None,) -> Type[LoggingServiceV2Transport]:
+ def get_transport_class(
+ cls,
+ label: str = None,
+ ) -> Type[LoggingServiceV2Transport]:
"""Returns an appropriate transport class.
Args:
@@ -162,9 +175,15 @@ def transport(self) -> LoggingServiceV2Transport:
return self._transport
@staticmethod
- def log_path(project: str, log: str,) -> str:
+ def log_path(
+ project: str,
+ log: str,
+ ) -> str:
"""Returns a fully-qualified log string."""
- return "projects/{project}/logs/{log}".format(project=project, log=log,)
+ return "projects/{project}/logs/{log}".format(
+ project=project,
+ log=log,
+ )
@staticmethod
def parse_log_path(path: str) -> Dict[str, str]:
@@ -173,7 +192,9 @@ def parse_log_path(path: str) -> Dict[str, str]:
return m.groupdict() if m else {}
@staticmethod
- def common_billing_account_path(billing_account: str,) -> str:
+ def common_billing_account_path(
+ billing_account: str,
+ ) -> str:
"""Returns a fully-qualified billing_account string."""
return "billingAccounts/{billing_account}".format(
billing_account=billing_account,
@@ -186,9 +207,13 @@ def parse_common_billing_account_path(path: str) -> Dict[str, str]:
return m.groupdict() if m else {}
@staticmethod
- def common_folder_path(folder: str,) -> str:
+ def common_folder_path(
+ folder: str,
+ ) -> str:
"""Returns a fully-qualified folder string."""
- return "folders/{folder}".format(folder=folder,)
+ return "folders/{folder}".format(
+ folder=folder,
+ )
@staticmethod
def parse_common_folder_path(path: str) -> Dict[str, str]:
@@ -197,9 +222,13 @@ def parse_common_folder_path(path: str) -> Dict[str, str]:
return m.groupdict() if m else {}
@staticmethod
- def common_organization_path(organization: str,) -> str:
+ def common_organization_path(
+ organization: str,
+ ) -> str:
"""Returns a fully-qualified organization string."""
- return "organizations/{organization}".format(organization=organization,)
+ return "organizations/{organization}".format(
+ organization=organization,
+ )
@staticmethod
def parse_common_organization_path(path: str) -> Dict[str, str]:
@@ -208,9 +237,13 @@ def parse_common_organization_path(path: str) -> Dict[str, str]:
return m.groupdict() if m else {}
@staticmethod
- def common_project_path(project: str,) -> str:
+ def common_project_path(
+ project: str,
+ ) -> str:
"""Returns a fully-qualified project string."""
- return "projects/{project}".format(project=project,)
+ return "projects/{project}".format(
+ project=project,
+ )
@staticmethod
def parse_common_project_path(path: str) -> Dict[str, str]:
@@ -219,10 +252,14 @@ def parse_common_project_path(path: str) -> Dict[str, str]:
return m.groupdict() if m else {}
@staticmethod
- def common_location_path(project: str, location: str,) -> str:
+ def common_location_path(
+ project: str,
+ location: str,
+ ) -> str:
"""Returns a fully-qualified location string."""
return "projects/{project}/locations/{location}".format(
- project=project, location=location,
+ project=project,
+ location=location,
)
@staticmethod
@@ -405,11 +442,27 @@ def delete_log(
timeout: float = None,
metadata: Sequence[Tuple[str, str]] = (),
) -> None:
- r"""Deletes all the log entries in a log. The log
- reappears if it receives new entries. Log entries
- written shortly before the delete operation might not be
- deleted. Entries received after the delete operation
- with a timestamp before the operation will be deleted.
+ r"""Deletes all the log entries in a log for the \_Default Log
+ Bucket. The log reappears if it receives new entries. Log
+ entries written shortly before the delete operation might not be
+ deleted. Entries received after the delete operation with a
+ timestamp before the operation will be deleted.
+
+ .. code-block:: python
+
+ from google.cloud import logging_v2
+
+ def sample_delete_log():
+ # Create a client
+ client = logging_v2.LoggingServiceV2Client()
+
+ # Initialize request argument(s)
+ request = logging_v2.DeleteLogRequest(
+ log_name="log_name_value",
+ )
+
+ # Make the request
+ client.delete_log(request=request)
Args:
request (Union[google.cloud.logging_v2.types.DeleteLogRequest, dict]):
@@ -417,16 +470,15 @@ def delete_log(
log_name (str):
Required. The resource name of the log to delete:
- ::
-
- "projects/[PROJECT_ID]/logs/[LOG_ID]"
- "organizations/[ORGANIZATION_ID]/logs/[LOG_ID]"
- "billingAccounts/[BILLING_ACCOUNT_ID]/logs/[LOG_ID]"
- "folders/[FOLDER_ID]/logs/[LOG_ID]"
+ - ``projects/[PROJECT_ID]/logs/[LOG_ID]``
+ - ``organizations/[ORGANIZATION_ID]/logs/[LOG_ID]``
+ - ``billingAccounts/[BILLING_ACCOUNT_ID]/logs/[LOG_ID]``
+ - ``folders/[FOLDER_ID]/logs/[LOG_ID]``
``[LOG_ID]`` must be URL-encoded. For example,
``"projects/my-project-id/logs/syslog"``,
- ``"organizations/1234567890/logs/cloudresourcemanager.googleapis.com%2Factivity"``.
+ ``"organizations/123/logs/cloudaudit.googleapis.com%2Factivity"``.
+
For more information about log names, see
[LogEntry][google.logging.v2.LogEntry].
@@ -440,7 +492,7 @@ def delete_log(
sent along with the request as metadata.
"""
# Create or coerce a protobuf request object.
- # Sanity check: If we got a request object, we should *not* have
+ # Quick check: If we got a request object, we should *not* have
# gotten any keyword arguments that map to the request.
has_flattened_params = any([log_name])
if request is not None and has_flattened_params:
@@ -472,7 +524,10 @@ def delete_log(
# Send the request.
rpc(
- request, retry=retry, timeout=timeout, metadata=metadata,
+ request,
+ retry=retry,
+ timeout=timeout,
+ metadata=metadata,
)
def write_log_entries(
@@ -481,7 +536,7 @@ def write_log_entries(
*,
log_name: str = None,
resource: monitored_resource_pb2.MonitoredResource = None,
- labels: Sequence[logging.WriteLogEntriesRequest.LabelsEntry] = None,
+ labels: Mapping[str, str] = None,
entries: Sequence[log_entry.LogEntry] = None,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: float = None,
@@ -495,6 +550,28 @@ def write_log_entries(
maximum of 1000 different resources (projects,
organizations, billing accounts or folders)
+ .. code-block:: python
+
+ from google.cloud import logging_v2
+
+ def sample_write_log_entries():
+ # Create a client
+ client = logging_v2.LoggingServiceV2Client()
+
+ # Initialize request argument(s)
+ entries = logging_v2.LogEntry()
+ entries.log_name = "log_name_value"
+
+ request = logging_v2.WriteLogEntriesRequest(
+ entries=entries,
+ )
+
+ # Make the request
+ response = client.write_log_entries(request=request)
+
+ # Handle the response
+ print(response)
+
Args:
request (Union[google.cloud.logging_v2.types.WriteLogEntriesRequest, dict]):
The request object. The parameters to WriteLogEntries.
@@ -503,19 +580,17 @@ def write_log_entries(
to all log entries in ``entries`` that do not specify a
value for ``log_name``:
- ::
-
- "projects/[PROJECT_ID]/logs/[LOG_ID]"
- "organizations/[ORGANIZATION_ID]/logs/[LOG_ID]"
- "billingAccounts/[BILLING_ACCOUNT_ID]/logs/[LOG_ID]"
- "folders/[FOLDER_ID]/logs/[LOG_ID]"
+ - ``projects/[PROJECT_ID]/logs/[LOG_ID]``
+ - ``organizations/[ORGANIZATION_ID]/logs/[LOG_ID]``
+ - ``billingAccounts/[BILLING_ACCOUNT_ID]/logs/[LOG_ID]``
+ - ``folders/[FOLDER_ID]/logs/[LOG_ID]``
``[LOG_ID]`` must be URL-encoded. For example:
::
"projects/my-project-id/logs/syslog"
- "organizations/1234567890/logs/cloudresourcemanager.googleapis.com%2Factivity"
+ "organizations/123/logs/cloudaudit.googleapis.com%2Factivity"
The permission ``logging.logEntries.create`` is needed
on each project, organization, billing account, or
@@ -542,7 +617,7 @@ def write_log_entries(
This corresponds to the ``resource`` field
on the ``request`` instance; if ``request`` is provided, this
should not be set.
- labels (Sequence[google.cloud.logging_v2.types.WriteLogEntriesRequest.LabelsEntry]):
+ labels (Mapping[str, str]):
Optional. Default labels that are added to the
``labels`` field of all log entries in ``entries``. If a
log entry already has a label with the same key as a
@@ -571,17 +646,17 @@ def write_log_entries(
Log entries with timestamps that are more than the `logs
retention
- period `__
- in the past or more than 24 hours in the future will not
- be available when calling ``entries.list``. However,
- those log entries can still be `exported with
+ period `__ in
+ the past or more than 24 hours in the future will not be
+ available when calling ``entries.list``. However, those
+ log entries can still be `exported with
LogSinks `__.
To improve throughput and to avoid exceeding the `quota
- limit `__
- for calls to ``entries.write``, you should try to
- include several log entries in this list, rather than
- calling this method for each individual log entry.
+ limit `__ for
+ calls to ``entries.write``, you should try to include
+ several log entries in this list, rather than calling
+ this method for each individual log entry.
This corresponds to the ``entries`` field
on the ``request`` instance; if ``request`` is provided, this
@@ -597,7 +672,7 @@ def write_log_entries(
Result returned from WriteLogEntries.
"""
# Create or coerce a protobuf request object.
- # Sanity check: If we got a request object, we should *not* have
+ # Quick check: If we got a request object, we should *not* have
# gotten any keyword arguments that map to the request.
has_flattened_params = any([log_name, resource, labels, entries])
if request is not None and has_flattened_params:
@@ -628,7 +703,12 @@ def write_log_entries(
rpc = self._transport._wrapped_methods[self._transport.write_log_entries]
# Send the request.
- response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,)
+ response = rpc(
+ request,
+ retry=retry,
+ timeout=timeout,
+ metadata=metadata,
+ )
# Done; return the response.
return response
@@ -649,6 +729,26 @@ def list_log_entries(
For ways to export log entries, see `Exporting
Logs `__.
+ .. code-block:: python
+
+ from google.cloud import logging_v2
+
+ def sample_list_log_entries():
+ # Create a client
+ client = logging_v2.LoggingServiceV2Client()
+
+ # Initialize request argument(s)
+ request = logging_v2.ListLogEntriesRequest(
+ resource_names=['resource_names_value_1', 'resource_names_value_2'],
+ )
+
+ # Make the request
+ page_result = client.list_log_entries(request=request)
+
+ # Handle the response
+ for response in page_result:
+ print(response)
+
Args:
request (Union[google.cloud.logging_v2.types.ListLogEntriesRequest, dict]):
The request object. The parameters to `ListLogEntries`.
@@ -656,18 +756,17 @@ def list_log_entries(
Required. Names of one or more parent resources from
which to retrieve log entries:
- ::
+ - ``projects/[PROJECT_ID]``
+ - ``organizations/[ORGANIZATION_ID]``
+ - ``billingAccounts/[BILLING_ACCOUNT_ID]``
+ - ``folders/[FOLDER_ID]``
- "projects/[PROJECT_ID]"
- "organizations/[ORGANIZATION_ID]"
- "billingAccounts/[BILLING_ACCOUNT_ID]"
- "folders/[FOLDER_ID]"
+ May alternatively be one or more views:
- May alternatively be one or more views
- projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]
- organization/[ORGANIZATION_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]
- billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]
- folders/[FOLDER_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]
+ - ``projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]``
+ - ``organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]``
+ - ``billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]``
+ - ``folders/[FOLDER_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]``
Projects listed in the ``project_ids`` field are added
to this list.
@@ -717,7 +816,7 @@ def list_log_entries(
"""
# Create or coerce a protobuf request object.
- # Sanity check: If we got a request object, we should *not* have
+ # Quick check: If we got a request object, we should *not* have
# gotten any keyword arguments that map to the request.
has_flattened_params = any([resource_names, filter, order_by])
if request is not None and has_flattened_params:
@@ -746,12 +845,20 @@ def list_log_entries(
rpc = self._transport._wrapped_methods[self._transport.list_log_entries]
# Send the request.
- response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,)
+ response = rpc(
+ request,
+ retry=retry,
+ timeout=timeout,
+ metadata=metadata,
+ )
# This method is paged; wrap the response in a pager, which provides
# an `__iter__` convenience method.
response = pagers.ListLogEntriesPager(
- method=rpc, request=request, response=response, metadata=metadata,
+ method=rpc,
+ request=request,
+ response=response,
+ metadata=metadata,
)
# Done; return the response.
@@ -768,6 +875,25 @@ def list_monitored_resource_descriptors(
r"""Lists the descriptors for monitored resource types
used by Logging.
+ .. code-block:: python
+
+ from google.cloud import logging_v2
+
+ def sample_list_monitored_resource_descriptors():
+ # Create a client
+ client = logging_v2.LoggingServiceV2Client()
+
+ # Initialize request argument(s)
+ request = logging_v2.ListMonitoredResourceDescriptorsRequest(
+ )
+
+ # Make the request
+ page_result = client.list_monitored_resource_descriptors(request=request)
+
+ # Handle the response
+ for response in page_result:
+ print(response)
+
Args:
request (Union[google.cloud.logging_v2.types.ListMonitoredResourceDescriptorsRequest, dict]):
The request object. The parameters to
@@ -802,12 +928,20 @@ def list_monitored_resource_descriptors(
]
# Send the request.
- response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,)
+ response = rpc(
+ request,
+ retry=retry,
+ timeout=timeout,
+ metadata=metadata,
+ )
# This method is paged; wrap the response in a pager, which provides
# an `__iter__` convenience method.
response = pagers.ListMonitoredResourceDescriptorsPager(
- method=rpc, request=request, response=response, metadata=metadata,
+ method=rpc,
+ request=request,
+ response=response,
+ metadata=metadata,
)
# Done; return the response.
@@ -826,18 +960,36 @@ def list_logs(
or billing accounts. Only logs that have entries are
listed.
+ .. code-block:: python
+
+ from google.cloud import logging_v2
+
+ def sample_list_logs():
+ # Create a client
+ client = logging_v2.LoggingServiceV2Client()
+
+ # Initialize request argument(s)
+ request = logging_v2.ListLogsRequest(
+ parent="parent_value",
+ )
+
+ # Make the request
+ page_result = client.list_logs(request=request)
+
+ # Handle the response
+ for response in page_result:
+ print(response)
+
Args:
request (Union[google.cloud.logging_v2.types.ListLogsRequest, dict]):
The request object. The parameters to ListLogs.
parent (str):
Required. The resource name that owns the logs:
- ::
-
- "projects/[PROJECT_ID]"
- "organizations/[ORGANIZATION_ID]"
- "billingAccounts/[BILLING_ACCOUNT_ID]"
- "folders/[FOLDER_ID]"
+ - ``projects/[PROJECT_ID]``
+ - ``organizations/[ORGANIZATION_ID]``
+ - ``billingAccounts/[BILLING_ACCOUNT_ID]``
+ - ``folders/[FOLDER_ID]``
This corresponds to the ``parent`` field
on the ``request`` instance; if ``request`` is provided, this
@@ -857,7 +1009,7 @@ def list_logs(
"""
# Create or coerce a protobuf request object.
- # Sanity check: If we got a request object, we should *not* have
+ # Quick check: If we got a request object, we should *not* have
# gotten any keyword arguments that map to the request.
has_flattened_params = any([parent])
if request is not None and has_flattened_params:
@@ -888,12 +1040,20 @@ def list_logs(
)
# Send the request.
- response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,)
+ response = rpc(
+ request,
+ retry=retry,
+ timeout=timeout,
+ metadata=metadata,
+ )
# This method is paged; wrap the response in a pager, which provides
# an `__iter__` convenience method.
response = pagers.ListLogsPager(
- method=rpc, request=request, response=response, metadata=metadata,
+ method=rpc,
+ request=request,
+ response=response,
+ metadata=metadata,
)
# Done; return the response.
@@ -911,6 +1071,36 @@ def tail_log_entries(
Until the stream is terminated, it will continue reading
logs.
+ .. code-block:: python
+
+ from google.cloud import logging_v2
+
+ def sample_tail_log_entries():
+ # Create a client
+ client = logging_v2.LoggingServiceV2Client()
+
+ # Initialize request argument(s)
+ request = logging_v2.TailLogEntriesRequest(
+ resource_names=['resource_names_value_1', 'resource_names_value_2'],
+ )
+
+ # This method expects an iterator which contains
+ # 'logging_v2.TailLogEntriesRequest' objects
+ # Here we create a generator that yields a single `request` for
+ # demonstrative purposes.
+ requests = [request]
+
+ def request_generator():
+ for request in requests:
+ yield request
+
+ # Make the request
+ stream = client.tail_log_entries(requests=request_generator())
+
+ # Handle the response
+ for response in stream:
+ print(response)
+
Args:
requests (Iterator[google.cloud.logging_v2.types.TailLogEntriesRequest]):
The request object iterator. The parameters to `TailLogEntries`.
@@ -930,7 +1120,12 @@ def tail_log_entries(
rpc = self._transport._wrapped_methods[self._transport.tail_log_entries]
# Send the request.
- response = rpc(requests, retry=retry, timeout=timeout, metadata=metadata,)
+ response = rpc(
+ requests,
+ retry=retry,
+ timeout=timeout,
+ metadata=metadata,
+ )
# Done; return the response.
return response
@@ -951,7 +1146,9 @@ def __exit__(self, type, value, traceback):
try:
DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo(
- gapic_version=pkg_resources.get_distribution("google-cloud-logging",).version,
+ gapic_version=pkg_resources.get_distribution(
+ "google-cloud-logging",
+ ).version,
)
except pkg_resources.DistributionNotFound:
DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo()
diff --git a/google/cloud/logging_v2/services/logging_service_v2/pagers.py b/google/cloud/logging_v2/services/logging_service_v2/pagers.py
index ca4d01fac..e1e7188cd 100644
--- a/google/cloud/logging_v2/services/logging_service_v2/pagers.py
+++ b/google/cloud/logging_v2/services/logging_service_v2/pagers.py
@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
-# Copyright 2020 Google LLC
+# Copyright 2022 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
diff --git a/google/cloud/logging_v2/services/logging_service_v2/transports/__init__.py b/google/cloud/logging_v2/services/logging_service_v2/transports/__init__.py
index 65e713121..4e0163fe6 100644
--- a/google/cloud/logging_v2/services/logging_service_v2/transports/__init__.py
+++ b/google/cloud/logging_v2/services/logging_service_v2/transports/__init__.py
@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
-# Copyright 2020 Google LLC
+# Copyright 2022 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
diff --git a/google/cloud/logging_v2/services/logging_service_v2/transports/base.py b/google/cloud/logging_v2/services/logging_service_v2/transports/base.py
index 6fe2e9e8a..ceefeda8a 100644
--- a/google/cloud/logging_v2/services/logging_service_v2/transports/base.py
+++ b/google/cloud/logging_v2/services/logging_service_v2/transports/base.py
@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
-# Copyright 2020 Google LLC
+# Copyright 2022 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -30,7 +30,9 @@
try:
DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo(
- gapic_version=pkg_resources.get_distribution("google-cloud-logging",).version,
+ gapic_version=pkg_resources.get_distribution(
+ "google-cloud-logging",
+ ).version,
)
except pkg_resources.DistributionNotFound:
DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo()
@@ -85,6 +87,7 @@ def __init__(
always_use_jwt_access (Optional[bool]): Whether self signed JWT should
be used for service account credentials.
"""
+
# Save the hostname. Default to port 443 (HTTPS) if none is specified.
if ":" not in host:
host += ":443"
@@ -226,9 +229,9 @@ def _prep_wrapped_messages(self, client_info):
def close(self):
"""Closes resources associated with the transport.
- .. warning::
- Only call this method if the transport is NOT shared
- with other clients - this may cause errors in other clients!
+ .. warning::
+ Only call this method if the transport is NOT shared
+ with other clients - this may cause errors in other clients!
"""
raise NotImplementedError()
@@ -294,5 +297,9 @@ def tail_log_entries(
]:
raise NotImplementedError()
+ @property
+ def kind(self) -> str:
+ raise NotImplementedError()
+
__all__ = ("LoggingServiceV2Transport",)
diff --git a/google/cloud/logging_v2/services/logging_service_v2/transports/grpc.py b/google/cloud/logging_v2/services/logging_service_v2/transports/grpc.py
index 0379cbecf..22affa06b 100644
--- a/google/cloud/logging_v2/services/logging_service_v2/transports/grpc.py
+++ b/google/cloud/logging_v2/services/logging_service_v2/transports/grpc.py
@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
-# Copyright 2020 Google LLC
+# Copyright 2022 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -159,8 +159,11 @@ def __init__(
if not self._grpc_channel:
self._grpc_channel = type(self).create_channel(
self._host,
+ # use the credentials which are saved
credentials=self._credentials,
- credentials_file=credentials_file,
+ # Set ``credentials_file`` to ``None`` here as
+ # the credentials that we saved earlier should be used.
+ credentials_file=None,
scopes=self._scopes,
ssl_credentials=self._ssl_channel_credentials,
quota_project_id=quota_project_id,
@@ -222,19 +225,18 @@ def create_channel(
@property
def grpc_channel(self) -> grpc.Channel:
- """Return the channel designed to connect to this service.
- """
+ """Return the channel designed to connect to this service."""
return self._grpc_channel
@property
def delete_log(self) -> Callable[[logging.DeleteLogRequest], empty_pb2.Empty]:
r"""Return a callable for the delete log method over gRPC.
- Deletes all the log entries in a log. The log
- reappears if it receives new entries. Log entries
- written shortly before the delete operation might not be
- deleted. Entries received after the delete operation
- with a timestamp before the operation will be deleted.
+ Deletes all the log entries in a log for the \_Default Log
+ Bucket. The log reappears if it receives new entries. Log
+ entries written shortly before the delete operation might not be
+ deleted. Entries received after the delete operation with a
+ timestamp before the operation will be deleted.
Returns:
Callable[[~.DeleteLogRequest],
@@ -407,5 +409,9 @@ def tail_log_entries(
def close(self):
self.grpc_channel.close()
+ @property
+ def kind(self) -> str:
+ return "grpc"
+
__all__ = ("LoggingServiceV2GrpcTransport",)
diff --git a/google/cloud/logging_v2/services/logging_service_v2/transports/grpc_asyncio.py b/google/cloud/logging_v2/services/logging_service_v2/transports/grpc_asyncio.py
index 16602c2b4..1ef7198fd 100644
--- a/google/cloud/logging_v2/services/logging_service_v2/transports/grpc_asyncio.py
+++ b/google/cloud/logging_v2/services/logging_service_v2/transports/grpc_asyncio.py
@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
-# Copyright 2020 Google LLC
+# Copyright 2022 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -204,8 +204,11 @@ def __init__(
if not self._grpc_channel:
self._grpc_channel = type(self).create_channel(
self._host,
+ # use the credentials which are saved
credentials=self._credentials,
- credentials_file=credentials_file,
+ # Set ``credentials_file`` to ``None`` here as
+ # the credentials that we saved earlier should be used.
+ credentials_file=None,
scopes=self._scopes,
ssl_credentials=self._ssl_channel_credentials,
quota_project_id=quota_project_id,
@@ -234,11 +237,11 @@ def delete_log(
) -> Callable[[logging.DeleteLogRequest], Awaitable[empty_pb2.Empty]]:
r"""Return a callable for the delete log method over gRPC.
- Deletes all the log entries in a log. The log
- reappears if it receives new entries. Log entries
- written shortly before the delete operation might not be
- deleted. Entries received after the delete operation
- with a timestamp before the operation will be deleted.
+ Deletes all the log entries in a log for the \_Default Log
+ Bucket. The log reappears if it receives new entries. Log
+ entries written shortly before the delete operation might not be
+ deleted. Entries received after the delete operation with a
+ timestamp before the operation will be deleted.
Returns:
Callable[[~.DeleteLogRequest],
diff --git a/google/cloud/logging_v2/services/metrics_service_v2/__init__.py b/google/cloud/logging_v2/services/metrics_service_v2/__init__.py
index f37e39314..fc0615f19 100644
--- a/google/cloud/logging_v2/services/metrics_service_v2/__init__.py
+++ b/google/cloud/logging_v2/services/metrics_service_v2/__init__.py
@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
-# Copyright 2020 Google LLC
+# Copyright 2022 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
diff --git a/google/cloud/logging_v2/services/metrics_service_v2/async_client.py b/google/cloud/logging_v2/services/metrics_service_v2/async_client.py
index eb7321ab7..816b70695 100644
--- a/google/cloud/logging_v2/services/metrics_service_v2/async_client.py
+++ b/google/cloud/logging_v2/services/metrics_service_v2/async_client.py
@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
-# Copyright 2020 Google LLC
+# Copyright 2022 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -16,7 +16,7 @@
from collections import OrderedDict
import functools
import re
-from typing import Dict, Optional, Sequence, Tuple, Type, Union
+from typing import Dict, Mapping, Optional, Sequence, Tuple, Type, Union
import pkg_resources
from google.api_core.client_options import ClientOptions
@@ -216,6 +216,26 @@ async def list_log_metrics(
) -> pagers.ListLogMetricsAsyncPager:
r"""Lists logs-based metrics.
+ .. code-block:: python
+
+ from google.cloud import logging_v2
+
+ async def sample_list_log_metrics():
+ # Create a client
+ client = logging_v2.MetricsServiceV2AsyncClient()
+
+ # Initialize request argument(s)
+ request = logging_v2.ListLogMetricsRequest(
+ parent="parent_value",
+ )
+
+ # Make the request
+ page_result = client.list_log_metrics(request=request)
+
+ # Handle the response
+ async for response in page_result:
+ print(response)
+
Args:
request (Union[google.cloud.logging_v2.types.ListLogMetricsRequest, dict]):
The request object. The parameters to ListLogMetrics.
@@ -245,7 +265,7 @@ async def list_log_metrics(
"""
# Create or coerce a protobuf request object.
- # Sanity check: If we got a request object, we should *not* have
+ # Quick check: If we got a request object, we should *not* have
# gotten any keyword arguments that map to the request.
has_flattened_params = any([parent])
if request is not None and has_flattened_params:
@@ -287,12 +307,20 @@ async def list_log_metrics(
)
# Send the request.
- response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,)
+ response = await rpc(
+ request,
+ retry=retry,
+ timeout=timeout,
+ metadata=metadata,
+ )
# This method is paged; wrap the response in a pager, which provides
# an `__aiter__` convenience method.
response = pagers.ListLogMetricsAsyncPager(
- method=rpc, request=request, response=response, metadata=metadata,
+ method=rpc,
+ request=request,
+ response=response,
+ metadata=metadata,
)
# Done; return the response.
@@ -309,6 +337,25 @@ async def get_log_metric(
) -> logging_metrics.LogMetric:
r"""Gets a logs-based metric.
+ .. code-block:: python
+
+ from google.cloud import logging_v2
+
+ async def sample_get_log_metric():
+ # Create a client
+ client = logging_v2.MetricsServiceV2AsyncClient()
+
+ # Initialize request argument(s)
+ request = logging_v2.GetLogMetricRequest(
+ metric_name="metric_name_value",
+ )
+
+ # Make the request
+ response = await client.get_log_metric(request=request)
+
+ # Handle the response
+ print(response)
+
Args:
request (Union[google.cloud.logging_v2.types.GetLogMetricRequest, dict]):
The request object. The parameters to GetLogMetric.
@@ -344,7 +391,7 @@ async def get_log_metric(
"""
# Create or coerce a protobuf request object.
- # Sanity check: If we got a request object, we should *not* have
+ # Quick check: If we got a request object, we should *not* have
# gotten any keyword arguments that map to the request.
has_flattened_params = any([metric_name])
if request is not None and has_flattened_params:
@@ -388,7 +435,12 @@ async def get_log_metric(
)
# Send the request.
- response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,)
+ response = await rpc(
+ request,
+ retry=retry,
+ timeout=timeout,
+ metadata=metadata,
+ )
# Done; return the response.
return response
@@ -405,6 +457,30 @@ async def create_log_metric(
) -> logging_metrics.LogMetric:
r"""Creates a logs-based metric.
+ .. code-block:: python
+
+ from google.cloud import logging_v2
+
+ async def sample_create_log_metric():
+ # Create a client
+ client = logging_v2.MetricsServiceV2AsyncClient()
+
+ # Initialize request argument(s)
+ metric = logging_v2.LogMetric()
+ metric.name = "name_value"
+ metric.filter = "filter_value"
+
+ request = logging_v2.CreateLogMetricRequest(
+ parent="parent_value",
+ metric=metric,
+ )
+
+ # Make the request
+ response = await client.create_log_metric(request=request)
+
+ # Handle the response
+ print(response)
+
Args:
request (Union[google.cloud.logging_v2.types.CreateLogMetricRequest, dict]):
The request object. The parameters to CreateLogMetric.
@@ -451,7 +527,7 @@ async def create_log_metric(
"""
# Create or coerce a protobuf request object.
- # Sanity check: If we got a request object, we should *not* have
+ # Quick check: If we got a request object, we should *not* have
# gotten any keyword arguments that map to the request.
has_flattened_params = any([parent, metric])
if request is not None and has_flattened_params:
@@ -484,7 +560,12 @@ async def create_log_metric(
)
# Send the request.
- response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,)
+ response = await rpc(
+ request,
+ retry=retry,
+ timeout=timeout,
+ metadata=metadata,
+ )
# Done; return the response.
return response
@@ -501,6 +582,30 @@ async def update_log_metric(
) -> logging_metrics.LogMetric:
r"""Creates or updates a logs-based metric.
+ .. code-block:: python
+
+ from google.cloud import logging_v2
+
+ async def sample_update_log_metric():
+ # Create a client
+ client = logging_v2.MetricsServiceV2AsyncClient()
+
+ # Initialize request argument(s)
+ metric = logging_v2.LogMetric()
+ metric.name = "name_value"
+ metric.filter = "filter_value"
+
+ request = logging_v2.UpdateLogMetricRequest(
+ metric_name="metric_name_value",
+ metric=metric,
+ )
+
+ # Make the request
+ response = await client.update_log_metric(request=request)
+
+ # Handle the response
+ print(response)
+
Args:
request (Union[google.cloud.logging_v2.types.UpdateLogMetricRequest, dict]):
The request object. The parameters to UpdateLogMetric.
@@ -546,7 +651,7 @@ async def update_log_metric(
"""
# Create or coerce a protobuf request object.
- # Sanity check: If we got a request object, we should *not* have
+ # Quick check: If we got a request object, we should *not* have
# gotten any keyword arguments that map to the request.
has_flattened_params = any([metric_name, metric])
if request is not None and has_flattened_params:
@@ -592,7 +697,12 @@ async def update_log_metric(
)
# Send the request.
- response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,)
+ response = await rpc(
+ request,
+ retry=retry,
+ timeout=timeout,
+ metadata=metadata,
+ )
# Done; return the response.
return response
@@ -608,6 +718,22 @@ async def delete_log_metric(
) -> None:
r"""Deletes a logs-based metric.
+ .. code-block:: python
+
+ from google.cloud import logging_v2
+
+ async def sample_delete_log_metric():
+ # Create a client
+ client = logging_v2.MetricsServiceV2AsyncClient()
+
+ # Initialize request argument(s)
+ request = logging_v2.DeleteLogMetricRequest(
+ metric_name="metric_name_value",
+ )
+
+ # Make the request
+ await client.delete_log_metric(request=request)
+
Args:
request (Union[google.cloud.logging_v2.types.DeleteLogMetricRequest, dict]):
The request object. The parameters to DeleteLogMetric.
@@ -628,7 +754,7 @@ async def delete_log_metric(
sent along with the request as metadata.
"""
# Create or coerce a protobuf request object.
- # Sanity check: If we got a request object, we should *not* have
+ # Quick check: If we got a request object, we should *not* have
# gotten any keyword arguments that map to the request.
has_flattened_params = any([metric_name])
if request is not None and has_flattened_params:
@@ -673,7 +799,10 @@ async def delete_log_metric(
# Send the request.
await rpc(
- request, retry=retry, timeout=timeout, metadata=metadata,
+ request,
+ retry=retry,
+ timeout=timeout,
+ metadata=metadata,
)
async def __aenter__(self):
@@ -685,7 +814,9 @@ async def __aexit__(self, exc_type, exc, tb):
try:
DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo(
- gapic_version=pkg_resources.get_distribution("google-cloud-logging",).version,
+ gapic_version=pkg_resources.get_distribution(
+ "google-cloud-logging",
+ ).version,
)
except pkg_resources.DistributionNotFound:
DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo()
diff --git a/google/cloud/logging_v2/services/metrics_service_v2/client.py b/google/cloud/logging_v2/services/metrics_service_v2/client.py
index ced653a51..df5d4d2fc 100644
--- a/google/cloud/logging_v2/services/metrics_service_v2/client.py
+++ b/google/cloud/logging_v2/services/metrics_service_v2/client.py
@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
-# Copyright 2020 Google LLC
+# Copyright 2022 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -16,7 +16,7 @@
from collections import OrderedDict
import os
import re
-from typing import Dict, Optional, Sequence, Tuple, Type, Union
+from typing import Dict, Mapping, Optional, Sequence, Tuple, Type, Union
import pkg_resources
from google.api_core import client_options as client_options_lib
@@ -58,7 +58,10 @@ class MetricsServiceV2ClientMeta(type):
_transport_registry["grpc"] = MetricsServiceV2GrpcTransport
_transport_registry["grpc_asyncio"] = MetricsServiceV2GrpcAsyncIOTransport
- def get_transport_class(cls, label: str = None,) -> Type[MetricsServiceV2Transport]:
+ def get_transport_class(
+ cls,
+ label: str = None,
+ ) -> Type[MetricsServiceV2Transport]:
"""Returns an appropriate transport class.
Args:
@@ -163,10 +166,14 @@ def transport(self) -> MetricsServiceV2Transport:
return self._transport
@staticmethod
- def log_metric_path(project: str, metric: str,) -> str:
+ def log_metric_path(
+ project: str,
+ metric: str,
+ ) -> str:
"""Returns a fully-qualified log_metric string."""
return "projects/{project}/metrics/{metric}".format(
- project=project, metric=metric,
+ project=project,
+ metric=metric,
)
@staticmethod
@@ -176,7 +183,9 @@ def parse_log_metric_path(path: str) -> Dict[str, str]:
return m.groupdict() if m else {}
@staticmethod
- def common_billing_account_path(billing_account: str,) -> str:
+ def common_billing_account_path(
+ billing_account: str,
+ ) -> str:
"""Returns a fully-qualified billing_account string."""
return "billingAccounts/{billing_account}".format(
billing_account=billing_account,
@@ -189,9 +198,13 @@ def parse_common_billing_account_path(path: str) -> Dict[str, str]:
return m.groupdict() if m else {}
@staticmethod
- def common_folder_path(folder: str,) -> str:
+ def common_folder_path(
+ folder: str,
+ ) -> str:
"""Returns a fully-qualified folder string."""
- return "folders/{folder}".format(folder=folder,)
+ return "folders/{folder}".format(
+ folder=folder,
+ )
@staticmethod
def parse_common_folder_path(path: str) -> Dict[str, str]:
@@ -200,9 +213,13 @@ def parse_common_folder_path(path: str) -> Dict[str, str]:
return m.groupdict() if m else {}
@staticmethod
- def common_organization_path(organization: str,) -> str:
+ def common_organization_path(
+ organization: str,
+ ) -> str:
"""Returns a fully-qualified organization string."""
- return "organizations/{organization}".format(organization=organization,)
+ return "organizations/{organization}".format(
+ organization=organization,
+ )
@staticmethod
def parse_common_organization_path(path: str) -> Dict[str, str]:
@@ -211,9 +228,13 @@ def parse_common_organization_path(path: str) -> Dict[str, str]:
return m.groupdict() if m else {}
@staticmethod
- def common_project_path(project: str,) -> str:
+ def common_project_path(
+ project: str,
+ ) -> str:
"""Returns a fully-qualified project string."""
- return "projects/{project}".format(project=project,)
+ return "projects/{project}".format(
+ project=project,
+ )
@staticmethod
def parse_common_project_path(path: str) -> Dict[str, str]:
@@ -222,10 +243,14 @@ def parse_common_project_path(path: str) -> Dict[str, str]:
return m.groupdict() if m else {}
@staticmethod
- def common_location_path(project: str, location: str,) -> str:
+ def common_location_path(
+ project: str,
+ location: str,
+ ) -> str:
"""Returns a fully-qualified location string."""
return "projects/{project}/locations/{location}".format(
- project=project, location=location,
+ project=project,
+ location=location,
)
@staticmethod
@@ -410,6 +435,26 @@ def list_log_metrics(
) -> pagers.ListLogMetricsPager:
r"""Lists logs-based metrics.
+ .. code-block:: python
+
+ from google.cloud import logging_v2
+
+ def sample_list_log_metrics():
+ # Create a client
+ client = logging_v2.MetricsServiceV2Client()
+
+ # Initialize request argument(s)
+ request = logging_v2.ListLogMetricsRequest(
+ parent="parent_value",
+ )
+
+ # Make the request
+ page_result = client.list_log_metrics(request=request)
+
+ # Handle the response
+ for response in page_result:
+ print(response)
+
Args:
request (Union[google.cloud.logging_v2.types.ListLogMetricsRequest, dict]):
The request object. The parameters to ListLogMetrics.
@@ -439,7 +484,7 @@ def list_log_metrics(
"""
# Create or coerce a protobuf request object.
- # Sanity check: If we got a request object, we should *not* have
+ # Quick check: If we got a request object, we should *not* have
# gotten any keyword arguments that map to the request.
has_flattened_params = any([parent])
if request is not None and has_flattened_params:
@@ -470,12 +515,20 @@ def list_log_metrics(
)
# Send the request.
- response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,)
+ response = rpc(
+ request,
+ retry=retry,
+ timeout=timeout,
+ metadata=metadata,
+ )
# This method is paged; wrap the response in a pager, which provides
# an `__iter__` convenience method.
response = pagers.ListLogMetricsPager(
- method=rpc, request=request, response=response, metadata=metadata,
+ method=rpc,
+ request=request,
+ response=response,
+ metadata=metadata,
)
# Done; return the response.
@@ -492,6 +545,25 @@ def get_log_metric(
) -> logging_metrics.LogMetric:
r"""Gets a logs-based metric.
+ .. code-block:: python
+
+ from google.cloud import logging_v2
+
+ def sample_get_log_metric():
+ # Create a client
+ client = logging_v2.MetricsServiceV2Client()
+
+ # Initialize request argument(s)
+ request = logging_v2.GetLogMetricRequest(
+ metric_name="metric_name_value",
+ )
+
+ # Make the request
+ response = client.get_log_metric(request=request)
+
+ # Handle the response
+ print(response)
+
Args:
request (Union[google.cloud.logging_v2.types.GetLogMetricRequest, dict]):
The request object. The parameters to GetLogMetric.
@@ -527,7 +599,7 @@ def get_log_metric(
"""
# Create or coerce a protobuf request object.
- # Sanity check: If we got a request object, we should *not* have
+ # Quick check: If we got a request object, we should *not* have
# gotten any keyword arguments that map to the request.
has_flattened_params = any([metric_name])
if request is not None and has_flattened_params:
@@ -560,7 +632,12 @@ def get_log_metric(
)
# Send the request.
- response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,)
+ response = rpc(
+ request,
+ retry=retry,
+ timeout=timeout,
+ metadata=metadata,
+ )
# Done; return the response.
return response
@@ -577,6 +654,30 @@ def create_log_metric(
) -> logging_metrics.LogMetric:
r"""Creates a logs-based metric.
+ .. code-block:: python
+
+ from google.cloud import logging_v2
+
+ def sample_create_log_metric():
+ # Create a client
+ client = logging_v2.MetricsServiceV2Client()
+
+ # Initialize request argument(s)
+ metric = logging_v2.LogMetric()
+ metric.name = "name_value"
+ metric.filter = "filter_value"
+
+ request = logging_v2.CreateLogMetricRequest(
+ parent="parent_value",
+ metric=metric,
+ )
+
+ # Make the request
+ response = client.create_log_metric(request=request)
+
+ # Handle the response
+ print(response)
+
Args:
request (Union[google.cloud.logging_v2.types.CreateLogMetricRequest, dict]):
The request object. The parameters to CreateLogMetric.
@@ -623,7 +724,7 @@ def create_log_metric(
"""
# Create or coerce a protobuf request object.
- # Sanity check: If we got a request object, we should *not* have
+ # Quick check: If we got a request object, we should *not* have
# gotten any keyword arguments that map to the request.
has_flattened_params = any([parent, metric])
if request is not None and has_flattened_params:
@@ -656,7 +757,12 @@ def create_log_metric(
)
# Send the request.
- response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,)
+ response = rpc(
+ request,
+ retry=retry,
+ timeout=timeout,
+ metadata=metadata,
+ )
# Done; return the response.
return response
@@ -673,6 +779,30 @@ def update_log_metric(
) -> logging_metrics.LogMetric:
r"""Creates or updates a logs-based metric.
+ .. code-block:: python
+
+ from google.cloud import logging_v2
+
+ def sample_update_log_metric():
+ # Create a client
+ client = logging_v2.MetricsServiceV2Client()
+
+ # Initialize request argument(s)
+ metric = logging_v2.LogMetric()
+ metric.name = "name_value"
+ metric.filter = "filter_value"
+
+ request = logging_v2.UpdateLogMetricRequest(
+ metric_name="metric_name_value",
+ metric=metric,
+ )
+
+ # Make the request
+ response = client.update_log_metric(request=request)
+
+ # Handle the response
+ print(response)
+
Args:
request (Union[google.cloud.logging_v2.types.UpdateLogMetricRequest, dict]):
The request object. The parameters to UpdateLogMetric.
@@ -718,7 +848,7 @@ def update_log_metric(
"""
# Create or coerce a protobuf request object.
- # Sanity check: If we got a request object, we should *not* have
+ # Quick check: If we got a request object, we should *not* have
# gotten any keyword arguments that map to the request.
has_flattened_params = any([metric_name, metric])
if request is not None and has_flattened_params:
@@ -753,7 +883,12 @@ def update_log_metric(
)
# Send the request.
- response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,)
+ response = rpc(
+ request,
+ retry=retry,
+ timeout=timeout,
+ metadata=metadata,
+ )
# Done; return the response.
return response
@@ -769,6 +904,22 @@ def delete_log_metric(
) -> None:
r"""Deletes a logs-based metric.
+ .. code-block:: python
+
+ from google.cloud import logging_v2
+
+ def sample_delete_log_metric():
+ # Create a client
+ client = logging_v2.MetricsServiceV2Client()
+
+ # Initialize request argument(s)
+ request = logging_v2.DeleteLogMetricRequest(
+ metric_name="metric_name_value",
+ )
+
+ # Make the request
+ client.delete_log_metric(request=request)
+
Args:
request (Union[google.cloud.logging_v2.types.DeleteLogMetricRequest, dict]):
The request object. The parameters to DeleteLogMetric.
@@ -789,7 +940,7 @@ def delete_log_metric(
sent along with the request as metadata.
"""
# Create or coerce a protobuf request object.
- # Sanity check: If we got a request object, we should *not* have
+ # Quick check: If we got a request object, we should *not* have
# gotten any keyword arguments that map to the request.
has_flattened_params = any([metric_name])
if request is not None and has_flattened_params:
@@ -823,7 +974,10 @@ def delete_log_metric(
# Send the request.
rpc(
- request, retry=retry, timeout=timeout, metadata=metadata,
+ request,
+ retry=retry,
+ timeout=timeout,
+ metadata=metadata,
)
def __enter__(self):
@@ -842,7 +996,9 @@ def __exit__(self, type, value, traceback):
try:
DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo(
- gapic_version=pkg_resources.get_distribution("google-cloud-logging",).version,
+ gapic_version=pkg_resources.get_distribution(
+ "google-cloud-logging",
+ ).version,
)
except pkg_resources.DistributionNotFound:
DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo()
diff --git a/google/cloud/logging_v2/services/metrics_service_v2/pagers.py b/google/cloud/logging_v2/services/metrics_service_v2/pagers.py
index 7026e3858..2c647cda1 100644
--- a/google/cloud/logging_v2/services/metrics_service_v2/pagers.py
+++ b/google/cloud/logging_v2/services/metrics_service_v2/pagers.py
@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
-# Copyright 2020 Google LLC
+# Copyright 2022 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
diff --git a/google/cloud/logging_v2/services/metrics_service_v2/transports/__init__.py b/google/cloud/logging_v2/services/metrics_service_v2/transports/__init__.py
index 10ccb830c..e28f020df 100644
--- a/google/cloud/logging_v2/services/metrics_service_v2/transports/__init__.py
+++ b/google/cloud/logging_v2/services/metrics_service_v2/transports/__init__.py
@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
-# Copyright 2020 Google LLC
+# Copyright 2022 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
diff --git a/google/cloud/logging_v2/services/metrics_service_v2/transports/base.py b/google/cloud/logging_v2/services/metrics_service_v2/transports/base.py
index fef40f239..eae5f5da7 100644
--- a/google/cloud/logging_v2/services/metrics_service_v2/transports/base.py
+++ b/google/cloud/logging_v2/services/metrics_service_v2/transports/base.py
@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
-# Copyright 2020 Google LLC
+# Copyright 2022 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -30,7 +30,9 @@
try:
DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo(
- gapic_version=pkg_resources.get_distribution("google-cloud-logging",).version,
+ gapic_version=pkg_resources.get_distribution(
+ "google-cloud-logging",
+ ).version,
)
except pkg_resources.DistributionNotFound:
DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo()
@@ -85,6 +87,7 @@ def __init__(
always_use_jwt_access (Optional[bool]): Whether self signed JWT should
be used for service account credentials.
"""
+
# Save the hostname. Default to port 443 (HTTPS) if none is specified.
if ":" not in host:
host += ":443"
@@ -158,7 +161,9 @@ def _prep_wrapped_messages(self, client_info):
client_info=client_info,
),
self.create_log_metric: gapic_v1.method.wrap_method(
- self.create_log_metric, default_timeout=60.0, client_info=client_info,
+ self.create_log_metric,
+ default_timeout=60.0,
+ client_info=client_info,
),
self.update_log_metric: gapic_v1.method.wrap_method(
self.update_log_metric,
@@ -197,9 +202,9 @@ def _prep_wrapped_messages(self, client_info):
def close(self):
"""Closes resources associated with the transport.
- .. warning::
- Only call this method if the transport is NOT shared
- with other clients - this may cause errors in other clients!
+ .. warning::
+ Only call this method if the transport is NOT shared
+ with other clients - this may cause errors in other clients!
"""
raise NotImplementedError()
@@ -251,5 +256,9 @@ def delete_log_metric(
]:
raise NotImplementedError()
+ @property
+ def kind(self) -> str:
+ raise NotImplementedError()
+
__all__ = ("MetricsServiceV2Transport",)
diff --git a/google/cloud/logging_v2/services/metrics_service_v2/transports/grpc.py b/google/cloud/logging_v2/services/metrics_service_v2/transports/grpc.py
index 194d341f3..12d70452f 100644
--- a/google/cloud/logging_v2/services/metrics_service_v2/transports/grpc.py
+++ b/google/cloud/logging_v2/services/metrics_service_v2/transports/grpc.py
@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
-# Copyright 2020 Google LLC
+# Copyright 2022 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -159,8 +159,11 @@ def __init__(
if not self._grpc_channel:
self._grpc_channel = type(self).create_channel(
self._host,
+ # use the credentials which are saved
credentials=self._credentials,
- credentials_file=credentials_file,
+ # Set ``credentials_file`` to ``None`` here as
+ # the credentials that we saved earlier should be used.
+ credentials_file=None,
scopes=self._scopes,
ssl_credentials=self._ssl_channel_credentials,
quota_project_id=quota_project_id,
@@ -222,8 +225,7 @@ def create_channel(
@property
def grpc_channel(self) -> grpc.Channel:
- """Return the channel designed to connect to this service.
- """
+ """Return the channel designed to connect to this service."""
return self._grpc_channel
@property
@@ -361,5 +363,9 @@ def delete_log_metric(
def close(self):
self.grpc_channel.close()
+ @property
+ def kind(self) -> str:
+ return "grpc"
+
__all__ = ("MetricsServiceV2GrpcTransport",)
diff --git a/google/cloud/logging_v2/services/metrics_service_v2/transports/grpc_asyncio.py b/google/cloud/logging_v2/services/metrics_service_v2/transports/grpc_asyncio.py
index 37cec4a63..28ff48f5c 100644
--- a/google/cloud/logging_v2/services/metrics_service_v2/transports/grpc_asyncio.py
+++ b/google/cloud/logging_v2/services/metrics_service_v2/transports/grpc_asyncio.py
@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
-# Copyright 2020 Google LLC
+# Copyright 2022 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -204,8 +204,11 @@ def __init__(
if not self._grpc_channel:
self._grpc_channel = type(self).create_channel(
self._host,
+ # use the credentials which are saved
credentials=self._credentials,
- credentials_file=credentials_file,
+ # Set ``credentials_file`` to ``None`` here as
+ # the credentials that we saved earlier should be used.
+ credentials_file=None,
scopes=self._scopes,
ssl_credentials=self._ssl_channel_credentials,
quota_project_id=quota_project_id,
diff --git a/google/cloud/logging_v2/types/__init__.py b/google/cloud/logging_v2/types/__init__.py
index 7d1cdd99e..43b5674dd 100644
--- a/google/cloud/logging_v2/types/__init__.py
+++ b/google/cloud/logging_v2/types/__init__.py
@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
-# Copyright 2020 Google LLC
+# Copyright 2022 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -17,6 +17,7 @@
LogEntry,
LogEntryOperation,
LogEntrySourceLocation,
+ LogSplit,
)
from .logging import (
DeleteLogRequest,
@@ -35,6 +36,9 @@
from .logging_config import (
BigQueryOptions,
CmekSettings,
+ CopyLogEntriesMetadata,
+ CopyLogEntriesRequest,
+ CopyLogEntriesResponse,
CreateBucketRequest,
CreateExclusionRequest,
CreateSinkRequest,
@@ -46,6 +50,7 @@
GetBucketRequest,
GetCmekSettingsRequest,
GetExclusionRequest,
+ GetSettingsRequest,
GetSinkRequest,
GetViewRequest,
ListBucketsRequest,
@@ -60,13 +65,16 @@
LogExclusion,
LogSink,
LogView,
+ Settings,
UndeleteBucketRequest,
UpdateBucketRequest,
UpdateCmekSettingsRequest,
UpdateExclusionRequest,
+ UpdateSettingsRequest,
UpdateSinkRequest,
UpdateViewRequest,
LifecycleState,
+ OperationState,
)
from .logging_metrics import (
CreateLogMetricRequest,
@@ -82,6 +90,7 @@
"LogEntry",
"LogEntryOperation",
"LogEntrySourceLocation",
+ "LogSplit",
"DeleteLogRequest",
"ListLogEntriesRequest",
"ListLogEntriesResponse",
@@ -96,6 +105,9 @@
"WriteLogEntriesResponse",
"BigQueryOptions",
"CmekSettings",
+ "CopyLogEntriesMetadata",
+ "CopyLogEntriesRequest",
+ "CopyLogEntriesResponse",
"CreateBucketRequest",
"CreateExclusionRequest",
"CreateSinkRequest",
@@ -107,6 +119,7 @@
"GetBucketRequest",
"GetCmekSettingsRequest",
"GetExclusionRequest",
+ "GetSettingsRequest",
"GetSinkRequest",
"GetViewRequest",
"ListBucketsRequest",
@@ -121,13 +134,16 @@
"LogExclusion",
"LogSink",
"LogView",
+ "Settings",
"UndeleteBucketRequest",
"UpdateBucketRequest",
"UpdateCmekSettingsRequest",
"UpdateExclusionRequest",
+ "UpdateSettingsRequest",
"UpdateSinkRequest",
"UpdateViewRequest",
"LifecycleState",
+ "OperationState",
"CreateLogMetricRequest",
"DeleteLogMetricRequest",
"GetLogMetricRequest",
diff --git a/google/cloud/logging_v2/types/log_entry.py b/google/cloud/logging_v2/types/log_entry.py
index 93e428622..cc3469428 100644
--- a/google/cloud/logging_v2/types/log_entry.py
+++ b/google/cloud/logging_v2/types/log_entry.py
@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
-# Copyright 2020 Google LLC
+# Copyright 2022 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -25,7 +25,12 @@
__protobuf__ = proto.module(
package="google.logging.v2",
- manifest={"LogEntry", "LogEntryOperation", "LogEntrySourceLocation",},
+ manifest={
+ "LogEntry",
+ "LogEntryOperation",
+ "LogEntrySourceLocation",
+ "LogSplit",
+ },
)
@@ -59,6 +64,7 @@ class LogEntry(proto.Message):
``[LOG_ID]`` must be URL-encoded within ``log_name``.
Example:
``"organizations/1234567890/logs/cloudresourcemanager.googleapis.com%2Factivity"``.
+
``[LOG_ID]`` must be less than 512 characters long and can
only include the following characters: upper and lower case
alphanumeric characters, forward-slash, underscore, hyphen,
@@ -66,7 +72,7 @@ class LogEntry(proto.Message):
For backward compatibility, if ``log_name`` begins with a
forward-slash, such as ``/projects/...``, then the log entry
- is ingested as usual but the forward-slash is removed.
+ is ingested as usual, but the forward-slash is removed.
Listing the log entry will not show the leading slash and
filtering for a log name with a leading slash will never
return any results.
@@ -138,10 +144,23 @@ class LogEntry(proto.Message):
http_request (google.logging.type.http_request_pb2.HttpRequest):
Optional. Information about the HTTP request
associated with this log entry, if applicable.
- labels (Sequence[google.cloud.logging_v2.types.LogEntry.LabelsEntry]):
- Optional. A set of user-defined (key, value)
- data that provides additional information about
- the log entry.
+ labels (Mapping[str, str]):
+ Optional. A map of key, value pairs that provides additional
+ information about the log entry. The labels can be
+ user-defined or system-defined.
+
+ User-defined labels are arbitrary key, value pairs that you
+ can use to classify logs.
+
+ System-defined labels are defined by GCP services for
+ platform logs. They have two components - a service
+ namespace component and the attribute name. For example:
+ ``compute.googleapis.com/resource_name``.
+
+ Cloud Logging truncates label keys that exceed 512 B and
+ label values that exceed 64 KB upon their associated log
+ entry being written. The truncation is indicated by an
+ ellipsis at the end of the character string.
operation (google.cloud.logging_v2.types.LogEntryOperation):
Optional. Information about an operation
associated with the log entry, if applicable.
@@ -171,35 +190,93 @@ class LogEntry(proto.Message):
source_location (google.cloud.logging_v2.types.LogEntrySourceLocation):
Optional. Source code location information
associated with the log entry, if any.
+ split (google.cloud.logging_v2.types.LogSplit):
+ Optional. Information indicating this
+ LogEntry is part of a sequence of multiple log
+ entries split from a single LogEntry.
"""
- log_name = proto.Field(proto.STRING, number=12,)
+ log_name = proto.Field(
+ proto.STRING,
+ number=12,
+ )
resource = proto.Field(
- proto.MESSAGE, number=8, message=monitored_resource_pb2.MonitoredResource,
+ proto.MESSAGE,
+ number=8,
+ message=monitored_resource_pb2.MonitoredResource,
)
proto_payload = proto.Field(
- proto.MESSAGE, number=2, oneof="payload", message=any_pb2.Any,
+ proto.MESSAGE,
+ number=2,
+ oneof="payload",
+ message=any_pb2.Any,
+ )
+ text_payload = proto.Field(
+ proto.STRING,
+ number=3,
+ oneof="payload",
)
- text_payload = proto.Field(proto.STRING, number=3, oneof="payload",)
json_payload = proto.Field(
- proto.MESSAGE, number=6, oneof="payload", message=struct_pb2.Struct,
+ proto.MESSAGE,
+ number=6,
+ oneof="payload",
+ message=struct_pb2.Struct,
+ )
+ timestamp = proto.Field(
+ proto.MESSAGE,
+ number=9,
+ message=timestamp_pb2.Timestamp,
)
- timestamp = proto.Field(proto.MESSAGE, number=9, message=timestamp_pb2.Timestamp,)
receive_timestamp = proto.Field(
- proto.MESSAGE, number=24, message=timestamp_pb2.Timestamp,
+ proto.MESSAGE,
+ number=24,
+ message=timestamp_pb2.Timestamp,
+ )
+ severity = proto.Field(
+ proto.ENUM,
+ number=10,
+ enum=log_severity_pb2.LogSeverity,
+ )
+ insert_id = proto.Field(
+ proto.STRING,
+ number=4,
)
- severity = proto.Field(proto.ENUM, number=10, enum=log_severity_pb2.LogSeverity,)
- insert_id = proto.Field(proto.STRING, number=4,)
http_request = proto.Field(
- proto.MESSAGE, number=7, message=http_request_pb2.HttpRequest,
+ proto.MESSAGE,
+ number=7,
+ message=http_request_pb2.HttpRequest,
+ )
+ labels = proto.MapField(
+ proto.STRING,
+ proto.STRING,
+ number=11,
+ )
+ operation = proto.Field(
+ proto.MESSAGE,
+ number=15,
+ message="LogEntryOperation",
+ )
+ trace = proto.Field(
+ proto.STRING,
+ number=22,
+ )
+ span_id = proto.Field(
+ proto.STRING,
+ number=27,
+ )
+ trace_sampled = proto.Field(
+ proto.BOOL,
+ number=30,
)
- labels = proto.MapField(proto.STRING, proto.STRING, number=11,)
- operation = proto.Field(proto.MESSAGE, number=15, message="LogEntryOperation",)
- trace = proto.Field(proto.STRING, number=22,)
- span_id = proto.Field(proto.STRING, number=27,)
- trace_sampled = proto.Field(proto.BOOL, number=30,)
source_location = proto.Field(
- proto.MESSAGE, number=23, message="LogEntrySourceLocation",
+ proto.MESSAGE,
+ number=23,
+ message="LogEntrySourceLocation",
+ )
+ split = proto.Field(
+ proto.MESSAGE,
+ number=35,
+ message="LogSplit",
)
@@ -225,10 +302,22 @@ class LogEntryOperation(proto.Message):
last log entry in the operation.
"""
- id = proto.Field(proto.STRING, number=1,)
- producer = proto.Field(proto.STRING, number=2,)
- first = proto.Field(proto.BOOL, number=3,)
- last = proto.Field(proto.BOOL, number=4,)
+ id = proto.Field(
+ proto.STRING,
+ number=1,
+ )
+ producer = proto.Field(
+ proto.STRING,
+ number=2,
+ )
+ first = proto.Field(
+ proto.BOOL,
+ number=3,
+ )
+ last = proto.Field(
+ proto.BOOL,
+ number=4,
+ )
class LogEntrySourceLocation(proto.Message):
@@ -253,9 +342,53 @@ class LogEntrySourceLocation(proto.Message):
(Go), ``function`` (Python).
"""
- file = proto.Field(proto.STRING, number=1,)
- line = proto.Field(proto.INT64, number=2,)
- function = proto.Field(proto.STRING, number=3,)
+ file = proto.Field(
+ proto.STRING,
+ number=1,
+ )
+ line = proto.Field(
+ proto.INT64,
+ number=2,
+ )
+ function = proto.Field(
+ proto.STRING,
+ number=3,
+ )
+
+
+class LogSplit(proto.Message):
+ r"""Additional information used to correlate multiple log
+ entries. Used when a single LogEntry would exceed the Google
+ Cloud Logging size limit and is split across multiple log
+ entries.
+
+ Attributes:
+ uid (str):
+ A globally unique identifier for all log entries in a
+ sequence of split log entries. All log entries with the same
+ \|LogSplit.uid\| are assumed to be part of the same sequence
+ of split log entries.
+ index (int):
+ The index of this LogEntry in the sequence of split log
+ entries. Log entries are given \|index\| values 0, 1, ...,
+ n-1 for a sequence of n log entries.
+ total_splits (int):
+ The total number of log entries that the
+ original LogEntry was split into.
+ """
+
+ uid = proto.Field(
+ proto.STRING,
+ number=1,
+ )
+ index = proto.Field(
+ proto.INT32,
+ number=2,
+ )
+ total_splits = proto.Field(
+ proto.INT32,
+ number=3,
+ )
__all__ = tuple(sorted(__protobuf__.manifest))
diff --git a/google/cloud/logging_v2/types/logging.py b/google/cloud/logging_v2/types/logging.py
index 8477c2a49..42bb9dbb8 100644
--- a/google/cloud/logging_v2/types/logging.py
+++ b/google/cloud/logging_v2/types/logging.py
@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
-# Copyright 2020 Google LLC
+# Copyright 2022 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -47,21 +47,23 @@ class DeleteLogRequest(proto.Message):
log_name (str):
Required. The resource name of the log to delete:
- ::
-
- "projects/[PROJECT_ID]/logs/[LOG_ID]"
- "organizations/[ORGANIZATION_ID]/logs/[LOG_ID]"
- "billingAccounts/[BILLING_ACCOUNT_ID]/logs/[LOG_ID]"
- "folders/[FOLDER_ID]/logs/[LOG_ID]"
+ - ``projects/[PROJECT_ID]/logs/[LOG_ID]``
+ - ``organizations/[ORGANIZATION_ID]/logs/[LOG_ID]``
+ - ``billingAccounts/[BILLING_ACCOUNT_ID]/logs/[LOG_ID]``
+ - ``folders/[FOLDER_ID]/logs/[LOG_ID]``
``[LOG_ID]`` must be URL-encoded. For example,
``"projects/my-project-id/logs/syslog"``,
- ``"organizations/1234567890/logs/cloudresourcemanager.googleapis.com%2Factivity"``.
+ ``"organizations/123/logs/cloudaudit.googleapis.com%2Factivity"``.
+
For more information about log names, see
[LogEntry][google.logging.v2.LogEntry].
"""
- log_name = proto.Field(proto.STRING, number=1,)
+ log_name = proto.Field(
+ proto.STRING,
+ number=1,
+ )
class WriteLogEntriesRequest(proto.Message):
@@ -73,19 +75,17 @@ class WriteLogEntriesRequest(proto.Message):
all log entries in ``entries`` that do not specify a value
for ``log_name``:
- ::
-
- "projects/[PROJECT_ID]/logs/[LOG_ID]"
- "organizations/[ORGANIZATION_ID]/logs/[LOG_ID]"
- "billingAccounts/[BILLING_ACCOUNT_ID]/logs/[LOG_ID]"
- "folders/[FOLDER_ID]/logs/[LOG_ID]"
+ - ``projects/[PROJECT_ID]/logs/[LOG_ID]``
+ - ``organizations/[ORGANIZATION_ID]/logs/[LOG_ID]``
+ - ``billingAccounts/[BILLING_ACCOUNT_ID]/logs/[LOG_ID]``
+ - ``folders/[FOLDER_ID]/logs/[LOG_ID]``
``[LOG_ID]`` must be URL-encoded. For example:
::
"projects/my-project-id/logs/syslog"
- "organizations/1234567890/logs/cloudresourcemanager.googleapis.com%2Factivity"
+ "organizations/123/logs/cloudaudit.googleapis.com%2Factivity"
The permission ``logging.logEntries.create`` is needed on
each project, organization, billing account, or folder that
@@ -103,7 +103,7 @@ class WriteLogEntriesRequest(proto.Message):
"zone": "us-central1-a", "instance_id": "00000000000000000000" }}
See [LogEntry][google.logging.v2.LogEntry].
- labels (Sequence[google.cloud.logging_v2.types.WriteLogEntriesRequest.LabelsEntry]):
+ labels (Mapping[str, str]):
Optional. Default labels that are added to the ``labels``
field of all log entries in ``entries``. If a log entry
already has a label with the same key as a label in this
@@ -128,17 +128,17 @@ class WriteLogEntriesRequest(proto.Message):
Log entries with timestamps that are more than the `logs
retention
- period `__ in
- the past or more than 24 hours in the future will not be
+ period `__ in the
+ past or more than 24 hours in the future will not be
available when calling ``entries.list``. However, those log
entries can still be `exported with
LogSinks `__.
To improve throughput and to avoid exceeding the `quota
- limit `__ for
- calls to ``entries.write``, you should try to include
- several log entries in this list, rather than calling this
- method for each individual log entry.
+ limit `__ for calls
+ to ``entries.write``, you should try to include several log
+ entries in this list, rather than calling this method for
+ each individual log entry.
partial_success (bool):
Optional. Whether valid entries should be written even if
some other entries fail due to INVALID_ARGUMENT or
@@ -155,26 +155,44 @@ class WriteLogEntriesRequest(proto.Message):
properly before sending valuable data.
"""
- log_name = proto.Field(proto.STRING, number=1,)
+ log_name = proto.Field(
+ proto.STRING,
+ number=1,
+ )
resource = proto.Field(
- proto.MESSAGE, number=2, message=monitored_resource_pb2.MonitoredResource,
+ proto.MESSAGE,
+ number=2,
+ message=monitored_resource_pb2.MonitoredResource,
+ )
+ labels = proto.MapField(
+ proto.STRING,
+ proto.STRING,
+ number=3,
+ )
+ entries = proto.RepeatedField(
+ proto.MESSAGE,
+ number=4,
+ message=log_entry.LogEntry,
+ )
+ partial_success = proto.Field(
+ proto.BOOL,
+ number=5,
+ )
+ dry_run = proto.Field(
+ proto.BOOL,
+ number=6,
)
- labels = proto.MapField(proto.STRING, proto.STRING, number=3,)
- entries = proto.RepeatedField(proto.MESSAGE, number=4, message=log_entry.LogEntry,)
- partial_success = proto.Field(proto.BOOL, number=5,)
- dry_run = proto.Field(proto.BOOL, number=6,)
class WriteLogEntriesResponse(proto.Message):
- r"""Result returned from WriteLogEntries.
- """
+ r"""Result returned from WriteLogEntries."""
class WriteLogEntriesPartialErrors(proto.Message):
r"""Error details for WriteLogEntries with partial success.
Attributes:
- log_entry_errors (Sequence[google.cloud.logging_v2.types.WriteLogEntriesPartialErrors.LogEntryErrorsEntry]):
+ log_entry_errors (Mapping[int, google.rpc.status_pb2.Status]):
When ``WriteLogEntriesRequest.partial_success`` is true,
records the error status for entries that were not written
due to a permanent error, keyed by the entry's zero-based
@@ -185,7 +203,10 @@ class WriteLogEntriesPartialErrors(proto.Message):
"""
log_entry_errors = proto.MapField(
- proto.INT32, proto.MESSAGE, number=1, message=status_pb2.Status,
+ proto.INT32,
+ proto.MESSAGE,
+ number=1,
+ message=status_pb2.Status,
)
@@ -197,18 +218,17 @@ class ListLogEntriesRequest(proto.Message):
Required. Names of one or more parent resources from which
to retrieve log entries:
- ::
+ - ``projects/[PROJECT_ID]``
+ - ``organizations/[ORGANIZATION_ID]``
+ - ``billingAccounts/[BILLING_ACCOUNT_ID]``
+ - ``folders/[FOLDER_ID]``
- "projects/[PROJECT_ID]"
- "organizations/[ORGANIZATION_ID]"
- "billingAccounts/[BILLING_ACCOUNT_ID]"
- "folders/[FOLDER_ID]"
+ May alternatively be one or more views:
- May alternatively be one or more views
- projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]
- organization/[ORGANIZATION_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]
- billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]
- folders/[FOLDER_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]
+ - ``projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]``
+ - ``organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]``
+ - ``billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]``
+ - ``folders/[FOLDER_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]``
Projects listed in the ``project_ids`` field are added to
this list.
@@ -245,11 +265,26 @@ class ListLogEntriesRequest(proto.Message):
should be identical to those in the previous call.
"""
- resource_names = proto.RepeatedField(proto.STRING, number=8,)
- filter = proto.Field(proto.STRING, number=2,)
- order_by = proto.Field(proto.STRING, number=3,)
- page_size = proto.Field(proto.INT32, number=4,)
- page_token = proto.Field(proto.STRING, number=5,)
+ resource_names = proto.RepeatedField(
+ proto.STRING,
+ number=8,
+ )
+ filter = proto.Field(
+ proto.STRING,
+ number=2,
+ )
+ order_by = proto.Field(
+ proto.STRING,
+ number=3,
+ )
+ page_size = proto.Field(
+ proto.INT32,
+ number=4,
+ )
+ page_token = proto.Field(
+ proto.STRING,
+ number=5,
+ )
class ListLogEntriesResponse(proto.Message):
@@ -281,8 +316,15 @@ class ListLogEntriesResponse(proto.Message):
def raw_page(self):
return self
- entries = proto.RepeatedField(proto.MESSAGE, number=1, message=log_entry.LogEntry,)
- next_page_token = proto.Field(proto.STRING, number=2,)
+ entries = proto.RepeatedField(
+ proto.MESSAGE,
+ number=1,
+ message=log_entry.LogEntry,
+ )
+ next_page_token = proto.Field(
+ proto.STRING,
+ number=2,
+ )
class ListMonitoredResourceDescriptorsRequest(proto.Message):
@@ -302,8 +344,14 @@ class ListMonitoredResourceDescriptorsRequest(proto.Message):
should be identical to those in the previous call.
"""
- page_size = proto.Field(proto.INT32, number=1,)
- page_token = proto.Field(proto.STRING, number=2,)
+ page_size = proto.Field(
+ proto.INT32,
+ number=1,
+ )
+ page_token = proto.Field(
+ proto.STRING,
+ number=2,
+ )
class ListMonitoredResourceDescriptorsResponse(proto.Message):
@@ -328,7 +376,10 @@ def raw_page(self):
number=1,
message=monitored_resource_pb2.MonitoredResourceDescriptor,
)
- next_page_token = proto.Field(proto.STRING, number=2,)
+ next_page_token = proto.Field(
+ proto.STRING,
+ number=2,
+ )
class ListLogsRequest(proto.Message):
@@ -338,12 +389,10 @@ class ListLogsRequest(proto.Message):
parent (str):
Required. The resource name that owns the logs:
- ::
-
- "projects/[PROJECT_ID]"
- "organizations/[ORGANIZATION_ID]"
- "billingAccounts/[BILLING_ACCOUNT_ID]"
- "folders/[FOLDER_ID]".
+ - ``projects/[PROJECT_ID]``
+ - ``organizations/[ORGANIZATION_ID]``
+ - ``billingAccounts/[BILLING_ACCOUNT_ID]``
+ - ``folders/[FOLDER_ID]``
page_size (int):
Optional. The maximum number of results to return from this
request. Non-positive values are ignored. The presence of
@@ -357,20 +406,36 @@ class ListLogsRequest(proto.Message):
should be identical to those in the previous call.
resource_names (Sequence[str]):
Optional. The resource name that owns the logs:
- projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]
- organization/[ORGANIZATION_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]
- billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]
- folders/[FOLDER_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]
+
+ - ``projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]``
+ - ``organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]``
+ - ``billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]``
+ - ``folders/[FOLDER_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]``
To support legacy queries, it could also be:
- "projects/[PROJECT_ID]" "organizations/[ORGANIZATION_ID]"
- "billingAccounts/[BILLING_ACCOUNT_ID]" "folders/[FOLDER_ID]".
+
+ - ``projects/[PROJECT_ID]``
+ - ``organizations/[ORGANIZATION_ID]``
+ - ``billingAccounts/[BILLING_ACCOUNT_ID]``
+ - ``folders/[FOLDER_ID]``
"""
- parent = proto.Field(proto.STRING, number=1,)
- page_size = proto.Field(proto.INT32, number=2,)
- page_token = proto.Field(proto.STRING, number=3,)
- resource_names = proto.RepeatedField(proto.STRING, number=8,)
+ parent = proto.Field(
+ proto.STRING,
+ number=1,
+ )
+ page_size = proto.Field(
+ proto.INT32,
+ number=2,
+ )
+ page_token = proto.Field(
+ proto.STRING,
+ number=3,
+ )
+ resource_names = proto.RepeatedField(
+ proto.STRING,
+ number=8,
+ )
class ListLogsResponse(proto.Message):
@@ -392,8 +457,14 @@ class ListLogsResponse(proto.Message):
def raw_page(self):
return self
- log_names = proto.RepeatedField(proto.STRING, number=3,)
- next_page_token = proto.Field(proto.STRING, number=2,)
+ log_names = proto.RepeatedField(
+ proto.STRING,
+ number=3,
+ )
+ next_page_token = proto.Field(
+ proto.STRING,
+ number=2,
+ )
class TailLogEntriesRequest(proto.Message):
@@ -404,18 +475,17 @@ class TailLogEntriesRequest(proto.Message):
Required. Name of a parent resource from which to retrieve
log entries:
- ::
-
- "projects/[PROJECT_ID]"
- "organizations/[ORGANIZATION_ID]"
- "billingAccounts/[BILLING_ACCOUNT_ID]"
- "folders/[FOLDER_ID]"
+ - ``projects/[PROJECT_ID]``
+ - ``organizations/[ORGANIZATION_ID]``
+ - ``billingAccounts/[BILLING_ACCOUNT_ID]``
+ - ``folders/[FOLDER_ID]``
May alternatively be one or more views:
- "projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]"
- "organization/[ORGANIZATION_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]"
- "billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]"
- "folders/[FOLDER_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]".
+
+ - ``projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]``
+ - ``organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]``
+ - ``billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]``
+ - ``folders/[FOLDER_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]``
filter (str):
Optional. A filter that chooses which log entries to return.
See `Advanced Logs
@@ -435,9 +505,19 @@ class TailLogEntriesRequest(proto.Message):
milliseconds.
"""
- resource_names = proto.RepeatedField(proto.STRING, number=1,)
- filter = proto.Field(proto.STRING, number=2,)
- buffer_window = proto.Field(proto.MESSAGE, number=3, message=duration_pb2.Duration,)
+ resource_names = proto.RepeatedField(
+ proto.STRING,
+ number=1,
+ )
+ filter = proto.Field(
+ proto.STRING,
+ number=2,
+ )
+ buffer_window = proto.Field(
+ proto.MESSAGE,
+ number=3,
+ message=duration_pb2.Duration,
+ )
class TailLogEntriesResponse(proto.Message):
@@ -479,13 +559,24 @@ class Reason(proto.Enum):
NOT_CONSUMED = 2
reason = proto.Field(
- proto.ENUM, number=1, enum="TailLogEntriesResponse.SuppressionInfo.Reason",
+ proto.ENUM,
+ number=1,
+ enum="TailLogEntriesResponse.SuppressionInfo.Reason",
+ )
+ suppressed_count = proto.Field(
+ proto.INT32,
+ number=2,
)
- suppressed_count = proto.Field(proto.INT32, number=2,)
- entries = proto.RepeatedField(proto.MESSAGE, number=1, message=log_entry.LogEntry,)
+ entries = proto.RepeatedField(
+ proto.MESSAGE,
+ number=1,
+ message=log_entry.LogEntry,
+ )
suppression_info = proto.RepeatedField(
- proto.MESSAGE, number=2, message=SuppressionInfo,
+ proto.MESSAGE,
+ number=2,
+ message=SuppressionInfo,
)
diff --git a/google/cloud/logging_v2/types/logging_config.py b/google/cloud/logging_v2/types/logging_config.py
index 3ea70506c..c2fcf30bd 100644
--- a/google/cloud/logging_v2/types/logging_config.py
+++ b/google/cloud/logging_v2/types/logging_config.py
@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
-# Copyright 2020 Google LLC
+# Copyright 2022 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -23,6 +23,7 @@
package="google.logging.v2",
manifest={
"LifecycleState",
+ "OperationState",
"LogBucket",
"LogView",
"LogSink",
@@ -56,6 +57,12 @@
"GetCmekSettingsRequest",
"UpdateCmekSettingsRequest",
"CmekSettings",
+ "GetSettingsRequest",
+ "UpdateSettingsRequest",
+ "Settings",
+ "CopyLogEntriesRequest",
+ "CopyLogEntriesMetadata",
+ "CopyLogEntriesResponse",
},
)
@@ -67,18 +74,42 @@ class LifecycleState(proto.Enum):
DELETE_REQUESTED = 2
+class OperationState(proto.Enum):
+ r"""List of different operation states.
+ High level state of the operation. This is used to report the
+ job's current state to the user. Once a long running operation
+ is created, the current state of the operation can be queried
+ even before the operation is finished and the final result is
+ available.
+ """
+ OPERATION_STATE_UNSPECIFIED = 0
+ OPERATION_STATE_SCHEDULED = 1
+ OPERATION_STATE_WAITING_FOR_PERMISSIONS = 2
+ OPERATION_STATE_RUNNING = 3
+ OPERATION_STATE_SUCCEEDED = 4
+ OPERATION_STATE_FAILED = 5
+ OPERATION_STATE_CANCELLED = 6
+
+
class LogBucket(proto.Message):
- r"""Describes a repository of logs.
+ r"""Describes a repository in which log entries are stored.
Attributes:
name (str):
- The resource name of the bucket. For example:
- "projects/my-project-id/locations/my-location/buckets/my-bucket-id
- The supported locations are: "global"
+ Output only. The resource name of the bucket.
+
+ For example:
- For the location of ``global`` it is unspecified where logs
- are actually stored. Once a bucket has been created, the
- location can not be changed.
+ ``projects/my-project/locations/global/buckets/my-bucket``
+
+ For a list of supported locations, see `Supported
+ Regions `__
+
+ For the location of ``global`` it is unspecified where log
+ entries are actually stored.
+
+ After a bucket has been created, the location cannot be
+ changed.
description (str):
Describes this bucket.
create_time (google.protobuf.timestamp_pb2.Timestamp):
@@ -96,32 +127,84 @@ class LogBucket(proto.Message):
bucket creation time, the default time of 30
days will be used.
locked (bool):
- Whether the bucket has been locked.
- The retention period on a locked bucket may not
+ Whether the bucket is locked.
+ The retention period on a locked bucket cannot
be changed. Locked buckets may only be deleted
if they are empty.
lifecycle_state (google.cloud.logging_v2.types.LifecycleState):
Output only. The bucket lifecycle state.
+ restricted_fields (Sequence[str]):
+ Log entry field paths that are denied access in this bucket.
+
+ The following fields and their children are eligible:
+ ``textPayload``, ``jsonPayload``, ``protoPayload``,
+ ``httpRequest``, ``labels``, ``sourceLocation``.
+
+ Restricting a repeated field will restrict all values.
+ Adding a parent will block all child fields. (e.g.
+ ``foo.bar`` will block ``foo.bar.baz``)
+ cmek_settings (google.cloud.logging_v2.types.CmekSettings):
+ The CMEK settings of the log bucket. If
+ present, new log entries written to this log
+ bucket are encrypted using the CMEK key provided
+ in this configuration. If a log bucket has CMEK
+ settings, the CMEK settings cannot be disabled
+ later by updating the log bucket. Changing the
+ KMS key is allowed.
"""
- name = proto.Field(proto.STRING, number=1,)
- description = proto.Field(proto.STRING, number=3,)
- create_time = proto.Field(proto.MESSAGE, number=4, message=timestamp_pb2.Timestamp,)
- update_time = proto.Field(proto.MESSAGE, number=5, message=timestamp_pb2.Timestamp,)
- retention_days = proto.Field(proto.INT32, number=11,)
- locked = proto.Field(proto.BOOL, number=9,)
- lifecycle_state = proto.Field(proto.ENUM, number=12, enum="LifecycleState",)
+ name = proto.Field(
+ proto.STRING,
+ number=1,
+ )
+ description = proto.Field(
+ proto.STRING,
+ number=3,
+ )
+ create_time = proto.Field(
+ proto.MESSAGE,
+ number=4,
+ message=timestamp_pb2.Timestamp,
+ )
+ update_time = proto.Field(
+ proto.MESSAGE,
+ number=5,
+ message=timestamp_pb2.Timestamp,
+ )
+ retention_days = proto.Field(
+ proto.INT32,
+ number=11,
+ )
+ locked = proto.Field(
+ proto.BOOL,
+ number=9,
+ )
+ lifecycle_state = proto.Field(
+ proto.ENUM,
+ number=12,
+ enum="LifecycleState",
+ )
+ restricted_fields = proto.RepeatedField(
+ proto.STRING,
+ number=15,
+ )
+ cmek_settings = proto.Field(
+ proto.MESSAGE,
+ number=19,
+ message="CmekSettings",
+ )
class LogView(proto.Message):
- r"""Describes a view over logs in a bucket.
+ r"""Describes a view over log entries in a bucket.
Attributes:
name (str):
The resource name of the view.
- For example
- "projects/my-project-id/locations/my-
- location/buckets/my-bucket-id/views/my-view
+
+ For example:
+
+ ``projects/my-project/locations/global/buckets/my-bucket/views/my-view``
description (str):
Describes this view.
create_time (google.protobuf.timestamp_pb2.Timestamp):
@@ -132,27 +215,52 @@ class LogView(proto.Message):
view.
filter (str):
Filter that restricts which log entries in a bucket are
- visible in this view. Filters are restricted to be a logical
- AND of ==/!= of any of the following: originating
- project/folder/organization/billing account. resource type
- log id Example: SOURCE("projects/myproject") AND
- resource.type = "gce_instance" AND LOG_ID("stdout")
+ visible in this view.
+
+ Filters are restricted to be a logical AND of ==/!= of any
+ of the following:
+
+ - originating project/folder/organization/billing account.
+ - resource type
+ - log id
+
+ For example:
+
+ SOURCE("projects/myproject") AND resource.type =
+ "gce_instance" AND LOG_ID("stdout")
"""
- name = proto.Field(proto.STRING, number=1,)
- description = proto.Field(proto.STRING, number=3,)
- create_time = proto.Field(proto.MESSAGE, number=4, message=timestamp_pb2.Timestamp,)
- update_time = proto.Field(proto.MESSAGE, number=5, message=timestamp_pb2.Timestamp,)
- filter = proto.Field(proto.STRING, number=7,)
+ name = proto.Field(
+ proto.STRING,
+ number=1,
+ )
+ description = proto.Field(
+ proto.STRING,
+ number=3,
+ )
+ create_time = proto.Field(
+ proto.MESSAGE,
+ number=4,
+ message=timestamp_pb2.Timestamp,
+ )
+ update_time = proto.Field(
+ proto.MESSAGE,
+ number=5,
+ message=timestamp_pb2.Timestamp,
+ )
+ filter = proto.Field(
+ proto.STRING,
+ number=7,
+ )
class LogSink(proto.Message):
r"""Describes a sink used to export log entries to one of the
following destinations in any project: a Cloud Storage bucket, a
- BigQuery dataset, or a Cloud Pub/Sub topic. A logs filter
- controls which log entries are exported. The sink must be
- created within a project, organization, billing account, or
- folder.
+ BigQuery dataset, a Pub/Sub topic or a Cloud Logging log bucket.
+ A logs filter controls which log entries are exported. The sink
+ must be created within a project, organization, billing account,
+ or folder.
.. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields
@@ -160,7 +268,9 @@ class LogSink(proto.Message):
Attributes:
name (str):
Required. The client-assigned sink identifier, unique within
- the project. Example: ``"my-syslog-errors-to-pubsub"``. Sink
+ the project.
+
+ For example: ``"my-syslog-errors-to-pubsub"``. Sink
identifiers are limited to 100 characters and can include
only the following characters: upper and lower-case
alphanumeric characters, underscores, hyphens, and periods.
@@ -183,30 +293,30 @@ class LogSink(proto.Message):
Optional. An `advanced logs
filter `__.
The only exported log entries are those that are in the
- resource owning the sink and that match the filter. For
- example:
+ resource owning the sink and that match the filter.
- ::
+ For example:
- logName="projects/[PROJECT_ID]/logs/[LOG_ID]" AND severity>=ERROR
+ ``logName="projects/[PROJECT_ID]/logs/[LOG_ID]" AND severity>=ERROR``
description (str):
Optional. A description of this sink.
The maximum length of the description is 8000
characters.
disabled (bool):
- Optional. If set to True, then this sink is
+ Optional. If set to true, then this sink is
disabled and it does not export any log entries.
exclusions (Sequence[google.cloud.logging_v2.types.LogExclusion]):
- Optional. Log entries that match any of the exclusion
- filters will not be exported. If a log entry is matched by
- both ``filter`` and one of ``exclusion_filters`` it will not
- be exported.
+ Optional. Log entries that match any of these exclusion
+ filters will not be exported.
+
+ If a log entry is matched by both ``filter`` and one of
+ ``exclusion_filters`` it will not be exported.
output_version_format (google.cloud.logging_v2.types.LogSink.VersionFormat):
Deprecated. This field is unused.
writer_identity (str):
Output only. An IAM identity—a service account or
- group—under which Logging writes the exported log entries to
- the sink's destination. This field is set by
+ group—under which Cloud Logging writes the exported log
+ entries to the sink's destination. This field is set by
[sinks.create][google.logging.v2.ConfigServiceV2.CreateSink]
and
[sinks.update][google.logging.v2.ConfigServiceV2.UpdateSink]
@@ -219,25 +329,30 @@ class LogSink(proto.Message):
Resource `__.
Consult the destination service's documentation to determine
the appropriate IAM roles to assign to the identity.
+
+ Sinks that have a destination that is a log bucket in the
+ same project as the sink do not have a writer_identity and
+ no additional permissions are required.
include_children (bool):
Optional. This field applies only to sinks owned by
organizations and folders. If the field is false, the
default, only the logs owned by the sink's parent resource
- are available for export. If the field is true, then logs
- from all the projects, folders, and billing accounts
+ are available for export. If the field is true, then log
+ entries from all the projects, folders, and billing accounts
contained in the sink's parent resource are also available
for export. Whether a particular log entry from the children
- is exported depends on the sink's filter expression. For
- example, if this field is true, then the filter
+ is exported depends on the sink's filter expression.
+
+ For example, if this field is true, then the filter
``resource.type=gce_instance`` would export all Compute
Engine VM instance log entries from all projects in the
- sink's parent. To only export entries from certain child
- projects, filter on the project part of the log name:
+ sink's parent.
- ::
+ To only export entries from certain child projects, filter
+ on the project part of the log name:
- logName:("projects/test-project1/" OR "projects/test-project2/") AND
- resource.type=gce_instance
+ logName:("projects/test-project1/" OR
+ "projects/test-project2/") AND resource.type=gce_instance
bigquery_options (google.cloud.logging_v2.types.BigQueryOptions):
Optional. Options that affect sinks exporting
data to BigQuery.
@@ -259,23 +374,59 @@ class VersionFormat(proto.Enum):
V2 = 1
V1 = 2
- name = proto.Field(proto.STRING, number=1,)
- destination = proto.Field(proto.STRING, number=3,)
- filter = proto.Field(proto.STRING, number=5,)
- description = proto.Field(proto.STRING, number=18,)
- disabled = proto.Field(proto.BOOL, number=19,)
- exclusions = proto.RepeatedField(proto.MESSAGE, number=16, message="LogExclusion",)
- output_version_format = proto.Field(proto.ENUM, number=6, enum=VersionFormat,)
- writer_identity = proto.Field(proto.STRING, number=8,)
- include_children = proto.Field(proto.BOOL, number=9,)
+ name = proto.Field(
+ proto.STRING,
+ number=1,
+ )
+ destination = proto.Field(
+ proto.STRING,
+ number=3,
+ )
+ filter = proto.Field(
+ proto.STRING,
+ number=5,
+ )
+ description = proto.Field(
+ proto.STRING,
+ number=18,
+ )
+ disabled = proto.Field(
+ proto.BOOL,
+ number=19,
+ )
+ exclusions = proto.RepeatedField(
+ proto.MESSAGE,
+ number=16,
+ message="LogExclusion",
+ )
+ output_version_format = proto.Field(
+ proto.ENUM,
+ number=6,
+ enum=VersionFormat,
+ )
+ writer_identity = proto.Field(
+ proto.STRING,
+ number=8,
+ )
+ include_children = proto.Field(
+ proto.BOOL,
+ number=9,
+ )
bigquery_options = proto.Field(
- proto.MESSAGE, number=12, oneof="options", message="BigQueryOptions",
+ proto.MESSAGE,
+ number=12,
+ oneof="options",
+ message="BigQueryOptions",
)
create_time = proto.Field(
- proto.MESSAGE, number=13, message=timestamp_pb2.Timestamp,
+ proto.MESSAGE,
+ number=13,
+ message=timestamp_pb2.Timestamp,
)
update_time = proto.Field(
- proto.MESSAGE, number=14, message=timestamp_pb2.Timestamp,
+ proto.MESSAGE,
+ number=14,
+ message=timestamp_pb2.Timestamp,
)
@@ -287,25 +438,33 @@ class BigQueryOptions(proto.Message):
use_partitioned_tables (bool):
Optional. Whether to use `BigQuery's partition
tables `__.
- By default, Logging creates dated tables based on the log
- entries' timestamps, e.g. syslog_20170523. With partitioned
- tables the date suffix is no longer present and `special
- query
+ By default, Cloud Logging creates dated tables based on the
+ log entries' timestamps, e.g. syslog_20170523. With
+ partitioned tables the date suffix is no longer present and
+ `special query
syntax `__
has to be used instead. In both cases, tables are sharded
based on UTC timezone.
uses_timestamp_column_partitioning (bool):
Output only. True if new timestamp column based partitioning
is in use, false if legacy ingestion-time partitioning is in
- use. All new sinks will have this field set true and will
- use timestamp column based partitioning. If
+ use.
+
+ All new sinks will have this field set true and will use
+ timestamp column based partitioning. If
use_partitioned_tables is false, this value has no meaning
and will be false. Legacy sinks using partitioned tables
will have this field set to false.
"""
- use_partitioned_tables = proto.Field(proto.BOOL, number=1,)
- uses_timestamp_column_partitioning = proto.Field(proto.BOOL, number=3,)
+ use_partitioned_tables = proto.Field(
+ proto.BOOL,
+ number=1,
+ )
+ uses_timestamp_column_partitioning = proto.Field(
+ proto.BOOL,
+ number=3,
+ )
class ListBucketsRequest(proto.Message):
@@ -339,9 +498,18 @@ class ListBucketsRequest(proto.Message):
results might be available.
"""
- parent = proto.Field(proto.STRING, number=1,)
- page_token = proto.Field(proto.STRING, number=2,)
- page_size = proto.Field(proto.INT32, number=3,)
+ parent = proto.Field(
+ proto.STRING,
+ number=1,
+ )
+ page_token = proto.Field(
+ proto.STRING,
+ number=2,
+ )
+ page_size = proto.Field(
+ proto.INT32,
+ number=3,
+ )
class ListBucketsResponse(proto.Message):
@@ -361,8 +529,15 @@ class ListBucketsResponse(proto.Message):
def raw_page(self):
return self
- buckets = proto.RepeatedField(proto.MESSAGE, number=1, message="LogBucket",)
- next_page_token = proto.Field(proto.STRING, number=2,)
+ buckets = proto.RepeatedField(
+ proto.MESSAGE,
+ number=1,
+ message="LogBucket",
+ )
+ next_page_token = proto.Field(
+ proto.STRING,
+ number=2,
+ )
class CreateBucketRequest(proto.Message):
@@ -370,13 +545,15 @@ class CreateBucketRequest(proto.Message):
Attributes:
parent (str):
- Required. The resource in which to create the bucket:
+ Required. The resource in which to create the log bucket:
::
"projects/[PROJECT_ID]/locations/[LOCATION_ID]"
- Example: ``"projects/my-logging-project/locations/global"``
+ For example:
+
+ ``"projects/my-project/locations/global"``
bucket_id (str):
Required. A client-assigned identifier such as
``"my-bucket"``. Identifiers are limited to 100 characters
@@ -389,9 +566,19 @@ class CreateBucketRequest(proto.Message):
name field in the bucket is ignored.
"""
- parent = proto.Field(proto.STRING, number=1,)
- bucket_id = proto.Field(proto.STRING, number=2,)
- bucket = proto.Field(proto.MESSAGE, number=3, message="LogBucket",)
+ parent = proto.Field(
+ proto.STRING,
+ number=1,
+ )
+ bucket_id = proto.Field(
+ proto.STRING,
+ number=2,
+ )
+ bucket = proto.Field(
+ proto.MESSAGE,
+ number=3,
+ message="LogBucket",
+ )
class UpdateBucketRequest(proto.Message):
@@ -408,11 +595,9 @@ class UpdateBucketRequest(proto.Message):
"billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]"
"folders/[FOLDER_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]"
- Example:
- ``"projects/my-project-id/locations/my-location/buckets/my-bucket-id"``.
- Also requires permission
- "resourcemanager.projects.updateLiens" to set the locked
- property
+ For example:
+
+ ``"projects/my-project/locations/global/buckets/my-bucket"``
bucket (google.cloud.logging_v2.types.LogBucket):
Required. The updated bucket.
update_mask (google.protobuf.field_mask_pb2.FieldMask):
@@ -421,16 +606,25 @@ class UpdateBucketRequest(proto.Message):
and only if, it is in the update mask. ``name`` and output
only fields cannot be updated.
- For a detailed ``FieldMask`` definition, see
+ For a detailed ``FieldMask`` definition, see:
https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#google.protobuf.FieldMask
- Example: ``updateMask=retention_days``.
+ For example: ``updateMask=retention_days``
"""
- name = proto.Field(proto.STRING, number=1,)
- bucket = proto.Field(proto.MESSAGE, number=2, message="LogBucket",)
+ name = proto.Field(
+ proto.STRING,
+ number=1,
+ )
+ bucket = proto.Field(
+ proto.MESSAGE,
+ number=2,
+ message="LogBucket",
+ )
update_mask = proto.Field(
- proto.MESSAGE, number=4, message=field_mask_pb2.FieldMask,
+ proto.MESSAGE,
+ number=4,
+ message=field_mask_pb2.FieldMask,
)
@@ -448,11 +642,15 @@ class GetBucketRequest(proto.Message):
"billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]"
"folders/[FOLDER_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]"
- Example:
- ``"projects/my-project-id/locations/my-location/buckets/my-bucket-id"``.
+ For example:
+
+ ``"projects/my-project/locations/global/buckets/my-bucket"``
"""
- name = proto.Field(proto.STRING, number=1,)
+ name = proto.Field(
+ proto.STRING,
+ number=1,
+ )
class DeleteBucketRequest(proto.Message):
@@ -469,11 +667,15 @@ class DeleteBucketRequest(proto.Message):
"billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]"
"folders/[FOLDER_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]"
- Example:
- ``"projects/my-project-id/locations/my-location/buckets/my-bucket-id"``.
+ For example:
+
+ ``"projects/my-project/locations/global/buckets/my-bucket"``
"""
- name = proto.Field(proto.STRING, number=1,)
+ name = proto.Field(
+ proto.STRING,
+ number=1,
+ )
class UndeleteBucketRequest(proto.Message):
@@ -490,11 +692,15 @@ class UndeleteBucketRequest(proto.Message):
"billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]"
"folders/[FOLDER_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]"
- Example:
- ``"projects/my-project-id/locations/my-location/buckets/my-bucket-id"``.
+ For example:
+
+ ``"projects/my-project/locations/global/buckets/my-bucket"``
"""
- name = proto.Field(proto.STRING, number=1,)
+ name = proto.Field(
+ proto.STRING,
+ number=1,
+ )
class ListViewsRequest(proto.Message):
@@ -515,14 +721,25 @@ class ListViewsRequest(proto.Message):
should be identical to those in the previous call.
page_size (int):
Optional. The maximum number of results to return from this
- request. Non-positive values are ignored. The presence of
+ request.
+
+ Non-positive values are ignored. The presence of
``nextPageToken`` in the response indicates that more
results might be available.
"""
- parent = proto.Field(proto.STRING, number=1,)
- page_token = proto.Field(proto.STRING, number=2,)
- page_size = proto.Field(proto.INT32, number=3,)
+ parent = proto.Field(
+ proto.STRING,
+ number=1,
+ )
+ page_token = proto.Field(
+ proto.STRING,
+ number=2,
+ )
+ page_size = proto.Field(
+ proto.INT32,
+ number=3,
+ )
class ListViewsResponse(proto.Message):
@@ -542,8 +759,15 @@ class ListViewsResponse(proto.Message):
def raw_page(self):
return self
- views = proto.RepeatedField(proto.MESSAGE, number=1, message="LogView",)
- next_page_token = proto.Field(proto.STRING, number=2,)
+ views = proto.RepeatedField(
+ proto.MESSAGE,
+ number=1,
+ message="LogView",
+ )
+ next_page_token = proto.Field(
+ proto.STRING,
+ number=2,
+ )
class CreateViewRequest(proto.Message):
@@ -555,19 +779,30 @@ class CreateViewRequest(proto.Message):
::
- "projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]"
+ `"projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]"`
- Example:
- ``"projects/my-logging-project/locations/my-location/buckets/my-bucket"``
+ For example:
+
+ ``"projects/my-project/locations/global/buckets/my-bucket"``
view_id (str):
Required. The id to use for this view.
view (google.cloud.logging_v2.types.LogView):
Required. The new view.
"""
- parent = proto.Field(proto.STRING, number=1,)
- view_id = proto.Field(proto.STRING, number=2,)
- view = proto.Field(proto.MESSAGE, number=3, message="LogView",)
+ parent = proto.Field(
+ proto.STRING,
+ number=1,
+ )
+ view_id = proto.Field(
+ proto.STRING,
+ number=2,
+ )
+ view = proto.Field(
+ proto.MESSAGE,
+ number=3,
+ message="LogView",
+ )
class UpdateViewRequest(proto.Message):
@@ -581,8 +816,9 @@ class UpdateViewRequest(proto.Message):
"projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]"
- Example:
- ``"projects/my-project-id/locations/my-location/buckets/my-bucket-id/views/my-view-id"``.
+ For example:
+
+ ``"projects/my-project/locations/global/buckets/my-bucket/views/my-view"``
view (google.cloud.logging_v2.types.LogView):
Required. The updated view.
update_mask (google.protobuf.field_mask_pb2.FieldMask):
@@ -594,13 +830,22 @@ class UpdateViewRequest(proto.Message):
For a detailed ``FieldMask`` definition, see
https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#google.protobuf.FieldMask
- Example: ``updateMask=filter``.
+ For example: ``updateMask=filter``
"""
- name = proto.Field(proto.STRING, number=1,)
- view = proto.Field(proto.MESSAGE, number=2, message="LogView",)
+ name = proto.Field(
+ proto.STRING,
+ number=1,
+ )
+ view = proto.Field(
+ proto.MESSAGE,
+ number=2,
+ message="LogView",
+ )
update_mask = proto.Field(
- proto.MESSAGE, number=4, message=field_mask_pb2.FieldMask,
+ proto.MESSAGE,
+ number=4,
+ message=field_mask_pb2.FieldMask,
)
@@ -615,11 +860,15 @@ class GetViewRequest(proto.Message):
"projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]"
- Example:
- ``"projects/my-project-id/locations/my-location/buckets/my-bucket-id/views/my-view-id"``.
+ For example:
+
+ ``"projects/my-project/locations/global/buckets/my-bucket/views/my-view"``
"""
- name = proto.Field(proto.STRING, number=1,)
+ name = proto.Field(
+ proto.STRING,
+ number=1,
+ )
class DeleteViewRequest(proto.Message):
@@ -633,11 +882,17 @@ class DeleteViewRequest(proto.Message):
"projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]"
- Example:
- ``"projects/my-project-id/locations/my-location/buckets/my-bucket-id/views/my-view-id"``.
+ For example:
+
+ ::
+
+ `"projects/my-project/locations/global/buckets/my-bucket/views/my-view"`
"""
- name = proto.Field(proto.STRING, number=1,)
+ name = proto.Field(
+ proto.STRING,
+ number=1,
+ )
class ListSinksRequest(proto.Message):
@@ -666,9 +921,18 @@ class ListSinksRequest(proto.Message):
results might be available.
"""
- parent = proto.Field(proto.STRING, number=1,)
- page_token = proto.Field(proto.STRING, number=2,)
- page_size = proto.Field(proto.INT32, number=3,)
+ parent = proto.Field(
+ proto.STRING,
+ number=1,
+ )
+ page_token = proto.Field(
+ proto.STRING,
+ number=2,
+ )
+ page_size = proto.Field(
+ proto.INT32,
+ number=3,
+ )
class ListSinksResponse(proto.Message):
@@ -688,8 +952,15 @@ class ListSinksResponse(proto.Message):
def raw_page(self):
return self
- sinks = proto.RepeatedField(proto.MESSAGE, number=1, message="LogSink",)
- next_page_token = proto.Field(proto.STRING, number=2,)
+ sinks = proto.RepeatedField(
+ proto.MESSAGE,
+ number=1,
+ message="LogSink",
+ )
+ next_page_token = proto.Field(
+ proto.STRING,
+ number=2,
+ )
class GetSinkRequest(proto.Message):
@@ -706,10 +977,15 @@ class GetSinkRequest(proto.Message):
"billingAccounts/[BILLING_ACCOUNT_ID]/sinks/[SINK_ID]"
"folders/[FOLDER_ID]/sinks/[SINK_ID]"
- Example: ``"projects/my-project-id/sinks/my-sink-id"``.
+ For example:
+
+ ``"projects/my-project/sinks/my-sink"``
"""
- sink_name = proto.Field(proto.STRING, number=1,)
+ sink_name = proto.Field(
+ proto.STRING,
+ number=1,
+ )
class CreateSinkRequest(proto.Message):
@@ -726,8 +1002,9 @@ class CreateSinkRequest(proto.Message):
"billingAccounts/[BILLING_ACCOUNT_ID]"
"folders/[FOLDER_ID]"
- Examples: ``"projects/my-logging-project"``,
- ``"organizations/123456789"``.
+ For examples:
+
+ ``"projects/my-project"`` ``"organizations/123456789"``
sink (google.cloud.logging_v2.types.LogSink):
Required. The new sink, whose ``name`` parameter is a sink
identifier that is not already in use.
@@ -736,9 +1013,10 @@ class CreateSinkRequest(proto.Message):
``writer_identity`` in the new sink. If this value is
omitted or set to false, and if the sink's parent is a
project, then the value returned as ``writer_identity`` is
- the same group or service account used by Logging before the
- addition of writer identities to this API. The sink's
- destination must be in the same project as the sink itself.
+ the same group or service account used by Cloud Logging
+ before the addition of writer identities to this API. The
+ sink's destination must be in the same project as the sink
+ itself.
If this field is set to true, or if the sink is owned by a
non-project resource such as an organization, then the value
@@ -748,9 +1026,19 @@ class CreateSinkRequest(proto.Message):
[LogSink][google.logging.v2.LogSink].
"""
- parent = proto.Field(proto.STRING, number=1,)
- sink = proto.Field(proto.MESSAGE, number=2, message="LogSink",)
- unique_writer_identity = proto.Field(proto.BOOL, number=3,)
+ parent = proto.Field(
+ proto.STRING,
+ number=1,
+ )
+ sink = proto.Field(
+ proto.MESSAGE,
+ number=2,
+ message="LogSink",
+ )
+ unique_writer_identity = proto.Field(
+ proto.BOOL,
+ number=3,
+ )
class UpdateSinkRequest(proto.Message):
@@ -768,7 +1056,9 @@ class UpdateSinkRequest(proto.Message):
"billingAccounts/[BILLING_ACCOUNT_ID]/sinks/[SINK_ID]"
"folders/[FOLDER_ID]/sinks/[SINK_ID]"
- Example: ``"projects/my-project-id/sinks/my-sink-id"``.
+ For example:
+
+ ``"projects/my-project/sinks/my-sink"``
sink (google.cloud.logging_v2.types.LogSink):
Required. The updated sink, whose name is the same
identifier that appears as part of ``sink_name``.
@@ -794,23 +1084,37 @@ class UpdateSinkRequest(proto.Message):
and only if, it is in the update mask. ``name`` and output
only fields cannot be updated.
- An empty updateMask is temporarily treated as using the
+ An empty ``updateMask`` is temporarily treated as using the
following mask for backwards compatibility purposes:
- destination,filter,includeChildren At some point in the
- future, behavior will be removed and specifying an empty
- updateMask will be an error.
+
+ ``destination,filter,includeChildren``
+
+ At some point in the future, behavior will be removed and
+ specifying an empty ``updateMask`` will be an error.
For a detailed ``FieldMask`` definition, see
https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#google.protobuf.FieldMask
- Example: ``updateMask=filter``.
+ For example: ``updateMask=filter``
"""
- sink_name = proto.Field(proto.STRING, number=1,)
- sink = proto.Field(proto.MESSAGE, number=2, message="LogSink",)
- unique_writer_identity = proto.Field(proto.BOOL, number=3,)
+ sink_name = proto.Field(
+ proto.STRING,
+ number=1,
+ )
+ sink = proto.Field(
+ proto.MESSAGE,
+ number=2,
+ message="LogSink",
+ )
+ unique_writer_identity = proto.Field(
+ proto.BOOL,
+ number=3,
+ )
update_mask = proto.Field(
- proto.MESSAGE, number=4, message=field_mask_pb2.FieldMask,
+ proto.MESSAGE,
+ number=4,
+ message=field_mask_pb2.FieldMask,
)
@@ -829,20 +1133,24 @@ class DeleteSinkRequest(proto.Message):
"billingAccounts/[BILLING_ACCOUNT_ID]/sinks/[SINK_ID]"
"folders/[FOLDER_ID]/sinks/[SINK_ID]"
- Example: ``"projects/my-project-id/sinks/my-sink-id"``.
+ For example:
+
+ ``"projects/my-project/sinks/my-sink"``
"""
- sink_name = proto.Field(proto.STRING, number=1,)
+ sink_name = proto.Field(
+ proto.STRING,
+ number=1,
+ )
class LogExclusion(proto.Message):
- r"""Specifies a set of log entries that are not to be stored in
- Logging. If your GCP resource receives a large volume of logs,
- you can use exclusions to reduce your chargeable logs.
- Exclusions are processed after log sinks, so you can export log
- entries before they are excluded. Note that organization-level
- and folder-level exclusions don't apply to child resources, and
- that you can't exclude audit log entries.
+ r"""Specifies a set of log entries that are filtered out by a sink. If
+ your Google Cloud resource receives a large volume of log entries,
+ you can use exclusions to reduce your chargeable logs. Note that
+ exclusions on organization-level and folder-level sinks don't apply
+ to child resources. Note also that you cannot modify the \_Required
+ sink or exclude logs from it.
Attributes:
name (str):
@@ -860,10 +1168,11 @@ class LogExclusion(proto.Message):
`sample
function `__,
you can exclude less than 100% of the matching log entries.
+
For example, the following query matches 99% of low-severity
log entries from Google Cloud Storage buckets:
- ``"resource.type=gcs_bucket severity`__
for more information.
@@ -1070,21 +1442,27 @@ class GetCmekSettingsRequest(proto.Message):
"billingAccounts/[BILLING_ACCOUNT_ID]/cmekSettings"
"folders/[FOLDER_ID]/cmekSettings"
- Example: ``"organizations/12345/cmekSettings"``.
+ For example:
+
+ ``"organizations/12345/cmekSettings"``
- Note: CMEK for the Logs Router can currently only be
- configured for GCP organizations. Once configured, it
- applies to all projects and folders in the GCP organization.
+ Note: CMEK for the Log Router can be configured for Google
+ Cloud projects, folders, organizations and billing accounts.
+ Once configured for an organization, it applies to all
+ projects and folders in the Google Cloud organization.
"""
- name = proto.Field(proto.STRING, number=1,)
+ name = proto.Field(
+ proto.STRING,
+ number=1,
+ )
class UpdateCmekSettingsRequest(proto.Message):
r"""The parameters to
[UpdateCmekSettings][google.logging.v2.ConfigServiceV2.UpdateCmekSettings].
- See `Enabling CMEK for Logs
+ See `Enabling CMEK for Log
Router `__
for more information.
@@ -1099,15 +1477,18 @@ class UpdateCmekSettingsRequest(proto.Message):
"billingAccounts/[BILLING_ACCOUNT_ID]/cmekSettings"
"folders/[FOLDER_ID]/cmekSettings"
- Example: ``"organizations/12345/cmekSettings"``.
+ For example:
+
+ ``"organizations/12345/cmekSettings"``
- Note: CMEK for the Logs Router can currently only be
- configured for GCP organizations. Once configured, it
- applies to all projects and folders in the GCP organization.
+ Note: CMEK for the Log Router can currently only be
+ configured for Google Cloud organizations. Once configured,
+ it applies to all projects and folders in the Google Cloud
+ organization.
cmek_settings (google.cloud.logging_v2.types.CmekSettings):
Required. The CMEK settings to update.
- See `Enabling CMEK for Logs
+ See `Enabling CMEK for Log
Router `__
for more information.
update_mask (google.protobuf.field_mask_pb2.FieldMask):
@@ -1119,13 +1500,22 @@ class UpdateCmekSettingsRequest(proto.Message):
See [FieldMask][google.protobuf.FieldMask] for more
information.
- Example: ``"updateMask=kmsKeyName"``
+ For example: ``"updateMask=kmsKeyName"``
"""
- name = proto.Field(proto.STRING, number=1,)
- cmek_settings = proto.Field(proto.MESSAGE, number=2, message="CmekSettings",)
+ name = proto.Field(
+ proto.STRING,
+ number=1,
+ )
+ cmek_settings = proto.Field(
+ proto.MESSAGE,
+ number=2,
+ message="CmekSettings",
+ )
update_mask = proto.Field(
- proto.MESSAGE, number=3, message=field_mask_pb2.FieldMask,
+ proto.MESSAGE,
+ number=3,
+ message=field_mask_pb2.FieldMask,
)
@@ -1134,11 +1524,11 @@ class CmekSettings(proto.Message):
associated with a project, folder, organization, billing account, or
flexible resource.
- Note: CMEK for the Logs Router can currently only be configured for
- GCP organizations. Once configured, it applies to all projects and
- folders in the GCP organization.
+ Note: CMEK for the Log Router can currently only be configured for
+ Google Cloud organizations. Once configured, it applies to all
+ projects and folders in the Google Cloud organization.
- See `Enabling CMEK for Logs
+ See `Enabling CMEK for Log
Router `__
for more information.
@@ -1150,14 +1540,184 @@ class CmekSettings(proto.Message):
The resource name for the configured Cloud KMS key.
KMS key name format:
- "projects/[PROJECT_ID]/locations/[LOCATION]/keyRings/[KEYRING]/cryptoKeys/[KEY]"
+
+ ::
+
+ "projects/[PROJECT_ID]/locations/[LOCATION]/keyRings/[KEYRING]/cryptoKeys/[KEY]"
+
+ For example:
+
+ ``"projects/my-project/locations/us-central1/keyRings/my-ring/cryptoKeys/my-key"``
+
+ To enable CMEK for the Log Router, set this field to a valid
+ ``kms_key_name`` for which the associated service account
+ has the required cloudkms.cryptoKeyEncrypterDecrypter roles
+ assigned for the key.
+
+ The Cloud KMS key used by the Log Router can be updated by
+ changing the ``kms_key_name`` to a new valid key name or
+ disabled by setting the key name to an empty string.
+ Encryption operations that are in progress will be completed
+ with the key that was in use when they started. Decryption
+ operations will be completed using the key that was used at
+ the time of encryption unless access to that key has been
+ revoked.
+
+ To disable CMEK for the Log Router, set this field to an
+ empty string.
+
+ See `Enabling CMEK for Log
+ Router `__
+ for more information.
+ service_account_id (str):
+ Output only. The service account that will be used by the
+ Log Router to access your Cloud KMS key.
+
+ Before enabling CMEK for Log Router, you must first assign
+ the cloudkms.cryptoKeyEncrypterDecrypter role to the service
+ account that the Log Router will use to access your Cloud
+ KMS key. Use
+ [GetCmekSettings][google.logging.v2.ConfigServiceV2.GetCmekSettings]
+ to obtain the service account ID.
+
+ See `Enabling CMEK for Log
+ Router `__
+ for more information.
+ """
+
+ name = proto.Field(
+ proto.STRING,
+ number=1,
+ )
+ kms_key_name = proto.Field(
+ proto.STRING,
+ number=2,
+ )
+ service_account_id = proto.Field(
+ proto.STRING,
+ number=3,
+ )
+
+
+class GetSettingsRequest(proto.Message):
+ r"""The parameters to
+ [GetSettings][google.logging.v2.ConfigServiceV2.GetSettings].
+
+ See `Enabling CMEK for Log
+ Router `__
+ for more information.
+
+ Attributes:
+ name (str):
+ Required. The resource for which to retrieve settings.
+
+ ::
+
+ "projects/[PROJECT_ID]/settings"
+ "organizations/[ORGANIZATION_ID]/settings"
+ "billingAccounts/[BILLING_ACCOUNT_ID]/settings"
+ "folders/[FOLDER_ID]/settings"
+
+ For example:
+
+ ``"organizations/12345/settings"``
+
+ Note: Settings for the Log Router can be get for Google
+ Cloud projects, folders, organizations and billing accounts.
+ Currently it can only be configured for organizations. Once
+ configured for an organization, it applies to all projects
+ and folders in the Google Cloud organization.
+ """
+
+ name = proto.Field(
+ proto.STRING,
+ number=1,
+ )
+
+
+class UpdateSettingsRequest(proto.Message):
+ r"""The parameters to
+ [UpdateSettings][google.logging.v2.ConfigServiceV2.UpdateSettings].
+
+ See `Enabling CMEK for Log
+ Router `__
+ for more information.
+
+ Attributes:
+ name (str):
+ Required. The resource name for the settings to update.
+
+ ::
+
+ "organizations/[ORGANIZATION_ID]/settings"
+
+ For example:
+
+ ``"organizations/12345/settings"``
+
+ Note: Settings for the Log Router can currently only be
+ configured for Google Cloud organizations. Once configured,
+ it applies to all projects and folders in the Google Cloud
+ organization.
+ settings (google.cloud.logging_v2.types.Settings):
+ Required. The settings to update.
+
+ See `Enabling CMEK for Log
+ Router `__
+ for more information.
+ update_mask (google.protobuf.field_mask_pb2.FieldMask):
+ Optional. Field mask identifying which fields from
+ ``settings`` should be updated. A field will be overwritten
+ if and only if it is in the update mask. Output only fields
+ cannot be updated.
+
+ See [FieldMask][google.protobuf.FieldMask] for more
+ information.
+
+ For example: ``"updateMask=kmsKeyName"``
+ """
+
+ name = proto.Field(
+ proto.STRING,
+ number=1,
+ )
+ settings = proto.Field(
+ proto.MESSAGE,
+ number=2,
+ message="Settings",
+ )
+ update_mask = proto.Field(
+ proto.MESSAGE,
+ number=3,
+ message=field_mask_pb2.FieldMask,
+ )
+
+
+class Settings(proto.Message):
+ r"""Describes the settings associated with a project, folder,
+ organization, billing account, or flexible resource.
+
+ Attributes:
+ name (str):
+ Output only. The resource name of the
+ settings.
+ kms_key_name (str):
+ Optional. The resource name for the configured Cloud KMS
+ key.
+
+ KMS key name format:
+
+ ::
+
+ "projects/[PROJECT_ID]/locations/[LOCATION]/keyRings/[KEYRING]/cryptoKeys/[KEY]"
For example:
- ``"projects/my-project-id/locations/my-region/keyRings/key-ring-name/cryptoKeys/key-name"``
- To enable CMEK for the Logs Router, set this field to a
- valid ``kms_key_name`` for which the associated service
- account has the required
+ ``"projects/my-project/locations/us-central1/keyRings/my-ring/cryptoKeys/my-key"``
+
+ To enable CMEK for the Log Router, set this field to a valid
+ ``kms_key_name`` for which the associated service account
+ has the required
``roles/cloudkms.cryptoKeyEncrypterDecrypter`` role assigned
for the key.
@@ -1169,31 +1729,170 @@ class CmekSettings(proto.Message):
the time of encryption unless access to that key has been
revoked.
- To disable CMEK for the Logs Router, set this field to an
+ To disable CMEK for the Log Router, set this field to an
empty string.
- See `Enabling CMEK for Logs
+ See `Enabling CMEK for Log
Router `__
for more information.
- service_account_id (str):
+ kms_service_account_id (str):
Output only. The service account that will be used by the
- Logs Router to access your Cloud KMS key.
+ Log Router to access your Cloud KMS key.
- Before enabling CMEK for Logs Router, you must first assign
+ Before enabling CMEK for Log Router, you must first assign
the role ``roles/cloudkms.cryptoKeyEncrypterDecrypter`` to
- the service account that the Logs Router will use to access
+ the service account that the Log Router will use to access
your Cloud KMS key. Use
- [GetCmekSettings][google.logging.v2.ConfigServiceV2.GetCmekSettings]
+ [GetSettings][google.logging.v2.ConfigServiceV2.GetSettings]
to obtain the service account ID.
- See `Enabling CMEK for Logs
+ See `Enabling CMEK for Log
Router `__
for more information.
+ storage_location (str):
+ Optional. The Cloud region that will be used for \_Default
+ and \_Required log buckets for newly created projects and
+ folders. For example ``europe-west1``. This setting does not
+ affect the location of custom log buckets.
+ disable_default_sink (bool):
+ Optional. If set to true, the \_Default sink in newly
+ created projects and folders will created in a disabled
+ state. This can be used to automatically disable log
+ ingestion if there is already an aggregated sink configured
+ in the hierarchy. The \_Default sink can be re-enabled
+ manually if needed.
"""
- name = proto.Field(proto.STRING, number=1,)
- kms_key_name = proto.Field(proto.STRING, number=2,)
- service_account_id = proto.Field(proto.STRING, number=3,)
+ name = proto.Field(
+ proto.STRING,
+ number=1,
+ )
+ kms_key_name = proto.Field(
+ proto.STRING,
+ number=2,
+ )
+ kms_service_account_id = proto.Field(
+ proto.STRING,
+ number=3,
+ )
+ storage_location = proto.Field(
+ proto.STRING,
+ number=4,
+ )
+ disable_default_sink = proto.Field(
+ proto.BOOL,
+ number=5,
+ )
+
+
+class CopyLogEntriesRequest(proto.Message):
+ r"""The parameters to CopyLogEntries.
+
+ Attributes:
+ name (str):
+ Required. Log bucket from which to copy log entries.
+
+ For example:
+
+ ``"projects/my-project/locations/global/buckets/my-source-bucket"``
+ filter (str):
+ Optional. A filter specifying which log
+ entries to copy. The filter must be no more than
+ 20k characters. An empty filter matches all log
+ entries.
+ destination (str):
+ Required. Destination to which to copy log
+ entries.
+ """
+
+ name = proto.Field(
+ proto.STRING,
+ number=1,
+ )
+ filter = proto.Field(
+ proto.STRING,
+ number=3,
+ )
+ destination = proto.Field(
+ proto.STRING,
+ number=4,
+ )
+
+
+class CopyLogEntriesMetadata(proto.Message):
+ r"""Metadata for CopyLogEntries long running operations.
+
+ Attributes:
+ start_time (google.protobuf.timestamp_pb2.Timestamp):
+ The create time of an operation.
+ end_time (google.protobuf.timestamp_pb2.Timestamp):
+ The end time of an operation.
+ state (google.cloud.logging_v2.types.OperationState):
+ State of an operation.
+ cancellation_requested (bool):
+ Identifies whether the user has requested
+ cancellation of the operation.
+ request (google.cloud.logging_v2.types.CopyLogEntriesRequest):
+ CopyLogEntries RPC request.
+ progress (int):
+ Estimated progress of the operation (0 -
+ 100%).
+ writer_identity (str):
+ The IAM identity of a service account that must be granted
+ access to the destination.
+
+ If the service account is not granted permission to the
+ destination within an hour, the operation will be cancelled.
+
+ For example: ``"serviceAccount:foo@bar.com"``
+ """
+
+ start_time = proto.Field(
+ proto.MESSAGE,
+ number=1,
+ message=timestamp_pb2.Timestamp,
+ )
+ end_time = proto.Field(
+ proto.MESSAGE,
+ number=2,
+ message=timestamp_pb2.Timestamp,
+ )
+ state = proto.Field(
+ proto.ENUM,
+ number=3,
+ enum="OperationState",
+ )
+ cancellation_requested = proto.Field(
+ proto.BOOL,
+ number=4,
+ )
+ request = proto.Field(
+ proto.MESSAGE,
+ number=5,
+ message="CopyLogEntriesRequest",
+ )
+ progress = proto.Field(
+ proto.INT32,
+ number=6,
+ )
+ writer_identity = proto.Field(
+ proto.STRING,
+ number=7,
+ )
+
+
+class CopyLogEntriesResponse(proto.Message):
+ r"""Response type for CopyLogEntries long running operations.
+
+ Attributes:
+ log_entries_copied_count (int):
+ Number of log entries copied.
+ """
+
+ log_entries_copied_count = proto.Field(
+ proto.INT64,
+ number=1,
+ )
__all__ = tuple(sorted(__protobuf__.manifest))
diff --git a/google/cloud/logging_v2/types/logging_metrics.py b/google/cloud/logging_v2/types/logging_metrics.py
index 26d855680..bcad752b3 100644
--- a/google/cloud/logging_v2/types/logging_metrics.py
+++ b/google/cloud/logging_v2/types/logging_metrics.py
@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
-# Copyright 2020 Google LLC
+# Copyright 2022 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -55,12 +55,12 @@ class LogMetric(proto.Message):
forward-slash character (``/``) denotes a hierarchy of name
pieces, and it cannot be the first character of the name.
- The metric identifier in this field must not be
- `URL-encoded `__.
- However, when the metric identifier appears as the
- ``[METRIC_ID]`` part of a ``metric_name`` API parameter,
- then the metric identifier must be URL-encoded. Example:
- ``"projects/my-project/metrics/nginx%2Frequests"``.
+ This field is the ``[METRIC_ID]`` part of a metric resource
+ name in the format
+ "projects/[PROJECT_ID]/metrics/[METRIC_ID]". Example: If the
+ resource name of a metric is
+ ``"projects/my-project/metrics/nginx%2Frequests"``, this
+ field's value is ``"nginx/requests"``.
description (str):
Optional. A description of this metric, which
is used in documentation. The maximum length of
@@ -75,6 +75,9 @@ class LogMetric(proto.Message):
"resource.type=gae_app AND severity>=ERROR"
The maximum length of the filter is 20000 characters.
+ disabled (bool):
+ Optional. If set to True, then this metric is
+ disabled and it does not generate any points.
metric_descriptor (google.api.metric_pb2.MetricDescriptor):
Optional. The metric descriptor associated with the
logs-based metric. If unspecified, it uses a default metric
@@ -125,7 +128,7 @@ class LogMetric(proto.Message):
Example:
``REGEXP_EXTRACT(jsonPayload.request, ".*quantity=(\d+).*")``
- label_extractors (Sequence[google.cloud.logging_v2.types.LogMetric.LabelExtractorsEntry]):
+ label_extractors (Mapping[str, str]):
Optional. A map from a label key string to an extractor
expression which is used to extract data from a log entry
field and assign as the label value. Each label key
@@ -167,22 +170,56 @@ class ApiVersion(proto.Enum):
V2 = 0
V1 = 1
- name = proto.Field(proto.STRING, number=1,)
- description = proto.Field(proto.STRING, number=2,)
- filter = proto.Field(proto.STRING, number=3,)
+ name = proto.Field(
+ proto.STRING,
+ number=1,
+ )
+ description = proto.Field(
+ proto.STRING,
+ number=2,
+ )
+ filter = proto.Field(
+ proto.STRING,
+ number=3,
+ )
+ disabled = proto.Field(
+ proto.BOOL,
+ number=12,
+ )
metric_descriptor = proto.Field(
- proto.MESSAGE, number=5, message=metric_pb2.MetricDescriptor,
+ proto.MESSAGE,
+ number=5,
+ message=metric_pb2.MetricDescriptor,
+ )
+ value_extractor = proto.Field(
+ proto.STRING,
+ number=6,
+ )
+ label_extractors = proto.MapField(
+ proto.STRING,
+ proto.STRING,
+ number=7,
)
- value_extractor = proto.Field(proto.STRING, number=6,)
- label_extractors = proto.MapField(proto.STRING, proto.STRING, number=7,)
bucket_options = proto.Field(
- proto.MESSAGE, number=8, message=distribution_pb2.Distribution.BucketOptions,
+ proto.MESSAGE,
+ number=8,
+ message=distribution_pb2.Distribution.BucketOptions,
+ )
+ create_time = proto.Field(
+ proto.MESSAGE,
+ number=9,
+ message=timestamp_pb2.Timestamp,
)
- create_time = proto.Field(proto.MESSAGE, number=9, message=timestamp_pb2.Timestamp,)
update_time = proto.Field(
- proto.MESSAGE, number=10, message=timestamp_pb2.Timestamp,
+ proto.MESSAGE,
+ number=10,
+ message=timestamp_pb2.Timestamp,
+ )
+ version = proto.Field(
+ proto.ENUM,
+ number=4,
+ enum=ApiVersion,
)
- version = proto.Field(proto.ENUM, number=4, enum=ApiVersion,)
class ListLogMetricsRequest(proto.Message):
@@ -208,9 +245,18 @@ class ListLogMetricsRequest(proto.Message):
results might be available.
"""
- parent = proto.Field(proto.STRING, number=1,)
- page_token = proto.Field(proto.STRING, number=2,)
- page_size = proto.Field(proto.INT32, number=3,)
+ parent = proto.Field(
+ proto.STRING,
+ number=1,
+ )
+ page_token = proto.Field(
+ proto.STRING,
+ number=2,
+ )
+ page_size = proto.Field(
+ proto.INT32,
+ number=3,
+ )
class ListLogMetricsResponse(proto.Message):
@@ -230,8 +276,15 @@ class ListLogMetricsResponse(proto.Message):
def raw_page(self):
return self
- metrics = proto.RepeatedField(proto.MESSAGE, number=1, message="LogMetric",)
- next_page_token = proto.Field(proto.STRING, number=2,)
+ metrics = proto.RepeatedField(
+ proto.MESSAGE,
+ number=1,
+ message="LogMetric",
+ )
+ next_page_token = proto.Field(
+ proto.STRING,
+ number=2,
+ )
class GetLogMetricRequest(proto.Message):
@@ -246,7 +299,10 @@ class GetLogMetricRequest(proto.Message):
"projects/[PROJECT_ID]/metrics/[METRIC_ID]".
"""
- metric_name = proto.Field(proto.STRING, number=1,)
+ metric_name = proto.Field(
+ proto.STRING,
+ number=1,
+ )
class CreateLogMetricRequest(proto.Message):
@@ -267,8 +323,15 @@ class CreateLogMetricRequest(proto.Message):
must not have an identifier that already exists.
"""
- parent = proto.Field(proto.STRING, number=1,)
- metric = proto.Field(proto.MESSAGE, number=2, message="LogMetric",)
+ parent = proto.Field(
+ proto.STRING,
+ number=1,
+ )
+ metric = proto.Field(
+ proto.MESSAGE,
+ number=2,
+ message="LogMetric",
+ )
class UpdateLogMetricRequest(proto.Message):
@@ -290,8 +353,15 @@ class UpdateLogMetricRequest(proto.Message):
Required. The updated metric.
"""
- metric_name = proto.Field(proto.STRING, number=1,)
- metric = proto.Field(proto.MESSAGE, number=2, message="LogMetric",)
+ metric_name = proto.Field(
+ proto.STRING,
+ number=1,
+ )
+ metric = proto.Field(
+ proto.MESSAGE,
+ number=2,
+ message="LogMetric",
+ )
class DeleteLogMetricRequest(proto.Message):
@@ -306,7 +376,10 @@ class DeleteLogMetricRequest(proto.Message):
"projects/[PROJECT_ID]/metrics/[METRIC_ID]".
"""
- metric_name = proto.Field(proto.STRING, number=1,)
+ metric_name = proto.Field(
+ proto.STRING,
+ number=1,
+ )
__all__ = tuple(sorted(__protobuf__.manifest))
diff --git a/noxfile.py b/noxfile.py
index 96ef7ee7e..6cfcca2ee 100644
--- a/noxfile.py
+++ b/noxfile.py
@@ -20,16 +20,50 @@
import os
import pathlib
import shutil
+import warnings
import nox
-
-BLACK_VERSION = "black==19.10b0"
-BLACK_PATHS = ["docs", "google", "tests", "noxfile.py", "setup.py"]
+BLACK_VERSION = "black==22.3.0"
+ISORT_VERSION = "isort==5.10.1"
+LINT_PATHS = ["docs", "google", "tests", "noxfile.py", "setup.py"]
DEFAULT_PYTHON_VERSION = "3.8"
-SYSTEM_TEST_PYTHON_VERSIONS = ["3.8"]
+
UNIT_TEST_PYTHON_VERSIONS = ["3.6", "3.7", "3.8", "3.9", "3.10"]
+UNIT_TEST_STANDARD_DEPENDENCIES = [
+ "mock",
+ "asyncmock",
+ "pytest",
+ "pytest-cov",
+ "pytest-asyncio",
+]
+UNIT_TEST_EXTERNAL_DEPENDENCIES = [
+ "flask",
+ "webob",
+ "django",
+]
+UNIT_TEST_LOCAL_DEPENDENCIES = []
+UNIT_TEST_DEPENDENCIES = []
+UNIT_TEST_EXTRAS = []
+UNIT_TEST_EXTRAS_BY_PYTHON = {}
+
+SYSTEM_TEST_PYTHON_VERSIONS = ["3.8"]
+SYSTEM_TEST_STANDARD_DEPENDENCIES = [
+ "mock",
+ "pytest",
+ "google-cloud-testutils",
+]
+SYSTEM_TEST_EXTERNAL_DEPENDENCIES = [
+ "google-cloud-bigquery",
+ "google-cloud-pubsub",
+ "google-cloud-storage",
+ "google-cloud-testutils",
+]
+SYSTEM_TEST_LOCAL_DEPENDENCIES = []
+SYSTEM_TEST_DEPENDENCIES = []
+SYSTEM_TEST_EXTRAS = []
+SYSTEM_TEST_EXTRAS_BY_PYTHON = {}
CURRENT_DIRECTORY = pathlib.Path(__file__).parent.absolute()
@@ -57,7 +91,9 @@ def lint(session):
"""
session.install("flake8", BLACK_VERSION)
session.run(
- "black", "--check", *BLACK_PATHS,
+ "black",
+ "--check",
+ *LINT_PATHS,
)
session.run("flake8", "google", "tests")
@@ -67,7 +103,28 @@ def blacken(session):
"""Run black. Format code to uniform standard."""
session.install(BLACK_VERSION)
session.run(
- "black", *BLACK_PATHS,
+ "black",
+ *LINT_PATHS,
+ )
+
+
+@nox.session(python=DEFAULT_PYTHON_VERSION)
+def format(session):
+ """
+ Run isort to sort imports. Then run black
+ to format code to uniform standard.
+ """
+ session.install(BLACK_VERSION, ISORT_VERSION)
+ # Use the --fss option to sort imports using strict alphabetical order.
+ # See https://pycqa.github.io/isort/docs/configuration/options.html#force-sort-within-sections
+ session.run(
+ "isort",
+ "--fss",
+ *LINT_PATHS,
+ )
+ session.run(
+ "black",
+ *LINT_PATHS,
)
@@ -78,26 +135,41 @@ def lint_setup_py(session):
session.run("python", "setup.py", "check", "--restructuredtext", "--strict")
+def install_unittest_dependencies(session, *constraints):
+ standard_deps = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_DEPENDENCIES
+ session.install(*standard_deps, *constraints)
+
+ if UNIT_TEST_EXTERNAL_DEPENDENCIES:
+ warnings.warn(
+ "'unit_test_external_dependencies' is deprecated. Instead, please "
+ "use 'unit_test_dependencies' or 'unit_test_local_dependencies'.",
+ DeprecationWarning,
+ )
+ session.install(*UNIT_TEST_EXTERNAL_DEPENDENCIES, *constraints)
+
+ if UNIT_TEST_LOCAL_DEPENDENCIES:
+ session.install(*UNIT_TEST_LOCAL_DEPENDENCIES, *constraints)
+
+ if UNIT_TEST_EXTRAS_BY_PYTHON:
+ extras = UNIT_TEST_EXTRAS_BY_PYTHON.get(session.python, [])
+ elif UNIT_TEST_EXTRAS:
+ extras = UNIT_TEST_EXTRAS
+ else:
+ extras = []
+
+ if extras:
+ session.install("-e", f".[{','.join(extras)}]", *constraints)
+ else:
+ session.install("-e", ".", *constraints)
+
+
def default(session):
# Install all test dependencies, then install this package in-place.
constraints_path = str(
CURRENT_DIRECTORY / "testing" / f"constraints-{session.python}.txt"
)
- session.install(
- "mock",
- "asyncmock",
- "pytest",
- "pytest-cov",
- "pytest-asyncio",
- "-c",
- constraints_path,
- )
- session.install("flask", "-c", constraints_path)
- session.install("webob", "-c", constraints_path)
- session.install("django", "-c", constraints_path)
-
- session.install("-e", ".", "-c", constraints_path)
+ install_unittest_dependencies(session, "-c", constraints_path)
# Run py.test against the unit tests.
session.run(
@@ -121,6 +193,35 @@ def unit(session):
default(session)
+def install_systemtest_dependencies(session, *constraints):
+
+ # Use pre-release gRPC for system tests.
+ session.install("--pre", "grpcio")
+
+ session.install(*SYSTEM_TEST_STANDARD_DEPENDENCIES, *constraints)
+
+ if SYSTEM_TEST_EXTERNAL_DEPENDENCIES:
+ session.install(*SYSTEM_TEST_EXTERNAL_DEPENDENCIES, *constraints)
+
+ if SYSTEM_TEST_LOCAL_DEPENDENCIES:
+ session.install("-e", *SYSTEM_TEST_LOCAL_DEPENDENCIES, *constraints)
+
+ if SYSTEM_TEST_DEPENDENCIES:
+ session.install("-e", *SYSTEM_TEST_DEPENDENCIES, *constraints)
+
+ if SYSTEM_TEST_EXTRAS_BY_PYTHON:
+ extras = SYSTEM_TEST_EXTRAS_BY_PYTHON.get(session.python, [])
+ elif SYSTEM_TEST_EXTRAS:
+ extras = SYSTEM_TEST_EXTRAS
+ else:
+ extras = []
+
+ if extras:
+ session.install("-e", f".[{','.join(extras)}]", *constraints)
+ else:
+ session.install("-e", ".", *constraints)
+
+
@nox.session(python=SYSTEM_TEST_PYTHON_VERSIONS)
def system(session):
"""Run the system test suite."""
@@ -143,23 +244,7 @@ def system(session):
if not system_test_exists and not system_test_folder_exists:
session.skip("System tests were not found")
- # Use pre-release gRPC for system tests.
- session.install("--pre", "grpcio")
-
- # Install all test dependencies, then install this package into the
- # virtualenv's dist-packages.
- session.install(
- "mock",
- "pytest",
- "google-cloud-testutils",
- "google-cloud-bigquery",
- "google-cloud-pubsub",
- "google-cloud-storage",
- "google-cloud-testutils",
- "-c",
- constraints_path,
- )
- session.install("-e", ".", "-c", constraints_path)
+ install_systemtest_dependencies(session, "-c", constraints_path)
# Run py.test against the system tests.
if system_test_exists:
diff --git a/owlbot.py b/owlbot.py
index b266ed13f..cf8252bcc 100644
--- a/owlbot.py
+++ b/owlbot.py
@@ -66,6 +66,7 @@
".coveragerc",
"docs/multiprocessing.rst",
".github/workflows", # exclude gh actions as credentials are needed for tests
+ ".github/auto-label.yaml",
])
# adjust .trampolinerc for environment tests
@@ -103,5 +104,7 @@
python.py_samples()
+python.configure_previous_major_version_branches()
+
s.shell.run(["nox", "-s", "blacken"], hide_output=False)
diff --git a/samples/generated_samples/logging_v2_generated_config_service_v2_copy_log_entries_async.py b/samples/generated_samples/logging_v2_generated_config_service_v2_copy_log_entries_async.py
new file mode 100644
index 000000000..abe149bd6
--- /dev/null
+++ b/samples/generated_samples/logging_v2_generated_config_service_v2_copy_log_entries_async.py
@@ -0,0 +1,50 @@
+# -*- coding: utf-8 -*-
+# Copyright 2022 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 CopyLogEntries
+# 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-logging
+
+
+# [START logging_v2_generated_ConfigServiceV2_CopyLogEntries_async]
+from google.cloud import logging_v2
+
+
+async def sample_copy_log_entries():
+ # Create a client
+ client = logging_v2.ConfigServiceV2AsyncClient()
+
+ # Initialize request argument(s)
+ request = logging_v2.CopyLogEntriesRequest(
+ name="name_value",
+ destination="destination_value",
+ )
+
+ # Make the request
+ operation = client.copy_log_entries(request=request)
+
+ print("Waiting for operation to complete...")
+
+ response = await operation.result()
+
+ # Handle the response
+ print(response)
+
+# [END logging_v2_generated_ConfigServiceV2_CopyLogEntries_async]
diff --git a/samples/generated_samples/logging_v2_generated_config_service_v2_copy_log_entries_sync.py b/samples/generated_samples/logging_v2_generated_config_service_v2_copy_log_entries_sync.py
new file mode 100644
index 000000000..90eb5354e
--- /dev/null
+++ b/samples/generated_samples/logging_v2_generated_config_service_v2_copy_log_entries_sync.py
@@ -0,0 +1,50 @@
+# -*- coding: utf-8 -*-
+# Copyright 2022 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 CopyLogEntries
+# 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-logging
+
+
+# [START logging_v2_generated_ConfigServiceV2_CopyLogEntries_sync]
+from google.cloud import logging_v2
+
+
+def sample_copy_log_entries():
+ # Create a client
+ client = logging_v2.ConfigServiceV2Client()
+
+ # Initialize request argument(s)
+ request = logging_v2.CopyLogEntriesRequest(
+ name="name_value",
+ destination="destination_value",
+ )
+
+ # Make the request
+ operation = client.copy_log_entries(request=request)
+
+ print("Waiting for operation to complete...")
+
+ response = operation.result()
+
+ # Handle the response
+ print(response)
+
+# [END logging_v2_generated_ConfigServiceV2_CopyLogEntries_sync]
diff --git a/samples/generated_samples/logging_v2_generated_config_service_v2_create_bucket_async.py b/samples/generated_samples/logging_v2_generated_config_service_v2_create_bucket_async.py
new file mode 100644
index 000000000..1c5c329c8
--- /dev/null
+++ b/samples/generated_samples/logging_v2_generated_config_service_v2_create_bucket_async.py
@@ -0,0 +1,46 @@
+# -*- coding: utf-8 -*-
+# Copyright 2022 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 CreateBucket
+# 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-logging
+
+
+# [START logging_v2_generated_ConfigServiceV2_CreateBucket_async]
+from google.cloud import logging_v2
+
+
+async def sample_create_bucket():
+ # Create a client
+ client = logging_v2.ConfigServiceV2AsyncClient()
+
+ # Initialize request argument(s)
+ request = logging_v2.CreateBucketRequest(
+ parent="parent_value",
+ bucket_id="bucket_id_value",
+ )
+
+ # Make the request
+ response = await client.create_bucket(request=request)
+
+ # Handle the response
+ print(response)
+
+# [END logging_v2_generated_ConfigServiceV2_CreateBucket_async]
diff --git a/samples/generated_samples/logging_v2_generated_config_service_v2_create_bucket_sync.py b/samples/generated_samples/logging_v2_generated_config_service_v2_create_bucket_sync.py
new file mode 100644
index 000000000..9b3093229
--- /dev/null
+++ b/samples/generated_samples/logging_v2_generated_config_service_v2_create_bucket_sync.py
@@ -0,0 +1,46 @@
+# -*- coding: utf-8 -*-
+# Copyright 2022 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 CreateBucket
+# 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-logging
+
+
+# [START logging_v2_generated_ConfigServiceV2_CreateBucket_sync]
+from google.cloud import logging_v2
+
+
+def sample_create_bucket():
+ # Create a client
+ client = logging_v2.ConfigServiceV2Client()
+
+ # Initialize request argument(s)
+ request = logging_v2.CreateBucketRequest(
+ parent="parent_value",
+ bucket_id="bucket_id_value",
+ )
+
+ # Make the request
+ response = client.create_bucket(request=request)
+
+ # Handle the response
+ print(response)
+
+# [END logging_v2_generated_ConfigServiceV2_CreateBucket_sync]
diff --git a/samples/generated_samples/logging_v2_generated_config_service_v2_create_exclusion_async.py b/samples/generated_samples/logging_v2_generated_config_service_v2_create_exclusion_async.py
new file mode 100644
index 000000000..5be1a9ad3
--- /dev/null
+++ b/samples/generated_samples/logging_v2_generated_config_service_v2_create_exclusion_async.py
@@ -0,0 +1,50 @@
+# -*- coding: utf-8 -*-
+# Copyright 2022 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 CreateExclusion
+# 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-logging
+
+
+# [START logging_v2_generated_ConfigServiceV2_CreateExclusion_async]
+from google.cloud import logging_v2
+
+
+async def sample_create_exclusion():
+ # Create a client
+ client = logging_v2.ConfigServiceV2AsyncClient()
+
+ # Initialize request argument(s)
+ exclusion = logging_v2.LogExclusion()
+ exclusion.name = "name_value"
+ exclusion.filter = "filter_value"
+
+ request = logging_v2.CreateExclusionRequest(
+ parent="parent_value",
+ exclusion=exclusion,
+ )
+
+ # Make the request
+ response = await client.create_exclusion(request=request)
+
+ # Handle the response
+ print(response)
+
+# [END logging_v2_generated_ConfigServiceV2_CreateExclusion_async]
diff --git a/samples/generated_samples/logging_v2_generated_config_service_v2_create_exclusion_sync.py b/samples/generated_samples/logging_v2_generated_config_service_v2_create_exclusion_sync.py
new file mode 100644
index 000000000..3b57560f3
--- /dev/null
+++ b/samples/generated_samples/logging_v2_generated_config_service_v2_create_exclusion_sync.py
@@ -0,0 +1,50 @@
+# -*- coding: utf-8 -*-
+# Copyright 2022 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 CreateExclusion
+# 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-logging
+
+
+# [START logging_v2_generated_ConfigServiceV2_CreateExclusion_sync]
+from google.cloud import logging_v2
+
+
+def sample_create_exclusion():
+ # Create a client
+ client = logging_v2.ConfigServiceV2Client()
+
+ # Initialize request argument(s)
+ exclusion = logging_v2.LogExclusion()
+ exclusion.name = "name_value"
+ exclusion.filter = "filter_value"
+
+ request = logging_v2.CreateExclusionRequest(
+ parent="parent_value",
+ exclusion=exclusion,
+ )
+
+ # Make the request
+ response = client.create_exclusion(request=request)
+
+ # Handle the response
+ print(response)
+
+# [END logging_v2_generated_ConfigServiceV2_CreateExclusion_sync]
diff --git a/samples/generated_samples/logging_v2_generated_config_service_v2_create_sink_async.py b/samples/generated_samples/logging_v2_generated_config_service_v2_create_sink_async.py
new file mode 100644
index 000000000..789598d4c
--- /dev/null
+++ b/samples/generated_samples/logging_v2_generated_config_service_v2_create_sink_async.py
@@ -0,0 +1,50 @@
+# -*- coding: utf-8 -*-
+# Copyright 2022 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 CreateSink
+# 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-logging
+
+
+# [START logging_v2_generated_ConfigServiceV2_CreateSink_async]
+from google.cloud import logging_v2
+
+
+async def sample_create_sink():
+ # Create a client
+ client = logging_v2.ConfigServiceV2AsyncClient()
+
+ # Initialize request argument(s)
+ sink = logging_v2.LogSink()
+ sink.name = "name_value"
+ sink.destination = "destination_value"
+
+ request = logging_v2.CreateSinkRequest(
+ parent="parent_value",
+ sink=sink,
+ )
+
+ # Make the request
+ response = await client.create_sink(request=request)
+
+ # Handle the response
+ print(response)
+
+# [END logging_v2_generated_ConfigServiceV2_CreateSink_async]
diff --git a/samples/generated_samples/logging_v2_generated_config_service_v2_create_sink_sync.py b/samples/generated_samples/logging_v2_generated_config_service_v2_create_sink_sync.py
new file mode 100644
index 000000000..e22bc6055
--- /dev/null
+++ b/samples/generated_samples/logging_v2_generated_config_service_v2_create_sink_sync.py
@@ -0,0 +1,50 @@
+# -*- coding: utf-8 -*-
+# Copyright 2022 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 CreateSink
+# 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-logging
+
+
+# [START logging_v2_generated_ConfigServiceV2_CreateSink_sync]
+from google.cloud import logging_v2
+
+
+def sample_create_sink():
+ # Create a client
+ client = logging_v2.ConfigServiceV2Client()
+
+ # Initialize request argument(s)
+ sink = logging_v2.LogSink()
+ sink.name = "name_value"
+ sink.destination = "destination_value"
+
+ request = logging_v2.CreateSinkRequest(
+ parent="parent_value",
+ sink=sink,
+ )
+
+ # Make the request
+ response = client.create_sink(request=request)
+
+ # Handle the response
+ print(response)
+
+# [END logging_v2_generated_ConfigServiceV2_CreateSink_sync]
diff --git a/samples/generated_samples/logging_v2_generated_config_service_v2_create_view_async.py b/samples/generated_samples/logging_v2_generated_config_service_v2_create_view_async.py
new file mode 100644
index 000000000..499d4eeba
--- /dev/null
+++ b/samples/generated_samples/logging_v2_generated_config_service_v2_create_view_async.py
@@ -0,0 +1,46 @@
+# -*- coding: utf-8 -*-
+# Copyright 2022 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 CreateView
+# 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-logging
+
+
+# [START logging_v2_generated_ConfigServiceV2_CreateView_async]
+from google.cloud import logging_v2
+
+
+async def sample_create_view():
+ # Create a client
+ client = logging_v2.ConfigServiceV2AsyncClient()
+
+ # Initialize request argument(s)
+ request = logging_v2.CreateViewRequest(
+ parent="parent_value",
+ view_id="view_id_value",
+ )
+
+ # Make the request
+ response = await client.create_view(request=request)
+
+ # Handle the response
+ print(response)
+
+# [END logging_v2_generated_ConfigServiceV2_CreateView_async]
diff --git a/samples/generated_samples/logging_v2_generated_config_service_v2_create_view_sync.py b/samples/generated_samples/logging_v2_generated_config_service_v2_create_view_sync.py
new file mode 100644
index 000000000..8e6425d71
--- /dev/null
+++ b/samples/generated_samples/logging_v2_generated_config_service_v2_create_view_sync.py
@@ -0,0 +1,46 @@
+# -*- coding: utf-8 -*-
+# Copyright 2022 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 CreateView
+# 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-logging
+
+
+# [START logging_v2_generated_ConfigServiceV2_CreateView_sync]
+from google.cloud import logging_v2
+
+
+def sample_create_view():
+ # Create a client
+ client = logging_v2.ConfigServiceV2Client()
+
+ # Initialize request argument(s)
+ request = logging_v2.CreateViewRequest(
+ parent="parent_value",
+ view_id="view_id_value",
+ )
+
+ # Make the request
+ response = client.create_view(request=request)
+
+ # Handle the response
+ print(response)
+
+# [END logging_v2_generated_ConfigServiceV2_CreateView_sync]
diff --git a/samples/generated_samples/logging_v2_generated_config_service_v2_delete_bucket_async.py b/samples/generated_samples/logging_v2_generated_config_service_v2_delete_bucket_async.py
new file mode 100644
index 000000000..def3e5abc
--- /dev/null
+++ b/samples/generated_samples/logging_v2_generated_config_service_v2_delete_bucket_async.py
@@ -0,0 +1,43 @@
+# -*- coding: utf-8 -*-
+# Copyright 2022 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 DeleteBucket
+# 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-logging
+
+
+# [START logging_v2_generated_ConfigServiceV2_DeleteBucket_async]
+from google.cloud import logging_v2
+
+
+async def sample_delete_bucket():
+ # Create a client
+ client = logging_v2.ConfigServiceV2AsyncClient()
+
+ # Initialize request argument(s)
+ request = logging_v2.DeleteBucketRequest(
+ name="name_value",
+ )
+
+ # Make the request
+ await client.delete_bucket(request=request)
+
+
+# [END logging_v2_generated_ConfigServiceV2_DeleteBucket_async]
diff --git a/samples/generated_samples/logging_v2_generated_config_service_v2_delete_bucket_sync.py b/samples/generated_samples/logging_v2_generated_config_service_v2_delete_bucket_sync.py
new file mode 100644
index 000000000..64c95c992
--- /dev/null
+++ b/samples/generated_samples/logging_v2_generated_config_service_v2_delete_bucket_sync.py
@@ -0,0 +1,43 @@
+# -*- coding: utf-8 -*-
+# Copyright 2022 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 DeleteBucket
+# 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-logging
+
+
+# [START logging_v2_generated_ConfigServiceV2_DeleteBucket_sync]
+from google.cloud import logging_v2
+
+
+def sample_delete_bucket():
+ # Create a client
+ client = logging_v2.ConfigServiceV2Client()
+
+ # Initialize request argument(s)
+ request = logging_v2.DeleteBucketRequest(
+ name="name_value",
+ )
+
+ # Make the request
+ client.delete_bucket(request=request)
+
+
+# [END logging_v2_generated_ConfigServiceV2_DeleteBucket_sync]
diff --git a/samples/generated_samples/logging_v2_generated_config_service_v2_delete_exclusion_async.py b/samples/generated_samples/logging_v2_generated_config_service_v2_delete_exclusion_async.py
new file mode 100644
index 000000000..4c042c3be
--- /dev/null
+++ b/samples/generated_samples/logging_v2_generated_config_service_v2_delete_exclusion_async.py
@@ -0,0 +1,43 @@
+# -*- coding: utf-8 -*-
+# Copyright 2022 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 DeleteExclusion
+# 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-logging
+
+
+# [START logging_v2_generated_ConfigServiceV2_DeleteExclusion_async]
+from google.cloud import logging_v2
+
+
+async def sample_delete_exclusion():
+ # Create a client
+ client = logging_v2.ConfigServiceV2AsyncClient()
+
+ # Initialize request argument(s)
+ request = logging_v2.DeleteExclusionRequest(
+ name="name_value",
+ )
+
+ # Make the request
+ await client.delete_exclusion(request=request)
+
+
+# [END logging_v2_generated_ConfigServiceV2_DeleteExclusion_async]
diff --git a/samples/generated_samples/logging_v2_generated_config_service_v2_delete_exclusion_sync.py b/samples/generated_samples/logging_v2_generated_config_service_v2_delete_exclusion_sync.py
new file mode 100644
index 000000000..dc3136584
--- /dev/null
+++ b/samples/generated_samples/logging_v2_generated_config_service_v2_delete_exclusion_sync.py
@@ -0,0 +1,43 @@
+# -*- coding: utf-8 -*-
+# Copyright 2022 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 DeleteExclusion
+# 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-logging
+
+
+# [START logging_v2_generated_ConfigServiceV2_DeleteExclusion_sync]
+from google.cloud import logging_v2
+
+
+def sample_delete_exclusion():
+ # Create a client
+ client = logging_v2.ConfigServiceV2Client()
+
+ # Initialize request argument(s)
+ request = logging_v2.DeleteExclusionRequest(
+ name="name_value",
+ )
+
+ # Make the request
+ client.delete_exclusion(request=request)
+
+
+# [END logging_v2_generated_ConfigServiceV2_DeleteExclusion_sync]
diff --git a/samples/generated_samples/logging_v2_generated_config_service_v2_delete_sink_async.py b/samples/generated_samples/logging_v2_generated_config_service_v2_delete_sink_async.py
new file mode 100644
index 000000000..fe5acb523
--- /dev/null
+++ b/samples/generated_samples/logging_v2_generated_config_service_v2_delete_sink_async.py
@@ -0,0 +1,43 @@
+# -*- coding: utf-8 -*-
+# Copyright 2022 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 DeleteSink
+# 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-logging
+
+
+# [START logging_v2_generated_ConfigServiceV2_DeleteSink_async]
+from google.cloud import logging_v2
+
+
+async def sample_delete_sink():
+ # Create a client
+ client = logging_v2.ConfigServiceV2AsyncClient()
+
+ # Initialize request argument(s)
+ request = logging_v2.DeleteSinkRequest(
+ sink_name="sink_name_value",
+ )
+
+ # Make the request
+ await client.delete_sink(request=request)
+
+
+# [END logging_v2_generated_ConfigServiceV2_DeleteSink_async]
diff --git a/samples/generated_samples/logging_v2_generated_config_service_v2_delete_sink_sync.py b/samples/generated_samples/logging_v2_generated_config_service_v2_delete_sink_sync.py
new file mode 100644
index 000000000..d9ddc66a0
--- /dev/null
+++ b/samples/generated_samples/logging_v2_generated_config_service_v2_delete_sink_sync.py
@@ -0,0 +1,43 @@
+# -*- coding: utf-8 -*-
+# Copyright 2022 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 DeleteSink
+# 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-logging
+
+
+# [START logging_v2_generated_ConfigServiceV2_DeleteSink_sync]
+from google.cloud import logging_v2
+
+
+def sample_delete_sink():
+ # Create a client
+ client = logging_v2.ConfigServiceV2Client()
+
+ # Initialize request argument(s)
+ request = logging_v2.DeleteSinkRequest(
+ sink_name="sink_name_value",
+ )
+
+ # Make the request
+ client.delete_sink(request=request)
+
+
+# [END logging_v2_generated_ConfigServiceV2_DeleteSink_sync]
diff --git a/samples/generated_samples/logging_v2_generated_config_service_v2_delete_view_async.py b/samples/generated_samples/logging_v2_generated_config_service_v2_delete_view_async.py
new file mode 100644
index 000000000..fd1eee969
--- /dev/null
+++ b/samples/generated_samples/logging_v2_generated_config_service_v2_delete_view_async.py
@@ -0,0 +1,43 @@
+# -*- coding: utf-8 -*-
+# Copyright 2022 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 DeleteView
+# 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-logging
+
+
+# [START logging_v2_generated_ConfigServiceV2_DeleteView_async]
+from google.cloud import logging_v2
+
+
+async def sample_delete_view():
+ # Create a client
+ client = logging_v2.ConfigServiceV2AsyncClient()
+
+ # Initialize request argument(s)
+ request = logging_v2.DeleteViewRequest(
+ name="name_value",
+ )
+
+ # Make the request
+ await client.delete_view(request=request)
+
+
+# [END logging_v2_generated_ConfigServiceV2_DeleteView_async]
diff --git a/samples/generated_samples/logging_v2_generated_config_service_v2_delete_view_sync.py b/samples/generated_samples/logging_v2_generated_config_service_v2_delete_view_sync.py
new file mode 100644
index 000000000..1169b4000
--- /dev/null
+++ b/samples/generated_samples/logging_v2_generated_config_service_v2_delete_view_sync.py
@@ -0,0 +1,43 @@
+# -*- coding: utf-8 -*-
+# Copyright 2022 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 DeleteView
+# 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-logging
+
+
+# [START logging_v2_generated_ConfigServiceV2_DeleteView_sync]
+from google.cloud import logging_v2
+
+
+def sample_delete_view():
+ # Create a client
+ client = logging_v2.ConfigServiceV2Client()
+
+ # Initialize request argument(s)
+ request = logging_v2.DeleteViewRequest(
+ name="name_value",
+ )
+
+ # Make the request
+ client.delete_view(request=request)
+
+
+# [END logging_v2_generated_ConfigServiceV2_DeleteView_sync]
diff --git a/samples/generated_samples/logging_v2_generated_config_service_v2_get_bucket_async.py b/samples/generated_samples/logging_v2_generated_config_service_v2_get_bucket_async.py
new file mode 100644
index 000000000..4b964aa74
--- /dev/null
+++ b/samples/generated_samples/logging_v2_generated_config_service_v2_get_bucket_async.py
@@ -0,0 +1,45 @@
+# -*- coding: utf-8 -*-
+# Copyright 2022 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 GetBucket
+# 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-logging
+
+
+# [START logging_v2_generated_ConfigServiceV2_GetBucket_async]
+from google.cloud import logging_v2
+
+
+async def sample_get_bucket():
+ # Create a client
+ client = logging_v2.ConfigServiceV2AsyncClient()
+
+ # Initialize request argument(s)
+ request = logging_v2.GetBucketRequest(
+ name="name_value",
+ )
+
+ # Make the request
+ response = await client.get_bucket(request=request)
+
+ # Handle the response
+ print(response)
+
+# [END logging_v2_generated_ConfigServiceV2_GetBucket_async]
diff --git a/samples/generated_samples/logging_v2_generated_config_service_v2_get_bucket_sync.py b/samples/generated_samples/logging_v2_generated_config_service_v2_get_bucket_sync.py
new file mode 100644
index 000000000..1b299dd56
--- /dev/null
+++ b/samples/generated_samples/logging_v2_generated_config_service_v2_get_bucket_sync.py
@@ -0,0 +1,45 @@
+# -*- coding: utf-8 -*-
+# Copyright 2022 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 GetBucket
+# 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-logging
+
+
+# [START logging_v2_generated_ConfigServiceV2_GetBucket_sync]
+from google.cloud import logging_v2
+
+
+def sample_get_bucket():
+ # Create a client
+ client = logging_v2.ConfigServiceV2Client()
+
+ # Initialize request argument(s)
+ request = logging_v2.GetBucketRequest(
+ name="name_value",
+ )
+
+ # Make the request
+ response = client.get_bucket(request=request)
+
+ # Handle the response
+ print(response)
+
+# [END logging_v2_generated_ConfigServiceV2_GetBucket_sync]
diff --git a/samples/generated_samples/logging_v2_generated_config_service_v2_get_cmek_settings_async.py b/samples/generated_samples/logging_v2_generated_config_service_v2_get_cmek_settings_async.py
new file mode 100644
index 000000000..356f0db9f
--- /dev/null
+++ b/samples/generated_samples/logging_v2_generated_config_service_v2_get_cmek_settings_async.py
@@ -0,0 +1,45 @@
+# -*- coding: utf-8 -*-
+# Copyright 2022 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 GetCmekSettings
+# 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-logging
+
+
+# [START logging_v2_generated_ConfigServiceV2_GetCmekSettings_async]
+from google.cloud import logging_v2
+
+
+async def sample_get_cmek_settings():
+ # Create a client
+ client = logging_v2.ConfigServiceV2AsyncClient()
+
+ # Initialize request argument(s)
+ request = logging_v2.GetCmekSettingsRequest(
+ name="name_value",
+ )
+
+ # Make the request
+ response = await client.get_cmek_settings(request=request)
+
+ # Handle the response
+ print(response)
+
+# [END logging_v2_generated_ConfigServiceV2_GetCmekSettings_async]
diff --git a/samples/generated_samples/logging_v2_generated_config_service_v2_get_cmek_settings_sync.py b/samples/generated_samples/logging_v2_generated_config_service_v2_get_cmek_settings_sync.py
new file mode 100644
index 000000000..83dfc8d2c
--- /dev/null
+++ b/samples/generated_samples/logging_v2_generated_config_service_v2_get_cmek_settings_sync.py
@@ -0,0 +1,45 @@
+# -*- coding: utf-8 -*-
+# Copyright 2022 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 GetCmekSettings
+# 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-logging
+
+
+# [START logging_v2_generated_ConfigServiceV2_GetCmekSettings_sync]
+from google.cloud import logging_v2
+
+
+def sample_get_cmek_settings():
+ # Create a client
+ client = logging_v2.ConfigServiceV2Client()
+
+ # Initialize request argument(s)
+ request = logging_v2.GetCmekSettingsRequest(
+ name="name_value",
+ )
+
+ # Make the request
+ response = client.get_cmek_settings(request=request)
+
+ # Handle the response
+ print(response)
+
+# [END logging_v2_generated_ConfigServiceV2_GetCmekSettings_sync]
diff --git a/samples/generated_samples/logging_v2_generated_config_service_v2_get_exclusion_async.py b/samples/generated_samples/logging_v2_generated_config_service_v2_get_exclusion_async.py
new file mode 100644
index 000000000..27a764445
--- /dev/null
+++ b/samples/generated_samples/logging_v2_generated_config_service_v2_get_exclusion_async.py
@@ -0,0 +1,45 @@
+# -*- coding: utf-8 -*-
+# Copyright 2022 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 GetExclusion
+# 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-logging
+
+
+# [START logging_v2_generated_ConfigServiceV2_GetExclusion_async]
+from google.cloud import logging_v2
+
+
+async def sample_get_exclusion():
+ # Create a client
+ client = logging_v2.ConfigServiceV2AsyncClient()
+
+ # Initialize request argument(s)
+ request = logging_v2.GetExclusionRequest(
+ name="name_value",
+ )
+
+ # Make the request
+ response = await client.get_exclusion(request=request)
+
+ # Handle the response
+ print(response)
+
+# [END logging_v2_generated_ConfigServiceV2_GetExclusion_async]
diff --git a/samples/generated_samples/logging_v2_generated_config_service_v2_get_exclusion_sync.py b/samples/generated_samples/logging_v2_generated_config_service_v2_get_exclusion_sync.py
new file mode 100644
index 000000000..980914dac
--- /dev/null
+++ b/samples/generated_samples/logging_v2_generated_config_service_v2_get_exclusion_sync.py
@@ -0,0 +1,45 @@
+# -*- coding: utf-8 -*-
+# Copyright 2022 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 GetExclusion
+# 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-logging
+
+
+# [START logging_v2_generated_ConfigServiceV2_GetExclusion_sync]
+from google.cloud import logging_v2
+
+
+def sample_get_exclusion():
+ # Create a client
+ client = logging_v2.ConfigServiceV2Client()
+
+ # Initialize request argument(s)
+ request = logging_v2.GetExclusionRequest(
+ name="name_value",
+ )
+
+ # Make the request
+ response = client.get_exclusion(request=request)
+
+ # Handle the response
+ print(response)
+
+# [END logging_v2_generated_ConfigServiceV2_GetExclusion_sync]
diff --git a/samples/generated_samples/logging_v2_generated_config_service_v2_get_settings_async.py b/samples/generated_samples/logging_v2_generated_config_service_v2_get_settings_async.py
new file mode 100644
index 000000000..0da6e2a7e
--- /dev/null
+++ b/samples/generated_samples/logging_v2_generated_config_service_v2_get_settings_async.py
@@ -0,0 +1,45 @@
+# -*- coding: utf-8 -*-
+# Copyright 2022 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 GetSettings
+# 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-logging
+
+
+# [START logging_v2_generated_ConfigServiceV2_GetSettings_async]
+from google.cloud import logging_v2
+
+
+async def sample_get_settings():
+ # Create a client
+ client = logging_v2.ConfigServiceV2AsyncClient()
+
+ # Initialize request argument(s)
+ request = logging_v2.GetSettingsRequest(
+ name="name_value",
+ )
+
+ # Make the request
+ response = await client.get_settings(request=request)
+
+ # Handle the response
+ print(response)
+
+# [END logging_v2_generated_ConfigServiceV2_GetSettings_async]
diff --git a/samples/generated_samples/logging_v2_generated_config_service_v2_get_settings_sync.py b/samples/generated_samples/logging_v2_generated_config_service_v2_get_settings_sync.py
new file mode 100644
index 000000000..ccbc05d50
--- /dev/null
+++ b/samples/generated_samples/logging_v2_generated_config_service_v2_get_settings_sync.py
@@ -0,0 +1,45 @@
+# -*- coding: utf-8 -*-
+# Copyright 2022 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 GetSettings
+# 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-logging
+
+
+# [START logging_v2_generated_ConfigServiceV2_GetSettings_sync]
+from google.cloud import logging_v2
+
+
+def sample_get_settings():
+ # Create a client
+ client = logging_v2.ConfigServiceV2Client()
+
+ # Initialize request argument(s)
+ request = logging_v2.GetSettingsRequest(
+ name="name_value",
+ )
+
+ # Make the request
+ response = client.get_settings(request=request)
+
+ # Handle the response
+ print(response)
+
+# [END logging_v2_generated_ConfigServiceV2_GetSettings_sync]
diff --git a/samples/generated_samples/logging_v2_generated_config_service_v2_get_sink_async.py b/samples/generated_samples/logging_v2_generated_config_service_v2_get_sink_async.py
new file mode 100644
index 000000000..fa3d7cf7f
--- /dev/null
+++ b/samples/generated_samples/logging_v2_generated_config_service_v2_get_sink_async.py
@@ -0,0 +1,45 @@
+# -*- coding: utf-8 -*-
+# Copyright 2022 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 GetSink
+# 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-logging
+
+
+# [START logging_v2_generated_ConfigServiceV2_GetSink_async]
+from google.cloud import logging_v2
+
+
+async def sample_get_sink():
+ # Create a client
+ client = logging_v2.ConfigServiceV2AsyncClient()
+
+ # Initialize request argument(s)
+ request = logging_v2.GetSinkRequest(
+ sink_name="sink_name_value",
+ )
+
+ # Make the request
+ response = await client.get_sink(request=request)
+
+ # Handle the response
+ print(response)
+
+# [END logging_v2_generated_ConfigServiceV2_GetSink_async]
diff --git a/samples/generated_samples/logging_v2_generated_config_service_v2_get_sink_sync.py b/samples/generated_samples/logging_v2_generated_config_service_v2_get_sink_sync.py
new file mode 100644
index 000000000..48581e470
--- /dev/null
+++ b/samples/generated_samples/logging_v2_generated_config_service_v2_get_sink_sync.py
@@ -0,0 +1,45 @@
+# -*- coding: utf-8 -*-
+# Copyright 2022 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 GetSink
+# 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-logging
+
+
+# [START logging_v2_generated_ConfigServiceV2_GetSink_sync]
+from google.cloud import logging_v2
+
+
+def sample_get_sink():
+ # Create a client
+ client = logging_v2.ConfigServiceV2Client()
+
+ # Initialize request argument(s)
+ request = logging_v2.GetSinkRequest(
+ sink_name="sink_name_value",
+ )
+
+ # Make the request
+ response = client.get_sink(request=request)
+
+ # Handle the response
+ print(response)
+
+# [END logging_v2_generated_ConfigServiceV2_GetSink_sync]
diff --git a/samples/generated_samples/logging_v2_generated_config_service_v2_get_view_async.py b/samples/generated_samples/logging_v2_generated_config_service_v2_get_view_async.py
new file mode 100644
index 000000000..9f26a5417
--- /dev/null
+++ b/samples/generated_samples/logging_v2_generated_config_service_v2_get_view_async.py
@@ -0,0 +1,45 @@
+# -*- coding: utf-8 -*-
+# Copyright 2022 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 GetView
+# 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-logging
+
+
+# [START logging_v2_generated_ConfigServiceV2_GetView_async]
+from google.cloud import logging_v2
+
+
+async def sample_get_view():
+ # Create a client
+ client = logging_v2.ConfigServiceV2AsyncClient()
+
+ # Initialize request argument(s)
+ request = logging_v2.GetViewRequest(
+ name="name_value",
+ )
+
+ # Make the request
+ response = await client.get_view(request=request)
+
+ # Handle the response
+ print(response)
+
+# [END logging_v2_generated_ConfigServiceV2_GetView_async]
diff --git a/samples/generated_samples/logging_v2_generated_config_service_v2_get_view_sync.py b/samples/generated_samples/logging_v2_generated_config_service_v2_get_view_sync.py
new file mode 100644
index 000000000..f88c15d2e
--- /dev/null
+++ b/samples/generated_samples/logging_v2_generated_config_service_v2_get_view_sync.py
@@ -0,0 +1,45 @@
+# -*- coding: utf-8 -*-
+# Copyright 2022 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 GetView
+# 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-logging
+
+
+# [START logging_v2_generated_ConfigServiceV2_GetView_sync]
+from google.cloud import logging_v2
+
+
+def sample_get_view():
+ # Create a client
+ client = logging_v2.ConfigServiceV2Client()
+
+ # Initialize request argument(s)
+ request = logging_v2.GetViewRequest(
+ name="name_value",
+ )
+
+ # Make the request
+ response = client.get_view(request=request)
+
+ # Handle the response
+ print(response)
+
+# [END logging_v2_generated_ConfigServiceV2_GetView_sync]
diff --git a/samples/generated_samples/logging_v2_generated_config_service_v2_list_buckets_async.py b/samples/generated_samples/logging_v2_generated_config_service_v2_list_buckets_async.py
new file mode 100644
index 000000000..4e3bfea55
--- /dev/null
+++ b/samples/generated_samples/logging_v2_generated_config_service_v2_list_buckets_async.py
@@ -0,0 +1,46 @@
+# -*- coding: utf-8 -*-
+# Copyright 2022 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 ListBuckets
+# 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-logging
+
+
+# [START logging_v2_generated_ConfigServiceV2_ListBuckets_async]
+from google.cloud import logging_v2
+
+
+async def sample_list_buckets():
+ # Create a client
+ client = logging_v2.ConfigServiceV2AsyncClient()
+
+ # Initialize request argument(s)
+ request = logging_v2.ListBucketsRequest(
+ parent="parent_value",
+ )
+
+ # Make the request
+ page_result = client.list_buckets(request=request)
+
+ # Handle the response
+ async for response in page_result:
+ print(response)
+
+# [END logging_v2_generated_ConfigServiceV2_ListBuckets_async]
diff --git a/samples/generated_samples/logging_v2_generated_config_service_v2_list_buckets_sync.py b/samples/generated_samples/logging_v2_generated_config_service_v2_list_buckets_sync.py
new file mode 100644
index 000000000..3522c4c89
--- /dev/null
+++ b/samples/generated_samples/logging_v2_generated_config_service_v2_list_buckets_sync.py
@@ -0,0 +1,46 @@
+# -*- coding: utf-8 -*-
+# Copyright 2022 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 ListBuckets
+# 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-logging
+
+
+# [START logging_v2_generated_ConfigServiceV2_ListBuckets_sync]
+from google.cloud import logging_v2
+
+
+def sample_list_buckets():
+ # Create a client
+ client = logging_v2.ConfigServiceV2Client()
+
+ # Initialize request argument(s)
+ request = logging_v2.ListBucketsRequest(
+ parent="parent_value",
+ )
+
+ # Make the request
+ page_result = client.list_buckets(request=request)
+
+ # Handle the response
+ for response in page_result:
+ print(response)
+
+# [END logging_v2_generated_ConfigServiceV2_ListBuckets_sync]
diff --git a/samples/generated_samples/logging_v2_generated_config_service_v2_list_exclusions_async.py b/samples/generated_samples/logging_v2_generated_config_service_v2_list_exclusions_async.py
new file mode 100644
index 000000000..788436d6a
--- /dev/null
+++ b/samples/generated_samples/logging_v2_generated_config_service_v2_list_exclusions_async.py
@@ -0,0 +1,46 @@
+# -*- coding: utf-8 -*-
+# Copyright 2022 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 ListExclusions
+# 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-logging
+
+
+# [START logging_v2_generated_ConfigServiceV2_ListExclusions_async]
+from google.cloud import logging_v2
+
+
+async def sample_list_exclusions():
+ # Create a client
+ client = logging_v2.ConfigServiceV2AsyncClient()
+
+ # Initialize request argument(s)
+ request = logging_v2.ListExclusionsRequest(
+ parent="parent_value",
+ )
+
+ # Make the request
+ page_result = client.list_exclusions(request=request)
+
+ # Handle the response
+ async for response in page_result:
+ print(response)
+
+# [END logging_v2_generated_ConfigServiceV2_ListExclusions_async]
diff --git a/samples/generated_samples/logging_v2_generated_config_service_v2_list_exclusions_sync.py b/samples/generated_samples/logging_v2_generated_config_service_v2_list_exclusions_sync.py
new file mode 100644
index 000000000..8ea9407a1
--- /dev/null
+++ b/samples/generated_samples/logging_v2_generated_config_service_v2_list_exclusions_sync.py
@@ -0,0 +1,46 @@
+# -*- coding: utf-8 -*-
+# Copyright 2022 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 ListExclusions
+# 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-logging
+
+
+# [START logging_v2_generated_ConfigServiceV2_ListExclusions_sync]
+from google.cloud import logging_v2
+
+
+def sample_list_exclusions():
+ # Create a client
+ client = logging_v2.ConfigServiceV2Client()
+
+ # Initialize request argument(s)
+ request = logging_v2.ListExclusionsRequest(
+ parent="parent_value",
+ )
+
+ # Make the request
+ page_result = client.list_exclusions(request=request)
+
+ # Handle the response
+ for response in page_result:
+ print(response)
+
+# [END logging_v2_generated_ConfigServiceV2_ListExclusions_sync]
diff --git a/samples/generated_samples/logging_v2_generated_config_service_v2_list_sinks_async.py b/samples/generated_samples/logging_v2_generated_config_service_v2_list_sinks_async.py
new file mode 100644
index 000000000..b43b5682a
--- /dev/null
+++ b/samples/generated_samples/logging_v2_generated_config_service_v2_list_sinks_async.py
@@ -0,0 +1,46 @@
+# -*- coding: utf-8 -*-
+# Copyright 2022 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 ListSinks
+# 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-logging
+
+
+# [START logging_v2_generated_ConfigServiceV2_ListSinks_async]
+from google.cloud import logging_v2
+
+
+async def sample_list_sinks():
+ # Create a client
+ client = logging_v2.ConfigServiceV2AsyncClient()
+
+ # Initialize request argument(s)
+ request = logging_v2.ListSinksRequest(
+ parent="parent_value",
+ )
+
+ # Make the request
+ page_result = client.list_sinks(request=request)
+
+ # Handle the response
+ async for response in page_result:
+ print(response)
+
+# [END logging_v2_generated_ConfigServiceV2_ListSinks_async]
diff --git a/samples/generated_samples/logging_v2_generated_config_service_v2_list_sinks_sync.py b/samples/generated_samples/logging_v2_generated_config_service_v2_list_sinks_sync.py
new file mode 100644
index 000000000..235395e6d
--- /dev/null
+++ b/samples/generated_samples/logging_v2_generated_config_service_v2_list_sinks_sync.py
@@ -0,0 +1,46 @@
+# -*- coding: utf-8 -*-
+# Copyright 2022 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 ListSinks
+# 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-logging
+
+
+# [START logging_v2_generated_ConfigServiceV2_ListSinks_sync]
+from google.cloud import logging_v2
+
+
+def sample_list_sinks():
+ # Create a client
+ client = logging_v2.ConfigServiceV2Client()
+
+ # Initialize request argument(s)
+ request = logging_v2.ListSinksRequest(
+ parent="parent_value",
+ )
+
+ # Make the request
+ page_result = client.list_sinks(request=request)
+
+ # Handle the response
+ for response in page_result:
+ print(response)
+
+# [END logging_v2_generated_ConfigServiceV2_ListSinks_sync]
diff --git a/samples/generated_samples/logging_v2_generated_config_service_v2_list_views_async.py b/samples/generated_samples/logging_v2_generated_config_service_v2_list_views_async.py
new file mode 100644
index 000000000..27910c9f7
--- /dev/null
+++ b/samples/generated_samples/logging_v2_generated_config_service_v2_list_views_async.py
@@ -0,0 +1,46 @@
+# -*- coding: utf-8 -*-
+# Copyright 2022 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 ListViews
+# 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-logging
+
+
+# [START logging_v2_generated_ConfigServiceV2_ListViews_async]
+from google.cloud import logging_v2
+
+
+async def sample_list_views():
+ # Create a client
+ client = logging_v2.ConfigServiceV2AsyncClient()
+
+ # Initialize request argument(s)
+ request = logging_v2.ListViewsRequest(
+ parent="parent_value",
+ )
+
+ # Make the request
+ page_result = client.list_views(request=request)
+
+ # Handle the response
+ async for response in page_result:
+ print(response)
+
+# [END logging_v2_generated_ConfigServiceV2_ListViews_async]
diff --git a/samples/generated_samples/logging_v2_generated_config_service_v2_list_views_sync.py b/samples/generated_samples/logging_v2_generated_config_service_v2_list_views_sync.py
new file mode 100644
index 000000000..2e5b6e53b
--- /dev/null
+++ b/samples/generated_samples/logging_v2_generated_config_service_v2_list_views_sync.py
@@ -0,0 +1,46 @@
+# -*- coding: utf-8 -*-
+# Copyright 2022 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 ListViews
+# 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-logging
+
+
+# [START logging_v2_generated_ConfigServiceV2_ListViews_sync]
+from google.cloud import logging_v2
+
+
+def sample_list_views():
+ # Create a client
+ client = logging_v2.ConfigServiceV2Client()
+
+ # Initialize request argument(s)
+ request = logging_v2.ListViewsRequest(
+ parent="parent_value",
+ )
+
+ # Make the request
+ page_result = client.list_views(request=request)
+
+ # Handle the response
+ for response in page_result:
+ print(response)
+
+# [END logging_v2_generated_ConfigServiceV2_ListViews_sync]
diff --git a/samples/generated_samples/logging_v2_generated_config_service_v2_undelete_bucket_async.py b/samples/generated_samples/logging_v2_generated_config_service_v2_undelete_bucket_async.py
new file mode 100644
index 000000000..020866b75
--- /dev/null
+++ b/samples/generated_samples/logging_v2_generated_config_service_v2_undelete_bucket_async.py
@@ -0,0 +1,43 @@
+# -*- coding: utf-8 -*-
+# Copyright 2022 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 UndeleteBucket
+# 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-logging
+
+
+# [START logging_v2_generated_ConfigServiceV2_UndeleteBucket_async]
+from google.cloud import logging_v2
+
+
+async def sample_undelete_bucket():
+ # Create a client
+ client = logging_v2.ConfigServiceV2AsyncClient()
+
+ # Initialize request argument(s)
+ request = logging_v2.UndeleteBucketRequest(
+ name="name_value",
+ )
+
+ # Make the request
+ await client.undelete_bucket(request=request)
+
+
+# [END logging_v2_generated_ConfigServiceV2_UndeleteBucket_async]
diff --git a/samples/generated_samples/logging_v2_generated_config_service_v2_undelete_bucket_sync.py b/samples/generated_samples/logging_v2_generated_config_service_v2_undelete_bucket_sync.py
new file mode 100644
index 000000000..0dfb39a11
--- /dev/null
+++ b/samples/generated_samples/logging_v2_generated_config_service_v2_undelete_bucket_sync.py
@@ -0,0 +1,43 @@
+# -*- coding: utf-8 -*-
+# Copyright 2022 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 UndeleteBucket
+# 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-logging
+
+
+# [START logging_v2_generated_ConfigServiceV2_UndeleteBucket_sync]
+from google.cloud import logging_v2
+
+
+def sample_undelete_bucket():
+ # Create a client
+ client = logging_v2.ConfigServiceV2Client()
+
+ # Initialize request argument(s)
+ request = logging_v2.UndeleteBucketRequest(
+ name="name_value",
+ )
+
+ # Make the request
+ client.undelete_bucket(request=request)
+
+
+# [END logging_v2_generated_ConfigServiceV2_UndeleteBucket_sync]
diff --git a/samples/generated_samples/logging_v2_generated_config_service_v2_update_bucket_async.py b/samples/generated_samples/logging_v2_generated_config_service_v2_update_bucket_async.py
new file mode 100644
index 000000000..78245abfc
--- /dev/null
+++ b/samples/generated_samples/logging_v2_generated_config_service_v2_update_bucket_async.py
@@ -0,0 +1,45 @@
+# -*- coding: utf-8 -*-
+# Copyright 2022 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 UpdateBucket
+# 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-logging
+
+
+# [START logging_v2_generated_ConfigServiceV2_UpdateBucket_async]
+from google.cloud import logging_v2
+
+
+async def sample_update_bucket():
+ # Create a client
+ client = logging_v2.ConfigServiceV2AsyncClient()
+
+ # Initialize request argument(s)
+ request = logging_v2.UpdateBucketRequest(
+ name="name_value",
+ )
+
+ # Make the request
+ response = await client.update_bucket(request=request)
+
+ # Handle the response
+ print(response)
+
+# [END logging_v2_generated_ConfigServiceV2_UpdateBucket_async]
diff --git a/samples/generated_samples/logging_v2_generated_config_service_v2_update_bucket_sync.py b/samples/generated_samples/logging_v2_generated_config_service_v2_update_bucket_sync.py
new file mode 100644
index 000000000..c285fd542
--- /dev/null
+++ b/samples/generated_samples/logging_v2_generated_config_service_v2_update_bucket_sync.py
@@ -0,0 +1,45 @@
+# -*- coding: utf-8 -*-
+# Copyright 2022 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 UpdateBucket
+# 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-logging
+
+
+# [START logging_v2_generated_ConfigServiceV2_UpdateBucket_sync]
+from google.cloud import logging_v2
+
+
+def sample_update_bucket():
+ # Create a client
+ client = logging_v2.ConfigServiceV2Client()
+
+ # Initialize request argument(s)
+ request = logging_v2.UpdateBucketRequest(
+ name="name_value",
+ )
+
+ # Make the request
+ response = client.update_bucket(request=request)
+
+ # Handle the response
+ print(response)
+
+# [END logging_v2_generated_ConfigServiceV2_UpdateBucket_sync]
diff --git a/samples/generated_samples/logging_v2_generated_config_service_v2_update_cmek_settings_async.py b/samples/generated_samples/logging_v2_generated_config_service_v2_update_cmek_settings_async.py
new file mode 100644
index 000000000..8d49b85e7
--- /dev/null
+++ b/samples/generated_samples/logging_v2_generated_config_service_v2_update_cmek_settings_async.py
@@ -0,0 +1,45 @@
+# -*- coding: utf-8 -*-
+# Copyright 2022 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 UpdateCmekSettings
+# 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-logging
+
+
+# [START logging_v2_generated_ConfigServiceV2_UpdateCmekSettings_async]
+from google.cloud import logging_v2
+
+
+async def sample_update_cmek_settings():
+ # Create a client
+ client = logging_v2.ConfigServiceV2AsyncClient()
+
+ # Initialize request argument(s)
+ request = logging_v2.UpdateCmekSettingsRequest(
+ name="name_value",
+ )
+
+ # Make the request
+ response = await client.update_cmek_settings(request=request)
+
+ # Handle the response
+ print(response)
+
+# [END logging_v2_generated_ConfigServiceV2_UpdateCmekSettings_async]
diff --git a/samples/generated_samples/logging_v2_generated_config_service_v2_update_cmek_settings_sync.py b/samples/generated_samples/logging_v2_generated_config_service_v2_update_cmek_settings_sync.py
new file mode 100644
index 000000000..7b04208d4
--- /dev/null
+++ b/samples/generated_samples/logging_v2_generated_config_service_v2_update_cmek_settings_sync.py
@@ -0,0 +1,45 @@
+# -*- coding: utf-8 -*-
+# Copyright 2022 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 UpdateCmekSettings
+# 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-logging
+
+
+# [START logging_v2_generated_ConfigServiceV2_UpdateCmekSettings_sync]
+from google.cloud import logging_v2
+
+
+def sample_update_cmek_settings():
+ # Create a client
+ client = logging_v2.ConfigServiceV2Client()
+
+ # Initialize request argument(s)
+ request = logging_v2.UpdateCmekSettingsRequest(
+ name="name_value",
+ )
+
+ # Make the request
+ response = client.update_cmek_settings(request=request)
+
+ # Handle the response
+ print(response)
+
+# [END logging_v2_generated_ConfigServiceV2_UpdateCmekSettings_sync]
diff --git a/samples/generated_samples/logging_v2_generated_config_service_v2_update_exclusion_async.py b/samples/generated_samples/logging_v2_generated_config_service_v2_update_exclusion_async.py
new file mode 100644
index 000000000..d06cf80d4
--- /dev/null
+++ b/samples/generated_samples/logging_v2_generated_config_service_v2_update_exclusion_async.py
@@ -0,0 +1,50 @@
+# -*- coding: utf-8 -*-
+# Copyright 2022 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 UpdateExclusion
+# 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-logging
+
+
+# [START logging_v2_generated_ConfigServiceV2_UpdateExclusion_async]
+from google.cloud import logging_v2
+
+
+async def sample_update_exclusion():
+ # Create a client
+ client = logging_v2.ConfigServiceV2AsyncClient()
+
+ # Initialize request argument(s)
+ exclusion = logging_v2.LogExclusion()
+ exclusion.name = "name_value"
+ exclusion.filter = "filter_value"
+
+ request = logging_v2.UpdateExclusionRequest(
+ name="name_value",
+ exclusion=exclusion,
+ )
+
+ # Make the request
+ response = await client.update_exclusion(request=request)
+
+ # Handle the response
+ print(response)
+
+# [END logging_v2_generated_ConfigServiceV2_UpdateExclusion_async]
diff --git a/samples/generated_samples/logging_v2_generated_config_service_v2_update_exclusion_sync.py b/samples/generated_samples/logging_v2_generated_config_service_v2_update_exclusion_sync.py
new file mode 100644
index 000000000..c0dba34cc
--- /dev/null
+++ b/samples/generated_samples/logging_v2_generated_config_service_v2_update_exclusion_sync.py
@@ -0,0 +1,50 @@
+# -*- coding: utf-8 -*-
+# Copyright 2022 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 UpdateExclusion
+# 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-logging
+
+
+# [START logging_v2_generated_ConfigServiceV2_UpdateExclusion_sync]
+from google.cloud import logging_v2
+
+
+def sample_update_exclusion():
+ # Create a client
+ client = logging_v2.ConfigServiceV2Client()
+
+ # Initialize request argument(s)
+ exclusion = logging_v2.LogExclusion()
+ exclusion.name = "name_value"
+ exclusion.filter = "filter_value"
+
+ request = logging_v2.UpdateExclusionRequest(
+ name="name_value",
+ exclusion=exclusion,
+ )
+
+ # Make the request
+ response = client.update_exclusion(request=request)
+
+ # Handle the response
+ print(response)
+
+# [END logging_v2_generated_ConfigServiceV2_UpdateExclusion_sync]
diff --git a/samples/generated_samples/logging_v2_generated_config_service_v2_update_settings_async.py b/samples/generated_samples/logging_v2_generated_config_service_v2_update_settings_async.py
new file mode 100644
index 000000000..dba1d4e8e
--- /dev/null
+++ b/samples/generated_samples/logging_v2_generated_config_service_v2_update_settings_async.py
@@ -0,0 +1,45 @@
+# -*- coding: utf-8 -*-
+# Copyright 2022 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 UpdateSettings
+# 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-logging
+
+
+# [START logging_v2_generated_ConfigServiceV2_UpdateSettings_async]
+from google.cloud import logging_v2
+
+
+async def sample_update_settings():
+ # Create a client
+ client = logging_v2.ConfigServiceV2AsyncClient()
+
+ # Initialize request argument(s)
+ request = logging_v2.UpdateSettingsRequest(
+ name="name_value",
+ )
+
+ # Make the request
+ response = await client.update_settings(request=request)
+
+ # Handle the response
+ print(response)
+
+# [END logging_v2_generated_ConfigServiceV2_UpdateSettings_async]
diff --git a/samples/generated_samples/logging_v2_generated_config_service_v2_update_settings_sync.py b/samples/generated_samples/logging_v2_generated_config_service_v2_update_settings_sync.py
new file mode 100644
index 000000000..f70f52036
--- /dev/null
+++ b/samples/generated_samples/logging_v2_generated_config_service_v2_update_settings_sync.py
@@ -0,0 +1,45 @@
+# -*- coding: utf-8 -*-
+# Copyright 2022 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 UpdateSettings
+# 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-logging
+
+
+# [START logging_v2_generated_ConfigServiceV2_UpdateSettings_sync]
+from google.cloud import logging_v2
+
+
+def sample_update_settings():
+ # Create a client
+ client = logging_v2.ConfigServiceV2Client()
+
+ # Initialize request argument(s)
+ request = logging_v2.UpdateSettingsRequest(
+ name="name_value",
+ )
+
+ # Make the request
+ response = client.update_settings(request=request)
+
+ # Handle the response
+ print(response)
+
+# [END logging_v2_generated_ConfigServiceV2_UpdateSettings_sync]
diff --git a/samples/generated_samples/logging_v2_generated_config_service_v2_update_sink_async.py b/samples/generated_samples/logging_v2_generated_config_service_v2_update_sink_async.py
new file mode 100644
index 000000000..c46b9ab42
--- /dev/null
+++ b/samples/generated_samples/logging_v2_generated_config_service_v2_update_sink_async.py
@@ -0,0 +1,50 @@
+# -*- coding: utf-8 -*-
+# Copyright 2022 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 UpdateSink
+# 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-logging
+
+
+# [START logging_v2_generated_ConfigServiceV2_UpdateSink_async]
+from google.cloud import logging_v2
+
+
+async def sample_update_sink():
+ # Create a client
+ client = logging_v2.ConfigServiceV2AsyncClient()
+
+ # Initialize request argument(s)
+ sink = logging_v2.LogSink()
+ sink.name = "name_value"
+ sink.destination = "destination_value"
+
+ request = logging_v2.UpdateSinkRequest(
+ sink_name="sink_name_value",
+ sink=sink,
+ )
+
+ # Make the request
+ response = await client.update_sink(request=request)
+
+ # Handle the response
+ print(response)
+
+# [END logging_v2_generated_ConfigServiceV2_UpdateSink_async]
diff --git a/samples/generated_samples/logging_v2_generated_config_service_v2_update_sink_sync.py b/samples/generated_samples/logging_v2_generated_config_service_v2_update_sink_sync.py
new file mode 100644
index 000000000..9639ece28
--- /dev/null
+++ b/samples/generated_samples/logging_v2_generated_config_service_v2_update_sink_sync.py
@@ -0,0 +1,50 @@
+# -*- coding: utf-8 -*-
+# Copyright 2022 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 UpdateSink
+# 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-logging
+
+
+# [START logging_v2_generated_ConfigServiceV2_UpdateSink_sync]
+from google.cloud import logging_v2
+
+
+def sample_update_sink():
+ # Create a client
+ client = logging_v2.ConfigServiceV2Client()
+
+ # Initialize request argument(s)
+ sink = logging_v2.LogSink()
+ sink.name = "name_value"
+ sink.destination = "destination_value"
+
+ request = logging_v2.UpdateSinkRequest(
+ sink_name="sink_name_value",
+ sink=sink,
+ )
+
+ # Make the request
+ response = client.update_sink(request=request)
+
+ # Handle the response
+ print(response)
+
+# [END logging_v2_generated_ConfigServiceV2_UpdateSink_sync]
diff --git a/samples/generated_samples/logging_v2_generated_config_service_v2_update_view_async.py b/samples/generated_samples/logging_v2_generated_config_service_v2_update_view_async.py
new file mode 100644
index 000000000..250d3f9dc
--- /dev/null
+++ b/samples/generated_samples/logging_v2_generated_config_service_v2_update_view_async.py
@@ -0,0 +1,45 @@
+# -*- coding: utf-8 -*-
+# Copyright 2022 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 UpdateView
+# 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-logging
+
+
+# [START logging_v2_generated_ConfigServiceV2_UpdateView_async]
+from google.cloud import logging_v2
+
+
+async def sample_update_view():
+ # Create a client
+ client = logging_v2.ConfigServiceV2AsyncClient()
+
+ # Initialize request argument(s)
+ request = logging_v2.UpdateViewRequest(
+ name="name_value",
+ )
+
+ # Make the request
+ response = await client.update_view(request=request)
+
+ # Handle the response
+ print(response)
+
+# [END logging_v2_generated_ConfigServiceV2_UpdateView_async]
diff --git a/samples/generated_samples/logging_v2_generated_config_service_v2_update_view_sync.py b/samples/generated_samples/logging_v2_generated_config_service_v2_update_view_sync.py
new file mode 100644
index 000000000..139784880
--- /dev/null
+++ b/samples/generated_samples/logging_v2_generated_config_service_v2_update_view_sync.py
@@ -0,0 +1,45 @@
+# -*- coding: utf-8 -*-
+# Copyright 2022 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 UpdateView
+# 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-logging
+
+
+# [START logging_v2_generated_ConfigServiceV2_UpdateView_sync]
+from google.cloud import logging_v2
+
+
+def sample_update_view():
+ # Create a client
+ client = logging_v2.ConfigServiceV2Client()
+
+ # Initialize request argument(s)
+ request = logging_v2.UpdateViewRequest(
+ name="name_value",
+ )
+
+ # Make the request
+ response = client.update_view(request=request)
+
+ # Handle the response
+ print(response)
+
+# [END logging_v2_generated_ConfigServiceV2_UpdateView_sync]
diff --git a/samples/generated_samples/logging_v2_generated_logging_service_v2_delete_log_async.py b/samples/generated_samples/logging_v2_generated_logging_service_v2_delete_log_async.py
new file mode 100644
index 000000000..6338b9abc
--- /dev/null
+++ b/samples/generated_samples/logging_v2_generated_logging_service_v2_delete_log_async.py
@@ -0,0 +1,43 @@
+# -*- coding: utf-8 -*-
+# Copyright 2022 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 DeleteLog
+# 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-logging
+
+
+# [START logging_v2_generated_LoggingServiceV2_DeleteLog_async]
+from google.cloud import logging_v2
+
+
+async def sample_delete_log():
+ # Create a client
+ client = logging_v2.LoggingServiceV2AsyncClient()
+
+ # Initialize request argument(s)
+ request = logging_v2.DeleteLogRequest(
+ log_name="log_name_value",
+ )
+
+ # Make the request
+ await client.delete_log(request=request)
+
+
+# [END logging_v2_generated_LoggingServiceV2_DeleteLog_async]
diff --git a/samples/generated_samples/logging_v2_generated_logging_service_v2_delete_log_sync.py b/samples/generated_samples/logging_v2_generated_logging_service_v2_delete_log_sync.py
new file mode 100644
index 000000000..36280057b
--- /dev/null
+++ b/samples/generated_samples/logging_v2_generated_logging_service_v2_delete_log_sync.py
@@ -0,0 +1,43 @@
+# -*- coding: utf-8 -*-
+# Copyright 2022 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 DeleteLog
+# 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-logging
+
+
+# [START logging_v2_generated_LoggingServiceV2_DeleteLog_sync]
+from google.cloud import logging_v2
+
+
+def sample_delete_log():
+ # Create a client
+ client = logging_v2.LoggingServiceV2Client()
+
+ # Initialize request argument(s)
+ request = logging_v2.DeleteLogRequest(
+ log_name="log_name_value",
+ )
+
+ # Make the request
+ client.delete_log(request=request)
+
+
+# [END logging_v2_generated_LoggingServiceV2_DeleteLog_sync]
diff --git a/samples/generated_samples/logging_v2_generated_logging_service_v2_list_log_entries_async.py b/samples/generated_samples/logging_v2_generated_logging_service_v2_list_log_entries_async.py
new file mode 100644
index 000000000..4a8692b04
--- /dev/null
+++ b/samples/generated_samples/logging_v2_generated_logging_service_v2_list_log_entries_async.py
@@ -0,0 +1,46 @@
+# -*- coding: utf-8 -*-
+# Copyright 2022 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 ListLogEntries
+# 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-logging
+
+
+# [START logging_v2_generated_LoggingServiceV2_ListLogEntries_async]
+from google.cloud import logging_v2
+
+
+async def sample_list_log_entries():
+ # Create a client
+ client = logging_v2.LoggingServiceV2AsyncClient()
+
+ # Initialize request argument(s)
+ request = logging_v2.ListLogEntriesRequest(
+ resource_names=['resource_names_value_1', 'resource_names_value_2'],
+ )
+
+ # Make the request
+ page_result = client.list_log_entries(request=request)
+
+ # Handle the response
+ async for response in page_result:
+ print(response)
+
+# [END logging_v2_generated_LoggingServiceV2_ListLogEntries_async]
diff --git a/samples/generated_samples/logging_v2_generated_logging_service_v2_list_log_entries_sync.py b/samples/generated_samples/logging_v2_generated_logging_service_v2_list_log_entries_sync.py
new file mode 100644
index 000000000..062075af9
--- /dev/null
+++ b/samples/generated_samples/logging_v2_generated_logging_service_v2_list_log_entries_sync.py
@@ -0,0 +1,46 @@
+# -*- coding: utf-8 -*-
+# Copyright 2022 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 ListLogEntries
+# 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-logging
+
+
+# [START logging_v2_generated_LoggingServiceV2_ListLogEntries_sync]
+from google.cloud import logging_v2
+
+
+def sample_list_log_entries():
+ # Create a client
+ client = logging_v2.LoggingServiceV2Client()
+
+ # Initialize request argument(s)
+ request = logging_v2.ListLogEntriesRequest(
+ resource_names=['resource_names_value_1', 'resource_names_value_2'],
+ )
+
+ # Make the request
+ page_result = client.list_log_entries(request=request)
+
+ # Handle the response
+ for response in page_result:
+ print(response)
+
+# [END logging_v2_generated_LoggingServiceV2_ListLogEntries_sync]
diff --git a/samples/generated_samples/logging_v2_generated_logging_service_v2_list_logs_async.py b/samples/generated_samples/logging_v2_generated_logging_service_v2_list_logs_async.py
new file mode 100644
index 000000000..fb0106199
--- /dev/null
+++ b/samples/generated_samples/logging_v2_generated_logging_service_v2_list_logs_async.py
@@ -0,0 +1,46 @@
+# -*- coding: utf-8 -*-
+# Copyright 2022 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 ListLogs
+# 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-logging
+
+
+# [START logging_v2_generated_LoggingServiceV2_ListLogs_async]
+from google.cloud import logging_v2
+
+
+async def sample_list_logs():
+ # Create a client
+ client = logging_v2.LoggingServiceV2AsyncClient()
+
+ # Initialize request argument(s)
+ request = logging_v2.ListLogsRequest(
+ parent="parent_value",
+ )
+
+ # Make the request
+ page_result = client.list_logs(request=request)
+
+ # Handle the response
+ async for response in page_result:
+ print(response)
+
+# [END logging_v2_generated_LoggingServiceV2_ListLogs_async]
diff --git a/samples/generated_samples/logging_v2_generated_logging_service_v2_list_logs_sync.py b/samples/generated_samples/logging_v2_generated_logging_service_v2_list_logs_sync.py
new file mode 100644
index 000000000..0f775572f
--- /dev/null
+++ b/samples/generated_samples/logging_v2_generated_logging_service_v2_list_logs_sync.py
@@ -0,0 +1,46 @@
+# -*- coding: utf-8 -*-
+# Copyright 2022 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 ListLogs
+# 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-logging
+
+
+# [START logging_v2_generated_LoggingServiceV2_ListLogs_sync]
+from google.cloud import logging_v2
+
+
+def sample_list_logs():
+ # Create a client
+ client = logging_v2.LoggingServiceV2Client()
+
+ # Initialize request argument(s)
+ request = logging_v2.ListLogsRequest(
+ parent="parent_value",
+ )
+
+ # Make the request
+ page_result = client.list_logs(request=request)
+
+ # Handle the response
+ for response in page_result:
+ print(response)
+
+# [END logging_v2_generated_LoggingServiceV2_ListLogs_sync]
diff --git a/samples/generated_samples/logging_v2_generated_logging_service_v2_list_monitored_resource_descriptors_async.py b/samples/generated_samples/logging_v2_generated_logging_service_v2_list_monitored_resource_descriptors_async.py
new file mode 100644
index 000000000..b8f339701
--- /dev/null
+++ b/samples/generated_samples/logging_v2_generated_logging_service_v2_list_monitored_resource_descriptors_async.py
@@ -0,0 +1,45 @@
+# -*- coding: utf-8 -*-
+# Copyright 2022 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 ListMonitoredResourceDescriptors
+# 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-logging
+
+
+# [START logging_v2_generated_LoggingServiceV2_ListMonitoredResourceDescriptors_async]
+from google.cloud import logging_v2
+
+
+async def sample_list_monitored_resource_descriptors():
+ # Create a client
+ client = logging_v2.LoggingServiceV2AsyncClient()
+
+ # Initialize request argument(s)
+ request = logging_v2.ListMonitoredResourceDescriptorsRequest(
+ )
+
+ # Make the request
+ page_result = client.list_monitored_resource_descriptors(request=request)
+
+ # Handle the response
+ async for response in page_result:
+ print(response)
+
+# [END logging_v2_generated_LoggingServiceV2_ListMonitoredResourceDescriptors_async]
diff --git a/samples/generated_samples/logging_v2_generated_logging_service_v2_list_monitored_resource_descriptors_sync.py b/samples/generated_samples/logging_v2_generated_logging_service_v2_list_monitored_resource_descriptors_sync.py
new file mode 100644
index 000000000..736d64d61
--- /dev/null
+++ b/samples/generated_samples/logging_v2_generated_logging_service_v2_list_monitored_resource_descriptors_sync.py
@@ -0,0 +1,45 @@
+# -*- coding: utf-8 -*-
+# Copyright 2022 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 ListMonitoredResourceDescriptors
+# 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-logging
+
+
+# [START logging_v2_generated_LoggingServiceV2_ListMonitoredResourceDescriptors_sync]
+from google.cloud import logging_v2
+
+
+def sample_list_monitored_resource_descriptors():
+ # Create a client
+ client = logging_v2.LoggingServiceV2Client()
+
+ # Initialize request argument(s)
+ request = logging_v2.ListMonitoredResourceDescriptorsRequest(
+ )
+
+ # Make the request
+ page_result = client.list_monitored_resource_descriptors(request=request)
+
+ # Handle the response
+ for response in page_result:
+ print(response)
+
+# [END logging_v2_generated_LoggingServiceV2_ListMonitoredResourceDescriptors_sync]
diff --git a/samples/generated_samples/logging_v2_generated_logging_service_v2_tail_log_entries_async.py b/samples/generated_samples/logging_v2_generated_logging_service_v2_tail_log_entries_async.py
new file mode 100644
index 000000000..3e77920f8
--- /dev/null
+++ b/samples/generated_samples/logging_v2_generated_logging_service_v2_tail_log_entries_async.py
@@ -0,0 +1,56 @@
+# -*- coding: utf-8 -*-
+# Copyright 2022 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 TailLogEntries
+# 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-logging
+
+
+# [START logging_v2_generated_LoggingServiceV2_TailLogEntries_async]
+from google.cloud import logging_v2
+
+
+async def sample_tail_log_entries():
+ # Create a client
+ client = logging_v2.LoggingServiceV2AsyncClient()
+
+ # Initialize request argument(s)
+ request = logging_v2.TailLogEntriesRequest(
+ resource_names=['resource_names_value_1', 'resource_names_value_2'],
+ )
+
+ # This method expects an iterator which contains
+ # 'logging_v2.TailLogEntriesRequest' objects
+ # Here we create a generator that yields a single `request` for
+ # demonstrative purposes.
+ requests = [request]
+
+ def request_generator():
+ for request in requests:
+ yield request
+
+ # Make the request
+ stream = await client.tail_log_entries(requests=request_generator())
+
+ # Handle the response
+ async for response in stream:
+ print(response)
+
+# [END logging_v2_generated_LoggingServiceV2_TailLogEntries_async]
diff --git a/samples/generated_samples/logging_v2_generated_logging_service_v2_tail_log_entries_sync.py b/samples/generated_samples/logging_v2_generated_logging_service_v2_tail_log_entries_sync.py
new file mode 100644
index 000000000..ee1108b33
--- /dev/null
+++ b/samples/generated_samples/logging_v2_generated_logging_service_v2_tail_log_entries_sync.py
@@ -0,0 +1,56 @@
+# -*- coding: utf-8 -*-
+# Copyright 2022 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 TailLogEntries
+# 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-logging
+
+
+# [START logging_v2_generated_LoggingServiceV2_TailLogEntries_sync]
+from google.cloud import logging_v2
+
+
+def sample_tail_log_entries():
+ # Create a client
+ client = logging_v2.LoggingServiceV2Client()
+
+ # Initialize request argument(s)
+ request = logging_v2.TailLogEntriesRequest(
+ resource_names=['resource_names_value_1', 'resource_names_value_2'],
+ )
+
+ # This method expects an iterator which contains
+ # 'logging_v2.TailLogEntriesRequest' objects
+ # Here we create a generator that yields a single `request` for
+ # demonstrative purposes.
+ requests = [request]
+
+ def request_generator():
+ for request in requests:
+ yield request
+
+ # Make the request
+ stream = client.tail_log_entries(requests=request_generator())
+
+ # Handle the response
+ for response in stream:
+ print(response)
+
+# [END logging_v2_generated_LoggingServiceV2_TailLogEntries_sync]
diff --git a/samples/generated_samples/logging_v2_generated_logging_service_v2_write_log_entries_async.py b/samples/generated_samples/logging_v2_generated_logging_service_v2_write_log_entries_async.py
new file mode 100644
index 000000000..28025d777
--- /dev/null
+++ b/samples/generated_samples/logging_v2_generated_logging_service_v2_write_log_entries_async.py
@@ -0,0 +1,48 @@
+# -*- coding: utf-8 -*-
+# Copyright 2022 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 WriteLogEntries
+# 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-logging
+
+
+# [START logging_v2_generated_LoggingServiceV2_WriteLogEntries_async]
+from google.cloud import logging_v2
+
+
+async def sample_write_log_entries():
+ # Create a client
+ client = logging_v2.LoggingServiceV2AsyncClient()
+
+ # Initialize request argument(s)
+ entries = logging_v2.LogEntry()
+ entries.log_name = "log_name_value"
+
+ request = logging_v2.WriteLogEntriesRequest(
+ entries=entries,
+ )
+
+ # Make the request
+ response = await client.write_log_entries(request=request)
+
+ # Handle the response
+ print(response)
+
+# [END logging_v2_generated_LoggingServiceV2_WriteLogEntries_async]
diff --git a/samples/generated_samples/logging_v2_generated_logging_service_v2_write_log_entries_sync.py b/samples/generated_samples/logging_v2_generated_logging_service_v2_write_log_entries_sync.py
new file mode 100644
index 000000000..31569811c
--- /dev/null
+++ b/samples/generated_samples/logging_v2_generated_logging_service_v2_write_log_entries_sync.py
@@ -0,0 +1,48 @@
+# -*- coding: utf-8 -*-
+# Copyright 2022 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 WriteLogEntries
+# 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-logging
+
+
+# [START logging_v2_generated_LoggingServiceV2_WriteLogEntries_sync]
+from google.cloud import logging_v2
+
+
+def sample_write_log_entries():
+ # Create a client
+ client = logging_v2.LoggingServiceV2Client()
+
+ # Initialize request argument(s)
+ entries = logging_v2.LogEntry()
+ entries.log_name = "log_name_value"
+
+ request = logging_v2.WriteLogEntriesRequest(
+ entries=entries,
+ )
+
+ # Make the request
+ response = client.write_log_entries(request=request)
+
+ # Handle the response
+ print(response)
+
+# [END logging_v2_generated_LoggingServiceV2_WriteLogEntries_sync]
diff --git a/samples/generated_samples/logging_v2_generated_metrics_service_v2_create_log_metric_async.py b/samples/generated_samples/logging_v2_generated_metrics_service_v2_create_log_metric_async.py
new file mode 100644
index 000000000..96690c2c3
--- /dev/null
+++ b/samples/generated_samples/logging_v2_generated_metrics_service_v2_create_log_metric_async.py
@@ -0,0 +1,50 @@
+# -*- coding: utf-8 -*-
+# Copyright 2022 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 CreateLogMetric
+# 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-logging
+
+
+# [START logging_v2_generated_MetricsServiceV2_CreateLogMetric_async]
+from google.cloud import logging_v2
+
+
+async def sample_create_log_metric():
+ # Create a client
+ client = logging_v2.MetricsServiceV2AsyncClient()
+
+ # Initialize request argument(s)
+ metric = logging_v2.LogMetric()
+ metric.name = "name_value"
+ metric.filter = "filter_value"
+
+ request = logging_v2.CreateLogMetricRequest(
+ parent="parent_value",
+ metric=metric,
+ )
+
+ # Make the request
+ response = await client.create_log_metric(request=request)
+
+ # Handle the response
+ print(response)
+
+# [END logging_v2_generated_MetricsServiceV2_CreateLogMetric_async]
diff --git a/samples/generated_samples/logging_v2_generated_metrics_service_v2_create_log_metric_sync.py b/samples/generated_samples/logging_v2_generated_metrics_service_v2_create_log_metric_sync.py
new file mode 100644
index 000000000..051694d31
--- /dev/null
+++ b/samples/generated_samples/logging_v2_generated_metrics_service_v2_create_log_metric_sync.py
@@ -0,0 +1,50 @@
+# -*- coding: utf-8 -*-
+# Copyright 2022 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 CreateLogMetric
+# 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-logging
+
+
+# [START logging_v2_generated_MetricsServiceV2_CreateLogMetric_sync]
+from google.cloud import logging_v2
+
+
+def sample_create_log_metric():
+ # Create a client
+ client = logging_v2.MetricsServiceV2Client()
+
+ # Initialize request argument(s)
+ metric = logging_v2.LogMetric()
+ metric.name = "name_value"
+ metric.filter = "filter_value"
+
+ request = logging_v2.CreateLogMetricRequest(
+ parent="parent_value",
+ metric=metric,
+ )
+
+ # Make the request
+ response = client.create_log_metric(request=request)
+
+ # Handle the response
+ print(response)
+
+# [END logging_v2_generated_MetricsServiceV2_CreateLogMetric_sync]
diff --git a/samples/generated_samples/logging_v2_generated_metrics_service_v2_delete_log_metric_async.py b/samples/generated_samples/logging_v2_generated_metrics_service_v2_delete_log_metric_async.py
new file mode 100644
index 000000000..bf2ee5e4a
--- /dev/null
+++ b/samples/generated_samples/logging_v2_generated_metrics_service_v2_delete_log_metric_async.py
@@ -0,0 +1,43 @@
+# -*- coding: utf-8 -*-
+# Copyright 2022 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 DeleteLogMetric
+# 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-logging
+
+
+# [START logging_v2_generated_MetricsServiceV2_DeleteLogMetric_async]
+from google.cloud import logging_v2
+
+
+async def sample_delete_log_metric():
+ # Create a client
+ client = logging_v2.MetricsServiceV2AsyncClient()
+
+ # Initialize request argument(s)
+ request = logging_v2.DeleteLogMetricRequest(
+ metric_name="metric_name_value",
+ )
+
+ # Make the request
+ await client.delete_log_metric(request=request)
+
+
+# [END logging_v2_generated_MetricsServiceV2_DeleteLogMetric_async]
diff --git a/samples/generated_samples/logging_v2_generated_metrics_service_v2_delete_log_metric_sync.py b/samples/generated_samples/logging_v2_generated_metrics_service_v2_delete_log_metric_sync.py
new file mode 100644
index 000000000..eae109200
--- /dev/null
+++ b/samples/generated_samples/logging_v2_generated_metrics_service_v2_delete_log_metric_sync.py
@@ -0,0 +1,43 @@
+# -*- coding: utf-8 -*-
+# Copyright 2022 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 DeleteLogMetric
+# 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-logging
+
+
+# [START logging_v2_generated_MetricsServiceV2_DeleteLogMetric_sync]
+from google.cloud import logging_v2
+
+
+def sample_delete_log_metric():
+ # Create a client
+ client = logging_v2.MetricsServiceV2Client()
+
+ # Initialize request argument(s)
+ request = logging_v2.DeleteLogMetricRequest(
+ metric_name="metric_name_value",
+ )
+
+ # Make the request
+ client.delete_log_metric(request=request)
+
+
+# [END logging_v2_generated_MetricsServiceV2_DeleteLogMetric_sync]
diff --git a/samples/generated_samples/logging_v2_generated_metrics_service_v2_get_log_metric_async.py b/samples/generated_samples/logging_v2_generated_metrics_service_v2_get_log_metric_async.py
new file mode 100644
index 000000000..cea94a356
--- /dev/null
+++ b/samples/generated_samples/logging_v2_generated_metrics_service_v2_get_log_metric_async.py
@@ -0,0 +1,45 @@
+# -*- coding: utf-8 -*-
+# Copyright 2022 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 GetLogMetric
+# 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-logging
+
+
+# [START logging_v2_generated_MetricsServiceV2_GetLogMetric_async]
+from google.cloud import logging_v2
+
+
+async def sample_get_log_metric():
+ # Create a client
+ client = logging_v2.MetricsServiceV2AsyncClient()
+
+ # Initialize request argument(s)
+ request = logging_v2.GetLogMetricRequest(
+ metric_name="metric_name_value",
+ )
+
+ # Make the request
+ response = await client.get_log_metric(request=request)
+
+ # Handle the response
+ print(response)
+
+# [END logging_v2_generated_MetricsServiceV2_GetLogMetric_async]
diff --git a/samples/generated_samples/logging_v2_generated_metrics_service_v2_get_log_metric_sync.py b/samples/generated_samples/logging_v2_generated_metrics_service_v2_get_log_metric_sync.py
new file mode 100644
index 000000000..eea36222a
--- /dev/null
+++ b/samples/generated_samples/logging_v2_generated_metrics_service_v2_get_log_metric_sync.py
@@ -0,0 +1,45 @@
+# -*- coding: utf-8 -*-
+# Copyright 2022 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 GetLogMetric
+# 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-logging
+
+
+# [START logging_v2_generated_MetricsServiceV2_GetLogMetric_sync]
+from google.cloud import logging_v2
+
+
+def sample_get_log_metric():
+ # Create a client
+ client = logging_v2.MetricsServiceV2Client()
+
+ # Initialize request argument(s)
+ request = logging_v2.GetLogMetricRequest(
+ metric_name="metric_name_value",
+ )
+
+ # Make the request
+ response = client.get_log_metric(request=request)
+
+ # Handle the response
+ print(response)
+
+# [END logging_v2_generated_MetricsServiceV2_GetLogMetric_sync]
diff --git a/samples/generated_samples/logging_v2_generated_metrics_service_v2_list_log_metrics_async.py b/samples/generated_samples/logging_v2_generated_metrics_service_v2_list_log_metrics_async.py
new file mode 100644
index 000000000..9dac77937
--- /dev/null
+++ b/samples/generated_samples/logging_v2_generated_metrics_service_v2_list_log_metrics_async.py
@@ -0,0 +1,46 @@
+# -*- coding: utf-8 -*-
+# Copyright 2022 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 ListLogMetrics
+# 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-logging
+
+
+# [START logging_v2_generated_MetricsServiceV2_ListLogMetrics_async]
+from google.cloud import logging_v2
+
+
+async def sample_list_log_metrics():
+ # Create a client
+ client = logging_v2.MetricsServiceV2AsyncClient()
+
+ # Initialize request argument(s)
+ request = logging_v2.ListLogMetricsRequest(
+ parent="parent_value",
+ )
+
+ # Make the request
+ page_result = client.list_log_metrics(request=request)
+
+ # Handle the response
+ async for response in page_result:
+ print(response)
+
+# [END logging_v2_generated_MetricsServiceV2_ListLogMetrics_async]
diff --git a/samples/generated_samples/logging_v2_generated_metrics_service_v2_list_log_metrics_sync.py b/samples/generated_samples/logging_v2_generated_metrics_service_v2_list_log_metrics_sync.py
new file mode 100644
index 000000000..97b3c2f13
--- /dev/null
+++ b/samples/generated_samples/logging_v2_generated_metrics_service_v2_list_log_metrics_sync.py
@@ -0,0 +1,46 @@
+# -*- coding: utf-8 -*-
+# Copyright 2022 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 ListLogMetrics
+# 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-logging
+
+
+# [START logging_v2_generated_MetricsServiceV2_ListLogMetrics_sync]
+from google.cloud import logging_v2
+
+
+def sample_list_log_metrics():
+ # Create a client
+ client = logging_v2.MetricsServiceV2Client()
+
+ # Initialize request argument(s)
+ request = logging_v2.ListLogMetricsRequest(
+ parent="parent_value",
+ )
+
+ # Make the request
+ page_result = client.list_log_metrics(request=request)
+
+ # Handle the response
+ for response in page_result:
+ print(response)
+
+# [END logging_v2_generated_MetricsServiceV2_ListLogMetrics_sync]
diff --git a/samples/generated_samples/logging_v2_generated_metrics_service_v2_update_log_metric_async.py b/samples/generated_samples/logging_v2_generated_metrics_service_v2_update_log_metric_async.py
new file mode 100644
index 000000000..c94c70e76
--- /dev/null
+++ b/samples/generated_samples/logging_v2_generated_metrics_service_v2_update_log_metric_async.py
@@ -0,0 +1,50 @@
+# -*- coding: utf-8 -*-
+# Copyright 2022 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 UpdateLogMetric
+# 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-logging
+
+
+# [START logging_v2_generated_MetricsServiceV2_UpdateLogMetric_async]
+from google.cloud import logging_v2
+
+
+async def sample_update_log_metric():
+ # Create a client
+ client = logging_v2.MetricsServiceV2AsyncClient()
+
+ # Initialize request argument(s)
+ metric = logging_v2.LogMetric()
+ metric.name = "name_value"
+ metric.filter = "filter_value"
+
+ request = logging_v2.UpdateLogMetricRequest(
+ metric_name="metric_name_value",
+ metric=metric,
+ )
+
+ # Make the request
+ response = await client.update_log_metric(request=request)
+
+ # Handle the response
+ print(response)
+
+# [END logging_v2_generated_MetricsServiceV2_UpdateLogMetric_async]
diff --git a/samples/generated_samples/logging_v2_generated_metrics_service_v2_update_log_metric_sync.py b/samples/generated_samples/logging_v2_generated_metrics_service_v2_update_log_metric_sync.py
new file mode 100644
index 000000000..bcdff3269
--- /dev/null
+++ b/samples/generated_samples/logging_v2_generated_metrics_service_v2_update_log_metric_sync.py
@@ -0,0 +1,50 @@
+# -*- coding: utf-8 -*-
+# Copyright 2022 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 UpdateLogMetric
+# 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-logging
+
+
+# [START logging_v2_generated_MetricsServiceV2_UpdateLogMetric_sync]
+from google.cloud import logging_v2
+
+
+def sample_update_log_metric():
+ # Create a client
+ client = logging_v2.MetricsServiceV2Client()
+
+ # Initialize request argument(s)
+ metric = logging_v2.LogMetric()
+ metric.name = "name_value"
+ metric.filter = "filter_value"
+
+ request = logging_v2.UpdateLogMetricRequest(
+ metric_name="metric_name_value",
+ metric=metric,
+ )
+
+ # Make the request
+ response = client.update_log_metric(request=request)
+
+ # Handle the response
+ print(response)
+
+# [END logging_v2_generated_MetricsServiceV2_UpdateLogMetric_sync]
diff --git a/samples/generated_samples/snippet_metadata_logging_v2.json b/samples/generated_samples/snippet_metadata_logging_v2.json
new file mode 100644
index 000000000..657563cd6
--- /dev/null
+++ b/samples/generated_samples/snippet_metadata_logging_v2.json
@@ -0,0 +1,5929 @@
+{
+ "clientLibrary": {
+ "apis": [
+ {
+ "id": "google.logging.v2",
+ "version": "v2"
+ }
+ ],
+ "language": "PYTHON",
+ "name": "google-cloud-logging"
+ },
+ "snippets": [
+ {
+ "canonical": true,
+ "clientMethod": {
+ "async": true,
+ "client": {
+ "fullName": "google.cloud.logging_v2.ConfigServiceV2AsyncClient",
+ "shortName": "ConfigServiceV2AsyncClient"
+ },
+ "fullName": "google.cloud.logging_v2.ConfigServiceV2AsyncClient.copy_log_entries",
+ "method": {
+ "fullName": "google.logging.v2.ConfigServiceV2.CopyLogEntries",
+ "service": {
+ "fullName": "google.logging.v2.ConfigServiceV2",
+ "shortName": "ConfigServiceV2"
+ },
+ "shortName": "CopyLogEntries"
+ },
+ "parameters": [
+ {
+ "name": "request",
+ "type": "google.cloud.logging_v2.types.CopyLogEntriesRequest"
+ },
+ {
+ "name": "retry",
+ "type": "google.api_core.retry.Retry"
+ },
+ {
+ "name": "timeout",
+ "type": "float"
+ },
+ {
+ "name": "metadata",
+ "type": "Sequence[Tuple[str, str]"
+ }
+ ],
+ "resultType": "google.api_core.operation_async.AsyncOperation",
+ "shortName": "copy_log_entries"
+ },
+ "description": "Sample for CopyLogEntries",
+ "file": "logging_v2_generated_config_service_v2_copy_log_entries_async.py",
+ "language": "PYTHON",
+ "origin": "API_DEFINITION",
+ "regionTag": "logging_v2_generated_ConfigServiceV2_CopyLogEntries_async",
+ "segments": [
+ {
+ "end": 49,
+ "start": 27,
+ "type": "FULL"
+ },
+ {
+ "end": 49,
+ "start": 27,
+ "type": "SHORT"
+ },
+ {
+ "end": 33,
+ "start": 31,
+ "type": "CLIENT_INITIALIZATION"
+ },
+ {
+ "end": 39,
+ "start": 34,
+ "type": "REQUEST_INITIALIZATION"
+ },
+ {
+ "end": 46,
+ "start": 40,
+ "type": "REQUEST_EXECUTION"
+ },
+ {
+ "end": 50,
+ "start": 47,
+ "type": "RESPONSE_HANDLING"
+ }
+ ],
+ "title": "logging_v2_generated_config_service_v2_copy_log_entries_async.py"
+ },
+ {
+ "canonical": true,
+ "clientMethod": {
+ "client": {
+ "fullName": "google.cloud.logging_v2.ConfigServiceV2Client",
+ "shortName": "ConfigServiceV2Client"
+ },
+ "fullName": "google.cloud.logging_v2.ConfigServiceV2Client.copy_log_entries",
+ "method": {
+ "fullName": "google.logging.v2.ConfigServiceV2.CopyLogEntries",
+ "service": {
+ "fullName": "google.logging.v2.ConfigServiceV2",
+ "shortName": "ConfigServiceV2"
+ },
+ "shortName": "CopyLogEntries"
+ },
+ "parameters": [
+ {
+ "name": "request",
+ "type": "google.cloud.logging_v2.types.CopyLogEntriesRequest"
+ },
+ {
+ "name": "retry",
+ "type": "google.api_core.retry.Retry"
+ },
+ {
+ "name": "timeout",
+ "type": "float"
+ },
+ {
+ "name": "metadata",
+ "type": "Sequence[Tuple[str, str]"
+ }
+ ],
+ "resultType": "google.api_core.operation.Operation",
+ "shortName": "copy_log_entries"
+ },
+ "description": "Sample for CopyLogEntries",
+ "file": "logging_v2_generated_config_service_v2_copy_log_entries_sync.py",
+ "language": "PYTHON",
+ "origin": "API_DEFINITION",
+ "regionTag": "logging_v2_generated_ConfigServiceV2_CopyLogEntries_sync",
+ "segments": [
+ {
+ "end": 49,
+ "start": 27,
+ "type": "FULL"
+ },
+ {
+ "end": 49,
+ "start": 27,
+ "type": "SHORT"
+ },
+ {
+ "end": 33,
+ "start": 31,
+ "type": "CLIENT_INITIALIZATION"
+ },
+ {
+ "end": 39,
+ "start": 34,
+ "type": "REQUEST_INITIALIZATION"
+ },
+ {
+ "end": 46,
+ "start": 40,
+ "type": "REQUEST_EXECUTION"
+ },
+ {
+ "end": 50,
+ "start": 47,
+ "type": "RESPONSE_HANDLING"
+ }
+ ],
+ "title": "logging_v2_generated_config_service_v2_copy_log_entries_sync.py"
+ },
+ {
+ "canonical": true,
+ "clientMethod": {
+ "async": true,
+ "client": {
+ "fullName": "google.cloud.logging_v2.ConfigServiceV2AsyncClient",
+ "shortName": "ConfigServiceV2AsyncClient"
+ },
+ "fullName": "google.cloud.logging_v2.ConfigServiceV2AsyncClient.create_bucket",
+ "method": {
+ "fullName": "google.logging.v2.ConfigServiceV2.CreateBucket",
+ "service": {
+ "fullName": "google.logging.v2.ConfigServiceV2",
+ "shortName": "ConfigServiceV2"
+ },
+ "shortName": "CreateBucket"
+ },
+ "parameters": [
+ {
+ "name": "request",
+ "type": "google.cloud.logging_v2.types.CreateBucketRequest"
+ },
+ {
+ "name": "retry",
+ "type": "google.api_core.retry.Retry"
+ },
+ {
+ "name": "timeout",
+ "type": "float"
+ },
+ {
+ "name": "metadata",
+ "type": "Sequence[Tuple[str, str]"
+ }
+ ],
+ "resultType": "google.cloud.logging_v2.types.LogBucket",
+ "shortName": "create_bucket"
+ },
+ "description": "Sample for CreateBucket",
+ "file": "logging_v2_generated_config_service_v2_create_bucket_async.py",
+ "language": "PYTHON",
+ "origin": "API_DEFINITION",
+ "regionTag": "logging_v2_generated_ConfigServiceV2_CreateBucket_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"
+ }
+ ],
+ "title": "logging_v2_generated_config_service_v2_create_bucket_async.py"
+ },
+ {
+ "canonical": true,
+ "clientMethod": {
+ "client": {
+ "fullName": "google.cloud.logging_v2.ConfigServiceV2Client",
+ "shortName": "ConfigServiceV2Client"
+ },
+ "fullName": "google.cloud.logging_v2.ConfigServiceV2Client.create_bucket",
+ "method": {
+ "fullName": "google.logging.v2.ConfigServiceV2.CreateBucket",
+ "service": {
+ "fullName": "google.logging.v2.ConfigServiceV2",
+ "shortName": "ConfigServiceV2"
+ },
+ "shortName": "CreateBucket"
+ },
+ "parameters": [
+ {
+ "name": "request",
+ "type": "google.cloud.logging_v2.types.CreateBucketRequest"
+ },
+ {
+ "name": "retry",
+ "type": "google.api_core.retry.Retry"
+ },
+ {
+ "name": "timeout",
+ "type": "float"
+ },
+ {
+ "name": "metadata",
+ "type": "Sequence[Tuple[str, str]"
+ }
+ ],
+ "resultType": "google.cloud.logging_v2.types.LogBucket",
+ "shortName": "create_bucket"
+ },
+ "description": "Sample for CreateBucket",
+ "file": "logging_v2_generated_config_service_v2_create_bucket_sync.py",
+ "language": "PYTHON",
+ "origin": "API_DEFINITION",
+ "regionTag": "logging_v2_generated_ConfigServiceV2_CreateBucket_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"
+ }
+ ],
+ "title": "logging_v2_generated_config_service_v2_create_bucket_sync.py"
+ },
+ {
+ "canonical": true,
+ "clientMethod": {
+ "async": true,
+ "client": {
+ "fullName": "google.cloud.logging_v2.ConfigServiceV2AsyncClient",
+ "shortName": "ConfigServiceV2AsyncClient"
+ },
+ "fullName": "google.cloud.logging_v2.ConfigServiceV2AsyncClient.create_exclusion",
+ "method": {
+ "fullName": "google.logging.v2.ConfigServiceV2.CreateExclusion",
+ "service": {
+ "fullName": "google.logging.v2.ConfigServiceV2",
+ "shortName": "ConfigServiceV2"
+ },
+ "shortName": "CreateExclusion"
+ },
+ "parameters": [
+ {
+ "name": "request",
+ "type": "google.cloud.logging_v2.types.CreateExclusionRequest"
+ },
+ {
+ "name": "parent",
+ "type": "str"
+ },
+ {
+ "name": "exclusion",
+ "type": "google.cloud.logging_v2.types.LogExclusion"
+ },
+ {
+ "name": "retry",
+ "type": "google.api_core.retry.Retry"
+ },
+ {
+ "name": "timeout",
+ "type": "float"
+ },
+ {
+ "name": "metadata",
+ "type": "Sequence[Tuple[str, str]"
+ }
+ ],
+ "resultType": "google.cloud.logging_v2.types.LogExclusion",
+ "shortName": "create_exclusion"
+ },
+ "description": "Sample for CreateExclusion",
+ "file": "logging_v2_generated_config_service_v2_create_exclusion_async.py",
+ "language": "PYTHON",
+ "origin": "API_DEFINITION",
+ "regionTag": "logging_v2_generated_ConfigServiceV2_CreateExclusion_async",
+ "segments": [
+ {
+ "end": 49,
+ "start": 27,
+ "type": "FULL"
+ },
+ {
+ "end": 49,
+ "start": 27,
+ "type": "SHORT"
+ },
+ {
+ "end": 33,
+ "start": 31,
+ "type": "CLIENT_INITIALIZATION"
+ },
+ {
+ "end": 43,
+ "start": 34,
+ "type": "REQUEST_INITIALIZATION"
+ },
+ {
+ "end": 46,
+ "start": 44,
+ "type": "REQUEST_EXECUTION"
+ },
+ {
+ "end": 50,
+ "start": 47,
+ "type": "RESPONSE_HANDLING"
+ }
+ ],
+ "title": "logging_v2_generated_config_service_v2_create_exclusion_async.py"
+ },
+ {
+ "canonical": true,
+ "clientMethod": {
+ "client": {
+ "fullName": "google.cloud.logging_v2.ConfigServiceV2Client",
+ "shortName": "ConfigServiceV2Client"
+ },
+ "fullName": "google.cloud.logging_v2.ConfigServiceV2Client.create_exclusion",
+ "method": {
+ "fullName": "google.logging.v2.ConfigServiceV2.CreateExclusion",
+ "service": {
+ "fullName": "google.logging.v2.ConfigServiceV2",
+ "shortName": "ConfigServiceV2"
+ },
+ "shortName": "CreateExclusion"
+ },
+ "parameters": [
+ {
+ "name": "request",
+ "type": "google.cloud.logging_v2.types.CreateExclusionRequest"
+ },
+ {
+ "name": "parent",
+ "type": "str"
+ },
+ {
+ "name": "exclusion",
+ "type": "google.cloud.logging_v2.types.LogExclusion"
+ },
+ {
+ "name": "retry",
+ "type": "google.api_core.retry.Retry"
+ },
+ {
+ "name": "timeout",
+ "type": "float"
+ },
+ {
+ "name": "metadata",
+ "type": "Sequence[Tuple[str, str]"
+ }
+ ],
+ "resultType": "google.cloud.logging_v2.types.LogExclusion",
+ "shortName": "create_exclusion"
+ },
+ "description": "Sample for CreateExclusion",
+ "file": "logging_v2_generated_config_service_v2_create_exclusion_sync.py",
+ "language": "PYTHON",
+ "origin": "API_DEFINITION",
+ "regionTag": "logging_v2_generated_ConfigServiceV2_CreateExclusion_sync",
+ "segments": [
+ {
+ "end": 49,
+ "start": 27,
+ "type": "FULL"
+ },
+ {
+ "end": 49,
+ "start": 27,
+ "type": "SHORT"
+ },
+ {
+ "end": 33,
+ "start": 31,
+ "type": "CLIENT_INITIALIZATION"
+ },
+ {
+ "end": 43,
+ "start": 34,
+ "type": "REQUEST_INITIALIZATION"
+ },
+ {
+ "end": 46,
+ "start": 44,
+ "type": "REQUEST_EXECUTION"
+ },
+ {
+ "end": 50,
+ "start": 47,
+ "type": "RESPONSE_HANDLING"
+ }
+ ],
+ "title": "logging_v2_generated_config_service_v2_create_exclusion_sync.py"
+ },
+ {
+ "canonical": true,
+ "clientMethod": {
+ "async": true,
+ "client": {
+ "fullName": "google.cloud.logging_v2.ConfigServiceV2AsyncClient",
+ "shortName": "ConfigServiceV2AsyncClient"
+ },
+ "fullName": "google.cloud.logging_v2.ConfigServiceV2AsyncClient.create_sink",
+ "method": {
+ "fullName": "google.logging.v2.ConfigServiceV2.CreateSink",
+ "service": {
+ "fullName": "google.logging.v2.ConfigServiceV2",
+ "shortName": "ConfigServiceV2"
+ },
+ "shortName": "CreateSink"
+ },
+ "parameters": [
+ {
+ "name": "request",
+ "type": "google.cloud.logging_v2.types.CreateSinkRequest"
+ },
+ {
+ "name": "parent",
+ "type": "str"
+ },
+ {
+ "name": "sink",
+ "type": "google.cloud.logging_v2.types.LogSink"
+ },
+ {
+ "name": "retry",
+ "type": "google.api_core.retry.Retry"
+ },
+ {
+ "name": "timeout",
+ "type": "float"
+ },
+ {
+ "name": "metadata",
+ "type": "Sequence[Tuple[str, str]"
+ }
+ ],
+ "resultType": "google.cloud.logging_v2.types.LogSink",
+ "shortName": "create_sink"
+ },
+ "description": "Sample for CreateSink",
+ "file": "logging_v2_generated_config_service_v2_create_sink_async.py",
+ "language": "PYTHON",
+ "origin": "API_DEFINITION",
+ "regionTag": "logging_v2_generated_ConfigServiceV2_CreateSink_async",
+ "segments": [
+ {
+ "end": 49,
+ "start": 27,
+ "type": "FULL"
+ },
+ {
+ "end": 49,
+ "start": 27,
+ "type": "SHORT"
+ },
+ {
+ "end": 33,
+ "start": 31,
+ "type": "CLIENT_INITIALIZATION"
+ },
+ {
+ "end": 43,
+ "start": 34,
+ "type": "REQUEST_INITIALIZATION"
+ },
+ {
+ "end": 46,
+ "start": 44,
+ "type": "REQUEST_EXECUTION"
+ },
+ {
+ "end": 50,
+ "start": 47,
+ "type": "RESPONSE_HANDLING"
+ }
+ ],
+ "title": "logging_v2_generated_config_service_v2_create_sink_async.py"
+ },
+ {
+ "canonical": true,
+ "clientMethod": {
+ "client": {
+ "fullName": "google.cloud.logging_v2.ConfigServiceV2Client",
+ "shortName": "ConfigServiceV2Client"
+ },
+ "fullName": "google.cloud.logging_v2.ConfigServiceV2Client.create_sink",
+ "method": {
+ "fullName": "google.logging.v2.ConfigServiceV2.CreateSink",
+ "service": {
+ "fullName": "google.logging.v2.ConfigServiceV2",
+ "shortName": "ConfigServiceV2"
+ },
+ "shortName": "CreateSink"
+ },
+ "parameters": [
+ {
+ "name": "request",
+ "type": "google.cloud.logging_v2.types.CreateSinkRequest"
+ },
+ {
+ "name": "parent",
+ "type": "str"
+ },
+ {
+ "name": "sink",
+ "type": "google.cloud.logging_v2.types.LogSink"
+ },
+ {
+ "name": "retry",
+ "type": "google.api_core.retry.Retry"
+ },
+ {
+ "name": "timeout",
+ "type": "float"
+ },
+ {
+ "name": "metadata",
+ "type": "Sequence[Tuple[str, str]"
+ }
+ ],
+ "resultType": "google.cloud.logging_v2.types.LogSink",
+ "shortName": "create_sink"
+ },
+ "description": "Sample for CreateSink",
+ "file": "logging_v2_generated_config_service_v2_create_sink_sync.py",
+ "language": "PYTHON",
+ "origin": "API_DEFINITION",
+ "regionTag": "logging_v2_generated_ConfigServiceV2_CreateSink_sync",
+ "segments": [
+ {
+ "end": 49,
+ "start": 27,
+ "type": "FULL"
+ },
+ {
+ "end": 49,
+ "start": 27,
+ "type": "SHORT"
+ },
+ {
+ "end": 33,
+ "start": 31,
+ "type": "CLIENT_INITIALIZATION"
+ },
+ {
+ "end": 43,
+ "start": 34,
+ "type": "REQUEST_INITIALIZATION"
+ },
+ {
+ "end": 46,
+ "start": 44,
+ "type": "REQUEST_EXECUTION"
+ },
+ {
+ "end": 50,
+ "start": 47,
+ "type": "RESPONSE_HANDLING"
+ }
+ ],
+ "title": "logging_v2_generated_config_service_v2_create_sink_sync.py"
+ },
+ {
+ "canonical": true,
+ "clientMethod": {
+ "async": true,
+ "client": {
+ "fullName": "google.cloud.logging_v2.ConfigServiceV2AsyncClient",
+ "shortName": "ConfigServiceV2AsyncClient"
+ },
+ "fullName": "google.cloud.logging_v2.ConfigServiceV2AsyncClient.create_view",
+ "method": {
+ "fullName": "google.logging.v2.ConfigServiceV2.CreateView",
+ "service": {
+ "fullName": "google.logging.v2.ConfigServiceV2",
+ "shortName": "ConfigServiceV2"
+ },
+ "shortName": "CreateView"
+ },
+ "parameters": [
+ {
+ "name": "request",
+ "type": "google.cloud.logging_v2.types.CreateViewRequest"
+ },
+ {
+ "name": "retry",
+ "type": "google.api_core.retry.Retry"
+ },
+ {
+ "name": "timeout",
+ "type": "float"
+ },
+ {
+ "name": "metadata",
+ "type": "Sequence[Tuple[str, str]"
+ }
+ ],
+ "resultType": "google.cloud.logging_v2.types.LogView",
+ "shortName": "create_view"
+ },
+ "description": "Sample for CreateView",
+ "file": "logging_v2_generated_config_service_v2_create_view_async.py",
+ "language": "PYTHON",
+ "origin": "API_DEFINITION",
+ "regionTag": "logging_v2_generated_ConfigServiceV2_CreateView_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"
+ }
+ ],
+ "title": "logging_v2_generated_config_service_v2_create_view_async.py"
+ },
+ {
+ "canonical": true,
+ "clientMethod": {
+ "client": {
+ "fullName": "google.cloud.logging_v2.ConfigServiceV2Client",
+ "shortName": "ConfigServiceV2Client"
+ },
+ "fullName": "google.cloud.logging_v2.ConfigServiceV2Client.create_view",
+ "method": {
+ "fullName": "google.logging.v2.ConfigServiceV2.CreateView",
+ "service": {
+ "fullName": "google.logging.v2.ConfigServiceV2",
+ "shortName": "ConfigServiceV2"
+ },
+ "shortName": "CreateView"
+ },
+ "parameters": [
+ {
+ "name": "request",
+ "type": "google.cloud.logging_v2.types.CreateViewRequest"
+ },
+ {
+ "name": "retry",
+ "type": "google.api_core.retry.Retry"
+ },
+ {
+ "name": "timeout",
+ "type": "float"
+ },
+ {
+ "name": "metadata",
+ "type": "Sequence[Tuple[str, str]"
+ }
+ ],
+ "resultType": "google.cloud.logging_v2.types.LogView",
+ "shortName": "create_view"
+ },
+ "description": "Sample for CreateView",
+ "file": "logging_v2_generated_config_service_v2_create_view_sync.py",
+ "language": "PYTHON",
+ "origin": "API_DEFINITION",
+ "regionTag": "logging_v2_generated_ConfigServiceV2_CreateView_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"
+ }
+ ],
+ "title": "logging_v2_generated_config_service_v2_create_view_sync.py"
+ },
+ {
+ "canonical": true,
+ "clientMethod": {
+ "async": true,
+ "client": {
+ "fullName": "google.cloud.logging_v2.ConfigServiceV2AsyncClient",
+ "shortName": "ConfigServiceV2AsyncClient"
+ },
+ "fullName": "google.cloud.logging_v2.ConfigServiceV2AsyncClient.delete_bucket",
+ "method": {
+ "fullName": "google.logging.v2.ConfigServiceV2.DeleteBucket",
+ "service": {
+ "fullName": "google.logging.v2.ConfigServiceV2",
+ "shortName": "ConfigServiceV2"
+ },
+ "shortName": "DeleteBucket"
+ },
+ "parameters": [
+ {
+ "name": "request",
+ "type": "google.cloud.logging_v2.types.DeleteBucketRequest"
+ },
+ {
+ "name": "retry",
+ "type": "google.api_core.retry.Retry"
+ },
+ {
+ "name": "timeout",
+ "type": "float"
+ },
+ {
+ "name": "metadata",
+ "type": "Sequence[Tuple[str, str]"
+ }
+ ],
+ "shortName": "delete_bucket"
+ },
+ "description": "Sample for DeleteBucket",
+ "file": "logging_v2_generated_config_service_v2_delete_bucket_async.py",
+ "language": "PYTHON",
+ "origin": "API_DEFINITION",
+ "regionTag": "logging_v2_generated_ConfigServiceV2_DeleteBucket_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"
+ }
+ ],
+ "title": "logging_v2_generated_config_service_v2_delete_bucket_async.py"
+ },
+ {
+ "canonical": true,
+ "clientMethod": {
+ "client": {
+ "fullName": "google.cloud.logging_v2.ConfigServiceV2Client",
+ "shortName": "ConfigServiceV2Client"
+ },
+ "fullName": "google.cloud.logging_v2.ConfigServiceV2Client.delete_bucket",
+ "method": {
+ "fullName": "google.logging.v2.ConfigServiceV2.DeleteBucket",
+ "service": {
+ "fullName": "google.logging.v2.ConfigServiceV2",
+ "shortName": "ConfigServiceV2"
+ },
+ "shortName": "DeleteBucket"
+ },
+ "parameters": [
+ {
+ "name": "request",
+ "type": "google.cloud.logging_v2.types.DeleteBucketRequest"
+ },
+ {
+ "name": "retry",
+ "type": "google.api_core.retry.Retry"
+ },
+ {
+ "name": "timeout",
+ "type": "float"
+ },
+ {
+ "name": "metadata",
+ "type": "Sequence[Tuple[str, str]"
+ }
+ ],
+ "shortName": "delete_bucket"
+ },
+ "description": "Sample for DeleteBucket",
+ "file": "logging_v2_generated_config_service_v2_delete_bucket_sync.py",
+ "language": "PYTHON",
+ "origin": "API_DEFINITION",
+ "regionTag": "logging_v2_generated_ConfigServiceV2_DeleteBucket_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"
+ }
+ ],
+ "title": "logging_v2_generated_config_service_v2_delete_bucket_sync.py"
+ },
+ {
+ "canonical": true,
+ "clientMethod": {
+ "async": true,
+ "client": {
+ "fullName": "google.cloud.logging_v2.ConfigServiceV2AsyncClient",
+ "shortName": "ConfigServiceV2AsyncClient"
+ },
+ "fullName": "google.cloud.logging_v2.ConfigServiceV2AsyncClient.delete_exclusion",
+ "method": {
+ "fullName": "google.logging.v2.ConfigServiceV2.DeleteExclusion",
+ "service": {
+ "fullName": "google.logging.v2.ConfigServiceV2",
+ "shortName": "ConfigServiceV2"
+ },
+ "shortName": "DeleteExclusion"
+ },
+ "parameters": [
+ {
+ "name": "request",
+ "type": "google.cloud.logging_v2.types.DeleteExclusionRequest"
+ },
+ {
+ "name": "name",
+ "type": "str"
+ },
+ {
+ "name": "retry",
+ "type": "google.api_core.retry.Retry"
+ },
+ {
+ "name": "timeout",
+ "type": "float"
+ },
+ {
+ "name": "metadata",
+ "type": "Sequence[Tuple[str, str]"
+ }
+ ],
+ "shortName": "delete_exclusion"
+ },
+ "description": "Sample for DeleteExclusion",
+ "file": "logging_v2_generated_config_service_v2_delete_exclusion_async.py",
+ "language": "PYTHON",
+ "origin": "API_DEFINITION",
+ "regionTag": "logging_v2_generated_ConfigServiceV2_DeleteExclusion_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"
+ }
+ ],
+ "title": "logging_v2_generated_config_service_v2_delete_exclusion_async.py"
+ },
+ {
+ "canonical": true,
+ "clientMethod": {
+ "client": {
+ "fullName": "google.cloud.logging_v2.ConfigServiceV2Client",
+ "shortName": "ConfigServiceV2Client"
+ },
+ "fullName": "google.cloud.logging_v2.ConfigServiceV2Client.delete_exclusion",
+ "method": {
+ "fullName": "google.logging.v2.ConfigServiceV2.DeleteExclusion",
+ "service": {
+ "fullName": "google.logging.v2.ConfigServiceV2",
+ "shortName": "ConfigServiceV2"
+ },
+ "shortName": "DeleteExclusion"
+ },
+ "parameters": [
+ {
+ "name": "request",
+ "type": "google.cloud.logging_v2.types.DeleteExclusionRequest"
+ },
+ {
+ "name": "name",
+ "type": "str"
+ },
+ {
+ "name": "retry",
+ "type": "google.api_core.retry.Retry"
+ },
+ {
+ "name": "timeout",
+ "type": "float"
+ },
+ {
+ "name": "metadata",
+ "type": "Sequence[Tuple[str, str]"
+ }
+ ],
+ "shortName": "delete_exclusion"
+ },
+ "description": "Sample for DeleteExclusion",
+ "file": "logging_v2_generated_config_service_v2_delete_exclusion_sync.py",
+ "language": "PYTHON",
+ "origin": "API_DEFINITION",
+ "regionTag": "logging_v2_generated_ConfigServiceV2_DeleteExclusion_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"
+ }
+ ],
+ "title": "logging_v2_generated_config_service_v2_delete_exclusion_sync.py"
+ },
+ {
+ "canonical": true,
+ "clientMethod": {
+ "async": true,
+ "client": {
+ "fullName": "google.cloud.logging_v2.ConfigServiceV2AsyncClient",
+ "shortName": "ConfigServiceV2AsyncClient"
+ },
+ "fullName": "google.cloud.logging_v2.ConfigServiceV2AsyncClient.delete_sink",
+ "method": {
+ "fullName": "google.logging.v2.ConfigServiceV2.DeleteSink",
+ "service": {
+ "fullName": "google.logging.v2.ConfigServiceV2",
+ "shortName": "ConfigServiceV2"
+ },
+ "shortName": "DeleteSink"
+ },
+ "parameters": [
+ {
+ "name": "request",
+ "type": "google.cloud.logging_v2.types.DeleteSinkRequest"
+ },
+ {
+ "name": "sink_name",
+ "type": "str"
+ },
+ {
+ "name": "retry",
+ "type": "google.api_core.retry.Retry"
+ },
+ {
+ "name": "timeout",
+ "type": "float"
+ },
+ {
+ "name": "metadata",
+ "type": "Sequence[Tuple[str, str]"
+ }
+ ],
+ "shortName": "delete_sink"
+ },
+ "description": "Sample for DeleteSink",
+ "file": "logging_v2_generated_config_service_v2_delete_sink_async.py",
+ "language": "PYTHON",
+ "origin": "API_DEFINITION",
+ "regionTag": "logging_v2_generated_ConfigServiceV2_DeleteSink_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"
+ }
+ ],
+ "title": "logging_v2_generated_config_service_v2_delete_sink_async.py"
+ },
+ {
+ "canonical": true,
+ "clientMethod": {
+ "client": {
+ "fullName": "google.cloud.logging_v2.ConfigServiceV2Client",
+ "shortName": "ConfigServiceV2Client"
+ },
+ "fullName": "google.cloud.logging_v2.ConfigServiceV2Client.delete_sink",
+ "method": {
+ "fullName": "google.logging.v2.ConfigServiceV2.DeleteSink",
+ "service": {
+ "fullName": "google.logging.v2.ConfigServiceV2",
+ "shortName": "ConfigServiceV2"
+ },
+ "shortName": "DeleteSink"
+ },
+ "parameters": [
+ {
+ "name": "request",
+ "type": "google.cloud.logging_v2.types.DeleteSinkRequest"
+ },
+ {
+ "name": "sink_name",
+ "type": "str"
+ },
+ {
+ "name": "retry",
+ "type": "google.api_core.retry.Retry"
+ },
+ {
+ "name": "timeout",
+ "type": "float"
+ },
+ {
+ "name": "metadata",
+ "type": "Sequence[Tuple[str, str]"
+ }
+ ],
+ "shortName": "delete_sink"
+ },
+ "description": "Sample for DeleteSink",
+ "file": "logging_v2_generated_config_service_v2_delete_sink_sync.py",
+ "language": "PYTHON",
+ "origin": "API_DEFINITION",
+ "regionTag": "logging_v2_generated_ConfigServiceV2_DeleteSink_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"
+ }
+ ],
+ "title": "logging_v2_generated_config_service_v2_delete_sink_sync.py"
+ },
+ {
+ "canonical": true,
+ "clientMethod": {
+ "async": true,
+ "client": {
+ "fullName": "google.cloud.logging_v2.ConfigServiceV2AsyncClient",
+ "shortName": "ConfigServiceV2AsyncClient"
+ },
+ "fullName": "google.cloud.logging_v2.ConfigServiceV2AsyncClient.delete_view",
+ "method": {
+ "fullName": "google.logging.v2.ConfigServiceV2.DeleteView",
+ "service": {
+ "fullName": "google.logging.v2.ConfigServiceV2",
+ "shortName": "ConfigServiceV2"
+ },
+ "shortName": "DeleteView"
+ },
+ "parameters": [
+ {
+ "name": "request",
+ "type": "google.cloud.logging_v2.types.DeleteViewRequest"
+ },
+ {
+ "name": "retry",
+ "type": "google.api_core.retry.Retry"
+ },
+ {
+ "name": "timeout",
+ "type": "float"
+ },
+ {
+ "name": "metadata",
+ "type": "Sequence[Tuple[str, str]"
+ }
+ ],
+ "shortName": "delete_view"
+ },
+ "description": "Sample for DeleteView",
+ "file": "logging_v2_generated_config_service_v2_delete_view_async.py",
+ "language": "PYTHON",
+ "origin": "API_DEFINITION",
+ "regionTag": "logging_v2_generated_ConfigServiceV2_DeleteView_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"
+ }
+ ],
+ "title": "logging_v2_generated_config_service_v2_delete_view_async.py"
+ },
+ {
+ "canonical": true,
+ "clientMethod": {
+ "client": {
+ "fullName": "google.cloud.logging_v2.ConfigServiceV2Client",
+ "shortName": "ConfigServiceV2Client"
+ },
+ "fullName": "google.cloud.logging_v2.ConfigServiceV2Client.delete_view",
+ "method": {
+ "fullName": "google.logging.v2.ConfigServiceV2.DeleteView",
+ "service": {
+ "fullName": "google.logging.v2.ConfigServiceV2",
+ "shortName": "ConfigServiceV2"
+ },
+ "shortName": "DeleteView"
+ },
+ "parameters": [
+ {
+ "name": "request",
+ "type": "google.cloud.logging_v2.types.DeleteViewRequest"
+ },
+ {
+ "name": "retry",
+ "type": "google.api_core.retry.Retry"
+ },
+ {
+ "name": "timeout",
+ "type": "float"
+ },
+ {
+ "name": "metadata",
+ "type": "Sequence[Tuple[str, str]"
+ }
+ ],
+ "shortName": "delete_view"
+ },
+ "description": "Sample for DeleteView",
+ "file": "logging_v2_generated_config_service_v2_delete_view_sync.py",
+ "language": "PYTHON",
+ "origin": "API_DEFINITION",
+ "regionTag": "logging_v2_generated_ConfigServiceV2_DeleteView_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"
+ }
+ ],
+ "title": "logging_v2_generated_config_service_v2_delete_view_sync.py"
+ },
+ {
+ "canonical": true,
+ "clientMethod": {
+ "async": true,
+ "client": {
+ "fullName": "google.cloud.logging_v2.ConfigServiceV2AsyncClient",
+ "shortName": "ConfigServiceV2AsyncClient"
+ },
+ "fullName": "google.cloud.logging_v2.ConfigServiceV2AsyncClient.get_bucket",
+ "method": {
+ "fullName": "google.logging.v2.ConfigServiceV2.GetBucket",
+ "service": {
+ "fullName": "google.logging.v2.ConfigServiceV2",
+ "shortName": "ConfigServiceV2"
+ },
+ "shortName": "GetBucket"
+ },
+ "parameters": [
+ {
+ "name": "request",
+ "type": "google.cloud.logging_v2.types.GetBucketRequest"
+ },
+ {
+ "name": "retry",
+ "type": "google.api_core.retry.Retry"
+ },
+ {
+ "name": "timeout",
+ "type": "float"
+ },
+ {
+ "name": "metadata",
+ "type": "Sequence[Tuple[str, str]"
+ }
+ ],
+ "resultType": "google.cloud.logging_v2.types.LogBucket",
+ "shortName": "get_bucket"
+ },
+ "description": "Sample for GetBucket",
+ "file": "logging_v2_generated_config_service_v2_get_bucket_async.py",
+ "language": "PYTHON",
+ "origin": "API_DEFINITION",
+ "regionTag": "logging_v2_generated_ConfigServiceV2_GetBucket_async",
+ "segments": [
+ {
+ "end": 44,
+ "start": 27,
+ "type": "FULL"
+ },
+ {
+ "end": 44,
+ "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": 45,
+ "start": 42,
+ "type": "RESPONSE_HANDLING"
+ }
+ ],
+ "title": "logging_v2_generated_config_service_v2_get_bucket_async.py"
+ },
+ {
+ "canonical": true,
+ "clientMethod": {
+ "client": {
+ "fullName": "google.cloud.logging_v2.ConfigServiceV2Client",
+ "shortName": "ConfigServiceV2Client"
+ },
+ "fullName": "google.cloud.logging_v2.ConfigServiceV2Client.get_bucket",
+ "method": {
+ "fullName": "google.logging.v2.ConfigServiceV2.GetBucket",
+ "service": {
+ "fullName": "google.logging.v2.ConfigServiceV2",
+ "shortName": "ConfigServiceV2"
+ },
+ "shortName": "GetBucket"
+ },
+ "parameters": [
+ {
+ "name": "request",
+ "type": "google.cloud.logging_v2.types.GetBucketRequest"
+ },
+ {
+ "name": "retry",
+ "type": "google.api_core.retry.Retry"
+ },
+ {
+ "name": "timeout",
+ "type": "float"
+ },
+ {
+ "name": "metadata",
+ "type": "Sequence[Tuple[str, str]"
+ }
+ ],
+ "resultType": "google.cloud.logging_v2.types.LogBucket",
+ "shortName": "get_bucket"
+ },
+ "description": "Sample for GetBucket",
+ "file": "logging_v2_generated_config_service_v2_get_bucket_sync.py",
+ "language": "PYTHON",
+ "origin": "API_DEFINITION",
+ "regionTag": "logging_v2_generated_ConfigServiceV2_GetBucket_sync",
+ "segments": [
+ {
+ "end": 44,
+ "start": 27,
+ "type": "FULL"
+ },
+ {
+ "end": 44,
+ "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": 45,
+ "start": 42,
+ "type": "RESPONSE_HANDLING"
+ }
+ ],
+ "title": "logging_v2_generated_config_service_v2_get_bucket_sync.py"
+ },
+ {
+ "canonical": true,
+ "clientMethod": {
+ "async": true,
+ "client": {
+ "fullName": "google.cloud.logging_v2.ConfigServiceV2AsyncClient",
+ "shortName": "ConfigServiceV2AsyncClient"
+ },
+ "fullName": "google.cloud.logging_v2.ConfigServiceV2AsyncClient.get_cmek_settings",
+ "method": {
+ "fullName": "google.logging.v2.ConfigServiceV2.GetCmekSettings",
+ "service": {
+ "fullName": "google.logging.v2.ConfigServiceV2",
+ "shortName": "ConfigServiceV2"
+ },
+ "shortName": "GetCmekSettings"
+ },
+ "parameters": [
+ {
+ "name": "request",
+ "type": "google.cloud.logging_v2.types.GetCmekSettingsRequest"
+ },
+ {
+ "name": "retry",
+ "type": "google.api_core.retry.Retry"
+ },
+ {
+ "name": "timeout",
+ "type": "float"
+ },
+ {
+ "name": "metadata",
+ "type": "Sequence[Tuple[str, str]"
+ }
+ ],
+ "resultType": "google.cloud.logging_v2.types.CmekSettings",
+ "shortName": "get_cmek_settings"
+ },
+ "description": "Sample for GetCmekSettings",
+ "file": "logging_v2_generated_config_service_v2_get_cmek_settings_async.py",
+ "language": "PYTHON",
+ "origin": "API_DEFINITION",
+ "regionTag": "logging_v2_generated_ConfigServiceV2_GetCmekSettings_async",
+ "segments": [
+ {
+ "end": 44,
+ "start": 27,
+ "type": "FULL"
+ },
+ {
+ "end": 44,
+ "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": 45,
+ "start": 42,
+ "type": "RESPONSE_HANDLING"
+ }
+ ],
+ "title": "logging_v2_generated_config_service_v2_get_cmek_settings_async.py"
+ },
+ {
+ "canonical": true,
+ "clientMethod": {
+ "client": {
+ "fullName": "google.cloud.logging_v2.ConfigServiceV2Client",
+ "shortName": "ConfigServiceV2Client"
+ },
+ "fullName": "google.cloud.logging_v2.ConfigServiceV2Client.get_cmek_settings",
+ "method": {
+ "fullName": "google.logging.v2.ConfigServiceV2.GetCmekSettings",
+ "service": {
+ "fullName": "google.logging.v2.ConfigServiceV2",
+ "shortName": "ConfigServiceV2"
+ },
+ "shortName": "GetCmekSettings"
+ },
+ "parameters": [
+ {
+ "name": "request",
+ "type": "google.cloud.logging_v2.types.GetCmekSettingsRequest"
+ },
+ {
+ "name": "retry",
+ "type": "google.api_core.retry.Retry"
+ },
+ {
+ "name": "timeout",
+ "type": "float"
+ },
+ {
+ "name": "metadata",
+ "type": "Sequence[Tuple[str, str]"
+ }
+ ],
+ "resultType": "google.cloud.logging_v2.types.CmekSettings",
+ "shortName": "get_cmek_settings"
+ },
+ "description": "Sample for GetCmekSettings",
+ "file": "logging_v2_generated_config_service_v2_get_cmek_settings_sync.py",
+ "language": "PYTHON",
+ "origin": "API_DEFINITION",
+ "regionTag": "logging_v2_generated_ConfigServiceV2_GetCmekSettings_sync",
+ "segments": [
+ {
+ "end": 44,
+ "start": 27,
+ "type": "FULL"
+ },
+ {
+ "end": 44,
+ "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": 45,
+ "start": 42,
+ "type": "RESPONSE_HANDLING"
+ }
+ ],
+ "title": "logging_v2_generated_config_service_v2_get_cmek_settings_sync.py"
+ },
+ {
+ "canonical": true,
+ "clientMethod": {
+ "async": true,
+ "client": {
+ "fullName": "google.cloud.logging_v2.ConfigServiceV2AsyncClient",
+ "shortName": "ConfigServiceV2AsyncClient"
+ },
+ "fullName": "google.cloud.logging_v2.ConfigServiceV2AsyncClient.get_exclusion",
+ "method": {
+ "fullName": "google.logging.v2.ConfigServiceV2.GetExclusion",
+ "service": {
+ "fullName": "google.logging.v2.ConfigServiceV2",
+ "shortName": "ConfigServiceV2"
+ },
+ "shortName": "GetExclusion"
+ },
+ "parameters": [
+ {
+ "name": "request",
+ "type": "google.cloud.logging_v2.types.GetExclusionRequest"
+ },
+ {
+ "name": "name",
+ "type": "str"
+ },
+ {
+ "name": "retry",
+ "type": "google.api_core.retry.Retry"
+ },
+ {
+ "name": "timeout",
+ "type": "float"
+ },
+ {
+ "name": "metadata",
+ "type": "Sequence[Tuple[str, str]"
+ }
+ ],
+ "resultType": "google.cloud.logging_v2.types.LogExclusion",
+ "shortName": "get_exclusion"
+ },
+ "description": "Sample for GetExclusion",
+ "file": "logging_v2_generated_config_service_v2_get_exclusion_async.py",
+ "language": "PYTHON",
+ "origin": "API_DEFINITION",
+ "regionTag": "logging_v2_generated_ConfigServiceV2_GetExclusion_async",
+ "segments": [
+ {
+ "end": 44,
+ "start": 27,
+ "type": "FULL"
+ },
+ {
+ "end": 44,
+ "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": 45,
+ "start": 42,
+ "type": "RESPONSE_HANDLING"
+ }
+ ],
+ "title": "logging_v2_generated_config_service_v2_get_exclusion_async.py"
+ },
+ {
+ "canonical": true,
+ "clientMethod": {
+ "client": {
+ "fullName": "google.cloud.logging_v2.ConfigServiceV2Client",
+ "shortName": "ConfigServiceV2Client"
+ },
+ "fullName": "google.cloud.logging_v2.ConfigServiceV2Client.get_exclusion",
+ "method": {
+ "fullName": "google.logging.v2.ConfigServiceV2.GetExclusion",
+ "service": {
+ "fullName": "google.logging.v2.ConfigServiceV2",
+ "shortName": "ConfigServiceV2"
+ },
+ "shortName": "GetExclusion"
+ },
+ "parameters": [
+ {
+ "name": "request",
+ "type": "google.cloud.logging_v2.types.GetExclusionRequest"
+ },
+ {
+ "name": "name",
+ "type": "str"
+ },
+ {
+ "name": "retry",
+ "type": "google.api_core.retry.Retry"
+ },
+ {
+ "name": "timeout",
+ "type": "float"
+ },
+ {
+ "name": "metadata",
+ "type": "Sequence[Tuple[str, str]"
+ }
+ ],
+ "resultType": "google.cloud.logging_v2.types.LogExclusion",
+ "shortName": "get_exclusion"
+ },
+ "description": "Sample for GetExclusion",
+ "file": "logging_v2_generated_config_service_v2_get_exclusion_sync.py",
+ "language": "PYTHON",
+ "origin": "API_DEFINITION",
+ "regionTag": "logging_v2_generated_ConfigServiceV2_GetExclusion_sync",
+ "segments": [
+ {
+ "end": 44,
+ "start": 27,
+ "type": "FULL"
+ },
+ {
+ "end": 44,
+ "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": 45,
+ "start": 42,
+ "type": "RESPONSE_HANDLING"
+ }
+ ],
+ "title": "logging_v2_generated_config_service_v2_get_exclusion_sync.py"
+ },
+ {
+ "canonical": true,
+ "clientMethod": {
+ "async": true,
+ "client": {
+ "fullName": "google.cloud.logging_v2.ConfigServiceV2AsyncClient",
+ "shortName": "ConfigServiceV2AsyncClient"
+ },
+ "fullName": "google.cloud.logging_v2.ConfigServiceV2AsyncClient.get_settings",
+ "method": {
+ "fullName": "google.logging.v2.ConfigServiceV2.GetSettings",
+ "service": {
+ "fullName": "google.logging.v2.ConfigServiceV2",
+ "shortName": "ConfigServiceV2"
+ },
+ "shortName": "GetSettings"
+ },
+ "parameters": [
+ {
+ "name": "request",
+ "type": "google.cloud.logging_v2.types.GetSettingsRequest"
+ },
+ {
+ "name": "name",
+ "type": "str"
+ },
+ {
+ "name": "retry",
+ "type": "google.api_core.retry.Retry"
+ },
+ {
+ "name": "timeout",
+ "type": "float"
+ },
+ {
+ "name": "metadata",
+ "type": "Sequence[Tuple[str, str]"
+ }
+ ],
+ "resultType": "google.cloud.logging_v2.types.Settings",
+ "shortName": "get_settings"
+ },
+ "description": "Sample for GetSettings",
+ "file": "logging_v2_generated_config_service_v2_get_settings_async.py",
+ "language": "PYTHON",
+ "origin": "API_DEFINITION",
+ "regionTag": "logging_v2_generated_ConfigServiceV2_GetSettings_async",
+ "segments": [
+ {
+ "end": 44,
+ "start": 27,
+ "type": "FULL"
+ },
+ {
+ "end": 44,
+ "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": 45,
+ "start": 42,
+ "type": "RESPONSE_HANDLING"
+ }
+ ],
+ "title": "logging_v2_generated_config_service_v2_get_settings_async.py"
+ },
+ {
+ "canonical": true,
+ "clientMethod": {
+ "client": {
+ "fullName": "google.cloud.logging_v2.ConfigServiceV2Client",
+ "shortName": "ConfigServiceV2Client"
+ },
+ "fullName": "google.cloud.logging_v2.ConfigServiceV2Client.get_settings",
+ "method": {
+ "fullName": "google.logging.v2.ConfigServiceV2.GetSettings",
+ "service": {
+ "fullName": "google.logging.v2.ConfigServiceV2",
+ "shortName": "ConfigServiceV2"
+ },
+ "shortName": "GetSettings"
+ },
+ "parameters": [
+ {
+ "name": "request",
+ "type": "google.cloud.logging_v2.types.GetSettingsRequest"
+ },
+ {
+ "name": "name",
+ "type": "str"
+ },
+ {
+ "name": "retry",
+ "type": "google.api_core.retry.Retry"
+ },
+ {
+ "name": "timeout",
+ "type": "float"
+ },
+ {
+ "name": "metadata",
+ "type": "Sequence[Tuple[str, str]"
+ }
+ ],
+ "resultType": "google.cloud.logging_v2.types.Settings",
+ "shortName": "get_settings"
+ },
+ "description": "Sample for GetSettings",
+ "file": "logging_v2_generated_config_service_v2_get_settings_sync.py",
+ "language": "PYTHON",
+ "origin": "API_DEFINITION",
+ "regionTag": "logging_v2_generated_ConfigServiceV2_GetSettings_sync",
+ "segments": [
+ {
+ "end": 44,
+ "start": 27,
+ "type": "FULL"
+ },
+ {
+ "end": 44,
+ "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": 45,
+ "start": 42,
+ "type": "RESPONSE_HANDLING"
+ }
+ ],
+ "title": "logging_v2_generated_config_service_v2_get_settings_sync.py"
+ },
+ {
+ "canonical": true,
+ "clientMethod": {
+ "async": true,
+ "client": {
+ "fullName": "google.cloud.logging_v2.ConfigServiceV2AsyncClient",
+ "shortName": "ConfigServiceV2AsyncClient"
+ },
+ "fullName": "google.cloud.logging_v2.ConfigServiceV2AsyncClient.get_sink",
+ "method": {
+ "fullName": "google.logging.v2.ConfigServiceV2.GetSink",
+ "service": {
+ "fullName": "google.logging.v2.ConfigServiceV2",
+ "shortName": "ConfigServiceV2"
+ },
+ "shortName": "GetSink"
+ },
+ "parameters": [
+ {
+ "name": "request",
+ "type": "google.cloud.logging_v2.types.GetSinkRequest"
+ },
+ {
+ "name": "sink_name",
+ "type": "str"
+ },
+ {
+ "name": "retry",
+ "type": "google.api_core.retry.Retry"
+ },
+ {
+ "name": "timeout",
+ "type": "float"
+ },
+ {
+ "name": "metadata",
+ "type": "Sequence[Tuple[str, str]"
+ }
+ ],
+ "resultType": "google.cloud.logging_v2.types.LogSink",
+ "shortName": "get_sink"
+ },
+ "description": "Sample for GetSink",
+ "file": "logging_v2_generated_config_service_v2_get_sink_async.py",
+ "language": "PYTHON",
+ "origin": "API_DEFINITION",
+ "regionTag": "logging_v2_generated_ConfigServiceV2_GetSink_async",
+ "segments": [
+ {
+ "end": 44,
+ "start": 27,
+ "type": "FULL"
+ },
+ {
+ "end": 44,
+ "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": 45,
+ "start": 42,
+ "type": "RESPONSE_HANDLING"
+ }
+ ],
+ "title": "logging_v2_generated_config_service_v2_get_sink_async.py"
+ },
+ {
+ "canonical": true,
+ "clientMethod": {
+ "client": {
+ "fullName": "google.cloud.logging_v2.ConfigServiceV2Client",
+ "shortName": "ConfigServiceV2Client"
+ },
+ "fullName": "google.cloud.logging_v2.ConfigServiceV2Client.get_sink",
+ "method": {
+ "fullName": "google.logging.v2.ConfigServiceV2.GetSink",
+ "service": {
+ "fullName": "google.logging.v2.ConfigServiceV2",
+ "shortName": "ConfigServiceV2"
+ },
+ "shortName": "GetSink"
+ },
+ "parameters": [
+ {
+ "name": "request",
+ "type": "google.cloud.logging_v2.types.GetSinkRequest"
+ },
+ {
+ "name": "sink_name",
+ "type": "str"
+ },
+ {
+ "name": "retry",
+ "type": "google.api_core.retry.Retry"
+ },
+ {
+ "name": "timeout",
+ "type": "float"
+ },
+ {
+ "name": "metadata",
+ "type": "Sequence[Tuple[str, str]"
+ }
+ ],
+ "resultType": "google.cloud.logging_v2.types.LogSink",
+ "shortName": "get_sink"
+ },
+ "description": "Sample for GetSink",
+ "file": "logging_v2_generated_config_service_v2_get_sink_sync.py",
+ "language": "PYTHON",
+ "origin": "API_DEFINITION",
+ "regionTag": "logging_v2_generated_ConfigServiceV2_GetSink_sync",
+ "segments": [
+ {
+ "end": 44,
+ "start": 27,
+ "type": "FULL"
+ },
+ {
+ "end": 44,
+ "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": 45,
+ "start": 42,
+ "type": "RESPONSE_HANDLING"
+ }
+ ],
+ "title": "logging_v2_generated_config_service_v2_get_sink_sync.py"
+ },
+ {
+ "canonical": true,
+ "clientMethod": {
+ "async": true,
+ "client": {
+ "fullName": "google.cloud.logging_v2.ConfigServiceV2AsyncClient",
+ "shortName": "ConfigServiceV2AsyncClient"
+ },
+ "fullName": "google.cloud.logging_v2.ConfigServiceV2AsyncClient.get_view",
+ "method": {
+ "fullName": "google.logging.v2.ConfigServiceV2.GetView",
+ "service": {
+ "fullName": "google.logging.v2.ConfigServiceV2",
+ "shortName": "ConfigServiceV2"
+ },
+ "shortName": "GetView"
+ },
+ "parameters": [
+ {
+ "name": "request",
+ "type": "google.cloud.logging_v2.types.GetViewRequest"
+ },
+ {
+ "name": "retry",
+ "type": "google.api_core.retry.Retry"
+ },
+ {
+ "name": "timeout",
+ "type": "float"
+ },
+ {
+ "name": "metadata",
+ "type": "Sequence[Tuple[str, str]"
+ }
+ ],
+ "resultType": "google.cloud.logging_v2.types.LogView",
+ "shortName": "get_view"
+ },
+ "description": "Sample for GetView",
+ "file": "logging_v2_generated_config_service_v2_get_view_async.py",
+ "language": "PYTHON",
+ "origin": "API_DEFINITION",
+ "regionTag": "logging_v2_generated_ConfigServiceV2_GetView_async",
+ "segments": [
+ {
+ "end": 44,
+ "start": 27,
+ "type": "FULL"
+ },
+ {
+ "end": 44,
+ "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": 45,
+ "start": 42,
+ "type": "RESPONSE_HANDLING"
+ }
+ ],
+ "title": "logging_v2_generated_config_service_v2_get_view_async.py"
+ },
+ {
+ "canonical": true,
+ "clientMethod": {
+ "client": {
+ "fullName": "google.cloud.logging_v2.ConfigServiceV2Client",
+ "shortName": "ConfigServiceV2Client"
+ },
+ "fullName": "google.cloud.logging_v2.ConfigServiceV2Client.get_view",
+ "method": {
+ "fullName": "google.logging.v2.ConfigServiceV2.GetView",
+ "service": {
+ "fullName": "google.logging.v2.ConfigServiceV2",
+ "shortName": "ConfigServiceV2"
+ },
+ "shortName": "GetView"
+ },
+ "parameters": [
+ {
+ "name": "request",
+ "type": "google.cloud.logging_v2.types.GetViewRequest"
+ },
+ {
+ "name": "retry",
+ "type": "google.api_core.retry.Retry"
+ },
+ {
+ "name": "timeout",
+ "type": "float"
+ },
+ {
+ "name": "metadata",
+ "type": "Sequence[Tuple[str, str]"
+ }
+ ],
+ "resultType": "google.cloud.logging_v2.types.LogView",
+ "shortName": "get_view"
+ },
+ "description": "Sample for GetView",
+ "file": "logging_v2_generated_config_service_v2_get_view_sync.py",
+ "language": "PYTHON",
+ "origin": "API_DEFINITION",
+ "regionTag": "logging_v2_generated_ConfigServiceV2_GetView_sync",
+ "segments": [
+ {
+ "end": 44,
+ "start": 27,
+ "type": "FULL"
+ },
+ {
+ "end": 44,
+ "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": 45,
+ "start": 42,
+ "type": "RESPONSE_HANDLING"
+ }
+ ],
+ "title": "logging_v2_generated_config_service_v2_get_view_sync.py"
+ },
+ {
+ "canonical": true,
+ "clientMethod": {
+ "async": true,
+ "client": {
+ "fullName": "google.cloud.logging_v2.ConfigServiceV2AsyncClient",
+ "shortName": "ConfigServiceV2AsyncClient"
+ },
+ "fullName": "google.cloud.logging_v2.ConfigServiceV2AsyncClient.list_buckets",
+ "method": {
+ "fullName": "google.logging.v2.ConfigServiceV2.ListBuckets",
+ "service": {
+ "fullName": "google.logging.v2.ConfigServiceV2",
+ "shortName": "ConfigServiceV2"
+ },
+ "shortName": "ListBuckets"
+ },
+ "parameters": [
+ {
+ "name": "request",
+ "type": "google.cloud.logging_v2.types.ListBucketsRequest"
+ },
+ {
+ "name": "parent",
+ "type": "str"
+ },
+ {
+ "name": "retry",
+ "type": "google.api_core.retry.Retry"
+ },
+ {
+ "name": "timeout",
+ "type": "float"
+ },
+ {
+ "name": "metadata",
+ "type": "Sequence[Tuple[str, str]"
+ }
+ ],
+ "resultType": "google.cloud.logging_v2.services.config_service_v2.pagers.ListBucketsAsyncPager",
+ "shortName": "list_buckets"
+ },
+ "description": "Sample for ListBuckets",
+ "file": "logging_v2_generated_config_service_v2_list_buckets_async.py",
+ "language": "PYTHON",
+ "origin": "API_DEFINITION",
+ "regionTag": "logging_v2_generated_ConfigServiceV2_ListBuckets_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"
+ }
+ ],
+ "title": "logging_v2_generated_config_service_v2_list_buckets_async.py"
+ },
+ {
+ "canonical": true,
+ "clientMethod": {
+ "client": {
+ "fullName": "google.cloud.logging_v2.ConfigServiceV2Client",
+ "shortName": "ConfigServiceV2Client"
+ },
+ "fullName": "google.cloud.logging_v2.ConfigServiceV2Client.list_buckets",
+ "method": {
+ "fullName": "google.logging.v2.ConfigServiceV2.ListBuckets",
+ "service": {
+ "fullName": "google.logging.v2.ConfigServiceV2",
+ "shortName": "ConfigServiceV2"
+ },
+ "shortName": "ListBuckets"
+ },
+ "parameters": [
+ {
+ "name": "request",
+ "type": "google.cloud.logging_v2.types.ListBucketsRequest"
+ },
+ {
+ "name": "parent",
+ "type": "str"
+ },
+ {
+ "name": "retry",
+ "type": "google.api_core.retry.Retry"
+ },
+ {
+ "name": "timeout",
+ "type": "float"
+ },
+ {
+ "name": "metadata",
+ "type": "Sequence[Tuple[str, str]"
+ }
+ ],
+ "resultType": "google.cloud.logging_v2.services.config_service_v2.pagers.ListBucketsPager",
+ "shortName": "list_buckets"
+ },
+ "description": "Sample for ListBuckets",
+ "file": "logging_v2_generated_config_service_v2_list_buckets_sync.py",
+ "language": "PYTHON",
+ "origin": "API_DEFINITION",
+ "regionTag": "logging_v2_generated_ConfigServiceV2_ListBuckets_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"
+ }
+ ],
+ "title": "logging_v2_generated_config_service_v2_list_buckets_sync.py"
+ },
+ {
+ "canonical": true,
+ "clientMethod": {
+ "async": true,
+ "client": {
+ "fullName": "google.cloud.logging_v2.ConfigServiceV2AsyncClient",
+ "shortName": "ConfigServiceV2AsyncClient"
+ },
+ "fullName": "google.cloud.logging_v2.ConfigServiceV2AsyncClient.list_exclusions",
+ "method": {
+ "fullName": "google.logging.v2.ConfigServiceV2.ListExclusions",
+ "service": {
+ "fullName": "google.logging.v2.ConfigServiceV2",
+ "shortName": "ConfigServiceV2"
+ },
+ "shortName": "ListExclusions"
+ },
+ "parameters": [
+ {
+ "name": "request",
+ "type": "google.cloud.logging_v2.types.ListExclusionsRequest"
+ },
+ {
+ "name": "parent",
+ "type": "str"
+ },
+ {
+ "name": "retry",
+ "type": "google.api_core.retry.Retry"
+ },
+ {
+ "name": "timeout",
+ "type": "float"
+ },
+ {
+ "name": "metadata",
+ "type": "Sequence[Tuple[str, str]"
+ }
+ ],
+ "resultType": "google.cloud.logging_v2.services.config_service_v2.pagers.ListExclusionsAsyncPager",
+ "shortName": "list_exclusions"
+ },
+ "description": "Sample for ListExclusions",
+ "file": "logging_v2_generated_config_service_v2_list_exclusions_async.py",
+ "language": "PYTHON",
+ "origin": "API_DEFINITION",
+ "regionTag": "logging_v2_generated_ConfigServiceV2_ListExclusions_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"
+ }
+ ],
+ "title": "logging_v2_generated_config_service_v2_list_exclusions_async.py"
+ },
+ {
+ "canonical": true,
+ "clientMethod": {
+ "client": {
+ "fullName": "google.cloud.logging_v2.ConfigServiceV2Client",
+ "shortName": "ConfigServiceV2Client"
+ },
+ "fullName": "google.cloud.logging_v2.ConfigServiceV2Client.list_exclusions",
+ "method": {
+ "fullName": "google.logging.v2.ConfigServiceV2.ListExclusions",
+ "service": {
+ "fullName": "google.logging.v2.ConfigServiceV2",
+ "shortName": "ConfigServiceV2"
+ },
+ "shortName": "ListExclusions"
+ },
+ "parameters": [
+ {
+ "name": "request",
+ "type": "google.cloud.logging_v2.types.ListExclusionsRequest"
+ },
+ {
+ "name": "parent",
+ "type": "str"
+ },
+ {
+ "name": "retry",
+ "type": "google.api_core.retry.Retry"
+ },
+ {
+ "name": "timeout",
+ "type": "float"
+ },
+ {
+ "name": "metadata",
+ "type": "Sequence[Tuple[str, str]"
+ }
+ ],
+ "resultType": "google.cloud.logging_v2.services.config_service_v2.pagers.ListExclusionsPager",
+ "shortName": "list_exclusions"
+ },
+ "description": "Sample for ListExclusions",
+ "file": "logging_v2_generated_config_service_v2_list_exclusions_sync.py",
+ "language": "PYTHON",
+ "origin": "API_DEFINITION",
+ "regionTag": "logging_v2_generated_ConfigServiceV2_ListExclusions_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"
+ }
+ ],
+ "title": "logging_v2_generated_config_service_v2_list_exclusions_sync.py"
+ },
+ {
+ "canonical": true,
+ "clientMethod": {
+ "async": true,
+ "client": {
+ "fullName": "google.cloud.logging_v2.ConfigServiceV2AsyncClient",
+ "shortName": "ConfigServiceV2AsyncClient"
+ },
+ "fullName": "google.cloud.logging_v2.ConfigServiceV2AsyncClient.list_sinks",
+ "method": {
+ "fullName": "google.logging.v2.ConfigServiceV2.ListSinks",
+ "service": {
+ "fullName": "google.logging.v2.ConfigServiceV2",
+ "shortName": "ConfigServiceV2"
+ },
+ "shortName": "ListSinks"
+ },
+ "parameters": [
+ {
+ "name": "request",
+ "type": "google.cloud.logging_v2.types.ListSinksRequest"
+ },
+ {
+ "name": "parent",
+ "type": "str"
+ },
+ {
+ "name": "retry",
+ "type": "google.api_core.retry.Retry"
+ },
+ {
+ "name": "timeout",
+ "type": "float"
+ },
+ {
+ "name": "metadata",
+ "type": "Sequence[Tuple[str, str]"
+ }
+ ],
+ "resultType": "google.cloud.logging_v2.services.config_service_v2.pagers.ListSinksAsyncPager",
+ "shortName": "list_sinks"
+ },
+ "description": "Sample for ListSinks",
+ "file": "logging_v2_generated_config_service_v2_list_sinks_async.py",
+ "language": "PYTHON",
+ "origin": "API_DEFINITION",
+ "regionTag": "logging_v2_generated_ConfigServiceV2_ListSinks_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"
+ }
+ ],
+ "title": "logging_v2_generated_config_service_v2_list_sinks_async.py"
+ },
+ {
+ "canonical": true,
+ "clientMethod": {
+ "client": {
+ "fullName": "google.cloud.logging_v2.ConfigServiceV2Client",
+ "shortName": "ConfigServiceV2Client"
+ },
+ "fullName": "google.cloud.logging_v2.ConfigServiceV2Client.list_sinks",
+ "method": {
+ "fullName": "google.logging.v2.ConfigServiceV2.ListSinks",
+ "service": {
+ "fullName": "google.logging.v2.ConfigServiceV2",
+ "shortName": "ConfigServiceV2"
+ },
+ "shortName": "ListSinks"
+ },
+ "parameters": [
+ {
+ "name": "request",
+ "type": "google.cloud.logging_v2.types.ListSinksRequest"
+ },
+ {
+ "name": "parent",
+ "type": "str"
+ },
+ {
+ "name": "retry",
+ "type": "google.api_core.retry.Retry"
+ },
+ {
+ "name": "timeout",
+ "type": "float"
+ },
+ {
+ "name": "metadata",
+ "type": "Sequence[Tuple[str, str]"
+ }
+ ],
+ "resultType": "google.cloud.logging_v2.services.config_service_v2.pagers.ListSinksPager",
+ "shortName": "list_sinks"
+ },
+ "description": "Sample for ListSinks",
+ "file": "logging_v2_generated_config_service_v2_list_sinks_sync.py",
+ "language": "PYTHON",
+ "origin": "API_DEFINITION",
+ "regionTag": "logging_v2_generated_ConfigServiceV2_ListSinks_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"
+ }
+ ],
+ "title": "logging_v2_generated_config_service_v2_list_sinks_sync.py"
+ },
+ {
+ "canonical": true,
+ "clientMethod": {
+ "async": true,
+ "client": {
+ "fullName": "google.cloud.logging_v2.ConfigServiceV2AsyncClient",
+ "shortName": "ConfigServiceV2AsyncClient"
+ },
+ "fullName": "google.cloud.logging_v2.ConfigServiceV2AsyncClient.list_views",
+ "method": {
+ "fullName": "google.logging.v2.ConfigServiceV2.ListViews",
+ "service": {
+ "fullName": "google.logging.v2.ConfigServiceV2",
+ "shortName": "ConfigServiceV2"
+ },
+ "shortName": "ListViews"
+ },
+ "parameters": [
+ {
+ "name": "request",
+ "type": "google.cloud.logging_v2.types.ListViewsRequest"
+ },
+ {
+ "name": "parent",
+ "type": "str"
+ },
+ {
+ "name": "retry",
+ "type": "google.api_core.retry.Retry"
+ },
+ {
+ "name": "timeout",
+ "type": "float"
+ },
+ {
+ "name": "metadata",
+ "type": "Sequence[Tuple[str, str]"
+ }
+ ],
+ "resultType": "google.cloud.logging_v2.services.config_service_v2.pagers.ListViewsAsyncPager",
+ "shortName": "list_views"
+ },
+ "description": "Sample for ListViews",
+ "file": "logging_v2_generated_config_service_v2_list_views_async.py",
+ "language": "PYTHON",
+ "origin": "API_DEFINITION",
+ "regionTag": "logging_v2_generated_ConfigServiceV2_ListViews_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"
+ }
+ ],
+ "title": "logging_v2_generated_config_service_v2_list_views_async.py"
+ },
+ {
+ "canonical": true,
+ "clientMethod": {
+ "client": {
+ "fullName": "google.cloud.logging_v2.ConfigServiceV2Client",
+ "shortName": "ConfigServiceV2Client"
+ },
+ "fullName": "google.cloud.logging_v2.ConfigServiceV2Client.list_views",
+ "method": {
+ "fullName": "google.logging.v2.ConfigServiceV2.ListViews",
+ "service": {
+ "fullName": "google.logging.v2.ConfigServiceV2",
+ "shortName": "ConfigServiceV2"
+ },
+ "shortName": "ListViews"
+ },
+ "parameters": [
+ {
+ "name": "request",
+ "type": "google.cloud.logging_v2.types.ListViewsRequest"
+ },
+ {
+ "name": "parent",
+ "type": "str"
+ },
+ {
+ "name": "retry",
+ "type": "google.api_core.retry.Retry"
+ },
+ {
+ "name": "timeout",
+ "type": "float"
+ },
+ {
+ "name": "metadata",
+ "type": "Sequence[Tuple[str, str]"
+ }
+ ],
+ "resultType": "google.cloud.logging_v2.services.config_service_v2.pagers.ListViewsPager",
+ "shortName": "list_views"
+ },
+ "description": "Sample for ListViews",
+ "file": "logging_v2_generated_config_service_v2_list_views_sync.py",
+ "language": "PYTHON",
+ "origin": "API_DEFINITION",
+ "regionTag": "logging_v2_generated_ConfigServiceV2_ListViews_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"
+ }
+ ],
+ "title": "logging_v2_generated_config_service_v2_list_views_sync.py"
+ },
+ {
+ "canonical": true,
+ "clientMethod": {
+ "async": true,
+ "client": {
+ "fullName": "google.cloud.logging_v2.ConfigServiceV2AsyncClient",
+ "shortName": "ConfigServiceV2AsyncClient"
+ },
+ "fullName": "google.cloud.logging_v2.ConfigServiceV2AsyncClient.undelete_bucket",
+ "method": {
+ "fullName": "google.logging.v2.ConfigServiceV2.UndeleteBucket",
+ "service": {
+ "fullName": "google.logging.v2.ConfigServiceV2",
+ "shortName": "ConfigServiceV2"
+ },
+ "shortName": "UndeleteBucket"
+ },
+ "parameters": [
+ {
+ "name": "request",
+ "type": "google.cloud.logging_v2.types.UndeleteBucketRequest"
+ },
+ {
+ "name": "retry",
+ "type": "google.api_core.retry.Retry"
+ },
+ {
+ "name": "timeout",
+ "type": "float"
+ },
+ {
+ "name": "metadata",
+ "type": "Sequence[Tuple[str, str]"
+ }
+ ],
+ "shortName": "undelete_bucket"
+ },
+ "description": "Sample for UndeleteBucket",
+ "file": "logging_v2_generated_config_service_v2_undelete_bucket_async.py",
+ "language": "PYTHON",
+ "origin": "API_DEFINITION",
+ "regionTag": "logging_v2_generated_ConfigServiceV2_UndeleteBucket_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"
+ }
+ ],
+ "title": "logging_v2_generated_config_service_v2_undelete_bucket_async.py"
+ },
+ {
+ "canonical": true,
+ "clientMethod": {
+ "client": {
+ "fullName": "google.cloud.logging_v2.ConfigServiceV2Client",
+ "shortName": "ConfigServiceV2Client"
+ },
+ "fullName": "google.cloud.logging_v2.ConfigServiceV2Client.undelete_bucket",
+ "method": {
+ "fullName": "google.logging.v2.ConfigServiceV2.UndeleteBucket",
+ "service": {
+ "fullName": "google.logging.v2.ConfigServiceV2",
+ "shortName": "ConfigServiceV2"
+ },
+ "shortName": "UndeleteBucket"
+ },
+ "parameters": [
+ {
+ "name": "request",
+ "type": "google.cloud.logging_v2.types.UndeleteBucketRequest"
+ },
+ {
+ "name": "retry",
+ "type": "google.api_core.retry.Retry"
+ },
+ {
+ "name": "timeout",
+ "type": "float"
+ },
+ {
+ "name": "metadata",
+ "type": "Sequence[Tuple[str, str]"
+ }
+ ],
+ "shortName": "undelete_bucket"
+ },
+ "description": "Sample for UndeleteBucket",
+ "file": "logging_v2_generated_config_service_v2_undelete_bucket_sync.py",
+ "language": "PYTHON",
+ "origin": "API_DEFINITION",
+ "regionTag": "logging_v2_generated_ConfigServiceV2_UndeleteBucket_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"
+ }
+ ],
+ "title": "logging_v2_generated_config_service_v2_undelete_bucket_sync.py"
+ },
+ {
+ "canonical": true,
+ "clientMethod": {
+ "async": true,
+ "client": {
+ "fullName": "google.cloud.logging_v2.ConfigServiceV2AsyncClient",
+ "shortName": "ConfigServiceV2AsyncClient"
+ },
+ "fullName": "google.cloud.logging_v2.ConfigServiceV2AsyncClient.update_bucket",
+ "method": {
+ "fullName": "google.logging.v2.ConfigServiceV2.UpdateBucket",
+ "service": {
+ "fullName": "google.logging.v2.ConfigServiceV2",
+ "shortName": "ConfigServiceV2"
+ },
+ "shortName": "UpdateBucket"
+ },
+ "parameters": [
+ {
+ "name": "request",
+ "type": "google.cloud.logging_v2.types.UpdateBucketRequest"
+ },
+ {
+ "name": "retry",
+ "type": "google.api_core.retry.Retry"
+ },
+ {
+ "name": "timeout",
+ "type": "float"
+ },
+ {
+ "name": "metadata",
+ "type": "Sequence[Tuple[str, str]"
+ }
+ ],
+ "resultType": "google.cloud.logging_v2.types.LogBucket",
+ "shortName": "update_bucket"
+ },
+ "description": "Sample for UpdateBucket",
+ "file": "logging_v2_generated_config_service_v2_update_bucket_async.py",
+ "language": "PYTHON",
+ "origin": "API_DEFINITION",
+ "regionTag": "logging_v2_generated_ConfigServiceV2_UpdateBucket_async",
+ "segments": [
+ {
+ "end": 44,
+ "start": 27,
+ "type": "FULL"
+ },
+ {
+ "end": 44,
+ "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": 45,
+ "start": 42,
+ "type": "RESPONSE_HANDLING"
+ }
+ ],
+ "title": "logging_v2_generated_config_service_v2_update_bucket_async.py"
+ },
+ {
+ "canonical": true,
+ "clientMethod": {
+ "client": {
+ "fullName": "google.cloud.logging_v2.ConfigServiceV2Client",
+ "shortName": "ConfigServiceV2Client"
+ },
+ "fullName": "google.cloud.logging_v2.ConfigServiceV2Client.update_bucket",
+ "method": {
+ "fullName": "google.logging.v2.ConfigServiceV2.UpdateBucket",
+ "service": {
+ "fullName": "google.logging.v2.ConfigServiceV2",
+ "shortName": "ConfigServiceV2"
+ },
+ "shortName": "UpdateBucket"
+ },
+ "parameters": [
+ {
+ "name": "request",
+ "type": "google.cloud.logging_v2.types.UpdateBucketRequest"
+ },
+ {
+ "name": "retry",
+ "type": "google.api_core.retry.Retry"
+ },
+ {
+ "name": "timeout",
+ "type": "float"
+ },
+ {
+ "name": "metadata",
+ "type": "Sequence[Tuple[str, str]"
+ }
+ ],
+ "resultType": "google.cloud.logging_v2.types.LogBucket",
+ "shortName": "update_bucket"
+ },
+ "description": "Sample for UpdateBucket",
+ "file": "logging_v2_generated_config_service_v2_update_bucket_sync.py",
+ "language": "PYTHON",
+ "origin": "API_DEFINITION",
+ "regionTag": "logging_v2_generated_ConfigServiceV2_UpdateBucket_sync",
+ "segments": [
+ {
+ "end": 44,
+ "start": 27,
+ "type": "FULL"
+ },
+ {
+ "end": 44,
+ "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": 45,
+ "start": 42,
+ "type": "RESPONSE_HANDLING"
+ }
+ ],
+ "title": "logging_v2_generated_config_service_v2_update_bucket_sync.py"
+ },
+ {
+ "canonical": true,
+ "clientMethod": {
+ "async": true,
+ "client": {
+ "fullName": "google.cloud.logging_v2.ConfigServiceV2AsyncClient",
+ "shortName": "ConfigServiceV2AsyncClient"
+ },
+ "fullName": "google.cloud.logging_v2.ConfigServiceV2AsyncClient.update_cmek_settings",
+ "method": {
+ "fullName": "google.logging.v2.ConfigServiceV2.UpdateCmekSettings",
+ "service": {
+ "fullName": "google.logging.v2.ConfigServiceV2",
+ "shortName": "ConfigServiceV2"
+ },
+ "shortName": "UpdateCmekSettings"
+ },
+ "parameters": [
+ {
+ "name": "request",
+ "type": "google.cloud.logging_v2.types.UpdateCmekSettingsRequest"
+ },
+ {
+ "name": "retry",
+ "type": "google.api_core.retry.Retry"
+ },
+ {
+ "name": "timeout",
+ "type": "float"
+ },
+ {
+ "name": "metadata",
+ "type": "Sequence[Tuple[str, str]"
+ }
+ ],
+ "resultType": "google.cloud.logging_v2.types.CmekSettings",
+ "shortName": "update_cmek_settings"
+ },
+ "description": "Sample for UpdateCmekSettings",
+ "file": "logging_v2_generated_config_service_v2_update_cmek_settings_async.py",
+ "language": "PYTHON",
+ "origin": "API_DEFINITION",
+ "regionTag": "logging_v2_generated_ConfigServiceV2_UpdateCmekSettings_async",
+ "segments": [
+ {
+ "end": 44,
+ "start": 27,
+ "type": "FULL"
+ },
+ {
+ "end": 44,
+ "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": 45,
+ "start": 42,
+ "type": "RESPONSE_HANDLING"
+ }
+ ],
+ "title": "logging_v2_generated_config_service_v2_update_cmek_settings_async.py"
+ },
+ {
+ "canonical": true,
+ "clientMethod": {
+ "client": {
+ "fullName": "google.cloud.logging_v2.ConfigServiceV2Client",
+ "shortName": "ConfigServiceV2Client"
+ },
+ "fullName": "google.cloud.logging_v2.ConfigServiceV2Client.update_cmek_settings",
+ "method": {
+ "fullName": "google.logging.v2.ConfigServiceV2.UpdateCmekSettings",
+ "service": {
+ "fullName": "google.logging.v2.ConfigServiceV2",
+ "shortName": "ConfigServiceV2"
+ },
+ "shortName": "UpdateCmekSettings"
+ },
+ "parameters": [
+ {
+ "name": "request",
+ "type": "google.cloud.logging_v2.types.UpdateCmekSettingsRequest"
+ },
+ {
+ "name": "retry",
+ "type": "google.api_core.retry.Retry"
+ },
+ {
+ "name": "timeout",
+ "type": "float"
+ },
+ {
+ "name": "metadata",
+ "type": "Sequence[Tuple[str, str]"
+ }
+ ],
+ "resultType": "google.cloud.logging_v2.types.CmekSettings",
+ "shortName": "update_cmek_settings"
+ },
+ "description": "Sample for UpdateCmekSettings",
+ "file": "logging_v2_generated_config_service_v2_update_cmek_settings_sync.py",
+ "language": "PYTHON",
+ "origin": "API_DEFINITION",
+ "regionTag": "logging_v2_generated_ConfigServiceV2_UpdateCmekSettings_sync",
+ "segments": [
+ {
+ "end": 44,
+ "start": 27,
+ "type": "FULL"
+ },
+ {
+ "end": 44,
+ "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": 45,
+ "start": 42,
+ "type": "RESPONSE_HANDLING"
+ }
+ ],
+ "title": "logging_v2_generated_config_service_v2_update_cmek_settings_sync.py"
+ },
+ {
+ "canonical": true,
+ "clientMethod": {
+ "async": true,
+ "client": {
+ "fullName": "google.cloud.logging_v2.ConfigServiceV2AsyncClient",
+ "shortName": "ConfigServiceV2AsyncClient"
+ },
+ "fullName": "google.cloud.logging_v2.ConfigServiceV2AsyncClient.update_exclusion",
+ "method": {
+ "fullName": "google.logging.v2.ConfigServiceV2.UpdateExclusion",
+ "service": {
+ "fullName": "google.logging.v2.ConfigServiceV2",
+ "shortName": "ConfigServiceV2"
+ },
+ "shortName": "UpdateExclusion"
+ },
+ "parameters": [
+ {
+ "name": "request",
+ "type": "google.cloud.logging_v2.types.UpdateExclusionRequest"
+ },
+ {
+ "name": "name",
+ "type": "str"
+ },
+ {
+ "name": "exclusion",
+ "type": "google.cloud.logging_v2.types.LogExclusion"
+ },
+ {
+ "name": "update_mask",
+ "type": "google.protobuf.field_mask_pb2.FieldMask"
+ },
+ {
+ "name": "retry",
+ "type": "google.api_core.retry.Retry"
+ },
+ {
+ "name": "timeout",
+ "type": "float"
+ },
+ {
+ "name": "metadata",
+ "type": "Sequence[Tuple[str, str]"
+ }
+ ],
+ "resultType": "google.cloud.logging_v2.types.LogExclusion",
+ "shortName": "update_exclusion"
+ },
+ "description": "Sample for UpdateExclusion",
+ "file": "logging_v2_generated_config_service_v2_update_exclusion_async.py",
+ "language": "PYTHON",
+ "origin": "API_DEFINITION",
+ "regionTag": "logging_v2_generated_ConfigServiceV2_UpdateExclusion_async",
+ "segments": [
+ {
+ "end": 49,
+ "start": 27,
+ "type": "FULL"
+ },
+ {
+ "end": 49,
+ "start": 27,
+ "type": "SHORT"
+ },
+ {
+ "end": 33,
+ "start": 31,
+ "type": "CLIENT_INITIALIZATION"
+ },
+ {
+ "end": 43,
+ "start": 34,
+ "type": "REQUEST_INITIALIZATION"
+ },
+ {
+ "end": 46,
+ "start": 44,
+ "type": "REQUEST_EXECUTION"
+ },
+ {
+ "end": 50,
+ "start": 47,
+ "type": "RESPONSE_HANDLING"
+ }
+ ],
+ "title": "logging_v2_generated_config_service_v2_update_exclusion_async.py"
+ },
+ {
+ "canonical": true,
+ "clientMethod": {
+ "client": {
+ "fullName": "google.cloud.logging_v2.ConfigServiceV2Client",
+ "shortName": "ConfigServiceV2Client"
+ },
+ "fullName": "google.cloud.logging_v2.ConfigServiceV2Client.update_exclusion",
+ "method": {
+ "fullName": "google.logging.v2.ConfigServiceV2.UpdateExclusion",
+ "service": {
+ "fullName": "google.logging.v2.ConfigServiceV2",
+ "shortName": "ConfigServiceV2"
+ },
+ "shortName": "UpdateExclusion"
+ },
+ "parameters": [
+ {
+ "name": "request",
+ "type": "google.cloud.logging_v2.types.UpdateExclusionRequest"
+ },
+ {
+ "name": "name",
+ "type": "str"
+ },
+ {
+ "name": "exclusion",
+ "type": "google.cloud.logging_v2.types.LogExclusion"
+ },
+ {
+ "name": "update_mask",
+ "type": "google.protobuf.field_mask_pb2.FieldMask"
+ },
+ {
+ "name": "retry",
+ "type": "google.api_core.retry.Retry"
+ },
+ {
+ "name": "timeout",
+ "type": "float"
+ },
+ {
+ "name": "metadata",
+ "type": "Sequence[Tuple[str, str]"
+ }
+ ],
+ "resultType": "google.cloud.logging_v2.types.LogExclusion",
+ "shortName": "update_exclusion"
+ },
+ "description": "Sample for UpdateExclusion",
+ "file": "logging_v2_generated_config_service_v2_update_exclusion_sync.py",
+ "language": "PYTHON",
+ "origin": "API_DEFINITION",
+ "regionTag": "logging_v2_generated_ConfigServiceV2_UpdateExclusion_sync",
+ "segments": [
+ {
+ "end": 49,
+ "start": 27,
+ "type": "FULL"
+ },
+ {
+ "end": 49,
+ "start": 27,
+ "type": "SHORT"
+ },
+ {
+ "end": 33,
+ "start": 31,
+ "type": "CLIENT_INITIALIZATION"
+ },
+ {
+ "end": 43,
+ "start": 34,
+ "type": "REQUEST_INITIALIZATION"
+ },
+ {
+ "end": 46,
+ "start": 44,
+ "type": "REQUEST_EXECUTION"
+ },
+ {
+ "end": 50,
+ "start": 47,
+ "type": "RESPONSE_HANDLING"
+ }
+ ],
+ "title": "logging_v2_generated_config_service_v2_update_exclusion_sync.py"
+ },
+ {
+ "canonical": true,
+ "clientMethod": {
+ "async": true,
+ "client": {
+ "fullName": "google.cloud.logging_v2.ConfigServiceV2AsyncClient",
+ "shortName": "ConfigServiceV2AsyncClient"
+ },
+ "fullName": "google.cloud.logging_v2.ConfigServiceV2AsyncClient.update_settings",
+ "method": {
+ "fullName": "google.logging.v2.ConfigServiceV2.UpdateSettings",
+ "service": {
+ "fullName": "google.logging.v2.ConfigServiceV2",
+ "shortName": "ConfigServiceV2"
+ },
+ "shortName": "UpdateSettings"
+ },
+ "parameters": [
+ {
+ "name": "request",
+ "type": "google.cloud.logging_v2.types.UpdateSettingsRequest"
+ },
+ {
+ "name": "settings",
+ "type": "google.cloud.logging_v2.types.Settings"
+ },
+ {
+ "name": "update_mask",
+ "type": "google.protobuf.field_mask_pb2.FieldMask"
+ },
+ {
+ "name": "retry",
+ "type": "google.api_core.retry.Retry"
+ },
+ {
+ "name": "timeout",
+ "type": "float"
+ },
+ {
+ "name": "metadata",
+ "type": "Sequence[Tuple[str, str]"
+ }
+ ],
+ "resultType": "google.cloud.logging_v2.types.Settings",
+ "shortName": "update_settings"
+ },
+ "description": "Sample for UpdateSettings",
+ "file": "logging_v2_generated_config_service_v2_update_settings_async.py",
+ "language": "PYTHON",
+ "origin": "API_DEFINITION",
+ "regionTag": "logging_v2_generated_ConfigServiceV2_UpdateSettings_async",
+ "segments": [
+ {
+ "end": 44,
+ "start": 27,
+ "type": "FULL"
+ },
+ {
+ "end": 44,
+ "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": 45,
+ "start": 42,
+ "type": "RESPONSE_HANDLING"
+ }
+ ],
+ "title": "logging_v2_generated_config_service_v2_update_settings_async.py"
+ },
+ {
+ "canonical": true,
+ "clientMethod": {
+ "client": {
+ "fullName": "google.cloud.logging_v2.ConfigServiceV2Client",
+ "shortName": "ConfigServiceV2Client"
+ },
+ "fullName": "google.cloud.logging_v2.ConfigServiceV2Client.update_settings",
+ "method": {
+ "fullName": "google.logging.v2.ConfigServiceV2.UpdateSettings",
+ "service": {
+ "fullName": "google.logging.v2.ConfigServiceV2",
+ "shortName": "ConfigServiceV2"
+ },
+ "shortName": "UpdateSettings"
+ },
+ "parameters": [
+ {
+ "name": "request",
+ "type": "google.cloud.logging_v2.types.UpdateSettingsRequest"
+ },
+ {
+ "name": "settings",
+ "type": "google.cloud.logging_v2.types.Settings"
+ },
+ {
+ "name": "update_mask",
+ "type": "google.protobuf.field_mask_pb2.FieldMask"
+ },
+ {
+ "name": "retry",
+ "type": "google.api_core.retry.Retry"
+ },
+ {
+ "name": "timeout",
+ "type": "float"
+ },
+ {
+ "name": "metadata",
+ "type": "Sequence[Tuple[str, str]"
+ }
+ ],
+ "resultType": "google.cloud.logging_v2.types.Settings",
+ "shortName": "update_settings"
+ },
+ "description": "Sample for UpdateSettings",
+ "file": "logging_v2_generated_config_service_v2_update_settings_sync.py",
+ "language": "PYTHON",
+ "origin": "API_DEFINITION",
+ "regionTag": "logging_v2_generated_ConfigServiceV2_UpdateSettings_sync",
+ "segments": [
+ {
+ "end": 44,
+ "start": 27,
+ "type": "FULL"
+ },
+ {
+ "end": 44,
+ "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": 45,
+ "start": 42,
+ "type": "RESPONSE_HANDLING"
+ }
+ ],
+ "title": "logging_v2_generated_config_service_v2_update_settings_sync.py"
+ },
+ {
+ "canonical": true,
+ "clientMethod": {
+ "async": true,
+ "client": {
+ "fullName": "google.cloud.logging_v2.ConfigServiceV2AsyncClient",
+ "shortName": "ConfigServiceV2AsyncClient"
+ },
+ "fullName": "google.cloud.logging_v2.ConfigServiceV2AsyncClient.update_sink",
+ "method": {
+ "fullName": "google.logging.v2.ConfigServiceV2.UpdateSink",
+ "service": {
+ "fullName": "google.logging.v2.ConfigServiceV2",
+ "shortName": "ConfigServiceV2"
+ },
+ "shortName": "UpdateSink"
+ },
+ "parameters": [
+ {
+ "name": "request",
+ "type": "google.cloud.logging_v2.types.UpdateSinkRequest"
+ },
+ {
+ "name": "sink_name",
+ "type": "str"
+ },
+ {
+ "name": "sink",
+ "type": "google.cloud.logging_v2.types.LogSink"
+ },
+ {
+ "name": "update_mask",
+ "type": "google.protobuf.field_mask_pb2.FieldMask"
+ },
+ {
+ "name": "retry",
+ "type": "google.api_core.retry.Retry"
+ },
+ {
+ "name": "timeout",
+ "type": "float"
+ },
+ {
+ "name": "metadata",
+ "type": "Sequence[Tuple[str, str]"
+ }
+ ],
+ "resultType": "google.cloud.logging_v2.types.LogSink",
+ "shortName": "update_sink"
+ },
+ "description": "Sample for UpdateSink",
+ "file": "logging_v2_generated_config_service_v2_update_sink_async.py",
+ "language": "PYTHON",
+ "origin": "API_DEFINITION",
+ "regionTag": "logging_v2_generated_ConfigServiceV2_UpdateSink_async",
+ "segments": [
+ {
+ "end": 49,
+ "start": 27,
+ "type": "FULL"
+ },
+ {
+ "end": 49,
+ "start": 27,
+ "type": "SHORT"
+ },
+ {
+ "end": 33,
+ "start": 31,
+ "type": "CLIENT_INITIALIZATION"
+ },
+ {
+ "end": 43,
+ "start": 34,
+ "type": "REQUEST_INITIALIZATION"
+ },
+ {
+ "end": 46,
+ "start": 44,
+ "type": "REQUEST_EXECUTION"
+ },
+ {
+ "end": 50,
+ "start": 47,
+ "type": "RESPONSE_HANDLING"
+ }
+ ],
+ "title": "logging_v2_generated_config_service_v2_update_sink_async.py"
+ },
+ {
+ "canonical": true,
+ "clientMethod": {
+ "client": {
+ "fullName": "google.cloud.logging_v2.ConfigServiceV2Client",
+ "shortName": "ConfigServiceV2Client"
+ },
+ "fullName": "google.cloud.logging_v2.ConfigServiceV2Client.update_sink",
+ "method": {
+ "fullName": "google.logging.v2.ConfigServiceV2.UpdateSink",
+ "service": {
+ "fullName": "google.logging.v2.ConfigServiceV2",
+ "shortName": "ConfigServiceV2"
+ },
+ "shortName": "UpdateSink"
+ },
+ "parameters": [
+ {
+ "name": "request",
+ "type": "google.cloud.logging_v2.types.UpdateSinkRequest"
+ },
+ {
+ "name": "sink_name",
+ "type": "str"
+ },
+ {
+ "name": "sink",
+ "type": "google.cloud.logging_v2.types.LogSink"
+ },
+ {
+ "name": "update_mask",
+ "type": "google.protobuf.field_mask_pb2.FieldMask"
+ },
+ {
+ "name": "retry",
+ "type": "google.api_core.retry.Retry"
+ },
+ {
+ "name": "timeout",
+ "type": "float"
+ },
+ {
+ "name": "metadata",
+ "type": "Sequence[Tuple[str, str]"
+ }
+ ],
+ "resultType": "google.cloud.logging_v2.types.LogSink",
+ "shortName": "update_sink"
+ },
+ "description": "Sample for UpdateSink",
+ "file": "logging_v2_generated_config_service_v2_update_sink_sync.py",
+ "language": "PYTHON",
+ "origin": "API_DEFINITION",
+ "regionTag": "logging_v2_generated_ConfigServiceV2_UpdateSink_sync",
+ "segments": [
+ {
+ "end": 49,
+ "start": 27,
+ "type": "FULL"
+ },
+ {
+ "end": 49,
+ "start": 27,
+ "type": "SHORT"
+ },
+ {
+ "end": 33,
+ "start": 31,
+ "type": "CLIENT_INITIALIZATION"
+ },
+ {
+ "end": 43,
+ "start": 34,
+ "type": "REQUEST_INITIALIZATION"
+ },
+ {
+ "end": 46,
+ "start": 44,
+ "type": "REQUEST_EXECUTION"
+ },
+ {
+ "end": 50,
+ "start": 47,
+ "type": "RESPONSE_HANDLING"
+ }
+ ],
+ "title": "logging_v2_generated_config_service_v2_update_sink_sync.py"
+ },
+ {
+ "canonical": true,
+ "clientMethod": {
+ "async": true,
+ "client": {
+ "fullName": "google.cloud.logging_v2.ConfigServiceV2AsyncClient",
+ "shortName": "ConfigServiceV2AsyncClient"
+ },
+ "fullName": "google.cloud.logging_v2.ConfigServiceV2AsyncClient.update_view",
+ "method": {
+ "fullName": "google.logging.v2.ConfigServiceV2.UpdateView",
+ "service": {
+ "fullName": "google.logging.v2.ConfigServiceV2",
+ "shortName": "ConfigServiceV2"
+ },
+ "shortName": "UpdateView"
+ },
+ "parameters": [
+ {
+ "name": "request",
+ "type": "google.cloud.logging_v2.types.UpdateViewRequest"
+ },
+ {
+ "name": "retry",
+ "type": "google.api_core.retry.Retry"
+ },
+ {
+ "name": "timeout",
+ "type": "float"
+ },
+ {
+ "name": "metadata",
+ "type": "Sequence[Tuple[str, str]"
+ }
+ ],
+ "resultType": "google.cloud.logging_v2.types.LogView",
+ "shortName": "update_view"
+ },
+ "description": "Sample for UpdateView",
+ "file": "logging_v2_generated_config_service_v2_update_view_async.py",
+ "language": "PYTHON",
+ "origin": "API_DEFINITION",
+ "regionTag": "logging_v2_generated_ConfigServiceV2_UpdateView_async",
+ "segments": [
+ {
+ "end": 44,
+ "start": 27,
+ "type": "FULL"
+ },
+ {
+ "end": 44,
+ "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": 45,
+ "start": 42,
+ "type": "RESPONSE_HANDLING"
+ }
+ ],
+ "title": "logging_v2_generated_config_service_v2_update_view_async.py"
+ },
+ {
+ "canonical": true,
+ "clientMethod": {
+ "client": {
+ "fullName": "google.cloud.logging_v2.ConfigServiceV2Client",
+ "shortName": "ConfigServiceV2Client"
+ },
+ "fullName": "google.cloud.logging_v2.ConfigServiceV2Client.update_view",
+ "method": {
+ "fullName": "google.logging.v2.ConfigServiceV2.UpdateView",
+ "service": {
+ "fullName": "google.logging.v2.ConfigServiceV2",
+ "shortName": "ConfigServiceV2"
+ },
+ "shortName": "UpdateView"
+ },
+ "parameters": [
+ {
+ "name": "request",
+ "type": "google.cloud.logging_v2.types.UpdateViewRequest"
+ },
+ {
+ "name": "retry",
+ "type": "google.api_core.retry.Retry"
+ },
+ {
+ "name": "timeout",
+ "type": "float"
+ },
+ {
+ "name": "metadata",
+ "type": "Sequence[Tuple[str, str]"
+ }
+ ],
+ "resultType": "google.cloud.logging_v2.types.LogView",
+ "shortName": "update_view"
+ },
+ "description": "Sample for UpdateView",
+ "file": "logging_v2_generated_config_service_v2_update_view_sync.py",
+ "language": "PYTHON",
+ "origin": "API_DEFINITION",
+ "regionTag": "logging_v2_generated_ConfigServiceV2_UpdateView_sync",
+ "segments": [
+ {
+ "end": 44,
+ "start": 27,
+ "type": "FULL"
+ },
+ {
+ "end": 44,
+ "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": 45,
+ "start": 42,
+ "type": "RESPONSE_HANDLING"
+ }
+ ],
+ "title": "logging_v2_generated_config_service_v2_update_view_sync.py"
+ },
+ {
+ "canonical": true,
+ "clientMethod": {
+ "async": true,
+ "client": {
+ "fullName": "google.cloud.logging_v2.LoggingServiceV2AsyncClient",
+ "shortName": "LoggingServiceV2AsyncClient"
+ },
+ "fullName": "google.cloud.logging_v2.LoggingServiceV2AsyncClient.delete_log",
+ "method": {
+ "fullName": "google.logging.v2.LoggingServiceV2.DeleteLog",
+ "service": {
+ "fullName": "google.logging.v2.LoggingServiceV2",
+ "shortName": "LoggingServiceV2"
+ },
+ "shortName": "DeleteLog"
+ },
+ "parameters": [
+ {
+ "name": "request",
+ "type": "google.cloud.logging_v2.types.DeleteLogRequest"
+ },
+ {
+ "name": "log_name",
+ "type": "str"
+ },
+ {
+ "name": "retry",
+ "type": "google.api_core.retry.Retry"
+ },
+ {
+ "name": "timeout",
+ "type": "float"
+ },
+ {
+ "name": "metadata",
+ "type": "Sequence[Tuple[str, str]"
+ }
+ ],
+ "shortName": "delete_log"
+ },
+ "description": "Sample for DeleteLog",
+ "file": "logging_v2_generated_logging_service_v2_delete_log_async.py",
+ "language": "PYTHON",
+ "origin": "API_DEFINITION",
+ "regionTag": "logging_v2_generated_LoggingServiceV2_DeleteLog_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"
+ }
+ ],
+ "title": "logging_v2_generated_logging_service_v2_delete_log_async.py"
+ },
+ {
+ "canonical": true,
+ "clientMethod": {
+ "client": {
+ "fullName": "google.cloud.logging_v2.LoggingServiceV2Client",
+ "shortName": "LoggingServiceV2Client"
+ },
+ "fullName": "google.cloud.logging_v2.LoggingServiceV2Client.delete_log",
+ "method": {
+ "fullName": "google.logging.v2.LoggingServiceV2.DeleteLog",
+ "service": {
+ "fullName": "google.logging.v2.LoggingServiceV2",
+ "shortName": "LoggingServiceV2"
+ },
+ "shortName": "DeleteLog"
+ },
+ "parameters": [
+ {
+ "name": "request",
+ "type": "google.cloud.logging_v2.types.DeleteLogRequest"
+ },
+ {
+ "name": "log_name",
+ "type": "str"
+ },
+ {
+ "name": "retry",
+ "type": "google.api_core.retry.Retry"
+ },
+ {
+ "name": "timeout",
+ "type": "float"
+ },
+ {
+ "name": "metadata",
+ "type": "Sequence[Tuple[str, str]"
+ }
+ ],
+ "shortName": "delete_log"
+ },
+ "description": "Sample for DeleteLog",
+ "file": "logging_v2_generated_logging_service_v2_delete_log_sync.py",
+ "language": "PYTHON",
+ "origin": "API_DEFINITION",
+ "regionTag": "logging_v2_generated_LoggingServiceV2_DeleteLog_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"
+ }
+ ],
+ "title": "logging_v2_generated_logging_service_v2_delete_log_sync.py"
+ },
+ {
+ "canonical": true,
+ "clientMethod": {
+ "async": true,
+ "client": {
+ "fullName": "google.cloud.logging_v2.LoggingServiceV2AsyncClient",
+ "shortName": "LoggingServiceV2AsyncClient"
+ },
+ "fullName": "google.cloud.logging_v2.LoggingServiceV2AsyncClient.list_log_entries",
+ "method": {
+ "fullName": "google.logging.v2.LoggingServiceV2.ListLogEntries",
+ "service": {
+ "fullName": "google.logging.v2.LoggingServiceV2",
+ "shortName": "LoggingServiceV2"
+ },
+ "shortName": "ListLogEntries"
+ },
+ "parameters": [
+ {
+ "name": "request",
+ "type": "google.cloud.logging_v2.types.ListLogEntriesRequest"
+ },
+ {
+ "name": "resource_names",
+ "type": "Sequence[str]"
+ },
+ {
+ "name": "filter",
+ "type": "str"
+ },
+ {
+ "name": "order_by",
+ "type": "str"
+ },
+ {
+ "name": "retry",
+ "type": "google.api_core.retry.Retry"
+ },
+ {
+ "name": "timeout",
+ "type": "float"
+ },
+ {
+ "name": "metadata",
+ "type": "Sequence[Tuple[str, str]"
+ }
+ ],
+ "resultType": "google.cloud.logging_v2.services.logging_service_v2.pagers.ListLogEntriesAsyncPager",
+ "shortName": "list_log_entries"
+ },
+ "description": "Sample for ListLogEntries",
+ "file": "logging_v2_generated_logging_service_v2_list_log_entries_async.py",
+ "language": "PYTHON",
+ "origin": "API_DEFINITION",
+ "regionTag": "logging_v2_generated_LoggingServiceV2_ListLogEntries_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"
+ }
+ ],
+ "title": "logging_v2_generated_logging_service_v2_list_log_entries_async.py"
+ },
+ {
+ "canonical": true,
+ "clientMethod": {
+ "client": {
+ "fullName": "google.cloud.logging_v2.LoggingServiceV2Client",
+ "shortName": "LoggingServiceV2Client"
+ },
+ "fullName": "google.cloud.logging_v2.LoggingServiceV2Client.list_log_entries",
+ "method": {
+ "fullName": "google.logging.v2.LoggingServiceV2.ListLogEntries",
+ "service": {
+ "fullName": "google.logging.v2.LoggingServiceV2",
+ "shortName": "LoggingServiceV2"
+ },
+ "shortName": "ListLogEntries"
+ },
+ "parameters": [
+ {
+ "name": "request",
+ "type": "google.cloud.logging_v2.types.ListLogEntriesRequest"
+ },
+ {
+ "name": "resource_names",
+ "type": "Sequence[str]"
+ },
+ {
+ "name": "filter",
+ "type": "str"
+ },
+ {
+ "name": "order_by",
+ "type": "str"
+ },
+ {
+ "name": "retry",
+ "type": "google.api_core.retry.Retry"
+ },
+ {
+ "name": "timeout",
+ "type": "float"
+ },
+ {
+ "name": "metadata",
+ "type": "Sequence[Tuple[str, str]"
+ }
+ ],
+ "resultType": "google.cloud.logging_v2.services.logging_service_v2.pagers.ListLogEntriesPager",
+ "shortName": "list_log_entries"
+ },
+ "description": "Sample for ListLogEntries",
+ "file": "logging_v2_generated_logging_service_v2_list_log_entries_sync.py",
+ "language": "PYTHON",
+ "origin": "API_DEFINITION",
+ "regionTag": "logging_v2_generated_LoggingServiceV2_ListLogEntries_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"
+ }
+ ],
+ "title": "logging_v2_generated_logging_service_v2_list_log_entries_sync.py"
+ },
+ {
+ "canonical": true,
+ "clientMethod": {
+ "async": true,
+ "client": {
+ "fullName": "google.cloud.logging_v2.LoggingServiceV2AsyncClient",
+ "shortName": "LoggingServiceV2AsyncClient"
+ },
+ "fullName": "google.cloud.logging_v2.LoggingServiceV2AsyncClient.list_logs",
+ "method": {
+ "fullName": "google.logging.v2.LoggingServiceV2.ListLogs",
+ "service": {
+ "fullName": "google.logging.v2.LoggingServiceV2",
+ "shortName": "LoggingServiceV2"
+ },
+ "shortName": "ListLogs"
+ },
+ "parameters": [
+ {
+ "name": "request",
+ "type": "google.cloud.logging_v2.types.ListLogsRequest"
+ },
+ {
+ "name": "parent",
+ "type": "str"
+ },
+ {
+ "name": "retry",
+ "type": "google.api_core.retry.Retry"
+ },
+ {
+ "name": "timeout",
+ "type": "float"
+ },
+ {
+ "name": "metadata",
+ "type": "Sequence[Tuple[str, str]"
+ }
+ ],
+ "resultType": "google.cloud.logging_v2.services.logging_service_v2.pagers.ListLogsAsyncPager",
+ "shortName": "list_logs"
+ },
+ "description": "Sample for ListLogs",
+ "file": "logging_v2_generated_logging_service_v2_list_logs_async.py",
+ "language": "PYTHON",
+ "origin": "API_DEFINITION",
+ "regionTag": "logging_v2_generated_LoggingServiceV2_ListLogs_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"
+ }
+ ],
+ "title": "logging_v2_generated_logging_service_v2_list_logs_async.py"
+ },
+ {
+ "canonical": true,
+ "clientMethod": {
+ "client": {
+ "fullName": "google.cloud.logging_v2.LoggingServiceV2Client",
+ "shortName": "LoggingServiceV2Client"
+ },
+ "fullName": "google.cloud.logging_v2.LoggingServiceV2Client.list_logs",
+ "method": {
+ "fullName": "google.logging.v2.LoggingServiceV2.ListLogs",
+ "service": {
+ "fullName": "google.logging.v2.LoggingServiceV2",
+ "shortName": "LoggingServiceV2"
+ },
+ "shortName": "ListLogs"
+ },
+ "parameters": [
+ {
+ "name": "request",
+ "type": "google.cloud.logging_v2.types.ListLogsRequest"
+ },
+ {
+ "name": "parent",
+ "type": "str"
+ },
+ {
+ "name": "retry",
+ "type": "google.api_core.retry.Retry"
+ },
+ {
+ "name": "timeout",
+ "type": "float"
+ },
+ {
+ "name": "metadata",
+ "type": "Sequence[Tuple[str, str]"
+ }
+ ],
+ "resultType": "google.cloud.logging_v2.services.logging_service_v2.pagers.ListLogsPager",
+ "shortName": "list_logs"
+ },
+ "description": "Sample for ListLogs",
+ "file": "logging_v2_generated_logging_service_v2_list_logs_sync.py",
+ "language": "PYTHON",
+ "origin": "API_DEFINITION",
+ "regionTag": "logging_v2_generated_LoggingServiceV2_ListLogs_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"
+ }
+ ],
+ "title": "logging_v2_generated_logging_service_v2_list_logs_sync.py"
+ },
+ {
+ "canonical": true,
+ "clientMethod": {
+ "async": true,
+ "client": {
+ "fullName": "google.cloud.logging_v2.LoggingServiceV2AsyncClient",
+ "shortName": "LoggingServiceV2AsyncClient"
+ },
+ "fullName": "google.cloud.logging_v2.LoggingServiceV2AsyncClient.list_monitored_resource_descriptors",
+ "method": {
+ "fullName": "google.logging.v2.LoggingServiceV2.ListMonitoredResourceDescriptors",
+ "service": {
+ "fullName": "google.logging.v2.LoggingServiceV2",
+ "shortName": "LoggingServiceV2"
+ },
+ "shortName": "ListMonitoredResourceDescriptors"
+ },
+ "parameters": [
+ {
+ "name": "request",
+ "type": "google.cloud.logging_v2.types.ListMonitoredResourceDescriptorsRequest"
+ },
+ {
+ "name": "retry",
+ "type": "google.api_core.retry.Retry"
+ },
+ {
+ "name": "timeout",
+ "type": "float"
+ },
+ {
+ "name": "metadata",
+ "type": "Sequence[Tuple[str, str]"
+ }
+ ],
+ "resultType": "google.cloud.logging_v2.services.logging_service_v2.pagers.ListMonitoredResourceDescriptorsAsyncPager",
+ "shortName": "list_monitored_resource_descriptors"
+ },
+ "description": "Sample for ListMonitoredResourceDescriptors",
+ "file": "logging_v2_generated_logging_service_v2_list_monitored_resource_descriptors_async.py",
+ "language": "PYTHON",
+ "origin": "API_DEFINITION",
+ "regionTag": "logging_v2_generated_LoggingServiceV2_ListMonitoredResourceDescriptors_async",
+ "segments": [
+ {
+ "end": 44,
+ "start": 27,
+ "type": "FULL"
+ },
+ {
+ "end": 44,
+ "start": 27,
+ "type": "SHORT"
+ },
+ {
+ "end": 33,
+ "start": 31,
+ "type": "CLIENT_INITIALIZATION"
+ },
+ {
+ "end": 37,
+ "start": 34,
+ "type": "REQUEST_INITIALIZATION"
+ },
+ {
+ "end": 40,
+ "start": 38,
+ "type": "REQUEST_EXECUTION"
+ },
+ {
+ "end": 45,
+ "start": 41,
+ "type": "RESPONSE_HANDLING"
+ }
+ ],
+ "title": "logging_v2_generated_logging_service_v2_list_monitored_resource_descriptors_async.py"
+ },
+ {
+ "canonical": true,
+ "clientMethod": {
+ "client": {
+ "fullName": "google.cloud.logging_v2.LoggingServiceV2Client",
+ "shortName": "LoggingServiceV2Client"
+ },
+ "fullName": "google.cloud.logging_v2.LoggingServiceV2Client.list_monitored_resource_descriptors",
+ "method": {
+ "fullName": "google.logging.v2.LoggingServiceV2.ListMonitoredResourceDescriptors",
+ "service": {
+ "fullName": "google.logging.v2.LoggingServiceV2",
+ "shortName": "LoggingServiceV2"
+ },
+ "shortName": "ListMonitoredResourceDescriptors"
+ },
+ "parameters": [
+ {
+ "name": "request",
+ "type": "google.cloud.logging_v2.types.ListMonitoredResourceDescriptorsRequest"
+ },
+ {
+ "name": "retry",
+ "type": "google.api_core.retry.Retry"
+ },
+ {
+ "name": "timeout",
+ "type": "float"
+ },
+ {
+ "name": "metadata",
+ "type": "Sequence[Tuple[str, str]"
+ }
+ ],
+ "resultType": "google.cloud.logging_v2.services.logging_service_v2.pagers.ListMonitoredResourceDescriptorsPager",
+ "shortName": "list_monitored_resource_descriptors"
+ },
+ "description": "Sample for ListMonitoredResourceDescriptors",
+ "file": "logging_v2_generated_logging_service_v2_list_monitored_resource_descriptors_sync.py",
+ "language": "PYTHON",
+ "origin": "API_DEFINITION",
+ "regionTag": "logging_v2_generated_LoggingServiceV2_ListMonitoredResourceDescriptors_sync",
+ "segments": [
+ {
+ "end": 44,
+ "start": 27,
+ "type": "FULL"
+ },
+ {
+ "end": 44,
+ "start": 27,
+ "type": "SHORT"
+ },
+ {
+ "end": 33,
+ "start": 31,
+ "type": "CLIENT_INITIALIZATION"
+ },
+ {
+ "end": 37,
+ "start": 34,
+ "type": "REQUEST_INITIALIZATION"
+ },
+ {
+ "end": 40,
+ "start": 38,
+ "type": "REQUEST_EXECUTION"
+ },
+ {
+ "end": 45,
+ "start": 41,
+ "type": "RESPONSE_HANDLING"
+ }
+ ],
+ "title": "logging_v2_generated_logging_service_v2_list_monitored_resource_descriptors_sync.py"
+ },
+ {
+ "canonical": true,
+ "clientMethod": {
+ "async": true,
+ "client": {
+ "fullName": "google.cloud.logging_v2.LoggingServiceV2AsyncClient",
+ "shortName": "LoggingServiceV2AsyncClient"
+ },
+ "fullName": "google.cloud.logging_v2.LoggingServiceV2AsyncClient.tail_log_entries",
+ "method": {
+ "fullName": "google.logging.v2.LoggingServiceV2.TailLogEntries",
+ "service": {
+ "fullName": "google.logging.v2.LoggingServiceV2",
+ "shortName": "LoggingServiceV2"
+ },
+ "shortName": "TailLogEntries"
+ },
+ "parameters": [
+ {
+ "name": "requests",
+ "type": "Iterator[google.cloud.logging_v2.types.TailLogEntriesRequest]"
+ },
+ {
+ "name": "retry",
+ "type": "google.api_core.retry.Retry"
+ },
+ {
+ "name": "timeout",
+ "type": "float"
+ },
+ {
+ "name": "metadata",
+ "type": "Sequence[Tuple[str, str]"
+ }
+ ],
+ "resultType": "Iterable[google.cloud.logging_v2.types.TailLogEntriesResponse]",
+ "shortName": "tail_log_entries"
+ },
+ "description": "Sample for TailLogEntries",
+ "file": "logging_v2_generated_logging_service_v2_tail_log_entries_async.py",
+ "language": "PYTHON",
+ "origin": "API_DEFINITION",
+ "regionTag": "logging_v2_generated_LoggingServiceV2_TailLogEntries_async",
+ "segments": [
+ {
+ "end": 55,
+ "start": 27,
+ "type": "FULL"
+ },
+ {
+ "end": 55,
+ "start": 27,
+ "type": "SHORT"
+ },
+ {
+ "end": 33,
+ "start": 31,
+ "type": "CLIENT_INITIALIZATION"
+ },
+ {
+ "end": 48,
+ "start": 34,
+ "type": "REQUEST_INITIALIZATION"
+ },
+ {
+ "end": 51,
+ "start": 49,
+ "type": "REQUEST_EXECUTION"
+ },
+ {
+ "end": 56,
+ "start": 52,
+ "type": "RESPONSE_HANDLING"
+ }
+ ],
+ "title": "logging_v2_generated_logging_service_v2_tail_log_entries_async.py"
+ },
+ {
+ "canonical": true,
+ "clientMethod": {
+ "client": {
+ "fullName": "google.cloud.logging_v2.LoggingServiceV2Client",
+ "shortName": "LoggingServiceV2Client"
+ },
+ "fullName": "google.cloud.logging_v2.LoggingServiceV2Client.tail_log_entries",
+ "method": {
+ "fullName": "google.logging.v2.LoggingServiceV2.TailLogEntries",
+ "service": {
+ "fullName": "google.logging.v2.LoggingServiceV2",
+ "shortName": "LoggingServiceV2"
+ },
+ "shortName": "TailLogEntries"
+ },
+ "parameters": [
+ {
+ "name": "requests",
+ "type": "Iterator[google.cloud.logging_v2.types.TailLogEntriesRequest]"
+ },
+ {
+ "name": "retry",
+ "type": "google.api_core.retry.Retry"
+ },
+ {
+ "name": "timeout",
+ "type": "float"
+ },
+ {
+ "name": "metadata",
+ "type": "Sequence[Tuple[str, str]"
+ }
+ ],
+ "resultType": "Iterable[google.cloud.logging_v2.types.TailLogEntriesResponse]",
+ "shortName": "tail_log_entries"
+ },
+ "description": "Sample for TailLogEntries",
+ "file": "logging_v2_generated_logging_service_v2_tail_log_entries_sync.py",
+ "language": "PYTHON",
+ "origin": "API_DEFINITION",
+ "regionTag": "logging_v2_generated_LoggingServiceV2_TailLogEntries_sync",
+ "segments": [
+ {
+ "end": 55,
+ "start": 27,
+ "type": "FULL"
+ },
+ {
+ "end": 55,
+ "start": 27,
+ "type": "SHORT"
+ },
+ {
+ "end": 33,
+ "start": 31,
+ "type": "CLIENT_INITIALIZATION"
+ },
+ {
+ "end": 48,
+ "start": 34,
+ "type": "REQUEST_INITIALIZATION"
+ },
+ {
+ "end": 51,
+ "start": 49,
+ "type": "REQUEST_EXECUTION"
+ },
+ {
+ "end": 56,
+ "start": 52,
+ "type": "RESPONSE_HANDLING"
+ }
+ ],
+ "title": "logging_v2_generated_logging_service_v2_tail_log_entries_sync.py"
+ },
+ {
+ "canonical": true,
+ "clientMethod": {
+ "async": true,
+ "client": {
+ "fullName": "google.cloud.logging_v2.LoggingServiceV2AsyncClient",
+ "shortName": "LoggingServiceV2AsyncClient"
+ },
+ "fullName": "google.cloud.logging_v2.LoggingServiceV2AsyncClient.write_log_entries",
+ "method": {
+ "fullName": "google.logging.v2.LoggingServiceV2.WriteLogEntries",
+ "service": {
+ "fullName": "google.logging.v2.LoggingServiceV2",
+ "shortName": "LoggingServiceV2"
+ },
+ "shortName": "WriteLogEntries"
+ },
+ "parameters": [
+ {
+ "name": "request",
+ "type": "google.cloud.logging_v2.types.WriteLogEntriesRequest"
+ },
+ {
+ "name": "log_name",
+ "type": "str"
+ },
+ {
+ "name": "resource",
+ "type": "google.api.monitored_resource_pb2.MonitoredResource"
+ },
+ {
+ "name": "labels",
+ "type": "Mapping[str, str]"
+ },
+ {
+ "name": "entries",
+ "type": "Sequence[google.cloud.logging_v2.types.LogEntry]"
+ },
+ {
+ "name": "retry",
+ "type": "google.api_core.retry.Retry"
+ },
+ {
+ "name": "timeout",
+ "type": "float"
+ },
+ {
+ "name": "metadata",
+ "type": "Sequence[Tuple[str, str]"
+ }
+ ],
+ "resultType": "google.cloud.logging_v2.types.WriteLogEntriesResponse",
+ "shortName": "write_log_entries"
+ },
+ "description": "Sample for WriteLogEntries",
+ "file": "logging_v2_generated_logging_service_v2_write_log_entries_async.py",
+ "language": "PYTHON",
+ "origin": "API_DEFINITION",
+ "regionTag": "logging_v2_generated_LoggingServiceV2_WriteLogEntries_async",
+ "segments": [
+ {
+ "end": 47,
+ "start": 27,
+ "type": "FULL"
+ },
+ {
+ "end": 47,
+ "start": 27,
+ "type": "SHORT"
+ },
+ {
+ "end": 33,
+ "start": 31,
+ "type": "CLIENT_INITIALIZATION"
+ },
+ {
+ "end": 41,
+ "start": 34,
+ "type": "REQUEST_INITIALIZATION"
+ },
+ {
+ "end": 44,
+ "start": 42,
+ "type": "REQUEST_EXECUTION"
+ },
+ {
+ "end": 48,
+ "start": 45,
+ "type": "RESPONSE_HANDLING"
+ }
+ ],
+ "title": "logging_v2_generated_logging_service_v2_write_log_entries_async.py"
+ },
+ {
+ "canonical": true,
+ "clientMethod": {
+ "client": {
+ "fullName": "google.cloud.logging_v2.LoggingServiceV2Client",
+ "shortName": "LoggingServiceV2Client"
+ },
+ "fullName": "google.cloud.logging_v2.LoggingServiceV2Client.write_log_entries",
+ "method": {
+ "fullName": "google.logging.v2.LoggingServiceV2.WriteLogEntries",
+ "service": {
+ "fullName": "google.logging.v2.LoggingServiceV2",
+ "shortName": "LoggingServiceV2"
+ },
+ "shortName": "WriteLogEntries"
+ },
+ "parameters": [
+ {
+ "name": "request",
+ "type": "google.cloud.logging_v2.types.WriteLogEntriesRequest"
+ },
+ {
+ "name": "log_name",
+ "type": "str"
+ },
+ {
+ "name": "resource",
+ "type": "google.api.monitored_resource_pb2.MonitoredResource"
+ },
+ {
+ "name": "labels",
+ "type": "Mapping[str, str]"
+ },
+ {
+ "name": "entries",
+ "type": "Sequence[google.cloud.logging_v2.types.LogEntry]"
+ },
+ {
+ "name": "retry",
+ "type": "google.api_core.retry.Retry"
+ },
+ {
+ "name": "timeout",
+ "type": "float"
+ },
+ {
+ "name": "metadata",
+ "type": "Sequence[Tuple[str, str]"
+ }
+ ],
+ "resultType": "google.cloud.logging_v2.types.WriteLogEntriesResponse",
+ "shortName": "write_log_entries"
+ },
+ "description": "Sample for WriteLogEntries",
+ "file": "logging_v2_generated_logging_service_v2_write_log_entries_sync.py",
+ "language": "PYTHON",
+ "origin": "API_DEFINITION",
+ "regionTag": "logging_v2_generated_LoggingServiceV2_WriteLogEntries_sync",
+ "segments": [
+ {
+ "end": 47,
+ "start": 27,
+ "type": "FULL"
+ },
+ {
+ "end": 47,
+ "start": 27,
+ "type": "SHORT"
+ },
+ {
+ "end": 33,
+ "start": 31,
+ "type": "CLIENT_INITIALIZATION"
+ },
+ {
+ "end": 41,
+ "start": 34,
+ "type": "REQUEST_INITIALIZATION"
+ },
+ {
+ "end": 44,
+ "start": 42,
+ "type": "REQUEST_EXECUTION"
+ },
+ {
+ "end": 48,
+ "start": 45,
+ "type": "RESPONSE_HANDLING"
+ }
+ ],
+ "title": "logging_v2_generated_logging_service_v2_write_log_entries_sync.py"
+ },
+ {
+ "canonical": true,
+ "clientMethod": {
+ "async": true,
+ "client": {
+ "fullName": "google.cloud.logging_v2.MetricsServiceV2AsyncClient",
+ "shortName": "MetricsServiceV2AsyncClient"
+ },
+ "fullName": "google.cloud.logging_v2.MetricsServiceV2AsyncClient.create_log_metric",
+ "method": {
+ "fullName": "google.logging.v2.MetricsServiceV2.CreateLogMetric",
+ "service": {
+ "fullName": "google.logging.v2.MetricsServiceV2",
+ "shortName": "MetricsServiceV2"
+ },
+ "shortName": "CreateLogMetric"
+ },
+ "parameters": [
+ {
+ "name": "request",
+ "type": "google.cloud.logging_v2.types.CreateLogMetricRequest"
+ },
+ {
+ "name": "parent",
+ "type": "str"
+ },
+ {
+ "name": "metric",
+ "type": "google.cloud.logging_v2.types.LogMetric"
+ },
+ {
+ "name": "retry",
+ "type": "google.api_core.retry.Retry"
+ },
+ {
+ "name": "timeout",
+ "type": "float"
+ },
+ {
+ "name": "metadata",
+ "type": "Sequence[Tuple[str, str]"
+ }
+ ],
+ "resultType": "google.cloud.logging_v2.types.LogMetric",
+ "shortName": "create_log_metric"
+ },
+ "description": "Sample for CreateLogMetric",
+ "file": "logging_v2_generated_metrics_service_v2_create_log_metric_async.py",
+ "language": "PYTHON",
+ "origin": "API_DEFINITION",
+ "regionTag": "logging_v2_generated_MetricsServiceV2_CreateLogMetric_async",
+ "segments": [
+ {
+ "end": 49,
+ "start": 27,
+ "type": "FULL"
+ },
+ {
+ "end": 49,
+ "start": 27,
+ "type": "SHORT"
+ },
+ {
+ "end": 33,
+ "start": 31,
+ "type": "CLIENT_INITIALIZATION"
+ },
+ {
+ "end": 43,
+ "start": 34,
+ "type": "REQUEST_INITIALIZATION"
+ },
+ {
+ "end": 46,
+ "start": 44,
+ "type": "REQUEST_EXECUTION"
+ },
+ {
+ "end": 50,
+ "start": 47,
+ "type": "RESPONSE_HANDLING"
+ }
+ ],
+ "title": "logging_v2_generated_metrics_service_v2_create_log_metric_async.py"
+ },
+ {
+ "canonical": true,
+ "clientMethod": {
+ "client": {
+ "fullName": "google.cloud.logging_v2.MetricsServiceV2Client",
+ "shortName": "MetricsServiceV2Client"
+ },
+ "fullName": "google.cloud.logging_v2.MetricsServiceV2Client.create_log_metric",
+ "method": {
+ "fullName": "google.logging.v2.MetricsServiceV2.CreateLogMetric",
+ "service": {
+ "fullName": "google.logging.v2.MetricsServiceV2",
+ "shortName": "MetricsServiceV2"
+ },
+ "shortName": "CreateLogMetric"
+ },
+ "parameters": [
+ {
+ "name": "request",
+ "type": "google.cloud.logging_v2.types.CreateLogMetricRequest"
+ },
+ {
+ "name": "parent",
+ "type": "str"
+ },
+ {
+ "name": "metric",
+ "type": "google.cloud.logging_v2.types.LogMetric"
+ },
+ {
+ "name": "retry",
+ "type": "google.api_core.retry.Retry"
+ },
+ {
+ "name": "timeout",
+ "type": "float"
+ },
+ {
+ "name": "metadata",
+ "type": "Sequence[Tuple[str, str]"
+ }
+ ],
+ "resultType": "google.cloud.logging_v2.types.LogMetric",
+ "shortName": "create_log_metric"
+ },
+ "description": "Sample for CreateLogMetric",
+ "file": "logging_v2_generated_metrics_service_v2_create_log_metric_sync.py",
+ "language": "PYTHON",
+ "origin": "API_DEFINITION",
+ "regionTag": "logging_v2_generated_MetricsServiceV2_CreateLogMetric_sync",
+ "segments": [
+ {
+ "end": 49,
+ "start": 27,
+ "type": "FULL"
+ },
+ {
+ "end": 49,
+ "start": 27,
+ "type": "SHORT"
+ },
+ {
+ "end": 33,
+ "start": 31,
+ "type": "CLIENT_INITIALIZATION"
+ },
+ {
+ "end": 43,
+ "start": 34,
+ "type": "REQUEST_INITIALIZATION"
+ },
+ {
+ "end": 46,
+ "start": 44,
+ "type": "REQUEST_EXECUTION"
+ },
+ {
+ "end": 50,
+ "start": 47,
+ "type": "RESPONSE_HANDLING"
+ }
+ ],
+ "title": "logging_v2_generated_metrics_service_v2_create_log_metric_sync.py"
+ },
+ {
+ "canonical": true,
+ "clientMethod": {
+ "async": true,
+ "client": {
+ "fullName": "google.cloud.logging_v2.MetricsServiceV2AsyncClient",
+ "shortName": "MetricsServiceV2AsyncClient"
+ },
+ "fullName": "google.cloud.logging_v2.MetricsServiceV2AsyncClient.delete_log_metric",
+ "method": {
+ "fullName": "google.logging.v2.MetricsServiceV2.DeleteLogMetric",
+ "service": {
+ "fullName": "google.logging.v2.MetricsServiceV2",
+ "shortName": "MetricsServiceV2"
+ },
+ "shortName": "DeleteLogMetric"
+ },
+ "parameters": [
+ {
+ "name": "request",
+ "type": "google.cloud.logging_v2.types.DeleteLogMetricRequest"
+ },
+ {
+ "name": "metric_name",
+ "type": "str"
+ },
+ {
+ "name": "retry",
+ "type": "google.api_core.retry.Retry"
+ },
+ {
+ "name": "timeout",
+ "type": "float"
+ },
+ {
+ "name": "metadata",
+ "type": "Sequence[Tuple[str, str]"
+ }
+ ],
+ "shortName": "delete_log_metric"
+ },
+ "description": "Sample for DeleteLogMetric",
+ "file": "logging_v2_generated_metrics_service_v2_delete_log_metric_async.py",
+ "language": "PYTHON",
+ "origin": "API_DEFINITION",
+ "regionTag": "logging_v2_generated_MetricsServiceV2_DeleteLogMetric_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"
+ }
+ ],
+ "title": "logging_v2_generated_metrics_service_v2_delete_log_metric_async.py"
+ },
+ {
+ "canonical": true,
+ "clientMethod": {
+ "client": {
+ "fullName": "google.cloud.logging_v2.MetricsServiceV2Client",
+ "shortName": "MetricsServiceV2Client"
+ },
+ "fullName": "google.cloud.logging_v2.MetricsServiceV2Client.delete_log_metric",
+ "method": {
+ "fullName": "google.logging.v2.MetricsServiceV2.DeleteLogMetric",
+ "service": {
+ "fullName": "google.logging.v2.MetricsServiceV2",
+ "shortName": "MetricsServiceV2"
+ },
+ "shortName": "DeleteLogMetric"
+ },
+ "parameters": [
+ {
+ "name": "request",
+ "type": "google.cloud.logging_v2.types.DeleteLogMetricRequest"
+ },
+ {
+ "name": "metric_name",
+ "type": "str"
+ },
+ {
+ "name": "retry",
+ "type": "google.api_core.retry.Retry"
+ },
+ {
+ "name": "timeout",
+ "type": "float"
+ },
+ {
+ "name": "metadata",
+ "type": "Sequence[Tuple[str, str]"
+ }
+ ],
+ "shortName": "delete_log_metric"
+ },
+ "description": "Sample for DeleteLogMetric",
+ "file": "logging_v2_generated_metrics_service_v2_delete_log_metric_sync.py",
+ "language": "PYTHON",
+ "origin": "API_DEFINITION",
+ "regionTag": "logging_v2_generated_MetricsServiceV2_DeleteLogMetric_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"
+ }
+ ],
+ "title": "logging_v2_generated_metrics_service_v2_delete_log_metric_sync.py"
+ },
+ {
+ "canonical": true,
+ "clientMethod": {
+ "async": true,
+ "client": {
+ "fullName": "google.cloud.logging_v2.MetricsServiceV2AsyncClient",
+ "shortName": "MetricsServiceV2AsyncClient"
+ },
+ "fullName": "google.cloud.logging_v2.MetricsServiceV2AsyncClient.get_log_metric",
+ "method": {
+ "fullName": "google.logging.v2.MetricsServiceV2.GetLogMetric",
+ "service": {
+ "fullName": "google.logging.v2.MetricsServiceV2",
+ "shortName": "MetricsServiceV2"
+ },
+ "shortName": "GetLogMetric"
+ },
+ "parameters": [
+ {
+ "name": "request",
+ "type": "google.cloud.logging_v2.types.GetLogMetricRequest"
+ },
+ {
+ "name": "metric_name",
+ "type": "str"
+ },
+ {
+ "name": "retry",
+ "type": "google.api_core.retry.Retry"
+ },
+ {
+ "name": "timeout",
+ "type": "float"
+ },
+ {
+ "name": "metadata",
+ "type": "Sequence[Tuple[str, str]"
+ }
+ ],
+ "resultType": "google.cloud.logging_v2.types.LogMetric",
+ "shortName": "get_log_metric"
+ },
+ "description": "Sample for GetLogMetric",
+ "file": "logging_v2_generated_metrics_service_v2_get_log_metric_async.py",
+ "language": "PYTHON",
+ "origin": "API_DEFINITION",
+ "regionTag": "logging_v2_generated_MetricsServiceV2_GetLogMetric_async",
+ "segments": [
+ {
+ "end": 44,
+ "start": 27,
+ "type": "FULL"
+ },
+ {
+ "end": 44,
+ "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": 45,
+ "start": 42,
+ "type": "RESPONSE_HANDLING"
+ }
+ ],
+ "title": "logging_v2_generated_metrics_service_v2_get_log_metric_async.py"
+ },
+ {
+ "canonical": true,
+ "clientMethod": {
+ "client": {
+ "fullName": "google.cloud.logging_v2.MetricsServiceV2Client",
+ "shortName": "MetricsServiceV2Client"
+ },
+ "fullName": "google.cloud.logging_v2.MetricsServiceV2Client.get_log_metric",
+ "method": {
+ "fullName": "google.logging.v2.MetricsServiceV2.GetLogMetric",
+ "service": {
+ "fullName": "google.logging.v2.MetricsServiceV2",
+ "shortName": "MetricsServiceV2"
+ },
+ "shortName": "GetLogMetric"
+ },
+ "parameters": [
+ {
+ "name": "request",
+ "type": "google.cloud.logging_v2.types.GetLogMetricRequest"
+ },
+ {
+ "name": "metric_name",
+ "type": "str"
+ },
+ {
+ "name": "retry",
+ "type": "google.api_core.retry.Retry"
+ },
+ {
+ "name": "timeout",
+ "type": "float"
+ },
+ {
+ "name": "metadata",
+ "type": "Sequence[Tuple[str, str]"
+ }
+ ],
+ "resultType": "google.cloud.logging_v2.types.LogMetric",
+ "shortName": "get_log_metric"
+ },
+ "description": "Sample for GetLogMetric",
+ "file": "logging_v2_generated_metrics_service_v2_get_log_metric_sync.py",
+ "language": "PYTHON",
+ "origin": "API_DEFINITION",
+ "regionTag": "logging_v2_generated_MetricsServiceV2_GetLogMetric_sync",
+ "segments": [
+ {
+ "end": 44,
+ "start": 27,
+ "type": "FULL"
+ },
+ {
+ "end": 44,
+ "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": 45,
+ "start": 42,
+ "type": "RESPONSE_HANDLING"
+ }
+ ],
+ "title": "logging_v2_generated_metrics_service_v2_get_log_metric_sync.py"
+ },
+ {
+ "canonical": true,
+ "clientMethod": {
+ "async": true,
+ "client": {
+ "fullName": "google.cloud.logging_v2.MetricsServiceV2AsyncClient",
+ "shortName": "MetricsServiceV2AsyncClient"
+ },
+ "fullName": "google.cloud.logging_v2.MetricsServiceV2AsyncClient.list_log_metrics",
+ "method": {
+ "fullName": "google.logging.v2.MetricsServiceV2.ListLogMetrics",
+ "service": {
+ "fullName": "google.logging.v2.MetricsServiceV2",
+ "shortName": "MetricsServiceV2"
+ },
+ "shortName": "ListLogMetrics"
+ },
+ "parameters": [
+ {
+ "name": "request",
+ "type": "google.cloud.logging_v2.types.ListLogMetricsRequest"
+ },
+ {
+ "name": "parent",
+ "type": "str"
+ },
+ {
+ "name": "retry",
+ "type": "google.api_core.retry.Retry"
+ },
+ {
+ "name": "timeout",
+ "type": "float"
+ },
+ {
+ "name": "metadata",
+ "type": "Sequence[Tuple[str, str]"
+ }
+ ],
+ "resultType": "google.cloud.logging_v2.services.metrics_service_v2.pagers.ListLogMetricsAsyncPager",
+ "shortName": "list_log_metrics"
+ },
+ "description": "Sample for ListLogMetrics",
+ "file": "logging_v2_generated_metrics_service_v2_list_log_metrics_async.py",
+ "language": "PYTHON",
+ "origin": "API_DEFINITION",
+ "regionTag": "logging_v2_generated_MetricsServiceV2_ListLogMetrics_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"
+ }
+ ],
+ "title": "logging_v2_generated_metrics_service_v2_list_log_metrics_async.py"
+ },
+ {
+ "canonical": true,
+ "clientMethod": {
+ "client": {
+ "fullName": "google.cloud.logging_v2.MetricsServiceV2Client",
+ "shortName": "MetricsServiceV2Client"
+ },
+ "fullName": "google.cloud.logging_v2.MetricsServiceV2Client.list_log_metrics",
+ "method": {
+ "fullName": "google.logging.v2.MetricsServiceV2.ListLogMetrics",
+ "service": {
+ "fullName": "google.logging.v2.MetricsServiceV2",
+ "shortName": "MetricsServiceV2"
+ },
+ "shortName": "ListLogMetrics"
+ },
+ "parameters": [
+ {
+ "name": "request",
+ "type": "google.cloud.logging_v2.types.ListLogMetricsRequest"
+ },
+ {
+ "name": "parent",
+ "type": "str"
+ },
+ {
+ "name": "retry",
+ "type": "google.api_core.retry.Retry"
+ },
+ {
+ "name": "timeout",
+ "type": "float"
+ },
+ {
+ "name": "metadata",
+ "type": "Sequence[Tuple[str, str]"
+ }
+ ],
+ "resultType": "google.cloud.logging_v2.services.metrics_service_v2.pagers.ListLogMetricsPager",
+ "shortName": "list_log_metrics"
+ },
+ "description": "Sample for ListLogMetrics",
+ "file": "logging_v2_generated_metrics_service_v2_list_log_metrics_sync.py",
+ "language": "PYTHON",
+ "origin": "API_DEFINITION",
+ "regionTag": "logging_v2_generated_MetricsServiceV2_ListLogMetrics_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"
+ }
+ ],
+ "title": "logging_v2_generated_metrics_service_v2_list_log_metrics_sync.py"
+ },
+ {
+ "canonical": true,
+ "clientMethod": {
+ "async": true,
+ "client": {
+ "fullName": "google.cloud.logging_v2.MetricsServiceV2AsyncClient",
+ "shortName": "MetricsServiceV2AsyncClient"
+ },
+ "fullName": "google.cloud.logging_v2.MetricsServiceV2AsyncClient.update_log_metric",
+ "method": {
+ "fullName": "google.logging.v2.MetricsServiceV2.UpdateLogMetric",
+ "service": {
+ "fullName": "google.logging.v2.MetricsServiceV2",
+ "shortName": "MetricsServiceV2"
+ },
+ "shortName": "UpdateLogMetric"
+ },
+ "parameters": [
+ {
+ "name": "request",
+ "type": "google.cloud.logging_v2.types.UpdateLogMetricRequest"
+ },
+ {
+ "name": "metric_name",
+ "type": "str"
+ },
+ {
+ "name": "metric",
+ "type": "google.cloud.logging_v2.types.LogMetric"
+ },
+ {
+ "name": "retry",
+ "type": "google.api_core.retry.Retry"
+ },
+ {
+ "name": "timeout",
+ "type": "float"
+ },
+ {
+ "name": "metadata",
+ "type": "Sequence[Tuple[str, str]"
+ }
+ ],
+ "resultType": "google.cloud.logging_v2.types.LogMetric",
+ "shortName": "update_log_metric"
+ },
+ "description": "Sample for UpdateLogMetric",
+ "file": "logging_v2_generated_metrics_service_v2_update_log_metric_async.py",
+ "language": "PYTHON",
+ "origin": "API_DEFINITION",
+ "regionTag": "logging_v2_generated_MetricsServiceV2_UpdateLogMetric_async",
+ "segments": [
+ {
+ "end": 49,
+ "start": 27,
+ "type": "FULL"
+ },
+ {
+ "end": 49,
+ "start": 27,
+ "type": "SHORT"
+ },
+ {
+ "end": 33,
+ "start": 31,
+ "type": "CLIENT_INITIALIZATION"
+ },
+ {
+ "end": 43,
+ "start": 34,
+ "type": "REQUEST_INITIALIZATION"
+ },
+ {
+ "end": 46,
+ "start": 44,
+ "type": "REQUEST_EXECUTION"
+ },
+ {
+ "end": 50,
+ "start": 47,
+ "type": "RESPONSE_HANDLING"
+ }
+ ],
+ "title": "logging_v2_generated_metrics_service_v2_update_log_metric_async.py"
+ },
+ {
+ "canonical": true,
+ "clientMethod": {
+ "client": {
+ "fullName": "google.cloud.logging_v2.MetricsServiceV2Client",
+ "shortName": "MetricsServiceV2Client"
+ },
+ "fullName": "google.cloud.logging_v2.MetricsServiceV2Client.update_log_metric",
+ "method": {
+ "fullName": "google.logging.v2.MetricsServiceV2.UpdateLogMetric",
+ "service": {
+ "fullName": "google.logging.v2.MetricsServiceV2",
+ "shortName": "MetricsServiceV2"
+ },
+ "shortName": "UpdateLogMetric"
+ },
+ "parameters": [
+ {
+ "name": "request",
+ "type": "google.cloud.logging_v2.types.UpdateLogMetricRequest"
+ },
+ {
+ "name": "metric_name",
+ "type": "str"
+ },
+ {
+ "name": "metric",
+ "type": "google.cloud.logging_v2.types.LogMetric"
+ },
+ {
+ "name": "retry",
+ "type": "google.api_core.retry.Retry"
+ },
+ {
+ "name": "timeout",
+ "type": "float"
+ },
+ {
+ "name": "metadata",
+ "type": "Sequence[Tuple[str, str]"
+ }
+ ],
+ "resultType": "google.cloud.logging_v2.types.LogMetric",
+ "shortName": "update_log_metric"
+ },
+ "description": "Sample for UpdateLogMetric",
+ "file": "logging_v2_generated_metrics_service_v2_update_log_metric_sync.py",
+ "language": "PYTHON",
+ "origin": "API_DEFINITION",
+ "regionTag": "logging_v2_generated_MetricsServiceV2_UpdateLogMetric_sync",
+ "segments": [
+ {
+ "end": 49,
+ "start": 27,
+ "type": "FULL"
+ },
+ {
+ "end": 49,
+ "start": 27,
+ "type": "SHORT"
+ },
+ {
+ "end": 33,
+ "start": 31,
+ "type": "CLIENT_INITIALIZATION"
+ },
+ {
+ "end": 43,
+ "start": 34,
+ "type": "REQUEST_INITIALIZATION"
+ },
+ {
+ "end": 46,
+ "start": 44,
+ "type": "REQUEST_EXECUTION"
+ },
+ {
+ "end": 50,
+ "start": 47,
+ "type": "RESPONSE_HANDLING"
+ }
+ ],
+ "title": "logging_v2_generated_metrics_service_v2_update_log_metric_sync.py"
+ }
+ ]
+}
diff --git a/samples/snippets/noxfile.py b/samples/snippets/noxfile.py
index 20cdfc620..38bb0a572 100644
--- a/samples/snippets/noxfile.py
+++ b/samples/snippets/noxfile.py
@@ -29,7 +29,8 @@
# WARNING - WARNING - WARNING - WARNING - WARNING
# WARNING - WARNING - WARNING - WARNING - WARNING
-BLACK_VERSION = "black==19.10b0"
+BLACK_VERSION = "black==22.3.0"
+ISORT_VERSION = "isort==5.10.1"
# Copy `noxfile_config.py` to your directory and modify it instead.
@@ -168,12 +169,32 @@ def lint(session: nox.sessions.Session) -> None:
@nox.session
def blacken(session: nox.sessions.Session) -> None:
+ """Run black. Format code to uniform standard."""
session.install(BLACK_VERSION)
python_files = [path for path in os.listdir(".") if path.endswith(".py")]
session.run("black", *python_files)
+#
+# format = isort + black
+#
+
+@nox.session
+def format(session: nox.sessions.Session) -> None:
+ """
+ Run isort to sort imports. Then run black
+ to format code to uniform standard.
+ """
+ session.install(BLACK_VERSION, ISORT_VERSION)
+ python_files = [path for path in os.listdir(".") if path.endswith(".py")]
+
+ # Use the --fss option to sort imports using strict alphabetical order.
+ # See https://pycqa.github.io/isort/docs/configuration/options.html#force-sort-within-sections
+ session.run("isort", "--fss", *python_files)
+ session.run("black", *python_files)
+
+
#
# Sample Tests
#
@@ -188,42 +209,54 @@ def _session_tests(
# check for presence of tests
test_list = glob.glob("*_test.py") + glob.glob("test_*.py")
test_list.extend(glob.glob("tests"))
+
if len(test_list) == 0:
print("No tests found, skipping directory.")
- else:
- if TEST_CONFIG["pip_version_override"]:
- pip_version = TEST_CONFIG["pip_version_override"]
- session.install(f"pip=={pip_version}")
- """Runs py.test for a particular project."""
- if os.path.exists("requirements.txt"):
- if os.path.exists("constraints.txt"):
- session.install("-r", "requirements.txt", "-c", "constraints.txt")
- else:
- session.install("-r", "requirements.txt")
-
- if os.path.exists("requirements-test.txt"):
- if os.path.exists("constraints-test.txt"):
- session.install(
- "-r", "requirements-test.txt", "-c", "constraints-test.txt"
- )
- else:
- session.install("-r", "requirements-test.txt")
-
- if INSTALL_LIBRARY_FROM_SOURCE:
- session.install("-e", _get_repo_root())
-
- if post_install:
- post_install(session)
-
- session.run(
- "pytest",
- *(PYTEST_COMMON_ARGS + session.posargs),
- # Pytest will return 5 when no tests are collected. This can happen
- # on travis where slow and flaky tests are excluded.
- # See http://doc.pytest.org/en/latest/_modules/_pytest/main.html
- success_codes=[0, 5],
- env=get_pytest_env_vars(),
- )
+ return
+
+ if TEST_CONFIG["pip_version_override"]:
+ pip_version = TEST_CONFIG["pip_version_override"]
+ session.install(f"pip=={pip_version}")
+ """Runs py.test for a particular project."""
+ concurrent_args = []
+ if os.path.exists("requirements.txt"):
+ if os.path.exists("constraints.txt"):
+ session.install("-r", "requirements.txt", "-c", "constraints.txt")
+ else:
+ session.install("-r", "requirements.txt")
+ with open("requirements.txt") as rfile:
+ packages = rfile.read()
+
+ if os.path.exists("requirements-test.txt"):
+ if os.path.exists("constraints-test.txt"):
+ session.install(
+ "-r", "requirements-test.txt", "-c", "constraints-test.txt"
+ )
+ else:
+ session.install("-r", "requirements-test.txt")
+ with open("requirements-test.txt") as rtfile:
+ packages += rtfile.read()
+
+ if INSTALL_LIBRARY_FROM_SOURCE:
+ session.install("-e", _get_repo_root())
+
+ if post_install:
+ post_install(session)
+
+ if "pytest-parallel" in packages:
+ concurrent_args.extend(['--workers', 'auto', '--tests-per-worker', 'auto'])
+ elif "pytest-xdist" in packages:
+ concurrent_args.extend(['-n', 'auto'])
+
+ session.run(
+ "pytest",
+ *(PYTEST_COMMON_ARGS + session.posargs + concurrent_args),
+ # Pytest will return 5 when no tests are collected. This can happen
+ # on travis where slow and flaky tests are excluded.
+ # See http://doc.pytest.org/en/latest/_modules/_pytest/main.html
+ success_codes=[0, 5],
+ env=get_pytest_env_vars(),
+ )
@nox.session(python=ALL_VERSIONS)
diff --git a/samples/snippets/requirements-test.txt b/samples/snippets/requirements-test.txt
index fbe6c1c5c..678dbc8ef 100644
--- a/samples/snippets/requirements-test.txt
+++ b/samples/snippets/requirements-test.txt
@@ -1,2 +1,2 @@
backoff==1.11.1
-pytest==6.2.5
+pytest==7.1.1
diff --git a/samples/snippets/requirements.txt b/samples/snippets/requirements.txt
index 0ab529f1c..acdfd4276 100644
--- a/samples/snippets/requirements.txt
+++ b/samples/snippets/requirements.txt
@@ -1,5 +1,4 @@
-google-cloud-logging==2.7.0
-google-cloud-bigquery==2.32.0
-google-cloud-storage==2.0.0; python_version == '3.6'
-google-cloud-storage==2.1.0; python_version >= '3.7'
-google-cloud-pubsub==2.9.0
+google-cloud-logging==3.0.0
+google-cloud-bigquery==3.0.1
+google-cloud-storage==2.3.0
+google-cloud-pubsub==2.12.0
diff --git a/scripts/readme-gen/readme_gen.py b/scripts/readme-gen/readme_gen.py
index d309d6e97..91b59676b 100644
--- a/scripts/readme-gen/readme_gen.py
+++ b/scripts/readme-gen/readme_gen.py
@@ -28,7 +28,10 @@
jinja_env = jinja2.Environment(
trim_blocks=True,
loader=jinja2.FileSystemLoader(
- os.path.abspath(os.path.join(os.path.dirname(__file__), 'templates'))))
+ os.path.abspath(os.path.join(os.path.dirname(__file__), "templates"))
+ ),
+ autoescape=True,
+)
README_TMPL = jinja_env.get_template('README.tmpl.rst')
diff --git a/setup.py b/setup.py
index 2cf113e34..dc26595c0 100644
--- a/setup.py
+++ b/setup.py
@@ -22,7 +22,7 @@
name = "google-cloud-logging"
description = "Stackdriver Logging API client library"
-version = "3.0.0"
+version = "3.1.0"
# Should be one of:
# 'Development Status :: 3 - Alpha'
# 'Development Status :: 4 - Beta'
@@ -32,7 +32,7 @@
# NOTE: Maintainers, please do not require google-api-core>=2.x.x
# Until this issue is closed
# https://github.com/googleapis/google-cloud-python/issues/10566
- "google-api-core[grpc] >= 1.26.0, <3.0.0dev",
+ "google-api-core[grpc] >= 1.31.5, <3.0.0dev,!=2.0.*,!=2.1.*,!=2.2.*,!=2.3.0",
"google-cloud-appengine-logging>=0.1.0, <2.0.0dev",
"google-cloud-audit-log >= 0.1.0, < 1.0.0dev",
# NOTE: Maintainers, please do not require google-api-core>=2.x.x
diff --git a/testing/constraints-3.6.txt b/testing/constraints-3.6.txt
index 250c505ff..0aa016644 100644
--- a/testing/constraints-3.6.txt
+++ b/testing/constraints-3.6.txt
@@ -5,6 +5,6 @@
#
# e.g., if setup.py has "foo >= 1.14.0, < 2.0.0dev",
# Then this file should have foo==1.14.0
-google-api-core==1.28.0
+google-api-core==1.31.5
google-cloud-core==1.4.1
proto-plus==1.15.0
diff --git a/tests/__init__.py b/tests/__init__.py
index 4de65971c..e8e1c3845 100644
--- a/tests/__init__.py
+++ b/tests/__init__.py
@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
-# Copyright 2020 Google LLC
+# Copyright 2022 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
diff --git a/tests/environment b/tests/environment
index 41c32ce34..be8b03308 160000
--- a/tests/environment
+++ b/tests/environment
@@ -1 +1 @@
-Subproject commit 41c32ce3425529680e32701549d3f682f9c82b63
+Subproject commit be8b033084726bb7a3f62130157e1da3500f6855
diff --git a/tests/system/test_system.py b/tests/system/test_system.py
index 90b4059d6..84d0c9552 100644
--- a/tests/system/test_system.py
+++ b/tests/system/test_system.py
@@ -110,6 +110,8 @@ def setUpModule():
# Skip the test cases using bigquery, storage and pubsub clients for mTLS testing.
# Bigquery and storage uses http which doesn't have mTLS support, pubsub doesn't
# have mTLS fix released yet.
+# We also need to skip HTTP client test cases because mTLS is only available for
+# gRPC clients.
skip_for_mtls = pytest.mark.skipif(
Config.use_mtls == "always", reason="Skip the test case for mTLS testing"
)
@@ -196,7 +198,12 @@ def test_list_entry_with_auditlog(self):
gapic_logger = Config.CLIENT.logger(f"audit-proto-{uuid.uuid1()}")
http_logger = Config.HTTP_CLIENT.logger(f"audit-proto-{uuid.uuid1()}-http")
- for logger in [gapic_logger, http_logger]:
+ loggers = (
+ [gapic_logger]
+ if Config.use_mtls == "always"
+ else [gapic_logger, http_logger]
+ )
+ for logger in loggers:
logger.log_proto(audit_struct)
# retrieve log
@@ -249,7 +256,12 @@ def test_list_entry_with_requestlog(self):
gapic_logger = Config.CLIENT.logger(f"req-proto-{uuid.uuid1()}")
http_logger = Config.CLIENT.logger(f"req-proto-{uuid.uuid1()}-http")
- for logger in [gapic_logger, http_logger]:
+ loggers = (
+ [gapic_logger]
+ if Config.use_mtls == "always"
+ else [gapic_logger, http_logger]
+ )
+ for logger in loggers:
logger.log_proto(req_struct)
# retrieve log
@@ -301,7 +313,12 @@ def test_log_text(self):
TEXT_PAYLOAD = "System test: test_log_text"
gapic_logger = Config.CLIENT.logger(self._logger_name("log_text"))
http_logger = Config.HTTP_CLIENT.logger(self._logger_name("log_text_http"))
- for logger in [gapic_logger, http_logger]:
+ loggers = (
+ [gapic_logger]
+ if Config.use_mtls == "always"
+ else [gapic_logger, http_logger]
+ )
+ for logger in loggers:
self.to_delete.append(logger)
logger.log_text(TEXT_PAYLOAD)
entries = _list_entries(logger)
@@ -314,7 +331,12 @@ def test_log_text_with_timestamp(self):
gapic_logger = Config.CLIENT.logger(self._logger_name("log_text_ts"))
http_logger = Config.HTTP_CLIENT.logger(self._logger_name("log_text_ts_http"))
now = datetime.utcnow()
- for logger in [gapic_logger, http_logger]:
+ loggers = (
+ [gapic_logger]
+ if Config.use_mtls == "always"
+ else [gapic_logger, http_logger]
+ )
+ for logger in loggers:
self.to_delete.append(logger)
logger.log_text(text_payload, timestamp=now)
entries = _list_entries(logger)
@@ -329,7 +351,12 @@ def test_log_text_with_resource(self):
gapic_logger = Config.CLIENT.logger(self._logger_name("log_text_res"))
http_logger = Config.HTTP_CLIENT.logger(self._logger_name("log_text_res_http"))
now = datetime.utcnow()
- for logger in [gapic_logger, http_logger]:
+ loggers = (
+ [gapic_logger]
+ if Config.use_mtls == "always"
+ else [gapic_logger, http_logger]
+ )
+ for logger in loggers:
resource = Resource(
type="gae_app",
labels={"module_id": "default", "version_id": "test", "zone": ""},
@@ -355,7 +382,12 @@ def test_log_text_w_metadata(self):
REQUEST = {"requestMethod": METHOD, "requestUrl": URI, "status": STATUS}
gapic_logger = Config.CLIENT.logger(self._logger_name("log_text_md"))
http_logger = Config.HTTP_CLIENT.logger(self._logger_name("log_text_md_http"))
- for logger in [gapic_logger, http_logger]:
+ loggers = (
+ [gapic_logger]
+ if Config.use_mtls == "always"
+ else [gapic_logger, http_logger]
+ )
+ for logger in loggers:
self.to_delete.append(logger)
logger.log_text(
@@ -381,7 +413,12 @@ def test_log_text_w_metadata(self):
def test_log_struct(self):
gapic_logger = Config.CLIENT.logger(self._logger_name("log_struct"))
http_logger = Config.HTTP_CLIENT.logger(self._logger_name("log_struct_http"))
- for logger in [gapic_logger, http_logger]:
+ loggers = (
+ [gapic_logger]
+ if Config.use_mtls == "always"
+ else [gapic_logger, http_logger]
+ )
+ for logger in loggers:
self.to_delete.append(logger)
logger.log_struct(self.JSON_PAYLOAD)
@@ -399,7 +436,12 @@ def test_log_struct_w_metadata(self):
REQUEST = {"requestMethod": METHOD, "requestUrl": URI, "status": STATUS}
gapic_logger = Config.CLIENT.logger(self._logger_name("log_struct_md"))
http_logger = Config.HTTP_CLIENT.logger(self._logger_name("log_struct_md_http"))
- for logger in [gapic_logger, http_logger]:
+ loggers = (
+ [gapic_logger]
+ if Config.use_mtls == "always"
+ else [gapic_logger, http_logger]
+ )
+ for logger in loggers:
self.to_delete.append(logger)
logger.log_struct(
@@ -423,7 +465,12 @@ def test_log_w_text(self):
TEXT_PAYLOAD = "System test: test_log_w_text"
gapic_logger = Config.CLIENT.logger(self._logger_name("log_w_text"))
http_logger = Config.HTTP_CLIENT.logger(self._logger_name("log_w_text"))
- for logger in [gapic_logger, http_logger]:
+ loggers = (
+ [gapic_logger]
+ if Config.use_mtls == "always"
+ else [gapic_logger, http_logger]
+ )
+ for logger in loggers:
self.to_delete.append(logger)
logger.log(TEXT_PAYLOAD)
entries = _list_entries(logger)
@@ -433,7 +480,12 @@ def test_log_w_text(self):
def test_log_w_struct(self):
gapic_logger = Config.CLIENT.logger(self._logger_name("log_w_struct"))
http_logger = Config.HTTP_CLIENT.logger(self._logger_name("log_w_struct_http"))
- for logger in [gapic_logger, http_logger]:
+ loggers = (
+ [gapic_logger]
+ if Config.use_mtls == "always"
+ else [gapic_logger, http_logger]
+ )
+ for logger in loggers:
self.to_delete.append(logger)
logger.log(self.JSON_PAYLOAD)
@@ -446,7 +498,12 @@ def test_log_empty(self):
gapic_logger = Config.CLIENT.logger(self._logger_name("log_empty"))
http_logger = Config.HTTP_CLIENT.logger(self._logger_name("log_empty_http"))
- for logger in [gapic_logger, http_logger]:
+ loggers = (
+ [gapic_logger]
+ if Config.use_mtls == "always"
+ else [gapic_logger, http_logger]
+ )
+ for logger in loggers:
self.to_delete.append(logger)
logger.log()
@@ -829,6 +886,7 @@ def test_update_sink(self):
self.assertEqual(sink.filter_, UPDATED_FILTER)
self.assertEqual(sink.destination, dataset_uri)
+ @skip_for_mtls
def test_api_equality_list_logs(self):
unique_id = uuid.uuid1()
gapic_logger = Config.CLIENT.logger(f"api-list-{unique_id}")
diff --git a/tests/unit/__init__.py b/tests/unit/__init__.py
index 4de65971c..e8e1c3845 100644
--- a/tests/unit/__init__.py
+++ b/tests/unit/__init__.py
@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
-# Copyright 2020 Google LLC
+# Copyright 2022 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
diff --git a/tests/unit/gapic/__init__.py b/tests/unit/gapic/__init__.py
index 4de65971c..e8e1c3845 100644
--- a/tests/unit/gapic/__init__.py
+++ b/tests/unit/gapic/__init__.py
@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
-# Copyright 2020 Google LLC
+# Copyright 2022 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
diff --git a/tests/unit/gapic/logging_v2/__init__.py b/tests/unit/gapic/logging_v2/__init__.py
index 4de65971c..e8e1c3845 100644
--- a/tests/unit/gapic/logging_v2/__init__.py
+++ b/tests/unit/gapic/logging_v2/__init__.py
@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
-# Copyright 2020 Google LLC
+# Copyright 2022 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
diff --git a/tests/unit/gapic/logging_v2/test_config_service_v2.py b/tests/unit/gapic/logging_v2/test_config_service_v2.py
index efb46eaad..caa7bd689 100644
--- a/tests/unit/gapic/logging_v2/test_config_service_v2.py
+++ b/tests/unit/gapic/logging_v2/test_config_service_v2.py
@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
-# Copyright 2020 Google LLC
+# Copyright 2022 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -25,9 +25,13 @@
from google.api_core import client_options
from google.api_core import exceptions as core_exceptions
+from google.api_core import future
from google.api_core import gapic_v1
from google.api_core import grpc_helpers
from google.api_core import grpc_helpers_async
+from google.api_core import operation
+from google.api_core import operation_async # type: ignore
+from google.api_core import operations_v1
from google.api_core import path_template
from google.auth import credentials as ga_credentials
from google.auth.exceptions import MutualTLSChannelError
@@ -38,6 +42,7 @@
from google.cloud.logging_v2.services.config_service_v2 import pagers
from google.cloud.logging_v2.services.config_service_v2 import transports
from google.cloud.logging_v2.types import logging_config
+from google.longrunning import operations_pb2
from google.oauth2 import service_account
from google.protobuf import field_mask_pb2 # type: ignore
from google.protobuf import timestamp_pb2 # type: ignore
@@ -89,20 +94,26 @@ def test__get_default_mtls_endpoint():
@pytest.mark.parametrize(
- "client_class", [ConfigServiceV2Client, ConfigServiceV2AsyncClient,]
+ "client_class,transport_name",
+ [
+ (ConfigServiceV2Client, "grpc"),
+ (ConfigServiceV2AsyncClient, "grpc_asyncio"),
+ ],
)
-def test_config_service_v2_client_from_service_account_info(client_class):
+def test_config_service_v2_client_from_service_account_info(
+ client_class, transport_name
+):
creds = ga_credentials.AnonymousCredentials()
with mock.patch.object(
service_account.Credentials, "from_service_account_info"
) as factory:
factory.return_value = creds
info = {"valid": True}
- client = client_class.from_service_account_info(info)
+ client = client_class.from_service_account_info(info, transport=transport_name)
assert client.transport._credentials == creds
assert isinstance(client, client_class)
- assert client.transport._host == "logging.googleapis.com:443"
+ assert client.transport._host == ("logging.googleapis.com:443")
@pytest.mark.parametrize(
@@ -131,23 +142,33 @@ def test_config_service_v2_client_service_account_always_use_jwt(
@pytest.mark.parametrize(
- "client_class", [ConfigServiceV2Client, ConfigServiceV2AsyncClient,]
+ "client_class,transport_name",
+ [
+ (ConfigServiceV2Client, "grpc"),
+ (ConfigServiceV2AsyncClient, "grpc_asyncio"),
+ ],
)
-def test_config_service_v2_client_from_service_account_file(client_class):
+def test_config_service_v2_client_from_service_account_file(
+ client_class, transport_name
+):
creds = ga_credentials.AnonymousCredentials()
with mock.patch.object(
service_account.Credentials, "from_service_account_file"
) as factory:
factory.return_value = creds
- client = client_class.from_service_account_file("dummy/file/path.json")
+ client = client_class.from_service_account_file(
+ "dummy/file/path.json", transport=transport_name
+ )
assert client.transport._credentials == creds
assert isinstance(client, client_class)
- client = client_class.from_service_account_json("dummy/file/path.json")
+ client = client_class.from_service_account_json(
+ "dummy/file/path.json", transport=transport_name
+ )
assert client.transport._credentials == creds
assert isinstance(client, client_class)
- assert client.transport._host == "logging.googleapis.com:443"
+ assert client.transport._host == ("logging.googleapis.com:443")
def test_config_service_v2_client_get_transport_class():
@@ -505,7 +526,9 @@ def test_config_service_v2_client_client_options_scopes(
client_class, transport_class, transport_name
):
# Check the case scopes are provided.
- options = client_options.ClientOptions(scopes=["1", "2"],)
+ options = client_options.ClientOptions(
+ scopes=["1", "2"],
+ )
with mock.patch.object(transport_class, "__init__") as patched:
patched.return_value = None
client = client_class(client_options=options, transport=transport_name)
@@ -522,21 +545,28 @@ def test_config_service_v2_client_client_options_scopes(
@pytest.mark.parametrize(
- "client_class,transport_class,transport_name",
+ "client_class,transport_class,transport_name,grpc_helpers",
[
- (ConfigServiceV2Client, transports.ConfigServiceV2GrpcTransport, "grpc"),
+ (
+ ConfigServiceV2Client,
+ transports.ConfigServiceV2GrpcTransport,
+ "grpc",
+ grpc_helpers,
+ ),
(
ConfigServiceV2AsyncClient,
transports.ConfigServiceV2GrpcAsyncIOTransport,
"grpc_asyncio",
+ grpc_helpers_async,
),
],
)
def test_config_service_v2_client_client_options_credentials_file(
- client_class, transport_class, transport_name
+ client_class, transport_class, transport_name, grpc_helpers
):
# Check the case credentials file is provided.
options = client_options.ClientOptions(credentials_file="credentials.json")
+
with mock.patch.object(transport_class, "__init__") as patched:
patched.return_value = None
client = client_class(client_options=options, transport=transport_name)
@@ -572,10 +602,88 @@ def test_config_service_v2_client_client_options_from_dict():
)
-@pytest.mark.parametrize("request_type", [logging_config.ListBucketsRequest, dict,])
+@pytest.mark.parametrize(
+ "client_class,transport_class,transport_name,grpc_helpers",
+ [
+ (
+ ConfigServiceV2Client,
+ transports.ConfigServiceV2GrpcTransport,
+ "grpc",
+ grpc_helpers,
+ ),
+ (
+ ConfigServiceV2AsyncClient,
+ transports.ConfigServiceV2GrpcAsyncIOTransport,
+ "grpc_asyncio",
+ grpc_helpers_async,
+ ),
+ ],
+)
+def test_config_service_v2_client_create_channel_credentials_file(
+ client_class, transport_class, transport_name, grpc_helpers
+):
+ # Check the case credentials file is provided.
+ options = client_options.ClientOptions(credentials_file="credentials.json")
+
+ with mock.patch.object(transport_class, "__init__") as patched:
+ patched.return_value = None
+ client = client_class(client_options=options, transport=transport_name)
+ patched.assert_called_once_with(
+ credentials=None,
+ credentials_file="credentials.json",
+ host=client.DEFAULT_ENDPOINT,
+ scopes=None,
+ client_cert_source_for_mtls=None,
+ quota_project_id=None,
+ client_info=transports.base.DEFAULT_CLIENT_INFO,
+ always_use_jwt_access=True,
+ )
+
+ # test that the credentials from file are saved and used as the credentials.
+ with mock.patch.object(
+ google.auth, "load_credentials_from_file", autospec=True
+ ) as load_creds, mock.patch.object(
+ google.auth, "default", autospec=True
+ ) as adc, mock.patch.object(
+ grpc_helpers, "create_channel"
+ ) as create_channel:
+ creds = ga_credentials.AnonymousCredentials()
+ file_creds = ga_credentials.AnonymousCredentials()
+ load_creds.return_value = (file_creds, None)
+ adc.return_value = (creds, None)
+ client = client_class(client_options=options, transport=transport_name)
+ create_channel.assert_called_with(
+ "logging.googleapis.com:443",
+ credentials=file_creds,
+ credentials_file=None,
+ quota_project_id=None,
+ default_scopes=(
+ "https://www.googleapis.com/auth/cloud-platform",
+ "https://www.googleapis.com/auth/cloud-platform.read-only",
+ "https://www.googleapis.com/auth/logging.admin",
+ "https://www.googleapis.com/auth/logging.read",
+ ),
+ scopes=None,
+ default_host="logging.googleapis.com",
+ ssl_credentials=None,
+ options=[
+ ("grpc.max_send_message_length", -1),
+ ("grpc.max_receive_message_length", -1),
+ ],
+ )
+
+
+@pytest.mark.parametrize(
+ "request_type",
+ [
+ logging_config.ListBucketsRequest,
+ dict,
+ ],
+)
def test_list_buckets(request_type, transport: str = "grpc"):
client = ConfigServiceV2Client(
- credentials=ga_credentials.AnonymousCredentials(), transport=transport,
+ credentials=ga_credentials.AnonymousCredentials(),
+ transport=transport,
)
# Everything is optional in proto3 as far as the runtime is concerned,
@@ -604,7 +712,8 @@ def test_list_buckets_empty_call():
# This test is a coverage failsafe to make sure that totally empty calls,
# i.e. request == None and no flattened fields passed, work.
client = ConfigServiceV2Client(
- credentials=ga_credentials.AnonymousCredentials(), transport="grpc",
+ credentials=ga_credentials.AnonymousCredentials(),
+ transport="grpc",
)
# Mock the actual call within the gRPC stub, and fake the request.
@@ -620,7 +729,8 @@ async def test_list_buckets_async(
transport: str = "grpc_asyncio", request_type=logging_config.ListBucketsRequest
):
client = ConfigServiceV2AsyncClient(
- credentials=ga_credentials.AnonymousCredentials(), transport=transport,
+ credentials=ga_credentials.AnonymousCredentials(),
+ transport=transport,
)
# Everything is optional in proto3 as far as the runtime is concerned,
@@ -631,7 +741,9 @@ async def test_list_buckets_async(
with mock.patch.object(type(client.transport.list_buckets), "__call__") as call:
# Designate an appropriate return value for the call.
call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(
- logging_config.ListBucketsResponse(next_page_token="next_page_token_value",)
+ logging_config.ListBucketsResponse(
+ next_page_token="next_page_token_value",
+ )
)
response = await client.list_buckets(request)
@@ -651,13 +763,15 @@ async def test_list_buckets_async_from_dict():
def test_list_buckets_field_headers():
- client = ConfigServiceV2Client(credentials=ga_credentials.AnonymousCredentials(),)
+ client = ConfigServiceV2Client(
+ credentials=ga_credentials.AnonymousCredentials(),
+ )
# Any value that is part of the HTTP/1.1 URI should be sent as
# a field header. Set these to a non-empty value.
request = logging_config.ListBucketsRequest()
- request.parent = "parent/value"
+ request.parent = "parent_value"
# Mock the actual call within the gRPC stub, and fake the request.
with mock.patch.object(type(client.transport.list_buckets), "__call__") as call:
@@ -671,7 +785,10 @@ def test_list_buckets_field_headers():
# Establish that the field header was sent.
_, _, kw = call.mock_calls[0]
- assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"]
+ assert (
+ "x-goog-request-params",
+ "parent=parent_value",
+ ) in kw["metadata"]
@pytest.mark.asyncio
@@ -684,7 +801,7 @@ async def test_list_buckets_field_headers_async():
# a field header. Set these to a non-empty value.
request = logging_config.ListBucketsRequest()
- request.parent = "parent/value"
+ request.parent = "parent_value"
# Mock the actual call within the gRPC stub, and fake the request.
with mock.patch.object(type(client.transport.list_buckets), "__call__") as call:
@@ -700,11 +817,16 @@ async def test_list_buckets_field_headers_async():
# Establish that the field header was sent.
_, _, kw = call.mock_calls[0]
- assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"]
+ assert (
+ "x-goog-request-params",
+ "parent=parent_value",
+ ) in kw["metadata"]
def test_list_buckets_flattened():
- client = ConfigServiceV2Client(credentials=ga_credentials.AnonymousCredentials(),)
+ client = ConfigServiceV2Client(
+ credentials=ga_credentials.AnonymousCredentials(),
+ )
# Mock the actual call within the gRPC stub, and fake the request.
with mock.patch.object(type(client.transport.list_buckets), "__call__") as call:
@@ -712,7 +834,9 @@ def test_list_buckets_flattened():
call.return_value = logging_config.ListBucketsResponse()
# Call the method with a truthy value for each flattened field,
# using the keyword arguments to the method.
- client.list_buckets(parent="parent_value",)
+ client.list_buckets(
+ parent="parent_value",
+ )
# Establish that the underlying call was made with the expected
# request object values.
@@ -724,13 +848,16 @@ def test_list_buckets_flattened():
def test_list_buckets_flattened_error():
- client = ConfigServiceV2Client(credentials=ga_credentials.AnonymousCredentials(),)
+ client = ConfigServiceV2Client(
+ credentials=ga_credentials.AnonymousCredentials(),
+ )
# Attempting to call a method with both a request object and flattened
# fields is an error.
with pytest.raises(ValueError):
client.list_buckets(
- logging_config.ListBucketsRequest(), parent="parent_value",
+ logging_config.ListBucketsRequest(),
+ parent="parent_value",
)
@@ -750,7 +877,9 @@ async def test_list_buckets_flattened_async():
)
# Call the method with a truthy value for each flattened field,
# using the keyword arguments to the method.
- response = await client.list_buckets(parent="parent_value",)
+ response = await client.list_buckets(
+ parent="parent_value",
+ )
# Establish that the underlying call was made with the expected
# request object values.
@@ -771,13 +900,15 @@ async def test_list_buckets_flattened_error_async():
# fields is an error.
with pytest.raises(ValueError):
await client.list_buckets(
- logging_config.ListBucketsRequest(), parent="parent_value",
+ logging_config.ListBucketsRequest(),
+ parent="parent_value",
)
def test_list_buckets_pager(transport_name: str = "grpc"):
client = ConfigServiceV2Client(
- credentials=ga_credentials.AnonymousCredentials, transport=transport_name,
+ credentials=ga_credentials.AnonymousCredentials,
+ transport=transport_name,
)
# Mock the actual call within the gRPC stub, and fake the request.
@@ -792,12 +923,21 @@ def test_list_buckets_pager(transport_name: str = "grpc"):
],
next_page_token="abc",
),
- logging_config.ListBucketsResponse(buckets=[], next_page_token="def",),
logging_config.ListBucketsResponse(
- buckets=[logging_config.LogBucket(),], next_page_token="ghi",
+ buckets=[],
+ next_page_token="def",
+ ),
+ logging_config.ListBucketsResponse(
+ buckets=[
+ logging_config.LogBucket(),
+ ],
+ next_page_token="ghi",
),
logging_config.ListBucketsResponse(
- buckets=[logging_config.LogBucket(), logging_config.LogBucket(),],
+ buckets=[
+ logging_config.LogBucket(),
+ logging_config.LogBucket(),
+ ],
),
RuntimeError,
)
@@ -810,14 +950,15 @@ def test_list_buckets_pager(transport_name: str = "grpc"):
assert pager._metadata == metadata
- results = [i for i in pager]
+ results = list(pager)
assert len(results) == 6
assert all(isinstance(i, logging_config.LogBucket) for i in results)
def test_list_buckets_pages(transport_name: str = "grpc"):
client = ConfigServiceV2Client(
- credentials=ga_credentials.AnonymousCredentials, transport=transport_name,
+ credentials=ga_credentials.AnonymousCredentials,
+ transport=transport_name,
)
# Mock the actual call within the gRPC stub, and fake the request.
@@ -832,12 +973,21 @@ def test_list_buckets_pages(transport_name: str = "grpc"):
],
next_page_token="abc",
),
- logging_config.ListBucketsResponse(buckets=[], next_page_token="def",),
logging_config.ListBucketsResponse(
- buckets=[logging_config.LogBucket(),], next_page_token="ghi",
+ buckets=[],
+ next_page_token="def",
+ ),
+ logging_config.ListBucketsResponse(
+ buckets=[
+ logging_config.LogBucket(),
+ ],
+ next_page_token="ghi",
),
logging_config.ListBucketsResponse(
- buckets=[logging_config.LogBucket(), logging_config.LogBucket(),],
+ buckets=[
+ logging_config.LogBucket(),
+ logging_config.LogBucket(),
+ ],
),
RuntimeError,
)
@@ -866,19 +1016,30 @@ async def test_list_buckets_async_pager():
],
next_page_token="abc",
),
- logging_config.ListBucketsResponse(buckets=[], next_page_token="def",),
logging_config.ListBucketsResponse(
- buckets=[logging_config.LogBucket(),], next_page_token="ghi",
+ buckets=[],
+ next_page_token="def",
+ ),
+ logging_config.ListBucketsResponse(
+ buckets=[
+ logging_config.LogBucket(),
+ ],
+ next_page_token="ghi",
),
logging_config.ListBucketsResponse(
- buckets=[logging_config.LogBucket(), logging_config.LogBucket(),],
+ buckets=[
+ logging_config.LogBucket(),
+ logging_config.LogBucket(),
+ ],
),
RuntimeError,
)
- async_pager = await client.list_buckets(request={},)
+ async_pager = await client.list_buckets(
+ request={},
+ )
assert async_pager.next_page_token == "abc"
responses = []
- async for response in async_pager:
+ async for response in async_pager: # pragma: no branch
responses.append(response)
assert len(responses) == 6
@@ -905,26 +1066,44 @@ async def test_list_buckets_async_pages():
],
next_page_token="abc",
),
- logging_config.ListBucketsResponse(buckets=[], next_page_token="def",),
logging_config.ListBucketsResponse(
- buckets=[logging_config.LogBucket(),], next_page_token="ghi",
+ buckets=[],
+ next_page_token="def",
),
logging_config.ListBucketsResponse(
- buckets=[logging_config.LogBucket(), logging_config.LogBucket(),],
+ buckets=[
+ logging_config.LogBucket(),
+ ],
+ next_page_token="ghi",
+ ),
+ logging_config.ListBucketsResponse(
+ buckets=[
+ logging_config.LogBucket(),
+ logging_config.LogBucket(),
+ ],
),
RuntimeError,
)
pages = []
- async for page_ in (await client.list_buckets(request={})).pages:
+ async for page_ in (
+ await client.list_buckets(request={})
+ ).pages: # pragma: no branch
pages.append(page_)
for page_, token in zip(pages, ["abc", "def", "ghi", ""]):
assert page_.raw_page.next_page_token == token
-@pytest.mark.parametrize("request_type", [logging_config.GetBucketRequest, dict,])
+@pytest.mark.parametrize(
+ "request_type",
+ [
+ logging_config.GetBucketRequest,
+ dict,
+ ],
+)
def test_get_bucket(request_type, transport: str = "grpc"):
client = ConfigServiceV2Client(
- credentials=ga_credentials.AnonymousCredentials(), transport=transport,
+ credentials=ga_credentials.AnonymousCredentials(),
+ transport=transport,
)
# Everything is optional in proto3 as far as the runtime is concerned,
@@ -940,6 +1119,7 @@ def test_get_bucket(request_type, transport: str = "grpc"):
retention_days=1512,
locked=True,
lifecycle_state=logging_config.LifecycleState.ACTIVE,
+ restricted_fields=["restricted_fields_value"],
)
response = client.get_bucket(request)
@@ -955,13 +1135,15 @@ def test_get_bucket(request_type, transport: str = "grpc"):
assert response.retention_days == 1512
assert response.locked is True
assert response.lifecycle_state == logging_config.LifecycleState.ACTIVE
+ assert response.restricted_fields == ["restricted_fields_value"]
def test_get_bucket_empty_call():
# This test is a coverage failsafe to make sure that totally empty calls,
# i.e. request == None and no flattened fields passed, work.
client = ConfigServiceV2Client(
- credentials=ga_credentials.AnonymousCredentials(), transport="grpc",
+ credentials=ga_credentials.AnonymousCredentials(),
+ transport="grpc",
)
# Mock the actual call within the gRPC stub, and fake the request.
@@ -977,7 +1159,8 @@ async def test_get_bucket_async(
transport: str = "grpc_asyncio", request_type=logging_config.GetBucketRequest
):
client = ConfigServiceV2AsyncClient(
- credentials=ga_credentials.AnonymousCredentials(), transport=transport,
+ credentials=ga_credentials.AnonymousCredentials(),
+ transport=transport,
)
# Everything is optional in proto3 as far as the runtime is concerned,
@@ -994,6 +1177,7 @@ async def test_get_bucket_async(
retention_days=1512,
locked=True,
lifecycle_state=logging_config.LifecycleState.ACTIVE,
+ restricted_fields=["restricted_fields_value"],
)
)
response = await client.get_bucket(request)
@@ -1010,6 +1194,7 @@ async def test_get_bucket_async(
assert response.retention_days == 1512
assert response.locked is True
assert response.lifecycle_state == logging_config.LifecycleState.ACTIVE
+ assert response.restricted_fields == ["restricted_fields_value"]
@pytest.mark.asyncio
@@ -1018,13 +1203,15 @@ async def test_get_bucket_async_from_dict():
def test_get_bucket_field_headers():
- client = ConfigServiceV2Client(credentials=ga_credentials.AnonymousCredentials(),)
+ client = ConfigServiceV2Client(
+ credentials=ga_credentials.AnonymousCredentials(),
+ )
# Any value that is part of the HTTP/1.1 URI should be sent as
# a field header. Set these to a non-empty value.
request = logging_config.GetBucketRequest()
- request.name = "name/value"
+ request.name = "name_value"
# Mock the actual call within the gRPC stub, and fake the request.
with mock.patch.object(type(client.transport.get_bucket), "__call__") as call:
@@ -1038,7 +1225,10 @@ def test_get_bucket_field_headers():
# Establish that the field header was sent.
_, _, kw = call.mock_calls[0]
- assert ("x-goog-request-params", "name=name/value",) in kw["metadata"]
+ assert (
+ "x-goog-request-params",
+ "name=name_value",
+ ) in kw["metadata"]
@pytest.mark.asyncio
@@ -1051,7 +1241,7 @@ async def test_get_bucket_field_headers_async():
# a field header. Set these to a non-empty value.
request = logging_config.GetBucketRequest()
- request.name = "name/value"
+ request.name = "name_value"
# Mock the actual call within the gRPC stub, and fake the request.
with mock.patch.object(type(client.transport.get_bucket), "__call__") as call:
@@ -1067,13 +1257,23 @@ async def test_get_bucket_field_headers_async():
# Establish that the field header was sent.
_, _, kw = call.mock_calls[0]
- assert ("x-goog-request-params", "name=name/value",) in kw["metadata"]
+ assert (
+ "x-goog-request-params",
+ "name=name_value",
+ ) in kw["metadata"]
-@pytest.mark.parametrize("request_type", [logging_config.CreateBucketRequest, dict,])
+@pytest.mark.parametrize(
+ "request_type",
+ [
+ logging_config.CreateBucketRequest,
+ dict,
+ ],
+)
def test_create_bucket(request_type, transport: str = "grpc"):
client = ConfigServiceV2Client(
- credentials=ga_credentials.AnonymousCredentials(), transport=transport,
+ credentials=ga_credentials.AnonymousCredentials(),
+ transport=transport,
)
# Everything is optional in proto3 as far as the runtime is concerned,
@@ -1089,6 +1289,7 @@ def test_create_bucket(request_type, transport: str = "grpc"):
retention_days=1512,
locked=True,
lifecycle_state=logging_config.LifecycleState.ACTIVE,
+ restricted_fields=["restricted_fields_value"],
)
response = client.create_bucket(request)
@@ -1104,13 +1305,15 @@ def test_create_bucket(request_type, transport: str = "grpc"):
assert response.retention_days == 1512
assert response.locked is True
assert response.lifecycle_state == logging_config.LifecycleState.ACTIVE
+ assert response.restricted_fields == ["restricted_fields_value"]
def test_create_bucket_empty_call():
# This test is a coverage failsafe to make sure that totally empty calls,
# i.e. request == None and no flattened fields passed, work.
client = ConfigServiceV2Client(
- credentials=ga_credentials.AnonymousCredentials(), transport="grpc",
+ credentials=ga_credentials.AnonymousCredentials(),
+ transport="grpc",
)
# Mock the actual call within the gRPC stub, and fake the request.
@@ -1126,7 +1329,8 @@ async def test_create_bucket_async(
transport: str = "grpc_asyncio", request_type=logging_config.CreateBucketRequest
):
client = ConfigServiceV2AsyncClient(
- credentials=ga_credentials.AnonymousCredentials(), transport=transport,
+ credentials=ga_credentials.AnonymousCredentials(),
+ transport=transport,
)
# Everything is optional in proto3 as far as the runtime is concerned,
@@ -1143,6 +1347,7 @@ async def test_create_bucket_async(
retention_days=1512,
locked=True,
lifecycle_state=logging_config.LifecycleState.ACTIVE,
+ restricted_fields=["restricted_fields_value"],
)
)
response = await client.create_bucket(request)
@@ -1159,6 +1364,7 @@ async def test_create_bucket_async(
assert response.retention_days == 1512
assert response.locked is True
assert response.lifecycle_state == logging_config.LifecycleState.ACTIVE
+ assert response.restricted_fields == ["restricted_fields_value"]
@pytest.mark.asyncio
@@ -1167,13 +1373,15 @@ async def test_create_bucket_async_from_dict():
def test_create_bucket_field_headers():
- client = ConfigServiceV2Client(credentials=ga_credentials.AnonymousCredentials(),)
+ client = ConfigServiceV2Client(
+ credentials=ga_credentials.AnonymousCredentials(),
+ )
# Any value that is part of the HTTP/1.1 URI should be sent as
# a field header. Set these to a non-empty value.
request = logging_config.CreateBucketRequest()
- request.parent = "parent/value"
+ request.parent = "parent_value"
# Mock the actual call within the gRPC stub, and fake the request.
with mock.patch.object(type(client.transport.create_bucket), "__call__") as call:
@@ -1187,7 +1395,10 @@ def test_create_bucket_field_headers():
# Establish that the field header was sent.
_, _, kw = call.mock_calls[0]
- assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"]
+ assert (
+ "x-goog-request-params",
+ "parent=parent_value",
+ ) in kw["metadata"]
@pytest.mark.asyncio
@@ -1200,7 +1411,7 @@ async def test_create_bucket_field_headers_async():
# a field header. Set these to a non-empty value.
request = logging_config.CreateBucketRequest()
- request.parent = "parent/value"
+ request.parent = "parent_value"
# Mock the actual call within the gRPC stub, and fake the request.
with mock.patch.object(type(client.transport.create_bucket), "__call__") as call:
@@ -1216,13 +1427,23 @@ async def test_create_bucket_field_headers_async():
# Establish that the field header was sent.
_, _, kw = call.mock_calls[0]
- assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"]
+ assert (
+ "x-goog-request-params",
+ "parent=parent_value",
+ ) in kw["metadata"]
-@pytest.mark.parametrize("request_type", [logging_config.UpdateBucketRequest, dict,])
+@pytest.mark.parametrize(
+ "request_type",
+ [
+ logging_config.UpdateBucketRequest,
+ dict,
+ ],
+)
def test_update_bucket(request_type, transport: str = "grpc"):
client = ConfigServiceV2Client(
- credentials=ga_credentials.AnonymousCredentials(), transport=transport,
+ credentials=ga_credentials.AnonymousCredentials(),
+ transport=transport,
)
# Everything is optional in proto3 as far as the runtime is concerned,
@@ -1238,6 +1459,7 @@ def test_update_bucket(request_type, transport: str = "grpc"):
retention_days=1512,
locked=True,
lifecycle_state=logging_config.LifecycleState.ACTIVE,
+ restricted_fields=["restricted_fields_value"],
)
response = client.update_bucket(request)
@@ -1253,13 +1475,15 @@ def test_update_bucket(request_type, transport: str = "grpc"):
assert response.retention_days == 1512
assert response.locked is True
assert response.lifecycle_state == logging_config.LifecycleState.ACTIVE
+ assert response.restricted_fields == ["restricted_fields_value"]
def test_update_bucket_empty_call():
# This test is a coverage failsafe to make sure that totally empty calls,
# i.e. request == None and no flattened fields passed, work.
client = ConfigServiceV2Client(
- credentials=ga_credentials.AnonymousCredentials(), transport="grpc",
+ credentials=ga_credentials.AnonymousCredentials(),
+ transport="grpc",
)
# Mock the actual call within the gRPC stub, and fake the request.
@@ -1275,7 +1499,8 @@ async def test_update_bucket_async(
transport: str = "grpc_asyncio", request_type=logging_config.UpdateBucketRequest
):
client = ConfigServiceV2AsyncClient(
- credentials=ga_credentials.AnonymousCredentials(), transport=transport,
+ credentials=ga_credentials.AnonymousCredentials(),
+ transport=transport,
)
# Everything is optional in proto3 as far as the runtime is concerned,
@@ -1292,6 +1517,7 @@ async def test_update_bucket_async(
retention_days=1512,
locked=True,
lifecycle_state=logging_config.LifecycleState.ACTIVE,
+ restricted_fields=["restricted_fields_value"],
)
)
response = await client.update_bucket(request)
@@ -1308,6 +1534,7 @@ async def test_update_bucket_async(
assert response.retention_days == 1512
assert response.locked is True
assert response.lifecycle_state == logging_config.LifecycleState.ACTIVE
+ assert response.restricted_fields == ["restricted_fields_value"]
@pytest.mark.asyncio
@@ -1316,13 +1543,15 @@ async def test_update_bucket_async_from_dict():
def test_update_bucket_field_headers():
- client = ConfigServiceV2Client(credentials=ga_credentials.AnonymousCredentials(),)
+ client = ConfigServiceV2Client(
+ credentials=ga_credentials.AnonymousCredentials(),
+ )
# Any value that is part of the HTTP/1.1 URI should be sent as
# a field header. Set these to a non-empty value.
request = logging_config.UpdateBucketRequest()
- request.name = "name/value"
+ request.name = "name_value"
# Mock the actual call within the gRPC stub, and fake the request.
with mock.patch.object(type(client.transport.update_bucket), "__call__") as call:
@@ -1336,7 +1565,10 @@ def test_update_bucket_field_headers():
# Establish that the field header was sent.
_, _, kw = call.mock_calls[0]
- assert ("x-goog-request-params", "name=name/value",) in kw["metadata"]
+ assert (
+ "x-goog-request-params",
+ "name=name_value",
+ ) in kw["metadata"]
@pytest.mark.asyncio
@@ -1349,7 +1581,7 @@ async def test_update_bucket_field_headers_async():
# a field header. Set these to a non-empty value.
request = logging_config.UpdateBucketRequest()
- request.name = "name/value"
+ request.name = "name_value"
# Mock the actual call within the gRPC stub, and fake the request.
with mock.patch.object(type(client.transport.update_bucket), "__call__") as call:
@@ -1365,13 +1597,23 @@ async def test_update_bucket_field_headers_async():
# Establish that the field header was sent.
_, _, kw = call.mock_calls[0]
- assert ("x-goog-request-params", "name=name/value",) in kw["metadata"]
+ assert (
+ "x-goog-request-params",
+ "name=name_value",
+ ) in kw["metadata"]
-@pytest.mark.parametrize("request_type", [logging_config.DeleteBucketRequest, dict,])
+@pytest.mark.parametrize(
+ "request_type",
+ [
+ logging_config.DeleteBucketRequest,
+ dict,
+ ],
+)
def test_delete_bucket(request_type, transport: str = "grpc"):
client = ConfigServiceV2Client(
- credentials=ga_credentials.AnonymousCredentials(), transport=transport,
+ credentials=ga_credentials.AnonymousCredentials(),
+ transport=transport,
)
# Everything is optional in proto3 as far as the runtime is concerned,
@@ -1397,7 +1639,8 @@ def test_delete_bucket_empty_call():
# This test is a coverage failsafe to make sure that totally empty calls,
# i.e. request == None and no flattened fields passed, work.
client = ConfigServiceV2Client(
- credentials=ga_credentials.AnonymousCredentials(), transport="grpc",
+ credentials=ga_credentials.AnonymousCredentials(),
+ transport="grpc",
)
# Mock the actual call within the gRPC stub, and fake the request.
@@ -1413,7 +1656,8 @@ async def test_delete_bucket_async(
transport: str = "grpc_asyncio", request_type=logging_config.DeleteBucketRequest
):
client = ConfigServiceV2AsyncClient(
- credentials=ga_credentials.AnonymousCredentials(), transport=transport,
+ credentials=ga_credentials.AnonymousCredentials(),
+ transport=transport,
)
# Everything is optional in proto3 as far as the runtime is concerned,
@@ -1441,13 +1685,15 @@ async def test_delete_bucket_async_from_dict():
def test_delete_bucket_field_headers():
- client = ConfigServiceV2Client(credentials=ga_credentials.AnonymousCredentials(),)
+ client = ConfigServiceV2Client(
+ credentials=ga_credentials.AnonymousCredentials(),
+ )
# Any value that is part of the HTTP/1.1 URI should be sent as
# a field header. Set these to a non-empty value.
request = logging_config.DeleteBucketRequest()
- request.name = "name/value"
+ request.name = "name_value"
# Mock the actual call within the gRPC stub, and fake the request.
with mock.patch.object(type(client.transport.delete_bucket), "__call__") as call:
@@ -1461,7 +1707,10 @@ def test_delete_bucket_field_headers():
# Establish that the field header was sent.
_, _, kw = call.mock_calls[0]
- assert ("x-goog-request-params", "name=name/value",) in kw["metadata"]
+ assert (
+ "x-goog-request-params",
+ "name=name_value",
+ ) in kw["metadata"]
@pytest.mark.asyncio
@@ -1474,7 +1723,7 @@ async def test_delete_bucket_field_headers_async():
# a field header. Set these to a non-empty value.
request = logging_config.DeleteBucketRequest()
- request.name = "name/value"
+ request.name = "name_value"
# Mock the actual call within the gRPC stub, and fake the request.
with mock.patch.object(type(client.transport.delete_bucket), "__call__") as call:
@@ -1488,13 +1737,23 @@ async def test_delete_bucket_field_headers_async():
# Establish that the field header was sent.
_, _, kw = call.mock_calls[0]
- assert ("x-goog-request-params", "name=name/value",) in kw["metadata"]
+ assert (
+ "x-goog-request-params",
+ "name=name_value",
+ ) in kw["metadata"]
-@pytest.mark.parametrize("request_type", [logging_config.UndeleteBucketRequest, dict,])
+@pytest.mark.parametrize(
+ "request_type",
+ [
+ logging_config.UndeleteBucketRequest,
+ dict,
+ ],
+)
def test_undelete_bucket(request_type, transport: str = "grpc"):
client = ConfigServiceV2Client(
- credentials=ga_credentials.AnonymousCredentials(), transport=transport,
+ credentials=ga_credentials.AnonymousCredentials(),
+ transport=transport,
)
# Everything is optional in proto3 as far as the runtime is concerned,
@@ -1520,7 +1779,8 @@ def test_undelete_bucket_empty_call():
# This test is a coverage failsafe to make sure that totally empty calls,
# i.e. request == None and no flattened fields passed, work.
client = ConfigServiceV2Client(
- credentials=ga_credentials.AnonymousCredentials(), transport="grpc",
+ credentials=ga_credentials.AnonymousCredentials(),
+ transport="grpc",
)
# Mock the actual call within the gRPC stub, and fake the request.
@@ -1536,7 +1796,8 @@ async def test_undelete_bucket_async(
transport: str = "grpc_asyncio", request_type=logging_config.UndeleteBucketRequest
):
client = ConfigServiceV2AsyncClient(
- credentials=ga_credentials.AnonymousCredentials(), transport=transport,
+ credentials=ga_credentials.AnonymousCredentials(),
+ transport=transport,
)
# Everything is optional in proto3 as far as the runtime is concerned,
@@ -1564,13 +1825,15 @@ async def test_undelete_bucket_async_from_dict():
def test_undelete_bucket_field_headers():
- client = ConfigServiceV2Client(credentials=ga_credentials.AnonymousCredentials(),)
+ client = ConfigServiceV2Client(
+ credentials=ga_credentials.AnonymousCredentials(),
+ )
# Any value that is part of the HTTP/1.1 URI should be sent as
# a field header. Set these to a non-empty value.
request = logging_config.UndeleteBucketRequest()
- request.name = "name/value"
+ request.name = "name_value"
# Mock the actual call within the gRPC stub, and fake the request.
with mock.patch.object(type(client.transport.undelete_bucket), "__call__") as call:
@@ -1584,7 +1847,10 @@ def test_undelete_bucket_field_headers():
# Establish that the field header was sent.
_, _, kw = call.mock_calls[0]
- assert ("x-goog-request-params", "name=name/value",) in kw["metadata"]
+ assert (
+ "x-goog-request-params",
+ "name=name_value",
+ ) in kw["metadata"]
@pytest.mark.asyncio
@@ -1597,7 +1863,7 @@ async def test_undelete_bucket_field_headers_async():
# a field header. Set these to a non-empty value.
request = logging_config.UndeleteBucketRequest()
- request.name = "name/value"
+ request.name = "name_value"
# Mock the actual call within the gRPC stub, and fake the request.
with mock.patch.object(type(client.transport.undelete_bucket), "__call__") as call:
@@ -1611,13 +1877,23 @@ async def test_undelete_bucket_field_headers_async():
# Establish that the field header was sent.
_, _, kw = call.mock_calls[0]
- assert ("x-goog-request-params", "name=name/value",) in kw["metadata"]
+ assert (
+ "x-goog-request-params",
+ "name=name_value",
+ ) in kw["metadata"]
-@pytest.mark.parametrize("request_type", [logging_config.ListViewsRequest, dict,])
+@pytest.mark.parametrize(
+ "request_type",
+ [
+ logging_config.ListViewsRequest,
+ dict,
+ ],
+)
def test_list_views(request_type, transport: str = "grpc"):
client = ConfigServiceV2Client(
- credentials=ga_credentials.AnonymousCredentials(), transport=transport,
+ credentials=ga_credentials.AnonymousCredentials(),
+ transport=transport,
)
# Everything is optional in proto3 as far as the runtime is concerned,
@@ -1646,7 +1922,8 @@ def test_list_views_empty_call():
# This test is a coverage failsafe to make sure that totally empty calls,
# i.e. request == None and no flattened fields passed, work.
client = ConfigServiceV2Client(
- credentials=ga_credentials.AnonymousCredentials(), transport="grpc",
+ credentials=ga_credentials.AnonymousCredentials(),
+ transport="grpc",
)
# Mock the actual call within the gRPC stub, and fake the request.
@@ -1662,7 +1939,8 @@ async def test_list_views_async(
transport: str = "grpc_asyncio", request_type=logging_config.ListViewsRequest
):
client = ConfigServiceV2AsyncClient(
- credentials=ga_credentials.AnonymousCredentials(), transport=transport,
+ credentials=ga_credentials.AnonymousCredentials(),
+ transport=transport,
)
# Everything is optional in proto3 as far as the runtime is concerned,
@@ -1673,7 +1951,9 @@ async def test_list_views_async(
with mock.patch.object(type(client.transport.list_views), "__call__") as call:
# Designate an appropriate return value for the call.
call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(
- logging_config.ListViewsResponse(next_page_token="next_page_token_value",)
+ logging_config.ListViewsResponse(
+ next_page_token="next_page_token_value",
+ )
)
response = await client.list_views(request)
@@ -1693,13 +1973,15 @@ async def test_list_views_async_from_dict():
def test_list_views_field_headers():
- client = ConfigServiceV2Client(credentials=ga_credentials.AnonymousCredentials(),)
+ client = ConfigServiceV2Client(
+ credentials=ga_credentials.AnonymousCredentials(),
+ )
# Any value that is part of the HTTP/1.1 URI should be sent as
# a field header. Set these to a non-empty value.
request = logging_config.ListViewsRequest()
- request.parent = "parent/value"
+ request.parent = "parent_value"
# Mock the actual call within the gRPC stub, and fake the request.
with mock.patch.object(type(client.transport.list_views), "__call__") as call:
@@ -1713,7 +1995,10 @@ def test_list_views_field_headers():
# Establish that the field header was sent.
_, _, kw = call.mock_calls[0]
- assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"]
+ assert (
+ "x-goog-request-params",
+ "parent=parent_value",
+ ) in kw["metadata"]
@pytest.mark.asyncio
@@ -1726,7 +2011,7 @@ async def test_list_views_field_headers_async():
# a field header. Set these to a non-empty value.
request = logging_config.ListViewsRequest()
- request.parent = "parent/value"
+ request.parent = "parent_value"
# Mock the actual call within the gRPC stub, and fake the request.
with mock.patch.object(type(client.transport.list_views), "__call__") as call:
@@ -1742,11 +2027,16 @@ async def test_list_views_field_headers_async():
# Establish that the field header was sent.
_, _, kw = call.mock_calls[0]
- assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"]
+ assert (
+ "x-goog-request-params",
+ "parent=parent_value",
+ ) in kw["metadata"]
def test_list_views_flattened():
- client = ConfigServiceV2Client(credentials=ga_credentials.AnonymousCredentials(),)
+ client = ConfigServiceV2Client(
+ credentials=ga_credentials.AnonymousCredentials(),
+ )
# Mock the actual call within the gRPC stub, and fake the request.
with mock.patch.object(type(client.transport.list_views), "__call__") as call:
@@ -1754,7 +2044,9 @@ def test_list_views_flattened():
call.return_value = logging_config.ListViewsResponse()
# Call the method with a truthy value for each flattened field,
# using the keyword arguments to the method.
- client.list_views(parent="parent_value",)
+ client.list_views(
+ parent="parent_value",
+ )
# Establish that the underlying call was made with the expected
# request object values.
@@ -1766,13 +2058,16 @@ def test_list_views_flattened():
def test_list_views_flattened_error():
- client = ConfigServiceV2Client(credentials=ga_credentials.AnonymousCredentials(),)
+ client = ConfigServiceV2Client(
+ credentials=ga_credentials.AnonymousCredentials(),
+ )
# Attempting to call a method with both a request object and flattened
# fields is an error.
with pytest.raises(ValueError):
client.list_views(
- logging_config.ListViewsRequest(), parent="parent_value",
+ logging_config.ListViewsRequest(),
+ parent="parent_value",
)
@@ -1792,7 +2087,9 @@ async def test_list_views_flattened_async():
)
# Call the method with a truthy value for each flattened field,
# using the keyword arguments to the method.
- response = await client.list_views(parent="parent_value",)
+ response = await client.list_views(
+ parent="parent_value",
+ )
# Establish that the underlying call was made with the expected
# request object values.
@@ -1813,13 +2110,15 @@ async def test_list_views_flattened_error_async():
# fields is an error.
with pytest.raises(ValueError):
await client.list_views(
- logging_config.ListViewsRequest(), parent="parent_value",
+ logging_config.ListViewsRequest(),
+ parent="parent_value",
)
def test_list_views_pager(transport_name: str = "grpc"):
client = ConfigServiceV2Client(
- credentials=ga_credentials.AnonymousCredentials, transport=transport_name,
+ credentials=ga_credentials.AnonymousCredentials,
+ transport=transport_name,
)
# Mock the actual call within the gRPC stub, and fake the request.
@@ -1834,12 +2133,21 @@ def test_list_views_pager(transport_name: str = "grpc"):
],
next_page_token="abc",
),
- logging_config.ListViewsResponse(views=[], next_page_token="def",),
logging_config.ListViewsResponse(
- views=[logging_config.LogView(),], next_page_token="ghi",
+ views=[],
+ next_page_token="def",
+ ),
+ logging_config.ListViewsResponse(
+ views=[
+ logging_config.LogView(),
+ ],
+ next_page_token="ghi",
),
logging_config.ListViewsResponse(
- views=[logging_config.LogView(), logging_config.LogView(),],
+ views=[
+ logging_config.LogView(),
+ logging_config.LogView(),
+ ],
),
RuntimeError,
)
@@ -1852,14 +2160,15 @@ def test_list_views_pager(transport_name: str = "grpc"):
assert pager._metadata == metadata
- results = [i for i in pager]
+ results = list(pager)
assert len(results) == 6
assert all(isinstance(i, logging_config.LogView) for i in results)
def test_list_views_pages(transport_name: str = "grpc"):
client = ConfigServiceV2Client(
- credentials=ga_credentials.AnonymousCredentials, transport=transport_name,
+ credentials=ga_credentials.AnonymousCredentials,
+ transport=transport_name,
)
# Mock the actual call within the gRPC stub, and fake the request.
@@ -1874,12 +2183,21 @@ def test_list_views_pages(transport_name: str = "grpc"):
],
next_page_token="abc",
),
- logging_config.ListViewsResponse(views=[], next_page_token="def",),
logging_config.ListViewsResponse(
- views=[logging_config.LogView(),], next_page_token="ghi",
+ views=[],
+ next_page_token="def",
+ ),
+ logging_config.ListViewsResponse(
+ views=[
+ logging_config.LogView(),
+ ],
+ next_page_token="ghi",
),
logging_config.ListViewsResponse(
- views=[logging_config.LogView(), logging_config.LogView(),],
+ views=[
+ logging_config.LogView(),
+ logging_config.LogView(),
+ ],
),
RuntimeError,
)
@@ -1908,19 +2226,30 @@ async def test_list_views_async_pager():
],
next_page_token="abc",
),
- logging_config.ListViewsResponse(views=[], next_page_token="def",),
logging_config.ListViewsResponse(
- views=[logging_config.LogView(),], next_page_token="ghi",
+ views=[],
+ next_page_token="def",
),
logging_config.ListViewsResponse(
- views=[logging_config.LogView(), logging_config.LogView(),],
+ views=[
+ logging_config.LogView(),
+ ],
+ next_page_token="ghi",
+ ),
+ logging_config.ListViewsResponse(
+ views=[
+ logging_config.LogView(),
+ logging_config.LogView(),
+ ],
),
RuntimeError,
)
- async_pager = await client.list_views(request={},)
+ async_pager = await client.list_views(
+ request={},
+ )
assert async_pager.next_page_token == "abc"
responses = []
- async for response in async_pager:
+ async for response in async_pager: # pragma: no branch
responses.append(response)
assert len(responses) == 6
@@ -1947,26 +2276,44 @@ async def test_list_views_async_pages():
],
next_page_token="abc",
),
- logging_config.ListViewsResponse(views=[], next_page_token="def",),
logging_config.ListViewsResponse(
- views=[logging_config.LogView(),], next_page_token="ghi",
+ views=[],
+ next_page_token="def",
+ ),
+ logging_config.ListViewsResponse(
+ views=[
+ logging_config.LogView(),
+ ],
+ next_page_token="ghi",
),
logging_config.ListViewsResponse(
- views=[logging_config.LogView(), logging_config.LogView(),],
+ views=[
+ logging_config.LogView(),
+ logging_config.LogView(),
+ ],
),
RuntimeError,
)
pages = []
- async for page_ in (await client.list_views(request={})).pages:
+ async for page_ in (
+ await client.list_views(request={})
+ ).pages: # pragma: no branch
pages.append(page_)
for page_, token in zip(pages, ["abc", "def", "ghi", ""]):
assert page_.raw_page.next_page_token == token
-@pytest.mark.parametrize("request_type", [logging_config.GetViewRequest, dict,])
+@pytest.mark.parametrize(
+ "request_type",
+ [
+ logging_config.GetViewRequest,
+ dict,
+ ],
+)
def test_get_view(request_type, transport: str = "grpc"):
client = ConfigServiceV2Client(
- credentials=ga_credentials.AnonymousCredentials(), transport=transport,
+ credentials=ga_credentials.AnonymousCredentials(),
+ transport=transport,
)
# Everything is optional in proto3 as far as the runtime is concerned,
@@ -1977,7 +2324,9 @@ def test_get_view(request_type, transport: str = "grpc"):
with mock.patch.object(type(client.transport.get_view), "__call__") as call:
# Designate an appropriate return value for the call.
call.return_value = logging_config.LogView(
- name="name_value", description="description_value", filter="filter_value",
+ name="name_value",
+ description="description_value",
+ filter="filter_value",
)
response = client.get_view(request)
@@ -1997,7 +2346,8 @@ def test_get_view_empty_call():
# This test is a coverage failsafe to make sure that totally empty calls,
# i.e. request == None and no flattened fields passed, work.
client = ConfigServiceV2Client(
- credentials=ga_credentials.AnonymousCredentials(), transport="grpc",
+ credentials=ga_credentials.AnonymousCredentials(),
+ transport="grpc",
)
# Mock the actual call within the gRPC stub, and fake the request.
@@ -2013,7 +2363,8 @@ async def test_get_view_async(
transport: str = "grpc_asyncio", request_type=logging_config.GetViewRequest
):
client = ConfigServiceV2AsyncClient(
- credentials=ga_credentials.AnonymousCredentials(), transport=transport,
+ credentials=ga_credentials.AnonymousCredentials(),
+ transport=transport,
)
# Everything is optional in proto3 as far as the runtime is concerned,
@@ -2050,13 +2401,15 @@ async def test_get_view_async_from_dict():
def test_get_view_field_headers():
- client = ConfigServiceV2Client(credentials=ga_credentials.AnonymousCredentials(),)
+ client = ConfigServiceV2Client(
+ credentials=ga_credentials.AnonymousCredentials(),
+ )
# Any value that is part of the HTTP/1.1 URI should be sent as
# a field header. Set these to a non-empty value.
request = logging_config.GetViewRequest()
- request.name = "name/value"
+ request.name = "name_value"
# Mock the actual call within the gRPC stub, and fake the request.
with mock.patch.object(type(client.transport.get_view), "__call__") as call:
@@ -2070,7 +2423,10 @@ def test_get_view_field_headers():
# Establish that the field header was sent.
_, _, kw = call.mock_calls[0]
- assert ("x-goog-request-params", "name=name/value",) in kw["metadata"]
+ assert (
+ "x-goog-request-params",
+ "name=name_value",
+ ) in kw["metadata"]
@pytest.mark.asyncio
@@ -2083,7 +2439,7 @@ async def test_get_view_field_headers_async():
# a field header. Set these to a non-empty value.
request = logging_config.GetViewRequest()
- request.name = "name/value"
+ request.name = "name_value"
# Mock the actual call within the gRPC stub, and fake the request.
with mock.patch.object(type(client.transport.get_view), "__call__") as call:
@@ -2099,13 +2455,23 @@ async def test_get_view_field_headers_async():
# Establish that the field header was sent.
_, _, kw = call.mock_calls[0]
- assert ("x-goog-request-params", "name=name/value",) in kw["metadata"]
+ assert (
+ "x-goog-request-params",
+ "name=name_value",
+ ) in kw["metadata"]
-@pytest.mark.parametrize("request_type", [logging_config.CreateViewRequest, dict,])
+@pytest.mark.parametrize(
+ "request_type",
+ [
+ logging_config.CreateViewRequest,
+ dict,
+ ],
+)
def test_create_view(request_type, transport: str = "grpc"):
client = ConfigServiceV2Client(
- credentials=ga_credentials.AnonymousCredentials(), transport=transport,
+ credentials=ga_credentials.AnonymousCredentials(),
+ transport=transport,
)
# Everything is optional in proto3 as far as the runtime is concerned,
@@ -2116,7 +2482,9 @@ def test_create_view(request_type, transport: str = "grpc"):
with mock.patch.object(type(client.transport.create_view), "__call__") as call:
# Designate an appropriate return value for the call.
call.return_value = logging_config.LogView(
- name="name_value", description="description_value", filter="filter_value",
+ name="name_value",
+ description="description_value",
+ filter="filter_value",
)
response = client.create_view(request)
@@ -2136,7 +2504,8 @@ def test_create_view_empty_call():
# This test is a coverage failsafe to make sure that totally empty calls,
# i.e. request == None and no flattened fields passed, work.
client = ConfigServiceV2Client(
- credentials=ga_credentials.AnonymousCredentials(), transport="grpc",
+ credentials=ga_credentials.AnonymousCredentials(),
+ transport="grpc",
)
# Mock the actual call within the gRPC stub, and fake the request.
@@ -2152,7 +2521,8 @@ async def test_create_view_async(
transport: str = "grpc_asyncio", request_type=logging_config.CreateViewRequest
):
client = ConfigServiceV2AsyncClient(
- credentials=ga_credentials.AnonymousCredentials(), transport=transport,
+ credentials=ga_credentials.AnonymousCredentials(),
+ transport=transport,
)
# Everything is optional in proto3 as far as the runtime is concerned,
@@ -2189,13 +2559,15 @@ async def test_create_view_async_from_dict():
def test_create_view_field_headers():
- client = ConfigServiceV2Client(credentials=ga_credentials.AnonymousCredentials(),)
+ client = ConfigServiceV2Client(
+ credentials=ga_credentials.AnonymousCredentials(),
+ )
# Any value that is part of the HTTP/1.1 URI should be sent as
# a field header. Set these to a non-empty value.
request = logging_config.CreateViewRequest()
- request.parent = "parent/value"
+ request.parent = "parent_value"
# Mock the actual call within the gRPC stub, and fake the request.
with mock.patch.object(type(client.transport.create_view), "__call__") as call:
@@ -2209,7 +2581,10 @@ def test_create_view_field_headers():
# Establish that the field header was sent.
_, _, kw = call.mock_calls[0]
- assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"]
+ assert (
+ "x-goog-request-params",
+ "parent=parent_value",
+ ) in kw["metadata"]
@pytest.mark.asyncio
@@ -2222,7 +2597,7 @@ async def test_create_view_field_headers_async():
# a field header. Set these to a non-empty value.
request = logging_config.CreateViewRequest()
- request.parent = "parent/value"
+ request.parent = "parent_value"
# Mock the actual call within the gRPC stub, and fake the request.
with mock.patch.object(type(client.transport.create_view), "__call__") as call:
@@ -2238,13 +2613,23 @@ async def test_create_view_field_headers_async():
# Establish that the field header was sent.
_, _, kw = call.mock_calls[0]
- assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"]
+ assert (
+ "x-goog-request-params",
+ "parent=parent_value",
+ ) in kw["metadata"]
-@pytest.mark.parametrize("request_type", [logging_config.UpdateViewRequest, dict,])
+@pytest.mark.parametrize(
+ "request_type",
+ [
+ logging_config.UpdateViewRequest,
+ dict,
+ ],
+)
def test_update_view(request_type, transport: str = "grpc"):
client = ConfigServiceV2Client(
- credentials=ga_credentials.AnonymousCredentials(), transport=transport,
+ credentials=ga_credentials.AnonymousCredentials(),
+ transport=transport,
)
# Everything is optional in proto3 as far as the runtime is concerned,
@@ -2255,7 +2640,9 @@ def test_update_view(request_type, transport: str = "grpc"):
with mock.patch.object(type(client.transport.update_view), "__call__") as call:
# Designate an appropriate return value for the call.
call.return_value = logging_config.LogView(
- name="name_value", description="description_value", filter="filter_value",
+ name="name_value",
+ description="description_value",
+ filter="filter_value",
)
response = client.update_view(request)
@@ -2275,7 +2662,8 @@ def test_update_view_empty_call():
# This test is a coverage failsafe to make sure that totally empty calls,
# i.e. request == None and no flattened fields passed, work.
client = ConfigServiceV2Client(
- credentials=ga_credentials.AnonymousCredentials(), transport="grpc",
+ credentials=ga_credentials.AnonymousCredentials(),
+ transport="grpc",
)
# Mock the actual call within the gRPC stub, and fake the request.
@@ -2291,7 +2679,8 @@ async def test_update_view_async(
transport: str = "grpc_asyncio", request_type=logging_config.UpdateViewRequest
):
client = ConfigServiceV2AsyncClient(
- credentials=ga_credentials.AnonymousCredentials(), transport=transport,
+ credentials=ga_credentials.AnonymousCredentials(),
+ transport=transport,
)
# Everything is optional in proto3 as far as the runtime is concerned,
@@ -2328,13 +2717,15 @@ async def test_update_view_async_from_dict():
def test_update_view_field_headers():
- client = ConfigServiceV2Client(credentials=ga_credentials.AnonymousCredentials(),)
+ client = ConfigServiceV2Client(
+ credentials=ga_credentials.AnonymousCredentials(),
+ )
# Any value that is part of the HTTP/1.1 URI should be sent as
# a field header. Set these to a non-empty value.
request = logging_config.UpdateViewRequest()
- request.name = "name/value"
+ request.name = "name_value"
# Mock the actual call within the gRPC stub, and fake the request.
with mock.patch.object(type(client.transport.update_view), "__call__") as call:
@@ -2348,7 +2739,10 @@ def test_update_view_field_headers():
# Establish that the field header was sent.
_, _, kw = call.mock_calls[0]
- assert ("x-goog-request-params", "name=name/value",) in kw["metadata"]
+ assert (
+ "x-goog-request-params",
+ "name=name_value",
+ ) in kw["metadata"]
@pytest.mark.asyncio
@@ -2361,7 +2755,7 @@ async def test_update_view_field_headers_async():
# a field header. Set these to a non-empty value.
request = logging_config.UpdateViewRequest()
- request.name = "name/value"
+ request.name = "name_value"
# Mock the actual call within the gRPC stub, and fake the request.
with mock.patch.object(type(client.transport.update_view), "__call__") as call:
@@ -2377,13 +2771,23 @@ async def test_update_view_field_headers_async():
# Establish that the field header was sent.
_, _, kw = call.mock_calls[0]
- assert ("x-goog-request-params", "name=name/value",) in kw["metadata"]
+ assert (
+ "x-goog-request-params",
+ "name=name_value",
+ ) in kw["metadata"]
-@pytest.mark.parametrize("request_type", [logging_config.DeleteViewRequest, dict,])
+@pytest.mark.parametrize(
+ "request_type",
+ [
+ logging_config.DeleteViewRequest,
+ dict,
+ ],
+)
def test_delete_view(request_type, transport: str = "grpc"):
client = ConfigServiceV2Client(
- credentials=ga_credentials.AnonymousCredentials(), transport=transport,
+ credentials=ga_credentials.AnonymousCredentials(),
+ transport=transport,
)
# Everything is optional in proto3 as far as the runtime is concerned,
@@ -2409,7 +2813,8 @@ def test_delete_view_empty_call():
# This test is a coverage failsafe to make sure that totally empty calls,
# i.e. request == None and no flattened fields passed, work.
client = ConfigServiceV2Client(
- credentials=ga_credentials.AnonymousCredentials(), transport="grpc",
+ credentials=ga_credentials.AnonymousCredentials(),
+ transport="grpc",
)
# Mock the actual call within the gRPC stub, and fake the request.
@@ -2425,7 +2830,8 @@ async def test_delete_view_async(
transport: str = "grpc_asyncio", request_type=logging_config.DeleteViewRequest
):
client = ConfigServiceV2AsyncClient(
- credentials=ga_credentials.AnonymousCredentials(), transport=transport,
+ credentials=ga_credentials.AnonymousCredentials(),
+ transport=transport,
)
# Everything is optional in proto3 as far as the runtime is concerned,
@@ -2453,13 +2859,15 @@ async def test_delete_view_async_from_dict():
def test_delete_view_field_headers():
- client = ConfigServiceV2Client(credentials=ga_credentials.AnonymousCredentials(),)
+ client = ConfigServiceV2Client(
+ credentials=ga_credentials.AnonymousCredentials(),
+ )
# Any value that is part of the HTTP/1.1 URI should be sent as
# a field header. Set these to a non-empty value.
request = logging_config.DeleteViewRequest()
- request.name = "name/value"
+ request.name = "name_value"
# Mock the actual call within the gRPC stub, and fake the request.
with mock.patch.object(type(client.transport.delete_view), "__call__") as call:
@@ -2473,7 +2881,10 @@ def test_delete_view_field_headers():
# Establish that the field header was sent.
_, _, kw = call.mock_calls[0]
- assert ("x-goog-request-params", "name=name/value",) in kw["metadata"]
+ assert (
+ "x-goog-request-params",
+ "name=name_value",
+ ) in kw["metadata"]
@pytest.mark.asyncio
@@ -2486,7 +2897,7 @@ async def test_delete_view_field_headers_async():
# a field header. Set these to a non-empty value.
request = logging_config.DeleteViewRequest()
- request.name = "name/value"
+ request.name = "name_value"
# Mock the actual call within the gRPC stub, and fake the request.
with mock.patch.object(type(client.transport.delete_view), "__call__") as call:
@@ -2500,13 +2911,23 @@ async def test_delete_view_field_headers_async():
# Establish that the field header was sent.
_, _, kw = call.mock_calls[0]
- assert ("x-goog-request-params", "name=name/value",) in kw["metadata"]
+ assert (
+ "x-goog-request-params",
+ "name=name_value",
+ ) in kw["metadata"]
-@pytest.mark.parametrize("request_type", [logging_config.ListSinksRequest, dict,])
+@pytest.mark.parametrize(
+ "request_type",
+ [
+ logging_config.ListSinksRequest,
+ dict,
+ ],
+)
def test_list_sinks(request_type, transport: str = "grpc"):
client = ConfigServiceV2Client(
- credentials=ga_credentials.AnonymousCredentials(), transport=transport,
+ credentials=ga_credentials.AnonymousCredentials(),
+ transport=transport,
)
# Everything is optional in proto3 as far as the runtime is concerned,
@@ -2535,7 +2956,8 @@ def test_list_sinks_empty_call():
# This test is a coverage failsafe to make sure that totally empty calls,
# i.e. request == None and no flattened fields passed, work.
client = ConfigServiceV2Client(
- credentials=ga_credentials.AnonymousCredentials(), transport="grpc",
+ credentials=ga_credentials.AnonymousCredentials(),
+ transport="grpc",
)
# Mock the actual call within the gRPC stub, and fake the request.
@@ -2551,7 +2973,8 @@ async def test_list_sinks_async(
transport: str = "grpc_asyncio", request_type=logging_config.ListSinksRequest
):
client = ConfigServiceV2AsyncClient(
- credentials=ga_credentials.AnonymousCredentials(), transport=transport,
+ credentials=ga_credentials.AnonymousCredentials(),
+ transport=transport,
)
# Everything is optional in proto3 as far as the runtime is concerned,
@@ -2562,7 +2985,9 @@ async def test_list_sinks_async(
with mock.patch.object(type(client.transport.list_sinks), "__call__") as call:
# Designate an appropriate return value for the call.
call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(
- logging_config.ListSinksResponse(next_page_token="next_page_token_value",)
+ logging_config.ListSinksResponse(
+ next_page_token="next_page_token_value",
+ )
)
response = await client.list_sinks(request)
@@ -2582,13 +3007,15 @@ async def test_list_sinks_async_from_dict():
def test_list_sinks_field_headers():
- client = ConfigServiceV2Client(credentials=ga_credentials.AnonymousCredentials(),)
+ client = ConfigServiceV2Client(
+ credentials=ga_credentials.AnonymousCredentials(),
+ )
# Any value that is part of the HTTP/1.1 URI should be sent as
# a field header. Set these to a non-empty value.
request = logging_config.ListSinksRequest()
- request.parent = "parent/value"
+ request.parent = "parent_value"
# Mock the actual call within the gRPC stub, and fake the request.
with mock.patch.object(type(client.transport.list_sinks), "__call__") as call:
@@ -2602,7 +3029,10 @@ def test_list_sinks_field_headers():
# Establish that the field header was sent.
_, _, kw = call.mock_calls[0]
- assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"]
+ assert (
+ "x-goog-request-params",
+ "parent=parent_value",
+ ) in kw["metadata"]
@pytest.mark.asyncio
@@ -2615,7 +3045,7 @@ async def test_list_sinks_field_headers_async():
# a field header. Set these to a non-empty value.
request = logging_config.ListSinksRequest()
- request.parent = "parent/value"
+ request.parent = "parent_value"
# Mock the actual call within the gRPC stub, and fake the request.
with mock.patch.object(type(client.transport.list_sinks), "__call__") as call:
@@ -2631,11 +3061,16 @@ async def test_list_sinks_field_headers_async():
# Establish that the field header was sent.
_, _, kw = call.mock_calls[0]
- assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"]
+ assert (
+ "x-goog-request-params",
+ "parent=parent_value",
+ ) in kw["metadata"]
def test_list_sinks_flattened():
- client = ConfigServiceV2Client(credentials=ga_credentials.AnonymousCredentials(),)
+ client = ConfigServiceV2Client(
+ credentials=ga_credentials.AnonymousCredentials(),
+ )
# Mock the actual call within the gRPC stub, and fake the request.
with mock.patch.object(type(client.transport.list_sinks), "__call__") as call:
@@ -2643,7 +3078,9 @@ def test_list_sinks_flattened():
call.return_value = logging_config.ListSinksResponse()
# Call the method with a truthy value for each flattened field,
# using the keyword arguments to the method.
- client.list_sinks(parent="parent_value",)
+ client.list_sinks(
+ parent="parent_value",
+ )
# Establish that the underlying call was made with the expected
# request object values.
@@ -2655,13 +3092,16 @@ def test_list_sinks_flattened():
def test_list_sinks_flattened_error():
- client = ConfigServiceV2Client(credentials=ga_credentials.AnonymousCredentials(),)
+ client = ConfigServiceV2Client(
+ credentials=ga_credentials.AnonymousCredentials(),
+ )
# Attempting to call a method with both a request object and flattened
# fields is an error.
with pytest.raises(ValueError):
client.list_sinks(
- logging_config.ListSinksRequest(), parent="parent_value",
+ logging_config.ListSinksRequest(),
+ parent="parent_value",
)
@@ -2681,7 +3121,9 @@ async def test_list_sinks_flattened_async():
)
# Call the method with a truthy value for each flattened field,
# using the keyword arguments to the method.
- response = await client.list_sinks(parent="parent_value",)
+ response = await client.list_sinks(
+ parent="parent_value",
+ )
# Establish that the underlying call was made with the expected
# request object values.
@@ -2702,13 +3144,15 @@ async def test_list_sinks_flattened_error_async():
# fields is an error.
with pytest.raises(ValueError):
await client.list_sinks(
- logging_config.ListSinksRequest(), parent="parent_value",
+ logging_config.ListSinksRequest(),
+ parent="parent_value",
)
def test_list_sinks_pager(transport_name: str = "grpc"):
client = ConfigServiceV2Client(
- credentials=ga_credentials.AnonymousCredentials, transport=transport_name,
+ credentials=ga_credentials.AnonymousCredentials,
+ transport=transport_name,
)
# Mock the actual call within the gRPC stub, and fake the request.
@@ -2723,12 +3167,21 @@ def test_list_sinks_pager(transport_name: str = "grpc"):
],
next_page_token="abc",
),
- logging_config.ListSinksResponse(sinks=[], next_page_token="def",),
logging_config.ListSinksResponse(
- sinks=[logging_config.LogSink(),], next_page_token="ghi",
+ sinks=[],
+ next_page_token="def",
+ ),
+ logging_config.ListSinksResponse(
+ sinks=[
+ logging_config.LogSink(),
+ ],
+ next_page_token="ghi",
),
logging_config.ListSinksResponse(
- sinks=[logging_config.LogSink(), logging_config.LogSink(),],
+ sinks=[
+ logging_config.LogSink(),
+ logging_config.LogSink(),
+ ],
),
RuntimeError,
)
@@ -2741,14 +3194,15 @@ def test_list_sinks_pager(transport_name: str = "grpc"):
assert pager._metadata == metadata
- results = [i for i in pager]
+ results = list(pager)
assert len(results) == 6
assert all(isinstance(i, logging_config.LogSink) for i in results)
def test_list_sinks_pages(transport_name: str = "grpc"):
client = ConfigServiceV2Client(
- credentials=ga_credentials.AnonymousCredentials, transport=transport_name,
+ credentials=ga_credentials.AnonymousCredentials,
+ transport=transport_name,
)
# Mock the actual call within the gRPC stub, and fake the request.
@@ -2763,12 +3217,21 @@ def test_list_sinks_pages(transport_name: str = "grpc"):
],
next_page_token="abc",
),
- logging_config.ListSinksResponse(sinks=[], next_page_token="def",),
logging_config.ListSinksResponse(
- sinks=[logging_config.LogSink(),], next_page_token="ghi",
+ sinks=[],
+ next_page_token="def",
),
logging_config.ListSinksResponse(
- sinks=[logging_config.LogSink(), logging_config.LogSink(),],
+ sinks=[
+ logging_config.LogSink(),
+ ],
+ next_page_token="ghi",
+ ),
+ logging_config.ListSinksResponse(
+ sinks=[
+ logging_config.LogSink(),
+ logging_config.LogSink(),
+ ],
),
RuntimeError,
)
@@ -2797,19 +3260,30 @@ async def test_list_sinks_async_pager():
],
next_page_token="abc",
),
- logging_config.ListSinksResponse(sinks=[], next_page_token="def",),
logging_config.ListSinksResponse(
- sinks=[logging_config.LogSink(),], next_page_token="ghi",
+ sinks=[],
+ next_page_token="def",
+ ),
+ logging_config.ListSinksResponse(
+ sinks=[
+ logging_config.LogSink(),
+ ],
+ next_page_token="ghi",
),
logging_config.ListSinksResponse(
- sinks=[logging_config.LogSink(), logging_config.LogSink(),],
+ sinks=[
+ logging_config.LogSink(),
+ logging_config.LogSink(),
+ ],
),
RuntimeError,
)
- async_pager = await client.list_sinks(request={},)
+ async_pager = await client.list_sinks(
+ request={},
+ )
assert async_pager.next_page_token == "abc"
responses = []
- async for response in async_pager:
+ async for response in async_pager: # pragma: no branch
responses.append(response)
assert len(responses) == 6
@@ -2836,26 +3310,44 @@ async def test_list_sinks_async_pages():
],
next_page_token="abc",
),
- logging_config.ListSinksResponse(sinks=[], next_page_token="def",),
logging_config.ListSinksResponse(
- sinks=[logging_config.LogSink(),], next_page_token="ghi",
+ sinks=[],
+ next_page_token="def",
+ ),
+ logging_config.ListSinksResponse(
+ sinks=[
+ logging_config.LogSink(),
+ ],
+ next_page_token="ghi",
),
logging_config.ListSinksResponse(
- sinks=[logging_config.LogSink(), logging_config.LogSink(),],
+ sinks=[
+ logging_config.LogSink(),
+ logging_config.LogSink(),
+ ],
),
RuntimeError,
)
pages = []
- async for page_ in (await client.list_sinks(request={})).pages:
+ async for page_ in (
+ await client.list_sinks(request={})
+ ).pages: # pragma: no branch
pages.append(page_)
for page_, token in zip(pages, ["abc", "def", "ghi", ""]):
assert page_.raw_page.next_page_token == token
-@pytest.mark.parametrize("request_type", [logging_config.GetSinkRequest, dict,])
+@pytest.mark.parametrize(
+ "request_type",
+ [
+ logging_config.GetSinkRequest,
+ dict,
+ ],
+)
def test_get_sink(request_type, transport: str = "grpc"):
client = ConfigServiceV2Client(
- credentials=ga_credentials.AnonymousCredentials(), transport=transport,
+ credentials=ga_credentials.AnonymousCredentials(),
+ transport=transport,
)
# Everything is optional in proto3 as far as the runtime is concerned,
@@ -2901,7 +3393,8 @@ def test_get_sink_empty_call():
# This test is a coverage failsafe to make sure that totally empty calls,
# i.e. request == None and no flattened fields passed, work.
client = ConfigServiceV2Client(
- credentials=ga_credentials.AnonymousCredentials(), transport="grpc",
+ credentials=ga_credentials.AnonymousCredentials(),
+ transport="grpc",
)
# Mock the actual call within the gRPC stub, and fake the request.
@@ -2917,7 +3410,8 @@ async def test_get_sink_async(
transport: str = "grpc_asyncio", request_type=logging_config.GetSinkRequest
):
client = ConfigServiceV2AsyncClient(
- credentials=ga_credentials.AnonymousCredentials(), transport=transport,
+ credentials=ga_credentials.AnonymousCredentials(),
+ transport=transport,
)
# Everything is optional in proto3 as far as the runtime is concerned,
@@ -2964,13 +3458,15 @@ async def test_get_sink_async_from_dict():
def test_get_sink_field_headers():
- client = ConfigServiceV2Client(credentials=ga_credentials.AnonymousCredentials(),)
+ client = ConfigServiceV2Client(
+ credentials=ga_credentials.AnonymousCredentials(),
+ )
# Any value that is part of the HTTP/1.1 URI should be sent as
# a field header. Set these to a non-empty value.
request = logging_config.GetSinkRequest()
- request.sink_name = "sink_name/value"
+ request.sink_name = "sink_name_value"
# Mock the actual call within the gRPC stub, and fake the request.
with mock.patch.object(type(client.transport.get_sink), "__call__") as call:
@@ -2984,7 +3480,10 @@ def test_get_sink_field_headers():
# Establish that the field header was sent.
_, _, kw = call.mock_calls[0]
- assert ("x-goog-request-params", "sink_name=sink_name/value",) in kw["metadata"]
+ assert (
+ "x-goog-request-params",
+ "sink_name=sink_name_value",
+ ) in kw["metadata"]
@pytest.mark.asyncio
@@ -2997,7 +3496,7 @@ async def test_get_sink_field_headers_async():
# a field header. Set these to a non-empty value.
request = logging_config.GetSinkRequest()
- request.sink_name = "sink_name/value"
+ request.sink_name = "sink_name_value"
# Mock the actual call within the gRPC stub, and fake the request.
with mock.patch.object(type(client.transport.get_sink), "__call__") as call:
@@ -3013,11 +3512,16 @@ async def test_get_sink_field_headers_async():
# Establish that the field header was sent.
_, _, kw = call.mock_calls[0]
- assert ("x-goog-request-params", "sink_name=sink_name/value",) in kw["metadata"]
+ assert (
+ "x-goog-request-params",
+ "sink_name=sink_name_value",
+ ) in kw["metadata"]
def test_get_sink_flattened():
- client = ConfigServiceV2Client(credentials=ga_credentials.AnonymousCredentials(),)
+ client = ConfigServiceV2Client(
+ credentials=ga_credentials.AnonymousCredentials(),
+ )
# Mock the actual call within the gRPC stub, and fake the request.
with mock.patch.object(type(client.transport.get_sink), "__call__") as call:
@@ -3025,7 +3529,9 @@ def test_get_sink_flattened():
call.return_value = logging_config.LogSink()
# Call the method with a truthy value for each flattened field,
# using the keyword arguments to the method.
- client.get_sink(sink_name="sink_name_value",)
+ client.get_sink(
+ sink_name="sink_name_value",
+ )
# Establish that the underlying call was made with the expected
# request object values.
@@ -3037,13 +3543,16 @@ def test_get_sink_flattened():
def test_get_sink_flattened_error():
- client = ConfigServiceV2Client(credentials=ga_credentials.AnonymousCredentials(),)
+ client = ConfigServiceV2Client(
+ credentials=ga_credentials.AnonymousCredentials(),
+ )
# Attempting to call a method with both a request object and flattened
# fields is an error.
with pytest.raises(ValueError):
client.get_sink(
- logging_config.GetSinkRequest(), sink_name="sink_name_value",
+ logging_config.GetSinkRequest(),
+ sink_name="sink_name_value",
)
@@ -3063,7 +3572,9 @@ async def test_get_sink_flattened_async():
)
# Call the method with a truthy value for each flattened field,
# using the keyword arguments to the method.
- response = await client.get_sink(sink_name="sink_name_value",)
+ response = await client.get_sink(
+ sink_name="sink_name_value",
+ )
# Establish that the underlying call was made with the expected
# request object values.
@@ -3084,14 +3595,22 @@ async def test_get_sink_flattened_error_async():
# fields is an error.
with pytest.raises(ValueError):
await client.get_sink(
- logging_config.GetSinkRequest(), sink_name="sink_name_value",
+ logging_config.GetSinkRequest(),
+ sink_name="sink_name_value",
)
-@pytest.mark.parametrize("request_type", [logging_config.CreateSinkRequest, dict,])
+@pytest.mark.parametrize(
+ "request_type",
+ [
+ logging_config.CreateSinkRequest,
+ dict,
+ ],
+)
def test_create_sink(request_type, transport: str = "grpc"):
client = ConfigServiceV2Client(
- credentials=ga_credentials.AnonymousCredentials(), transport=transport,
+ credentials=ga_credentials.AnonymousCredentials(),
+ transport=transport,
)
# Everything is optional in proto3 as far as the runtime is concerned,
@@ -3137,7 +3656,8 @@ def test_create_sink_empty_call():
# This test is a coverage failsafe to make sure that totally empty calls,
# i.e. request == None and no flattened fields passed, work.
client = ConfigServiceV2Client(
- credentials=ga_credentials.AnonymousCredentials(), transport="grpc",
+ credentials=ga_credentials.AnonymousCredentials(),
+ transport="grpc",
)
# Mock the actual call within the gRPC stub, and fake the request.
@@ -3153,7 +3673,8 @@ async def test_create_sink_async(
transport: str = "grpc_asyncio", request_type=logging_config.CreateSinkRequest
):
client = ConfigServiceV2AsyncClient(
- credentials=ga_credentials.AnonymousCredentials(), transport=transport,
+ credentials=ga_credentials.AnonymousCredentials(),
+ transport=transport,
)
# Everything is optional in proto3 as far as the runtime is concerned,
@@ -3200,13 +3721,15 @@ async def test_create_sink_async_from_dict():
def test_create_sink_field_headers():
- client = ConfigServiceV2Client(credentials=ga_credentials.AnonymousCredentials(),)
+ client = ConfigServiceV2Client(
+ credentials=ga_credentials.AnonymousCredentials(),
+ )
# Any value that is part of the HTTP/1.1 URI should be sent as
# a field header. Set these to a non-empty value.
request = logging_config.CreateSinkRequest()
- request.parent = "parent/value"
+ request.parent = "parent_value"
# Mock the actual call within the gRPC stub, and fake the request.
with mock.patch.object(type(client.transport.create_sink), "__call__") as call:
@@ -3220,7 +3743,10 @@ def test_create_sink_field_headers():
# Establish that the field header was sent.
_, _, kw = call.mock_calls[0]
- assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"]
+ assert (
+ "x-goog-request-params",
+ "parent=parent_value",
+ ) in kw["metadata"]
@pytest.mark.asyncio
@@ -3233,7 +3759,7 @@ async def test_create_sink_field_headers_async():
# a field header. Set these to a non-empty value.
request = logging_config.CreateSinkRequest()
- request.parent = "parent/value"
+ request.parent = "parent_value"
# Mock the actual call within the gRPC stub, and fake the request.
with mock.patch.object(type(client.transport.create_sink), "__call__") as call:
@@ -3249,11 +3775,16 @@ async def test_create_sink_field_headers_async():
# Establish that the field header was sent.
_, _, kw = call.mock_calls[0]
- assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"]
+ assert (
+ "x-goog-request-params",
+ "parent=parent_value",
+ ) in kw["metadata"]
def test_create_sink_flattened():
- client = ConfigServiceV2Client(credentials=ga_credentials.AnonymousCredentials(),)
+ client = ConfigServiceV2Client(
+ credentials=ga_credentials.AnonymousCredentials(),
+ )
# Mock the actual call within the gRPC stub, and fake the request.
with mock.patch.object(type(client.transport.create_sink), "__call__") as call:
@@ -3262,7 +3793,8 @@ def test_create_sink_flattened():
# Call the method with a truthy value for each flattened field,
# using the keyword arguments to the method.
client.create_sink(
- parent="parent_value", sink=logging_config.LogSink(name="name_value"),
+ parent="parent_value",
+ sink=logging_config.LogSink(name="name_value"),
)
# Establish that the underlying call was made with the expected
@@ -3278,7 +3810,9 @@ def test_create_sink_flattened():
def test_create_sink_flattened_error():
- client = ConfigServiceV2Client(credentials=ga_credentials.AnonymousCredentials(),)
+ client = ConfigServiceV2Client(
+ credentials=ga_credentials.AnonymousCredentials(),
+ )
# Attempting to call a method with both a request object and flattened
# fields is an error.
@@ -3307,7 +3841,8 @@ async def test_create_sink_flattened_async():
# Call the method with a truthy value for each flattened field,
# using the keyword arguments to the method.
response = await client.create_sink(
- parent="parent_value", sink=logging_config.LogSink(name="name_value"),
+ parent="parent_value",
+ sink=logging_config.LogSink(name="name_value"),
)
# Establish that the underlying call was made with the expected
@@ -3338,10 +3873,17 @@ async def test_create_sink_flattened_error_async():
)
-@pytest.mark.parametrize("request_type", [logging_config.UpdateSinkRequest, dict,])
+@pytest.mark.parametrize(
+ "request_type",
+ [
+ logging_config.UpdateSinkRequest,
+ dict,
+ ],
+)
def test_update_sink(request_type, transport: str = "grpc"):
client = ConfigServiceV2Client(
- credentials=ga_credentials.AnonymousCredentials(), transport=transport,
+ credentials=ga_credentials.AnonymousCredentials(),
+ transport=transport,
)
# Everything is optional in proto3 as far as the runtime is concerned,
@@ -3387,7 +3929,8 @@ def test_update_sink_empty_call():
# This test is a coverage failsafe to make sure that totally empty calls,
# i.e. request == None and no flattened fields passed, work.
client = ConfigServiceV2Client(
- credentials=ga_credentials.AnonymousCredentials(), transport="grpc",
+ credentials=ga_credentials.AnonymousCredentials(),
+ transport="grpc",
)
# Mock the actual call within the gRPC stub, and fake the request.
@@ -3403,7 +3946,8 @@ async def test_update_sink_async(
transport: str = "grpc_asyncio", request_type=logging_config.UpdateSinkRequest
):
client = ConfigServiceV2AsyncClient(
- credentials=ga_credentials.AnonymousCredentials(), transport=transport,
+ credentials=ga_credentials.AnonymousCredentials(),
+ transport=transport,
)
# Everything is optional in proto3 as far as the runtime is concerned,
@@ -3450,13 +3994,15 @@ async def test_update_sink_async_from_dict():
def test_update_sink_field_headers():
- client = ConfigServiceV2Client(credentials=ga_credentials.AnonymousCredentials(),)
+ client = ConfigServiceV2Client(
+ credentials=ga_credentials.AnonymousCredentials(),
+ )
# Any value that is part of the HTTP/1.1 URI should be sent as
# a field header. Set these to a non-empty value.
request = logging_config.UpdateSinkRequest()
- request.sink_name = "sink_name/value"
+ request.sink_name = "sink_name_value"
# Mock the actual call within the gRPC stub, and fake the request.
with mock.patch.object(type(client.transport.update_sink), "__call__") as call:
@@ -3470,7 +4016,10 @@ def test_update_sink_field_headers():
# Establish that the field header was sent.
_, _, kw = call.mock_calls[0]
- assert ("x-goog-request-params", "sink_name=sink_name/value",) in kw["metadata"]
+ assert (
+ "x-goog-request-params",
+ "sink_name=sink_name_value",
+ ) in kw["metadata"]
@pytest.mark.asyncio
@@ -3483,7 +4032,7 @@ async def test_update_sink_field_headers_async():
# a field header. Set these to a non-empty value.
request = logging_config.UpdateSinkRequest()
- request.sink_name = "sink_name/value"
+ request.sink_name = "sink_name_value"
# Mock the actual call within the gRPC stub, and fake the request.
with mock.patch.object(type(client.transport.update_sink), "__call__") as call:
@@ -3499,11 +4048,16 @@ async def test_update_sink_field_headers_async():
# Establish that the field header was sent.
_, _, kw = call.mock_calls[0]
- assert ("x-goog-request-params", "sink_name=sink_name/value",) in kw["metadata"]
+ assert (
+ "x-goog-request-params",
+ "sink_name=sink_name_value",
+ ) in kw["metadata"]
def test_update_sink_flattened():
- client = ConfigServiceV2Client(credentials=ga_credentials.AnonymousCredentials(),)
+ client = ConfigServiceV2Client(
+ credentials=ga_credentials.AnonymousCredentials(),
+ )
# Mock the actual call within the gRPC stub, and fake the request.
with mock.patch.object(type(client.transport.update_sink), "__call__") as call:
@@ -3533,7 +4087,9 @@ def test_update_sink_flattened():
def test_update_sink_flattened_error():
- client = ConfigServiceV2Client(credentials=ga_credentials.AnonymousCredentials(),)
+ client = ConfigServiceV2Client(
+ credentials=ga_credentials.AnonymousCredentials(),
+ )
# Attempting to call a method with both a request object and flattened
# fields is an error.
@@ -3600,10 +4156,17 @@ async def test_update_sink_flattened_error_async():
)
-@pytest.mark.parametrize("request_type", [logging_config.DeleteSinkRequest, dict,])
+@pytest.mark.parametrize(
+ "request_type",
+ [
+ logging_config.DeleteSinkRequest,
+ dict,
+ ],
+)
def test_delete_sink(request_type, transport: str = "grpc"):
client = ConfigServiceV2Client(
- credentials=ga_credentials.AnonymousCredentials(), transport=transport,
+ credentials=ga_credentials.AnonymousCredentials(),
+ transport=transport,
)
# Everything is optional in proto3 as far as the runtime is concerned,
@@ -3629,7 +4192,8 @@ def test_delete_sink_empty_call():
# This test is a coverage failsafe to make sure that totally empty calls,
# i.e. request == None and no flattened fields passed, work.
client = ConfigServiceV2Client(
- credentials=ga_credentials.AnonymousCredentials(), transport="grpc",
+ credentials=ga_credentials.AnonymousCredentials(),
+ transport="grpc",
)
# Mock the actual call within the gRPC stub, and fake the request.
@@ -3645,7 +4209,8 @@ async def test_delete_sink_async(
transport: str = "grpc_asyncio", request_type=logging_config.DeleteSinkRequest
):
client = ConfigServiceV2AsyncClient(
- credentials=ga_credentials.AnonymousCredentials(), transport=transport,
+ credentials=ga_credentials.AnonymousCredentials(),
+ transport=transport,
)
# Everything is optional in proto3 as far as the runtime is concerned,
@@ -3673,13 +4238,15 @@ async def test_delete_sink_async_from_dict():
def test_delete_sink_field_headers():
- client = ConfigServiceV2Client(credentials=ga_credentials.AnonymousCredentials(),)
+ client = ConfigServiceV2Client(
+ credentials=ga_credentials.AnonymousCredentials(),
+ )
# Any value that is part of the HTTP/1.1 URI should be sent as
# a field header. Set these to a non-empty value.
request = logging_config.DeleteSinkRequest()
- request.sink_name = "sink_name/value"
+ request.sink_name = "sink_name_value"
# Mock the actual call within the gRPC stub, and fake the request.
with mock.patch.object(type(client.transport.delete_sink), "__call__") as call:
@@ -3693,7 +4260,10 @@ def test_delete_sink_field_headers():
# Establish that the field header was sent.
_, _, kw = call.mock_calls[0]
- assert ("x-goog-request-params", "sink_name=sink_name/value",) in kw["metadata"]
+ assert (
+ "x-goog-request-params",
+ "sink_name=sink_name_value",
+ ) in kw["metadata"]
@pytest.mark.asyncio
@@ -3706,7 +4276,7 @@ async def test_delete_sink_field_headers_async():
# a field header. Set these to a non-empty value.
request = logging_config.DeleteSinkRequest()
- request.sink_name = "sink_name/value"
+ request.sink_name = "sink_name_value"
# Mock the actual call within the gRPC stub, and fake the request.
with mock.patch.object(type(client.transport.delete_sink), "__call__") as call:
@@ -3720,11 +4290,16 @@ async def test_delete_sink_field_headers_async():
# Establish that the field header was sent.
_, _, kw = call.mock_calls[0]
- assert ("x-goog-request-params", "sink_name=sink_name/value",) in kw["metadata"]
+ assert (
+ "x-goog-request-params",
+ "sink_name=sink_name_value",
+ ) in kw["metadata"]
def test_delete_sink_flattened():
- client = ConfigServiceV2Client(credentials=ga_credentials.AnonymousCredentials(),)
+ client = ConfigServiceV2Client(
+ credentials=ga_credentials.AnonymousCredentials(),
+ )
# Mock the actual call within the gRPC stub, and fake the request.
with mock.patch.object(type(client.transport.delete_sink), "__call__") as call:
@@ -3732,7 +4307,9 @@ def test_delete_sink_flattened():
call.return_value = None
# Call the method with a truthy value for each flattened field,
# using the keyword arguments to the method.
- client.delete_sink(sink_name="sink_name_value",)
+ client.delete_sink(
+ sink_name="sink_name_value",
+ )
# Establish that the underlying call was made with the expected
# request object values.
@@ -3744,13 +4321,16 @@ def test_delete_sink_flattened():
def test_delete_sink_flattened_error():
- client = ConfigServiceV2Client(credentials=ga_credentials.AnonymousCredentials(),)
+ client = ConfigServiceV2Client(
+ credentials=ga_credentials.AnonymousCredentials(),
+ )
# Attempting to call a method with both a request object and flattened
# fields is an error.
with pytest.raises(ValueError):
client.delete_sink(
- logging_config.DeleteSinkRequest(), sink_name="sink_name_value",
+ logging_config.DeleteSinkRequest(),
+ sink_name="sink_name_value",
)
@@ -3768,7 +4348,9 @@ async def test_delete_sink_flattened_async():
call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(None)
# Call the method with a truthy value for each flattened field,
# using the keyword arguments to the method.
- response = await client.delete_sink(sink_name="sink_name_value",)
+ response = await client.delete_sink(
+ sink_name="sink_name_value",
+ )
# Establish that the underlying call was made with the expected
# request object values.
@@ -3789,14 +4371,22 @@ async def test_delete_sink_flattened_error_async():
# fields is an error.
with pytest.raises(ValueError):
await client.delete_sink(
- logging_config.DeleteSinkRequest(), sink_name="sink_name_value",
+ logging_config.DeleteSinkRequest(),
+ sink_name="sink_name_value",
)
-@pytest.mark.parametrize("request_type", [logging_config.ListExclusionsRequest, dict,])
+@pytest.mark.parametrize(
+ "request_type",
+ [
+ logging_config.ListExclusionsRequest,
+ dict,
+ ],
+)
def test_list_exclusions(request_type, transport: str = "grpc"):
client = ConfigServiceV2Client(
- credentials=ga_credentials.AnonymousCredentials(), transport=transport,
+ credentials=ga_credentials.AnonymousCredentials(),
+ transport=transport,
)
# Everything is optional in proto3 as far as the runtime is concerned,
@@ -3825,7 +4415,8 @@ def test_list_exclusions_empty_call():
# This test is a coverage failsafe to make sure that totally empty calls,
# i.e. request == None and no flattened fields passed, work.
client = ConfigServiceV2Client(
- credentials=ga_credentials.AnonymousCredentials(), transport="grpc",
+ credentials=ga_credentials.AnonymousCredentials(),
+ transport="grpc",
)
# Mock the actual call within the gRPC stub, and fake the request.
@@ -3841,7 +4432,8 @@ async def test_list_exclusions_async(
transport: str = "grpc_asyncio", request_type=logging_config.ListExclusionsRequest
):
client = ConfigServiceV2AsyncClient(
- credentials=ga_credentials.AnonymousCredentials(), transport=transport,
+ credentials=ga_credentials.AnonymousCredentials(),
+ transport=transport,
)
# Everything is optional in proto3 as far as the runtime is concerned,
@@ -3874,13 +4466,15 @@ async def test_list_exclusions_async_from_dict():
def test_list_exclusions_field_headers():
- client = ConfigServiceV2Client(credentials=ga_credentials.AnonymousCredentials(),)
+ client = ConfigServiceV2Client(
+ credentials=ga_credentials.AnonymousCredentials(),
+ )
# Any value that is part of the HTTP/1.1 URI should be sent as
# a field header. Set these to a non-empty value.
request = logging_config.ListExclusionsRequest()
- request.parent = "parent/value"
+ request.parent = "parent_value"
# Mock the actual call within the gRPC stub, and fake the request.
with mock.patch.object(type(client.transport.list_exclusions), "__call__") as call:
@@ -3894,7 +4488,10 @@ def test_list_exclusions_field_headers():
# Establish that the field header was sent.
_, _, kw = call.mock_calls[0]
- assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"]
+ assert (
+ "x-goog-request-params",
+ "parent=parent_value",
+ ) in kw["metadata"]
@pytest.mark.asyncio
@@ -3907,7 +4504,7 @@ async def test_list_exclusions_field_headers_async():
# a field header. Set these to a non-empty value.
request = logging_config.ListExclusionsRequest()
- request.parent = "parent/value"
+ request.parent = "parent_value"
# Mock the actual call within the gRPC stub, and fake the request.
with mock.patch.object(type(client.transport.list_exclusions), "__call__") as call:
@@ -3923,11 +4520,16 @@ async def test_list_exclusions_field_headers_async():
# Establish that the field header was sent.
_, _, kw = call.mock_calls[0]
- assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"]
+ assert (
+ "x-goog-request-params",
+ "parent=parent_value",
+ ) in kw["metadata"]
def test_list_exclusions_flattened():
- client = ConfigServiceV2Client(credentials=ga_credentials.AnonymousCredentials(),)
+ client = ConfigServiceV2Client(
+ credentials=ga_credentials.AnonymousCredentials(),
+ )
# Mock the actual call within the gRPC stub, and fake the request.
with mock.patch.object(type(client.transport.list_exclusions), "__call__") as call:
@@ -3935,7 +4537,9 @@ def test_list_exclusions_flattened():
call.return_value = logging_config.ListExclusionsResponse()
# Call the method with a truthy value for each flattened field,
# using the keyword arguments to the method.
- client.list_exclusions(parent="parent_value",)
+ client.list_exclusions(
+ parent="parent_value",
+ )
# Establish that the underlying call was made with the expected
# request object values.
@@ -3947,13 +4551,16 @@ def test_list_exclusions_flattened():
def test_list_exclusions_flattened_error():
- client = ConfigServiceV2Client(credentials=ga_credentials.AnonymousCredentials(),)
+ client = ConfigServiceV2Client(
+ credentials=ga_credentials.AnonymousCredentials(),
+ )
# Attempting to call a method with both a request object and flattened
# fields is an error.
with pytest.raises(ValueError):
client.list_exclusions(
- logging_config.ListExclusionsRequest(), parent="parent_value",
+ logging_config.ListExclusionsRequest(),
+ parent="parent_value",
)
@@ -3973,7 +4580,9 @@ async def test_list_exclusions_flattened_async():
)
# Call the method with a truthy value for each flattened field,
# using the keyword arguments to the method.
- response = await client.list_exclusions(parent="parent_value",)
+ response = await client.list_exclusions(
+ parent="parent_value",
+ )
# Establish that the underlying call was made with the expected
# request object values.
@@ -3994,13 +4603,15 @@ async def test_list_exclusions_flattened_error_async():
# fields is an error.
with pytest.raises(ValueError):
await client.list_exclusions(
- logging_config.ListExclusionsRequest(), parent="parent_value",
+ logging_config.ListExclusionsRequest(),
+ parent="parent_value",
)
def test_list_exclusions_pager(transport_name: str = "grpc"):
client = ConfigServiceV2Client(
- credentials=ga_credentials.AnonymousCredentials, transport=transport_name,
+ credentials=ga_credentials.AnonymousCredentials,
+ transport=transport_name,
)
# Mock the actual call within the gRPC stub, and fake the request.
@@ -4016,10 +4627,14 @@ def test_list_exclusions_pager(transport_name: str = "grpc"):
next_page_token="abc",
),
logging_config.ListExclusionsResponse(
- exclusions=[], next_page_token="def",
+ exclusions=[],
+ next_page_token="def",
),
logging_config.ListExclusionsResponse(
- exclusions=[logging_config.LogExclusion(),], next_page_token="ghi",
+ exclusions=[
+ logging_config.LogExclusion(),
+ ],
+ next_page_token="ghi",
),
logging_config.ListExclusionsResponse(
exclusions=[
@@ -4038,14 +4653,15 @@ def test_list_exclusions_pager(transport_name: str = "grpc"):
assert pager._metadata == metadata
- results = [i for i in pager]
+ results = list(pager)
assert len(results) == 6
assert all(isinstance(i, logging_config.LogExclusion) for i in results)
def test_list_exclusions_pages(transport_name: str = "grpc"):
client = ConfigServiceV2Client(
- credentials=ga_credentials.AnonymousCredentials, transport=transport_name,
+ credentials=ga_credentials.AnonymousCredentials,
+ transport=transport_name,
)
# Mock the actual call within the gRPC stub, and fake the request.
@@ -4061,10 +4677,14 @@ def test_list_exclusions_pages(transport_name: str = "grpc"):
next_page_token="abc",
),
logging_config.ListExclusionsResponse(
- exclusions=[], next_page_token="def",
+ exclusions=[],
+ next_page_token="def",
),
logging_config.ListExclusionsResponse(
- exclusions=[logging_config.LogExclusion(),], next_page_token="ghi",
+ exclusions=[
+ logging_config.LogExclusion(),
+ ],
+ next_page_token="ghi",
),
logging_config.ListExclusionsResponse(
exclusions=[
@@ -4100,10 +4720,14 @@ async def test_list_exclusions_async_pager():
next_page_token="abc",
),
logging_config.ListExclusionsResponse(
- exclusions=[], next_page_token="def",
+ exclusions=[],
+ next_page_token="def",
),
logging_config.ListExclusionsResponse(
- exclusions=[logging_config.LogExclusion(),], next_page_token="ghi",
+ exclusions=[
+ logging_config.LogExclusion(),
+ ],
+ next_page_token="ghi",
),
logging_config.ListExclusionsResponse(
exclusions=[
@@ -4113,10 +4737,12 @@ async def test_list_exclusions_async_pager():
),
RuntimeError,
)
- async_pager = await client.list_exclusions(request={},)
+ async_pager = await client.list_exclusions(
+ request={},
+ )
assert async_pager.next_page_token == "abc"
responses = []
- async for response in async_pager:
+ async for response in async_pager: # pragma: no branch
responses.append(response)
assert len(responses) == 6
@@ -4144,10 +4770,14 @@ async def test_list_exclusions_async_pages():
next_page_token="abc",
),
logging_config.ListExclusionsResponse(
- exclusions=[], next_page_token="def",
+ exclusions=[],
+ next_page_token="def",
),
logging_config.ListExclusionsResponse(
- exclusions=[logging_config.LogExclusion(),], next_page_token="ghi",
+ exclusions=[
+ logging_config.LogExclusion(),
+ ],
+ next_page_token="ghi",
),
logging_config.ListExclusionsResponse(
exclusions=[
@@ -4158,16 +4788,25 @@ async def test_list_exclusions_async_pages():
RuntimeError,
)
pages = []
- async for page_ in (await client.list_exclusions(request={})).pages:
+ async for page_ in (
+ await client.list_exclusions(request={})
+ ).pages: # pragma: no branch
pages.append(page_)
for page_, token in zip(pages, ["abc", "def", "ghi", ""]):
assert page_.raw_page.next_page_token == token
-@pytest.mark.parametrize("request_type", [logging_config.GetExclusionRequest, dict,])
+@pytest.mark.parametrize(
+ "request_type",
+ [
+ logging_config.GetExclusionRequest,
+ dict,
+ ],
+)
def test_get_exclusion(request_type, transport: str = "grpc"):
client = ConfigServiceV2Client(
- credentials=ga_credentials.AnonymousCredentials(), transport=transport,
+ credentials=ga_credentials.AnonymousCredentials(),
+ transport=transport,
)
# Everything is optional in proto3 as far as the runtime is concerned,
@@ -4202,7 +4841,8 @@ def test_get_exclusion_empty_call():
# This test is a coverage failsafe to make sure that totally empty calls,
# i.e. request == None and no flattened fields passed, work.
client = ConfigServiceV2Client(
- credentials=ga_credentials.AnonymousCredentials(), transport="grpc",
+ credentials=ga_credentials.AnonymousCredentials(),
+ transport="grpc",
)
# Mock the actual call within the gRPC stub, and fake the request.
@@ -4218,7 +4858,8 @@ async def test_get_exclusion_async(
transport: str = "grpc_asyncio", request_type=logging_config.GetExclusionRequest
):
client = ConfigServiceV2AsyncClient(
- credentials=ga_credentials.AnonymousCredentials(), transport=transport,
+ credentials=ga_credentials.AnonymousCredentials(),
+ transport=transport,
)
# Everything is optional in proto3 as far as the runtime is concerned,
@@ -4257,13 +4898,15 @@ async def test_get_exclusion_async_from_dict():
def test_get_exclusion_field_headers():
- client = ConfigServiceV2Client(credentials=ga_credentials.AnonymousCredentials(),)
+ client = ConfigServiceV2Client(
+ credentials=ga_credentials.AnonymousCredentials(),
+ )
# Any value that is part of the HTTP/1.1 URI should be sent as
# a field header. Set these to a non-empty value.
request = logging_config.GetExclusionRequest()
- request.name = "name/value"
+ request.name = "name_value"
# Mock the actual call within the gRPC stub, and fake the request.
with mock.patch.object(type(client.transport.get_exclusion), "__call__") as call:
@@ -4277,7 +4920,10 @@ def test_get_exclusion_field_headers():
# Establish that the field header was sent.
_, _, kw = call.mock_calls[0]
- assert ("x-goog-request-params", "name=name/value",) in kw["metadata"]
+ assert (
+ "x-goog-request-params",
+ "name=name_value",
+ ) in kw["metadata"]
@pytest.mark.asyncio
@@ -4290,7 +4936,7 @@ async def test_get_exclusion_field_headers_async():
# a field header. Set these to a non-empty value.
request = logging_config.GetExclusionRequest()
- request.name = "name/value"
+ request.name = "name_value"
# Mock the actual call within the gRPC stub, and fake the request.
with mock.patch.object(type(client.transport.get_exclusion), "__call__") as call:
@@ -4306,11 +4952,16 @@ async def test_get_exclusion_field_headers_async():
# Establish that the field header was sent.
_, _, kw = call.mock_calls[0]
- assert ("x-goog-request-params", "name=name/value",) in kw["metadata"]
+ assert (
+ "x-goog-request-params",
+ "name=name_value",
+ ) in kw["metadata"]
def test_get_exclusion_flattened():
- client = ConfigServiceV2Client(credentials=ga_credentials.AnonymousCredentials(),)
+ client = ConfigServiceV2Client(
+ credentials=ga_credentials.AnonymousCredentials(),
+ )
# Mock the actual call within the gRPC stub, and fake the request.
with mock.patch.object(type(client.transport.get_exclusion), "__call__") as call:
@@ -4318,7 +4969,9 @@ def test_get_exclusion_flattened():
call.return_value = logging_config.LogExclusion()
# Call the method with a truthy value for each flattened field,
# using the keyword arguments to the method.
- client.get_exclusion(name="name_value",)
+ client.get_exclusion(
+ name="name_value",
+ )
# Establish that the underlying call was made with the expected
# request object values.
@@ -4330,13 +4983,16 @@ def test_get_exclusion_flattened():
def test_get_exclusion_flattened_error():
- client = ConfigServiceV2Client(credentials=ga_credentials.AnonymousCredentials(),)
+ client = ConfigServiceV2Client(
+ credentials=ga_credentials.AnonymousCredentials(),
+ )
# Attempting to call a method with both a request object and flattened
# fields is an error.
with pytest.raises(ValueError):
client.get_exclusion(
- logging_config.GetExclusionRequest(), name="name_value",
+ logging_config.GetExclusionRequest(),
+ name="name_value",
)
@@ -4356,7 +5012,9 @@ async def test_get_exclusion_flattened_async():
)
# Call the method with a truthy value for each flattened field,
# using the keyword arguments to the method.
- response = await client.get_exclusion(name="name_value",)
+ response = await client.get_exclusion(
+ name="name_value",
+ )
# Establish that the underlying call was made with the expected
# request object values.
@@ -4377,14 +5035,22 @@ async def test_get_exclusion_flattened_error_async():
# fields is an error.
with pytest.raises(ValueError):
await client.get_exclusion(
- logging_config.GetExclusionRequest(), name="name_value",
+ logging_config.GetExclusionRequest(),
+ name="name_value",
)
-@pytest.mark.parametrize("request_type", [logging_config.CreateExclusionRequest, dict,])
+@pytest.mark.parametrize(
+ "request_type",
+ [
+ logging_config.CreateExclusionRequest,
+ dict,
+ ],
+)
def test_create_exclusion(request_type, transport: str = "grpc"):
client = ConfigServiceV2Client(
- credentials=ga_credentials.AnonymousCredentials(), transport=transport,
+ credentials=ga_credentials.AnonymousCredentials(),
+ transport=transport,
)
# Everything is optional in proto3 as far as the runtime is concerned,
@@ -4419,7 +5085,8 @@ def test_create_exclusion_empty_call():
# This test is a coverage failsafe to make sure that totally empty calls,
# i.e. request == None and no flattened fields passed, work.
client = ConfigServiceV2Client(
- credentials=ga_credentials.AnonymousCredentials(), transport="grpc",
+ credentials=ga_credentials.AnonymousCredentials(),
+ transport="grpc",
)
# Mock the actual call within the gRPC stub, and fake the request.
@@ -4435,7 +5102,8 @@ async def test_create_exclusion_async(
transport: str = "grpc_asyncio", request_type=logging_config.CreateExclusionRequest
):
client = ConfigServiceV2AsyncClient(
- credentials=ga_credentials.AnonymousCredentials(), transport=transport,
+ credentials=ga_credentials.AnonymousCredentials(),
+ transport=transport,
)
# Everything is optional in proto3 as far as the runtime is concerned,
@@ -4474,13 +5142,15 @@ async def test_create_exclusion_async_from_dict():
def test_create_exclusion_field_headers():
- client = ConfigServiceV2Client(credentials=ga_credentials.AnonymousCredentials(),)
+ client = ConfigServiceV2Client(
+ credentials=ga_credentials.AnonymousCredentials(),
+ )
# Any value that is part of the HTTP/1.1 URI should be sent as
# a field header. Set these to a non-empty value.
request = logging_config.CreateExclusionRequest()
- request.parent = "parent/value"
+ request.parent = "parent_value"
# Mock the actual call within the gRPC stub, and fake the request.
with mock.patch.object(type(client.transport.create_exclusion), "__call__") as call:
@@ -4494,7 +5164,10 @@ def test_create_exclusion_field_headers():
# Establish that the field header was sent.
_, _, kw = call.mock_calls[0]
- assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"]
+ assert (
+ "x-goog-request-params",
+ "parent=parent_value",
+ ) in kw["metadata"]
@pytest.mark.asyncio
@@ -4507,7 +5180,7 @@ async def test_create_exclusion_field_headers_async():
# a field header. Set these to a non-empty value.
request = logging_config.CreateExclusionRequest()
- request.parent = "parent/value"
+ request.parent = "parent_value"
# Mock the actual call within the gRPC stub, and fake the request.
with mock.patch.object(type(client.transport.create_exclusion), "__call__") as call:
@@ -4523,11 +5196,16 @@ async def test_create_exclusion_field_headers_async():
# Establish that the field header was sent.
_, _, kw = call.mock_calls[0]
- assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"]
+ assert (
+ "x-goog-request-params",
+ "parent=parent_value",
+ ) in kw["metadata"]
def test_create_exclusion_flattened():
- client = ConfigServiceV2Client(credentials=ga_credentials.AnonymousCredentials(),)
+ client = ConfigServiceV2Client(
+ credentials=ga_credentials.AnonymousCredentials(),
+ )
# Mock the actual call within the gRPC stub, and fake the request.
with mock.patch.object(type(client.transport.create_exclusion), "__call__") as call:
@@ -4553,7 +5231,9 @@ def test_create_exclusion_flattened():
def test_create_exclusion_flattened_error():
- client = ConfigServiceV2Client(credentials=ga_credentials.AnonymousCredentials(),)
+ client = ConfigServiceV2Client(
+ credentials=ga_credentials.AnonymousCredentials(),
+ )
# Attempting to call a method with both a request object and flattened
# fields is an error.
@@ -4614,10 +5294,17 @@ async def test_create_exclusion_flattened_error_async():
)
-@pytest.mark.parametrize("request_type", [logging_config.UpdateExclusionRequest, dict,])
+@pytest.mark.parametrize(
+ "request_type",
+ [
+ logging_config.UpdateExclusionRequest,
+ dict,
+ ],
+)
def test_update_exclusion(request_type, transport: str = "grpc"):
client = ConfigServiceV2Client(
- credentials=ga_credentials.AnonymousCredentials(), transport=transport,
+ credentials=ga_credentials.AnonymousCredentials(),
+ transport=transport,
)
# Everything is optional in proto3 as far as the runtime is concerned,
@@ -4652,7 +5339,8 @@ def test_update_exclusion_empty_call():
# This test is a coverage failsafe to make sure that totally empty calls,
# i.e. request == None and no flattened fields passed, work.
client = ConfigServiceV2Client(
- credentials=ga_credentials.AnonymousCredentials(), transport="grpc",
+ credentials=ga_credentials.AnonymousCredentials(),
+ transport="grpc",
)
# Mock the actual call within the gRPC stub, and fake the request.
@@ -4668,7 +5356,8 @@ async def test_update_exclusion_async(
transport: str = "grpc_asyncio", request_type=logging_config.UpdateExclusionRequest
):
client = ConfigServiceV2AsyncClient(
- credentials=ga_credentials.AnonymousCredentials(), transport=transport,
+ credentials=ga_credentials.AnonymousCredentials(),
+ transport=transport,
)
# Everything is optional in proto3 as far as the runtime is concerned,
@@ -4707,13 +5396,15 @@ async def test_update_exclusion_async_from_dict():
def test_update_exclusion_field_headers():
- client = ConfigServiceV2Client(credentials=ga_credentials.AnonymousCredentials(),)
+ client = ConfigServiceV2Client(
+ credentials=ga_credentials.AnonymousCredentials(),
+ )
# Any value that is part of the HTTP/1.1 URI should be sent as
# a field header. Set these to a non-empty value.
request = logging_config.UpdateExclusionRequest()
- request.name = "name/value"
+ request.name = "name_value"
# Mock the actual call within the gRPC stub, and fake the request.
with mock.patch.object(type(client.transport.update_exclusion), "__call__") as call:
@@ -4727,7 +5418,10 @@ def test_update_exclusion_field_headers():
# Establish that the field header was sent.
_, _, kw = call.mock_calls[0]
- assert ("x-goog-request-params", "name=name/value",) in kw["metadata"]
+ assert (
+ "x-goog-request-params",
+ "name=name_value",
+ ) in kw["metadata"]
@pytest.mark.asyncio
@@ -4740,7 +5434,7 @@ async def test_update_exclusion_field_headers_async():
# a field header. Set these to a non-empty value.
request = logging_config.UpdateExclusionRequest()
- request.name = "name/value"
+ request.name = "name_value"
# Mock the actual call within the gRPC stub, and fake the request.
with mock.patch.object(type(client.transport.update_exclusion), "__call__") as call:
@@ -4756,11 +5450,16 @@ async def test_update_exclusion_field_headers_async():
# Establish that the field header was sent.
_, _, kw = call.mock_calls[0]
- assert ("x-goog-request-params", "name=name/value",) in kw["metadata"]
+ assert (
+ "x-goog-request-params",
+ "name=name_value",
+ ) in kw["metadata"]
def test_update_exclusion_flattened():
- client = ConfigServiceV2Client(credentials=ga_credentials.AnonymousCredentials(),)
+ client = ConfigServiceV2Client(
+ credentials=ga_credentials.AnonymousCredentials(),
+ )
# Mock the actual call within the gRPC stub, and fake the request.
with mock.patch.object(type(client.transport.update_exclusion), "__call__") as call:
@@ -4790,7 +5489,9 @@ def test_update_exclusion_flattened():
def test_update_exclusion_flattened_error():
- client = ConfigServiceV2Client(credentials=ga_credentials.AnonymousCredentials(),)
+ client = ConfigServiceV2Client(
+ credentials=ga_credentials.AnonymousCredentials(),
+ )
# Attempting to call a method with both a request object and flattened
# fields is an error.
@@ -4857,10 +5558,17 @@ async def test_update_exclusion_flattened_error_async():
)
-@pytest.mark.parametrize("request_type", [logging_config.DeleteExclusionRequest, dict,])
+@pytest.mark.parametrize(
+ "request_type",
+ [
+ logging_config.DeleteExclusionRequest,
+ dict,
+ ],
+)
def test_delete_exclusion(request_type, transport: str = "grpc"):
client = ConfigServiceV2Client(
- credentials=ga_credentials.AnonymousCredentials(), transport=transport,
+ credentials=ga_credentials.AnonymousCredentials(),
+ transport=transport,
)
# Everything is optional in proto3 as far as the runtime is concerned,
@@ -4886,7 +5594,8 @@ def test_delete_exclusion_empty_call():
# This test is a coverage failsafe to make sure that totally empty calls,
# i.e. request == None and no flattened fields passed, work.
client = ConfigServiceV2Client(
- credentials=ga_credentials.AnonymousCredentials(), transport="grpc",
+ credentials=ga_credentials.AnonymousCredentials(),
+ transport="grpc",
)
# Mock the actual call within the gRPC stub, and fake the request.
@@ -4902,7 +5611,8 @@ async def test_delete_exclusion_async(
transport: str = "grpc_asyncio", request_type=logging_config.DeleteExclusionRequest
):
client = ConfigServiceV2AsyncClient(
- credentials=ga_credentials.AnonymousCredentials(), transport=transport,
+ credentials=ga_credentials.AnonymousCredentials(),
+ transport=transport,
)
# Everything is optional in proto3 as far as the runtime is concerned,
@@ -4930,13 +5640,15 @@ async def test_delete_exclusion_async_from_dict():
def test_delete_exclusion_field_headers():
- client = ConfigServiceV2Client(credentials=ga_credentials.AnonymousCredentials(),)
+ client = ConfigServiceV2Client(
+ credentials=ga_credentials.AnonymousCredentials(),
+ )
# Any value that is part of the HTTP/1.1 URI should be sent as
# a field header. Set these to a non-empty value.
request = logging_config.DeleteExclusionRequest()
- request.name = "name/value"
+ request.name = "name_value"
# Mock the actual call within the gRPC stub, and fake the request.
with mock.patch.object(type(client.transport.delete_exclusion), "__call__") as call:
@@ -4950,7 +5662,10 @@ def test_delete_exclusion_field_headers():
# Establish that the field header was sent.
_, _, kw = call.mock_calls[0]
- assert ("x-goog-request-params", "name=name/value",) in kw["metadata"]
+ assert (
+ "x-goog-request-params",
+ "name=name_value",
+ ) in kw["metadata"]
@pytest.mark.asyncio
@@ -4963,7 +5678,7 @@ async def test_delete_exclusion_field_headers_async():
# a field header. Set these to a non-empty value.
request = logging_config.DeleteExclusionRequest()
- request.name = "name/value"
+ request.name = "name_value"
# Mock the actual call within the gRPC stub, and fake the request.
with mock.patch.object(type(client.transport.delete_exclusion), "__call__") as call:
@@ -4977,11 +5692,16 @@ async def test_delete_exclusion_field_headers_async():
# Establish that the field header was sent.
_, _, kw = call.mock_calls[0]
- assert ("x-goog-request-params", "name=name/value",) in kw["metadata"]
+ assert (
+ "x-goog-request-params",
+ "name=name_value",
+ ) in kw["metadata"]
def test_delete_exclusion_flattened():
- client = ConfigServiceV2Client(credentials=ga_credentials.AnonymousCredentials(),)
+ client = ConfigServiceV2Client(
+ credentials=ga_credentials.AnonymousCredentials(),
+ )
# Mock the actual call within the gRPC stub, and fake the request.
with mock.patch.object(type(client.transport.delete_exclusion), "__call__") as call:
@@ -4989,7 +5709,9 @@ def test_delete_exclusion_flattened():
call.return_value = None
# Call the method with a truthy value for each flattened field,
# using the keyword arguments to the method.
- client.delete_exclusion(name="name_value",)
+ client.delete_exclusion(
+ name="name_value",
+ )
# Establish that the underlying call was made with the expected
# request object values.
@@ -5001,13 +5723,16 @@ def test_delete_exclusion_flattened():
def test_delete_exclusion_flattened_error():
- client = ConfigServiceV2Client(credentials=ga_credentials.AnonymousCredentials(),)
+ client = ConfigServiceV2Client(
+ credentials=ga_credentials.AnonymousCredentials(),
+ )
# Attempting to call a method with both a request object and flattened
# fields is an error.
with pytest.raises(ValueError):
client.delete_exclusion(
- logging_config.DeleteExclusionRequest(), name="name_value",
+ logging_config.DeleteExclusionRequest(),
+ name="name_value",
)
@@ -5025,7 +5750,9 @@ async def test_delete_exclusion_flattened_async():
call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(None)
# Call the method with a truthy value for each flattened field,
# using the keyword arguments to the method.
- response = await client.delete_exclusion(name="name_value",)
+ response = await client.delete_exclusion(
+ name="name_value",
+ )
# Establish that the underlying call was made with the expected
# request object values.
@@ -5046,14 +5773,22 @@ async def test_delete_exclusion_flattened_error_async():
# fields is an error.
with pytest.raises(ValueError):
await client.delete_exclusion(
- logging_config.DeleteExclusionRequest(), name="name_value",
+ logging_config.DeleteExclusionRequest(),
+ name="name_value",
)
-@pytest.mark.parametrize("request_type", [logging_config.GetCmekSettingsRequest, dict,])
+@pytest.mark.parametrize(
+ "request_type",
+ [
+ logging_config.GetCmekSettingsRequest,
+ dict,
+ ],
+)
def test_get_cmek_settings(request_type, transport: str = "grpc"):
client = ConfigServiceV2Client(
- credentials=ga_credentials.AnonymousCredentials(), transport=transport,
+ credentials=ga_credentials.AnonymousCredentials(),
+ transport=transport,
)
# Everything is optional in proto3 as far as the runtime is concerned,
@@ -5088,7 +5823,8 @@ def test_get_cmek_settings_empty_call():
# This test is a coverage failsafe to make sure that totally empty calls,
# i.e. request == None and no flattened fields passed, work.
client = ConfigServiceV2Client(
- credentials=ga_credentials.AnonymousCredentials(), transport="grpc",
+ credentials=ga_credentials.AnonymousCredentials(),
+ transport="grpc",
)
# Mock the actual call within the gRPC stub, and fake the request.
@@ -5106,7 +5842,8 @@ async def test_get_cmek_settings_async(
transport: str = "grpc_asyncio", request_type=logging_config.GetCmekSettingsRequest
):
client = ConfigServiceV2AsyncClient(
- credentials=ga_credentials.AnonymousCredentials(), transport=transport,
+ credentials=ga_credentials.AnonymousCredentials(),
+ transport=transport,
)
# Everything is optional in proto3 as far as the runtime is concerned,
@@ -5145,13 +5882,15 @@ async def test_get_cmek_settings_async_from_dict():
def test_get_cmek_settings_field_headers():
- client = ConfigServiceV2Client(credentials=ga_credentials.AnonymousCredentials(),)
+ client = ConfigServiceV2Client(
+ credentials=ga_credentials.AnonymousCredentials(),
+ )
# Any value that is part of the HTTP/1.1 URI should be sent as
# a field header. Set these to a non-empty value.
request = logging_config.GetCmekSettingsRequest()
- request.name = "name/value"
+ request.name = "name_value"
# Mock the actual call within the gRPC stub, and fake the request.
with mock.patch.object(
@@ -5167,7 +5906,10 @@ def test_get_cmek_settings_field_headers():
# Establish that the field header was sent.
_, _, kw = call.mock_calls[0]
- assert ("x-goog-request-params", "name=name/value",) in kw["metadata"]
+ assert (
+ "x-goog-request-params",
+ "name=name_value",
+ ) in kw["metadata"]
@pytest.mark.asyncio
@@ -5180,7 +5922,7 @@ async def test_get_cmek_settings_field_headers_async():
# a field header. Set these to a non-empty value.
request = logging_config.GetCmekSettingsRequest()
- request.name = "name/value"
+ request.name = "name_value"
# Mock the actual call within the gRPC stub, and fake the request.
with mock.patch.object(
@@ -5198,15 +5940,23 @@ async def test_get_cmek_settings_field_headers_async():
# Establish that the field header was sent.
_, _, kw = call.mock_calls[0]
- assert ("x-goog-request-params", "name=name/value",) in kw["metadata"]
+ assert (
+ "x-goog-request-params",
+ "name=name_value",
+ ) in kw["metadata"]
@pytest.mark.parametrize(
- "request_type", [logging_config.UpdateCmekSettingsRequest, dict,]
+ "request_type",
+ [
+ logging_config.UpdateCmekSettingsRequest,
+ dict,
+ ],
)
def test_update_cmek_settings(request_type, transport: str = "grpc"):
client = ConfigServiceV2Client(
- credentials=ga_credentials.AnonymousCredentials(), transport=transport,
+ credentials=ga_credentials.AnonymousCredentials(),
+ transport=transport,
)
# Everything is optional in proto3 as far as the runtime is concerned,
@@ -5241,7 +5991,8 @@ def test_update_cmek_settings_empty_call():
# This test is a coverage failsafe to make sure that totally empty calls,
# i.e. request == None and no flattened fields passed, work.
client = ConfigServiceV2Client(
- credentials=ga_credentials.AnonymousCredentials(), transport="grpc",
+ credentials=ga_credentials.AnonymousCredentials(),
+ transport="grpc",
)
# Mock the actual call within the gRPC stub, and fake the request.
@@ -5260,7 +6011,8 @@ async def test_update_cmek_settings_async(
request_type=logging_config.UpdateCmekSettingsRequest,
):
client = ConfigServiceV2AsyncClient(
- credentials=ga_credentials.AnonymousCredentials(), transport=transport,
+ credentials=ga_credentials.AnonymousCredentials(),
+ transport=transport,
)
# Everything is optional in proto3 as far as the runtime is concerned,
@@ -5299,13 +6051,15 @@ async def test_update_cmek_settings_async_from_dict():
def test_update_cmek_settings_field_headers():
- client = ConfigServiceV2Client(credentials=ga_credentials.AnonymousCredentials(),)
+ client = ConfigServiceV2Client(
+ credentials=ga_credentials.AnonymousCredentials(),
+ )
# Any value that is part of the HTTP/1.1 URI should be sent as
# a field header. Set these to a non-empty value.
request = logging_config.UpdateCmekSettingsRequest()
- request.name = "name/value"
+ request.name = "name_value"
# Mock the actual call within the gRPC stub, and fake the request.
with mock.patch.object(
@@ -5321,7 +6075,10 @@ def test_update_cmek_settings_field_headers():
# Establish that the field header was sent.
_, _, kw = call.mock_calls[0]
- assert ("x-goog-request-params", "name=name/value",) in kw["metadata"]
+ assert (
+ "x-goog-request-params",
+ "name=name_value",
+ ) in kw["metadata"]
@pytest.mark.asyncio
@@ -5334,7 +6091,7 @@ async def test_update_cmek_settings_field_headers_async():
# a field header. Set these to a non-empty value.
request = logging_config.UpdateCmekSettingsRequest()
- request.name = "name/value"
+ request.name = "name_value"
# Mock the actual call within the gRPC stub, and fake the request.
with mock.patch.object(
@@ -5352,112 +6109,727 @@ async def test_update_cmek_settings_field_headers_async():
# Establish that the field header was sent.
_, _, kw = call.mock_calls[0]
- assert ("x-goog-request-params", "name=name/value",) in kw["metadata"]
+ assert (
+ "x-goog-request-params",
+ "name=name_value",
+ ) in kw["metadata"]
-def test_credentials_transport_error():
- # It is an error to provide credentials and a transport instance.
- transport = transports.ConfigServiceV2GrpcTransport(
+@pytest.mark.parametrize(
+ "request_type",
+ [
+ logging_config.GetSettingsRequest,
+ dict,
+ ],
+)
+def test_get_settings(request_type, transport: str = "grpc"):
+ client = ConfigServiceV2Client(
credentials=ga_credentials.AnonymousCredentials(),
+ transport=transport,
)
- with pytest.raises(ValueError):
- client = ConfigServiceV2Client(
- credentials=ga_credentials.AnonymousCredentials(), transport=transport,
- )
- # It is an error to provide a credentials file and a transport instance.
- transport = transports.ConfigServiceV2GrpcTransport(
- credentials=ga_credentials.AnonymousCredentials(),
- )
- with pytest.raises(ValueError):
- client = ConfigServiceV2Client(
- client_options={"credentials_file": "credentials.json"},
- transport=transport,
+ # Everything is optional in proto3 as far as the runtime is concerned,
+ # and we are mocking out the actual API, so just send an empty request.
+ request = request_type()
+
+ # Mock the actual call within the gRPC stub, and fake the request.
+ with mock.patch.object(type(client.transport.get_settings), "__call__") as call:
+ # Designate an appropriate return value for the call.
+ call.return_value = logging_config.Settings(
+ name="name_value",
+ kms_key_name="kms_key_name_value",
+ kms_service_account_id="kms_service_account_id_value",
+ storage_location="storage_location_value",
+ disable_default_sink=True,
)
+ response = client.get_settings(request)
- # It is an error to provide an api_key and a transport instance.
- transport = transports.ConfigServiceV2GrpcTransport(
+ # Establish that the underlying gRPC stub method was called.
+ assert len(call.mock_calls) == 1
+ _, args, _ = call.mock_calls[0]
+ assert args[0] == logging_config.GetSettingsRequest()
+
+ # Establish that the response is the type that we expect.
+ assert isinstance(response, logging_config.Settings)
+ assert response.name == "name_value"
+ assert response.kms_key_name == "kms_key_name_value"
+ assert response.kms_service_account_id == "kms_service_account_id_value"
+ assert response.storage_location == "storage_location_value"
+ assert response.disable_default_sink is True
+
+
+def test_get_settings_empty_call():
+ # This test is a coverage failsafe to make sure that totally empty calls,
+ # i.e. request == None and no flattened fields passed, work.
+ client = ConfigServiceV2Client(
credentials=ga_credentials.AnonymousCredentials(),
+ transport="grpc",
)
- options = client_options.ClientOptions()
- options.api_key = "api_key"
- with pytest.raises(ValueError):
- client = ConfigServiceV2Client(client_options=options, transport=transport,)
- # It is an error to provide an api_key and a credential.
- options = mock.Mock()
- options.api_key = "api_key"
- with pytest.raises(ValueError):
- client = ConfigServiceV2Client(
- client_options=options, credentials=ga_credentials.AnonymousCredentials()
- )
+ # Mock the actual call within the gRPC stub, and fake the request.
+ with mock.patch.object(type(client.transport.get_settings), "__call__") as call:
+ client.get_settings()
+ call.assert_called()
+ _, args, _ = call.mock_calls[0]
+ assert args[0] == logging_config.GetSettingsRequest()
- # It is an error to provide scopes and a transport instance.
- transport = transports.ConfigServiceV2GrpcTransport(
+
+@pytest.mark.asyncio
+async def test_get_settings_async(
+ transport: str = "grpc_asyncio", request_type=logging_config.GetSettingsRequest
+):
+ client = ConfigServiceV2AsyncClient(
credentials=ga_credentials.AnonymousCredentials(),
+ transport=transport,
)
- with pytest.raises(ValueError):
- client = ConfigServiceV2Client(
- client_options={"scopes": ["1", "2"]}, transport=transport,
+
+ # Everything is optional in proto3 as far as the runtime is concerned,
+ # and we are mocking out the actual API, so just send an empty request.
+ request = request_type()
+
+ # Mock the actual call within the gRPC stub, and fake the request.
+ with mock.patch.object(type(client.transport.get_settings), "__call__") as call:
+ # Designate an appropriate return value for the call.
+ call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(
+ logging_config.Settings(
+ name="name_value",
+ kms_key_name="kms_key_name_value",
+ kms_service_account_id="kms_service_account_id_value",
+ storage_location="storage_location_value",
+ disable_default_sink=True,
+ )
)
+ response = await client.get_settings(request)
+ # Establish that the underlying gRPC stub method was called.
+ assert len(call.mock_calls)
+ _, args, _ = call.mock_calls[0]
+ assert args[0] == logging_config.GetSettingsRequest()
-def test_transport_instance():
- # A client may be instantiated with a custom transport instance.
- transport = transports.ConfigServiceV2GrpcTransport(
- credentials=ga_credentials.AnonymousCredentials(),
- )
- client = ConfigServiceV2Client(transport=transport)
- assert client.transport is transport
+ # Establish that the response is the type that we expect.
+ assert isinstance(response, logging_config.Settings)
+ assert response.name == "name_value"
+ assert response.kms_key_name == "kms_key_name_value"
+ assert response.kms_service_account_id == "kms_service_account_id_value"
+ assert response.storage_location == "storage_location_value"
+ assert response.disable_default_sink is True
-def test_transport_get_channel():
- # A client may be instantiated with a custom transport instance.
- transport = transports.ConfigServiceV2GrpcTransport(
- credentials=ga_credentials.AnonymousCredentials(),
- )
- channel = transport.grpc_channel
- assert channel
+@pytest.mark.asyncio
+async def test_get_settings_async_from_dict():
+ await test_get_settings_async(request_type=dict)
- transport = transports.ConfigServiceV2GrpcAsyncIOTransport(
+
+def test_get_settings_field_headers():
+ client = ConfigServiceV2Client(
credentials=ga_credentials.AnonymousCredentials(),
)
- channel = transport.grpc_channel
- assert channel
-
-@pytest.mark.parametrize(
- "transport_class",
- [
- transports.ConfigServiceV2GrpcTransport,
- transports.ConfigServiceV2GrpcAsyncIOTransport,
- ],
-)
-def test_transport_adc(transport_class):
- # Test default credentials are used if not provided.
- with mock.patch.object(google.auth, "default") as adc:
- adc.return_value = (ga_credentials.AnonymousCredentials(), None)
- transport_class()
- adc.assert_called_once()
+ # Any value that is part of the HTTP/1.1 URI should be sent as
+ # a field header. Set these to a non-empty value.
+ request = logging_config.GetSettingsRequest()
+ request.name = "name_value"
-def test_transport_grpc_default():
- # A client should use the gRPC transport by default.
- client = ConfigServiceV2Client(credentials=ga_credentials.AnonymousCredentials(),)
- assert isinstance(client.transport, transports.ConfigServiceV2GrpcTransport,)
+ # Mock the actual call within the gRPC stub, and fake the request.
+ with mock.patch.object(type(client.transport.get_settings), "__call__") as call:
+ call.return_value = logging_config.Settings()
+ client.get_settings(request)
+ # Establish that the underlying gRPC stub method was called.
+ assert len(call.mock_calls) == 1
+ _, args, _ = call.mock_calls[0]
+ assert args[0] == request
-def test_config_service_v2_base_transport_error():
- # Passing both a credentials object and credentials_file should raise an error
- with pytest.raises(core_exceptions.DuplicateCredentialArgs):
- transport = transports.ConfigServiceV2Transport(
- credentials=ga_credentials.AnonymousCredentials(),
- credentials_file="credentials.json",
- )
+ # Establish that the field header was sent.
+ _, _, kw = call.mock_calls[0]
+ assert (
+ "x-goog-request-params",
+ "name=name_value",
+ ) in kw["metadata"]
-def test_config_service_v2_base_transport():
- # Instantiate the base transport.
+@pytest.mark.asyncio
+async def test_get_settings_field_headers_async():
+ client = ConfigServiceV2AsyncClient(
+ credentials=ga_credentials.AnonymousCredentials(),
+ )
+
+ # Any value that is part of the HTTP/1.1 URI should be sent as
+ # a field header. Set these to a non-empty value.
+ request = logging_config.GetSettingsRequest()
+
+ request.name = "name_value"
+
+ # Mock the actual call within the gRPC stub, and fake the request.
+ with mock.patch.object(type(client.transport.get_settings), "__call__") as call:
+ call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(
+ logging_config.Settings()
+ )
+ await client.get_settings(request)
+
+ # Establish that the underlying gRPC stub method was called.
+ assert len(call.mock_calls)
+ _, args, _ = call.mock_calls[0]
+ assert args[0] == request
+
+ # Establish that the field header was sent.
+ _, _, kw = call.mock_calls[0]
+ assert (
+ "x-goog-request-params",
+ "name=name_value",
+ ) in kw["metadata"]
+
+
+def test_get_settings_flattened():
+ client = ConfigServiceV2Client(
+ credentials=ga_credentials.AnonymousCredentials(),
+ )
+
+ # Mock the actual call within the gRPC stub, and fake the request.
+ with mock.patch.object(type(client.transport.get_settings), "__call__") as call:
+ # Designate an appropriate return value for the call.
+ call.return_value = logging_config.Settings()
+ # Call the method with a truthy value for each flattened field,
+ # using the keyword arguments to the method.
+ client.get_settings(
+ name="name_value",
+ )
+
+ # Establish that the underlying call was made with the expected
+ # request object values.
+ assert len(call.mock_calls) == 1
+ _, args, _ = call.mock_calls[0]
+ arg = args[0].name
+ mock_val = "name_value"
+ assert arg == mock_val
+
+
+def test_get_settings_flattened_error():
+ client = ConfigServiceV2Client(
+ credentials=ga_credentials.AnonymousCredentials(),
+ )
+
+ # Attempting to call a method with both a request object and flattened
+ # fields is an error.
+ with pytest.raises(ValueError):
+ client.get_settings(
+ logging_config.GetSettingsRequest(),
+ name="name_value",
+ )
+
+
+@pytest.mark.asyncio
+async def test_get_settings_flattened_async():
+ client = ConfigServiceV2AsyncClient(
+ credentials=ga_credentials.AnonymousCredentials(),
+ )
+
+ # Mock the actual call within the gRPC stub, and fake the request.
+ with mock.patch.object(type(client.transport.get_settings), "__call__") as call:
+ # Designate an appropriate return value for the call.
+ call.return_value = logging_config.Settings()
+
+ call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(
+ logging_config.Settings()
+ )
+ # Call the method with a truthy value for each flattened field,
+ # using the keyword arguments to the method.
+ response = await client.get_settings(
+ name="name_value",
+ )
+
+ # Establish that the underlying call was made with the expected
+ # request object values.
+ assert len(call.mock_calls)
+ _, args, _ = call.mock_calls[0]
+ arg = args[0].name
+ mock_val = "name_value"
+ assert arg == mock_val
+
+
+@pytest.mark.asyncio
+async def test_get_settings_flattened_error_async():
+ client = ConfigServiceV2AsyncClient(
+ credentials=ga_credentials.AnonymousCredentials(),
+ )
+
+ # Attempting to call a method with both a request object and flattened
+ # fields is an error.
+ with pytest.raises(ValueError):
+ await client.get_settings(
+ logging_config.GetSettingsRequest(),
+ name="name_value",
+ )
+
+
+@pytest.mark.parametrize(
+ "request_type",
+ [
+ logging_config.UpdateSettingsRequest,
+ dict,
+ ],
+)
+def test_update_settings(request_type, transport: str = "grpc"):
+ client = ConfigServiceV2Client(
+ credentials=ga_credentials.AnonymousCredentials(),
+ transport=transport,
+ )
+
+ # Everything is optional in proto3 as far as the runtime is concerned,
+ # and we are mocking out the actual API, so just send an empty request.
+ request = request_type()
+
+ # Mock the actual call within the gRPC stub, and fake the request.
+ with mock.patch.object(type(client.transport.update_settings), "__call__") as call:
+ # Designate an appropriate return value for the call.
+ call.return_value = logging_config.Settings(
+ name="name_value",
+ kms_key_name="kms_key_name_value",
+ kms_service_account_id="kms_service_account_id_value",
+ storage_location="storage_location_value",
+ disable_default_sink=True,
+ )
+ response = client.update_settings(request)
+
+ # Establish that the underlying gRPC stub method was called.
+ assert len(call.mock_calls) == 1
+ _, args, _ = call.mock_calls[0]
+ assert args[0] == logging_config.UpdateSettingsRequest()
+
+ # Establish that the response is the type that we expect.
+ assert isinstance(response, logging_config.Settings)
+ assert response.name == "name_value"
+ assert response.kms_key_name == "kms_key_name_value"
+ assert response.kms_service_account_id == "kms_service_account_id_value"
+ assert response.storage_location == "storage_location_value"
+ assert response.disable_default_sink is True
+
+
+def test_update_settings_empty_call():
+ # This test is a coverage failsafe to make sure that totally empty calls,
+ # i.e. request == None and no flattened fields passed, work.
+ client = ConfigServiceV2Client(
+ credentials=ga_credentials.AnonymousCredentials(),
+ transport="grpc",
+ )
+
+ # Mock the actual call within the gRPC stub, and fake the request.
+ with mock.patch.object(type(client.transport.update_settings), "__call__") as call:
+ client.update_settings()
+ call.assert_called()
+ _, args, _ = call.mock_calls[0]
+ assert args[0] == logging_config.UpdateSettingsRequest()
+
+
+@pytest.mark.asyncio
+async def test_update_settings_async(
+ transport: str = "grpc_asyncio", request_type=logging_config.UpdateSettingsRequest
+):
+ client = ConfigServiceV2AsyncClient(
+ credentials=ga_credentials.AnonymousCredentials(),
+ transport=transport,
+ )
+
+ # Everything is optional in proto3 as far as the runtime is concerned,
+ # and we are mocking out the actual API, so just send an empty request.
+ request = request_type()
+
+ # Mock the actual call within the gRPC stub, and fake the request.
+ with mock.patch.object(type(client.transport.update_settings), "__call__") as call:
+ # Designate an appropriate return value for the call.
+ call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(
+ logging_config.Settings(
+ name="name_value",
+ kms_key_name="kms_key_name_value",
+ kms_service_account_id="kms_service_account_id_value",
+ storage_location="storage_location_value",
+ disable_default_sink=True,
+ )
+ )
+ response = await client.update_settings(request)
+
+ # Establish that the underlying gRPC stub method was called.
+ assert len(call.mock_calls)
+ _, args, _ = call.mock_calls[0]
+ assert args[0] == logging_config.UpdateSettingsRequest()
+
+ # Establish that the response is the type that we expect.
+ assert isinstance(response, logging_config.Settings)
+ assert response.name == "name_value"
+ assert response.kms_key_name == "kms_key_name_value"
+ assert response.kms_service_account_id == "kms_service_account_id_value"
+ assert response.storage_location == "storage_location_value"
+ assert response.disable_default_sink is True
+
+
+@pytest.mark.asyncio
+async def test_update_settings_async_from_dict():
+ await test_update_settings_async(request_type=dict)
+
+
+def test_update_settings_field_headers():
+ client = ConfigServiceV2Client(
+ credentials=ga_credentials.AnonymousCredentials(),
+ )
+
+ # Any value that is part of the HTTP/1.1 URI should be sent as
+ # a field header. Set these to a non-empty value.
+ request = logging_config.UpdateSettingsRequest()
+
+ request.name = "name_value"
+
+ # Mock the actual call within the gRPC stub, and fake the request.
+ with mock.patch.object(type(client.transport.update_settings), "__call__") as call:
+ call.return_value = logging_config.Settings()
+ client.update_settings(request)
+
+ # Establish that the underlying gRPC stub method was called.
+ assert len(call.mock_calls) == 1
+ _, args, _ = call.mock_calls[0]
+ assert args[0] == request
+
+ # Establish that the field header was sent.
+ _, _, kw = call.mock_calls[0]
+ assert (
+ "x-goog-request-params",
+ "name=name_value",
+ ) in kw["metadata"]
+
+
+@pytest.mark.asyncio
+async def test_update_settings_field_headers_async():
+ client = ConfigServiceV2AsyncClient(
+ credentials=ga_credentials.AnonymousCredentials(),
+ )
+
+ # Any value that is part of the HTTP/1.1 URI should be sent as
+ # a field header. Set these to a non-empty value.
+ request = logging_config.UpdateSettingsRequest()
+
+ request.name = "name_value"
+
+ # Mock the actual call within the gRPC stub, and fake the request.
+ with mock.patch.object(type(client.transport.update_settings), "__call__") as call:
+ call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(
+ logging_config.Settings()
+ )
+ await client.update_settings(request)
+
+ # Establish that the underlying gRPC stub method was called.
+ assert len(call.mock_calls)
+ _, args, _ = call.mock_calls[0]
+ assert args[0] == request
+
+ # Establish that the field header was sent.
+ _, _, kw = call.mock_calls[0]
+ assert (
+ "x-goog-request-params",
+ "name=name_value",
+ ) in kw["metadata"]
+
+
+def test_update_settings_flattened():
+ client = ConfigServiceV2Client(
+ credentials=ga_credentials.AnonymousCredentials(),
+ )
+
+ # Mock the actual call within the gRPC stub, and fake the request.
+ with mock.patch.object(type(client.transport.update_settings), "__call__") as call:
+ # Designate an appropriate return value for the call.
+ call.return_value = logging_config.Settings()
+ # Call the method with a truthy value for each flattened field,
+ # using the keyword arguments to the method.
+ client.update_settings(
+ settings=logging_config.Settings(name="name_value"),
+ update_mask=field_mask_pb2.FieldMask(paths=["paths_value"]),
+ )
+
+ # Establish that the underlying call was made with the expected
+ # request object values.
+ assert len(call.mock_calls) == 1
+ _, args, _ = call.mock_calls[0]
+ arg = args[0].settings
+ mock_val = logging_config.Settings(name="name_value")
+ assert arg == mock_val
+ arg = args[0].update_mask
+ mock_val = field_mask_pb2.FieldMask(paths=["paths_value"])
+ assert arg == mock_val
+
+
+def test_update_settings_flattened_error():
+ client = ConfigServiceV2Client(
+ credentials=ga_credentials.AnonymousCredentials(),
+ )
+
+ # Attempting to call a method with both a request object and flattened
+ # fields is an error.
+ with pytest.raises(ValueError):
+ client.update_settings(
+ logging_config.UpdateSettingsRequest(),
+ settings=logging_config.Settings(name="name_value"),
+ update_mask=field_mask_pb2.FieldMask(paths=["paths_value"]),
+ )
+
+
+@pytest.mark.asyncio
+async def test_update_settings_flattened_async():
+ client = ConfigServiceV2AsyncClient(
+ credentials=ga_credentials.AnonymousCredentials(),
+ )
+
+ # Mock the actual call within the gRPC stub, and fake the request.
+ with mock.patch.object(type(client.transport.update_settings), "__call__") as call:
+ # Designate an appropriate return value for the call.
+ call.return_value = logging_config.Settings()
+
+ call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(
+ logging_config.Settings()
+ )
+ # Call the method with a truthy value for each flattened field,
+ # using the keyword arguments to the method.
+ response = await client.update_settings(
+ settings=logging_config.Settings(name="name_value"),
+ update_mask=field_mask_pb2.FieldMask(paths=["paths_value"]),
+ )
+
+ # Establish that the underlying call was made with the expected
+ # request object values.
+ assert len(call.mock_calls)
+ _, args, _ = call.mock_calls[0]
+ arg = args[0].settings
+ mock_val = logging_config.Settings(name="name_value")
+ assert arg == mock_val
+ arg = args[0].update_mask
+ mock_val = field_mask_pb2.FieldMask(paths=["paths_value"])
+ assert arg == mock_val
+
+
+@pytest.mark.asyncio
+async def test_update_settings_flattened_error_async():
+ client = ConfigServiceV2AsyncClient(
+ credentials=ga_credentials.AnonymousCredentials(),
+ )
+
+ # Attempting to call a method with both a request object and flattened
+ # fields is an error.
+ with pytest.raises(ValueError):
+ await client.update_settings(
+ logging_config.UpdateSettingsRequest(),
+ settings=logging_config.Settings(name="name_value"),
+ update_mask=field_mask_pb2.FieldMask(paths=["paths_value"]),
+ )
+
+
+@pytest.mark.parametrize(
+ "request_type",
+ [
+ logging_config.CopyLogEntriesRequest,
+ dict,
+ ],
+)
+def test_copy_log_entries(request_type, transport: str = "grpc"):
+ client = ConfigServiceV2Client(
+ credentials=ga_credentials.AnonymousCredentials(),
+ transport=transport,
+ )
+
+ # Everything is optional in proto3 as far as the runtime is concerned,
+ # and we are mocking out the actual API, so just send an empty request.
+ request = request_type()
+
+ # Mock the actual call within the gRPC stub, and fake the request.
+ with mock.patch.object(type(client.transport.copy_log_entries), "__call__") as call:
+ # Designate an appropriate return value for the call.
+ call.return_value = operations_pb2.Operation(name="operations/spam")
+ response = client.copy_log_entries(request)
+
+ # Establish that the underlying gRPC stub method was called.
+ assert len(call.mock_calls) == 1
+ _, args, _ = call.mock_calls[0]
+ assert args[0] == logging_config.CopyLogEntriesRequest()
+
+ # Establish that the response is the type that we expect.
+ assert isinstance(response, future.Future)
+
+
+def test_copy_log_entries_empty_call():
+ # This test is a coverage failsafe to make sure that totally empty calls,
+ # i.e. request == None and no flattened fields passed, work.
+ client = ConfigServiceV2Client(
+ credentials=ga_credentials.AnonymousCredentials(),
+ transport="grpc",
+ )
+
+ # Mock the actual call within the gRPC stub, and fake the request.
+ with mock.patch.object(type(client.transport.copy_log_entries), "__call__") as call:
+ client.copy_log_entries()
+ call.assert_called()
+ _, args, _ = call.mock_calls[0]
+ assert args[0] == logging_config.CopyLogEntriesRequest()
+
+
+@pytest.mark.asyncio
+async def test_copy_log_entries_async(
+ transport: str = "grpc_asyncio", request_type=logging_config.CopyLogEntriesRequest
+):
+ client = ConfigServiceV2AsyncClient(
+ credentials=ga_credentials.AnonymousCredentials(),
+ transport=transport,
+ )
+
+ # Everything is optional in proto3 as far as the runtime is concerned,
+ # and we are mocking out the actual API, so just send an empty request.
+ request = request_type()
+
+ # Mock the actual call within the gRPC stub, and fake the request.
+ with mock.patch.object(type(client.transport.copy_log_entries), "__call__") as call:
+ # Designate an appropriate return value for the call.
+ call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(
+ operations_pb2.Operation(name="operations/spam")
+ )
+ response = await client.copy_log_entries(request)
+
+ # Establish that the underlying gRPC stub method was called.
+ assert len(call.mock_calls)
+ _, args, _ = call.mock_calls[0]
+ assert args[0] == logging_config.CopyLogEntriesRequest()
+
+ # Establish that the response is the type that we expect.
+ assert isinstance(response, future.Future)
+
+
+@pytest.mark.asyncio
+async def test_copy_log_entries_async_from_dict():
+ await test_copy_log_entries_async(request_type=dict)
+
+
+def test_credentials_transport_error():
+ # It is an error to provide credentials and a transport instance.
+ transport = transports.ConfigServiceV2GrpcTransport(
+ credentials=ga_credentials.AnonymousCredentials(),
+ )
+ with pytest.raises(ValueError):
+ client = ConfigServiceV2Client(
+ credentials=ga_credentials.AnonymousCredentials(),
+ transport=transport,
+ )
+
+ # It is an error to provide a credentials file and a transport instance.
+ transport = transports.ConfigServiceV2GrpcTransport(
+ credentials=ga_credentials.AnonymousCredentials(),
+ )
+ with pytest.raises(ValueError):
+ client = ConfigServiceV2Client(
+ client_options={"credentials_file": "credentials.json"},
+ transport=transport,
+ )
+
+ # It is an error to provide an api_key and a transport instance.
+ transport = transports.ConfigServiceV2GrpcTransport(
+ credentials=ga_credentials.AnonymousCredentials(),
+ )
+ options = client_options.ClientOptions()
+ options.api_key = "api_key"
+ with pytest.raises(ValueError):
+ client = ConfigServiceV2Client(
+ client_options=options,
+ transport=transport,
+ )
+
+ # It is an error to provide an api_key and a credential.
+ options = mock.Mock()
+ options.api_key = "api_key"
+ with pytest.raises(ValueError):
+ client = ConfigServiceV2Client(
+ client_options=options, credentials=ga_credentials.AnonymousCredentials()
+ )
+
+ # It is an error to provide scopes and a transport instance.
+ transport = transports.ConfigServiceV2GrpcTransport(
+ credentials=ga_credentials.AnonymousCredentials(),
+ )
+ with pytest.raises(ValueError):
+ client = ConfigServiceV2Client(
+ client_options={"scopes": ["1", "2"]},
+ transport=transport,
+ )
+
+
+def test_transport_instance():
+ # A client may be instantiated with a custom transport instance.
+ transport = transports.ConfigServiceV2GrpcTransport(
+ credentials=ga_credentials.AnonymousCredentials(),
+ )
+ client = ConfigServiceV2Client(transport=transport)
+ assert client.transport is transport
+
+
+def test_transport_get_channel():
+ # A client may be instantiated with a custom transport instance.
+ transport = transports.ConfigServiceV2GrpcTransport(
+ credentials=ga_credentials.AnonymousCredentials(),
+ )
+ channel = transport.grpc_channel
+ assert channel
+
+ transport = transports.ConfigServiceV2GrpcAsyncIOTransport(
+ credentials=ga_credentials.AnonymousCredentials(),
+ )
+ channel = transport.grpc_channel
+ assert channel
+
+
+@pytest.mark.parametrize(
+ "transport_class",
+ [
+ transports.ConfigServiceV2GrpcTransport,
+ transports.ConfigServiceV2GrpcAsyncIOTransport,
+ ],
+)
+def test_transport_adc(transport_class):
+ # Test default credentials are used if not provided.
+ with mock.patch.object(google.auth, "default") as adc:
+ adc.return_value = (ga_credentials.AnonymousCredentials(), None)
+ transport_class()
+ adc.assert_called_once()
+
+
+@pytest.mark.parametrize(
+ "transport_name",
+ [
+ "grpc",
+ ],
+)
+def test_transport_kind(transport_name):
+ transport = ConfigServiceV2Client.get_transport_class(transport_name)(
+ credentials=ga_credentials.AnonymousCredentials(),
+ )
+ assert transport.kind == transport_name
+
+
+def test_transport_grpc_default():
+ # A client should use the gRPC transport by default.
+ client = ConfigServiceV2Client(
+ credentials=ga_credentials.AnonymousCredentials(),
+ )
+ assert isinstance(
+ client.transport,
+ transports.ConfigServiceV2GrpcTransport,
+ )
+
+
+def test_config_service_v2_base_transport_error():
+ # Passing both a credentials object and credentials_file should raise an error
+ with pytest.raises(core_exceptions.DuplicateCredentialArgs):
+ transport = transports.ConfigServiceV2Transport(
+ credentials=ga_credentials.AnonymousCredentials(),
+ credentials_file="credentials.json",
+ )
+
+
+def test_config_service_v2_base_transport():
+ # Instantiate the base transport.
with mock.patch(
"google.cloud.logging_v2.services.config_service_v2.transports.ConfigServiceV2Transport.__init__"
) as Transport:
@@ -5492,6 +6864,9 @@ def test_config_service_v2_base_transport():
"delete_exclusion",
"get_cmek_settings",
"update_cmek_settings",
+ "get_settings",
+ "update_settings",
+ "copy_log_entries",
)
for method in methods:
with pytest.raises(NotImplementedError):
@@ -5500,6 +6875,19 @@ def test_config_service_v2_base_transport():
with pytest.raises(NotImplementedError):
transport.close()
+ # Additionally, the LRO client (a property) should
+ # also raise NotImplementedError
+ with pytest.raises(NotImplementedError):
+ transport.operations_client
+
+ # Catch all for all remaining methods and properties
+ remainder = [
+ "kind",
+ ]
+ for r in remainder:
+ with pytest.raises(NotImplementedError):
+ getattr(transport, r)()
+
def test_config_service_v2_base_transport_with_credentials_file():
# Instantiate the base transport with a credentials file
@@ -5511,7 +6899,8 @@ def test_config_service_v2_base_transport_with_credentials_file():
Transport.return_value = None
load_creds.return_value = (ga_credentials.AnonymousCredentials(), None)
transport = transports.ConfigServiceV2Transport(
- credentials_file="credentials.json", quota_project_id="octopus",
+ credentials_file="credentials.json",
+ quota_project_id="octopus",
)
load_creds.assert_called_once_with(
"credentials.json",
@@ -5664,24 +7053,40 @@ def test_config_service_v2_grpc_transport_client_cert_source_for_mtls(transport_
)
-def test_config_service_v2_host_no_port():
+@pytest.mark.parametrize(
+ "transport_name",
+ [
+ "grpc",
+ "grpc_asyncio",
+ ],
+)
+def test_config_service_v2_host_no_port(transport_name):
client = ConfigServiceV2Client(
credentials=ga_credentials.AnonymousCredentials(),
client_options=client_options.ClientOptions(
api_endpoint="logging.googleapis.com"
),
+ transport=transport_name,
)
- assert client.transport._host == "logging.googleapis.com:443"
+ assert client.transport._host == ("logging.googleapis.com:443")
-def test_config_service_v2_host_with_port():
+@pytest.mark.parametrize(
+ "transport_name",
+ [
+ "grpc",
+ "grpc_asyncio",
+ ],
+)
+def test_config_service_v2_host_with_port(transport_name):
client = ConfigServiceV2Client(
credentials=ga_credentials.AnonymousCredentials(),
client_options=client_options.ClientOptions(
api_endpoint="logging.googleapis.com:8000"
),
+ transport=transport_name,
)
- assert client.transport._host == "logging.googleapis.com:8000"
+ assert client.transport._host == ("logging.googleapis.com:8000")
def test_config_service_v2_grpc_transport_channel():
@@ -5689,7 +7094,8 @@ def test_config_service_v2_grpc_transport_channel():
# Check that channel is used if provided.
transport = transports.ConfigServiceV2GrpcTransport(
- host="squid.clam.whelk", channel=channel,
+ host="squid.clam.whelk",
+ channel=channel,
)
assert transport.grpc_channel == channel
assert transport._host == "squid.clam.whelk:443"
@@ -5701,7 +7107,8 @@ def test_config_service_v2_grpc_asyncio_transport_channel():
# Check that channel is used if provided.
transport = transports.ConfigServiceV2GrpcAsyncIOTransport(
- host="squid.clam.whelk", channel=channel,
+ host="squid.clam.whelk",
+ channel=channel,
)
assert transport.grpc_channel == channel
assert transport._host == "squid.clam.whelk:443"
@@ -5808,9 +7215,45 @@ def test_config_service_v2_transport_channel_mtls_with_adc(transport_class):
assert transport.grpc_channel == mock_grpc_channel
+def test_config_service_v2_grpc_lro_client():
+ client = ConfigServiceV2Client(
+ credentials=ga_credentials.AnonymousCredentials(),
+ transport="grpc",
+ )
+ transport = client.transport
+
+ # Ensure that we have a api-core operations client.
+ assert isinstance(
+ transport.operations_client,
+ operations_v1.OperationsClient,
+ )
+
+ # Ensure that subsequent calls to the property send the exact same object.
+ assert transport.operations_client is transport.operations_client
+
+
+def test_config_service_v2_grpc_lro_async_client():
+ client = ConfigServiceV2AsyncClient(
+ credentials=ga_credentials.AnonymousCredentials(),
+ transport="grpc_asyncio",
+ )
+ transport = client.transport
+
+ # Ensure that we have a api-core operations client.
+ assert isinstance(
+ transport.operations_client,
+ operations_v1.OperationsAsyncClient,
+ )
+
+ # Ensure that subsequent calls to the property send the exact same object.
+ assert transport.operations_client is transport.operations_client
+
+
def test_cmek_settings_path():
project = "squid"
- expected = "projects/{project}/cmekSettings".format(project=project,)
+ expected = "projects/{project}/cmekSettings".format(
+ project=project,
+ )
actual = ConfigServiceV2Client.cmek_settings_path(project)
assert expected == actual
@@ -5831,7 +7274,9 @@ def test_log_bucket_path():
location = "octopus"
bucket = "oyster"
expected = "projects/{project}/locations/{location}/buckets/{bucket}".format(
- project=project, location=location, bucket=bucket,
+ project=project,
+ location=location,
+ bucket=bucket,
)
actual = ConfigServiceV2Client.log_bucket_path(project, location, bucket)
assert expected == actual
@@ -5854,7 +7299,8 @@ def test_log_exclusion_path():
project = "winkle"
exclusion = "nautilus"
expected = "projects/{project}/exclusions/{exclusion}".format(
- project=project, exclusion=exclusion,
+ project=project,
+ exclusion=exclusion,
)
actual = ConfigServiceV2Client.log_exclusion_path(project, exclusion)
assert expected == actual
@@ -5875,7 +7321,10 @@ def test_parse_log_exclusion_path():
def test_log_sink_path():
project = "squid"
sink = "clam"
- expected = "projects/{project}/sinks/{sink}".format(project=project, sink=sink,)
+ expected = "projects/{project}/sinks/{sink}".format(
+ project=project,
+ sink=sink,
+ )
actual = ConfigServiceV2Client.log_sink_path(project, sink)
assert expected == actual
@@ -5897,8 +7346,13 @@ def test_log_view_path():
location = "nudibranch"
bucket = "cuttlefish"
view = "mussel"
- expected = "projects/{project}/locations/{location}/buckets/{bucket}/views/{view}".format(
- project=project, location=location, bucket=bucket, view=view,
+ expected = (
+ "projects/{project}/locations/{location}/buckets/{bucket}/views/{view}".format(
+ project=project,
+ location=location,
+ bucket=bucket,
+ view=view,
+ )
)
actual = ConfigServiceV2Client.log_view_path(project, location, bucket, view)
assert expected == actual
@@ -5918,8 +7372,28 @@ def test_parse_log_view_path():
assert expected == actual
+def test_settings_path():
+ project = "squid"
+ expected = "projects/{project}/settings".format(
+ project=project,
+ )
+ actual = ConfigServiceV2Client.settings_path(project)
+ assert expected == actual
+
+
+def test_parse_settings_path():
+ expected = {
+ "project": "clam",
+ }
+ path = ConfigServiceV2Client.settings_path(**expected)
+
+ # Check that the path construction is reversible.
+ actual = ConfigServiceV2Client.parse_settings_path(path)
+ assert expected == actual
+
+
def test_common_billing_account_path():
- billing_account = "squid"
+ billing_account = "whelk"
expected = "billingAccounts/{billing_account}".format(
billing_account=billing_account,
)
@@ -5929,7 +7403,7 @@ def test_common_billing_account_path():
def test_parse_common_billing_account_path():
expected = {
- "billing_account": "clam",
+ "billing_account": "octopus",
}
path = ConfigServiceV2Client.common_billing_account_path(**expected)
@@ -5939,15 +7413,17 @@ def test_parse_common_billing_account_path():
def test_common_folder_path():
- folder = "whelk"
- expected = "folders/{folder}".format(folder=folder,)
+ folder = "oyster"
+ expected = "folders/{folder}".format(
+ folder=folder,
+ )
actual = ConfigServiceV2Client.common_folder_path(folder)
assert expected == actual
def test_parse_common_folder_path():
expected = {
- "folder": "octopus",
+ "folder": "nudibranch",
}
path = ConfigServiceV2Client.common_folder_path(**expected)
@@ -5957,15 +7433,17 @@ def test_parse_common_folder_path():
def test_common_organization_path():
- organization = "oyster"
- expected = "organizations/{organization}".format(organization=organization,)
+ organization = "cuttlefish"
+ expected = "organizations/{organization}".format(
+ organization=organization,
+ )
actual = ConfigServiceV2Client.common_organization_path(organization)
assert expected == actual
def test_parse_common_organization_path():
expected = {
- "organization": "nudibranch",
+ "organization": "mussel",
}
path = ConfigServiceV2Client.common_organization_path(**expected)
@@ -5975,15 +7453,17 @@ def test_parse_common_organization_path():
def test_common_project_path():
- project = "cuttlefish"
- expected = "projects/{project}".format(project=project,)
+ project = "winkle"
+ expected = "projects/{project}".format(
+ project=project,
+ )
actual = ConfigServiceV2Client.common_project_path(project)
assert expected == actual
def test_parse_common_project_path():
expected = {
- "project": "mussel",
+ "project": "nautilus",
}
path = ConfigServiceV2Client.common_project_path(**expected)
@@ -5993,10 +7473,11 @@ def test_parse_common_project_path():
def test_common_location_path():
- project = "winkle"
- location = "nautilus"
+ project = "scallop"
+ location = "abalone"
expected = "projects/{project}/locations/{location}".format(
- project=project, location=location,
+ project=project,
+ location=location,
)
actual = ConfigServiceV2Client.common_location_path(project, location)
assert expected == actual
@@ -6004,8 +7485,8 @@ def test_common_location_path():
def test_parse_common_location_path():
expected = {
- "project": "scallop",
- "location": "abalone",
+ "project": "squid",
+ "location": "clam",
}
path = ConfigServiceV2Client.common_location_path(**expected)
@@ -6021,7 +7502,8 @@ def test_client_with_default_client_info():
transports.ConfigServiceV2Transport, "_prep_wrapped_messages"
) as prep:
client = ConfigServiceV2Client(
- credentials=ga_credentials.AnonymousCredentials(), client_info=client_info,
+ credentials=ga_credentials.AnonymousCredentials(),
+ client_info=client_info,
)
prep.assert_called_once_with(client_info)
@@ -6030,7 +7512,8 @@ def test_client_with_default_client_info():
) as prep:
transport_class = ConfigServiceV2Client.get_transport_class()
transport = transport_class(
- credentials=ga_credentials.AnonymousCredentials(), client_info=client_info,
+ credentials=ga_credentials.AnonymousCredentials(),
+ client_info=client_info,
)
prep.assert_called_once_with(client_info)
@@ -6038,7 +7521,8 @@ def test_client_with_default_client_info():
@pytest.mark.asyncio
async def test_transport_close_async():
client = ConfigServiceV2AsyncClient(
- credentials=ga_credentials.AnonymousCredentials(), transport="grpc_asyncio",
+ credentials=ga_credentials.AnonymousCredentials(),
+ transport="grpc_asyncio",
)
with mock.patch.object(
type(getattr(client.transport, "grpc_channel")), "close"
diff --git a/tests/unit/gapic/logging_v2/test_logging_service_v2.py b/tests/unit/gapic/logging_v2/test_logging_service_v2.py
index 9f11a0210..e7cbfcd8a 100644
--- a/tests/unit/gapic/logging_v2/test_logging_service_v2.py
+++ b/tests/unit/gapic/logging_v2/test_logging_service_v2.py
@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
-# Copyright 2020 Google LLC
+# Copyright 2022 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -96,20 +96,26 @@ def test__get_default_mtls_endpoint():
@pytest.mark.parametrize(
- "client_class", [LoggingServiceV2Client, LoggingServiceV2AsyncClient,]
+ "client_class,transport_name",
+ [
+ (LoggingServiceV2Client, "grpc"),
+ (LoggingServiceV2AsyncClient, "grpc_asyncio"),
+ ],
)
-def test_logging_service_v2_client_from_service_account_info(client_class):
+def test_logging_service_v2_client_from_service_account_info(
+ client_class, transport_name
+):
creds = ga_credentials.AnonymousCredentials()
with mock.patch.object(
service_account.Credentials, "from_service_account_info"
) as factory:
factory.return_value = creds
info = {"valid": True}
- client = client_class.from_service_account_info(info)
+ client = client_class.from_service_account_info(info, transport=transport_name)
assert client.transport._credentials == creds
assert isinstance(client, client_class)
- assert client.transport._host == "logging.googleapis.com:443"
+ assert client.transport._host == ("logging.googleapis.com:443")
@pytest.mark.parametrize(
@@ -138,23 +144,33 @@ def test_logging_service_v2_client_service_account_always_use_jwt(
@pytest.mark.parametrize(
- "client_class", [LoggingServiceV2Client, LoggingServiceV2AsyncClient,]
+ "client_class,transport_name",
+ [
+ (LoggingServiceV2Client, "grpc"),
+ (LoggingServiceV2AsyncClient, "grpc_asyncio"),
+ ],
)
-def test_logging_service_v2_client_from_service_account_file(client_class):
+def test_logging_service_v2_client_from_service_account_file(
+ client_class, transport_name
+):
creds = ga_credentials.AnonymousCredentials()
with mock.patch.object(
service_account.Credentials, "from_service_account_file"
) as factory:
factory.return_value = creds
- client = client_class.from_service_account_file("dummy/file/path.json")
+ client = client_class.from_service_account_file(
+ "dummy/file/path.json", transport=transport_name
+ )
assert client.transport._credentials == creds
assert isinstance(client, client_class)
- client = client_class.from_service_account_json("dummy/file/path.json")
+ client = client_class.from_service_account_json(
+ "dummy/file/path.json", transport=transport_name
+ )
assert client.transport._credentials == creds
assert isinstance(client, client_class)
- assert client.transport._host == "logging.googleapis.com:443"
+ assert client.transport._host == ("logging.googleapis.com:443")
def test_logging_service_v2_client_get_transport_class():
@@ -512,7 +528,9 @@ def test_logging_service_v2_client_client_options_scopes(
client_class, transport_class, transport_name
):
# Check the case scopes are provided.
- options = client_options.ClientOptions(scopes=["1", "2"],)
+ options = client_options.ClientOptions(
+ scopes=["1", "2"],
+ )
with mock.patch.object(transport_class, "__init__") as patched:
patched.return_value = None
client = client_class(client_options=options, transport=transport_name)
@@ -529,21 +547,28 @@ def test_logging_service_v2_client_client_options_scopes(
@pytest.mark.parametrize(
- "client_class,transport_class,transport_name",
+ "client_class,transport_class,transport_name,grpc_helpers",
[
- (LoggingServiceV2Client, transports.LoggingServiceV2GrpcTransport, "grpc"),
+ (
+ LoggingServiceV2Client,
+ transports.LoggingServiceV2GrpcTransport,
+ "grpc",
+ grpc_helpers,
+ ),
(
LoggingServiceV2AsyncClient,
transports.LoggingServiceV2GrpcAsyncIOTransport,
"grpc_asyncio",
+ grpc_helpers_async,
),
],
)
def test_logging_service_v2_client_client_options_credentials_file(
- client_class, transport_class, transport_name
+ client_class, transport_class, transport_name, grpc_helpers
):
# Check the case credentials file is provided.
options = client_options.ClientOptions(credentials_file="credentials.json")
+
with mock.patch.object(transport_class, "__init__") as patched:
patched.return_value = None
client = client_class(client_options=options, transport=transport_name)
@@ -579,10 +604,89 @@ def test_logging_service_v2_client_client_options_from_dict():
)
-@pytest.mark.parametrize("request_type", [logging.DeleteLogRequest, dict,])
+@pytest.mark.parametrize(
+ "client_class,transport_class,transport_name,grpc_helpers",
+ [
+ (
+ LoggingServiceV2Client,
+ transports.LoggingServiceV2GrpcTransport,
+ "grpc",
+ grpc_helpers,
+ ),
+ (
+ LoggingServiceV2AsyncClient,
+ transports.LoggingServiceV2GrpcAsyncIOTransport,
+ "grpc_asyncio",
+ grpc_helpers_async,
+ ),
+ ],
+)
+def test_logging_service_v2_client_create_channel_credentials_file(
+ client_class, transport_class, transport_name, grpc_helpers
+):
+ # Check the case credentials file is provided.
+ options = client_options.ClientOptions(credentials_file="credentials.json")
+
+ with mock.patch.object(transport_class, "__init__") as patched:
+ patched.return_value = None
+ client = client_class(client_options=options, transport=transport_name)
+ patched.assert_called_once_with(
+ credentials=None,
+ credentials_file="credentials.json",
+ host=client.DEFAULT_ENDPOINT,
+ scopes=None,
+ client_cert_source_for_mtls=None,
+ quota_project_id=None,
+ client_info=transports.base.DEFAULT_CLIENT_INFO,
+ always_use_jwt_access=True,
+ )
+
+ # test that the credentials from file are saved and used as the credentials.
+ with mock.patch.object(
+ google.auth, "load_credentials_from_file", autospec=True
+ ) as load_creds, mock.patch.object(
+ google.auth, "default", autospec=True
+ ) as adc, mock.patch.object(
+ grpc_helpers, "create_channel"
+ ) as create_channel:
+ creds = ga_credentials.AnonymousCredentials()
+ file_creds = ga_credentials.AnonymousCredentials()
+ load_creds.return_value = (file_creds, None)
+ adc.return_value = (creds, None)
+ client = client_class(client_options=options, transport=transport_name)
+ create_channel.assert_called_with(
+ "logging.googleapis.com:443",
+ credentials=file_creds,
+ credentials_file=None,
+ quota_project_id=None,
+ default_scopes=(
+ "https://www.googleapis.com/auth/cloud-platform",
+ "https://www.googleapis.com/auth/cloud-platform.read-only",
+ "https://www.googleapis.com/auth/logging.admin",
+ "https://www.googleapis.com/auth/logging.read",
+ "https://www.googleapis.com/auth/logging.write",
+ ),
+ scopes=None,
+ default_host="logging.googleapis.com",
+ ssl_credentials=None,
+ options=[
+ ("grpc.max_send_message_length", -1),
+ ("grpc.max_receive_message_length", -1),
+ ],
+ )
+
+
+@pytest.mark.parametrize(
+ "request_type",
+ [
+ logging.DeleteLogRequest,
+ dict,
+ ],
+)
def test_delete_log(request_type, transport: str = "grpc"):
client = LoggingServiceV2Client(
- credentials=ga_credentials.AnonymousCredentials(), transport=transport,
+ credentials=ga_credentials.AnonymousCredentials(),
+ transport=transport,
)
# Everything is optional in proto3 as far as the runtime is concerned,
@@ -608,7 +712,8 @@ def test_delete_log_empty_call():
# This test is a coverage failsafe to make sure that totally empty calls,
# i.e. request == None and no flattened fields passed, work.
client = LoggingServiceV2Client(
- credentials=ga_credentials.AnonymousCredentials(), transport="grpc",
+ credentials=ga_credentials.AnonymousCredentials(),
+ transport="grpc",
)
# Mock the actual call within the gRPC stub, and fake the request.
@@ -624,7 +729,8 @@ async def test_delete_log_async(
transport: str = "grpc_asyncio", request_type=logging.DeleteLogRequest
):
client = LoggingServiceV2AsyncClient(
- credentials=ga_credentials.AnonymousCredentials(), transport=transport,
+ credentials=ga_credentials.AnonymousCredentials(),
+ transport=transport,
)
# Everything is optional in proto3 as far as the runtime is concerned,
@@ -652,13 +758,15 @@ async def test_delete_log_async_from_dict():
def test_delete_log_field_headers():
- client = LoggingServiceV2Client(credentials=ga_credentials.AnonymousCredentials(),)
+ client = LoggingServiceV2Client(
+ credentials=ga_credentials.AnonymousCredentials(),
+ )
# Any value that is part of the HTTP/1.1 URI should be sent as
# a field header. Set these to a non-empty value.
request = logging.DeleteLogRequest()
- request.log_name = "log_name/value"
+ request.log_name = "log_name_value"
# Mock the actual call within the gRPC stub, and fake the request.
with mock.patch.object(type(client.transport.delete_log), "__call__") as call:
@@ -672,7 +780,10 @@ def test_delete_log_field_headers():
# Establish that the field header was sent.
_, _, kw = call.mock_calls[0]
- assert ("x-goog-request-params", "log_name=log_name/value",) in kw["metadata"]
+ assert (
+ "x-goog-request-params",
+ "log_name=log_name_value",
+ ) in kw["metadata"]
@pytest.mark.asyncio
@@ -685,7 +796,7 @@ async def test_delete_log_field_headers_async():
# a field header. Set these to a non-empty value.
request = logging.DeleteLogRequest()
- request.log_name = "log_name/value"
+ request.log_name = "log_name_value"
# Mock the actual call within the gRPC stub, and fake the request.
with mock.patch.object(type(client.transport.delete_log), "__call__") as call:
@@ -699,11 +810,16 @@ async def test_delete_log_field_headers_async():
# Establish that the field header was sent.
_, _, kw = call.mock_calls[0]
- assert ("x-goog-request-params", "log_name=log_name/value",) in kw["metadata"]
+ assert (
+ "x-goog-request-params",
+ "log_name=log_name_value",
+ ) in kw["metadata"]
def test_delete_log_flattened():
- client = LoggingServiceV2Client(credentials=ga_credentials.AnonymousCredentials(),)
+ client = LoggingServiceV2Client(
+ credentials=ga_credentials.AnonymousCredentials(),
+ )
# Mock the actual call within the gRPC stub, and fake the request.
with mock.patch.object(type(client.transport.delete_log), "__call__") as call:
@@ -711,7 +827,9 @@ def test_delete_log_flattened():
call.return_value = None
# Call the method with a truthy value for each flattened field,
# using the keyword arguments to the method.
- client.delete_log(log_name="log_name_value",)
+ client.delete_log(
+ log_name="log_name_value",
+ )
# Establish that the underlying call was made with the expected
# request object values.
@@ -723,13 +841,16 @@ def test_delete_log_flattened():
def test_delete_log_flattened_error():
- client = LoggingServiceV2Client(credentials=ga_credentials.AnonymousCredentials(),)
+ client = LoggingServiceV2Client(
+ credentials=ga_credentials.AnonymousCredentials(),
+ )
# Attempting to call a method with both a request object and flattened
# fields is an error.
with pytest.raises(ValueError):
client.delete_log(
- logging.DeleteLogRequest(), log_name="log_name_value",
+ logging.DeleteLogRequest(),
+ log_name="log_name_value",
)
@@ -747,7 +868,9 @@ async def test_delete_log_flattened_async():
call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(None)
# Call the method with a truthy value for each flattened field,
# using the keyword arguments to the method.
- response = await client.delete_log(log_name="log_name_value",)
+ response = await client.delete_log(
+ log_name="log_name_value",
+ )
# Establish that the underlying call was made with the expected
# request object values.
@@ -768,14 +891,22 @@ async def test_delete_log_flattened_error_async():
# fields is an error.
with pytest.raises(ValueError):
await client.delete_log(
- logging.DeleteLogRequest(), log_name="log_name_value",
+ logging.DeleteLogRequest(),
+ log_name="log_name_value",
)
-@pytest.mark.parametrize("request_type", [logging.WriteLogEntriesRequest, dict,])
+@pytest.mark.parametrize(
+ "request_type",
+ [
+ logging.WriteLogEntriesRequest,
+ dict,
+ ],
+)
def test_write_log_entries(request_type, transport: str = "grpc"):
client = LoggingServiceV2Client(
- credentials=ga_credentials.AnonymousCredentials(), transport=transport,
+ credentials=ga_credentials.AnonymousCredentials(),
+ transport=transport,
)
# Everything is optional in proto3 as far as the runtime is concerned,
@@ -803,7 +934,8 @@ def test_write_log_entries_empty_call():
# This test is a coverage failsafe to make sure that totally empty calls,
# i.e. request == None and no flattened fields passed, work.
client = LoggingServiceV2Client(
- credentials=ga_credentials.AnonymousCredentials(), transport="grpc",
+ credentials=ga_credentials.AnonymousCredentials(),
+ transport="grpc",
)
# Mock the actual call within the gRPC stub, and fake the request.
@@ -821,7 +953,8 @@ async def test_write_log_entries_async(
transport: str = "grpc_asyncio", request_type=logging.WriteLogEntriesRequest
):
client = LoggingServiceV2AsyncClient(
- credentials=ga_credentials.AnonymousCredentials(), transport=transport,
+ credentials=ga_credentials.AnonymousCredentials(),
+ transport=transport,
)
# Everything is optional in proto3 as far as the runtime is concerned,
@@ -853,7 +986,9 @@ async def test_write_log_entries_async_from_dict():
def test_write_log_entries_flattened():
- client = LoggingServiceV2Client(credentials=ga_credentials.AnonymousCredentials(),)
+ client = LoggingServiceV2Client(
+ credentials=ga_credentials.AnonymousCredentials(),
+ )
# Mock the actual call within the gRPC stub, and fake the request.
with mock.patch.object(
@@ -889,7 +1024,9 @@ def test_write_log_entries_flattened():
def test_write_log_entries_flattened_error():
- client = LoggingServiceV2Client(credentials=ga_credentials.AnonymousCredentials(),)
+ client = LoggingServiceV2Client(
+ credentials=ga_credentials.AnonymousCredentials(),
+ )
# Attempting to call a method with both a request object and flattened
# fields is an error.
@@ -964,10 +1101,17 @@ async def test_write_log_entries_flattened_error_async():
)
-@pytest.mark.parametrize("request_type", [logging.ListLogEntriesRequest, dict,])
+@pytest.mark.parametrize(
+ "request_type",
+ [
+ logging.ListLogEntriesRequest,
+ dict,
+ ],
+)
def test_list_log_entries(request_type, transport: str = "grpc"):
client = LoggingServiceV2Client(
- credentials=ga_credentials.AnonymousCredentials(), transport=transport,
+ credentials=ga_credentials.AnonymousCredentials(),
+ transport=transport,
)
# Everything is optional in proto3 as far as the runtime is concerned,
@@ -996,7 +1140,8 @@ def test_list_log_entries_empty_call():
# This test is a coverage failsafe to make sure that totally empty calls,
# i.e. request == None and no flattened fields passed, work.
client = LoggingServiceV2Client(
- credentials=ga_credentials.AnonymousCredentials(), transport="grpc",
+ credentials=ga_credentials.AnonymousCredentials(),
+ transport="grpc",
)
# Mock the actual call within the gRPC stub, and fake the request.
@@ -1012,7 +1157,8 @@ async def test_list_log_entries_async(
transport: str = "grpc_asyncio", request_type=logging.ListLogEntriesRequest
):
client = LoggingServiceV2AsyncClient(
- credentials=ga_credentials.AnonymousCredentials(), transport=transport,
+ credentials=ga_credentials.AnonymousCredentials(),
+ transport=transport,
)
# Everything is optional in proto3 as far as the runtime is concerned,
@@ -1023,7 +1169,9 @@ async def test_list_log_entries_async(
with mock.patch.object(type(client.transport.list_log_entries), "__call__") as call:
# Designate an appropriate return value for the call.
call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(
- logging.ListLogEntriesResponse(next_page_token="next_page_token_value",)
+ logging.ListLogEntriesResponse(
+ next_page_token="next_page_token_value",
+ )
)
response = await client.list_log_entries(request)
@@ -1043,7 +1191,9 @@ async def test_list_log_entries_async_from_dict():
def test_list_log_entries_flattened():
- client = LoggingServiceV2Client(credentials=ga_credentials.AnonymousCredentials(),)
+ client = LoggingServiceV2Client(
+ credentials=ga_credentials.AnonymousCredentials(),
+ )
# Mock the actual call within the gRPC stub, and fake the request.
with mock.patch.object(type(client.transport.list_log_entries), "__call__") as call:
@@ -1073,7 +1223,9 @@ def test_list_log_entries_flattened():
def test_list_log_entries_flattened_error():
- client = LoggingServiceV2Client(credentials=ga_credentials.AnonymousCredentials(),)
+ client = LoggingServiceV2Client(
+ credentials=ga_credentials.AnonymousCredentials(),
+ )
# Attempting to call a method with both a request object and flattened
# fields is an error.
@@ -1142,7 +1294,8 @@ async def test_list_log_entries_flattened_error_async():
def test_list_log_entries_pager(transport_name: str = "grpc"):
client = LoggingServiceV2Client(
- credentials=ga_credentials.AnonymousCredentials, transport=transport_name,
+ credentials=ga_credentials.AnonymousCredentials,
+ transport=transport_name,
)
# Mock the actual call within the gRPC stub, and fake the request.
@@ -1157,12 +1310,21 @@ def test_list_log_entries_pager(transport_name: str = "grpc"):
],
next_page_token="abc",
),
- logging.ListLogEntriesResponse(entries=[], next_page_token="def",),
logging.ListLogEntriesResponse(
- entries=[log_entry.LogEntry(),], next_page_token="ghi",
+ entries=[],
+ next_page_token="def",
),
logging.ListLogEntriesResponse(
- entries=[log_entry.LogEntry(), log_entry.LogEntry(),],
+ entries=[
+ log_entry.LogEntry(),
+ ],
+ next_page_token="ghi",
+ ),
+ logging.ListLogEntriesResponse(
+ entries=[
+ log_entry.LogEntry(),
+ log_entry.LogEntry(),
+ ],
),
RuntimeError,
)
@@ -1172,14 +1334,15 @@ def test_list_log_entries_pager(transport_name: str = "grpc"):
assert pager._metadata == metadata
- results = [i for i in pager]
+ results = list(pager)
assert len(results) == 6
assert all(isinstance(i, log_entry.LogEntry) for i in results)
def test_list_log_entries_pages(transport_name: str = "grpc"):
client = LoggingServiceV2Client(
- credentials=ga_credentials.AnonymousCredentials, transport=transport_name,
+ credentials=ga_credentials.AnonymousCredentials,
+ transport=transport_name,
)
# Mock the actual call within the gRPC stub, and fake the request.
@@ -1194,12 +1357,21 @@ def test_list_log_entries_pages(transport_name: str = "grpc"):
],
next_page_token="abc",
),
- logging.ListLogEntriesResponse(entries=[], next_page_token="def",),
logging.ListLogEntriesResponse(
- entries=[log_entry.LogEntry(),], next_page_token="ghi",
+ entries=[],
+ next_page_token="def",
),
logging.ListLogEntriesResponse(
- entries=[log_entry.LogEntry(), log_entry.LogEntry(),],
+ entries=[
+ log_entry.LogEntry(),
+ ],
+ next_page_token="ghi",
+ ),
+ logging.ListLogEntriesResponse(
+ entries=[
+ log_entry.LogEntry(),
+ log_entry.LogEntry(),
+ ],
),
RuntimeError,
)
@@ -1228,19 +1400,30 @@ async def test_list_log_entries_async_pager():
],
next_page_token="abc",
),
- logging.ListLogEntriesResponse(entries=[], next_page_token="def",),
logging.ListLogEntriesResponse(
- entries=[log_entry.LogEntry(),], next_page_token="ghi",
+ entries=[],
+ next_page_token="def",
),
logging.ListLogEntriesResponse(
- entries=[log_entry.LogEntry(), log_entry.LogEntry(),],
+ entries=[
+ log_entry.LogEntry(),
+ ],
+ next_page_token="ghi",
+ ),
+ logging.ListLogEntriesResponse(
+ entries=[
+ log_entry.LogEntry(),
+ log_entry.LogEntry(),
+ ],
),
RuntimeError,
)
- async_pager = await client.list_log_entries(request={},)
+ async_pager = await client.list_log_entries(
+ request={},
+ )
assert async_pager.next_page_token == "abc"
responses = []
- async for response in async_pager:
+ async for response in async_pager: # pragma: no branch
responses.append(response)
assert len(responses) == 6
@@ -1267,28 +1450,44 @@ async def test_list_log_entries_async_pages():
],
next_page_token="abc",
),
- logging.ListLogEntriesResponse(entries=[], next_page_token="def",),
logging.ListLogEntriesResponse(
- entries=[log_entry.LogEntry(),], next_page_token="ghi",
+ entries=[],
+ next_page_token="def",
+ ),
+ logging.ListLogEntriesResponse(
+ entries=[
+ log_entry.LogEntry(),
+ ],
+ next_page_token="ghi",
),
logging.ListLogEntriesResponse(
- entries=[log_entry.LogEntry(), log_entry.LogEntry(),],
+ entries=[
+ log_entry.LogEntry(),
+ log_entry.LogEntry(),
+ ],
),
RuntimeError,
)
pages = []
- async for page_ in (await client.list_log_entries(request={})).pages:
+ async for page_ in (
+ await client.list_log_entries(request={})
+ ).pages: # pragma: no branch
pages.append(page_)
for page_, token in zip(pages, ["abc", "def", "ghi", ""]):
assert page_.raw_page.next_page_token == token
@pytest.mark.parametrize(
- "request_type", [logging.ListMonitoredResourceDescriptorsRequest, dict,]
+ "request_type",
+ [
+ logging.ListMonitoredResourceDescriptorsRequest,
+ dict,
+ ],
)
def test_list_monitored_resource_descriptors(request_type, transport: str = "grpc"):
client = LoggingServiceV2Client(
- credentials=ga_credentials.AnonymousCredentials(), transport=transport,
+ credentials=ga_credentials.AnonymousCredentials(),
+ transport=transport,
)
# Everything is optional in proto3 as far as the runtime is concerned,
@@ -1319,7 +1518,8 @@ def test_list_monitored_resource_descriptors_empty_call():
# This test is a coverage failsafe to make sure that totally empty calls,
# i.e. request == None and no flattened fields passed, work.
client = LoggingServiceV2Client(
- credentials=ga_credentials.AnonymousCredentials(), transport="grpc",
+ credentials=ga_credentials.AnonymousCredentials(),
+ transport="grpc",
)
# Mock the actual call within the gRPC stub, and fake the request.
@@ -1338,7 +1538,8 @@ async def test_list_monitored_resource_descriptors_async(
request_type=logging.ListMonitoredResourceDescriptorsRequest,
):
client = LoggingServiceV2AsyncClient(
- credentials=ga_credentials.AnonymousCredentials(), transport=transport,
+ credentials=ga_credentials.AnonymousCredentials(),
+ transport=transport,
)
# Everything is optional in proto3 as far as the runtime is concerned,
@@ -1374,7 +1575,8 @@ async def test_list_monitored_resource_descriptors_async_from_dict():
def test_list_monitored_resource_descriptors_pager(transport_name: str = "grpc"):
client = LoggingServiceV2Client(
- credentials=ga_credentials.AnonymousCredentials, transport=transport_name,
+ credentials=ga_credentials.AnonymousCredentials,
+ transport=transport_name,
)
# Mock the actual call within the gRPC stub, and fake the request.
@@ -1392,7 +1594,8 @@ def test_list_monitored_resource_descriptors_pager(transport_name: str = "grpc")
next_page_token="abc",
),
logging.ListMonitoredResourceDescriptorsResponse(
- resource_descriptors=[], next_page_token="def",
+ resource_descriptors=[],
+ next_page_token="def",
),
logging.ListMonitoredResourceDescriptorsResponse(
resource_descriptors=[
@@ -1414,7 +1617,7 @@ def test_list_monitored_resource_descriptors_pager(transport_name: str = "grpc")
assert pager._metadata == metadata
- results = [i for i in pager]
+ results = list(pager)
assert len(results) == 6
assert all(
isinstance(i, monitored_resource_pb2.MonitoredResourceDescriptor)
@@ -1424,7 +1627,8 @@ def test_list_monitored_resource_descriptors_pager(transport_name: str = "grpc")
def test_list_monitored_resource_descriptors_pages(transport_name: str = "grpc"):
client = LoggingServiceV2Client(
- credentials=ga_credentials.AnonymousCredentials, transport=transport_name,
+ credentials=ga_credentials.AnonymousCredentials,
+ transport=transport_name,
)
# Mock the actual call within the gRPC stub, and fake the request.
@@ -1442,7 +1646,8 @@ def test_list_monitored_resource_descriptors_pages(transport_name: str = "grpc")
next_page_token="abc",
),
logging.ListMonitoredResourceDescriptorsResponse(
- resource_descriptors=[], next_page_token="def",
+ resource_descriptors=[],
+ next_page_token="def",
),
logging.ListMonitoredResourceDescriptorsResponse(
resource_descriptors=[
@@ -1486,7 +1691,8 @@ async def test_list_monitored_resource_descriptors_async_pager():
next_page_token="abc",
),
logging.ListMonitoredResourceDescriptorsResponse(
- resource_descriptors=[], next_page_token="def",
+ resource_descriptors=[],
+ next_page_token="def",
),
logging.ListMonitoredResourceDescriptorsResponse(
resource_descriptors=[
@@ -1502,10 +1708,12 @@ async def test_list_monitored_resource_descriptors_async_pager():
),
RuntimeError,
)
- async_pager = await client.list_monitored_resource_descriptors(request={},)
+ async_pager = await client.list_monitored_resource_descriptors(
+ request={},
+ )
assert async_pager.next_page_token == "abc"
responses = []
- async for response in async_pager:
+ async for response in async_pager: # pragma: no branch
responses.append(response)
assert len(responses) == 6
@@ -1538,7 +1746,8 @@ async def test_list_monitored_resource_descriptors_async_pages():
next_page_token="abc",
),
logging.ListMonitoredResourceDescriptorsResponse(
- resource_descriptors=[], next_page_token="def",
+ resource_descriptors=[],
+ next_page_token="def",
),
logging.ListMonitoredResourceDescriptorsResponse(
resource_descriptors=[
@@ -1557,16 +1766,23 @@ async def test_list_monitored_resource_descriptors_async_pages():
pages = []
async for page_ in (
await client.list_monitored_resource_descriptors(request={})
- ).pages:
+ ).pages: # pragma: no branch
pages.append(page_)
for page_, token in zip(pages, ["abc", "def", "ghi", ""]):
assert page_.raw_page.next_page_token == token
-@pytest.mark.parametrize("request_type", [logging.ListLogsRequest, dict,])
+@pytest.mark.parametrize(
+ "request_type",
+ [
+ logging.ListLogsRequest,
+ dict,
+ ],
+)
def test_list_logs(request_type, transport: str = "grpc"):
client = LoggingServiceV2Client(
- credentials=ga_credentials.AnonymousCredentials(), transport=transport,
+ credentials=ga_credentials.AnonymousCredentials(),
+ transport=transport,
)
# Everything is optional in proto3 as far as the runtime is concerned,
@@ -1577,7 +1793,8 @@ def test_list_logs(request_type, transport: str = "grpc"):
with mock.patch.object(type(client.transport.list_logs), "__call__") as call:
# Designate an appropriate return value for the call.
call.return_value = logging.ListLogsResponse(
- log_names=["log_names_value"], next_page_token="next_page_token_value",
+ log_names=["log_names_value"],
+ next_page_token="next_page_token_value",
)
response = client.list_logs(request)
@@ -1596,7 +1813,8 @@ def test_list_logs_empty_call():
# This test is a coverage failsafe to make sure that totally empty calls,
# i.e. request == None and no flattened fields passed, work.
client = LoggingServiceV2Client(
- credentials=ga_credentials.AnonymousCredentials(), transport="grpc",
+ credentials=ga_credentials.AnonymousCredentials(),
+ transport="grpc",
)
# Mock the actual call within the gRPC stub, and fake the request.
@@ -1612,7 +1830,8 @@ async def test_list_logs_async(
transport: str = "grpc_asyncio", request_type=logging.ListLogsRequest
):
client = LoggingServiceV2AsyncClient(
- credentials=ga_credentials.AnonymousCredentials(), transport=transport,
+ credentials=ga_credentials.AnonymousCredentials(),
+ transport=transport,
)
# Everything is optional in proto3 as far as the runtime is concerned,
@@ -1624,7 +1843,8 @@ async def test_list_logs_async(
# Designate an appropriate return value for the call.
call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(
logging.ListLogsResponse(
- log_names=["log_names_value"], next_page_token="next_page_token_value",
+ log_names=["log_names_value"],
+ next_page_token="next_page_token_value",
)
)
response = await client.list_logs(request)
@@ -1646,13 +1866,15 @@ async def test_list_logs_async_from_dict():
def test_list_logs_field_headers():
- client = LoggingServiceV2Client(credentials=ga_credentials.AnonymousCredentials(),)
+ client = LoggingServiceV2Client(
+ credentials=ga_credentials.AnonymousCredentials(),
+ )
# Any value that is part of the HTTP/1.1 URI should be sent as
# a field header. Set these to a non-empty value.
request = logging.ListLogsRequest()
- request.parent = "parent/value"
+ request.parent = "parent_value"
# Mock the actual call within the gRPC stub, and fake the request.
with mock.patch.object(type(client.transport.list_logs), "__call__") as call:
@@ -1666,7 +1888,10 @@ def test_list_logs_field_headers():
# Establish that the field header was sent.
_, _, kw = call.mock_calls[0]
- assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"]
+ assert (
+ "x-goog-request-params",
+ "parent=parent_value",
+ ) in kw["metadata"]
@pytest.mark.asyncio
@@ -1679,7 +1904,7 @@ async def test_list_logs_field_headers_async():
# a field header. Set these to a non-empty value.
request = logging.ListLogsRequest()
- request.parent = "parent/value"
+ request.parent = "parent_value"
# Mock the actual call within the gRPC stub, and fake the request.
with mock.patch.object(type(client.transport.list_logs), "__call__") as call:
@@ -1695,11 +1920,16 @@ async def test_list_logs_field_headers_async():
# Establish that the field header was sent.
_, _, kw = call.mock_calls[0]
- assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"]
+ assert (
+ "x-goog-request-params",
+ "parent=parent_value",
+ ) in kw["metadata"]
def test_list_logs_flattened():
- client = LoggingServiceV2Client(credentials=ga_credentials.AnonymousCredentials(),)
+ client = LoggingServiceV2Client(
+ credentials=ga_credentials.AnonymousCredentials(),
+ )
# Mock the actual call within the gRPC stub, and fake the request.
with mock.patch.object(type(client.transport.list_logs), "__call__") as call:
@@ -1707,7 +1937,9 @@ def test_list_logs_flattened():
call.return_value = logging.ListLogsResponse()
# Call the method with a truthy value for each flattened field,
# using the keyword arguments to the method.
- client.list_logs(parent="parent_value",)
+ client.list_logs(
+ parent="parent_value",
+ )
# Establish that the underlying call was made with the expected
# request object values.
@@ -1719,13 +1951,16 @@ def test_list_logs_flattened():
def test_list_logs_flattened_error():
- client = LoggingServiceV2Client(credentials=ga_credentials.AnonymousCredentials(),)
+ client = LoggingServiceV2Client(
+ credentials=ga_credentials.AnonymousCredentials(),
+ )
# Attempting to call a method with both a request object and flattened
# fields is an error.
with pytest.raises(ValueError):
client.list_logs(
- logging.ListLogsRequest(), parent="parent_value",
+ logging.ListLogsRequest(),
+ parent="parent_value",
)
@@ -1745,7 +1980,9 @@ async def test_list_logs_flattened_async():
)
# Call the method with a truthy value for each flattened field,
# using the keyword arguments to the method.
- response = await client.list_logs(parent="parent_value",)
+ response = await client.list_logs(
+ parent="parent_value",
+ )
# Establish that the underlying call was made with the expected
# request object values.
@@ -1766,13 +2003,15 @@ async def test_list_logs_flattened_error_async():
# fields is an error.
with pytest.raises(ValueError):
await client.list_logs(
- logging.ListLogsRequest(), parent="parent_value",
+ logging.ListLogsRequest(),
+ parent="parent_value",
)
def test_list_logs_pager(transport_name: str = "grpc"):
client = LoggingServiceV2Client(
- credentials=ga_credentials.AnonymousCredentials, transport=transport_name,
+ credentials=ga_credentials.AnonymousCredentials,
+ transport=transport_name,
)
# Mock the actual call within the gRPC stub, and fake the request.
@@ -1780,11 +2019,29 @@ def test_list_logs_pager(transport_name: str = "grpc"):
# Set the response to a series of pages.
call.side_effect = (
logging.ListLogsResponse(
- log_names=[str(), str(), str(),], next_page_token="abc",
+ log_names=[
+ str(),
+ str(),
+ str(),
+ ],
+ next_page_token="abc",
+ ),
+ logging.ListLogsResponse(
+ log_names=[],
+ next_page_token="def",
+ ),
+ logging.ListLogsResponse(
+ log_names=[
+ str(),
+ ],
+ next_page_token="ghi",
+ ),
+ logging.ListLogsResponse(
+ log_names=[
+ str(),
+ str(),
+ ],
),
- logging.ListLogsResponse(log_names=[], next_page_token="def",),
- logging.ListLogsResponse(log_names=[str(),], next_page_token="ghi",),
- logging.ListLogsResponse(log_names=[str(), str(),],),
RuntimeError,
)
@@ -1796,14 +2053,15 @@ def test_list_logs_pager(transport_name: str = "grpc"):
assert pager._metadata == metadata
- results = [i for i in pager]
+ results = list(pager)
assert len(results) == 6
assert all(isinstance(i, str) for i in results)
def test_list_logs_pages(transport_name: str = "grpc"):
client = LoggingServiceV2Client(
- credentials=ga_credentials.AnonymousCredentials, transport=transport_name,
+ credentials=ga_credentials.AnonymousCredentials,
+ transport=transport_name,
)
# Mock the actual call within the gRPC stub, and fake the request.
@@ -1811,11 +2069,29 @@ def test_list_logs_pages(transport_name: str = "grpc"):
# Set the response to a series of pages.
call.side_effect = (
logging.ListLogsResponse(
- log_names=[str(), str(), str(),], next_page_token="abc",
+ log_names=[
+ str(),
+ str(),
+ str(),
+ ],
+ next_page_token="abc",
+ ),
+ logging.ListLogsResponse(
+ log_names=[],
+ next_page_token="def",
+ ),
+ logging.ListLogsResponse(
+ log_names=[
+ str(),
+ ],
+ next_page_token="ghi",
+ ),
+ logging.ListLogsResponse(
+ log_names=[
+ str(),
+ str(),
+ ],
),
- logging.ListLogsResponse(log_names=[], next_page_token="def",),
- logging.ListLogsResponse(log_names=[str(),], next_page_token="ghi",),
- logging.ListLogsResponse(log_names=[str(), str(),],),
RuntimeError,
)
pages = list(client.list_logs(request={}).pages)
@@ -1836,17 +2112,37 @@ async def test_list_logs_async_pager():
# Set the response to a series of pages.
call.side_effect = (
logging.ListLogsResponse(
- log_names=[str(), str(), str(),], next_page_token="abc",
+ log_names=[
+ str(),
+ str(),
+ str(),
+ ],
+ next_page_token="abc",
+ ),
+ logging.ListLogsResponse(
+ log_names=[],
+ next_page_token="def",
+ ),
+ logging.ListLogsResponse(
+ log_names=[
+ str(),
+ ],
+ next_page_token="ghi",
+ ),
+ logging.ListLogsResponse(
+ log_names=[
+ str(),
+ str(),
+ ],
),
- logging.ListLogsResponse(log_names=[], next_page_token="def",),
- logging.ListLogsResponse(log_names=[str(),], next_page_token="ghi",),
- logging.ListLogsResponse(log_names=[str(), str(),],),
RuntimeError,
)
- async_pager = await client.list_logs(request={},)
+ async_pager = await client.list_logs(
+ request={},
+ )
assert async_pager.next_page_token == "abc"
responses = []
- async for response in async_pager:
+ async for response in async_pager: # pragma: no branch
responses.append(response)
assert len(responses) == 6
@@ -1866,24 +2162,51 @@ async def test_list_logs_async_pages():
# Set the response to a series of pages.
call.side_effect = (
logging.ListLogsResponse(
- log_names=[str(), str(), str(),], next_page_token="abc",
+ log_names=[
+ str(),
+ str(),
+ str(),
+ ],
+ next_page_token="abc",
+ ),
+ logging.ListLogsResponse(
+ log_names=[],
+ next_page_token="def",
+ ),
+ logging.ListLogsResponse(
+ log_names=[
+ str(),
+ ],
+ next_page_token="ghi",
+ ),
+ logging.ListLogsResponse(
+ log_names=[
+ str(),
+ str(),
+ ],
),
- logging.ListLogsResponse(log_names=[], next_page_token="def",),
- logging.ListLogsResponse(log_names=[str(),], next_page_token="ghi",),
- logging.ListLogsResponse(log_names=[str(), str(),],),
RuntimeError,
)
pages = []
- async for page_ in (await client.list_logs(request={})).pages:
+ async for page_ in (
+ await client.list_logs(request={})
+ ).pages: # pragma: no branch
pages.append(page_)
for page_, token in zip(pages, ["abc", "def", "ghi", ""]):
assert page_.raw_page.next_page_token == token
-@pytest.mark.parametrize("request_type", [logging.TailLogEntriesRequest, dict,])
+@pytest.mark.parametrize(
+ "request_type",
+ [
+ logging.TailLogEntriesRequest,
+ dict,
+ ],
+)
def test_tail_log_entries(request_type, transport: str = "grpc"):
client = LoggingServiceV2Client(
- credentials=ga_credentials.AnonymousCredentials(), transport=transport,
+ credentials=ga_credentials.AnonymousCredentials(),
+ transport=transport,
)
# Everything is optional in proto3 as far as the runtime is concerned,
@@ -1912,7 +2235,8 @@ async def test_tail_log_entries_async(
transport: str = "grpc_asyncio", request_type=logging.TailLogEntriesRequest
):
client = LoggingServiceV2AsyncClient(
- credentials=ga_credentials.AnonymousCredentials(), transport=transport,
+ credentials=ga_credentials.AnonymousCredentials(),
+ transport=transport,
)
# Everything is optional in proto3 as far as the runtime is concerned,
@@ -1951,7 +2275,8 @@ def test_credentials_transport_error():
)
with pytest.raises(ValueError):
client = LoggingServiceV2Client(
- credentials=ga_credentials.AnonymousCredentials(), transport=transport,
+ credentials=ga_credentials.AnonymousCredentials(),
+ transport=transport,
)
# It is an error to provide a credentials file and a transport instance.
@@ -1971,7 +2296,10 @@ def test_credentials_transport_error():
options = client_options.ClientOptions()
options.api_key = "api_key"
with pytest.raises(ValueError):
- client = LoggingServiceV2Client(client_options=options, transport=transport,)
+ client = LoggingServiceV2Client(
+ client_options=options,
+ transport=transport,
+ )
# It is an error to provide an api_key and a credential.
options = mock.Mock()
@@ -1987,7 +2315,8 @@ def test_credentials_transport_error():
)
with pytest.raises(ValueError):
client = LoggingServiceV2Client(
- client_options={"scopes": ["1", "2"]}, transport=transport,
+ client_options={"scopes": ["1", "2"]},
+ transport=transport,
)
@@ -2030,10 +2359,28 @@ def test_transport_adc(transport_class):
adc.assert_called_once()
+@pytest.mark.parametrize(
+ "transport_name",
+ [
+ "grpc",
+ ],
+)
+def test_transport_kind(transport_name):
+ transport = LoggingServiceV2Client.get_transport_class(transport_name)(
+ credentials=ga_credentials.AnonymousCredentials(),
+ )
+ assert transport.kind == transport_name
+
+
def test_transport_grpc_default():
# A client should use the gRPC transport by default.
- client = LoggingServiceV2Client(credentials=ga_credentials.AnonymousCredentials(),)
- assert isinstance(client.transport, transports.LoggingServiceV2GrpcTransport,)
+ client = LoggingServiceV2Client(
+ credentials=ga_credentials.AnonymousCredentials(),
+ )
+ assert isinstance(
+ client.transport,
+ transports.LoggingServiceV2GrpcTransport,
+ )
def test_logging_service_v2_base_transport_error():
@@ -2072,6 +2419,14 @@ def test_logging_service_v2_base_transport():
with pytest.raises(NotImplementedError):
transport.close()
+ # Catch all for all remaining methods and properties
+ remainder = [
+ "kind",
+ ]
+ for r in remainder:
+ with pytest.raises(NotImplementedError):
+ getattr(transport, r)()
+
def test_logging_service_v2_base_transport_with_credentials_file():
# Instantiate the base transport with a credentials file
@@ -2083,7 +2438,8 @@ def test_logging_service_v2_base_transport_with_credentials_file():
Transport.return_value = None
load_creds.return_value = (ga_credentials.AnonymousCredentials(), None)
transport = transports.LoggingServiceV2Transport(
- credentials_file="credentials.json", quota_project_id="octopus",
+ credentials_file="credentials.json",
+ quota_project_id="octopus",
)
load_creds.assert_called_once_with(
"credentials.json",
@@ -2240,24 +2596,40 @@ def test_logging_service_v2_grpc_transport_client_cert_source_for_mtls(transport
)
-def test_logging_service_v2_host_no_port():
+@pytest.mark.parametrize(
+ "transport_name",
+ [
+ "grpc",
+ "grpc_asyncio",
+ ],
+)
+def test_logging_service_v2_host_no_port(transport_name):
client = LoggingServiceV2Client(
credentials=ga_credentials.AnonymousCredentials(),
client_options=client_options.ClientOptions(
api_endpoint="logging.googleapis.com"
),
+ transport=transport_name,
)
- assert client.transport._host == "logging.googleapis.com:443"
+ assert client.transport._host == ("logging.googleapis.com:443")
-def test_logging_service_v2_host_with_port():
+@pytest.mark.parametrize(
+ "transport_name",
+ [
+ "grpc",
+ "grpc_asyncio",
+ ],
+)
+def test_logging_service_v2_host_with_port(transport_name):
client = LoggingServiceV2Client(
credentials=ga_credentials.AnonymousCredentials(),
client_options=client_options.ClientOptions(
api_endpoint="logging.googleapis.com:8000"
),
+ transport=transport_name,
)
- assert client.transport._host == "logging.googleapis.com:8000"
+ assert client.transport._host == ("logging.googleapis.com:8000")
def test_logging_service_v2_grpc_transport_channel():
@@ -2265,7 +2637,8 @@ def test_logging_service_v2_grpc_transport_channel():
# Check that channel is used if provided.
transport = transports.LoggingServiceV2GrpcTransport(
- host="squid.clam.whelk", channel=channel,
+ host="squid.clam.whelk",
+ channel=channel,
)
assert transport.grpc_channel == channel
assert transport._host == "squid.clam.whelk:443"
@@ -2277,7 +2650,8 @@ def test_logging_service_v2_grpc_asyncio_transport_channel():
# Check that channel is used if provided.
transport = transports.LoggingServiceV2GrpcAsyncIOTransport(
- host="squid.clam.whelk", channel=channel,
+ host="squid.clam.whelk",
+ channel=channel,
)
assert transport.grpc_channel == channel
assert transport._host == "squid.clam.whelk:443"
@@ -2387,7 +2761,10 @@ def test_logging_service_v2_transport_channel_mtls_with_adc(transport_class):
def test_log_path():
project = "squid"
log = "clam"
- expected = "projects/{project}/logs/{log}".format(project=project, log=log,)
+ expected = "projects/{project}/logs/{log}".format(
+ project=project,
+ log=log,
+ )
actual = LoggingServiceV2Client.log_path(project, log)
assert expected == actual
@@ -2426,7 +2803,9 @@ def test_parse_common_billing_account_path():
def test_common_folder_path():
folder = "cuttlefish"
- expected = "folders/{folder}".format(folder=folder,)
+ expected = "folders/{folder}".format(
+ folder=folder,
+ )
actual = LoggingServiceV2Client.common_folder_path(folder)
assert expected == actual
@@ -2444,7 +2823,9 @@ def test_parse_common_folder_path():
def test_common_organization_path():
organization = "winkle"
- expected = "organizations/{organization}".format(organization=organization,)
+ expected = "organizations/{organization}".format(
+ organization=organization,
+ )
actual = LoggingServiceV2Client.common_organization_path(organization)
assert expected == actual
@@ -2462,7 +2843,9 @@ def test_parse_common_organization_path():
def test_common_project_path():
project = "scallop"
- expected = "projects/{project}".format(project=project,)
+ expected = "projects/{project}".format(
+ project=project,
+ )
actual = LoggingServiceV2Client.common_project_path(project)
assert expected == actual
@@ -2482,7 +2865,8 @@ def test_common_location_path():
project = "squid"
location = "clam"
expected = "projects/{project}/locations/{location}".format(
- project=project, location=location,
+ project=project,
+ location=location,
)
actual = LoggingServiceV2Client.common_location_path(project, location)
assert expected == actual
@@ -2507,7 +2891,8 @@ def test_client_with_default_client_info():
transports.LoggingServiceV2Transport, "_prep_wrapped_messages"
) as prep:
client = LoggingServiceV2Client(
- credentials=ga_credentials.AnonymousCredentials(), client_info=client_info,
+ credentials=ga_credentials.AnonymousCredentials(),
+ client_info=client_info,
)
prep.assert_called_once_with(client_info)
@@ -2516,7 +2901,8 @@ def test_client_with_default_client_info():
) as prep:
transport_class = LoggingServiceV2Client.get_transport_class()
transport = transport_class(
- credentials=ga_credentials.AnonymousCredentials(), client_info=client_info,
+ credentials=ga_credentials.AnonymousCredentials(),
+ client_info=client_info,
)
prep.assert_called_once_with(client_info)
@@ -2524,7 +2910,8 @@ def test_client_with_default_client_info():
@pytest.mark.asyncio
async def test_transport_close_async():
client = LoggingServiceV2AsyncClient(
- credentials=ga_credentials.AnonymousCredentials(), transport="grpc_asyncio",
+ credentials=ga_credentials.AnonymousCredentials(),
+ transport="grpc_asyncio",
)
with mock.patch.object(
type(getattr(client.transport, "grpc_channel")), "close"
diff --git a/tests/unit/gapic/logging_v2/test_metrics_service_v2.py b/tests/unit/gapic/logging_v2/test_metrics_service_v2.py
index 97a2c4a99..456d43946 100644
--- a/tests/unit/gapic/logging_v2/test_metrics_service_v2.py
+++ b/tests/unit/gapic/logging_v2/test_metrics_service_v2.py
@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
-# Copyright 2020 Google LLC
+# Copyright 2022 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -94,20 +94,26 @@ def test__get_default_mtls_endpoint():
@pytest.mark.parametrize(
- "client_class", [MetricsServiceV2Client, MetricsServiceV2AsyncClient,]
+ "client_class,transport_name",
+ [
+ (MetricsServiceV2Client, "grpc"),
+ (MetricsServiceV2AsyncClient, "grpc_asyncio"),
+ ],
)
-def test_metrics_service_v2_client_from_service_account_info(client_class):
+def test_metrics_service_v2_client_from_service_account_info(
+ client_class, transport_name
+):
creds = ga_credentials.AnonymousCredentials()
with mock.patch.object(
service_account.Credentials, "from_service_account_info"
) as factory:
factory.return_value = creds
info = {"valid": True}
- client = client_class.from_service_account_info(info)
+ client = client_class.from_service_account_info(info, transport=transport_name)
assert client.transport._credentials == creds
assert isinstance(client, client_class)
- assert client.transport._host == "logging.googleapis.com:443"
+ assert client.transport._host == ("logging.googleapis.com:443")
@pytest.mark.parametrize(
@@ -136,23 +142,33 @@ def test_metrics_service_v2_client_service_account_always_use_jwt(
@pytest.mark.parametrize(
- "client_class", [MetricsServiceV2Client, MetricsServiceV2AsyncClient,]
+ "client_class,transport_name",
+ [
+ (MetricsServiceV2Client, "grpc"),
+ (MetricsServiceV2AsyncClient, "grpc_asyncio"),
+ ],
)
-def test_metrics_service_v2_client_from_service_account_file(client_class):
+def test_metrics_service_v2_client_from_service_account_file(
+ client_class, transport_name
+):
creds = ga_credentials.AnonymousCredentials()
with mock.patch.object(
service_account.Credentials, "from_service_account_file"
) as factory:
factory.return_value = creds
- client = client_class.from_service_account_file("dummy/file/path.json")
+ client = client_class.from_service_account_file(
+ "dummy/file/path.json", transport=transport_name
+ )
assert client.transport._credentials == creds
assert isinstance(client, client_class)
- client = client_class.from_service_account_json("dummy/file/path.json")
+ client = client_class.from_service_account_json(
+ "dummy/file/path.json", transport=transport_name
+ )
assert client.transport._credentials == creds
assert isinstance(client, client_class)
- assert client.transport._host == "logging.googleapis.com:443"
+ assert client.transport._host == ("logging.googleapis.com:443")
def test_metrics_service_v2_client_get_transport_class():
@@ -510,7 +526,9 @@ def test_metrics_service_v2_client_client_options_scopes(
client_class, transport_class, transport_name
):
# Check the case scopes are provided.
- options = client_options.ClientOptions(scopes=["1", "2"],)
+ options = client_options.ClientOptions(
+ scopes=["1", "2"],
+ )
with mock.patch.object(transport_class, "__init__") as patched:
patched.return_value = None
client = client_class(client_options=options, transport=transport_name)
@@ -527,21 +545,28 @@ def test_metrics_service_v2_client_client_options_scopes(
@pytest.mark.parametrize(
- "client_class,transport_class,transport_name",
+ "client_class,transport_class,transport_name,grpc_helpers",
[
- (MetricsServiceV2Client, transports.MetricsServiceV2GrpcTransport, "grpc"),
+ (
+ MetricsServiceV2Client,
+ transports.MetricsServiceV2GrpcTransport,
+ "grpc",
+ grpc_helpers,
+ ),
(
MetricsServiceV2AsyncClient,
transports.MetricsServiceV2GrpcAsyncIOTransport,
"grpc_asyncio",
+ grpc_helpers_async,
),
],
)
def test_metrics_service_v2_client_client_options_credentials_file(
- client_class, transport_class, transport_name
+ client_class, transport_class, transport_name, grpc_helpers
):
# Check the case credentials file is provided.
options = client_options.ClientOptions(credentials_file="credentials.json")
+
with mock.patch.object(transport_class, "__init__") as patched:
patched.return_value = None
client = client_class(client_options=options, transport=transport_name)
@@ -577,10 +602,89 @@ def test_metrics_service_v2_client_client_options_from_dict():
)
-@pytest.mark.parametrize("request_type", [logging_metrics.ListLogMetricsRequest, dict,])
+@pytest.mark.parametrize(
+ "client_class,transport_class,transport_name,grpc_helpers",
+ [
+ (
+ MetricsServiceV2Client,
+ transports.MetricsServiceV2GrpcTransport,
+ "grpc",
+ grpc_helpers,
+ ),
+ (
+ MetricsServiceV2AsyncClient,
+ transports.MetricsServiceV2GrpcAsyncIOTransport,
+ "grpc_asyncio",
+ grpc_helpers_async,
+ ),
+ ],
+)
+def test_metrics_service_v2_client_create_channel_credentials_file(
+ client_class, transport_class, transport_name, grpc_helpers
+):
+ # Check the case credentials file is provided.
+ options = client_options.ClientOptions(credentials_file="credentials.json")
+
+ with mock.patch.object(transport_class, "__init__") as patched:
+ patched.return_value = None
+ client = client_class(client_options=options, transport=transport_name)
+ patched.assert_called_once_with(
+ credentials=None,
+ credentials_file="credentials.json",
+ host=client.DEFAULT_ENDPOINT,
+ scopes=None,
+ client_cert_source_for_mtls=None,
+ quota_project_id=None,
+ client_info=transports.base.DEFAULT_CLIENT_INFO,
+ always_use_jwt_access=True,
+ )
+
+ # test that the credentials from file are saved and used as the credentials.
+ with mock.patch.object(
+ google.auth, "load_credentials_from_file", autospec=True
+ ) as load_creds, mock.patch.object(
+ google.auth, "default", autospec=True
+ ) as adc, mock.patch.object(
+ grpc_helpers, "create_channel"
+ ) as create_channel:
+ creds = ga_credentials.AnonymousCredentials()
+ file_creds = ga_credentials.AnonymousCredentials()
+ load_creds.return_value = (file_creds, None)
+ adc.return_value = (creds, None)
+ client = client_class(client_options=options, transport=transport_name)
+ create_channel.assert_called_with(
+ "logging.googleapis.com:443",
+ credentials=file_creds,
+ credentials_file=None,
+ quota_project_id=None,
+ default_scopes=(
+ "https://www.googleapis.com/auth/cloud-platform",
+ "https://www.googleapis.com/auth/cloud-platform.read-only",
+ "https://www.googleapis.com/auth/logging.admin",
+ "https://www.googleapis.com/auth/logging.read",
+ "https://www.googleapis.com/auth/logging.write",
+ ),
+ scopes=None,
+ default_host="logging.googleapis.com",
+ ssl_credentials=None,
+ options=[
+ ("grpc.max_send_message_length", -1),
+ ("grpc.max_receive_message_length", -1),
+ ],
+ )
+
+
+@pytest.mark.parametrize(
+ "request_type",
+ [
+ logging_metrics.ListLogMetricsRequest,
+ dict,
+ ],
+)
def test_list_log_metrics(request_type, transport: str = "grpc"):
client = MetricsServiceV2Client(
- credentials=ga_credentials.AnonymousCredentials(), transport=transport,
+ credentials=ga_credentials.AnonymousCredentials(),
+ transport=transport,
)
# Everything is optional in proto3 as far as the runtime is concerned,
@@ -609,7 +713,8 @@ def test_list_log_metrics_empty_call():
# This test is a coverage failsafe to make sure that totally empty calls,
# i.e. request == None and no flattened fields passed, work.
client = MetricsServiceV2Client(
- credentials=ga_credentials.AnonymousCredentials(), transport="grpc",
+ credentials=ga_credentials.AnonymousCredentials(),
+ transport="grpc",
)
# Mock the actual call within the gRPC stub, and fake the request.
@@ -625,7 +730,8 @@ async def test_list_log_metrics_async(
transport: str = "grpc_asyncio", request_type=logging_metrics.ListLogMetricsRequest
):
client = MetricsServiceV2AsyncClient(
- credentials=ga_credentials.AnonymousCredentials(), transport=transport,
+ credentials=ga_credentials.AnonymousCredentials(),
+ transport=transport,
)
# Everything is optional in proto3 as far as the runtime is concerned,
@@ -658,13 +764,15 @@ async def test_list_log_metrics_async_from_dict():
def test_list_log_metrics_field_headers():
- client = MetricsServiceV2Client(credentials=ga_credentials.AnonymousCredentials(),)
+ client = MetricsServiceV2Client(
+ credentials=ga_credentials.AnonymousCredentials(),
+ )
# Any value that is part of the HTTP/1.1 URI should be sent as
# a field header. Set these to a non-empty value.
request = logging_metrics.ListLogMetricsRequest()
- request.parent = "parent/value"
+ request.parent = "parent_value"
# Mock the actual call within the gRPC stub, and fake the request.
with mock.patch.object(type(client.transport.list_log_metrics), "__call__") as call:
@@ -678,7 +786,10 @@ def test_list_log_metrics_field_headers():
# Establish that the field header was sent.
_, _, kw = call.mock_calls[0]
- assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"]
+ assert (
+ "x-goog-request-params",
+ "parent=parent_value",
+ ) in kw["metadata"]
@pytest.mark.asyncio
@@ -691,7 +802,7 @@ async def test_list_log_metrics_field_headers_async():
# a field header. Set these to a non-empty value.
request = logging_metrics.ListLogMetricsRequest()
- request.parent = "parent/value"
+ request.parent = "parent_value"
# Mock the actual call within the gRPC stub, and fake the request.
with mock.patch.object(type(client.transport.list_log_metrics), "__call__") as call:
@@ -707,11 +818,16 @@ async def test_list_log_metrics_field_headers_async():
# Establish that the field header was sent.
_, _, kw = call.mock_calls[0]
- assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"]
+ assert (
+ "x-goog-request-params",
+ "parent=parent_value",
+ ) in kw["metadata"]
def test_list_log_metrics_flattened():
- client = MetricsServiceV2Client(credentials=ga_credentials.AnonymousCredentials(),)
+ client = MetricsServiceV2Client(
+ credentials=ga_credentials.AnonymousCredentials(),
+ )
# Mock the actual call within the gRPC stub, and fake the request.
with mock.patch.object(type(client.transport.list_log_metrics), "__call__") as call:
@@ -719,7 +835,9 @@ def test_list_log_metrics_flattened():
call.return_value = logging_metrics.ListLogMetricsResponse()
# Call the method with a truthy value for each flattened field,
# using the keyword arguments to the method.
- client.list_log_metrics(parent="parent_value",)
+ client.list_log_metrics(
+ parent="parent_value",
+ )
# Establish that the underlying call was made with the expected
# request object values.
@@ -731,13 +849,16 @@ def test_list_log_metrics_flattened():
def test_list_log_metrics_flattened_error():
- client = MetricsServiceV2Client(credentials=ga_credentials.AnonymousCredentials(),)
+ client = MetricsServiceV2Client(
+ credentials=ga_credentials.AnonymousCredentials(),
+ )
# Attempting to call a method with both a request object and flattened
# fields is an error.
with pytest.raises(ValueError):
client.list_log_metrics(
- logging_metrics.ListLogMetricsRequest(), parent="parent_value",
+ logging_metrics.ListLogMetricsRequest(),
+ parent="parent_value",
)
@@ -757,7 +878,9 @@ async def test_list_log_metrics_flattened_async():
)
# Call the method with a truthy value for each flattened field,
# using the keyword arguments to the method.
- response = await client.list_log_metrics(parent="parent_value",)
+ response = await client.list_log_metrics(
+ parent="parent_value",
+ )
# Establish that the underlying call was made with the expected
# request object values.
@@ -778,13 +901,15 @@ async def test_list_log_metrics_flattened_error_async():
# fields is an error.
with pytest.raises(ValueError):
await client.list_log_metrics(
- logging_metrics.ListLogMetricsRequest(), parent="parent_value",
+ logging_metrics.ListLogMetricsRequest(),
+ parent="parent_value",
)
def test_list_log_metrics_pager(transport_name: str = "grpc"):
client = MetricsServiceV2Client(
- credentials=ga_credentials.AnonymousCredentials, transport=transport_name,
+ credentials=ga_credentials.AnonymousCredentials,
+ transport=transport_name,
)
# Mock the actual call within the gRPC stub, and fake the request.
@@ -799,12 +924,21 @@ def test_list_log_metrics_pager(transport_name: str = "grpc"):
],
next_page_token="abc",
),
- logging_metrics.ListLogMetricsResponse(metrics=[], next_page_token="def",),
logging_metrics.ListLogMetricsResponse(
- metrics=[logging_metrics.LogMetric(),], next_page_token="ghi",
+ metrics=[],
+ next_page_token="def",
),
logging_metrics.ListLogMetricsResponse(
- metrics=[logging_metrics.LogMetric(), logging_metrics.LogMetric(),],
+ metrics=[
+ logging_metrics.LogMetric(),
+ ],
+ next_page_token="ghi",
+ ),
+ logging_metrics.ListLogMetricsResponse(
+ metrics=[
+ logging_metrics.LogMetric(),
+ logging_metrics.LogMetric(),
+ ],
),
RuntimeError,
)
@@ -817,14 +951,15 @@ def test_list_log_metrics_pager(transport_name: str = "grpc"):
assert pager._metadata == metadata
- results = [i for i in pager]
+ results = list(pager)
assert len(results) == 6
assert all(isinstance(i, logging_metrics.LogMetric) for i in results)
def test_list_log_metrics_pages(transport_name: str = "grpc"):
client = MetricsServiceV2Client(
- credentials=ga_credentials.AnonymousCredentials, transport=transport_name,
+ credentials=ga_credentials.AnonymousCredentials,
+ transport=transport_name,
)
# Mock the actual call within the gRPC stub, and fake the request.
@@ -839,12 +974,21 @@ def test_list_log_metrics_pages(transport_name: str = "grpc"):
],
next_page_token="abc",
),
- logging_metrics.ListLogMetricsResponse(metrics=[], next_page_token="def",),
logging_metrics.ListLogMetricsResponse(
- metrics=[logging_metrics.LogMetric(),], next_page_token="ghi",
+ metrics=[],
+ next_page_token="def",
),
logging_metrics.ListLogMetricsResponse(
- metrics=[logging_metrics.LogMetric(), logging_metrics.LogMetric(),],
+ metrics=[
+ logging_metrics.LogMetric(),
+ ],
+ next_page_token="ghi",
+ ),
+ logging_metrics.ListLogMetricsResponse(
+ metrics=[
+ logging_metrics.LogMetric(),
+ logging_metrics.LogMetric(),
+ ],
),
RuntimeError,
)
@@ -873,19 +1017,30 @@ async def test_list_log_metrics_async_pager():
],
next_page_token="abc",
),
- logging_metrics.ListLogMetricsResponse(metrics=[], next_page_token="def",),
logging_metrics.ListLogMetricsResponse(
- metrics=[logging_metrics.LogMetric(),], next_page_token="ghi",
+ metrics=[],
+ next_page_token="def",
+ ),
+ logging_metrics.ListLogMetricsResponse(
+ metrics=[
+ logging_metrics.LogMetric(),
+ ],
+ next_page_token="ghi",
),
logging_metrics.ListLogMetricsResponse(
- metrics=[logging_metrics.LogMetric(), logging_metrics.LogMetric(),],
+ metrics=[
+ logging_metrics.LogMetric(),
+ logging_metrics.LogMetric(),
+ ],
),
RuntimeError,
)
- async_pager = await client.list_log_metrics(request={},)
+ async_pager = await client.list_log_metrics(
+ request={},
+ )
assert async_pager.next_page_token == "abc"
responses = []
- async for response in async_pager:
+ async for response in async_pager: # pragma: no branch
responses.append(response)
assert len(responses) == 6
@@ -912,26 +1067,44 @@ async def test_list_log_metrics_async_pages():
],
next_page_token="abc",
),
- logging_metrics.ListLogMetricsResponse(metrics=[], next_page_token="def",),
logging_metrics.ListLogMetricsResponse(
- metrics=[logging_metrics.LogMetric(),], next_page_token="ghi",
+ metrics=[],
+ next_page_token="def",
),
logging_metrics.ListLogMetricsResponse(
- metrics=[logging_metrics.LogMetric(), logging_metrics.LogMetric(),],
+ metrics=[
+ logging_metrics.LogMetric(),
+ ],
+ next_page_token="ghi",
+ ),
+ logging_metrics.ListLogMetricsResponse(
+ metrics=[
+ logging_metrics.LogMetric(),
+ logging_metrics.LogMetric(),
+ ],
),
RuntimeError,
)
pages = []
- async for page_ in (await client.list_log_metrics(request={})).pages:
+ async for page_ in (
+ await client.list_log_metrics(request={})
+ ).pages: # pragma: no branch
pages.append(page_)
for page_, token in zip(pages, ["abc", "def", "ghi", ""]):
assert page_.raw_page.next_page_token == token
-@pytest.mark.parametrize("request_type", [logging_metrics.GetLogMetricRequest, dict,])
+@pytest.mark.parametrize(
+ "request_type",
+ [
+ logging_metrics.GetLogMetricRequest,
+ dict,
+ ],
+)
def test_get_log_metric(request_type, transport: str = "grpc"):
client = MetricsServiceV2Client(
- credentials=ga_credentials.AnonymousCredentials(), transport=transport,
+ credentials=ga_credentials.AnonymousCredentials(),
+ transport=transport,
)
# Everything is optional in proto3 as far as the runtime is concerned,
@@ -945,6 +1118,7 @@ def test_get_log_metric(request_type, transport: str = "grpc"):
name="name_value",
description="description_value",
filter="filter_value",
+ disabled=True,
value_extractor="value_extractor_value",
version=logging_metrics.LogMetric.ApiVersion.V1,
)
@@ -960,6 +1134,7 @@ def test_get_log_metric(request_type, transport: str = "grpc"):
assert response.name == "name_value"
assert response.description == "description_value"
assert response.filter == "filter_value"
+ assert response.disabled is True
assert response.value_extractor == "value_extractor_value"
assert response.version == logging_metrics.LogMetric.ApiVersion.V1
@@ -968,7 +1143,8 @@ def test_get_log_metric_empty_call():
# This test is a coverage failsafe to make sure that totally empty calls,
# i.e. request == None and no flattened fields passed, work.
client = MetricsServiceV2Client(
- credentials=ga_credentials.AnonymousCredentials(), transport="grpc",
+ credentials=ga_credentials.AnonymousCredentials(),
+ transport="grpc",
)
# Mock the actual call within the gRPC stub, and fake the request.
@@ -984,7 +1160,8 @@ async def test_get_log_metric_async(
transport: str = "grpc_asyncio", request_type=logging_metrics.GetLogMetricRequest
):
client = MetricsServiceV2AsyncClient(
- credentials=ga_credentials.AnonymousCredentials(), transport=transport,
+ credentials=ga_credentials.AnonymousCredentials(),
+ transport=transport,
)
# Everything is optional in proto3 as far as the runtime is concerned,
@@ -999,6 +1176,7 @@ async def test_get_log_metric_async(
name="name_value",
description="description_value",
filter="filter_value",
+ disabled=True,
value_extractor="value_extractor_value",
version=logging_metrics.LogMetric.ApiVersion.V1,
)
@@ -1015,6 +1193,7 @@ async def test_get_log_metric_async(
assert response.name == "name_value"
assert response.description == "description_value"
assert response.filter == "filter_value"
+ assert response.disabled is True
assert response.value_extractor == "value_extractor_value"
assert response.version == logging_metrics.LogMetric.ApiVersion.V1
@@ -1025,13 +1204,15 @@ async def test_get_log_metric_async_from_dict():
def test_get_log_metric_field_headers():
- client = MetricsServiceV2Client(credentials=ga_credentials.AnonymousCredentials(),)
+ client = MetricsServiceV2Client(
+ credentials=ga_credentials.AnonymousCredentials(),
+ )
# Any value that is part of the HTTP/1.1 URI should be sent as
# a field header. Set these to a non-empty value.
request = logging_metrics.GetLogMetricRequest()
- request.metric_name = "metric_name/value"
+ request.metric_name = "metric_name_value"
# Mock the actual call within the gRPC stub, and fake the request.
with mock.patch.object(type(client.transport.get_log_metric), "__call__") as call:
@@ -1045,7 +1226,10 @@ def test_get_log_metric_field_headers():
# Establish that the field header was sent.
_, _, kw = call.mock_calls[0]
- assert ("x-goog-request-params", "metric_name=metric_name/value",) in kw["metadata"]
+ assert (
+ "x-goog-request-params",
+ "metric_name=metric_name_value",
+ ) in kw["metadata"]
@pytest.mark.asyncio
@@ -1058,7 +1242,7 @@ async def test_get_log_metric_field_headers_async():
# a field header. Set these to a non-empty value.
request = logging_metrics.GetLogMetricRequest()
- request.metric_name = "metric_name/value"
+ request.metric_name = "metric_name_value"
# Mock the actual call within the gRPC stub, and fake the request.
with mock.patch.object(type(client.transport.get_log_metric), "__call__") as call:
@@ -1074,11 +1258,16 @@ async def test_get_log_metric_field_headers_async():
# Establish that the field header was sent.
_, _, kw = call.mock_calls[0]
- assert ("x-goog-request-params", "metric_name=metric_name/value",) in kw["metadata"]
+ assert (
+ "x-goog-request-params",
+ "metric_name=metric_name_value",
+ ) in kw["metadata"]
def test_get_log_metric_flattened():
- client = MetricsServiceV2Client(credentials=ga_credentials.AnonymousCredentials(),)
+ client = MetricsServiceV2Client(
+ credentials=ga_credentials.AnonymousCredentials(),
+ )
# Mock the actual call within the gRPC stub, and fake the request.
with mock.patch.object(type(client.transport.get_log_metric), "__call__") as call:
@@ -1086,7 +1275,9 @@ def test_get_log_metric_flattened():
call.return_value = logging_metrics.LogMetric()
# Call the method with a truthy value for each flattened field,
# using the keyword arguments to the method.
- client.get_log_metric(metric_name="metric_name_value",)
+ client.get_log_metric(
+ metric_name="metric_name_value",
+ )
# Establish that the underlying call was made with the expected
# request object values.
@@ -1098,13 +1289,16 @@ def test_get_log_metric_flattened():
def test_get_log_metric_flattened_error():
- client = MetricsServiceV2Client(credentials=ga_credentials.AnonymousCredentials(),)
+ client = MetricsServiceV2Client(
+ credentials=ga_credentials.AnonymousCredentials(),
+ )
# Attempting to call a method with both a request object and flattened
# fields is an error.
with pytest.raises(ValueError):
client.get_log_metric(
- logging_metrics.GetLogMetricRequest(), metric_name="metric_name_value",
+ logging_metrics.GetLogMetricRequest(),
+ metric_name="metric_name_value",
)
@@ -1124,7 +1318,9 @@ async def test_get_log_metric_flattened_async():
)
# Call the method with a truthy value for each flattened field,
# using the keyword arguments to the method.
- response = await client.get_log_metric(metric_name="metric_name_value",)
+ response = await client.get_log_metric(
+ metric_name="metric_name_value",
+ )
# Establish that the underlying call was made with the expected
# request object values.
@@ -1145,16 +1341,22 @@ async def test_get_log_metric_flattened_error_async():
# fields is an error.
with pytest.raises(ValueError):
await client.get_log_metric(
- logging_metrics.GetLogMetricRequest(), metric_name="metric_name_value",
+ logging_metrics.GetLogMetricRequest(),
+ metric_name="metric_name_value",
)
@pytest.mark.parametrize(
- "request_type", [logging_metrics.CreateLogMetricRequest, dict,]
+ "request_type",
+ [
+ logging_metrics.CreateLogMetricRequest,
+ dict,
+ ],
)
def test_create_log_metric(request_type, transport: str = "grpc"):
client = MetricsServiceV2Client(
- credentials=ga_credentials.AnonymousCredentials(), transport=transport,
+ credentials=ga_credentials.AnonymousCredentials(),
+ transport=transport,
)
# Everything is optional in proto3 as far as the runtime is concerned,
@@ -1170,6 +1372,7 @@ def test_create_log_metric(request_type, transport: str = "grpc"):
name="name_value",
description="description_value",
filter="filter_value",
+ disabled=True,
value_extractor="value_extractor_value",
version=logging_metrics.LogMetric.ApiVersion.V1,
)
@@ -1185,6 +1388,7 @@ def test_create_log_metric(request_type, transport: str = "grpc"):
assert response.name == "name_value"
assert response.description == "description_value"
assert response.filter == "filter_value"
+ assert response.disabled is True
assert response.value_extractor == "value_extractor_value"
assert response.version == logging_metrics.LogMetric.ApiVersion.V1
@@ -1193,7 +1397,8 @@ def test_create_log_metric_empty_call():
# This test is a coverage failsafe to make sure that totally empty calls,
# i.e. request == None and no flattened fields passed, work.
client = MetricsServiceV2Client(
- credentials=ga_credentials.AnonymousCredentials(), transport="grpc",
+ credentials=ga_credentials.AnonymousCredentials(),
+ transport="grpc",
)
# Mock the actual call within the gRPC stub, and fake the request.
@@ -1211,7 +1416,8 @@ async def test_create_log_metric_async(
transport: str = "grpc_asyncio", request_type=logging_metrics.CreateLogMetricRequest
):
client = MetricsServiceV2AsyncClient(
- credentials=ga_credentials.AnonymousCredentials(), transport=transport,
+ credentials=ga_credentials.AnonymousCredentials(),
+ transport=transport,
)
# Everything is optional in proto3 as far as the runtime is concerned,
@@ -1228,6 +1434,7 @@ async def test_create_log_metric_async(
name="name_value",
description="description_value",
filter="filter_value",
+ disabled=True,
value_extractor="value_extractor_value",
version=logging_metrics.LogMetric.ApiVersion.V1,
)
@@ -1244,6 +1451,7 @@ async def test_create_log_metric_async(
assert response.name == "name_value"
assert response.description == "description_value"
assert response.filter == "filter_value"
+ assert response.disabled is True
assert response.value_extractor == "value_extractor_value"
assert response.version == logging_metrics.LogMetric.ApiVersion.V1
@@ -1254,13 +1462,15 @@ async def test_create_log_metric_async_from_dict():
def test_create_log_metric_field_headers():
- client = MetricsServiceV2Client(credentials=ga_credentials.AnonymousCredentials(),)
+ client = MetricsServiceV2Client(
+ credentials=ga_credentials.AnonymousCredentials(),
+ )
# Any value that is part of the HTTP/1.1 URI should be sent as
# a field header. Set these to a non-empty value.
request = logging_metrics.CreateLogMetricRequest()
- request.parent = "parent/value"
+ request.parent = "parent_value"
# Mock the actual call within the gRPC stub, and fake the request.
with mock.patch.object(
@@ -1276,7 +1486,10 @@ def test_create_log_metric_field_headers():
# Establish that the field header was sent.
_, _, kw = call.mock_calls[0]
- assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"]
+ assert (
+ "x-goog-request-params",
+ "parent=parent_value",
+ ) in kw["metadata"]
@pytest.mark.asyncio
@@ -1289,7 +1502,7 @@ async def test_create_log_metric_field_headers_async():
# a field header. Set these to a non-empty value.
request = logging_metrics.CreateLogMetricRequest()
- request.parent = "parent/value"
+ request.parent = "parent_value"
# Mock the actual call within the gRPC stub, and fake the request.
with mock.patch.object(
@@ -1307,11 +1520,16 @@ async def test_create_log_metric_field_headers_async():
# Establish that the field header was sent.
_, _, kw = call.mock_calls[0]
- assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"]
+ assert (
+ "x-goog-request-params",
+ "parent=parent_value",
+ ) in kw["metadata"]
def test_create_log_metric_flattened():
- client = MetricsServiceV2Client(credentials=ga_credentials.AnonymousCredentials(),)
+ client = MetricsServiceV2Client(
+ credentials=ga_credentials.AnonymousCredentials(),
+ )
# Mock the actual call within the gRPC stub, and fake the request.
with mock.patch.object(
@@ -1322,7 +1540,8 @@ def test_create_log_metric_flattened():
# Call the method with a truthy value for each flattened field,
# using the keyword arguments to the method.
client.create_log_metric(
- parent="parent_value", metric=logging_metrics.LogMetric(name="name_value"),
+ parent="parent_value",
+ metric=logging_metrics.LogMetric(name="name_value"),
)
# Establish that the underlying call was made with the expected
@@ -1338,7 +1557,9 @@ def test_create_log_metric_flattened():
def test_create_log_metric_flattened_error():
- client = MetricsServiceV2Client(credentials=ga_credentials.AnonymousCredentials(),)
+ client = MetricsServiceV2Client(
+ credentials=ga_credentials.AnonymousCredentials(),
+ )
# Attempting to call a method with both a request object and flattened
# fields is an error.
@@ -1369,7 +1590,8 @@ async def test_create_log_metric_flattened_async():
# Call the method with a truthy value for each flattened field,
# using the keyword arguments to the method.
response = await client.create_log_metric(
- parent="parent_value", metric=logging_metrics.LogMetric(name="name_value"),
+ parent="parent_value",
+ metric=logging_metrics.LogMetric(name="name_value"),
)
# Establish that the underlying call was made with the expected
@@ -1401,11 +1623,16 @@ async def test_create_log_metric_flattened_error_async():
@pytest.mark.parametrize(
- "request_type", [logging_metrics.UpdateLogMetricRequest, dict,]
+ "request_type",
+ [
+ logging_metrics.UpdateLogMetricRequest,
+ dict,
+ ],
)
def test_update_log_metric(request_type, transport: str = "grpc"):
client = MetricsServiceV2Client(
- credentials=ga_credentials.AnonymousCredentials(), transport=transport,
+ credentials=ga_credentials.AnonymousCredentials(),
+ transport=transport,
)
# Everything is optional in proto3 as far as the runtime is concerned,
@@ -1421,6 +1648,7 @@ def test_update_log_metric(request_type, transport: str = "grpc"):
name="name_value",
description="description_value",
filter="filter_value",
+ disabled=True,
value_extractor="value_extractor_value",
version=logging_metrics.LogMetric.ApiVersion.V1,
)
@@ -1436,6 +1664,7 @@ def test_update_log_metric(request_type, transport: str = "grpc"):
assert response.name == "name_value"
assert response.description == "description_value"
assert response.filter == "filter_value"
+ assert response.disabled is True
assert response.value_extractor == "value_extractor_value"
assert response.version == logging_metrics.LogMetric.ApiVersion.V1
@@ -1444,7 +1673,8 @@ def test_update_log_metric_empty_call():
# This test is a coverage failsafe to make sure that totally empty calls,
# i.e. request == None and no flattened fields passed, work.
client = MetricsServiceV2Client(
- credentials=ga_credentials.AnonymousCredentials(), transport="grpc",
+ credentials=ga_credentials.AnonymousCredentials(),
+ transport="grpc",
)
# Mock the actual call within the gRPC stub, and fake the request.
@@ -1462,7 +1692,8 @@ async def test_update_log_metric_async(
transport: str = "grpc_asyncio", request_type=logging_metrics.UpdateLogMetricRequest
):
client = MetricsServiceV2AsyncClient(
- credentials=ga_credentials.AnonymousCredentials(), transport=transport,
+ credentials=ga_credentials.AnonymousCredentials(),
+ transport=transport,
)
# Everything is optional in proto3 as far as the runtime is concerned,
@@ -1479,6 +1710,7 @@ async def test_update_log_metric_async(
name="name_value",
description="description_value",
filter="filter_value",
+ disabled=True,
value_extractor="value_extractor_value",
version=logging_metrics.LogMetric.ApiVersion.V1,
)
@@ -1495,6 +1727,7 @@ async def test_update_log_metric_async(
assert response.name == "name_value"
assert response.description == "description_value"
assert response.filter == "filter_value"
+ assert response.disabled is True
assert response.value_extractor == "value_extractor_value"
assert response.version == logging_metrics.LogMetric.ApiVersion.V1
@@ -1505,13 +1738,15 @@ async def test_update_log_metric_async_from_dict():
def test_update_log_metric_field_headers():
- client = MetricsServiceV2Client(credentials=ga_credentials.AnonymousCredentials(),)
+ client = MetricsServiceV2Client(
+ credentials=ga_credentials.AnonymousCredentials(),
+ )
# Any value that is part of the HTTP/1.1 URI should be sent as
# a field header. Set these to a non-empty value.
request = logging_metrics.UpdateLogMetricRequest()
- request.metric_name = "metric_name/value"
+ request.metric_name = "metric_name_value"
# Mock the actual call within the gRPC stub, and fake the request.
with mock.patch.object(
@@ -1527,7 +1762,10 @@ def test_update_log_metric_field_headers():
# Establish that the field header was sent.
_, _, kw = call.mock_calls[0]
- assert ("x-goog-request-params", "metric_name=metric_name/value",) in kw["metadata"]
+ assert (
+ "x-goog-request-params",
+ "metric_name=metric_name_value",
+ ) in kw["metadata"]
@pytest.mark.asyncio
@@ -1540,7 +1778,7 @@ async def test_update_log_metric_field_headers_async():
# a field header. Set these to a non-empty value.
request = logging_metrics.UpdateLogMetricRequest()
- request.metric_name = "metric_name/value"
+ request.metric_name = "metric_name_value"
# Mock the actual call within the gRPC stub, and fake the request.
with mock.patch.object(
@@ -1558,11 +1796,16 @@ async def test_update_log_metric_field_headers_async():
# Establish that the field header was sent.
_, _, kw = call.mock_calls[0]
- assert ("x-goog-request-params", "metric_name=metric_name/value",) in kw["metadata"]
+ assert (
+ "x-goog-request-params",
+ "metric_name=metric_name_value",
+ ) in kw["metadata"]
def test_update_log_metric_flattened():
- client = MetricsServiceV2Client(credentials=ga_credentials.AnonymousCredentials(),)
+ client = MetricsServiceV2Client(
+ credentials=ga_credentials.AnonymousCredentials(),
+ )
# Mock the actual call within the gRPC stub, and fake the request.
with mock.patch.object(
@@ -1590,7 +1833,9 @@ def test_update_log_metric_flattened():
def test_update_log_metric_flattened_error():
- client = MetricsServiceV2Client(credentials=ga_credentials.AnonymousCredentials(),)
+ client = MetricsServiceV2Client(
+ credentials=ga_credentials.AnonymousCredentials(),
+ )
# Attempting to call a method with both a request object and flattened
# fields is an error.
@@ -1654,11 +1899,16 @@ async def test_update_log_metric_flattened_error_async():
@pytest.mark.parametrize(
- "request_type", [logging_metrics.DeleteLogMetricRequest, dict,]
+ "request_type",
+ [
+ logging_metrics.DeleteLogMetricRequest,
+ dict,
+ ],
)
def test_delete_log_metric(request_type, transport: str = "grpc"):
client = MetricsServiceV2Client(
- credentials=ga_credentials.AnonymousCredentials(), transport=transport,
+ credentials=ga_credentials.AnonymousCredentials(),
+ transport=transport,
)
# Everything is optional in proto3 as far as the runtime is concerned,
@@ -1686,7 +1936,8 @@ def test_delete_log_metric_empty_call():
# This test is a coverage failsafe to make sure that totally empty calls,
# i.e. request == None and no flattened fields passed, work.
client = MetricsServiceV2Client(
- credentials=ga_credentials.AnonymousCredentials(), transport="grpc",
+ credentials=ga_credentials.AnonymousCredentials(),
+ transport="grpc",
)
# Mock the actual call within the gRPC stub, and fake the request.
@@ -1704,7 +1955,8 @@ async def test_delete_log_metric_async(
transport: str = "grpc_asyncio", request_type=logging_metrics.DeleteLogMetricRequest
):
client = MetricsServiceV2AsyncClient(
- credentials=ga_credentials.AnonymousCredentials(), transport=transport,
+ credentials=ga_credentials.AnonymousCredentials(),
+ transport=transport,
)
# Everything is optional in proto3 as far as the runtime is concerned,
@@ -1734,13 +1986,15 @@ async def test_delete_log_metric_async_from_dict():
def test_delete_log_metric_field_headers():
- client = MetricsServiceV2Client(credentials=ga_credentials.AnonymousCredentials(),)
+ client = MetricsServiceV2Client(
+ credentials=ga_credentials.AnonymousCredentials(),
+ )
# Any value that is part of the HTTP/1.1 URI should be sent as
# a field header. Set these to a non-empty value.
request = logging_metrics.DeleteLogMetricRequest()
- request.metric_name = "metric_name/value"
+ request.metric_name = "metric_name_value"
# Mock the actual call within the gRPC stub, and fake the request.
with mock.patch.object(
@@ -1756,7 +2010,10 @@ def test_delete_log_metric_field_headers():
# Establish that the field header was sent.
_, _, kw = call.mock_calls[0]
- assert ("x-goog-request-params", "metric_name=metric_name/value",) in kw["metadata"]
+ assert (
+ "x-goog-request-params",
+ "metric_name=metric_name_value",
+ ) in kw["metadata"]
@pytest.mark.asyncio
@@ -1769,7 +2026,7 @@ async def test_delete_log_metric_field_headers_async():
# a field header. Set these to a non-empty value.
request = logging_metrics.DeleteLogMetricRequest()
- request.metric_name = "metric_name/value"
+ request.metric_name = "metric_name_value"
# Mock the actual call within the gRPC stub, and fake the request.
with mock.patch.object(
@@ -1785,11 +2042,16 @@ async def test_delete_log_metric_field_headers_async():
# Establish that the field header was sent.
_, _, kw = call.mock_calls[0]
- assert ("x-goog-request-params", "metric_name=metric_name/value",) in kw["metadata"]
+ assert (
+ "x-goog-request-params",
+ "metric_name=metric_name_value",
+ ) in kw["metadata"]
def test_delete_log_metric_flattened():
- client = MetricsServiceV2Client(credentials=ga_credentials.AnonymousCredentials(),)
+ client = MetricsServiceV2Client(
+ credentials=ga_credentials.AnonymousCredentials(),
+ )
# Mock the actual call within the gRPC stub, and fake the request.
with mock.patch.object(
@@ -1799,7 +2061,9 @@ def test_delete_log_metric_flattened():
call.return_value = None
# Call the method with a truthy value for each flattened field,
# using the keyword arguments to the method.
- client.delete_log_metric(metric_name="metric_name_value",)
+ client.delete_log_metric(
+ metric_name="metric_name_value",
+ )
# Establish that the underlying call was made with the expected
# request object values.
@@ -1811,13 +2075,16 @@ def test_delete_log_metric_flattened():
def test_delete_log_metric_flattened_error():
- client = MetricsServiceV2Client(credentials=ga_credentials.AnonymousCredentials(),)
+ client = MetricsServiceV2Client(
+ credentials=ga_credentials.AnonymousCredentials(),
+ )
# Attempting to call a method with both a request object and flattened
# fields is an error.
with pytest.raises(ValueError):
client.delete_log_metric(
- logging_metrics.DeleteLogMetricRequest(), metric_name="metric_name_value",
+ logging_metrics.DeleteLogMetricRequest(),
+ metric_name="metric_name_value",
)
@@ -1837,7 +2104,9 @@ async def test_delete_log_metric_flattened_async():
call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(None)
# Call the method with a truthy value for each flattened field,
# using the keyword arguments to the method.
- response = await client.delete_log_metric(metric_name="metric_name_value",)
+ response = await client.delete_log_metric(
+ metric_name="metric_name_value",
+ )
# Establish that the underlying call was made with the expected
# request object values.
@@ -1858,7 +2127,8 @@ async def test_delete_log_metric_flattened_error_async():
# fields is an error.
with pytest.raises(ValueError):
await client.delete_log_metric(
- logging_metrics.DeleteLogMetricRequest(), metric_name="metric_name_value",
+ logging_metrics.DeleteLogMetricRequest(),
+ metric_name="metric_name_value",
)
@@ -1869,7 +2139,8 @@ def test_credentials_transport_error():
)
with pytest.raises(ValueError):
client = MetricsServiceV2Client(
- credentials=ga_credentials.AnonymousCredentials(), transport=transport,
+ credentials=ga_credentials.AnonymousCredentials(),
+ transport=transport,
)
# It is an error to provide a credentials file and a transport instance.
@@ -1889,7 +2160,10 @@ def test_credentials_transport_error():
options = client_options.ClientOptions()
options.api_key = "api_key"
with pytest.raises(ValueError):
- client = MetricsServiceV2Client(client_options=options, transport=transport,)
+ client = MetricsServiceV2Client(
+ client_options=options,
+ transport=transport,
+ )
# It is an error to provide an api_key and a credential.
options = mock.Mock()
@@ -1905,7 +2179,8 @@ def test_credentials_transport_error():
)
with pytest.raises(ValueError):
client = MetricsServiceV2Client(
- client_options={"scopes": ["1", "2"]}, transport=transport,
+ client_options={"scopes": ["1", "2"]},
+ transport=transport,
)
@@ -1948,10 +2223,28 @@ def test_transport_adc(transport_class):
adc.assert_called_once()
+@pytest.mark.parametrize(
+ "transport_name",
+ [
+ "grpc",
+ ],
+)
+def test_transport_kind(transport_name):
+ transport = MetricsServiceV2Client.get_transport_class(transport_name)(
+ credentials=ga_credentials.AnonymousCredentials(),
+ )
+ assert transport.kind == transport_name
+
+
def test_transport_grpc_default():
# A client should use the gRPC transport by default.
- client = MetricsServiceV2Client(credentials=ga_credentials.AnonymousCredentials(),)
- assert isinstance(client.transport, transports.MetricsServiceV2GrpcTransport,)
+ client = MetricsServiceV2Client(
+ credentials=ga_credentials.AnonymousCredentials(),
+ )
+ assert isinstance(
+ client.transport,
+ transports.MetricsServiceV2GrpcTransport,
+ )
def test_metrics_service_v2_base_transport_error():
@@ -1989,6 +2282,14 @@ def test_metrics_service_v2_base_transport():
with pytest.raises(NotImplementedError):
transport.close()
+ # Catch all for all remaining methods and properties
+ remainder = [
+ "kind",
+ ]
+ for r in remainder:
+ with pytest.raises(NotImplementedError):
+ getattr(transport, r)()
+
def test_metrics_service_v2_base_transport_with_credentials_file():
# Instantiate the base transport with a credentials file
@@ -2000,7 +2301,8 @@ def test_metrics_service_v2_base_transport_with_credentials_file():
Transport.return_value = None
load_creds.return_value = (ga_credentials.AnonymousCredentials(), None)
transport = transports.MetricsServiceV2Transport(
- credentials_file="credentials.json", quota_project_id="octopus",
+ credentials_file="credentials.json",
+ quota_project_id="octopus",
)
load_creds.assert_called_once_with(
"credentials.json",
@@ -2157,24 +2459,40 @@ def test_metrics_service_v2_grpc_transport_client_cert_source_for_mtls(transport
)
-def test_metrics_service_v2_host_no_port():
+@pytest.mark.parametrize(
+ "transport_name",
+ [
+ "grpc",
+ "grpc_asyncio",
+ ],
+)
+def test_metrics_service_v2_host_no_port(transport_name):
client = MetricsServiceV2Client(
credentials=ga_credentials.AnonymousCredentials(),
client_options=client_options.ClientOptions(
api_endpoint="logging.googleapis.com"
),
+ transport=transport_name,
)
- assert client.transport._host == "logging.googleapis.com:443"
+ assert client.transport._host == ("logging.googleapis.com:443")
-def test_metrics_service_v2_host_with_port():
+@pytest.mark.parametrize(
+ "transport_name",
+ [
+ "grpc",
+ "grpc_asyncio",
+ ],
+)
+def test_metrics_service_v2_host_with_port(transport_name):
client = MetricsServiceV2Client(
credentials=ga_credentials.AnonymousCredentials(),
client_options=client_options.ClientOptions(
api_endpoint="logging.googleapis.com:8000"
),
+ transport=transport_name,
)
- assert client.transport._host == "logging.googleapis.com:8000"
+ assert client.transport._host == ("logging.googleapis.com:8000")
def test_metrics_service_v2_grpc_transport_channel():
@@ -2182,7 +2500,8 @@ def test_metrics_service_v2_grpc_transport_channel():
# Check that channel is used if provided.
transport = transports.MetricsServiceV2GrpcTransport(
- host="squid.clam.whelk", channel=channel,
+ host="squid.clam.whelk",
+ channel=channel,
)
assert transport.grpc_channel == channel
assert transport._host == "squid.clam.whelk:443"
@@ -2194,7 +2513,8 @@ def test_metrics_service_v2_grpc_asyncio_transport_channel():
# Check that channel is used if provided.
transport = transports.MetricsServiceV2GrpcAsyncIOTransport(
- host="squid.clam.whelk", channel=channel,
+ host="squid.clam.whelk",
+ channel=channel,
)
assert transport.grpc_channel == channel
assert transport._host == "squid.clam.whelk:443"
@@ -2305,7 +2625,8 @@ def test_log_metric_path():
project = "squid"
metric = "clam"
expected = "projects/{project}/metrics/{metric}".format(
- project=project, metric=metric,
+ project=project,
+ metric=metric,
)
actual = MetricsServiceV2Client.log_metric_path(project, metric)
assert expected == actual
@@ -2345,7 +2666,9 @@ def test_parse_common_billing_account_path():
def test_common_folder_path():
folder = "cuttlefish"
- expected = "folders/{folder}".format(folder=folder,)
+ expected = "folders/{folder}".format(
+ folder=folder,
+ )
actual = MetricsServiceV2Client.common_folder_path(folder)
assert expected == actual
@@ -2363,7 +2686,9 @@ def test_parse_common_folder_path():
def test_common_organization_path():
organization = "winkle"
- expected = "organizations/{organization}".format(organization=organization,)
+ expected = "organizations/{organization}".format(
+ organization=organization,
+ )
actual = MetricsServiceV2Client.common_organization_path(organization)
assert expected == actual
@@ -2381,7 +2706,9 @@ def test_parse_common_organization_path():
def test_common_project_path():
project = "scallop"
- expected = "projects/{project}".format(project=project,)
+ expected = "projects/{project}".format(
+ project=project,
+ )
actual = MetricsServiceV2Client.common_project_path(project)
assert expected == actual
@@ -2401,7 +2728,8 @@ def test_common_location_path():
project = "squid"
location = "clam"
expected = "projects/{project}/locations/{location}".format(
- project=project, location=location,
+ project=project,
+ location=location,
)
actual = MetricsServiceV2Client.common_location_path(project, location)
assert expected == actual
@@ -2426,7 +2754,8 @@ def test_client_with_default_client_info():
transports.MetricsServiceV2Transport, "_prep_wrapped_messages"
) as prep:
client = MetricsServiceV2Client(
- credentials=ga_credentials.AnonymousCredentials(), client_info=client_info,
+ credentials=ga_credentials.AnonymousCredentials(),
+ client_info=client_info,
)
prep.assert_called_once_with(client_info)
@@ -2435,7 +2764,8 @@ def test_client_with_default_client_info():
) as prep:
transport_class = MetricsServiceV2Client.get_transport_class()
transport = transport_class(
- credentials=ga_credentials.AnonymousCredentials(), client_info=client_info,
+ credentials=ga_credentials.AnonymousCredentials(),
+ client_info=client_info,
)
prep.assert_called_once_with(client_info)
@@ -2443,7 +2773,8 @@ def test_client_with_default_client_info():
@pytest.mark.asyncio
async def test_transport_close_async():
client = MetricsServiceV2AsyncClient(
- credentials=ga_credentials.AnonymousCredentials(), transport="grpc_asyncio",
+ credentials=ga_credentials.AnonymousCredentials(),
+ transport="grpc_asyncio",
)
with mock.patch.object(
type(getattr(client.transport, "grpc_channel")), "close"
diff --git a/tests/unit/handlers/test_handlers.py b/tests/unit/handlers/test_handlers.py
index bbfacf59f..0bcde45de 100644
--- a/tests/unit/handlers/test_handlers.py
+++ b/tests/unit/handlers/test_handlers.py
@@ -100,7 +100,15 @@ def test_minimal_record(self):
import logging
filter_obj = self._make_one()
- record = logging.LogRecord(None, logging.INFO, None, None, None, None, None,)
+ record = logging.LogRecord(
+ None,
+ logging.INFO,
+ None,
+ None,
+ None,
+ None,
+ None,
+ )
record.created = None
success = filter_obj.filter(record)
@@ -128,7 +136,15 @@ def test_record_with_request(self):
import logging
filter_obj = self._make_one()
- record = logging.LogRecord(None, logging.INFO, None, None, None, None, None,)
+ record = logging.LogRecord(
+ None,
+ logging.INFO,
+ None,
+ None,
+ None,
+ None,
+ None,
+ )
record.created = None
expected_path = "http://testserver/123"
@@ -170,7 +186,15 @@ def test_record_with_traceparent_request(self):
import logging
filter_obj = self._make_one()
- record = logging.LogRecord(None, logging.INFO, None, None, None, None, None,)
+ record = logging.LogRecord(
+ None,
+ logging.INFO,
+ None,
+ None,
+ None,
+ None,
+ None,
+ )
record.created = None
expected_path = "http://testserver/123"
@@ -368,7 +392,17 @@ def test_emit_minimal(self):
handler.handle(record)
self.assertEqual(
handler.transport.send_called_with,
- (record, None, _GLOBAL_RESOURCE, None, None, None, False, None, None,),
+ (
+ record,
+ None,
+ _GLOBAL_RESOURCE,
+ None,
+ None,
+ None,
+ False,
+ None,
+ None,
+ ),
)
def test_emit_manual_field_override(self):
@@ -437,7 +471,9 @@ def test_emit_with_custom_formatter(self):
client = _Client(self.PROJECT)
handler = self._make_one(
- client, transport=_Transport, resource=_GLOBAL_RESOURCE,
+ client,
+ transport=_Transport,
+ resource=_GLOBAL_RESOURCE,
)
logFormatter = logging.Formatter(fmt="%(name)s :: %(levelname)s :: %(message)s")
handler.setFormatter(logFormatter)
@@ -473,7 +509,9 @@ def test_emit_dict(self):
client = _Client(self.PROJECT)
handler = self._make_one(
- client, transport=_Transport, resource=_GLOBAL_RESOURCE,
+ client,
+ transport=_Transport,
+ resource=_GLOBAL_RESOURCE,
)
message = {"x": "test"}
logname = "logname"
@@ -506,7 +544,9 @@ def test_emit_w_json_extras(self):
client = _Client(self.PROJECT)
handler = self._make_one(
- client, transport=_Transport, resource=_GLOBAL_RESOURCE,
+ client,
+ transport=_Transport,
+ resource=_GLOBAL_RESOURCE,
)
message = "message"
json_fields = {"hello": "world"}
@@ -541,7 +581,9 @@ def test_emit_with_encoded_json(self):
client = _Client(self.PROJECT)
handler = self._make_one(
- client, transport=_Transport, resource=_GLOBAL_RESOURCE,
+ client,
+ transport=_Transport,
+ resource=_GLOBAL_RESOURCE,
)
logFormatter = logging.Formatter(fmt='{ "x" : "%(name)s" }')
handler.setFormatter(logFormatter)
@@ -574,7 +616,9 @@ def test_format_with_arguments(self):
client = _Client(self.PROJECT)
handler = self._make_one(
- client, transport=_Transport, resource=_GLOBAL_RESOURCE,
+ client,
+ transport=_Transport,
+ resource=_GLOBAL_RESOURCE,
)
message = "name: %s"
name_arg = "Daniel"
@@ -860,7 +904,7 @@ def __init__(self, project):
class _Transport(object):
- def __init__(self, client, name):
+ def __init__(self, client, name, resource=None):
self.client = client
self.name = name
diff --git a/tests/unit/handlers/test_structured_log.py b/tests/unit/handlers/test_structured_log.py
index 5db098c29..5031748f9 100644
--- a/tests/unit/handlers/test_structured_log.py
+++ b/tests/unit/handlers/test_structured_log.py
@@ -90,7 +90,15 @@ def test_format_minimal(self):
import json
handler = self._make_one()
- record = logging.LogRecord(None, logging.INFO, None, None, None, None, None,)
+ record = logging.LogRecord(
+ None,
+ logging.INFO,
+ None,
+ None,
+ None,
+ None,
+ None,
+ )
record.created = None
expected_payload = {
"severity": "INFO",
@@ -118,7 +126,15 @@ def test_format_with_quotes(self):
handler = self._make_one()
message = '"test"'
expected_result = '\\"test\\"'
- record = logging.LogRecord(None, logging.INFO, None, None, message, None, None,)
+ record = logging.LogRecord(
+ None,
+ logging.INFO,
+ None,
+ None,
+ message,
+ None,
+ None,
+ )
record.created = None
handler.filter(record)
result = handler.format(record)
@@ -151,7 +167,15 @@ def test_format_with_line_break(self):
handler = self._make_one()
message = "test\ntest"
expected_result = "test\\ntest"
- record = logging.LogRecord(None, logging.INFO, None, None, message, None, None,)
+ record = logging.LogRecord(
+ None,
+ logging.INFO,
+ None,
+ None,
+ message,
+ None,
+ None,
+ )
record.created = None
handler.filter(record)
result = handler.format(record)
@@ -169,7 +193,13 @@ def test_format_with_custom_formatter(self):
message = "test"
expected_result = "logname :: INFO :: test"
record = logging.LogRecord(
- "logname", logging.INFO, None, None, message, None, None,
+ "logname",
+ logging.INFO,
+ None,
+ None,
+ message,
+ None,
+ None,
)
record.created = None
handler.filter(record)
@@ -187,7 +217,13 @@ def test_dict(self):
message = {"x": "test"}
expected_result = '"x": "test"'
record = logging.LogRecord(
- "logname", logging.INFO, None, None, message, None, None,
+ "logname",
+ logging.INFO,
+ None,
+ None,
+ message,
+ None,
+ None,
)
record.created = None
handler.filter(record)
@@ -206,7 +242,13 @@ def test_encoded_json(self):
handler.setFormatter(logFormatter)
expected_result = '"name": "logname"'
record = logging.LogRecord(
- "logname", logging.INFO, None, None, None, None, None,
+ "logname",
+ logging.INFO,
+ None,
+ None,
+ None,
+ None,
+ None,
)
record.created = None
handler.filter(record)
@@ -225,7 +267,13 @@ def test_format_with_arguments(self):
name_arg = "Daniel"
expected_result = "name: Daniel"
record = logging.LogRecord(
- None, logging.INFO, None, None, message, name_arg, None,
+ None,
+ logging.INFO,
+ None,
+ None,
+ message,
+ name_arg,
+ None,
)
record.created = None
handler.filter(record)
@@ -375,7 +423,13 @@ def test_format_with_json_fields(self):
expected_result = "name: Daniel"
json_fields = {"hello": "world", "number": 12}
record = logging.LogRecord(
- None, logging.INFO, None, None, message, name_arg, None,
+ None,
+ logging.INFO,
+ None,
+ None,
+ message,
+ name_arg,
+ None,
)
record.created = None
setattr(record, "json_fields", json_fields)
diff --git a/tests/unit/handlers/transports/test_background_thread.py b/tests/unit/handlers/transports/test_background_thread.py
index f408de476..07e1a7e66 100644
--- a/tests/unit/handlers/transports/test_background_thread.py
+++ b/tests/unit/handlers/transports/test_background_thread.py
@@ -64,7 +64,9 @@ def test_send(self):
transport.send(record, message, resource=_GLOBAL_RESOURCE)
transport.worker.enqueue.assert_called_once_with(
- record, message, resource=_GLOBAL_RESOURCE,
+ record,
+ message,
+ resource=_GLOBAL_RESOURCE,
)
def test_trace_send(self):
@@ -86,7 +88,10 @@ def test_trace_send(self):
transport.send(record, message, resource=_GLOBAL_RESOURCE, trace=trace)
transport.worker.enqueue.assert_called_once_with(
- record, message, resource=_GLOBAL_RESOURCE, trace=trace,
+ record,
+ message,
+ resource=_GLOBAL_RESOURCE,
+ trace=trace,
)
def test_span_send(self):
@@ -108,7 +113,10 @@ def test_span_send(self):
transport.send(record, message, resource=_GLOBAL_RESOURCE, span_id=span_id)
transport.worker.enqueue.assert_called_once_with(
- record, message, resource=_GLOBAL_RESOURCE, span_id=span_id,
+ record,
+ message,
+ resource=_GLOBAL_RESOURCE,
+ span_id=span_id,
)
def test_flush(self):
@@ -509,11 +517,12 @@ def commit(self):
class _Logger(object):
- def __init__(self, name):
+ def __init__(self, name, resource=None):
self.name = name
self._batch_cls = _Batch
self._batch = None
self._num_batches = 0
+ self.resource = resource
def batch(self):
self._batch = self._batch_cls()
@@ -530,6 +539,6 @@ def __init__(self, project, _http=None, credentials=None):
self._credentials = credentials
self._connection = mock.Mock(credentials=credentials, spec=["credentials"])
- def logger(self, name): # pylint: disable=unused-argument
- self._logger = _Logger(name)
+ def logger(self, name, resource=None): # pylint: disable=unused-argument
+ self._logger = _Logger(name, resource=resource)
return self._logger
diff --git a/tests/unit/handlers/transports/test_base.py b/tests/unit/handlers/transports/test_base.py
index 4cbfab02e..71ef1366a 100644
--- a/tests/unit/handlers/transports/test_base.py
+++ b/tests/unit/handlers/transports/test_base.py
@@ -29,10 +29,13 @@ def _make_one(self, *args, **kw):
return self._get_target_class()(*args, **kw)
def test_send_is_abstract(self):
- target = self._make_one()
+ target = self._make_one("client", "name")
with self.assertRaises(NotImplementedError):
target.send(None, None, resource=None)
+ def test_resource_is_valid_argunent(self):
+ self._make_one("client", "name", resource="resource")
+
def test_flush_is_abstract_and_optional(self):
- target = self._make_one()
+ target = self._make_one("client", "name")
target.flush()
diff --git a/tests/unit/handlers/transports/test_sync.py b/tests/unit/handlers/transports/test_sync.py
index cc8ffe284..bdc78d89a 100644
--- a/tests/unit/handlers/transports/test_sync.py
+++ b/tests/unit/handlers/transports/test_sync.py
@@ -91,8 +91,9 @@ def test_send_struct(self):
class _Logger(object):
from google.cloud.logging_v2.logger import _GLOBAL_RESOURCE
- def __init__(self, name):
+ def __init__(self, name, resource=_GLOBAL_RESOURCE):
self.name = name
+ self.resource = resource
def log(
self,
@@ -119,8 +120,8 @@ class _Client(object):
def __init__(self, project):
self.project = project
- def logger(self, name): # pylint: disable=unused-argument
- self._logger = _Logger(name)
+ def logger(self, name, resource=None): # pylint: disable=unused-argument
+ self._logger = _Logger(name, resource=resource)
return self._logger
diff --git a/tests/unit/test__gapic.py b/tests/unit/test__gapic.py
index d8c4bf57e..127c856b4 100644
--- a/tests/unit/test__gapic.py
+++ b/tests/unit/test__gapic.py
@@ -215,7 +215,9 @@ def test_list_sinks(self):
) as call:
call.return_value = logging_v2.types.ListSinksResponse(sinks=[sink_msg])
- result = client.list_sinks(self.PARENT_PATH,)
+ result = client.list_sinks(
+ self.PARENT_PATH,
+ )
sinks = list(result)
diff --git a/tests/unit/test_logger.py b/tests/unit/test_logger.py
index 1eae1cda6..597313824 100644
--- a/tests/unit/test_logger.py
+++ b/tests/unit/test_logger.py
@@ -443,8 +443,8 @@ def test_log_w_dict_resource(self):
def test_log_lowercase_severity(self):
"""
- lower case severity strings should be accepted
- """
+ lower case severity strings should be accepted
+ """
from google.cloud.logging_v2.handlers._monitored_resources import (
detect_resource,
)
@@ -785,7 +785,10 @@ def test_list_entries_explicit(self):
},
)
# verify that default filter is 24 hours
- LOG_FILTER = "logName=projects/%s/logs/%s" % (self.PROJECT, self.LOGGER_NAME,)
+ LOG_FILTER = "logName=projects/%s/logs/%s" % (
+ self.PROJECT,
+ self.LOGGER_NAME,
+ )
combined_filter = (
INPUT_FILTER
+ " AND "
@@ -826,7 +829,10 @@ def test_list_entries_explicit_timestamp(self):
self.assertEqual(len(entries), 0)
# self.assertEqual(client._listed, LISTED)
# check call payload
- LOG_FILTER = "logName=projects/%s/logs/%s" % (self.PROJECT, self.LOGGER_NAME,)
+ LOG_FILTER = "logName=projects/%s/logs/%s" % (
+ self.PROJECT,
+ self.LOGGER_NAME,
+ )
combined_filter = INPUT_FILTER + " AND " + LOG_FILTER
self.assertEqual(
client._connection._called_with,
@@ -958,7 +964,9 @@ def test_list_entries_folder(self):
returned = {"entries": ENTRIES}
client._connection = _Connection(returned)
- iterator = client.list_entries(resource_names=[f"folder/{FOLDER_ID}"],)
+ iterator = client.list_entries(
+ resource_names=[f"folder/{FOLDER_ID}"],
+ )
entries = list(iterator)
# Check the entries.
self.assertEqual(len(entries), 1)