Skip to content

Commit

Permalink
chore: Re-generated to pick up changes from googleapis. (#198)
Browse files Browse the repository at this point in the history
* chore: update gapic-generator-python

PiperOrigin-RevId: 355923884

Source-Author: Google APIs <noreply@google.com>
Source-Date: Fri Feb 5 14:04:52 2021 -0800
Source-Repo: googleapis/googleapis
Source-Sha: 5e3dacee19405529b841b53797df799c2383536c
Source-Link: googleapis/googleapis@5e3dace

* chore: update gapic-generator-python to 0.40.11

PiperOrigin-RevId: 359562873

Source-Author: Google APIs <noreply@google.com>
Source-Date: Thu Feb 25 10:52:32 2021 -0800
Source-Repo: googleapis/googleapis
Source-Sha: 07932bb995e7dc91b43620ea8402c6668c7d102c
Source-Link: googleapis/googleapis@07932bb
  • Loading branch information
yoshi-automation committed Mar 8, 2021
1 parent 24b4789 commit bfafb35
Show file tree
Hide file tree
Showing 12 changed files with 709 additions and 26 deletions.
32 changes: 30 additions & 2 deletions google/cloud/logging_v2/services/config_service_v2/async_client.py
Expand Up @@ -90,8 +90,36 @@ class ConfigServiceV2AsyncClient:
ConfigServiceV2Client.parse_common_location_path
)

from_service_account_info = ConfigServiceV2Client.from_service_account_info
from_service_account_file = ConfigServiceV2Client.from_service_account_file
@classmethod
def from_service_account_info(cls, info: dict, *args, **kwargs):
"""Creates an instance of this client using the provided credentials info.
Args:
info (dict): The service account private key info.
args: Additional arguments to pass to the constructor.
kwargs: Additional arguments to pass to the constructor.
Returns:
ConfigServiceV2AsyncClient: The constructed client.
"""
return ConfigServiceV2Client.from_service_account_info.__func__(ConfigServiceV2AsyncClient, info, *args, **kwargs) # type: ignore

@classmethod
def from_service_account_file(cls, filename: str, *args, **kwargs):
"""Creates an instance of this client using the provided credentials
file.
Args:
filename (str): The path to the service account private key json
file.
args: Additional arguments to pass to the constructor.
kwargs: Additional arguments to pass to the constructor.
Returns:
ConfigServiceV2AsyncClient: The constructed client.
"""
return ConfigServiceV2Client.from_service_account_file.__func__(ConfigServiceV2AsyncClient, filename, *args, **kwargs) # type: ignore

from_service_account_json = from_service_account_file

@property
Expand Down
11 changes: 10 additions & 1 deletion google/cloud/logging_v2/services/config_service_v2/pagers.py
Expand Up @@ -15,7 +15,16 @@
# limitations under the License.
#

from typing import Any, AsyncIterable, Awaitable, Callable, Iterable, Sequence, Tuple
from typing import (
Any,
AsyncIterable,
Awaitable,
Callable,
Iterable,
Sequence,
Tuple,
Optional,
)

from google.cloud.logging_v2.types import logging_config

Expand Down
Expand Up @@ -87,8 +87,36 @@ class LoggingServiceV2AsyncClient:
LoggingServiceV2Client.parse_common_location_path
)

from_service_account_info = LoggingServiceV2Client.from_service_account_info
from_service_account_file = LoggingServiceV2Client.from_service_account_file
@classmethod
def from_service_account_info(cls, info: dict, *args, **kwargs):
"""Creates an instance of this client using the provided credentials info.
Args:
info (dict): The service account private key info.
args: Additional arguments to pass to the constructor.
kwargs: Additional arguments to pass to the constructor.
Returns:
LoggingServiceV2AsyncClient: The constructed client.
"""
return LoggingServiceV2Client.from_service_account_info.__func__(LoggingServiceV2AsyncClient, info, *args, **kwargs) # type: ignore

@classmethod
def from_service_account_file(cls, filename: str, *args, **kwargs):
"""Creates an instance of this client using the provided credentials
file.
Args:
filename (str): The path to the service account private key json
file.
args: Additional arguments to pass to the constructor.
kwargs: Additional arguments to pass to the constructor.
Returns:
LoggingServiceV2AsyncClient: The constructed client.
"""
return LoggingServiceV2Client.from_service_account_file.__func__(LoggingServiceV2AsyncClient, filename, *args, **kwargs) # type: ignore

