Skip to content

Commit

Permalink
chore: use gapic-generator-python 1.2.0 (#18)
Browse files Browse the repository at this point in the history
- [ ] Regenerate this pull request now.

PiperOrigin-RevId: 467286830

Source-Link: googleapis/googleapis@e6e875a

Source-Link: googleapis/googleapis-gen@0295ea1
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiMDI5NWVhMTRkOWNkNGQ0N2RkYjIzYjllYmQzOWEzMWUyMDM1ZTI4ZiJ9

fix(deps): require google-api-core>=1.32.0,>=2.8.0
chore: use gapic-generator-python 1.1.1
PiperOrigin-RevId: 459095142

Source-Link: googleapis/googleapis@4f1be99

Source-Link: googleapis/googleapis-gen@ae686d9
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiYWU2ODZkOWNkZTRmYzNlMzZkMGFjMDJlZmI4NjQzYjE1ODkwYzFlZCJ9

feat: add audience parameter
PiperOrigin-RevId: 456827138

Source-Link: googleapis/googleapis@23f1a15

Source-Link: googleapis/googleapis-gen@4075a85
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiNDA3NWE4NTE0ZjY3NjY5MWVjMTU2Njg4YTViYmYxODNhYTk4OTNjZSJ9

chore: use gapic-generator-python 1.0.0
PiperOrigin-RevId: 451250442

Source-Link: googleapis/googleapis@cca5e81

Source-Link: googleapis/googleapis-gen@0b219da
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiMGIyMTlkYTE2MWE4YmRjYzNjNmY3YjJlZmNkODIxMDUxODJhMzBjYSJ9

fix: Updates pre-release Cloud Run v2 Preview client libraries to work with the latest API revision
PiperOrigin-RevId: 447174265

Source-Link: googleapis/googleapis@185ba8a

Source-Link: googleapis/googleapis-gen@e3fa46f
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiZTNmYTQ2ZmU0NzgxMDY5OGVmOTY5M2VkZWFmNWMzNzRkZDQ3ZThkNyJ9
  • Loading branch information
gcf-owl-bot[bot] authored Aug 15, 2022
1 parent bd6ffe8 commit 0bff59e
Show file tree
Hide file tree
Showing 22 changed files with 331 additions and 529 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -539,6 +539,7 @@ def __init__(
quota_project_id=client_options.quota_project_id,
client_info=client_info,
always_use_jwt_access=True,
api_audience=client_options.api_audience,
)

def get_revision(
Expand Down Expand Up @@ -623,11 +624,19 @@ def sample_get_revision():
# and friendly error handling.
rpc = self._transport._wrapped_methods[self._transport.get_revision]

# Certain fields should be provided within the metadata header;
# add these here.
metadata = tuple(metadata) + (
gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)),
header_params = {}

routing_param_regex = re.compile(
"^projects/[^/]+/locations/(?P<location>[^/]+)(?:/.*)?$"
)
regex_match = routing_param_regex.match(request.name)
if regex_match and regex_match.group("location"):
header_params["location"] = regex_match.group("location")

if header_params:
metadata = tuple(metadata) + (
gapic_v1.routing_header.to_grpc_metadata(header_params),
)

# Send the request.
response = rpc(
Expand Down Expand Up @@ -726,11 +735,19 @@ def sample_list_revisions():
# and friendly error handling.
rpc = self._transport._wrapped_methods[self._transport.list_revisions]

# Certain fields should be provided within the metadata header;
# add these here.
metadata = tuple(metadata) + (
gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)),
header_params = {}

routing_param_regex = re.compile(
"^projects/[^/]+/locations/(?P<location>[^/]+)(?:/.*)?$"
)
regex_match = routing_param_regex.match(request.parent)
if regex_match and regex_match.group("location"):
header_params["location"] = regex_match.group("location")

if header_params:
metadata = tuple(metadata) + (
gapic_v1.routing_header.to_grpc_metadata(header_params),
)

# Send the request.
response = rpc(
Expand Down Expand Up @@ -840,11 +857,19 @@ def sample_delete_revision():
# and friendly error handling.
rpc = self._transport._wrapped_methods[self._transport.delete_revision]

# Certain fields should be provided within the metadata header;
# add these here.
metadata = tuple(metadata) + (
gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)),
header_params = {}

routing_param_regex = re.compile(
"^projects/[^/]+/locations/(?P<location>[^/]+)(?:/.*)?$"
)
regex_match = routing_param_regex.match(request.name)
if regex_match and regex_match.group("location"):
header_params["location"] = regex_match.group("location")

if header_params:
metadata = tuple(metadata) + (
gapic_v1.routing_header.to_grpc_metadata(header_params),
)

# Send the request.
response = rpc(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ def __init__(
quota_project_id: Optional[str] = None,
client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO,
always_use_jwt_access: Optional[bool] = False,
api_audience: Optional[str] = None,
**kwargs,
) -> None:
"""Instantiate the transport.
Expand Down Expand Up @@ -83,11 +84,6 @@ def __init__(
be used for service account credentials.
"""

# Save the hostname. Default to port 443 (HTTPS) if none is specified.
if ":" not in host:
host += ":443"
self._host = host

scopes_kwargs = {"scopes": scopes, "default_scopes": self.AUTH_SCOPES}

# Save the scopes.
Expand All @@ -108,6 +104,11 @@ def __init__(
credentials, _ = google.auth.default(
**scopes_kwargs, quota_project_id=quota_project_id
)
# Don't apply audience if the credentials file passed from user.
if hasattr(credentials, "with_gdch_audience"):
credentials = credentials.with_gdch_audience(
api_audience if api_audience else host
)

# If the credentials are service account credentials, then always try to use self signed JWT.
if (
Expand All @@ -120,6 +121,11 @@ def __init__(
# Save the credentials.
self._credentials = credentials

# Save the hostname. Default to port 443 (HTTPS) if none is specified.
if ":" not in host:
host += ":443"
self._host = host

def _prep_wrapped_messages(self, client_info):
# Precompute the wrapped methods.
self._wrapped_methods = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ def __init__(
quota_project_id: Optional[str] = None,
client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO,
always_use_jwt_access: Optional[bool] = False,
api_audience: Optional[str] = None,
) -> None:
"""Instantiate the transport.
Expand Down Expand Up @@ -156,6 +157,7 @@ def __init__(
quota_project_id=quota_project_id,
client_info=client_info,
always_use_jwt_access=always_use_jwt_access,
api_audience=api_audience,
)

if not self._grpc_channel:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ def __init__(
quota_project_id=None,
client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO,
always_use_jwt_access: Optional[bool] = False,
api_audience: Optional[str] = None,
) -> None:
"""Instantiate the transport.
Expand Down Expand Up @@ -201,6 +202,7 @@ def __init__(
quota_project_id=quota_project_id,
client_info=client_info,
always_use_jwt_access=always_use_jwt_access,
api_audience=api_audience,
)

if not self._grpc_channel:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@
from google.cloud.run_v2.types import vendor_settings
from google.iam.v1 import iam_policy_pb2 # type: ignore
from google.iam.v1 import policy_pb2 # type: ignore
from google.protobuf import field_mask_pb2 # type: ignore
from google.protobuf import timestamp_pb2 # type: ignore
from .transports.base import ServicesTransport, DEFAULT_CLIENT_INFO
from .transports.grpc_asyncio import ServicesGrpcAsyncIOTransport
Expand Down Expand Up @@ -592,7 +591,6 @@ async def update_service(
request: Union[gcr_service.UpdateServiceRequest, dict] = None,
*,
service: gcr_service.Service = None,
update_mask: field_mask_pb2.FieldMask = None,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: float = None,
metadata: Sequence[Tuple[str, str]] = (),
Expand Down Expand Up @@ -630,11 +628,6 @@ async def sample_update_service():
This corresponds to the ``service`` field
on the ``request`` instance; if ``request`` is provided, this
should not be set.
update_mask (:class:`google.protobuf.field_mask_pb2.FieldMask`):
The list of fields to be updated.
This corresponds to the ``update_mask`` field
on the ``request`` instance; if ``request`` is provided, this
should not be set.
retry (google.api_core.retry.Retry): Designation of what errors, if any,
should be retried.
timeout (float): The timeout for this request.
Expand All @@ -657,7 +650,7 @@ async def sample_update_service():
# Create or coerce a protobuf request object.
# Quick check: If we got a request object, we should *not* have
# gotten any keyword arguments that map to the request.
has_flattened_params = any([service, update_mask])
has_flattened_params = any([service])
if request is not None and has_flattened_params:
raise ValueError(
"If the `request` argument is set, then none of "
Expand All @@ -670,8 +663,6 @@ async def sample_update_service():
# request, apply these.
if service is not None:
request.service = service
if update_mask is not None:
request.update_mask = update_mask

# Wrap the RPC method; this adds retry and timeout information,
# and friendly error handling.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@
from google.cloud.run_v2.types import vendor_settings
from google.iam.v1 import iam_policy_pb2 # type: ignore
from google.iam.v1 import policy_pb2 # type: ignore
from google.protobuf import field_mask_pb2 # type: ignore
from google.protobuf import timestamp_pb2 # type: ignore
from .transports.base import ServicesTransport, DEFAULT_CLIENT_INFO
from .transports.grpc import ServicesGrpcTransport
Expand Down Expand Up @@ -543,6 +542,7 @@ def __init__(
quota_project_id=client_options.quota_project_id,
client_info=client_info,
always_use_jwt_access=True,
api_audience=client_options.api_audience,
)

def create_service(
Expand Down Expand Up @@ -659,11 +659,19 @@ def sample_create_service():
# and friendly error handling.
rpc = self._transport._wrapped_methods[self._transport.create_service]

# Certain fields should be provided within the metadata header;
# add these here.
metadata = tuple(metadata) + (
gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)),
header_params = {}

routing_param_regex = re.compile(
"^projects/[^/]+/locations/(?P<location>[^/]+)$"
)
regex_match = routing_param_regex.match(request.parent)
if regex_match and regex_match.group("location"):
header_params["location"] = regex_match.group("location")

if header_params:
metadata = tuple(metadata) + (
gapic_v1.routing_header.to_grpc_metadata(header_params),
)

# Send the request.
response = rpc(
Expand Down Expand Up @@ -770,11 +778,19 @@ def sample_get_service():
# and friendly error handling.
rpc = self._transport._wrapped_methods[self._transport.get_service]

# Certain fields should be provided within the metadata header;
# add these here.
metadata = tuple(metadata) + (
gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)),
header_params = {}

routing_param_regex = re.compile(
"^projects/[^/]+/locations/(?P<location>[^/]+)(?:/.*)?$"
)
regex_match = routing_param_regex.match(request.name)
if regex_match and regex_match.group("location"):
header_params["location"] = regex_match.group("location")

if header_params:
metadata = tuple(metadata) + (
gapic_v1.routing_header.to_grpc_metadata(header_params),
)

# Send the request.
response = rpc(
Expand Down Expand Up @@ -872,11 +888,19 @@ def sample_list_services():
# and friendly error handling.
rpc = self._transport._wrapped_methods[self._transport.list_services]

# Certain fields should be provided within the metadata header;
# add these here.
metadata = tuple(metadata) + (
gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)),
header_params = {}

routing_param_regex = re.compile(
"^projects/[^/]+/locations/(?P<location>[^/]+)$"
)
regex_match = routing_param_regex.match(request.parent)
if regex_match and regex_match.group("location"):
header_params["location"] = regex_match.group("location")

if header_params:
metadata = tuple(metadata) + (
gapic_v1.routing_header.to_grpc_metadata(header_params),
)

# Send the request.
response = rpc(
Expand All @@ -903,7 +927,6 @@ def update_service(
request: Union[gcr_service.UpdateServiceRequest, dict] = None,
*,
service: gcr_service.Service = None,
update_mask: field_mask_pb2.FieldMask = None,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: float = None,
metadata: Sequence[Tuple[str, str]] = (),
Expand Down Expand Up @@ -941,11 +964,6 @@ def sample_update_service():
This corresponds to the ``service`` field
on the ``request`` instance; if ``request`` is provided, this
should not be set.
update_mask (google.protobuf.field_mask_pb2.FieldMask):
The list of fields to be updated.
This corresponds to the ``update_mask`` field
on the ``request`` instance; if ``request`` is provided, this
should not be set.
retry (google.api_core.retry.Retry): Designation of what errors, if any,
should be retried.
timeout (float): The timeout for this request.
Expand All @@ -968,7 +986,7 @@ def sample_update_service():
# Create or coerce a protobuf request object.
# Quick check: If we got a request object, we should *not* have
# gotten any keyword arguments that map to the request.
has_flattened_params = any([service, update_mask])
has_flattened_params = any([service])
if request is not None and has_flattened_params:
raise ValueError(
"If the `request` argument is set, then none of "
Expand All @@ -985,20 +1003,24 @@ def sample_update_service():
# request, apply these.
if service is not None:
request.service = service
if update_mask is not None:
request.update_mask = update_mask

# Wrap the RPC method; this adds retry and timeout information,
# and friendly error handling.
rpc = self._transport._wrapped_methods[self._transport.update_service]

# Certain fields should be provided within the metadata header;
# add these here.
metadata = tuple(metadata) + (
gapic_v1.routing_header.to_grpc_metadata(
(("service.name", request.service.name),)
),
header_params = {}

routing_param_regex = re.compile(
"^projects/[^/]+/locations/(?P<location>[^/]+)(?:/.*)?$"
)
regex_match = routing_param_regex.match(request.service.name)
if regex_match and regex_match.group("location"):
header_params["location"] = regex_match.group("location")

if header_params:
metadata = tuple(metadata) + (
gapic_v1.routing_header.to_grpc_metadata(header_params),
)

# Send the request.
response = rpc(
Expand Down Expand Up @@ -1111,11 +1133,19 @@ def sample_delete_service():
# and friendly error handling.
rpc = self._transport._wrapped_methods[self._transport.delete_service]

# Certain fields should be provided within the metadata header;
# add these here.
metadata = tuple(metadata) + (
gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)),
header_params = {}

routing_param_regex = re.compile(
"^projects/[^/]+/locations/(?P<location>[^/]+)(?:/.*)?$"
)
regex_match = routing_param_regex.match(request.name)
if regex_match and regex_match.group("location"):
header_params["location"] = regex_match.group("location")

if header_params:
metadata = tuple(metadata) + (
gapic_v1.routing_header.to_grpc_metadata(header_params),
)

# Send the request.
response = rpc(
Expand Down
Loading

0 comments on commit 0bff59e

Please sign in to comment.