1# -*- coding: utf-8 -*- 
    2# Copyright 2025 Google LLC 
    3# 
    4# Licensed under the Apache License, Version 2.0 (the "License"); 
    5# you may not use this file except in compliance with the License. 
    6# You may obtain a copy of the License at 
    7# 
    8#     http://www.apache.org/licenses/LICENSE-2.0 
    9# 
    10# Unless required by applicable law or agreed to in writing, software 
    11# distributed under the License is distributed on an "AS IS" BASIS, 
    12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
    13# See the License for the specific language governing permissions and 
    14# limitations under the License. 
    15# 
    16import logging as std_logging 
    17from collections import OrderedDict 
    18import re 
    19from typing import ( 
    20    Dict, 
    21    Callable, 
    22    Mapping, 
    23    MutableMapping, 
    24    MutableSequence, 
    25    Optional, 
    26    Sequence, 
    27    Tuple, 
    28    Type, 
    29    Union, 
    30) 
    31 
    32from google.cloud.logging_v2 import gapic_version as package_version 
    33 
    34from google.api_core.client_options import ClientOptions 
    35from google.api_core import exceptions as core_exceptions 
    36from google.api_core import gapic_v1 
    37from google.api_core import retry_async as retries 
    38from google.auth import credentials as ga_credentials  # type: ignore 
    39from google.oauth2 import service_account  # type: ignore 
    40 
    41 
    42try: 
    43    OptionalRetry = Union[retries.AsyncRetry, gapic_v1.method._MethodDefault, None] 
    44except AttributeError:  # pragma: NO COVER 
    45    OptionalRetry = Union[retries.AsyncRetry, object, None]  # type: ignore 
    46 
    47from google.api_core import operation  # type: ignore 
    48from google.api_core import operation_async  # type: ignore 
    49from google.cloud.logging_v2.services.config_service_v2 import pagers 
    50from google.cloud.logging_v2.types import logging_config 
    51from google.longrunning import operations_pb2  # type: ignore 
    52from google.protobuf import empty_pb2  # type: ignore 
    53from google.protobuf import field_mask_pb2  # type: ignore 
    54from google.protobuf import timestamp_pb2  # type: ignore 
    55from .transports.base import ConfigServiceV2Transport, DEFAULT_CLIENT_INFO 
    56from .transports.grpc_asyncio import ConfigServiceV2GrpcAsyncIOTransport 
    57from .client import ConfigServiceV2Client 
    58 
    59try: 
    60    from google.api_core import client_logging  # type: ignore 
    61 
    62    CLIENT_LOGGING_SUPPORTED = True  # pragma: NO COVER 
    63except ImportError:  # pragma: NO COVER 
    64    CLIENT_LOGGING_SUPPORTED = False 
    65 
    66_LOGGER = std_logging.getLogger(__name__) 
    67 
    68 
    69class ConfigServiceV2AsyncClient: 
    70    """Service for configuring sinks used to route log entries.""" 
    71 
    72    _client: ConfigServiceV2Client 
    73 
    74    # Copy defaults from the synchronous client for use here. 
    75    # Note: DEFAULT_ENDPOINT is deprecated. Use _DEFAULT_ENDPOINT_TEMPLATE instead. 
    76    DEFAULT_ENDPOINT = ConfigServiceV2Client.DEFAULT_ENDPOINT 
    77    DEFAULT_MTLS_ENDPOINT = ConfigServiceV2Client.DEFAULT_MTLS_ENDPOINT 
    78    _DEFAULT_ENDPOINT_TEMPLATE = ConfigServiceV2Client._DEFAULT_ENDPOINT_TEMPLATE 
    79    _DEFAULT_UNIVERSE = ConfigServiceV2Client._DEFAULT_UNIVERSE 
    80 
    81    cmek_settings_path = staticmethod(ConfigServiceV2Client.cmek_settings_path) 
    82    parse_cmek_settings_path = staticmethod( 
    83        ConfigServiceV2Client.parse_cmek_settings_path 
    84    ) 
    85    link_path = staticmethod(ConfigServiceV2Client.link_path) 
    86    parse_link_path = staticmethod(ConfigServiceV2Client.parse_link_path) 
    87    log_bucket_path = staticmethod(ConfigServiceV2Client.log_bucket_path) 
    88    parse_log_bucket_path = staticmethod(ConfigServiceV2Client.parse_log_bucket_path) 
    89    log_exclusion_path = staticmethod(ConfigServiceV2Client.log_exclusion_path) 
    90    parse_log_exclusion_path = staticmethod( 
    91        ConfigServiceV2Client.parse_log_exclusion_path 
    92    ) 
    93    log_sink_path = staticmethod(ConfigServiceV2Client.log_sink_path) 
    94    parse_log_sink_path = staticmethod(ConfigServiceV2Client.parse_log_sink_path) 
    95    log_view_path = staticmethod(ConfigServiceV2Client.log_view_path) 
    96    parse_log_view_path = staticmethod(ConfigServiceV2Client.parse_log_view_path) 
    97    settings_path = staticmethod(ConfigServiceV2Client.settings_path) 
    98    parse_settings_path = staticmethod(ConfigServiceV2Client.parse_settings_path) 
    99    common_billing_account_path = staticmethod( 
    100        ConfigServiceV2Client.common_billing_account_path 
    101    ) 
    102    parse_common_billing_account_path = staticmethod( 
    103        ConfigServiceV2Client.parse_common_billing_account_path 
    104    ) 
    105    common_folder_path = staticmethod(ConfigServiceV2Client.common_folder_path) 
    106    parse_common_folder_path = staticmethod( 
    107        ConfigServiceV2Client.parse_common_folder_path 
    108    ) 
    109    common_organization_path = staticmethod( 
    110        ConfigServiceV2Client.common_organization_path 
    111    ) 
    112    parse_common_organization_path = staticmethod( 
    113        ConfigServiceV2Client.parse_common_organization_path 
    114    ) 
    115    common_project_path = staticmethod(ConfigServiceV2Client.common_project_path) 
    116    parse_common_project_path = staticmethod( 
    117        ConfigServiceV2Client.parse_common_project_path 
    118    ) 
    119    common_location_path = staticmethod(ConfigServiceV2Client.common_location_path) 
    120    parse_common_location_path = staticmethod( 
    121        ConfigServiceV2Client.parse_common_location_path 
    122    ) 
    123 
    124    @classmethod 
    125    def from_service_account_info(cls, info: dict, *args, **kwargs): 
    126        """Creates an instance of this client using the provided credentials 
    127            info. 
    128 
    129        Args: 
    130            info (dict): The service account private key info. 
    131            args: Additional arguments to pass to the constructor. 
    132            kwargs: Additional arguments to pass to the constructor. 
    133 
    134        Returns: 
    135            ConfigServiceV2AsyncClient: The constructed client. 
    136        """ 
    137        return ConfigServiceV2Client.from_service_account_info.__func__(ConfigServiceV2AsyncClient, info, *args, **kwargs)  # type: ignore 
    138 
    139    @classmethod 
    140    def from_service_account_file(cls, filename: str, *args, **kwargs): 
    141        """Creates an instance of this client using the provided credentials 
    142            file. 
    143 
    144        Args: 
    145            filename (str): The path to the service account private key json 
    146                file. 
    147            args: Additional arguments to pass to the constructor. 
    148            kwargs: Additional arguments to pass to the constructor. 
    149 
    150        Returns: 
    151            ConfigServiceV2AsyncClient: The constructed client. 
    152        """ 
    153        return ConfigServiceV2Client.from_service_account_file.__func__(ConfigServiceV2AsyncClient, filename, *args, **kwargs)  # type: ignore 
    154 
    155    from_service_account_json = from_service_account_file 
    156 
    157    @classmethod 
    158    def get_mtls_endpoint_and_cert_source( 
    159        cls, client_options: Optional[ClientOptions] = None 
    160    ): 
    161        """Return the API endpoint and client cert source for mutual TLS. 
    162 
    163        The client cert source is determined in the following order: 
    164        (1) if `GOOGLE_API_USE_CLIENT_CERTIFICATE` environment variable is not "true", the 
    165        client cert source is None. 
    166        (2) if `client_options.client_cert_source` is provided, use the provided one; if the 
    167        default client cert source exists, use the default one; otherwise the client cert 
    168        source is None. 
    169 
    170        The API endpoint is determined in the following order: 
    171        (1) if `client_options.api_endpoint` if provided, use the provided one. 
    172        (2) if `GOOGLE_API_USE_CLIENT_CERTIFICATE` environment variable is "always", use the 
    173        default mTLS endpoint; if the environment variable is "never", use the default API 
    174        endpoint; otherwise if client cert source exists, use the default mTLS endpoint, otherwise 
    175        use the default API endpoint. 
    176 
    177        More details can be found at https://google.aip.dev/auth/4114. 
    178 
    179        Args: 
    180            client_options (google.api_core.client_options.ClientOptions): Custom options for the 
    181                client. Only the `api_endpoint` and `client_cert_source` properties may be used 
    182                in this method. 
    183 
    184        Returns: 
    185            Tuple[str, Callable[[], Tuple[bytes, bytes]]]: returns the API endpoint and the 
    186                client cert source to use. 
    187 
    188        Raises: 
    189            google.auth.exceptions.MutualTLSChannelError: If any errors happen. 
    190        """ 
    191        return ConfigServiceV2Client.get_mtls_endpoint_and_cert_source(client_options)  # type: ignore 
    192 
    193    @property 
    194    def transport(self) -> ConfigServiceV2Transport: 
    195        """Returns the transport used by the client instance. 
    196 
    197        Returns: 
    198            ConfigServiceV2Transport: The transport used by the client instance. 
    199        """ 
    200        return self._client.transport 
    201 
    202    @property 
    203    def api_endpoint(self): 
    204        """Return the API endpoint used by the client instance. 
    205 
    206        Returns: 
    207            str: The API endpoint used by the client instance. 
    208        """ 
    209        return self._client._api_endpoint 
    210 
    211    @property 
    212    def universe_domain(self) -> str: 
    213        """Return the universe domain used by the client instance. 
    214 
    215        Returns: 
    216            str: The universe domain used 
    217                by the client instance. 
    218        """ 
    219        return self._client._universe_domain 
    220 
    221    get_transport_class = ConfigServiceV2Client.get_transport_class 
    222 
    223    def __init__( 
    224        self, 
    225        *, 
    226        credentials: Optional[ga_credentials.Credentials] = None, 
    227        transport: Optional[ 
    228            Union[ 
    229                str, ConfigServiceV2Transport, Callable[..., ConfigServiceV2Transport] 
    230            ] 
    231        ] = "grpc_asyncio", 
    232        client_options: Optional[ClientOptions] = None, 
    233        client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, 
    234    ) -> None: 
    235        """Instantiates the config service v2 async client. 
    236 
    237        Args: 
    238            credentials (Optional[google.auth.credentials.Credentials]): The 
    239                authorization credentials to attach to requests. These 
    240                credentials identify the application to the service; if none 
    241                are specified, the client will attempt to ascertain the 
    242                credentials from the environment. 
    243            transport (Optional[Union[str,ConfigServiceV2Transport,Callable[..., ConfigServiceV2Transport]]]): 
    244                The transport to use, or a Callable that constructs and returns a new transport to use. 
    245                If a Callable is given, it will be called with the same set of initialization 
    246                arguments as used in the ConfigServiceV2Transport constructor. 
    247                If set to None, a transport is chosen automatically. 
    248            client_options (Optional[Union[google.api_core.client_options.ClientOptions, dict]]): 
    249                Custom options for the client. 
    250 
    251                1. The ``api_endpoint`` property can be used to override the 
    252                default endpoint provided by the client when ``transport`` is 
    253                not explicitly provided. Only if this property is not set and 
    254                ``transport`` was not explicitly provided, the endpoint is 
    255                determined by the GOOGLE_API_USE_MTLS_ENDPOINT environment 
    256                variable, which have one of the following values: 
    257                "always" (always use the default mTLS endpoint), "never" (always 
    258                use the default regular endpoint) and "auto" (auto-switch to the 
    259                default mTLS endpoint if client certificate is present; this is 
    260                the default value). 
    261 
    262                2. If the GOOGLE_API_USE_CLIENT_CERTIFICATE environment variable 
    263                is "true", then the ``client_cert_source`` property can be used 
    264                to provide a client certificate for mTLS transport. If 
    265                not provided, the default SSL client certificate will be used if 
    266                present. If GOOGLE_API_USE_CLIENT_CERTIFICATE is "false" or not 
    267                set, no client certificate will be used. 
    268 
    269                3. The ``universe_domain`` property can be used to override the 
    270                default "googleapis.com" universe. Note that ``api_endpoint`` 
    271                property still takes precedence; and ``universe_domain`` is 
    272                currently not supported for mTLS. 
    273 
    274            client_info (google.api_core.gapic_v1.client_info.ClientInfo): 
    275                The client info used to send a user-agent string along with 
    276                API requests. If ``None``, then default info will be used. 
    277                Generally, you only need to set this if you're developing 
    278                your own client library. 
    279 
    280        Raises: 
    281            google.auth.exceptions.MutualTlsChannelError: If mutual TLS transport 
    282                creation failed for any reason. 
    283        """ 
    284        self._client = ConfigServiceV2Client( 
    285            credentials=credentials, 
    286            transport=transport, 
    287            client_options=client_options, 
    288            client_info=client_info, 
    289        ) 
    290 
    291        if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor( 
    292            std_logging.DEBUG 
    293        ):  # pragma: NO COVER 
    294            _LOGGER.debug( 
    295                "Created client `google.logging_v2.ConfigServiceV2AsyncClient`.", 
    296                extra={ 
    297                    "serviceName": "google.logging.v2.ConfigServiceV2", 
    298                    "universeDomain": getattr( 
    299                        self._client._transport._credentials, "universe_domain", "" 
    300                    ), 
    301                    "credentialsType": f"{type(self._client._transport._credentials).__module__}.{type(self._client._transport._credentials).__qualname__}", 
    302                    "credentialsInfo": getattr( 
    303                        self.transport._credentials, "get_cred_info", lambda: None 
    304                    )(), 
    305                } 
    306                if hasattr(self._client._transport, "_credentials") 
    307                else { 
    308                    "serviceName": "google.logging.v2.ConfigServiceV2", 
    309                    "credentialsType": None, 
    310                }, 
    311            ) 
    312 
    313    async def list_buckets( 
    314        self, 
    315        request: Optional[Union[logging_config.ListBucketsRequest, dict]] = None, 
    316        *, 
    317        parent: Optional[str] = None, 
    318        retry: OptionalRetry = gapic_v1.method.DEFAULT, 
    319        timeout: Union[float, object] = gapic_v1.method.DEFAULT, 
    320        metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), 
    321    ) -> pagers.ListBucketsAsyncPager: 
    322        r"""Lists log buckets. 
    323 
    324        .. code-block:: python 
    325 
    326            # This snippet has been automatically generated and should be regarded as a 
    327            # code template only. 
    328            # It will require modifications to work: 
    329            # - It may require correct/in-range values for request initialization. 
    330            # - It may require specifying regional endpoints when creating the service 
    331            #   client as shown in: 
    332            #   https://googleapis.dev/python/google-api-core/latest/client_options.html 
    333            from google.cloud import logging_v2 
    334 
    335            async def sample_list_buckets(): 
    336                # Create a client 
    337                client = logging_v2.ConfigServiceV2AsyncClient() 
    338 
    339                # Initialize request argument(s) 
    340                request = logging_v2.ListBucketsRequest( 
    341                    parent="parent_value", 
    342                ) 
    343 
    344                # Make the request 
    345                page_result = client.list_buckets(request=request) 
    346 
    347                # Handle the response 
    348                async for response in page_result: 
    349                    print(response) 
    350 
    351        Args: 
    352            request (Optional[Union[google.cloud.logging_v2.types.ListBucketsRequest, dict]]): 
    353                The request object. The parameters to ``ListBuckets``. 
    354            parent (:class:`str`): 
    355                Required. The parent resource whose buckets are to be 
    356                listed: 
    357 
    358                :: 
    359 
    360                    "projects/[PROJECT_ID]/locations/[LOCATION_ID]" 
    361                    "organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]" 
    362                    "billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]" 
    363                    "folders/[FOLDER_ID]/locations/[LOCATION_ID]" 
    364 
    365                Note: The locations portion of the resource must be 
    366                specified, but supplying the character ``-`` in place of 
    367                [LOCATION_ID] will return all buckets. 
    368 
    369                This corresponds to the ``parent`` field 
    370                on the ``request`` instance; if ``request`` is provided, this 
    371                should not be set. 
    372            retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any, 
    373                should be retried. 
    374            timeout (float): The timeout for this request. 
    375            metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be 
    376                sent along with the request as metadata. Normally, each value must be of type `str`, 
    377                but for metadata keys ending with the suffix `-bin`, the corresponding values must 
    378                be of type `bytes`. 
    379 
    380        Returns: 
    381            google.cloud.logging_v2.services.config_service_v2.pagers.ListBucketsAsyncPager: 
    382                The response from ListBuckets. 
    383 
    384                Iterating over this object will yield 
    385                results and resolve additional pages 
    386                automatically. 
    387 
    388        """ 
    389        # Create or coerce a protobuf request object. 
    390        # - Quick check: If we got a request object, we should *not* have 
    391        #   gotten any keyword arguments that map to the request. 
    392        flattened_params = [parent] 
    393        has_flattened_params = ( 
    394            len([param for param in flattened_params if param is not None]) > 0 
    395        ) 
    396        if request is not None and has_flattened_params: 
    397            raise ValueError( 
    398                "If the `request` argument is set, then none of " 
    399                "the individual field arguments should be set." 
    400            ) 
    401 
    402        # - Use the request object if provided (there's no risk of modifying the input as 
    403        #   there are no flattened fields), or create one. 
    404        if not isinstance(request, logging_config.ListBucketsRequest): 
    405            request = logging_config.ListBucketsRequest(request) 
    406 
    407        # If we have keyword arguments corresponding to fields on the 
    408        # request, apply these. 
    409        if parent is not None: 
    410            request.parent = parent 
    411 
    412        # Wrap the RPC method; this adds retry and timeout information, 
    413        # and friendly error handling. 
    414        rpc = self._client._transport._wrapped_methods[ 
    415            self._client._transport.list_buckets 
    416        ] 
    417 
    418        # Certain fields should be provided within the metadata header; 
    419        # add these here. 
    420        metadata = tuple(metadata) + ( 
    421            gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)), 
    422        ) 
    423 
    424        # Validate the universe domain. 
    425        self._client._validate_universe_domain() 
    426 
    427        # Send the request. 
    428        response = await rpc( 
    429            request, 
    430            retry=retry, 
    431            timeout=timeout, 
    432            metadata=metadata, 
    433        ) 
    434 
    435        # This method is paged; wrap the response in a pager, which provides 
    436        # an `__aiter__` convenience method. 
    437        response = pagers.ListBucketsAsyncPager( 
    438            method=rpc, 
    439            request=request, 
    440            response=response, 
    441            retry=retry, 
    442            timeout=timeout, 
    443            metadata=metadata, 
    444        ) 
    445 
    446        # Done; return the response. 
    447        return response 
    448 
    449    async def get_bucket( 
    450        self, 
    451        request: Optional[Union[logging_config.GetBucketRequest, dict]] = None, 
    452        *, 
    453        retry: OptionalRetry = gapic_v1.method.DEFAULT, 
    454        timeout: Union[float, object] = gapic_v1.method.DEFAULT, 
    455        metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), 
    456    ) -> logging_config.LogBucket: 
    457        r"""Gets a log bucket. 
    458 
    459        .. code-block:: python 
    460 
    461            # This snippet has been automatically generated and should be regarded as a 
    462            # code template only. 
    463            # It will require modifications to work: 
    464            # - It may require correct/in-range values for request initialization. 
    465            # - It may require specifying regional endpoints when creating the service 
    466            #   client as shown in: 
    467            #   https://googleapis.dev/python/google-api-core/latest/client_options.html 
    468            from google.cloud import logging_v2 
    469 
    470            async def sample_get_bucket(): 
    471                # Create a client 
    472                client = logging_v2.ConfigServiceV2AsyncClient() 
    473 
    474                # Initialize request argument(s) 
    475                request = logging_v2.GetBucketRequest( 
    476                    name="name_value", 
    477                ) 
    478 
    479                # Make the request 
    480                response = await client.get_bucket(request=request) 
    481 
    482                # Handle the response 
    483                print(response) 
    484 
    485        Args: 
    486            request (Optional[Union[google.cloud.logging_v2.types.GetBucketRequest, dict]]): 
    487                The request object. The parameters to ``GetBucket``. 
    488            retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any, 
    489                should be retried. 
    490            timeout (float): The timeout for this request. 
    491            metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be 
    492                sent along with the request as metadata. Normally, each value must be of type `str`, 
    493                but for metadata keys ending with the suffix `-bin`, the corresponding values must 
    494                be of type `bytes`. 
    495 
    496        Returns: 
    497            google.cloud.logging_v2.types.LogBucket: 
    498                Describes a repository in which log 
    499                entries are stored. 
    500 
    501        """ 
    502        # Create or coerce a protobuf request object. 
    503        # - Use the request object if provided (there's no risk of modifying the input as 
    504        #   there are no flattened fields), or create one. 
    505        if not isinstance(request, logging_config.GetBucketRequest): 
    506            request = logging_config.GetBucketRequest(request) 
    507 
    508        # Wrap the RPC method; this adds retry and timeout information, 
    509        # and friendly error handling. 
    510        rpc = self._client._transport._wrapped_methods[ 
    511            self._client._transport.get_bucket 
    512        ] 
    513 
    514        # Certain fields should be provided within the metadata header; 
    515        # add these here. 
    516        metadata = tuple(metadata) + ( 
    517            gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)), 
    518        ) 
    519 
    520        # Validate the universe domain. 
    521        self._client._validate_universe_domain() 
    522 
    523        # Send the request. 
    524        response = await rpc( 
    525            request, 
    526            retry=retry, 
    527            timeout=timeout, 
    528            metadata=metadata, 
    529        ) 
    530 
    531        # Done; return the response. 
    532        return response 
    533 
    534    async def create_bucket_async( 
    535        self, 
    536        request: Optional[Union[logging_config.CreateBucketRequest, dict]] = None, 
    537        *, 
    538        retry: OptionalRetry = gapic_v1.method.DEFAULT, 
    539        timeout: Union[float, object] = gapic_v1.method.DEFAULT, 
    540        metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), 
    541    ) -> operation_async.AsyncOperation: 
    542        r"""Creates a log bucket asynchronously that can be used 
    543        to store log entries. 
    544        After a bucket has been created, the bucket's location 
    545        cannot be changed. 
    546 
    547        .. code-block:: python 
    548 
    549            # This snippet has been automatically generated and should be regarded as a 
    550            # code template only. 
    551            # It will require modifications to work: 
    552            # - It may require correct/in-range values for request initialization. 
    553            # - It may require specifying regional endpoints when creating the service 
    554            #   client as shown in: 
    555            #   https://googleapis.dev/python/google-api-core/latest/client_options.html 
    556            from google.cloud import logging_v2 
    557 
    558            async def sample_create_bucket_async(): 
    559                # Create a client 
    560                client = logging_v2.ConfigServiceV2AsyncClient() 
    561 
    562                # Initialize request argument(s) 
    563                request = logging_v2.CreateBucketRequest( 
    564                    parent="parent_value", 
    565                    bucket_id="bucket_id_value", 
    566                ) 
    567 
    568                # Make the request 
    569                operation = client.create_bucket_async(request=request) 
    570 
    571                print("Waiting for operation to complete...") 
    572 
    573                response = (await operation).result() 
    574 
    575                # Handle the response 
    576                print(response) 
    577 
    578        Args: 
    579            request (Optional[Union[google.cloud.logging_v2.types.CreateBucketRequest, dict]]): 
    580                The request object. The parameters to ``CreateBucket``. 
    581            retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any, 
    582                should be retried. 
    583            timeout (float): The timeout for this request. 
    584            metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be 
    585                sent along with the request as metadata. Normally, each value must be of type `str`, 
    586                but for metadata keys ending with the suffix `-bin`, the corresponding values must 
    587                be of type `bytes`. 
    588 
    589        Returns: 
    590            google.api_core.operation_async.AsyncOperation: 
    591                An object representing a long-running operation. 
    592 
    593                The result type for the operation will be 
    594                :class:`google.cloud.logging_v2.types.LogBucket` 
    595                Describes a repository in which log entries are stored. 
    596 
    597        """ 
    598        # Create or coerce a protobuf request object. 
    599        # - Use the request object if provided (there's no risk of modifying the input as 
    600        #   there are no flattened fields), or create one. 
    601        if not isinstance(request, logging_config.CreateBucketRequest): 
    602            request = logging_config.CreateBucketRequest(request) 
    603 
    604        # Wrap the RPC method; this adds retry and timeout information, 
    605        # and friendly error handling. 
    606        rpc = self._client._transport._wrapped_methods[ 
    607            self._client._transport.create_bucket_async 
    608        ] 
    609 
    610        # Certain fields should be provided within the metadata header; 
    611        # add these here. 
    612        metadata = tuple(metadata) + ( 
    613            gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)), 
    614        ) 
    615 
    616        # Validate the universe domain. 
    617        self._client._validate_universe_domain() 
    618 
    619        # Send the request. 
    620        response = await rpc( 
    621            request, 
    622            retry=retry, 
    623            timeout=timeout, 
    624            metadata=metadata, 
    625        ) 
    626 
    627        # Wrap the response in an operation future. 
    628        response = operation_async.from_gapic( 
    629            response, 
    630            self._client._transport.operations_client, 
    631            logging_config.LogBucket, 
    632            metadata_type=logging_config.BucketMetadata, 
    633        ) 
    634 
    635        # Done; return the response. 
    636        return response 
    637 
    638    async def update_bucket_async( 
    639        self, 
    640        request: Optional[Union[logging_config.UpdateBucketRequest, dict]] = None, 
    641        *, 
    642        retry: OptionalRetry = gapic_v1.method.DEFAULT, 
    643        timeout: Union[float, object] = gapic_v1.method.DEFAULT, 
    644        metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), 
    645    ) -> operation_async.AsyncOperation: 
    646        r"""Updates a log bucket asynchronously. 
    647 
    648        If the bucket has a ``lifecycle_state`` of ``DELETE_REQUESTED``, 
    649        then ``FAILED_PRECONDITION`` will be returned. 
    650 
    651        After a bucket has been created, the bucket's location cannot be 
    652        changed. 
    653 
    654        .. code-block:: python 
    655 
    656            # This snippet has been automatically generated and should be regarded as a 
    657            # code template only. 
    658            # It will require modifications to work: 
    659            # - It may require correct/in-range values for request initialization. 
    660            # - It may require specifying regional endpoints when creating the service 
    661            #   client as shown in: 
    662            #   https://googleapis.dev/python/google-api-core/latest/client_options.html 
    663            from google.cloud import logging_v2 
    664 
    665            async def sample_update_bucket_async(): 
    666                # Create a client 
    667                client = logging_v2.ConfigServiceV2AsyncClient() 
    668 
    669                # Initialize request argument(s) 
    670                request = logging_v2.UpdateBucketRequest( 
    671                    name="name_value", 
    672                ) 
    673 
    674                # Make the request 
    675                operation = client.update_bucket_async(request=request) 
    676 
    677                print("Waiting for operation to complete...") 
    678 
    679                response = (await operation).result() 
    680 
    681                # Handle the response 
    682                print(response) 
    683 
    684        Args: 
    685            request (Optional[Union[google.cloud.logging_v2.types.UpdateBucketRequest, dict]]): 
    686                The request object. The parameters to ``UpdateBucket``. 
    687            retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any, 
    688                should be retried. 
    689            timeout (float): The timeout for this request. 
    690            metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be 
    691                sent along with the request as metadata. Normally, each value must be of type `str`, 
    692                but for metadata keys ending with the suffix `-bin`, the corresponding values must 
    693                be of type `bytes`. 
    694 
    695        Returns: 
    696            google.api_core.operation_async.AsyncOperation: 
    697                An object representing a long-running operation. 
    698 
    699                The result type for the operation will be 
    700                :class:`google.cloud.logging_v2.types.LogBucket` 
    701                Describes a repository in which log entries are stored. 
    702 
    703        """ 
    704        # Create or coerce a protobuf request object. 
    705        # - Use the request object if provided (there's no risk of modifying the input as 
    706        #   there are no flattened fields), or create one. 
    707        if not isinstance(request, logging_config.UpdateBucketRequest): 
    708            request = logging_config.UpdateBucketRequest(request) 
    709 
    710        # Wrap the RPC method; this adds retry and timeout information, 
    711        # and friendly error handling. 
    712        rpc = self._client._transport._wrapped_methods[ 
    713            self._client._transport.update_bucket_async 
    714        ] 
    715 
    716        # Certain fields should be provided within the metadata header; 
    717        # add these here. 
    718        metadata = tuple(metadata) + ( 
    719            gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)), 
    720        ) 
    721 
    722        # Validate the universe domain. 
    723        self._client._validate_universe_domain() 
    724 
    725        # Send the request. 
    726        response = await rpc( 
    727            request, 
    728            retry=retry, 
    729            timeout=timeout, 
    730            metadata=metadata, 
    731        ) 
    732 
    733        # Wrap the response in an operation future. 
    734        response = operation_async.from_gapic( 
    735            response, 
    736            self._client._transport.operations_client, 
    737            logging_config.LogBucket, 
    738            metadata_type=logging_config.BucketMetadata, 
    739        ) 
    740 
    741        # Done; return the response. 
    742        return response 
    743 
    744    async def create_bucket( 
    745        self, 
    746        request: Optional[Union[logging_config.CreateBucketRequest, dict]] = None, 
    747        *, 
    748        retry: OptionalRetry = gapic_v1.method.DEFAULT, 
    749        timeout: Union[float, object] = gapic_v1.method.DEFAULT, 
    750        metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), 
    751    ) -> logging_config.LogBucket: 
    752        r"""Creates a log bucket that can be used to store log 
    753        entries. After a bucket has been created, the bucket's 
    754        location cannot be changed. 
    755 
    756        .. code-block:: python 
    757 
    758            # This snippet has been automatically generated and should be regarded as a 
    759            # code template only. 
    760            # It will require modifications to work: 
    761            # - It may require correct/in-range values for request initialization. 
    762            # - It may require specifying regional endpoints when creating the service 
    763            #   client as shown in: 
    764            #   https://googleapis.dev/python/google-api-core/latest/client_options.html 
    765            from google.cloud import logging_v2 
    766 
    767            async def sample_create_bucket(): 
    768                # Create a client 
    769                client = logging_v2.ConfigServiceV2AsyncClient() 
    770 
    771                # Initialize request argument(s) 
    772                request = logging_v2.CreateBucketRequest( 
    773                    parent="parent_value", 
    774                    bucket_id="bucket_id_value", 
    775                ) 
    776 
    777                # Make the request 
    778                response = await client.create_bucket(request=request) 
    779 
    780                # Handle the response 
    781                print(response) 
    782 
    783        Args: 
    784            request (Optional[Union[google.cloud.logging_v2.types.CreateBucketRequest, dict]]): 
    785                The request object. The parameters to ``CreateBucket``. 
    786            retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any, 
    787                should be retried. 
    788            timeout (float): The timeout for this request. 
    789            metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be 
    790                sent along with the request as metadata. Normally, each value must be of type `str`, 
    791                but for metadata keys ending with the suffix `-bin`, the corresponding values must 
    792                be of type `bytes`. 
    793 
    794        Returns: 
    795            google.cloud.logging_v2.types.LogBucket: 
    796                Describes a repository in which log 
    797                entries are stored. 
    798 
    799        """ 
    800        # Create or coerce a protobuf request object. 
    801        # - Use the request object if provided (there's no risk of modifying the input as 
    802        #   there are no flattened fields), or create one. 
    803        if not isinstance(request, logging_config.CreateBucketRequest): 
    804            request = logging_config.CreateBucketRequest(request) 
    805 
    806        # Wrap the RPC method; this adds retry and timeout information, 
    807        # and friendly error handling. 
    808        rpc = self._client._transport._wrapped_methods[ 
    809            self._client._transport.create_bucket 
    810        ] 
    811 
    812        # Certain fields should be provided within the metadata header; 
    813        # add these here. 
    814        metadata = tuple(metadata) + ( 
    815            gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)), 
    816        ) 
    817 
    818        # Validate the universe domain. 
    819        self._client._validate_universe_domain() 
    820 
    821        # Send the request. 
    822        response = await rpc( 
    823            request, 
    824            retry=retry, 
    825            timeout=timeout, 
    826            metadata=metadata, 
    827        ) 
    828 
    829        # Done; return the response. 
    830        return response 
    831 
    832    async def update_bucket( 
    833        self, 
    834        request: Optional[Union[logging_config.UpdateBucketRequest, dict]] = None, 
    835        *, 
    836        retry: OptionalRetry = gapic_v1.method.DEFAULT, 
    837        timeout: Union[float, object] = gapic_v1.method.DEFAULT, 
    838        metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), 
    839    ) -> logging_config.LogBucket: 
    840        r"""Updates a log bucket. 
    841 
    842        If the bucket has a ``lifecycle_state`` of ``DELETE_REQUESTED``, 
    843        then ``FAILED_PRECONDITION`` will be returned. 
    844 
    845        After a bucket has been created, the bucket's location cannot be 
    846        changed. 
    847 
    848        .. code-block:: python 
    849 
    850            # This snippet has been automatically generated and should be regarded as a 
    851            # code template only. 
    852            # It will require modifications to work: 
    853            # - It may require correct/in-range values for request initialization. 
    854            # - It may require specifying regional endpoints when creating the service 
    855            #   client as shown in: 
    856            #   https://googleapis.dev/python/google-api-core/latest/client_options.html 
    857            from google.cloud import logging_v2 
    858 
    859            async def sample_update_bucket(): 
    860                # Create a client 
    861                client = logging_v2.ConfigServiceV2AsyncClient() 
    862 
    863                # Initialize request argument(s) 
    864                request = logging_v2.UpdateBucketRequest( 
    865                    name="name_value", 
    866                ) 
    867 
    868                # Make the request 
    869                response = await client.update_bucket(request=request) 
    870 
    871                # Handle the response 
    872                print(response) 
    873 
    874        Args: 
    875            request (Optional[Union[google.cloud.logging_v2.types.UpdateBucketRequest, dict]]): 
    876                The request object. The parameters to ``UpdateBucket``. 
    877            retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any, 
    878                should be retried. 
    879            timeout (float): The timeout for this request. 
    880            metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be 
    881                sent along with the request as metadata. Normally, each value must be of type `str`, 
    882                but for metadata keys ending with the suffix `-bin`, the corresponding values must 
    883                be of type `bytes`. 
    884 
    885        Returns: 
    886            google.cloud.logging_v2.types.LogBucket: 
    887                Describes a repository in which log 
    888                entries are stored. 
    889 
    890        """ 
    891        # Create or coerce a protobuf request object. 
    892        # - Use the request object if provided (there's no risk of modifying the input as 
    893        #   there are no flattened fields), or create one. 
    894        if not isinstance(request, logging_config.UpdateBucketRequest): 
    895            request = logging_config.UpdateBucketRequest(request) 
    896 
    897        # Wrap the RPC method; this adds retry and timeout information, 
    898        # and friendly error handling. 
    899        rpc = self._client._transport._wrapped_methods[ 
    900            self._client._transport.update_bucket 
    901        ] 
    902 
    903        # Certain fields should be provided within the metadata header; 
    904        # add these here. 
    905        metadata = tuple(metadata) + ( 
    906            gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)), 
    907        ) 
    908 
    909        # Validate the universe domain. 
    910        self._client._validate_universe_domain() 
    911 
    912        # Send the request. 
    913        response = await rpc( 
    914            request, 
    915            retry=retry, 
    916            timeout=timeout, 
    917            metadata=metadata, 
    918        ) 
    919 
    920        # Done; return the response. 
    921        return response 
    922 
    923    async def delete_bucket( 
    924        self, 
    925        request: Optional[Union[logging_config.DeleteBucketRequest, dict]] = None, 
    926        *, 
    927        retry: OptionalRetry = gapic_v1.method.DEFAULT, 
    928        timeout: Union[float, object] = gapic_v1.method.DEFAULT, 
    929        metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), 
    930    ) -> None: 
    931        r"""Deletes a log bucket. 
    932 
    933        Changes the bucket's ``lifecycle_state`` to the 
    934        ``DELETE_REQUESTED`` state. After 7 days, the bucket will be 
    935        purged and all log entries in the bucket will be permanently 
    936        deleted. 
    937 
    938        .. code-block:: python 
    939 
    940            # This snippet has been automatically generated and should be regarded as a 
    941            # code template only. 
    942            # It will require modifications to work: 
    943            # - It may require correct/in-range values for request initialization. 
    944            # - It may require specifying regional endpoints when creating the service 
    945            #   client as shown in: 
    946            #   https://googleapis.dev/python/google-api-core/latest/client_options.html 
    947            from google.cloud import logging_v2 
    948 
    949            async def sample_delete_bucket(): 
    950                # Create a client 
    951                client = logging_v2.ConfigServiceV2AsyncClient() 
    952 
    953                # Initialize request argument(s) 
    954                request = logging_v2.DeleteBucketRequest( 
    955                    name="name_value", 
    956                ) 
    957 
    958                # Make the request 
    959                await client.delete_bucket(request=request) 
    960 
    961        Args: 
    962            request (Optional[Union[google.cloud.logging_v2.types.DeleteBucketRequest, dict]]): 
    963                The request object. The parameters to ``DeleteBucket``. 
    964            retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any, 
    965                should be retried. 
    966            timeout (float): The timeout for this request. 
    967            metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be 
    968                sent along with the request as metadata. Normally, each value must be of type `str`, 
    969                but for metadata keys ending with the suffix `-bin`, the corresponding values must 
    970                be of type `bytes`. 
    971        """ 
    972        # Create or coerce a protobuf request object. 
    973        # - Use the request object if provided (there's no risk of modifying the input as 
    974        #   there are no flattened fields), or create one. 
    975        if not isinstance(request, logging_config.DeleteBucketRequest): 
    976            request = logging_config.DeleteBucketRequest(request) 
    977 
    978        # Wrap the RPC method; this adds retry and timeout information, 
    979        # and friendly error handling. 
    980        rpc = self._client._transport._wrapped_methods[ 
    981            self._client._transport.delete_bucket 
    982        ] 
    983 
    984        # Certain fields should be provided within the metadata header; 
    985        # add these here. 
    986        metadata = tuple(metadata) + ( 
    987            gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)), 
    988        ) 
    989 
    990        # Validate the universe domain. 
    991        self._client._validate_universe_domain() 
    992 
    993        # Send the request. 
    994        await rpc( 
    995            request, 
    996            retry=retry, 
    997            timeout=timeout, 
    998            metadata=metadata, 
    999        ) 
    1000 
    1001    async def undelete_bucket( 
    1002        self, 
    1003        request: Optional[Union[logging_config.UndeleteBucketRequest, dict]] = None, 
    1004        *, 
    1005        retry: OptionalRetry = gapic_v1.method.DEFAULT, 
    1006        timeout: Union[float, object] = gapic_v1.method.DEFAULT, 
    1007        metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), 
    1008    ) -> None: 
    1009        r"""Undeletes a log bucket. A bucket that has been 
    1010        deleted can be undeleted within the grace period of 7 
    1011        days. 
    1012 
    1013        .. code-block:: python 
    1014 
    1015            # This snippet has been automatically generated and should be regarded as a 
    1016            # code template only. 
    1017            # It will require modifications to work: 
    1018            # - It may require correct/in-range values for request initialization. 
    1019            # - It may require specifying regional endpoints when creating the service 
    1020            #   client as shown in: 
    1021            #   https://googleapis.dev/python/google-api-core/latest/client_options.html 
    1022            from google.cloud import logging_v2 
    1023 
    1024            async def sample_undelete_bucket(): 
    1025                # Create a client 
    1026                client = logging_v2.ConfigServiceV2AsyncClient() 
    1027 
    1028                # Initialize request argument(s) 
    1029                request = logging_v2.UndeleteBucketRequest( 
    1030                    name="name_value", 
    1031                ) 
    1032 
    1033                # Make the request 
    1034                await client.undelete_bucket(request=request) 
    1035 
    1036        Args: 
    1037            request (Optional[Union[google.cloud.logging_v2.types.UndeleteBucketRequest, dict]]): 
    1038                The request object. The parameters to ``UndeleteBucket``. 
    1039            retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any, 
    1040                should be retried. 
    1041            timeout (float): The timeout for this request. 
    1042            metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be 
    1043                sent along with the request as metadata. Normally, each value must be of type `str`, 
    1044                but for metadata keys ending with the suffix `-bin`, the corresponding values must 
    1045                be of type `bytes`. 
    1046        """ 
    1047        # Create or coerce a protobuf request object. 
    1048        # - Use the request object if provided (there's no risk of modifying the input as 
    1049        #   there are no flattened fields), or create one. 
    1050        if not isinstance(request, logging_config.UndeleteBucketRequest): 
    1051            request = logging_config.UndeleteBucketRequest(request) 
    1052 
    1053        # Wrap the RPC method; this adds retry and timeout information, 
    1054        # and friendly error handling. 
    1055        rpc = self._client._transport._wrapped_methods[ 
    1056            self._client._transport.undelete_bucket 
    1057        ] 
    1058 
    1059        # Certain fields should be provided within the metadata header; 
    1060        # add these here. 
    1061        metadata = tuple(metadata) + ( 
    1062            gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)), 
    1063        ) 
    1064 
    1065        # Validate the universe domain. 
    1066        self._client._validate_universe_domain() 
    1067 
    1068        # Send the request. 
    1069        await rpc( 
    1070            request, 
    1071            retry=retry, 
    1072            timeout=timeout, 
    1073            metadata=metadata, 
    1074        ) 
    1075 
    1076    async def list_views( 
    1077        self, 
    1078        request: Optional[Union[logging_config.ListViewsRequest, dict]] = None, 
    1079        *, 
    1080        parent: Optional[str] = None, 
    1081        retry: OptionalRetry = gapic_v1.method.DEFAULT, 
    1082        timeout: Union[float, object] = gapic_v1.method.DEFAULT, 
    1083        metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), 
    1084    ) -> pagers.ListViewsAsyncPager: 
    1085        r"""Lists views on a log bucket. 
    1086 
    1087        .. code-block:: python 
    1088 
    1089            # This snippet has been automatically generated and should be regarded as a 
    1090            # code template only. 
    1091            # It will require modifications to work: 
    1092            # - It may require correct/in-range values for request initialization. 
    1093            # - It may require specifying regional endpoints when creating the service 
    1094            #   client as shown in: 
    1095            #   https://googleapis.dev/python/google-api-core/latest/client_options.html 
    1096            from google.cloud import logging_v2 
    1097 
    1098            async def sample_list_views(): 
    1099                # Create a client 
    1100                client = logging_v2.ConfigServiceV2AsyncClient() 
    1101 
    1102                # Initialize request argument(s) 
    1103                request = logging_v2.ListViewsRequest( 
    1104                    parent="parent_value", 
    1105                ) 
    1106 
    1107                # Make the request 
    1108                page_result = client.list_views(request=request) 
    1109 
    1110                # Handle the response 
    1111                async for response in page_result: 
    1112                    print(response) 
    1113 
    1114        Args: 
    1115            request (Optional[Union[google.cloud.logging_v2.types.ListViewsRequest, dict]]): 
    1116                The request object. The parameters to ``ListViews``. 
    1117            parent (:class:`str`): 
    1118                Required. The bucket whose views are to be listed: 
    1119 
    1120                :: 
    1121 
    1122                    "projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" 
    1123 
    1124                This corresponds to the ``parent`` field 
    1125                on the ``request`` instance; if ``request`` is provided, this 
    1126                should not be set. 
    1127            retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any, 
    1128                should be retried. 
    1129            timeout (float): The timeout for this request. 
    1130            metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be 
    1131                sent along with the request as metadata. Normally, each value must be of type `str`, 
    1132                but for metadata keys ending with the suffix `-bin`, the corresponding values must 
    1133                be of type `bytes`. 
    1134 
    1135        Returns: 
    1136            google.cloud.logging_v2.services.config_service_v2.pagers.ListViewsAsyncPager: 
    1137                The response from ListViews. 
    1138 
    1139                Iterating over this object will yield 
    1140                results and resolve additional pages 
    1141                automatically. 
    1142 
    1143        """ 
    1144        # Create or coerce a protobuf request object. 
    1145        # - Quick check: If we got a request object, we should *not* have 
    1146        #   gotten any keyword arguments that map to the request. 
    1147        flattened_params = [parent] 
    1148        has_flattened_params = ( 
    1149            len([param for param in flattened_params if param is not None]) > 0 
    1150        ) 
    1151        if request is not None and has_flattened_params: 
    1152            raise ValueError( 
    1153                "If the `request` argument is set, then none of " 
    1154                "the individual field arguments should be set." 
    1155            ) 
    1156 
    1157        # - Use the request object if provided (there's no risk of modifying the input as 
    1158        #   there are no flattened fields), or create one. 
    1159        if not isinstance(request, logging_config.ListViewsRequest): 
    1160            request = logging_config.ListViewsRequest(request) 
    1161 
    1162        # If we have keyword arguments corresponding to fields on the 
    1163        # request, apply these. 
    1164        if parent is not None: 
    1165            request.parent = parent 
    1166 
    1167        # Wrap the RPC method; this adds retry and timeout information, 
    1168        # and friendly error handling. 
    1169        rpc = self._client._transport._wrapped_methods[ 
    1170            self._client._transport.list_views 
    1171        ] 
    1172 
    1173        # Certain fields should be provided within the metadata header; 
    1174        # add these here. 
    1175        metadata = tuple(metadata) + ( 
    1176            gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)), 
    1177        ) 
    1178 
    1179        # Validate the universe domain. 
    1180        self._client._validate_universe_domain() 
    1181 
    1182        # Send the request. 
    1183        response = await rpc( 
    1184            request, 
    1185            retry=retry, 
    1186            timeout=timeout, 
    1187            metadata=metadata, 
    1188        ) 
    1189 
    1190        # This method is paged; wrap the response in a pager, which provides 
    1191        # an `__aiter__` convenience method. 
    1192        response = pagers.ListViewsAsyncPager( 
    1193            method=rpc, 
    1194            request=request, 
    1195            response=response, 
    1196            retry=retry, 
    1197            timeout=timeout, 
    1198            metadata=metadata, 
    1199        ) 
    1200 
    1201        # Done; return the response. 
    1202        return response 
    1203 
    1204    async def get_view( 
    1205        self, 
    1206        request: Optional[Union[logging_config.GetViewRequest, dict]] = None, 
    1207        *, 
    1208        retry: OptionalRetry = gapic_v1.method.DEFAULT, 
    1209        timeout: Union[float, object] = gapic_v1.method.DEFAULT, 
    1210        metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), 
    1211    ) -> logging_config.LogView: 
    1212        r"""Gets a view on a log bucket.. 
    1213 
    1214        .. code-block:: python 
    1215 
    1216            # This snippet has been automatically generated and should be regarded as a 
    1217            # code template only. 
    1218            # It will require modifications to work: 
    1219            # - It may require correct/in-range values for request initialization. 
    1220            # - It may require specifying regional endpoints when creating the service 
    1221            #   client as shown in: 
    1222            #   https://googleapis.dev/python/google-api-core/latest/client_options.html 
    1223            from google.cloud import logging_v2 
    1224 
    1225            async def sample_get_view(): 
    1226                # Create a client 
    1227                client = logging_v2.ConfigServiceV2AsyncClient() 
    1228 
    1229                # Initialize request argument(s) 
    1230                request = logging_v2.GetViewRequest( 
    1231                    name="name_value", 
    1232                ) 
    1233 
    1234                # Make the request 
    1235                response = await client.get_view(request=request) 
    1236 
    1237                # Handle the response 
    1238                print(response) 
    1239 
    1240        Args: 
    1241            request (Optional[Union[google.cloud.logging_v2.types.GetViewRequest, dict]]): 
    1242                The request object. The parameters to ``GetView``. 
    1243            retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any, 
    1244                should be retried. 
    1245            timeout (float): The timeout for this request. 
    1246            metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be 
    1247                sent along with the request as metadata. Normally, each value must be of type `str`, 
    1248                but for metadata keys ending with the suffix `-bin`, the corresponding values must 
    1249                be of type `bytes`. 
    1250 
    1251        Returns: 
    1252            google.cloud.logging_v2.types.LogView: 
    1253                Describes a view over log entries in 
    1254                a bucket. 
    1255 
    1256        """ 
    1257        # Create or coerce a protobuf request object. 
    1258        # - Use the request object if provided (there's no risk of modifying the input as 
    1259        #   there are no flattened fields), or create one. 
    1260        if not isinstance(request, logging_config.GetViewRequest): 
    1261            request = logging_config.GetViewRequest(request) 
    1262 
    1263        # Wrap the RPC method; this adds retry and timeout information, 
    1264        # and friendly error handling. 
    1265        rpc = self._client._transport._wrapped_methods[self._client._transport.get_view] 
    1266 
    1267        # Certain fields should be provided within the metadata header; 
    1268        # add these here. 
    1269        metadata = tuple(metadata) + ( 
    1270            gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)), 
    1271        ) 
    1272 
    1273        # Validate the universe domain. 
    1274        self._client._validate_universe_domain() 
    1275 
    1276        # Send the request. 
    1277        response = await rpc( 
    1278            request, 
    1279            retry=retry, 
    1280            timeout=timeout, 
    1281            metadata=metadata, 
    1282        ) 
    1283 
    1284        # Done; return the response. 
    1285        return response 
    1286 
    1287    async def create_view( 
    1288        self, 
    1289        request: Optional[Union[logging_config.CreateViewRequest, dict]] = None, 
    1290        *, 
    1291        retry: OptionalRetry = gapic_v1.method.DEFAULT, 
    1292        timeout: Union[float, object] = gapic_v1.method.DEFAULT, 
    1293        metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), 
    1294    ) -> logging_config.LogView: 
    1295        r"""Creates a view over log entries in a log bucket. A 
    1296        bucket may contain a maximum of 30 views. 
    1297 
    1298        .. code-block:: python 
    1299 
    1300            # This snippet has been automatically generated and should be regarded as a 
    1301            # code template only. 
    1302            # It will require modifications to work: 
    1303            # - It may require correct/in-range values for request initialization. 
    1304            # - It may require specifying regional endpoints when creating the service 
    1305            #   client as shown in: 
    1306            #   https://googleapis.dev/python/google-api-core/latest/client_options.html 
    1307            from google.cloud import logging_v2 
    1308 
    1309            async def sample_create_view(): 
    1310                # Create a client 
    1311                client = logging_v2.ConfigServiceV2AsyncClient() 
    1312 
    1313                # Initialize request argument(s) 
    1314                request = logging_v2.CreateViewRequest( 
    1315                    parent="parent_value", 
    1316                    view_id="view_id_value", 
    1317                ) 
    1318 
    1319                # Make the request 
    1320                response = await client.create_view(request=request) 
    1321 
    1322                # Handle the response 
    1323                print(response) 
    1324 
    1325        Args: 
    1326            request (Optional[Union[google.cloud.logging_v2.types.CreateViewRequest, dict]]): 
    1327                The request object. The parameters to ``CreateView``. 
    1328            retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any, 
    1329                should be retried. 
    1330            timeout (float): The timeout for this request. 
    1331            metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be 
    1332                sent along with the request as metadata. Normally, each value must be of type `str`, 
    1333                but for metadata keys ending with the suffix `-bin`, the corresponding values must 
    1334                be of type `bytes`. 
    1335 
    1336        Returns: 
    1337            google.cloud.logging_v2.types.LogView: 
    1338                Describes a view over log entries in 
    1339                a bucket. 
    1340 
    1341        """ 
    1342        # Create or coerce a protobuf request object. 
    1343        # - Use the request object if provided (there's no risk of modifying the input as 
    1344        #   there are no flattened fields), or create one. 
    1345        if not isinstance(request, logging_config.CreateViewRequest): 
    1346            request = logging_config.CreateViewRequest(request) 
    1347 
    1348        # Wrap the RPC method; this adds retry and timeout information, 
    1349        # and friendly error handling. 
    1350        rpc = self._client._transport._wrapped_methods[ 
    1351            self._client._transport.create_view 
    1352        ] 
    1353 
    1354        # Certain fields should be provided within the metadata header; 
    1355        # add these here. 
    1356        metadata = tuple(metadata) + ( 
    1357            gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)), 
    1358        ) 
    1359 
    1360        # Validate the universe domain. 
    1361        self._client._validate_universe_domain() 
    1362 
    1363        # Send the request. 
    1364        response = await rpc( 
    1365            request, 
    1366            retry=retry, 
    1367            timeout=timeout, 
    1368            metadata=metadata, 
    1369        ) 
    1370 
    1371        # Done; return the response. 
    1372        return response 
    1373 
    1374    async def update_view( 
    1375        self, 
    1376        request: Optional[Union[logging_config.UpdateViewRequest, dict]] = None, 
    1377        *, 
    1378        retry: OptionalRetry = gapic_v1.method.DEFAULT, 
    1379        timeout: Union[float, object] = gapic_v1.method.DEFAULT, 
    1380        metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), 
    1381    ) -> logging_config.LogView: 
    1382        r"""Updates a view on a log bucket. This method replaces the 
    1383        following fields in the existing view with values from the new 
    1384        view: ``filter``. If an ``UNAVAILABLE`` error is returned, this 
    1385        indicates that system is not in a state where it can update the 
    1386        view. If this occurs, please try again in a few minutes. 
    1387 
    1388        .. code-block:: python 
    1389 
    1390            # This snippet has been automatically generated and should be regarded as a 
    1391            # code template only. 
    1392            # It will require modifications to work: 
    1393            # - It may require correct/in-range values for request initialization. 
    1394            # - It may require specifying regional endpoints when creating the service 
    1395            #   client as shown in: 
    1396            #   https://googleapis.dev/python/google-api-core/latest/client_options.html 
    1397            from google.cloud import logging_v2 
    1398 
    1399            async def sample_update_view(): 
    1400                # Create a client 
    1401                client = logging_v2.ConfigServiceV2AsyncClient() 
    1402 
    1403                # Initialize request argument(s) 
    1404                request = logging_v2.UpdateViewRequest( 
    1405                    name="name_value", 
    1406                ) 
    1407 
    1408                # Make the request 
    1409                response = await client.update_view(request=request) 
    1410 
    1411                # Handle the response 
    1412                print(response) 
    1413 
    1414        Args: 
    1415            request (Optional[Union[google.cloud.logging_v2.types.UpdateViewRequest, dict]]): 
    1416                The request object. The parameters to ``UpdateView``. 
    1417            retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any, 
    1418                should be retried. 
    1419            timeout (float): The timeout for this request. 
    1420            metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be 
    1421                sent along with the request as metadata. Normally, each value must be of type `str`, 
    1422                but for metadata keys ending with the suffix `-bin`, the corresponding values must 
    1423                be of type `bytes`. 
    1424 
    1425        Returns: 
    1426            google.cloud.logging_v2.types.LogView: 
    1427                Describes a view over log entries in 
    1428                a bucket. 
    1429 
    1430        """ 
    1431        # Create or coerce a protobuf request object. 
    1432        # - Use the request object if provided (there's no risk of modifying the input as 
    1433        #   there are no flattened fields), or create one. 
    1434        if not isinstance(request, logging_config.UpdateViewRequest): 
    1435            request = logging_config.UpdateViewRequest(request) 
    1436 
    1437        # Wrap the RPC method; this adds retry and timeout information, 
    1438        # and friendly error handling. 
    1439        rpc = self._client._transport._wrapped_methods[ 
    1440            self._client._transport.update_view 
    1441        ] 
    1442 
    1443        # Certain fields should be provided within the metadata header; 
    1444        # add these here. 
    1445        metadata = tuple(metadata) + ( 
    1446            gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)), 
    1447        ) 
    1448 
    1449        # Validate the universe domain. 
    1450        self._client._validate_universe_domain() 
    1451 
    1452        # Send the request. 
    1453        response = await rpc( 
    1454            request, 
    1455            retry=retry, 
    1456            timeout=timeout, 
    1457            metadata=metadata, 
    1458        ) 
    1459 
    1460        # Done; return the response. 
    1461        return response 
    1462 
    1463    async def delete_view( 
    1464        self, 
    1465        request: Optional[Union[logging_config.DeleteViewRequest, dict]] = None, 
    1466        *, 
    1467        retry: OptionalRetry = gapic_v1.method.DEFAULT, 
    1468        timeout: Union[float, object] = gapic_v1.method.DEFAULT, 
    1469        metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), 
    1470    ) -> None: 
    1471        r"""Deletes a view on a log bucket. If an ``UNAVAILABLE`` error is 
    1472        returned, this indicates that system is not in a state where it 
    1473        can delete the view. If this occurs, please try again in a few 
    1474        minutes. 
    1475 
    1476        .. code-block:: python 
    1477 
    1478            # This snippet has been automatically generated and should be regarded as a 
    1479            # code template only. 
    1480            # It will require modifications to work: 
    1481            # - It may require correct/in-range values for request initialization. 
    1482            # - It may require specifying regional endpoints when creating the service 
    1483            #   client as shown in: 
    1484            #   https://googleapis.dev/python/google-api-core/latest/client_options.html 
    1485            from google.cloud import logging_v2 
    1486 
    1487            async def sample_delete_view(): 
    1488                # Create a client 
    1489                client = logging_v2.ConfigServiceV2AsyncClient() 
    1490 
    1491                # Initialize request argument(s) 
    1492                request = logging_v2.DeleteViewRequest( 
    1493                    name="name_value", 
    1494                ) 
    1495 
    1496                # Make the request 
    1497                await client.delete_view(request=request) 
    1498 
    1499        Args: 
    1500            request (Optional[Union[google.cloud.logging_v2.types.DeleteViewRequest, dict]]): 
    1501                The request object. The parameters to ``DeleteView``. 
    1502            retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any, 
    1503                should be retried. 
    1504            timeout (float): The timeout for this request. 
    1505            metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be 
    1506                sent along with the request as metadata. Normally, each value must be of type `str`, 
    1507                but for metadata keys ending with the suffix `-bin`, the corresponding values must 
    1508                be of type `bytes`. 
    1509        """ 
    1510        # Create or coerce a protobuf request object. 
    1511        # - Use the request object if provided (there's no risk of modifying the input as 
    1512        #   there are no flattened fields), or create one. 
    1513        if not isinstance(request, logging_config.DeleteViewRequest): 
    1514            request = logging_config.DeleteViewRequest(request) 
    1515 
    1516        # Wrap the RPC method; this adds retry and timeout information, 
    1517        # and friendly error handling. 
    1518        rpc = self._client._transport._wrapped_methods[ 
    1519            self._client._transport.delete_view 
    1520        ] 
    1521 
    1522        # Certain fields should be provided within the metadata header; 
    1523        # add these here. 
    1524        metadata = tuple(metadata) + ( 
    1525            gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)), 
    1526        ) 
    1527 
    1528        # Validate the universe domain. 
    1529        self._client._validate_universe_domain() 
    1530 
    1531        # Send the request. 
    1532        await rpc( 
    1533            request, 
    1534            retry=retry, 
    1535            timeout=timeout, 
    1536            metadata=metadata, 
    1537        ) 
    1538 
    1539    async def list_sinks( 
    1540        self, 
    1541        request: Optional[Union[logging_config.ListSinksRequest, dict]] = None, 
    1542        *, 
    1543        parent: Optional[str] = None, 
    1544        retry: OptionalRetry = gapic_v1.method.DEFAULT, 
    1545        timeout: Union[float, object] = gapic_v1.method.DEFAULT, 
    1546        metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), 
    1547    ) -> pagers.ListSinksAsyncPager: 
    1548        r"""Lists sinks. 
    1549 
    1550        .. code-block:: python 
    1551 
    1552            # This snippet has been automatically generated and should be regarded as a 
    1553            # code template only. 
    1554            # It will require modifications to work: 
    1555            # - It may require correct/in-range values for request initialization. 
    1556            # - It may require specifying regional endpoints when creating the service 
    1557            #   client as shown in: 
    1558            #   https://googleapis.dev/python/google-api-core/latest/client_options.html 
    1559            from google.cloud import logging_v2 
    1560 
    1561            async def sample_list_sinks(): 
    1562                # Create a client 
    1563                client = logging_v2.ConfigServiceV2AsyncClient() 
    1564 
    1565                # Initialize request argument(s) 
    1566                request = logging_v2.ListSinksRequest( 
    1567                    parent="parent_value", 
    1568                ) 
    1569 
    1570                # Make the request 
    1571                page_result = client.list_sinks(request=request) 
    1572 
    1573                # Handle the response 
    1574                async for response in page_result: 
    1575                    print(response) 
    1576 
    1577        Args: 
    1578            request (Optional[Union[google.cloud.logging_v2.types.ListSinksRequest, dict]]): 
    1579                The request object. The parameters to ``ListSinks``. 
    1580            parent (:class:`str`): 
    1581                Required. The parent resource whose sinks are to be 
    1582                listed: 
    1583 
    1584                :: 
    1585 
    1586                    "projects/[PROJECT_ID]" 
    1587                    "organizations/[ORGANIZATION_ID]" 
    1588                    "billingAccounts/[BILLING_ACCOUNT_ID]" 
    1589                    "folders/[FOLDER_ID]" 
    1590 
    1591                This corresponds to the ``parent`` field 
    1592                on the ``request`` instance; if ``request`` is provided, this 
    1593                should not be set. 
    1594            retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any, 
    1595                should be retried. 
    1596            timeout (float): The timeout for this request. 
    1597            metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be 
    1598                sent along with the request as metadata. Normally, each value must be of type `str`, 
    1599                but for metadata keys ending with the suffix `-bin`, the corresponding values must 
    1600                be of type `bytes`. 
    1601 
    1602        Returns: 
    1603            google.cloud.logging_v2.services.config_service_v2.pagers.ListSinksAsyncPager: 
    1604                Result returned from ListSinks. 
    1605 
    1606                Iterating over this object will yield results and 
    1607                resolve additional pages automatically. 
    1608 
    1609        """ 
    1610        # Create or coerce a protobuf request object. 
    1611        # - Quick check: If we got a request object, we should *not* have 
    1612        #   gotten any keyword arguments that map to the request. 
    1613        flattened_params = [parent] 
    1614        has_flattened_params = ( 
    1615            len([param for param in flattened_params if param is not None]) > 0 
    1616        ) 
    1617        if request is not None and has_flattened_params: 
    1618            raise ValueError( 
    1619                "If the `request` argument is set, then none of " 
    1620                "the individual field arguments should be set." 
    1621            ) 
    1622 
    1623        # - Use the request object if provided (there's no risk of modifying the input as 
    1624        #   there are no flattened fields), or create one. 
    1625        if not isinstance(request, logging_config.ListSinksRequest): 
    1626            request = logging_config.ListSinksRequest(request) 
    1627 
    1628        # If we have keyword arguments corresponding to fields on the 
    1629        # request, apply these. 
    1630        if parent is not None: 
    1631            request.parent = parent 
    1632 
    1633        # Wrap the RPC method; this adds retry and timeout information, 
    1634        # and friendly error handling. 
    1635        rpc = self._client._transport._wrapped_methods[ 
    1636            self._client._transport.list_sinks 
    1637        ] 
    1638 
    1639        # Certain fields should be provided within the metadata header; 
    1640        # add these here. 
    1641        metadata = tuple(metadata) + ( 
    1642            gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)), 
    1643        ) 
    1644 
    1645        # Validate the universe domain. 
    1646        self._client._validate_universe_domain() 
    1647 
    1648        # Send the request. 
    1649        response = await rpc( 
    1650            request, 
    1651            retry=retry, 
    1652            timeout=timeout, 
    1653            metadata=metadata, 
    1654        ) 
    1655 
    1656        # This method is paged; wrap the response in a pager, which provides 
    1657        # an `__aiter__` convenience method. 
    1658        response = pagers.ListSinksAsyncPager( 
    1659            method=rpc, 
    1660            request=request, 
    1661            response=response, 
    1662            retry=retry, 
    1663            timeout=timeout, 
    1664            metadata=metadata, 
    1665        ) 
    1666 
    1667        # Done; return the response. 
    1668        return response 
    1669 
    1670    async def get_sink( 
    1671        self, 
    1672        request: Optional[Union[logging_config.GetSinkRequest, dict]] = None, 
    1673        *, 
    1674        sink_name: Optional[str] = None, 
    1675        retry: OptionalRetry = gapic_v1.method.DEFAULT, 
    1676        timeout: Union[float, object] = gapic_v1.method.DEFAULT, 
    1677        metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), 
    1678    ) -> logging_config.LogSink: 
    1679        r"""Gets a sink. 
    1680 
    1681        .. code-block:: python 
    1682 
    1683            # This snippet has been automatically generated and should be regarded as a 
    1684            # code template only. 
    1685            # It will require modifications to work: 
    1686            # - It may require correct/in-range values for request initialization. 
    1687            # - It may require specifying regional endpoints when creating the service 
    1688            #   client as shown in: 
    1689            #   https://googleapis.dev/python/google-api-core/latest/client_options.html 
    1690            from google.cloud import logging_v2 
    1691 
    1692            async def sample_get_sink(): 
    1693                # Create a client 
    1694                client = logging_v2.ConfigServiceV2AsyncClient() 
    1695 
    1696                # Initialize request argument(s) 
    1697                request = logging_v2.GetSinkRequest( 
    1698                    sink_name="sink_name_value", 
    1699                ) 
    1700 
    1701                # Make the request 
    1702                response = await client.get_sink(request=request) 
    1703 
    1704                # Handle the response 
    1705                print(response) 
    1706 
    1707        Args: 
    1708            request (Optional[Union[google.cloud.logging_v2.types.GetSinkRequest, dict]]): 
    1709                The request object. The parameters to ``GetSink``. 
    1710            sink_name (:class:`str`): 
    1711                Required. The resource name of the sink: 
    1712 
    1713                :: 
    1714 
    1715                    "projects/[PROJECT_ID]/sinks/[SINK_ID]" 
    1716                    "organizations/[ORGANIZATION_ID]/sinks/[SINK_ID]" 
    1717                    "billingAccounts/[BILLING_ACCOUNT_ID]/sinks/[SINK_ID]" 
    1718                    "folders/[FOLDER_ID]/sinks/[SINK_ID]" 
    1719 
    1720                For example: 
    1721 
    1722                ``"projects/my-project/sinks/my-sink"`` 
    1723 
    1724                This corresponds to the ``sink_name`` field 
    1725                on the ``request`` instance; if ``request`` is provided, this 
    1726                should not be set. 
    1727            retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any, 
    1728                should be retried. 
    1729            timeout (float): The timeout for this request. 
    1730            metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be 
    1731                sent along with the request as metadata. Normally, each value must be of type `str`, 
    1732                but for metadata keys ending with the suffix `-bin`, the corresponding values must 
    1733                be of type `bytes`. 
    1734 
    1735        Returns: 
    1736            google.cloud.logging_v2.types.LogSink: 
    1737                Describes a sink used to export log 
    1738                entries to one of the following 
    1739                destinations in any project: a Cloud 
    1740                Storage bucket, a BigQuery dataset, a 
    1741                Pub/Sub topic or a Cloud Logging log 
    1742                bucket. A logs filter controls which log 
    1743                entries are exported. The sink must be 
    1744                created within a project, organization, 
    1745                billing account, or folder. 
    1746 
    1747        """ 
    1748        # Create or coerce a protobuf request object. 
    1749        # - Quick check: If we got a request object, we should *not* have 
    1750        #   gotten any keyword arguments that map to the request. 
    1751        flattened_params = [sink_name] 
    1752        has_flattened_params = ( 
    1753            len([param for param in flattened_params if param is not None]) > 0 
    1754        ) 
    1755        if request is not None and has_flattened_params: 
    1756            raise ValueError( 
    1757                "If the `request` argument is set, then none of " 
    1758                "the individual field arguments should be set." 
    1759            ) 
    1760 
    1761        # - Use the request object if provided (there's no risk of modifying the input as 
    1762        #   there are no flattened fields), or create one. 
    1763        if not isinstance(request, logging_config.GetSinkRequest): 
    1764            request = logging_config.GetSinkRequest(request) 
    1765 
    1766        # If we have keyword arguments corresponding to fields on the 
    1767        # request, apply these. 
    1768        if sink_name is not None: 
    1769            request.sink_name = sink_name 
    1770 
    1771        # Wrap the RPC method; this adds retry and timeout information, 
    1772        # and friendly error handling. 
    1773        rpc = self._client._transport._wrapped_methods[self._client._transport.get_sink] 
    1774 
    1775        # Certain fields should be provided within the metadata header; 
    1776        # add these here. 
    1777        metadata = tuple(metadata) + ( 
    1778            gapic_v1.routing_header.to_grpc_metadata( 
    1779                (("sink_name", request.sink_name),) 
    1780            ), 
    1781        ) 
    1782 
    1783        # Validate the universe domain. 
    1784        self._client._validate_universe_domain() 
    1785 
    1786        # Send the request. 
    1787        response = await rpc( 
    1788            request, 
    1789            retry=retry, 
    1790            timeout=timeout, 
    1791            metadata=metadata, 
    1792        ) 
    1793 
    1794        # Done; return the response. 
    1795        return response 
    1796 
    1797    async def create_sink( 
    1798        self, 
    1799        request: Optional[Union[logging_config.CreateSinkRequest, dict]] = None, 
    1800        *, 
    1801        parent: Optional[str] = None, 
    1802        sink: Optional[logging_config.LogSink] = None, 
    1803        retry: OptionalRetry = gapic_v1.method.DEFAULT, 
    1804        timeout: Union[float, object] = gapic_v1.method.DEFAULT, 
    1805        metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), 
    1806    ) -> logging_config.LogSink: 
    1807        r"""Creates a sink that exports specified log entries to a 
    1808        destination. The export of newly-ingested log entries begins 
    1809        immediately, unless the sink's ``writer_identity`` is not 
    1810        permitted to write to the destination. A sink can export log 
    1811        entries only from the resource owning the sink. 
    1812 
    1813        .. code-block:: python 
    1814 
    1815            # This snippet has been automatically generated and should be regarded as a 
    1816            # code template only. 
    1817            # It will require modifications to work: 
    1818            # - It may require correct/in-range values for request initialization. 
    1819            # - It may require specifying regional endpoints when creating the service 
    1820            #   client as shown in: 
    1821            #   https://googleapis.dev/python/google-api-core/latest/client_options.html 
    1822            from google.cloud import logging_v2 
    1823 
    1824            async def sample_create_sink(): 
    1825                # Create a client 
    1826                client = logging_v2.ConfigServiceV2AsyncClient() 
    1827 
    1828                # Initialize request argument(s) 
    1829                sink = logging_v2.LogSink() 
    1830                sink.name = "name_value" 
    1831                sink.destination = "destination_value" 
    1832 
    1833                request = logging_v2.CreateSinkRequest( 
    1834                    parent="parent_value", 
    1835                    sink=sink, 
    1836                ) 
    1837 
    1838                # Make the request 
    1839                response = await client.create_sink(request=request) 
    1840 
    1841                # Handle the response 
    1842                print(response) 
    1843 
    1844        Args: 
    1845            request (Optional[Union[google.cloud.logging_v2.types.CreateSinkRequest, dict]]): 
    1846                The request object. The parameters to ``CreateSink``. 
    1847            parent (:class:`str`): 
    1848                Required. The resource in which to create the sink: 
    1849 
    1850                :: 
    1851 
    1852                    "projects/[PROJECT_ID]" 
    1853                    "organizations/[ORGANIZATION_ID]" 
    1854                    "billingAccounts/[BILLING_ACCOUNT_ID]" 
    1855                    "folders/[FOLDER_ID]" 
    1856 
    1857                For examples: 
    1858 
    1859                ``"projects/my-project"`` ``"organizations/123456789"`` 
    1860 
    1861                This corresponds to the ``parent`` field 
    1862                on the ``request`` instance; if ``request`` is provided, this 
    1863                should not be set. 
    1864            sink (:class:`google.cloud.logging_v2.types.LogSink`): 
    1865                Required. The new sink, whose ``name`` parameter is a 
    1866                sink identifier that is not already in use. 
    1867 
    1868                This corresponds to the ``sink`` field 
    1869                on the ``request`` instance; if ``request`` is provided, this 
    1870                should not be set. 
    1871            retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any, 
    1872                should be retried. 
    1873            timeout (float): The timeout for this request. 
    1874            metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be 
    1875                sent along with the request as metadata. Normally, each value must be of type `str`, 
    1876                but for metadata keys ending with the suffix `-bin`, the corresponding values must 
    1877                be of type `bytes`. 
    1878 
    1879        Returns: 
    1880            google.cloud.logging_v2.types.LogSink: 
    1881                Describes a sink used to export log 
    1882                entries to one of the following 
    1883                destinations in any project: a Cloud 
    1884                Storage bucket, a BigQuery dataset, a 
    1885                Pub/Sub topic or a Cloud Logging log 
    1886                bucket. A logs filter controls which log 
    1887                entries are exported. The sink must be 
    1888                created within a project, organization, 
    1889                billing account, or folder. 
    1890 
    1891        """ 
    1892        # Create or coerce a protobuf request object. 
    1893        # - Quick check: If we got a request object, we should *not* have 
    1894        #   gotten any keyword arguments that map to the request. 
    1895        flattened_params = [parent, sink] 
    1896        has_flattened_params = ( 
    1897            len([param for param in flattened_params if param is not None]) > 0 
    1898        ) 
    1899        if request is not None and has_flattened_params: 
    1900            raise ValueError( 
    1901                "If the `request` argument is set, then none of " 
    1902                "the individual field arguments should be set." 
    1903            ) 
    1904 
    1905        # - Use the request object if provided (there's no risk of modifying the input as 
    1906        #   there are no flattened fields), or create one. 
    1907        if not isinstance(request, logging_config.CreateSinkRequest): 
    1908            request = logging_config.CreateSinkRequest(request) 
    1909 
    1910        # If we have keyword arguments corresponding to fields on the 
    1911        # request, apply these. 
    1912        if parent is not None: 
    1913            request.parent = parent 
    1914        if sink is not None: 
    1915            request.sink = sink 
    1916 
    1917        # Wrap the RPC method; this adds retry and timeout information, 
    1918        # and friendly error handling. 
    1919        rpc = self._client._transport._wrapped_methods[ 
    1920            self._client._transport.create_sink 
    1921        ] 
    1922 
    1923        # Certain fields should be provided within the metadata header; 
    1924        # add these here. 
    1925        metadata = tuple(metadata) + ( 
    1926            gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)), 
    1927        ) 
    1928 
    1929        # Validate the universe domain. 
    1930        self._client._validate_universe_domain() 
    1931 
    1932        # Send the request. 
    1933        response = await rpc( 
    1934            request, 
    1935            retry=retry, 
    1936            timeout=timeout, 
    1937            metadata=metadata, 
    1938        ) 
    1939 
    1940        # Done; return the response. 
    1941        return response 
    1942 
    1943    async def update_sink( 
    1944        self, 
    1945        request: Optional[Union[logging_config.UpdateSinkRequest, dict]] = None, 
    1946        *, 
    1947        sink_name: Optional[str] = None, 
    1948        sink: Optional[logging_config.LogSink] = None, 
    1949        update_mask: Optional[field_mask_pb2.FieldMask] = None, 
    1950        retry: OptionalRetry = gapic_v1.method.DEFAULT, 
    1951        timeout: Union[float, object] = gapic_v1.method.DEFAULT, 
    1952        metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), 
    1953    ) -> logging_config.LogSink: 
    1954        r"""Updates a sink. This method replaces the following fields in the 
    1955        existing sink with values from the new sink: ``destination``, 
    1956        and ``filter``. 
    1957 
    1958        The updated sink might also have a new ``writer_identity``; see 
    1959        the ``unique_writer_identity`` field. 
    1960 
    1961        .. code-block:: python 
    1962 
    1963            # This snippet has been automatically generated and should be regarded as a 
    1964            # code template only. 
    1965            # It will require modifications to work: 
    1966            # - It may require correct/in-range values for request initialization. 
    1967            # - It may require specifying regional endpoints when creating the service 
    1968            #   client as shown in: 
    1969            #   https://googleapis.dev/python/google-api-core/latest/client_options.html 
    1970            from google.cloud import logging_v2 
    1971 
    1972            async def sample_update_sink(): 
    1973                # Create a client 
    1974                client = logging_v2.ConfigServiceV2AsyncClient() 
    1975 
    1976                # Initialize request argument(s) 
    1977                sink = logging_v2.LogSink() 
    1978                sink.name = "name_value" 
    1979                sink.destination = "destination_value" 
    1980 
    1981                request = logging_v2.UpdateSinkRequest( 
    1982                    sink_name="sink_name_value", 
    1983                    sink=sink, 
    1984                ) 
    1985 
    1986                # Make the request 
    1987                response = await client.update_sink(request=request) 
    1988 
    1989                # Handle the response 
    1990                print(response) 
    1991 
    1992        Args: 
    1993            request (Optional[Union[google.cloud.logging_v2.types.UpdateSinkRequest, dict]]): 
    1994                The request object. The parameters to ``UpdateSink``. 
    1995            sink_name (:class:`str`): 
    1996                Required. The full resource name of the sink to update, 
    1997                including the parent resource and the sink identifier: 
    1998 
    1999                :: 
    2000 
    2001                    "projects/[PROJECT_ID]/sinks/[SINK_ID]" 
    2002                    "organizations/[ORGANIZATION_ID]/sinks/[SINK_ID]" 
    2003                    "billingAccounts/[BILLING_ACCOUNT_ID]/sinks/[SINK_ID]" 
    2004                    "folders/[FOLDER_ID]/sinks/[SINK_ID]" 
    2005 
    2006                For example: 
    2007 
    2008                ``"projects/my-project/sinks/my-sink"`` 
    2009 
    2010                This corresponds to the ``sink_name`` field 
    2011                on the ``request`` instance; if ``request`` is provided, this 
    2012                should not be set. 
    2013            sink (:class:`google.cloud.logging_v2.types.LogSink`): 
    2014                Required. The updated sink, whose name is the same 
    2015                identifier that appears as part of ``sink_name``. 
    2016 
    2017                This corresponds to the ``sink`` field 
    2018                on the ``request`` instance; if ``request`` is provided, this 
    2019                should not be set. 
    2020            update_mask (:class:`google.protobuf.field_mask_pb2.FieldMask`): 
    2021                Optional. Field mask that specifies the fields in 
    2022                ``sink`` that need an update. A sink field will be 
    2023                overwritten if, and only if, it is in the update mask. 
    2024                ``name`` and output only fields cannot be updated. 
    2025 
    2026                An empty ``updateMask`` is temporarily treated as using 
    2027                the following mask for backwards compatibility purposes: 
    2028 
    2029                ``destination,filter,includeChildren`` 
    2030 
    2031                At some point in the future, behavior will be removed 
    2032                and specifying an empty ``updateMask`` will be an error. 
    2033 
    2034                For a detailed ``FieldMask`` definition, see 
    2035                https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#google.protobuf.FieldMask 
    2036 
    2037                For example: ``updateMask=filter`` 
    2038 
    2039                This corresponds to the ``update_mask`` field 
    2040                on the ``request`` instance; if ``request`` is provided, this 
    2041                should not be set. 
    2042            retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any, 
    2043                should be retried. 
    2044            timeout (float): The timeout for this request. 
    2045            metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be 
    2046                sent along with the request as metadata. Normally, each value must be of type `str`, 
    2047                but for metadata keys ending with the suffix `-bin`, the corresponding values must 
    2048                be of type `bytes`. 
    2049 
    2050        Returns: 
    2051            google.cloud.logging_v2.types.LogSink: 
    2052                Describes a sink used to export log 
    2053                entries to one of the following 
    2054                destinations in any project: a Cloud 
    2055                Storage bucket, a BigQuery dataset, a 
    2056                Pub/Sub topic or a Cloud Logging log 
    2057                bucket. A logs filter controls which log 
    2058                entries are exported. The sink must be 
    2059                created within a project, organization, 
    2060                billing account, or folder. 
    2061 
    2062        """ 
    2063        # Create or coerce a protobuf request object. 
    2064        # - Quick check: If we got a request object, we should *not* have 
    2065        #   gotten any keyword arguments that map to the request. 
    2066        flattened_params = [sink_name, sink, update_mask] 
    2067        has_flattened_params = ( 
    2068            len([param for param in flattened_params if param is not None]) > 0 
    2069        ) 
    2070        if request is not None and has_flattened_params: 
    2071            raise ValueError( 
    2072                "If the `request` argument is set, then none of " 
    2073                "the individual field arguments should be set." 
    2074            ) 
    2075 
    2076        # - Use the request object if provided (there's no risk of modifying the input as 
    2077        #   there are no flattened fields), or create one. 
    2078        if not isinstance(request, logging_config.UpdateSinkRequest): 
    2079            request = logging_config.UpdateSinkRequest(request) 
    2080 
    2081        # If we have keyword arguments corresponding to fields on the 
    2082        # request, apply these. 
    2083        if sink_name is not None: 
    2084            request.sink_name = sink_name 
    2085        if sink is not None: 
    2086            request.sink = sink 
    2087        if update_mask is not None: 
    2088            request.update_mask = update_mask 
    2089 
    2090        # Wrap the RPC method; this adds retry and timeout information, 
    2091        # and friendly error handling. 
    2092        rpc = self._client._transport._wrapped_methods[ 
    2093            self._client._transport.update_sink 
    2094        ] 
    2095 
    2096        # Certain fields should be provided within the metadata header; 
    2097        # add these here. 
    2098        metadata = tuple(metadata) + ( 
    2099            gapic_v1.routing_header.to_grpc_metadata( 
    2100                (("sink_name", request.sink_name),) 
    2101            ), 
    2102        ) 
    2103 
    2104        # Validate the universe domain. 
    2105        self._client._validate_universe_domain() 
    2106 
    2107        # Send the request. 
    2108        response = await rpc( 
    2109            request, 
    2110            retry=retry, 
    2111            timeout=timeout, 
    2112            metadata=metadata, 
    2113        ) 
    2114 
    2115        # Done; return the response. 
    2116        return response 
    2117 
    2118    async def delete_sink( 
    2119        self, 
    2120        request: Optional[Union[logging_config.DeleteSinkRequest, dict]] = None, 
    2121        *, 
    2122        sink_name: Optional[str] = None, 
    2123        retry: OptionalRetry = gapic_v1.method.DEFAULT, 
    2124        timeout: Union[float, object] = gapic_v1.method.DEFAULT, 
    2125        metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), 
    2126    ) -> None: 
    2127        r"""Deletes a sink. If the sink has a unique ``writer_identity``, 
    2128        then that service account is also deleted. 
    2129 
    2130        .. code-block:: python 
    2131 
    2132            # This snippet has been automatically generated and should be regarded as a 
    2133            # code template only. 
    2134            # It will require modifications to work: 
    2135            # - It may require correct/in-range values for request initialization. 
    2136            # - It may require specifying regional endpoints when creating the service 
    2137            #   client as shown in: 
    2138            #   https://googleapis.dev/python/google-api-core/latest/client_options.html 
    2139            from google.cloud import logging_v2 
    2140 
    2141            async def sample_delete_sink(): 
    2142                # Create a client 
    2143                client = logging_v2.ConfigServiceV2AsyncClient() 
    2144 
    2145                # Initialize request argument(s) 
    2146                request = logging_v2.DeleteSinkRequest( 
    2147                    sink_name="sink_name_value", 
    2148                ) 
    2149 
    2150                # Make the request 
    2151                await client.delete_sink(request=request) 
    2152 
    2153        Args: 
    2154            request (Optional[Union[google.cloud.logging_v2.types.DeleteSinkRequest, dict]]): 
    2155                The request object. The parameters to ``DeleteSink``. 
    2156            sink_name (:class:`str`): 
    2157                Required. The full resource name of the sink to delete, 
    2158                including the parent resource and the sink identifier: 
    2159 
    2160                :: 
    2161 
    2162                    "projects/[PROJECT_ID]/sinks/[SINK_ID]" 
    2163                    "organizations/[ORGANIZATION_ID]/sinks/[SINK_ID]" 
    2164                    "billingAccounts/[BILLING_ACCOUNT_ID]/sinks/[SINK_ID]" 
    2165                    "folders/[FOLDER_ID]/sinks/[SINK_ID]" 
    2166 
    2167                For example: 
    2168 
    2169                ``"projects/my-project/sinks/my-sink"`` 
    2170 
    2171                This corresponds to the ``sink_name`` field 
    2172                on the ``request`` instance; if ``request`` is provided, this 
    2173                should not be set. 
    2174            retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any, 
    2175                should be retried. 
    2176            timeout (float): The timeout for this request. 
    2177            metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be 
    2178                sent along with the request as metadata. Normally, each value must be of type `str`, 
    2179                but for metadata keys ending with the suffix `-bin`, the corresponding values must 
    2180                be of type `bytes`. 
    2181        """ 
    2182        # Create or coerce a protobuf request object. 
    2183        # - Quick check: If we got a request object, we should *not* have 
    2184        #   gotten any keyword arguments that map to the request. 
    2185        flattened_params = [sink_name] 
    2186        has_flattened_params = ( 
    2187            len([param for param in flattened_params if param is not None]) > 0 
    2188        ) 
    2189        if request is not None and has_flattened_params: 
    2190            raise ValueError( 
    2191                "If the `request` argument is set, then none of " 
    2192                "the individual field arguments should be set." 
    2193            ) 
    2194 
    2195        # - Use the request object if provided (there's no risk of modifying the input as 
    2196        #   there are no flattened fields), or create one. 
    2197        if not isinstance(request, logging_config.DeleteSinkRequest): 
    2198            request = logging_config.DeleteSinkRequest(request) 
    2199 
    2200        # If we have keyword arguments corresponding to fields on the 
    2201        # request, apply these. 
    2202        if sink_name is not None: 
    2203            request.sink_name = sink_name 
    2204 
    2205        # Wrap the RPC method; this adds retry and timeout information, 
    2206        # and friendly error handling. 
    2207        rpc = self._client._transport._wrapped_methods[ 
    2208            self._client._transport.delete_sink 
    2209        ] 
    2210 
    2211        # Certain fields should be provided within the metadata header; 
    2212        # add these here. 
    2213        metadata = tuple(metadata) + ( 
    2214            gapic_v1.routing_header.to_grpc_metadata( 
    2215                (("sink_name", request.sink_name),) 
    2216            ), 
    2217        ) 
    2218 
    2219        # Validate the universe domain. 
    2220        self._client._validate_universe_domain() 
    2221 
    2222        # Send the request. 
    2223        await rpc( 
    2224            request, 
    2225            retry=retry, 
    2226            timeout=timeout, 
    2227            metadata=metadata, 
    2228        ) 
    2229 
    2230    async def create_link( 
    2231        self, 
    2232        request: Optional[Union[logging_config.CreateLinkRequest, dict]] = None, 
    2233        *, 
    2234        parent: Optional[str] = None, 
    2235        link: Optional[logging_config.Link] = None, 
    2236        link_id: Optional[str] = None, 
    2237        retry: OptionalRetry = gapic_v1.method.DEFAULT, 
    2238        timeout: Union[float, object] = gapic_v1.method.DEFAULT, 
    2239        metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), 
    2240    ) -> operation_async.AsyncOperation: 
    2241        r"""Asynchronously creates a linked dataset in BigQuery 
    2242        which makes it possible to use BigQuery to read the logs 
    2243        stored in the log bucket. A log bucket may currently 
    2244        only contain one link. 
    2245 
    2246        .. code-block:: python 
    2247 
    2248            # This snippet has been automatically generated and should be regarded as a 
    2249            # code template only. 
    2250            # It will require modifications to work: 
    2251            # - It may require correct/in-range values for request initialization. 
    2252            # - It may require specifying regional endpoints when creating the service 
    2253            #   client as shown in: 
    2254            #   https://googleapis.dev/python/google-api-core/latest/client_options.html 
    2255            from google.cloud import logging_v2 
    2256 
    2257            async def sample_create_link(): 
    2258                # Create a client 
    2259                client = logging_v2.ConfigServiceV2AsyncClient() 
    2260 
    2261                # Initialize request argument(s) 
    2262                request = logging_v2.CreateLinkRequest( 
    2263                    parent="parent_value", 
    2264                    link_id="link_id_value", 
    2265                ) 
    2266 
    2267                # Make the request 
    2268                operation = client.create_link(request=request) 
    2269 
    2270                print("Waiting for operation to complete...") 
    2271 
    2272                response = (await operation).result() 
    2273 
    2274                # Handle the response 
    2275                print(response) 
    2276 
    2277        Args: 
    2278            request (Optional[Union[google.cloud.logging_v2.types.CreateLinkRequest, dict]]): 
    2279                The request object. The parameters to CreateLink. 
    2280            parent (:class:`str`): 
    2281                Required. The full resource name of the bucket to create 
    2282                a link for. 
    2283 
    2284                :: 
    2285 
    2286                    "projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" 
    2287                    "organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" 
    2288                    "billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" 
    2289                    "folders/[FOLDER_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" 
    2290 
    2291                This corresponds to the ``parent`` field 
    2292                on the ``request`` instance; if ``request`` is provided, this 
    2293                should not be set. 
    2294            link (:class:`google.cloud.logging_v2.types.Link`): 
    2295                Required. The new link. 
    2296                This corresponds to the ``link`` field 
    2297                on the ``request`` instance; if ``request`` is provided, this 
    2298                should not be set. 
    2299            link_id (:class:`str`): 
    2300                Required. The ID to use for the link. The link_id can 
    2301                have up to 100 characters. A valid link_id must only 
    2302                have alphanumeric characters and underscores within it. 
    2303 
    2304                This corresponds to the ``link_id`` field 
    2305                on the ``request`` instance; if ``request`` is provided, this 
    2306                should not be set. 
    2307            retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any, 
    2308                should be retried. 
    2309            timeout (float): The timeout for this request. 
    2310            metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be 
    2311                sent along with the request as metadata. Normally, each value must be of type `str`, 
    2312                but for metadata keys ending with the suffix `-bin`, the corresponding values must 
    2313                be of type `bytes`. 
    2314 
    2315        Returns: 
    2316            google.api_core.operation_async.AsyncOperation: 
    2317                An object representing a long-running operation. 
    2318 
    2319                The result type for the operation will be 
    2320                :class:`google.cloud.logging_v2.types.Link` Describes a 
    2321                link connected to an analytics enabled bucket. 
    2322 
    2323        """ 
    2324        # Create or coerce a protobuf request object. 
    2325        # - Quick check: If we got a request object, we should *not* have 
    2326        #   gotten any keyword arguments that map to the request. 
    2327        flattened_params = [parent, link, link_id] 
    2328        has_flattened_params = ( 
    2329            len([param for param in flattened_params if param is not None]) > 0 
    2330        ) 
    2331        if request is not None and has_flattened_params: 
    2332            raise ValueError( 
    2333                "If the `request` argument is set, then none of " 
    2334                "the individual field arguments should be set." 
    2335            ) 
    2336 
    2337        # - Use the request object if provided (there's no risk of modifying the input as 
    2338        #   there are no flattened fields), or create one. 
    2339        if not isinstance(request, logging_config.CreateLinkRequest): 
    2340            request = logging_config.CreateLinkRequest(request) 
    2341 
    2342        # If we have keyword arguments corresponding to fields on the 
    2343        # request, apply these. 
    2344        if parent is not None: 
    2345            request.parent = parent 
    2346        if link is not None: 
    2347            request.link = link 
    2348        if link_id is not None: 
    2349            request.link_id = link_id 
    2350 
    2351        # Wrap the RPC method; this adds retry and timeout information, 
    2352        # and friendly error handling. 
    2353        rpc = self._client._transport._wrapped_methods[ 
    2354            self._client._transport.create_link 
    2355        ] 
    2356 
    2357        # Certain fields should be provided within the metadata header; 
    2358        # add these here. 
    2359        metadata = tuple(metadata) + ( 
    2360            gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)), 
    2361        ) 
    2362 
    2363        # Validate the universe domain. 
    2364        self._client._validate_universe_domain() 
    2365 
    2366        # Send the request. 
    2367        response = await rpc( 
    2368            request, 
    2369            retry=retry, 
    2370            timeout=timeout, 
    2371            metadata=metadata, 
    2372        ) 
    2373 
    2374        # Wrap the response in an operation future. 
    2375        response = operation_async.from_gapic( 
    2376            response, 
    2377            self._client._transport.operations_client, 
    2378            logging_config.Link, 
    2379            metadata_type=logging_config.LinkMetadata, 
    2380        ) 
    2381 
    2382        # Done; return the response. 
    2383        return response 
    2384 
    2385    async def delete_link( 
    2386        self, 
    2387        request: Optional[Union[logging_config.DeleteLinkRequest, dict]] = None, 
    2388        *, 
    2389        name: Optional[str] = None, 
    2390        retry: OptionalRetry = gapic_v1.method.DEFAULT, 
    2391        timeout: Union[float, object] = gapic_v1.method.DEFAULT, 
    2392        metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), 
    2393    ) -> operation_async.AsyncOperation: 
    2394        r"""Deletes a link. This will also delete the 
    2395        corresponding BigQuery linked dataset. 
    2396 
    2397        .. code-block:: python 
    2398 
    2399            # This snippet has been automatically generated and should be regarded as a 
    2400            # code template only. 
    2401            # It will require modifications to work: 
    2402            # - It may require correct/in-range values for request initialization. 
    2403            # - It may require specifying regional endpoints when creating the service 
    2404            #   client as shown in: 
    2405            #   https://googleapis.dev/python/google-api-core/latest/client_options.html 
    2406            from google.cloud import logging_v2 
    2407 
    2408            async def sample_delete_link(): 
    2409                # Create a client 
    2410                client = logging_v2.ConfigServiceV2AsyncClient() 
    2411 
    2412                # Initialize request argument(s) 
    2413                request = logging_v2.DeleteLinkRequest( 
    2414                    name="name_value", 
    2415                ) 
    2416 
    2417                # Make the request 
    2418                operation = client.delete_link(request=request) 
    2419 
    2420                print("Waiting for operation to complete...") 
    2421 
    2422                response = (await operation).result() 
    2423 
    2424                # Handle the response 
    2425                print(response) 
    2426 
    2427        Args: 
    2428            request (Optional[Union[google.cloud.logging_v2.types.DeleteLinkRequest, dict]]): 
    2429                The request object. The parameters to DeleteLink. 
    2430            name (:class:`str`): 
    2431                Required. The full resource name of the link to delete. 
    2432 
    2433                "projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/links/[LINK_ID]" 
    2434                "organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/links/[LINK_ID]" 
    2435                "billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/links/[LINK_ID]" 
    2436                "folders/[FOLDER_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/links/[LINK_ID]" 
    2437 
    2438                This corresponds to the ``name`` field 
    2439                on the ``request`` instance; if ``request`` is provided, this 
    2440                should not be set. 
    2441            retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any, 
    2442                should be retried. 
    2443            timeout (float): The timeout for this request. 
    2444            metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be 
    2445                sent along with the request as metadata. Normally, each value must be of type `str`, 
    2446                but for metadata keys ending with the suffix `-bin`, the corresponding values must 
    2447                be of type `bytes`. 
    2448 
    2449        Returns: 
    2450            google.api_core.operation_async.AsyncOperation: 
    2451                An object representing a long-running operation. 
    2452 
    2453                The result type for the operation will be :class:`google.protobuf.empty_pb2.Empty` A generic empty message that you can re-use to avoid defining duplicated 
    2454                   empty messages in your APIs. A typical example is to 
    2455                   use it as the request or the response type of an API 
    2456                   method. For instance: 
    2457 
    2458                      service Foo { 
    2459                         rpc Bar(google.protobuf.Empty) returns 
    2460                         (google.protobuf.Empty); 
    2461 
    2462                      } 
    2463 
    2464        """ 
    2465        # Create or coerce a protobuf request object. 
    2466        # - Quick check: If we got a request object, we should *not* have 
    2467        #   gotten any keyword arguments that map to the request. 
    2468        flattened_params = [name] 
    2469        has_flattened_params = ( 
    2470            len([param for param in flattened_params if param is not None]) > 0 
    2471        ) 
    2472        if request is not None and has_flattened_params: 
    2473            raise ValueError( 
    2474                "If the `request` argument is set, then none of " 
    2475                "the individual field arguments should be set." 
    2476            ) 
    2477 
    2478        # - Use the request object if provided (there's no risk of modifying the input as 
    2479        #   there are no flattened fields), or create one. 
    2480        if not isinstance(request, logging_config.DeleteLinkRequest): 
    2481            request = logging_config.DeleteLinkRequest(request) 
    2482 
    2483        # If we have keyword arguments corresponding to fields on the 
    2484        # request, apply these. 
    2485        if name is not None: 
    2486            request.name = name 
    2487 
    2488        # Wrap the RPC method; this adds retry and timeout information, 
    2489        # and friendly error handling. 
    2490        rpc = self._client._transport._wrapped_methods[ 
    2491            self._client._transport.delete_link 
    2492        ] 
    2493 
    2494        # Certain fields should be provided within the metadata header; 
    2495        # add these here. 
    2496        metadata = tuple(metadata) + ( 
    2497            gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)), 
    2498        ) 
    2499 
    2500        # Validate the universe domain. 
    2501        self._client._validate_universe_domain() 
    2502 
    2503        # Send the request. 
    2504        response = await rpc( 
    2505            request, 
    2506            retry=retry, 
    2507            timeout=timeout, 
    2508            metadata=metadata, 
    2509        ) 
    2510 
    2511        # Wrap the response in an operation future. 
    2512        response = operation_async.from_gapic( 
    2513            response, 
    2514            self._client._transport.operations_client, 
    2515            empty_pb2.Empty, 
    2516            metadata_type=logging_config.LinkMetadata, 
    2517        ) 
    2518 
    2519        # Done; return the response. 
    2520        return response 
    2521 
    2522    async def list_links( 
    2523        self, 
    2524        request: Optional[Union[logging_config.ListLinksRequest, dict]] = None, 
    2525        *, 
    2526        parent: Optional[str] = None, 
    2527        retry: OptionalRetry = gapic_v1.method.DEFAULT, 
    2528        timeout: Union[float, object] = gapic_v1.method.DEFAULT, 
    2529        metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), 
    2530    ) -> pagers.ListLinksAsyncPager: 
    2531        r"""Lists links. 
    2532 
    2533        .. code-block:: python 
    2534 
    2535            # This snippet has been automatically generated and should be regarded as a 
    2536            # code template only. 
    2537            # It will require modifications to work: 
    2538            # - It may require correct/in-range values for request initialization. 
    2539            # - It may require specifying regional endpoints when creating the service 
    2540            #   client as shown in: 
    2541            #   https://googleapis.dev/python/google-api-core/latest/client_options.html 
    2542            from google.cloud import logging_v2 
    2543 
    2544            async def sample_list_links(): 
    2545                # Create a client 
    2546                client = logging_v2.ConfigServiceV2AsyncClient() 
    2547 
    2548                # Initialize request argument(s) 
    2549                request = logging_v2.ListLinksRequest( 
    2550                    parent="parent_value", 
    2551                ) 
    2552 
    2553                # Make the request 
    2554                page_result = client.list_links(request=request) 
    2555 
    2556                # Handle the response 
    2557                async for response in page_result: 
    2558                    print(response) 
    2559 
    2560        Args: 
    2561            request (Optional[Union[google.cloud.logging_v2.types.ListLinksRequest, dict]]): 
    2562                The request object. The parameters to ListLinks. 
    2563            parent (:class:`str`): 
    2564                Required. The parent resource whose links are to be 
    2565                listed: 
    2566 
    2567                "projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/links/" 
    2568                "organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/" 
    2569                "billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/" 
    2570                "folders/[FOLDER_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/ 
    2571 
    2572                This corresponds to the ``parent`` field 
    2573                on the ``request`` instance; if ``request`` is provided, this 
    2574                should not be set. 
    2575            retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any, 
    2576                should be retried. 
    2577            timeout (float): The timeout for this request. 
    2578            metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be 
    2579                sent along with the request as metadata. Normally, each value must be of type `str`, 
    2580                but for metadata keys ending with the suffix `-bin`, the corresponding values must 
    2581                be of type `bytes`. 
    2582 
    2583        Returns: 
    2584            google.cloud.logging_v2.services.config_service_v2.pagers.ListLinksAsyncPager: 
    2585                The response from ListLinks. 
    2586 
    2587                Iterating over this object will yield 
    2588                results and resolve additional pages 
    2589                automatically. 
    2590 
    2591        """ 
    2592        # Create or coerce a protobuf request object. 
    2593        # - Quick check: If we got a request object, we should *not* have 
    2594        #   gotten any keyword arguments that map to the request. 
    2595        flattened_params = [parent] 
    2596        has_flattened_params = ( 
    2597            len([param for param in flattened_params if param is not None]) > 0 
    2598        ) 
    2599        if request is not None and has_flattened_params: 
    2600            raise ValueError( 
    2601                "If the `request` argument is set, then none of " 
    2602                "the individual field arguments should be set." 
    2603            ) 
    2604 
    2605        # - Use the request object if provided (there's no risk of modifying the input as 
    2606        #   there are no flattened fields), or create one. 
    2607        if not isinstance(request, logging_config.ListLinksRequest): 
    2608            request = logging_config.ListLinksRequest(request) 
    2609 
    2610        # If we have keyword arguments corresponding to fields on the 
    2611        # request, apply these. 
    2612        if parent is not None: 
    2613            request.parent = parent 
    2614 
    2615        # Wrap the RPC method; this adds retry and timeout information, 
    2616        # and friendly error handling. 
    2617        rpc = self._client._transport._wrapped_methods[ 
    2618            self._client._transport.list_links 
    2619        ] 
    2620 
    2621        # Certain fields should be provided within the metadata header; 
    2622        # add these here. 
    2623        metadata = tuple(metadata) + ( 
    2624            gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)), 
    2625        ) 
    2626 
    2627        # Validate the universe domain. 
    2628        self._client._validate_universe_domain() 
    2629 
    2630        # Send the request. 
    2631        response = await rpc( 
    2632            request, 
    2633            retry=retry, 
    2634            timeout=timeout, 
    2635            metadata=metadata, 
    2636        ) 
    2637 
    2638        # This method is paged; wrap the response in a pager, which provides 
    2639        # an `__aiter__` convenience method. 
    2640        response = pagers.ListLinksAsyncPager( 
    2641            method=rpc, 
    2642            request=request, 
    2643            response=response, 
    2644            retry=retry, 
    2645            timeout=timeout, 
    2646            metadata=metadata, 
    2647        ) 
    2648 
    2649        # Done; return the response. 
    2650        return response 
    2651 
    2652    async def get_link( 
    2653        self, 
    2654        request: Optional[Union[logging_config.GetLinkRequest, dict]] = None, 
    2655        *, 
    2656        name: Optional[str] = None, 
    2657        retry: OptionalRetry = gapic_v1.method.DEFAULT, 
    2658        timeout: Union[float, object] = gapic_v1.method.DEFAULT, 
    2659        metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), 
    2660    ) -> logging_config.Link: 
    2661        r"""Gets a link. 
    2662 
    2663        .. code-block:: python 
    2664 
    2665            # This snippet has been automatically generated and should be regarded as a 
    2666            # code template only. 
    2667            # It will require modifications to work: 
    2668            # - It may require correct/in-range values for request initialization. 
    2669            # - It may require specifying regional endpoints when creating the service 
    2670            #   client as shown in: 
    2671            #   https://googleapis.dev/python/google-api-core/latest/client_options.html 
    2672            from google.cloud import logging_v2 
    2673 
    2674            async def sample_get_link(): 
    2675                # Create a client 
    2676                client = logging_v2.ConfigServiceV2AsyncClient() 
    2677 
    2678                # Initialize request argument(s) 
    2679                request = logging_v2.GetLinkRequest( 
    2680                    name="name_value", 
    2681                ) 
    2682 
    2683                # Make the request 
    2684                response = await client.get_link(request=request) 
    2685 
    2686                # Handle the response 
    2687                print(response) 
    2688 
    2689        Args: 
    2690            request (Optional[Union[google.cloud.logging_v2.types.GetLinkRequest, dict]]): 
    2691                The request object. The parameters to GetLink. 
    2692            name (:class:`str`): 
    2693                Required. The resource name of the link: 
    2694 
    2695                "projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/links/[LINK_ID]" 
    2696                "organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/links/[LINK_ID]" 
    2697                "billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/links/[LINK_ID]" 
    2698                "folders/[FOLDER_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/links/[LINK_ID] 
    2699 
    2700                This corresponds to the ``name`` field 
    2701                on the ``request`` instance; if ``request`` is provided, this 
    2702                should not be set. 
    2703            retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any, 
    2704                should be retried. 
    2705            timeout (float): The timeout for this request. 
    2706            metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be 
    2707                sent along with the request as metadata. Normally, each value must be of type `str`, 
    2708                but for metadata keys ending with the suffix `-bin`, the corresponding values must 
    2709                be of type `bytes`. 
    2710 
    2711        Returns: 
    2712            google.cloud.logging_v2.types.Link: 
    2713                Describes a link connected to an 
    2714                analytics enabled bucket. 
    2715 
    2716        """ 
    2717        # Create or coerce a protobuf request object. 
    2718        # - Quick check: If we got a request object, we should *not* have 
    2719        #   gotten any keyword arguments that map to the request. 
    2720        flattened_params = [name] 
    2721        has_flattened_params = ( 
    2722            len([param for param in flattened_params if param is not None]) > 0 
    2723        ) 
    2724        if request is not None and has_flattened_params: 
    2725            raise ValueError( 
    2726                "If the `request` argument is set, then none of " 
    2727                "the individual field arguments should be set." 
    2728            ) 
    2729 
    2730        # - Use the request object if provided (there's no risk of modifying the input as 
    2731        #   there are no flattened fields), or create one. 
    2732        if not isinstance(request, logging_config.GetLinkRequest): 
    2733            request = logging_config.GetLinkRequest(request) 
    2734 
    2735        # If we have keyword arguments corresponding to fields on the 
    2736        # request, apply these. 
    2737        if name is not None: 
    2738            request.name = name 
    2739 
    2740        # Wrap the RPC method; this adds retry and timeout information, 
    2741        # and friendly error handling. 
    2742        rpc = self._client._transport._wrapped_methods[self._client._transport.get_link] 
    2743 
    2744        # Certain fields should be provided within the metadata header; 
    2745        # add these here. 
    2746        metadata = tuple(metadata) + ( 
    2747            gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)), 
    2748        ) 
    2749 
    2750        # Validate the universe domain. 
    2751        self._client._validate_universe_domain() 
    2752 
    2753        # Send the request. 
    2754        response = await rpc( 
    2755            request, 
    2756            retry=retry, 
    2757            timeout=timeout, 
    2758            metadata=metadata, 
    2759        ) 
    2760 
    2761        # Done; return the response. 
    2762        return response 
    2763 
    2764    async def list_exclusions( 
    2765        self, 
    2766        request: Optional[Union[logging_config.ListExclusionsRequest, dict]] = None, 
    2767        *, 
    2768        parent: Optional[str] = None, 
    2769        retry: OptionalRetry = gapic_v1.method.DEFAULT, 
    2770        timeout: Union[float, object] = gapic_v1.method.DEFAULT, 
    2771        metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), 
    2772    ) -> pagers.ListExclusionsAsyncPager: 
    2773        r"""Lists all the exclusions on the \_Default sink in a parent 
    2774        resource. 
    2775 
    2776        .. code-block:: python 
    2777 
    2778            # This snippet has been automatically generated and should be regarded as a 
    2779            # code template only. 
    2780            # It will require modifications to work: 
    2781            # - It may require correct/in-range values for request initialization. 
    2782            # - It may require specifying regional endpoints when creating the service 
    2783            #   client as shown in: 
    2784            #   https://googleapis.dev/python/google-api-core/latest/client_options.html 
    2785            from google.cloud import logging_v2 
    2786 
    2787            async def sample_list_exclusions(): 
    2788                # Create a client 
    2789                client = logging_v2.ConfigServiceV2AsyncClient() 
    2790 
    2791                # Initialize request argument(s) 
    2792                request = logging_v2.ListExclusionsRequest( 
    2793                    parent="parent_value", 
    2794                ) 
    2795 
    2796                # Make the request 
    2797                page_result = client.list_exclusions(request=request) 
    2798 
    2799                # Handle the response 
    2800                async for response in page_result: 
    2801                    print(response) 
    2802 
    2803        Args: 
    2804            request (Optional[Union[google.cloud.logging_v2.types.ListExclusionsRequest, dict]]): 
    2805                The request object. The parameters to ``ListExclusions``. 
    2806            parent (:class:`str`): 
    2807                Required. The parent resource whose exclusions are to be 
    2808                listed. 
    2809 
    2810                :: 
    2811 
    2812                    "projects/[PROJECT_ID]" 
    2813                    "organizations/[ORGANIZATION_ID]" 
    2814                    "billingAccounts/[BILLING_ACCOUNT_ID]" 
    2815                    "folders/[FOLDER_ID]" 
    2816 
    2817                This corresponds to the ``parent`` field 
    2818                on the ``request`` instance; if ``request`` is provided, this 
    2819                should not be set. 
    2820            retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any, 
    2821                should be retried. 
    2822            timeout (float): The timeout for this request. 
    2823            metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be 
    2824                sent along with the request as metadata. Normally, each value must be of type `str`, 
    2825                but for metadata keys ending with the suffix `-bin`, the corresponding values must 
    2826                be of type `bytes`. 
    2827 
    2828        Returns: 
    2829            google.cloud.logging_v2.services.config_service_v2.pagers.ListExclusionsAsyncPager: 
    2830                Result returned from ListExclusions. 
    2831 
    2832                Iterating over this object will yield results and 
    2833                resolve additional pages automatically. 
    2834 
    2835        """ 
    2836        # Create or coerce a protobuf request object. 
    2837        # - Quick check: If we got a request object, we should *not* have 
    2838        #   gotten any keyword arguments that map to the request. 
    2839        flattened_params = [parent] 
    2840        has_flattened_params = ( 
    2841            len([param for param in flattened_params if param is not None]) > 0 
    2842        ) 
    2843        if request is not None and has_flattened_params: 
    2844            raise ValueError( 
    2845                "If the `request` argument is set, then none of " 
    2846                "the individual field arguments should be set." 
    2847            ) 
    2848 
    2849        # - Use the request object if provided (there's no risk of modifying the input as 
    2850        #   there are no flattened fields), or create one. 
    2851        if not isinstance(request, logging_config.ListExclusionsRequest): 
    2852            request = logging_config.ListExclusionsRequest(request) 
    2853 
    2854        # If we have keyword arguments corresponding to fields on the 
    2855        # request, apply these. 
    2856        if parent is not None: 
    2857            request.parent = parent 
    2858 
    2859        # Wrap the RPC method; this adds retry and timeout information, 
    2860        # and friendly error handling. 
    2861        rpc = self._client._transport._wrapped_methods[ 
    2862            self._client._transport.list_exclusions 
    2863        ] 
    2864 
    2865        # Certain fields should be provided within the metadata header; 
    2866        # add these here. 
    2867        metadata = tuple(metadata) + ( 
    2868            gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)), 
    2869        ) 
    2870 
    2871        # Validate the universe domain. 
    2872        self._client._validate_universe_domain() 
    2873 
    2874        # Send the request. 
    2875        response = await rpc( 
    2876            request, 
    2877            retry=retry, 
    2878            timeout=timeout, 
    2879            metadata=metadata, 
    2880        ) 
    2881 
    2882        # This method is paged; wrap the response in a pager, which provides 
    2883        # an `__aiter__` convenience method. 
    2884        response = pagers.ListExclusionsAsyncPager( 
    2885            method=rpc, 
    2886            request=request, 
    2887            response=response, 
    2888            retry=retry, 
    2889            timeout=timeout, 
    2890            metadata=metadata, 
    2891        ) 
    2892 
    2893        # Done; return the response. 
    2894        return response 
    2895 
    2896    async def get_exclusion( 
    2897        self, 
    2898        request: Optional[Union[logging_config.GetExclusionRequest, dict]] = None, 
    2899        *, 
    2900        name: Optional[str] = None, 
    2901        retry: OptionalRetry = gapic_v1.method.DEFAULT, 
    2902        timeout: Union[float, object] = gapic_v1.method.DEFAULT, 
    2903        metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), 
    2904    ) -> logging_config.LogExclusion: 
    2905        r"""Gets the description of an exclusion in the \_Default sink. 
    2906 
    2907        .. code-block:: python 
    2908 
    2909            # This snippet has been automatically generated and should be regarded as a 
    2910            # code template only. 
    2911            # It will require modifications to work: 
    2912            # - It may require correct/in-range values for request initialization. 
    2913            # - It may require specifying regional endpoints when creating the service 
    2914            #   client as shown in: 
    2915            #   https://googleapis.dev/python/google-api-core/latest/client_options.html 
    2916            from google.cloud import logging_v2 
    2917 
    2918            async def sample_get_exclusion(): 
    2919                # Create a client 
    2920                client = logging_v2.ConfigServiceV2AsyncClient() 
    2921 
    2922                # Initialize request argument(s) 
    2923                request = logging_v2.GetExclusionRequest( 
    2924                    name="name_value", 
    2925                ) 
    2926 
    2927                # Make the request 
    2928                response = await client.get_exclusion(request=request) 
    2929 
    2930                # Handle the response 
    2931                print(response) 
    2932 
    2933        Args: 
    2934            request (Optional[Union[google.cloud.logging_v2.types.GetExclusionRequest, dict]]): 
    2935                The request object. The parameters to ``GetExclusion``. 
    2936            name (:class:`str`): 
    2937                Required. The resource name of an existing exclusion: 
    2938 
    2939                :: 
    2940 
    2941                    "projects/[PROJECT_ID]/exclusions/[EXCLUSION_ID]" 
    2942                    "organizations/[ORGANIZATION_ID]/exclusions/[EXCLUSION_ID]" 
    2943                    "billingAccounts/[BILLING_ACCOUNT_ID]/exclusions/[EXCLUSION_ID]" 
    2944                    "folders/[FOLDER_ID]/exclusions/[EXCLUSION_ID]" 
    2945 
    2946                For example: 
    2947 
    2948                ``"projects/my-project/exclusions/my-exclusion"`` 
    2949 
    2950                This corresponds to the ``name`` field 
    2951                on the ``request`` instance; if ``request`` is provided, this 
    2952                should not be set. 
    2953            retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any, 
    2954                should be retried. 
    2955            timeout (float): The timeout for this request. 
    2956            metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be 
    2957                sent along with the request as metadata. Normally, each value must be of type `str`, 
    2958                but for metadata keys ending with the suffix `-bin`, the corresponding values must 
    2959                be of type `bytes`. 
    2960 
    2961        Returns: 
    2962            google.cloud.logging_v2.types.LogExclusion: 
    2963                Specifies a set of log entries that are filtered out by a sink. If 
    2964                   your Google Cloud resource receives a large volume of 
    2965                   log entries, you can use exclusions to reduce your 
    2966                   chargeable logs. Note that exclusions on 
    2967                   organization-level and folder-level sinks don't apply 
    2968                   to child resources. Note also that you cannot modify 
    2969                   the \_Required sink or exclude logs from it. 
    2970 
    2971        """ 
    2972        # Create or coerce a protobuf request object. 
    2973        # - Quick check: If we got a request object, we should *not* have 
    2974        #   gotten any keyword arguments that map to the request. 
    2975        flattened_params = [name] 
    2976        has_flattened_params = ( 
    2977            len([param for param in flattened_params if param is not None]) > 0 
    2978        ) 
    2979        if request is not None and has_flattened_params: 
    2980            raise ValueError( 
    2981                "If the `request` argument is set, then none of " 
    2982                "the individual field arguments should be set." 
    2983            ) 
    2984 
    2985        # - Use the request object if provided (there's no risk of modifying the input as 
    2986        #   there are no flattened fields), or create one. 
    2987        if not isinstance(request, logging_config.GetExclusionRequest): 
    2988            request = logging_config.GetExclusionRequest(request) 
    2989 
    2990        # If we have keyword arguments corresponding to fields on the 
    2991        # request, apply these. 
    2992        if name is not None: 
    2993            request.name = name 
    2994 
    2995        # Wrap the RPC method; this adds retry and timeout information, 
    2996        # and friendly error handling. 
    2997        rpc = self._client._transport._wrapped_methods[ 
    2998            self._client._transport.get_exclusion 
    2999        ] 
    3000 
    3001        # Certain fields should be provided within the metadata header; 
    3002        # add these here. 
    3003        metadata = tuple(metadata) + ( 
    3004            gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)), 
    3005        ) 
    3006 
    3007        # Validate the universe domain. 
    3008        self._client._validate_universe_domain() 
    3009 
    3010        # Send the request. 
    3011        response = await rpc( 
    3012            request, 
    3013            retry=retry, 
    3014            timeout=timeout, 
    3015            metadata=metadata, 
    3016        ) 
    3017 
    3018        # Done; return the response. 
    3019        return response 
    3020 
    3021    async def create_exclusion( 
    3022        self, 
    3023        request: Optional[Union[logging_config.CreateExclusionRequest, dict]] = None, 
    3024        *, 
    3025        parent: Optional[str] = None, 
    3026        exclusion: Optional[logging_config.LogExclusion] = None, 
    3027        retry: OptionalRetry = gapic_v1.method.DEFAULT, 
    3028        timeout: Union[float, object] = gapic_v1.method.DEFAULT, 
    3029        metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), 
    3030    ) -> logging_config.LogExclusion: 
    3031        r"""Creates a new exclusion in the \_Default sink in a specified 
    3032        parent resource. Only log entries belonging to that resource can 
    3033        be excluded. You can have up to 10 exclusions in a resource. 
    3034 
    3035        .. code-block:: python 
    3036 
    3037            # This snippet has been automatically generated and should be regarded as a 
    3038            # code template only. 
    3039            # It will require modifications to work: 
    3040            # - It may require correct/in-range values for request initialization. 
    3041            # - It may require specifying regional endpoints when creating the service 
    3042            #   client as shown in: 
    3043            #   https://googleapis.dev/python/google-api-core/latest/client_options.html 
    3044            from google.cloud import logging_v2 
    3045 
    3046            async def sample_create_exclusion(): 
    3047                # Create a client 
    3048                client = logging_v2.ConfigServiceV2AsyncClient() 
    3049 
    3050                # Initialize request argument(s) 
    3051                exclusion = logging_v2.LogExclusion() 
    3052                exclusion.name = "name_value" 
    3053                exclusion.filter = "filter_value" 
    3054 
    3055                request = logging_v2.CreateExclusionRequest( 
    3056                    parent="parent_value", 
    3057                    exclusion=exclusion, 
    3058                ) 
    3059 
    3060                # Make the request 
    3061                response = await client.create_exclusion(request=request) 
    3062 
    3063                # Handle the response 
    3064                print(response) 
    3065 
    3066        Args: 
    3067            request (Optional[Union[google.cloud.logging_v2.types.CreateExclusionRequest, dict]]): 
    3068                The request object. The parameters to ``CreateExclusion``. 
    3069            parent (:class:`str`): 
    3070                Required. The parent resource in which to create the 
    3071                exclusion: 
    3072 
    3073                :: 
    3074 
    3075                    "projects/[PROJECT_ID]" 
    3076                    "organizations/[ORGANIZATION_ID]" 
    3077                    "billingAccounts/[BILLING_ACCOUNT_ID]" 
    3078                    "folders/[FOLDER_ID]" 
    3079 
    3080                For examples: 
    3081 
    3082                ``"projects/my-logging-project"`` 
    3083                ``"organizations/123456789"`` 
    3084 
    3085                This corresponds to the ``parent`` field 
    3086                on the ``request`` instance; if ``request`` is provided, this 
    3087                should not be set. 
    3088            exclusion (:class:`google.cloud.logging_v2.types.LogExclusion`): 
    3089                Required. The new exclusion, whose ``name`` parameter is 
    3090                an exclusion name that is not already used in the parent 
    3091                resource. 
    3092 
    3093                This corresponds to the ``exclusion`` field 
    3094                on the ``request`` instance; if ``request`` is provided, this 
    3095                should not be set. 
    3096            retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any, 
    3097                should be retried. 
    3098            timeout (float): The timeout for this request. 
    3099            metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be 
    3100                sent along with the request as metadata. Normally, each value must be of type `str`, 
    3101                but for metadata keys ending with the suffix `-bin`, the corresponding values must 
    3102                be of type `bytes`. 
    3103 
    3104        Returns: 
    3105            google.cloud.logging_v2.types.LogExclusion: 
    3106                Specifies a set of log entries that are filtered out by a sink. If 
    3107                   your Google Cloud resource receives a large volume of 
    3108                   log entries, you can use exclusions to reduce your 
    3109                   chargeable logs. Note that exclusions on 
    3110                   organization-level and folder-level sinks don't apply 
    3111                   to child resources. Note also that you cannot modify 
    3112                   the \_Required sink or exclude logs from it. 
    3113 
    3114        """ 
    3115        # Create or coerce a protobuf request object. 
    3116        # - Quick check: If we got a request object, we should *not* have 
    3117        #   gotten any keyword arguments that map to the request. 
    3118        flattened_params = [parent, exclusion] 
    3119        has_flattened_params = ( 
    3120            len([param for param in flattened_params if param is not None]) > 0 
    3121        ) 
    3122        if request is not None and has_flattened_params: 
    3123            raise ValueError( 
    3124                "If the `request` argument is set, then none of " 
    3125                "the individual field arguments should be set." 
    3126            ) 
    3127 
    3128        # - Use the request object if provided (there's no risk of modifying the input as 
    3129        #   there are no flattened fields), or create one. 
    3130        if not isinstance(request, logging_config.CreateExclusionRequest): 
    3131            request = logging_config.CreateExclusionRequest(request) 
    3132 
    3133        # If we have keyword arguments corresponding to fields on the 
    3134        # request, apply these. 
    3135        if parent is not None: 
    3136            request.parent = parent 
    3137        if exclusion is not None: 
    3138            request.exclusion = exclusion 
    3139 
    3140        # Wrap the RPC method; this adds retry and timeout information, 
    3141        # and friendly error handling. 
    3142        rpc = self._client._transport._wrapped_methods[ 
    3143            self._client._transport.create_exclusion 
    3144        ] 
    3145 
    3146        # Certain fields should be provided within the metadata header; 
    3147        # add these here. 
    3148        metadata = tuple(metadata) + ( 
    3149            gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)), 
    3150        ) 
    3151 
    3152        # Validate the universe domain. 
    3153        self._client._validate_universe_domain() 
    3154 
    3155        # Send the request. 
    3156        response = await rpc( 
    3157            request, 
    3158            retry=retry, 
    3159            timeout=timeout, 
    3160            metadata=metadata, 
    3161        ) 
    3162 
    3163        # Done; return the response. 
    3164        return response 
    3165 
    3166    async def update_exclusion( 
    3167        self, 
    3168        request: Optional[Union[logging_config.UpdateExclusionRequest, dict]] = None, 
    3169        *, 
    3170        name: Optional[str] = None, 
    3171        exclusion: Optional[logging_config.LogExclusion] = None, 
    3172        update_mask: Optional[field_mask_pb2.FieldMask] = None, 
    3173        retry: OptionalRetry = gapic_v1.method.DEFAULT, 
    3174        timeout: Union[float, object] = gapic_v1.method.DEFAULT, 
    3175        metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), 
    3176    ) -> logging_config.LogExclusion: 
    3177        r"""Changes one or more properties of an existing exclusion in the 
    3178        \_Default sink. 
    3179 
    3180        .. code-block:: python 
    3181 
    3182            # This snippet has been automatically generated and should be regarded as a 
    3183            # code template only. 
    3184            # It will require modifications to work: 
    3185            # - It may require correct/in-range values for request initialization. 
    3186            # - It may require specifying regional endpoints when creating the service 
    3187            #   client as shown in: 
    3188            #   https://googleapis.dev/python/google-api-core/latest/client_options.html 
    3189            from google.cloud import logging_v2 
    3190 
    3191            async def sample_update_exclusion(): 
    3192                # Create a client 
    3193                client = logging_v2.ConfigServiceV2AsyncClient() 
    3194 
    3195                # Initialize request argument(s) 
    3196                exclusion = logging_v2.LogExclusion() 
    3197                exclusion.name = "name_value" 
    3198                exclusion.filter = "filter_value" 
    3199 
    3200                request = logging_v2.UpdateExclusionRequest( 
    3201                    name="name_value", 
    3202                    exclusion=exclusion, 
    3203                ) 
    3204 
    3205                # Make the request 
    3206                response = await client.update_exclusion(request=request) 
    3207 
    3208                # Handle the response 
    3209                print(response) 
    3210 
    3211        Args: 
    3212            request (Optional[Union[google.cloud.logging_v2.types.UpdateExclusionRequest, dict]]): 
    3213                The request object. The parameters to ``UpdateExclusion``. 
    3214            name (:class:`str`): 
    3215                Required. The resource name of the exclusion to update: 
    3216 
    3217                :: 
    3218 
    3219                    "projects/[PROJECT_ID]/exclusions/[EXCLUSION_ID]" 
    3220                    "organizations/[ORGANIZATION_ID]/exclusions/[EXCLUSION_ID]" 
    3221                    "billingAccounts/[BILLING_ACCOUNT_ID]/exclusions/[EXCLUSION_ID]" 
    3222                    "folders/[FOLDER_ID]/exclusions/[EXCLUSION_ID]" 
    3223 
    3224                For example: 
    3225 
    3226                ``"projects/my-project/exclusions/my-exclusion"`` 
    3227 
    3228                This corresponds to the ``name`` field 
    3229                on the ``request`` instance; if ``request`` is provided, this 
    3230                should not be set. 
    3231            exclusion (:class:`google.cloud.logging_v2.types.LogExclusion`): 
    3232                Required. New values for the existing exclusion. Only 
    3233                the fields specified in ``update_mask`` are relevant. 
    3234 
    3235                This corresponds to the ``exclusion`` field 
    3236                on the ``request`` instance; if ``request`` is provided, this 
    3237                should not be set. 
    3238            update_mask (:class:`google.protobuf.field_mask_pb2.FieldMask`): 
    3239                Required. A non-empty list of fields to change in the 
    3240                existing exclusion. New values for the fields are taken 
    3241                from the corresponding fields in the 
    3242                [LogExclusion][google.logging.v2.LogExclusion] included 
    3243                in this request. Fields not mentioned in ``update_mask`` 
    3244                are not changed and are ignored in the request. 
    3245 
    3246                For example, to change the filter and description of an 
    3247                exclusion, specify an ``update_mask`` of 
    3248                ``"filter,description"``. 
    3249 
    3250                This corresponds to the ``update_mask`` field 
    3251                on the ``request`` instance; if ``request`` is provided, this 
    3252                should not be set. 
    3253            retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any, 
    3254                should be retried. 
    3255            timeout (float): The timeout for this request. 
    3256            metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be 
    3257                sent along with the request as metadata. Normally, each value must be of type `str`, 
    3258                but for metadata keys ending with the suffix `-bin`, the corresponding values must 
    3259                be of type `bytes`. 
    3260 
    3261        Returns: 
    3262            google.cloud.logging_v2.types.LogExclusion: 
    3263                Specifies a set of log entries that are filtered out by a sink. If 
    3264                   your Google Cloud resource receives a large volume of 
    3265                   log entries, you can use exclusions to reduce your 
    3266                   chargeable logs. Note that exclusions on 
    3267                   organization-level and folder-level sinks don't apply 
    3268                   to child resources. Note also that you cannot modify 
    3269                   the \_Required sink or exclude logs from it. 
    3270 
    3271        """ 
    3272        # Create or coerce a protobuf request object. 
    3273        # - Quick check: If we got a request object, we should *not* have 
    3274        #   gotten any keyword arguments that map to the request. 
    3275        flattened_params = [name, exclusion, update_mask] 
    3276        has_flattened_params = ( 
    3277            len([param for param in flattened_params if param is not None]) > 0 
    3278        ) 
    3279        if request is not None and has_flattened_params: 
    3280            raise ValueError( 
    3281                "If the `request` argument is set, then none of " 
    3282                "the individual field arguments should be set." 
    3283            ) 
    3284 
    3285        # - Use the request object if provided (there's no risk of modifying the input as 
    3286        #   there are no flattened fields), or create one. 
    3287        if not isinstance(request, logging_config.UpdateExclusionRequest): 
    3288            request = logging_config.UpdateExclusionRequest(request) 
    3289 
    3290        # If we have keyword arguments corresponding to fields on the 
    3291        # request, apply these. 
    3292        if name is not None: 
    3293            request.name = name 
    3294        if exclusion is not None: 
    3295            request.exclusion = exclusion 
    3296        if update_mask is not None: 
    3297            request.update_mask = update_mask 
    3298 
    3299        # Wrap the RPC method; this adds retry and timeout information, 
    3300        # and friendly error handling. 
    3301        rpc = self._client._transport._wrapped_methods[ 
    3302            self._client._transport.update_exclusion 
    3303        ] 
    3304 
    3305        # Certain fields should be provided within the metadata header; 
    3306        # add these here. 
    3307        metadata = tuple(metadata) + ( 
    3308            gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)), 
    3309        ) 
    3310 
    3311        # Validate the universe domain. 
    3312        self._client._validate_universe_domain() 
    3313 
    3314        # Send the request. 
    3315        response = await rpc( 
    3316            request, 
    3317            retry=retry, 
    3318            timeout=timeout, 
    3319            metadata=metadata, 
    3320        ) 
    3321 
    3322        # Done; return the response. 
    3323        return response 
    3324 
    3325    async def delete_exclusion( 
    3326        self, 
    3327        request: Optional[Union[logging_config.DeleteExclusionRequest, dict]] = None, 
    3328        *, 
    3329        name: Optional[str] = None, 
    3330        retry: OptionalRetry = gapic_v1.method.DEFAULT, 
    3331        timeout: Union[float, object] = gapic_v1.method.DEFAULT, 
    3332        metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), 
    3333    ) -> None: 
    3334        r"""Deletes an exclusion in the \_Default sink. 
    3335 
    3336        .. code-block:: python 
    3337 
    3338            # This snippet has been automatically generated and should be regarded as a 
    3339            # code template only. 
    3340            # It will require modifications to work: 
    3341            # - It may require correct/in-range values for request initialization. 
    3342            # - It may require specifying regional endpoints when creating the service 
    3343            #   client as shown in: 
    3344            #   https://googleapis.dev/python/google-api-core/latest/client_options.html 
    3345            from google.cloud import logging_v2 
    3346 
    3347            async def sample_delete_exclusion(): 
    3348                # Create a client 
    3349                client = logging_v2.ConfigServiceV2AsyncClient() 
    3350 
    3351                # Initialize request argument(s) 
    3352                request = logging_v2.DeleteExclusionRequest( 
    3353                    name="name_value", 
    3354                ) 
    3355 
    3356                # Make the request 
    3357                await client.delete_exclusion(request=request) 
    3358 
    3359        Args: 
    3360            request (Optional[Union[google.cloud.logging_v2.types.DeleteExclusionRequest, dict]]): 
    3361                The request object. The parameters to ``DeleteExclusion``. 
    3362            name (:class:`str`): 
    3363                Required. The resource name of an existing exclusion to 
    3364                delete: 
    3365 
    3366                :: 
    3367 
    3368                    "projects/[PROJECT_ID]/exclusions/[EXCLUSION_ID]" 
    3369                    "organizations/[ORGANIZATION_ID]/exclusions/[EXCLUSION_ID]" 
    3370                    "billingAccounts/[BILLING_ACCOUNT_ID]/exclusions/[EXCLUSION_ID]" 
    3371                    "folders/[FOLDER_ID]/exclusions/[EXCLUSION_ID]" 
    3372 
    3373                For example: 
    3374 
    3375                ``"projects/my-project/exclusions/my-exclusion"`` 
    3376 
    3377                This corresponds to the ``name`` field 
    3378                on the ``request`` instance; if ``request`` is provided, this 
    3379                should not be set. 
    3380            retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any, 
    3381                should be retried. 
    3382            timeout (float): The timeout for this request. 
    3383            metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be 
    3384                sent along with the request as metadata. Normally, each value must be of type `str`, 
    3385                but for metadata keys ending with the suffix `-bin`, the corresponding values must 
    3386                be of type `bytes`. 
    3387        """ 
    3388        # Create or coerce a protobuf request object. 
    3389        # - Quick check: If we got a request object, we should *not* have 
    3390        #   gotten any keyword arguments that map to the request. 
    3391        flattened_params = [name] 
    3392        has_flattened_params = ( 
    3393            len([param for param in flattened_params if param is not None]) > 0 
    3394        ) 
    3395        if request is not None and has_flattened_params: 
    3396            raise ValueError( 
    3397                "If the `request` argument is set, then none of " 
    3398                "the individual field arguments should be set." 
    3399            ) 
    3400 
    3401        # - Use the request object if provided (there's no risk of modifying the input as 
    3402        #   there are no flattened fields), or create one. 
    3403        if not isinstance(request, logging_config.DeleteExclusionRequest): 
    3404            request = logging_config.DeleteExclusionRequest(request) 
    3405 
    3406        # If we have keyword arguments corresponding to fields on the 
    3407        # request, apply these. 
    3408        if name is not None: 
    3409            request.name = name 
    3410 
    3411        # Wrap the RPC method; this adds retry and timeout information, 
    3412        # and friendly error handling. 
    3413        rpc = self._client._transport._wrapped_methods[ 
    3414            self._client._transport.delete_exclusion 
    3415        ] 
    3416 
    3417        # Certain fields should be provided within the metadata header; 
    3418        # add these here. 
    3419        metadata = tuple(metadata) + ( 
    3420            gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)), 
    3421        ) 
    3422 
    3423        # Validate the universe domain. 
    3424        self._client._validate_universe_domain() 
    3425 
    3426        # Send the request. 
    3427        await rpc( 
    3428            request, 
    3429            retry=retry, 
    3430            timeout=timeout, 
    3431            metadata=metadata, 
    3432        ) 
    3433 
    3434    async def get_cmek_settings( 
    3435        self, 
    3436        request: Optional[Union[logging_config.GetCmekSettingsRequest, dict]] = None, 
    3437        *, 
    3438        retry: OptionalRetry = gapic_v1.method.DEFAULT, 
    3439        timeout: Union[float, object] = gapic_v1.method.DEFAULT, 
    3440        metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), 
    3441    ) -> logging_config.CmekSettings: 
    3442        r"""Gets the Logging CMEK settings for the given resource. 
    3443 
    3444        Note: CMEK for the Log Router can be configured for Google Cloud 
    3445        projects, folders, organizations and billing accounts. Once 
    3446        configured for an organization, it applies to all projects and 
    3447        folders in the Google Cloud organization. 
    3448 
    3449        See `Enabling CMEK for Log 
    3450        Router <https://cloud.google.com/logging/docs/routing/managed-encryption>`__ 
    3451        for more information. 
    3452 
    3453        .. code-block:: python 
    3454 
    3455            # This snippet has been automatically generated and should be regarded as a 
    3456            # code template only. 
    3457            # It will require modifications to work: 
    3458            # - It may require correct/in-range values for request initialization. 
    3459            # - It may require specifying regional endpoints when creating the service 
    3460            #   client as shown in: 
    3461            #   https://googleapis.dev/python/google-api-core/latest/client_options.html 
    3462            from google.cloud import logging_v2 
    3463 
    3464            async def sample_get_cmek_settings(): 
    3465                # Create a client 
    3466                client = logging_v2.ConfigServiceV2AsyncClient() 
    3467 
    3468                # Initialize request argument(s) 
    3469                request = logging_v2.GetCmekSettingsRequest( 
    3470                    name="name_value", 
    3471                ) 
    3472 
    3473                # Make the request 
    3474                response = await client.get_cmek_settings(request=request) 
    3475 
    3476                # Handle the response 
    3477                print(response) 
    3478 
    3479        Args: 
    3480            request (Optional[Union[google.cloud.logging_v2.types.GetCmekSettingsRequest, dict]]): 
    3481                The request object. The parameters to 
    3482                [GetCmekSettings][google.logging.v2.ConfigServiceV2.GetCmekSettings]. 
    3483 
    3484                See `Enabling CMEK for Log 
    3485                Router <https://cloud.google.com/logging/docs/routing/managed-encryption>`__ 
    3486                for more information. 
    3487            retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any, 
    3488                should be retried. 
    3489            timeout (float): The timeout for this request. 
    3490            metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be 
    3491                sent along with the request as metadata. Normally, each value must be of type `str`, 
    3492                but for metadata keys ending with the suffix `-bin`, the corresponding values must 
    3493                be of type `bytes`. 
    3494 
    3495        Returns: 
    3496            google.cloud.logging_v2.types.CmekSettings: 
    3497                Describes the customer-managed encryption key (CMEK) settings associated with 
    3498                   a project, folder, organization, billing account, or 
    3499                   flexible resource. 
    3500 
    3501                   Note: CMEK for the Log Router can currently only be 
    3502                   configured for Google Cloud organizations. Once 
    3503                   configured, it applies to all projects and folders in 
    3504                   the Google Cloud organization. 
    3505 
    3506                   See [Enabling CMEK for Log 
    3507                   Router](\ https://cloud.google.com/logging/docs/routing/managed-encryption) 
    3508                   for more information. 
    3509 
    3510        """ 
    3511        # Create or coerce a protobuf request object. 
    3512        # - Use the request object if provided (there's no risk of modifying the input as 
    3513        #   there are no flattened fields), or create one. 
    3514        if not isinstance(request, logging_config.GetCmekSettingsRequest): 
    3515            request = logging_config.GetCmekSettingsRequest(request) 
    3516 
    3517        # Wrap the RPC method; this adds retry and timeout information, 
    3518        # and friendly error handling. 
    3519        rpc = self._client._transport._wrapped_methods[ 
    3520            self._client._transport.get_cmek_settings 
    3521        ] 
    3522 
    3523        # Certain fields should be provided within the metadata header; 
    3524        # add these here. 
    3525        metadata = tuple(metadata) + ( 
    3526            gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)), 
    3527        ) 
    3528 
    3529        # Validate the universe domain. 
    3530        self._client._validate_universe_domain() 
    3531 
    3532        # Send the request. 
    3533        response = await rpc( 
    3534            request, 
    3535            retry=retry, 
    3536            timeout=timeout, 
    3537            metadata=metadata, 
    3538        ) 
    3539 
    3540        # Done; return the response. 
    3541        return response 
    3542 
    3543    async def update_cmek_settings( 
    3544        self, 
    3545        request: Optional[Union[logging_config.UpdateCmekSettingsRequest, dict]] = None, 
    3546        *, 
    3547        retry: OptionalRetry = gapic_v1.method.DEFAULT, 
    3548        timeout: Union[float, object] = gapic_v1.method.DEFAULT, 
    3549        metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), 
    3550    ) -> logging_config.CmekSettings: 
    3551        r"""Updates the Log Router CMEK settings for the given resource. 
    3552 
    3553        Note: CMEK for the Log Router can currently only be configured 
    3554        for Google Cloud organizations. Once configured, it applies to 
    3555        all projects and folders in the Google Cloud organization. 
    3556 
    3557        [UpdateCmekSettings][google.logging.v2.ConfigServiceV2.UpdateCmekSettings] 
    3558        will fail if 1) ``kms_key_name`` is invalid, or 2) the 
    3559        associated service account does not have the required 
    3560        ``roles/cloudkms.cryptoKeyEncrypterDecrypter`` role assigned for 
    3561        the key, or 3) access to the key is disabled. 
    3562 
    3563        See `Enabling CMEK for Log 
    3564        Router <https://cloud.google.com/logging/docs/routing/managed-encryption>`__ 
    3565        for more information. 
    3566 
    3567        .. code-block:: python 
    3568 
    3569            # This snippet has been automatically generated and should be regarded as a 
    3570            # code template only. 
    3571            # It will require modifications to work: 
    3572            # - It may require correct/in-range values for request initialization. 
    3573            # - It may require specifying regional endpoints when creating the service 
    3574            #   client as shown in: 
    3575            #   https://googleapis.dev/python/google-api-core/latest/client_options.html 
    3576            from google.cloud import logging_v2 
    3577 
    3578            async def sample_update_cmek_settings(): 
    3579                # Create a client 
    3580                client = logging_v2.ConfigServiceV2AsyncClient() 
    3581 
    3582                # Initialize request argument(s) 
    3583                request = logging_v2.UpdateCmekSettingsRequest( 
    3584                    name="name_value", 
    3585                ) 
    3586 
    3587                # Make the request 
    3588                response = await client.update_cmek_settings(request=request) 
    3589 
    3590                # Handle the response 
    3591                print(response) 
    3592 
    3593        Args: 
    3594            request (Optional[Union[google.cloud.logging_v2.types.UpdateCmekSettingsRequest, dict]]): 
    3595                The request object. The parameters to 
    3596                [UpdateCmekSettings][google.logging.v2.ConfigServiceV2.UpdateCmekSettings]. 
    3597 
    3598                See `Enabling CMEK for Log 
    3599                Router <https://cloud.google.com/logging/docs/routing/managed-encryption>`__ 
    3600                for more information. 
    3601            retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any, 
    3602                should be retried. 
    3603            timeout (float): The timeout for this request. 
    3604            metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be 
    3605                sent along with the request as metadata. Normally, each value must be of type `str`, 
    3606                but for metadata keys ending with the suffix `-bin`, the corresponding values must 
    3607                be of type `bytes`. 
    3608 
    3609        Returns: 
    3610            google.cloud.logging_v2.types.CmekSettings: 
    3611                Describes the customer-managed encryption key (CMEK) settings associated with 
    3612                   a project, folder, organization, billing account, or 
    3613                   flexible resource. 
    3614 
    3615                   Note: CMEK for the Log Router can currently only be 
    3616                   configured for Google Cloud organizations. Once 
    3617                   configured, it applies to all projects and folders in 
    3618                   the Google Cloud organization. 
    3619 
    3620                   See [Enabling CMEK for Log 
    3621                   Router](\ https://cloud.google.com/logging/docs/routing/managed-encryption) 
    3622                   for more information. 
    3623 
    3624        """ 
    3625        # Create or coerce a protobuf request object. 
    3626        # - Use the request object if provided (there's no risk of modifying the input as 
    3627        #   there are no flattened fields), or create one. 
    3628        if not isinstance(request, logging_config.UpdateCmekSettingsRequest): 
    3629            request = logging_config.UpdateCmekSettingsRequest(request) 
    3630 
    3631        # Wrap the RPC method; this adds retry and timeout information, 
    3632        # and friendly error handling. 
    3633        rpc = self._client._transport._wrapped_methods[ 
    3634            self._client._transport.update_cmek_settings 
    3635        ] 
    3636 
    3637        # Certain fields should be provided within the metadata header; 
    3638        # add these here. 
    3639        metadata = tuple(metadata) + ( 
    3640            gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)), 
    3641        ) 
    3642 
    3643        # Validate the universe domain. 
    3644        self._client._validate_universe_domain() 
    3645 
    3646        # Send the request. 
    3647        response = await rpc( 
    3648            request, 
    3649            retry=retry, 
    3650            timeout=timeout, 
    3651            metadata=metadata, 
    3652        ) 
    3653 
    3654        # Done; return the response. 
    3655        return response 
    3656 
    3657    async def get_settings( 
    3658        self, 
    3659        request: Optional[Union[logging_config.GetSettingsRequest, dict]] = None, 
    3660        *, 
    3661        name: Optional[str] = None, 
    3662        retry: OptionalRetry = gapic_v1.method.DEFAULT, 
    3663        timeout: Union[float, object] = gapic_v1.method.DEFAULT, 
    3664        metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), 
    3665    ) -> logging_config.Settings: 
    3666        r"""Gets the Log Router settings for the given resource. 
    3667 
    3668        Note: Settings for the Log Router can be get for Google Cloud 
    3669        projects, folders, organizations and billing accounts. Currently 
    3670        it can only be configured for organizations. Once configured for 
    3671        an organization, it applies to all projects and folders in the 
    3672        Google Cloud organization. 
    3673 
    3674        See `Enabling CMEK for Log 
    3675        Router <https://cloud.google.com/logging/docs/routing/managed-encryption>`__ 
    3676        for more information. 
    3677 
    3678        .. code-block:: python 
    3679 
    3680            # This snippet has been automatically generated and should be regarded as a 
    3681            # code template only. 
    3682            # It will require modifications to work: 
    3683            # - It may require correct/in-range values for request initialization. 
    3684            # - It may require specifying regional endpoints when creating the service 
    3685            #   client as shown in: 
    3686            #   https://googleapis.dev/python/google-api-core/latest/client_options.html 
    3687            from google.cloud import logging_v2 
    3688 
    3689            async def sample_get_settings(): 
    3690                # Create a client 
    3691                client = logging_v2.ConfigServiceV2AsyncClient() 
    3692 
    3693                # Initialize request argument(s) 
    3694                request = logging_v2.GetSettingsRequest( 
    3695                    name="name_value", 
    3696                ) 
    3697 
    3698                # Make the request 
    3699                response = await client.get_settings(request=request) 
    3700 
    3701                # Handle the response 
    3702                print(response) 
    3703 
    3704        Args: 
    3705            request (Optional[Union[google.cloud.logging_v2.types.GetSettingsRequest, dict]]): 
    3706                The request object. The parameters to 
    3707                [GetSettings][google.logging.v2.ConfigServiceV2.GetSettings]. 
    3708 
    3709                See `Enabling CMEK for Log 
    3710                Router <https://cloud.google.com/logging/docs/routing/managed-encryption>`__ 
    3711                for more information. 
    3712            name (:class:`str`): 
    3713                Required. The resource for which to retrieve settings. 
    3714 
    3715                :: 
    3716 
    3717                    "projects/[PROJECT_ID]/settings" 
    3718                    "organizations/[ORGANIZATION_ID]/settings" 
    3719                    "billingAccounts/[BILLING_ACCOUNT_ID]/settings" 
    3720                    "folders/[FOLDER_ID]/settings" 
    3721 
    3722                For example: 
    3723 
    3724                ``"organizations/12345/settings"`` 
    3725 
    3726                Note: Settings for the Log Router can be get for Google 
    3727                Cloud projects, folders, organizations and billing 
    3728                accounts. Currently it can only be configured for 
    3729                organizations. Once configured for an organization, it 
    3730                applies to all projects and folders in the Google Cloud 
    3731                organization. 
    3732 
    3733                This corresponds to the ``name`` field 
    3734                on the ``request`` instance; if ``request`` is provided, this 
    3735                should not be set. 
    3736            retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any, 
    3737                should be retried. 
    3738            timeout (float): The timeout for this request. 
    3739            metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be 
    3740                sent along with the request as metadata. Normally, each value must be of type `str`, 
    3741                but for metadata keys ending with the suffix `-bin`, the corresponding values must 
    3742                be of type `bytes`. 
    3743 
    3744        Returns: 
    3745            google.cloud.logging_v2.types.Settings: 
    3746                Describes the settings associated 
    3747                with a project, folder, organization, 
    3748                billing account, or flexible resource. 
    3749 
    3750        """ 
    3751        # Create or coerce a protobuf request object. 
    3752        # - Quick check: If we got a request object, we should *not* have 
    3753        #   gotten any keyword arguments that map to the request. 
    3754        flattened_params = [name] 
    3755        has_flattened_params = ( 
    3756            len([param for param in flattened_params if param is not None]) > 0 
    3757        ) 
    3758        if request is not None and has_flattened_params: 
    3759            raise ValueError( 
    3760                "If the `request` argument is set, then none of " 
    3761                "the individual field arguments should be set." 
    3762            ) 
    3763 
    3764        # - Use the request object if provided (there's no risk of modifying the input as 
    3765        #   there are no flattened fields), or create one. 
    3766        if not isinstance(request, logging_config.GetSettingsRequest): 
    3767            request = logging_config.GetSettingsRequest(request) 
    3768 
    3769        # If we have keyword arguments corresponding to fields on the 
    3770        # request, apply these. 
    3771        if name is not None: 
    3772            request.name = name 
    3773 
    3774        # Wrap the RPC method; this adds retry and timeout information, 
    3775        # and friendly error handling. 
    3776        rpc = self._client._transport._wrapped_methods[ 
    3777            self._client._transport.get_settings 
    3778        ] 
    3779 
    3780        # Certain fields should be provided within the metadata header; 
    3781        # add these here. 
    3782        metadata = tuple(metadata) + ( 
    3783            gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)), 
    3784        ) 
    3785 
    3786        # Validate the universe domain. 
    3787        self._client._validate_universe_domain() 
    3788 
    3789        # Send the request. 
    3790        response = await rpc( 
    3791            request, 
    3792            retry=retry, 
    3793            timeout=timeout, 
    3794            metadata=metadata, 
    3795        ) 
    3796 
    3797        # Done; return the response. 
    3798        return response 
    3799 
    3800    async def update_settings( 
    3801        self, 
    3802        request: Optional[Union[logging_config.UpdateSettingsRequest, dict]] = None, 
    3803        *, 
    3804        settings: Optional[logging_config.Settings] = None, 
    3805        update_mask: Optional[field_mask_pb2.FieldMask] = None, 
    3806        retry: OptionalRetry = gapic_v1.method.DEFAULT, 
    3807        timeout: Union[float, object] = gapic_v1.method.DEFAULT, 
    3808        metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), 
    3809    ) -> logging_config.Settings: 
    3810        r"""Updates the Log Router settings for the given resource. 
    3811 
    3812        Note: Settings for the Log Router can currently only be 
    3813        configured for Google Cloud organizations. Once configured, it 
    3814        applies to all projects and folders in the Google Cloud 
    3815        organization. 
    3816 
    3817        [UpdateSettings][google.logging.v2.ConfigServiceV2.UpdateSettings] 
    3818        will fail if 1) ``kms_key_name`` is invalid, or 2) the 
    3819        associated service account does not have the required 
    3820        ``roles/cloudkms.cryptoKeyEncrypterDecrypter`` role assigned for 
    3821        the key, or 3) access to the key is disabled. 4) ``location_id`` 
    3822        is not supported by Logging. 5) ``location_id`` violate 
    3823        OrgPolicy. 
    3824 
    3825        See `Enabling CMEK for Log 
    3826        Router <https://cloud.google.com/logging/docs/routing/managed-encryption>`__ 
    3827        for more information. 
    3828 
    3829        .. code-block:: python 
    3830 
    3831            # This snippet has been automatically generated and should be regarded as a 
    3832            # code template only. 
    3833            # It will require modifications to work: 
    3834            # - It may require correct/in-range values for request initialization. 
    3835            # - It may require specifying regional endpoints when creating the service 
    3836            #   client as shown in: 
    3837            #   https://googleapis.dev/python/google-api-core/latest/client_options.html 
    3838            from google.cloud import logging_v2 
    3839 
    3840            async def sample_update_settings(): 
    3841                # Create a client 
    3842                client = logging_v2.ConfigServiceV2AsyncClient() 
    3843 
    3844                # Initialize request argument(s) 
    3845                request = logging_v2.UpdateSettingsRequest( 
    3846                    name="name_value", 
    3847                ) 
    3848 
    3849                # Make the request 
    3850                response = await client.update_settings(request=request) 
    3851 
    3852                # Handle the response 
    3853                print(response) 
    3854 
    3855        Args: 
    3856            request (Optional[Union[google.cloud.logging_v2.types.UpdateSettingsRequest, dict]]): 
    3857                The request object. The parameters to 
    3858                [UpdateSettings][google.logging.v2.ConfigServiceV2.UpdateSettings]. 
    3859 
    3860                See `Enabling CMEK for Log 
    3861                Router <https://cloud.google.com/logging/docs/routing/managed-encryption>`__ 
    3862                for more information. 
    3863            settings (:class:`google.cloud.logging_v2.types.Settings`): 
    3864                Required. The settings to update. 
    3865 
    3866                See `Enabling CMEK for Log 
    3867                Router <https://cloud.google.com/logging/docs/routing/managed-encryption>`__ 
    3868                for more information. 
    3869 
    3870                This corresponds to the ``settings`` field 
    3871                on the ``request`` instance; if ``request`` is provided, this 
    3872                should not be set. 
    3873            update_mask (:class:`google.protobuf.field_mask_pb2.FieldMask`): 
    3874                Optional. Field mask identifying which fields from 
    3875                ``settings`` should be updated. A field will be 
    3876                overwritten if and only if it is in the update mask. 
    3877                Output only fields cannot be updated. 
    3878 
    3879                See [FieldMask][google.protobuf.FieldMask] for more 
    3880                information. 
    3881 
    3882                For example: ``"updateMask=kmsKeyName"`` 
    3883 
    3884                This corresponds to the ``update_mask`` field 
    3885                on the ``request`` instance; if ``request`` is provided, this 
    3886                should not be set. 
    3887            retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any, 
    3888                should be retried. 
    3889            timeout (float): The timeout for this request. 
    3890            metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be 
    3891                sent along with the request as metadata. Normally, each value must be of type `str`, 
    3892                but for metadata keys ending with the suffix `-bin`, the corresponding values must 
    3893                be of type `bytes`. 
    3894 
    3895        Returns: 
    3896            google.cloud.logging_v2.types.Settings: 
    3897                Describes the settings associated 
    3898                with a project, folder, organization, 
    3899                billing account, or flexible resource. 
    3900 
    3901        """ 
    3902        # Create or coerce a protobuf request object. 
    3903        # - Quick check: If we got a request object, we should *not* have 
    3904        #   gotten any keyword arguments that map to the request. 
    3905        flattened_params = [settings, update_mask] 
    3906        has_flattened_params = ( 
    3907            len([param for param in flattened_params if param is not None]) > 0 
    3908        ) 
    3909        if request is not None and has_flattened_params: 
    3910            raise ValueError( 
    3911                "If the `request` argument is set, then none of " 
    3912                "the individual field arguments should be set." 
    3913            ) 
    3914 
    3915        # - Use the request object if provided (there's no risk of modifying the input as 
    3916        #   there are no flattened fields), or create one. 
    3917        if not isinstance(request, logging_config.UpdateSettingsRequest): 
    3918            request = logging_config.UpdateSettingsRequest(request) 
    3919 
    3920        # If we have keyword arguments corresponding to fields on the 
    3921        # request, apply these. 
    3922        if settings is not None: 
    3923            request.settings = settings 
    3924        if update_mask is not None: 
    3925            request.update_mask = update_mask 
    3926 
    3927        # Wrap the RPC method; this adds retry and timeout information, 
    3928        # and friendly error handling. 
    3929        rpc = self._client._transport._wrapped_methods[ 
    3930            self._client._transport.update_settings 
    3931        ] 
    3932 
    3933        # Certain fields should be provided within the metadata header; 
    3934        # add these here. 
    3935        metadata = tuple(metadata) + ( 
    3936            gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)), 
    3937        ) 
    3938 
    3939        # Validate the universe domain. 
    3940        self._client._validate_universe_domain() 
    3941 
    3942        # Send the request. 
    3943        response = await rpc( 
    3944            request, 
    3945            retry=retry, 
    3946            timeout=timeout, 
    3947            metadata=metadata, 
    3948        ) 
    3949 
    3950        # Done; return the response. 
    3951        return response 
    3952 
    3953    async def copy_log_entries( 
    3954        self, 
    3955        request: Optional[Union[logging_config.CopyLogEntriesRequest, dict]] = None, 
    3956        *, 
    3957        retry: OptionalRetry = gapic_v1.method.DEFAULT, 
    3958        timeout: Union[float, object] = gapic_v1.method.DEFAULT, 
    3959        metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), 
    3960    ) -> operation_async.AsyncOperation: 
    3961        r"""Copies a set of log entries from a log bucket to a 
    3962        Cloud Storage bucket. 
    3963 
    3964        .. code-block:: python 
    3965 
    3966            # This snippet has been automatically generated and should be regarded as a 
    3967            # code template only. 
    3968            # It will require modifications to work: 
    3969            # - It may require correct/in-range values for request initialization. 
    3970            # - It may require specifying regional endpoints when creating the service 
    3971            #   client as shown in: 
    3972            #   https://googleapis.dev/python/google-api-core/latest/client_options.html 
    3973            from google.cloud import logging_v2 
    3974 
    3975            async def sample_copy_log_entries(): 
    3976                # Create a client 
    3977                client = logging_v2.ConfigServiceV2AsyncClient() 
    3978 
    3979                # Initialize request argument(s) 
    3980                request = logging_v2.CopyLogEntriesRequest( 
    3981                    name="name_value", 
    3982                    destination="destination_value", 
    3983                ) 
    3984 
    3985                # Make the request 
    3986                operation = client.copy_log_entries(request=request) 
    3987 
    3988                print("Waiting for operation to complete...") 
    3989 
    3990                response = (await operation).result() 
    3991 
    3992                # Handle the response 
    3993                print(response) 
    3994 
    3995        Args: 
    3996            request (Optional[Union[google.cloud.logging_v2.types.CopyLogEntriesRequest, dict]]): 
    3997                The request object. The parameters to CopyLogEntries. 
    3998            retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any, 
    3999                should be retried. 
    4000            timeout (float): The timeout for this request. 
    4001            metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be 
    4002                sent along with the request as metadata. Normally, each value must be of type `str`, 
    4003                but for metadata keys ending with the suffix `-bin`, the corresponding values must 
    4004                be of type `bytes`. 
    4005 
    4006        Returns: 
    4007            google.api_core.operation_async.AsyncOperation: 
    4008                An object representing a long-running operation. 
    4009 
    4010                The result type for the operation will be 
    4011                :class:`google.cloud.logging_v2.types.CopyLogEntriesResponse` 
    4012                Response type for CopyLogEntries long running 
    4013                operations. 
    4014 
    4015        """ 
    4016        # Create or coerce a protobuf request object. 
    4017        # - Use the request object if provided (there's no risk of modifying the input as 
    4018        #   there are no flattened fields), or create one. 
    4019        if not isinstance(request, logging_config.CopyLogEntriesRequest): 
    4020            request = logging_config.CopyLogEntriesRequest(request) 
    4021 
    4022        # Wrap the RPC method; this adds retry and timeout information, 
    4023        # and friendly error handling. 
    4024        rpc = self._client._transport._wrapped_methods[ 
    4025            self._client._transport.copy_log_entries 
    4026        ] 
    4027 
    4028        # Validate the universe domain. 
    4029        self._client._validate_universe_domain() 
    4030 
    4031        # Send the request. 
    4032        response = await rpc( 
    4033            request, 
    4034            retry=retry, 
    4035            timeout=timeout, 
    4036            metadata=metadata, 
    4037        ) 
    4038 
    4039        # Wrap the response in an operation future. 
    4040        response = operation_async.from_gapic( 
    4041            response, 
    4042            self._client._transport.operations_client, 
    4043            logging_config.CopyLogEntriesResponse, 
    4044            metadata_type=logging_config.CopyLogEntriesMetadata, 
    4045        ) 
    4046 
    4047        # Done; return the response. 
    4048        return response 
    4049 
    4050    async def list_operations( 
    4051        self, 
    4052        request: Optional[operations_pb2.ListOperationsRequest] = None, 
    4053        *, 
    4054        retry: OptionalRetry = gapic_v1.method.DEFAULT, 
    4055        timeout: Union[float, object] = gapic_v1.method.DEFAULT, 
    4056        metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), 
    4057    ) -> operations_pb2.ListOperationsResponse: 
    4058        r"""Lists operations that match the specified filter in the request. 
    4059 
    4060        Args: 
    4061            request (:class:`~.operations_pb2.ListOperationsRequest`): 
    4062                The request object. Request message for 
    4063                `ListOperations` method. 
    4064            retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, 
    4065                    if any, should be retried. 
    4066            timeout (float): The timeout for this request. 
    4067            metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be 
    4068                sent along with the request as metadata. Normally, each value must be of type `str`, 
    4069                but for metadata keys ending with the suffix `-bin`, the corresponding values must 
    4070                be of type `bytes`. 
    4071        Returns: 
    4072            ~.operations_pb2.ListOperationsResponse: 
    4073                Response message for ``ListOperations`` method. 
    4074        """ 
    4075        # Create or coerce a protobuf request object. 
    4076        # The request isn't a proto-plus wrapped type, 
    4077        # so it must be constructed via keyword expansion. 
    4078        if isinstance(request, dict): 
    4079            request = operations_pb2.ListOperationsRequest(**request) 
    4080 
    4081        # Wrap the RPC method; this adds retry and timeout information, 
    4082        # and friendly error handling. 
    4083        rpc = self.transport._wrapped_methods[self._client._transport.list_operations] 
    4084 
    4085        # Certain fields should be provided within the metadata header; 
    4086        # add these here. 
    4087        metadata = tuple(metadata) + ( 
    4088            gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)), 
    4089        ) 
    4090 
    4091        # Validate the universe domain. 
    4092        self._client._validate_universe_domain() 
    4093 
    4094        # Send the request. 
    4095        response = await rpc( 
    4096            request, 
    4097            retry=retry, 
    4098            timeout=timeout, 
    4099            metadata=metadata, 
    4100        ) 
    4101 
    4102        # Done; return the response. 
    4103        return response 
    4104 
    4105    async def get_operation( 
    4106        self, 
    4107        request: Optional[operations_pb2.GetOperationRequest] = None, 
    4108        *, 
    4109        retry: OptionalRetry = gapic_v1.method.DEFAULT, 
    4110        timeout: Union[float, object] = gapic_v1.method.DEFAULT, 
    4111        metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), 
    4112    ) -> operations_pb2.Operation: 
    4113        r"""Gets the latest state of a long-running operation. 
    4114 
    4115        Args: 
    4116            request (:class:`~.operations_pb2.GetOperationRequest`): 
    4117                The request object. Request message for 
    4118                `GetOperation` method. 
    4119            retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, 
    4120                    if any, should be retried. 
    4121            timeout (float): The timeout for this request. 
    4122            metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be 
    4123                sent along with the request as metadata. Normally, each value must be of type `str`, 
    4124                but for metadata keys ending with the suffix `-bin`, the corresponding values must 
    4125                be of type `bytes`. 
    4126        Returns: 
    4127            ~.operations_pb2.Operation: 
    4128                An ``Operation`` object. 
    4129        """ 
    4130        # Create or coerce a protobuf request object. 
    4131        # The request isn't a proto-plus wrapped type, 
    4132        # so it must be constructed via keyword expansion. 
    4133        if isinstance(request, dict): 
    4134            request = operations_pb2.GetOperationRequest(**request) 
    4135 
    4136        # Wrap the RPC method; this adds retry and timeout information, 
    4137        # and friendly error handling. 
    4138        rpc = self.transport._wrapped_methods[self._client._transport.get_operation] 
    4139 
    4140        # Certain fields should be provided within the metadata header; 
    4141        # add these here. 
    4142        metadata = tuple(metadata) + ( 
    4143            gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)), 
    4144        ) 
    4145 
    4146        # Validate the universe domain. 
    4147        self._client._validate_universe_domain() 
    4148 
    4149        # Send the request. 
    4150        response = await rpc( 
    4151            request, 
    4152            retry=retry, 
    4153            timeout=timeout, 
    4154            metadata=metadata, 
    4155        ) 
    4156 
    4157        # Done; return the response. 
    4158        return response 
    4159 
    4160    async def cancel_operation( 
    4161        self, 
    4162        request: Optional[operations_pb2.CancelOperationRequest] = None, 
    4163        *, 
    4164        retry: OptionalRetry = gapic_v1.method.DEFAULT, 
    4165        timeout: Union[float, object] = gapic_v1.method.DEFAULT, 
    4166        metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), 
    4167    ) -> None: 
    4168        r"""Starts asynchronous cancellation on a long-running operation. 
    4169 
    4170        The server makes a best effort to cancel the operation, but success 
    4171        is not guaranteed.  If the server doesn't support this method, it returns 
    4172        `google.rpc.Code.UNIMPLEMENTED`. 
    4173 
    4174        Args: 
    4175            request (:class:`~.operations_pb2.CancelOperationRequest`): 
    4176                The request object. Request message for 
    4177                `CancelOperation` method. 
    4178            retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, 
    4179                    if any, should be retried. 
    4180            timeout (float): The timeout for this request. 
    4181            metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be 
    4182                sent along with the request as metadata. Normally, each value must be of type `str`, 
    4183                but for metadata keys ending with the suffix `-bin`, the corresponding values must 
    4184                be of type `bytes`. 
    4185        Returns: 
    4186            None 
    4187        """ 
    4188        # Create or coerce a protobuf request object. 
    4189        # The request isn't a proto-plus wrapped type, 
    4190        # so it must be constructed via keyword expansion. 
    4191        if isinstance(request, dict): 
    4192            request = operations_pb2.CancelOperationRequest(**request) 
    4193 
    4194        # Wrap the RPC method; this adds retry and timeout information, 
    4195        # and friendly error handling. 
    4196        rpc = self.transport._wrapped_methods[self._client._transport.cancel_operation] 
    4197 
    4198        # Certain fields should be provided within the metadata header; 
    4199        # add these here. 
    4200        metadata = tuple(metadata) + ( 
    4201            gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)), 
    4202        ) 
    4203 
    4204        # Validate the universe domain. 
    4205        self._client._validate_universe_domain() 
    4206 
    4207        # Send the request. 
    4208        await rpc( 
    4209            request, 
    4210            retry=retry, 
    4211            timeout=timeout, 
    4212            metadata=metadata, 
    4213        ) 
    4214 
    4215    async def __aenter__(self) -> "ConfigServiceV2AsyncClient": 
    4216        return self 
    4217 
    4218    async def __aexit__(self, exc_type, exc, tb): 
    4219        await self.transport.close() 
    4220 
    4221 
    4222DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( 
    4223    gapic_version=package_version.__version__ 
    4224) 
    4225 
    4226 
    4227__all__ = ("ConfigServiceV2AsyncClient",)