from_service_account_json = from_service_account_file

@property
Expand Down
15 changes: 6 additions & 9 deletions google/cloud/logging_v2/services/logging_service_v2/client.py
Expand Up @@ -578,12 +578,10 @@ def write_log_entries(
request.log_name = log_name
if resource is not None:
request.resource = resource

if labels:
request.labels.update(labels)

if entries:
request.entries.extend(entries)
if labels is not None:
request.labels = labels
if entries is not None:
request.entries = entries

# Wrap the RPC method; this adds retry and timeout information,
# and friendly error handling.
Expand Down Expand Up @@ -699,14 +697,13 @@ def list_log_entries(
# If we have keyword arguments corresponding to fields on the
# request, apply these.

if resource_names is not None:
request.resource_names = resource_names
if filter is not None:
request.filter = filter
if order_by is not None:
request.order_by = order_by

if resource_names:
request.resource_names.extend(resource_names)

# Wrap the RPC method; this adds retry and timeout information,
# and friendly error handling.
rpc = self._transport._wrapped_methods[self._transport.list_log_entries]
Expand Down
11 changes: 10 additions & 1 deletion google/cloud/logging_v2/services/logging_service_v2/pagers.py
Expand Up @@ -15,7 +15,16 @@
# limitations under the License.
#

from typing import Any, AsyncIterable, Awaitable, Callable, Iterable, Sequence, Tuple
from typing import (
Any,
AsyncIterable,
Awaitable,
Callable,
Iterable,
Sequence,
Tuple,
Optional,
)

from google.api import monitored_resource_pb2 as monitored_resource # type: ignore
from google.cloud.logging_v2.types import log_entry
Expand Down
Expand Up @@ -80,8 +80,36 @@ class MetricsServiceV2AsyncClient:
MetricsServiceV2Client.parse_common_location_path
)

from_service_account_info = MetricsServiceV2Client.from_service_account_info
from_service_account_file = MetricsServiceV2Client.from_service_account_file
@classmethod
def from_service_account_info(cls, info: dict, *args, **kwargs):
"""Creates an instance of this client using the provided credentials info.
Args:
info (dict): The service account private key info.
args: Additional arguments to pass to the constructor.
kwargs: Additional arguments to pass to the constructor.
Returns:
MetricsServiceV2AsyncClient: The constructed client.
"""
return MetricsServiceV2Client.from_service_account_info.__func__(MetricsServiceV2AsyncClient, info, *args, **kwargs) # type: ignore

@classmethod
def from_service_account_file(cls, filename: str, *args, **kwargs):
"""Creates an instance of this client using the provided credentials
file.
Args:
filename (str): The path to the service account private key json
file.
args: Additional arguments to pass to the constructor.
kwargs: Additional arguments to pass to the constructor.
Returns:
MetricsServiceV2AsyncClient: The constructed client.
"""
return MetricsServiceV2Client.from_service_account_file.__func__(MetricsServiceV2AsyncClient, filename, *args, **kwargs) # type: ignore

from_service_account_json = from_service_account_file

@property
Expand Down
11 changes: 10 additions & 1 deletion google/cloud/logging_v2/services/metrics_service_v2/pagers.py
Expand Up @@ -15,7 +15,16 @@
# limitations under the License.
#

from typing import Any, AsyncIterable, Awaitable, Callable, Iterable, Sequence, Tuple
from typing import (
Any,
AsyncIterable,
Awaitable,
Callable,
Iterable,
Sequence,
Tuple,
Optional,
)

from google.cloud.logging_v2.types import logging_metrics

Expand Down
4 changes: 2 additions & 2 deletions synth.metadata
Expand Up @@ -11,8 +11,8 @@
"git": {
"name": "googleapis",
"remote": "https://github.com/googleapis/googleapis.git",
"sha": "20712b8fe95001b312f62c6c5f33e3e3ec92cfaf",
"internalRef": "354996675"
"sha": "07932bb995e7dc91b43620ea8402c6668c7d102c",
"internalRef": "359562873"
}
},
{
Expand Down
15 changes: 15 additions & 0 deletions tests/unit/gapic/logging_v2/__init__.py
@@ -1 +1,16 @@
# -*- coding: utf-8 -*-

# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

0 comments on commit bfafb35

Please sign in to comment.