Skip to content

Commit

Permalink
chore: Update gapic-generator-python to v1.18.5 (#299)
Browse files Browse the repository at this point in the history
* chore: Update gapic-generator-python to v1.18.5

PiperOrigin-RevId: 661268868

Source-Link: googleapis/googleapis@f7d214c

Source-Link: googleapis/googleapis-gen@79a8411
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiNzlhODQxMWJiZGIyNWE5ODNmYTNhYWU4YzBlMTQzMjdkZjEyOWY5NCJ9

chore: Update gapic-generator-python to v1.18.4

PiperOrigin-RevId: 657207628

Source-Link: googleapis/googleapis@33fe71e

Source-Link: googleapis/googleapis-gen@e02739d
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiZTAyNzM5ZDEyMmVkMTViZDVlZjU3NzFjNTdmMTJhODNkNDdhMWRkYSJ9

chore: Update gapic-generator-python to v1.18.3

PiperOrigin-RevId: 656040068

Source-Link: googleapis/googleapis@3f4e29a

Source-Link: googleapis/googleapis-gen@b8feb21
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiYjhmZWIyMTA5ZGRlN2IwOTM4YzIyYzk5M2QwMDIyNTFhYzY3MTRkYyJ9

chore: Update gapic-generator-python to v1.18.3

PiperOrigin-RevId: 655567917

Source-Link: googleapis/googleapis@43aa65e

Source-Link: googleapis/googleapis-gen@0e38378
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiMGUzODM3ODc1MzA3NGMwZjY2ZmY2MzM0OGQ2ODY0OTI5ZTEwNGQ1YyJ9

feat(spanner): Add support for Cloud Spanner Scheduled Backups

PiperOrigin-RevId: 649277844

Source-Link: googleapis/googleapis@fd7efa2

Source-Link: googleapis/googleapis-gen@50be251
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiNTBiZTI1MTMyOWQ4ZGI1YjU1NTYyNmViZDQ4ODY3MjFmNTQ3ZDNjYyJ9

* 🦉 Updates from OwlBot post-processor

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

---------

Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
  • Loading branch information
gcf-owl-bot[bot] and gcf-owl-bot[bot] committed Aug 13, 2024
1 parent 078feca commit 8820e49
Show file tree
Hide file tree
Showing 8 changed files with 190 additions and 126 deletions.
11 changes: 7 additions & 4 deletions google/cloud/orgpolicy_v2/services/org_policy/async_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
# limitations under the License.
#
from collections import OrderedDict
import functools
import re
from typing import (
Callable,
Expand Down Expand Up @@ -211,9 +210,7 @@ def universe_domain(self) -> str:
"""
return self._client._universe_domain

get_transport_class = functools.partial(
type(OrgPolicyClient).get_transport_class, type(OrgPolicyClient)
)
get_transport_class = OrgPolicyClient.get_transport_class

def __init__(
self,
Expand Down Expand Up @@ -402,6 +399,8 @@ async def sample_list_constraints():
method=rpc,
request=request,
response=response,
retry=retry,
timeout=timeout,
metadata=metadata,
)

Expand Down Expand Up @@ -532,6 +531,8 @@ async def sample_list_policies():
method=rpc,
request=request,
response=response,
retry=retry,
timeout=timeout,
metadata=metadata,
)

Expand Down Expand Up @@ -1594,6 +1595,8 @@ async def sample_list_custom_constraints():
method=rpc,
request=request,
response=response,
retry=retry,
timeout=timeout,
metadata=metadata,
)

Expand Down
8 changes: 7 additions & 1 deletion google/cloud/orgpolicy_v2/services/org_policy/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -715,7 +715,7 @@ def __init__(
transport_init: Union[
Type[OrgPolicyTransport], Callable[..., OrgPolicyTransport]
] = (
type(self).get_transport_class(transport)
OrgPolicyClient.get_transport_class(transport)
if isinstance(transport, str) or transport is None
else cast(Callable[..., OrgPolicyTransport], transport)
)
Expand Down Expand Up @@ -850,6 +850,8 @@ def sample_list_constraints():
method=rpc,
request=request,
response=response,
retry=retry,
timeout=timeout,
metadata=metadata,
)

Expand Down Expand Up @@ -977,6 +979,8 @@ def sample_list_policies():
method=rpc,
request=request,
response=response,
retry=retry,
timeout=timeout,
metadata=metadata,
)

Expand Down Expand Up @@ -2012,6 +2016,8 @@ def sample_list_custom_constraints():
method=rpc,
request=request,
response=response,
retry=retry,
timeout=timeout,
metadata=metadata,
)

Expand Down
98 changes: 92 additions & 6 deletions google/cloud/orgpolicy_v2/services/org_policy/pagers.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,22 @@
Optional,
Sequence,
Tuple,
Union,
)

from google.api_core import gapic_v1
from google.api_core import retry as retries
from google.api_core import retry_async as retries_async

try:
OptionalRetry = Union[retries.Retry, gapic_v1.method._MethodDefault, None]
OptionalAsyncRetry = Union[
retries_async.AsyncRetry, gapic_v1.method._MethodDefault, None
]
except AttributeError: # pragma: NO COVER
OptionalRetry = Union[retries.Retry, object, None] # type: ignore
OptionalAsyncRetry = Union[retries_async.AsyncRetry, object, None] # type: ignore

from google.cloud.orgpolicy_v2.types import constraint, orgpolicy


Expand Down Expand Up @@ -51,6 +65,8 @@ def __init__(
request: orgpolicy.ListConstraintsRequest,
response: orgpolicy.ListConstraintsResponse,
*,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, str]] = ()
):
"""Instantiate the pager.
Expand All @@ -62,12 +78,17 @@ def __init__(
The initial request object.
response (google.cloud.orgpolicy_v2.types.ListConstraintsResponse):
The initial response object.
retry (google.api_core.retry.Retry): Designation of what errors,
if any, should be retried.
timeout (float): The timeout for this request.
metadata (Sequence[Tuple[str, str]]): Strings which should be
sent along with the request as metadata.
"""
self._method = method
self._request = orgpolicy.ListConstraintsRequest(request)
self._response = response
self._retry = retry
self._timeout = timeout
self._metadata = metadata

def __getattr__(self, name: str) -> Any:
Expand All @@ -78,7 +99,12 @@ def pages(self) -> Iterator[orgpolicy.ListConstraintsResponse]:
yield self._response
while self._response.next_page_token:
self._request.page_token = self._response.next_page_token
self._response = self._method(self._request, metadata=self._metadata)
self._response = self._method(
self._request,
retry=self._retry,
timeout=self._timeout,
metadata=self._metadata,
)
yield self._response

def __iter__(self) -> Iterator[constraint.Constraint]:
Expand Down Expand Up @@ -113,6 +139,8 @@ def __init__(
request: orgpolicy.ListConstraintsRequest,
response: orgpolicy.ListConstraintsResponse,
*,
retry: OptionalAsyncRetry = gapic_v1.method.DEFAULT,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, str]] = ()
):
"""Instantiates the pager.
Expand All @@ -124,12 +152,17 @@ def __init__(
The initial request object.
response (google.cloud.orgpolicy_v2.types.ListConstraintsResponse):
The initial response object.
retry (google.api_core.retry.AsyncRetry): Designation of what errors,
if any, should be retried.
timeout (float): The timeout for this request.
metadata (Sequence[Tuple[str, str]]): Strings which should be
sent along with the request as metadata.
"""
self._method = method
self._request = orgpolicy.ListConstraintsRequest(request)
self._response = response
self._retry = retry
self._timeout = timeout
self._metadata = metadata

def __getattr__(self, name: str) -> Any:
Expand All @@ -140,7 +173,12 @@ async def pages(self) -> AsyncIterator[orgpolicy.ListConstraintsResponse]:
yield self._response
while self._response.next_page_token:
self._request.page_token = self._response.next_page_token
self._response = await self._method(self._request, metadata=self._metadata)
self._response = await self._method(
self._request,
retry=self._retry,
timeout=self._timeout,
metadata=self._metadata,
)
yield self._response

def __aiter__(self) -> AsyncIterator[constraint.Constraint]:
Expand Down Expand Up @@ -179,6 +217,8 @@ def __init__(
request: orgpolicy.ListPoliciesRequest,
response: orgpolicy.ListPoliciesResponse,
*,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, str]] = ()
):
"""Instantiate the pager.
Expand All @@ -190,12 +230,17 @@ def __init__(
The initial request object.
response (google.cloud.orgpolicy_v2.types.ListPoliciesResponse):
The initial response object.
retry (google.api_core.retry.Retry): Designation of what errors,
if any, should be retried.
timeout (float): The timeout for this request.
metadata (Sequence[Tuple[str, str]]): Strings which should be
sent along with the request as metadata.
"""
self._method = method
self._request = orgpolicy.ListPoliciesRequest(request)
self._response = response
self._retry = retry
self._timeout = timeout
self._metadata = metadata

def __getattr__(self, name: str) -> Any:
Expand All @@ -206,7 +251,12 @@ def pages(self) -> Iterator[orgpolicy.ListPoliciesResponse]:
yield self._response
while self._response.next_page_token:
self._request.page_token = self._response.next_page_token
self._response = self._method(self._request, metadata=self._metadata)
self._response = self._method(
self._request,
retry=self._retry,
timeout=self._timeout,
metadata=self._metadata,
)
yield self._response

def __iter__(self) -> Iterator[orgpolicy.Policy]:
Expand Down Expand Up @@ -241,6 +291,8 @@ def __init__(
request: orgpolicy.ListPoliciesRequest,
response: orgpolicy.ListPoliciesResponse,
*,
retry: OptionalAsyncRetry = gapic_v1.method.DEFAULT,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, str]] = ()
):
"""Instantiates the pager.
Expand All @@ -252,12 +304,17 @@ def __init__(
The initial request object.
response (google.cloud.orgpolicy_v2.types.ListPoliciesResponse):
The initial response object.
retry (google.api_core.retry.AsyncRetry): Designation of what errors,
if any, should be retried.
timeout (float): The timeout for this request.
metadata (Sequence[Tuple[str, str]]): Strings which should be
sent along with the request as metadata.
"""
self._method = method
self._request = orgpolicy.ListPoliciesRequest(request)
self._response = response
self._retry = retry
self._timeout = timeout
self._metadata = metadata

def __getattr__(self, name: str) -> Any:
Expand All @@ -268,7 +325,12 @@ async def pages(self) -> AsyncIterator[orgpolicy.ListPoliciesResponse]:
yield self._response
while self._response.next_page_token:
self._request.page_token = self._response.next_page_token
self._response = await self._method(self._request, metadata=self._metadata)
self._response = await self._method(
self._request,
retry=self._retry,
timeout=self._timeout,
metadata=self._metadata,
)
yield self._response

def __aiter__(self) -> AsyncIterator[orgpolicy.Policy]:
Expand Down Expand Up @@ -307,6 +369,8 @@ def __init__(
request: orgpolicy.ListCustomConstraintsRequest,
response: orgpolicy.ListCustomConstraintsResponse,
*,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, str]] = ()
):
"""Instantiate the pager.
Expand All @@ -318,12 +382,17 @@ def __init__(
The initial request object.
response (google.cloud.orgpolicy_v2.types.ListCustomConstraintsResponse):
The initial response object.
retry (google.api_core.retry.Retry): Designation of what errors,
if any, should be retried.
timeout (float): The timeout for this request.
metadata (Sequence[Tuple[str, str]]): Strings which should be
sent along with the request as metadata.
"""
self._method = method
self._request = orgpolicy.ListCustomConstraintsRequest(request)
self._response = response
self._retry = retry
self._timeout = timeout
self._metadata = metadata

def __getattr__(self, name: str) -> Any:
Expand All @@ -334,7 +403,12 @@ def pages(self) -> Iterator[orgpolicy.ListCustomConstraintsResponse]:
yield self._response
while self._response.next_page_token:
self._request.page_token = self._response.next_page_token
self._response = self._method(self._request, metadata=self._metadata)
self._response = self._method(
self._request,
retry=self._retry,
timeout=self._timeout,
metadata=self._metadata,
)
yield self._response

def __iter__(self) -> Iterator[constraint.CustomConstraint]:
Expand Down Expand Up @@ -369,6 +443,8 @@ def __init__(
request: orgpolicy.ListCustomConstraintsRequest,
response: orgpolicy.ListCustomConstraintsResponse,
*,
retry: OptionalAsyncRetry = gapic_v1.method.DEFAULT,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, str]] = ()
):
"""Instantiates the pager.
Expand All @@ -380,12 +456,17 @@ def __init__(
The initial request object.
response (google.cloud.orgpolicy_v2.types.ListCustomConstraintsResponse):
The initial response object.
retry (google.api_core.retry.AsyncRetry): Designation of what errors,
if any, should be retried.
timeout (float): The timeout for this request.
metadata (Sequence[Tuple[str, str]]): Strings which should be
sent along with the request as metadata.
"""
self._method = method
self._request = orgpolicy.ListCustomConstraintsRequest(request)
self._response = response
self._retry = retry
self._timeout = timeout
self._metadata = metadata

def __getattr__(self, name: str) -> Any:
Expand All @@ -396,7 +477,12 @@ async def pages(self) -> AsyncIterator[orgpolicy.ListCustomConstraintsResponse]:
yield self._response
while self._response.next_page_token:
self._request.page_token = self._response.next_page_token
self._response = await self._method(self._request, metadata=self._metadata)
self._response = await self._method(
self._request,
retry=self._retry,
timeout=self._timeout,
metadata=self._metadata,
)
yield self._response

def __aiter__(self) -> AsyncIterator[constraint.CustomConstraint]:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,8 @@ def __init__(

# Save the scopes.
self._scopes = scopes
if not hasattr(self, "_ignore_credentials"):
self._ignore_credentials: bool = False

# If no credentials are provided, then determine the appropriate
# defaults.
Expand All @@ -94,7 +96,7 @@ def __init__(
credentials, _ = google.auth.load_credentials_from_file(
credentials_file, **scopes_kwargs, quota_project_id=quota_project_id
)
elif credentials is None:
elif credentials is None and not self._ignore_credentials:
credentials, _ = google.auth.default(
**scopes_kwargs, quota_project_id=quota_project_id
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,8 @@ def __init__(

if isinstance(channel, grpc.Channel):
# Ignore credentials if a channel was passed.
credentials = False
credentials = None
self._ignore_credentials = True
# If a channel was explicitly provided, set it.
self._grpc_channel = channel
self._ssl_channel_credentials = None
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,8 @@ def __init__(

if isinstance(channel, aio.Channel):
# Ignore credentials if a channel was passed.
credentials = False
credentials = None
self._ignore_credentials = True
# If a channel was explicitly provided, set it.
self._grpc_channel = channel
self._ssl_channel_credentials = None
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
# See https://github.com/googleapis/google-cloud-python/issues/12364
"google-auth >= 2.14.1, <3.0.0dev,!=2.24.0,!=2.25.0",
"proto-plus >= 1.22.3, <2.0.0dev",
"protobuf>=3.20.2,<6.0.0dev,!=3.20.0,!=3.20.1,!=4.21.0,!=4.21.1,!=4.21.2,!=4.21.3,!=4.21.4,!=4.21.5",
"protobuf>=3.20.2,<6.0.0dev,!=4.21.0,!=4.21.1,!=4.21.2,!=4.21.3,!=4.21.4,!=4.21.5",
]
url = "https://github.com/googleapis/python-org-policy"

Expand Down
Loading

0 comments on commit 8820e49

Please sign in to comment.