Skip to content
This repository has been archived by the owner on Sep 5, 2023. It is now read-only.

Commit

Permalink
chore: Update gapic-generator-python to v1.8.5 (#325)
Browse files Browse the repository at this point in the history
* feat: enable "rest" transport in Python for services supporting numeric enums

PiperOrigin-RevId: 508143576

Source-Link: googleapis/googleapis@7a702a9

Source-Link: googleapis/googleapis-gen@6ad1279
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiNmFkMTI3OWMwZTdhYTc4N2FjNmI2NmM5ZmQ0YTIxMDY5MmVkZmZjZCJ9

* 🦉 Updates from OwlBot post-processor

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

* fix: Add service_yaml_parameters to py_gapic_library BUILD.bazel targets

PiperOrigin-RevId: 510187992

Source-Link: googleapis/googleapis@5edc235

Source-Link: googleapis/googleapis-gen@b0bedb7
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiYjBiZWRiNzJlNDc2NWEzZTBiNjc0YTI4YzUwZWEwZjlhOWIyNmE4OSJ9

* 🦉 Updates from OwlBot post-processor

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

* chore: Update gapic-generator-python to v1.8.5

PiperOrigin-RevId: 511892190

Source-Link: googleapis/googleapis@a45d9c0

Source-Link: googleapis/googleapis-gen@1907294
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiMTkwNzI5NGIxZDgzNjVlYTI0ZjhjNWYyZTA1OWE2NDEyNGM0ZWQzYiJ9

* 🦉 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>
Co-authored-by: Victor Chudnovsky <vchudnov@google.com>
  • Loading branch information
3 people committed Feb 28, 2023
1 parent 2344201 commit 6c4bf6e
Show file tree
Hide file tree
Showing 87 changed files with 25,579 additions and 729 deletions.
135 changes: 135 additions & 0 deletions google/cloud/talent_v4/gapic_metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,36 @@
]
}
}
},
"rest": {
"libraryClient": "CompanyServiceClient",
"rpcs": {
"CreateCompany": {
"methods": [
"create_company"
]
},
"DeleteCompany": {
"methods": [
"delete_company"
]
},
"GetCompany": {
"methods": [
"get_company"
]
},
"ListCompanies": {
"methods": [
"list_companies"
]
},
"UpdateCompany": {
"methods": [
"update_company"
]
}
}
}
}
},
Expand All @@ -90,6 +120,16 @@
]
}
}
},
"rest": {
"libraryClient": "CompletionClient",
"rpcs": {
"CompleteQuery": {
"methods": [
"complete_query"
]
}
}
}
}
},
Expand All @@ -114,6 +154,16 @@
]
}
}
},
"rest": {
"libraryClient": "EventServiceClient",
"rpcs": {
"CreateClientEvent": {
"methods": [
"create_client_event"
]
}
}
}
}
},
Expand Down Expand Up @@ -228,6 +278,61 @@
]
}
}
},
"rest": {
"libraryClient": "JobServiceClient",
"rpcs": {
"BatchCreateJobs": {
"methods": [
"batch_create_jobs"
]
},
"BatchDeleteJobs": {
"methods": [
"batch_delete_jobs"
]
},
"BatchUpdateJobs": {
"methods": [
"batch_update_jobs"
]
},
"CreateJob": {
"methods": [
"create_job"
]
},
"DeleteJob": {
"methods": [
"delete_job"
]
},
"GetJob": {
"methods": [
"get_job"
]
},
"ListJobs": {
"methods": [
"list_jobs"
]
},
"SearchJobs": {
"methods": [
"search_jobs"
]
},
"SearchJobsForAlert": {
"methods": [
"search_jobs_for_alert"
]
},
"UpdateJob": {
"methods": [
"update_job"
]
}
}
}
}
},
Expand Down Expand Up @@ -292,6 +397,36 @@
]
}
}
},
"rest": {
"libraryClient": "TenantServiceClient",
"rpcs": {
"CreateTenant": {
"methods": [
"create_tenant"
]
},
"DeleteTenant": {
"methods": [
"delete_tenant"
]
},
"GetTenant": {
"methods": [
"get_tenant"
]
},
"ListTenants": {
"methods": [
"list_tenants"
]
},
"UpdateTenant": {
"methods": [
"update_tenant"
]
}
}
}
}
}
Expand Down
55 changes: 55 additions & 0 deletions google/cloud/talent_v4/services/company_service/async_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
except AttributeError: # pragma: NO COVER
OptionalRetry = Union[retries.Retry, object] # type: ignore

from google.longrunning import operations_pb2
from google.protobuf import field_mask_pb2 # type: ignore

from google.cloud.talent_v4.services.company_service import pagers
Expand Down Expand Up @@ -832,6 +833,60 @@ async def sample_list_companies():
# Done; return the response.
return response

async def get_operation(
self,
request: Optional[operations_pb2.GetOperationRequest] = None,
*,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, str]] = (),
) -> operations_pb2.Operation:
r"""Gets the latest state of a long-running operation.
Args:
request (:class:`~.operations_pb2.GetOperationRequest`):
The request object. Request message for
`GetOperation` method.
retry (google.api_core.retry.Retry): Designation of what errors,
if any, should be retried.
timeout (float): The timeout for this request.
metadata (Sequence[Tuple[str, str]]): Strings which should be
sent along with the request as metadata.
Returns:
~.operations_pb2.Operation:
An ``Operation`` object.
"""
# Create or coerce a protobuf request object.
# The request isn't a proto-plus wrapped type,
# so it must be constructed via keyword expansion.
if isinstance(request, dict):
request = operations_pb2.GetOperationRequest(**request)

# Wrap the RPC method; this adds retry and timeout information,
# and friendly error handling.
rpc = gapic_v1.method.wrap_method(
self._client._transport.get_operation,
default_timeout=None,
client_info=DEFAULT_CLIENT_INFO,
)

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

# Send the request.
response = await rpc(
request,
retry=retry,
timeout=timeout,
metadata=metadata,
)

# Done; return the response.
return response

async def __aenter__(self):
return self

Expand Down
57 changes: 57 additions & 0 deletions google/cloud/talent_v4/services/company_service/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
except AttributeError: # pragma: NO COVER
OptionalRetry = Union[retries.Retry, object] # type: ignore

from google.longrunning import operations_pb2
from google.protobuf import field_mask_pb2 # type: ignore

from google.cloud.talent_v4.services.company_service import pagers
Expand All @@ -57,6 +58,7 @@
from .transports.base import DEFAULT_CLIENT_INFO, CompanyServiceTransport
from .transports.grpc import CompanyServiceGrpcTransport
from .transports.grpc_asyncio import CompanyServiceGrpcAsyncIOTransport
from .transports.rest import CompanyServiceRestTransport


class CompanyServiceClientMeta(type):
Expand All @@ -72,6 +74,7 @@ class CompanyServiceClientMeta(type):
) # type: Dict[str, Type[CompanyServiceTransport]]
_transport_registry["grpc"] = CompanyServiceGrpcTransport
_transport_registry["grpc_asyncio"] = CompanyServiceGrpcAsyncIOTransport
_transport_registry["rest"] = CompanyServiceRestTransport

def get_transport_class(
cls,
Expand Down Expand Up @@ -1057,6 +1060,60 @@ def __exit__(self, type, value, traceback):
"""
self.transport.close()

def get_operation(
self,
request: Optional[operations_pb2.GetOperationRequest] = None,
*,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, str]] = (),
) -> operations_pb2.Operation:
r"""Gets the latest state of a long-running operation.
Args:
request (:class:`~.operations_pb2.GetOperationRequest`):
The request object. Request message for
`GetOperation` method.
retry (google.api_core.retry.Retry): Designation of what errors,
if any, should be retried.
timeout (float): The timeout for this request.
metadata (Sequence[Tuple[str, str]]): Strings which should be
sent along with the request as metadata.
Returns:
~.operations_pb2.Operation:
An ``Operation`` object.
"""
# Create or coerce a protobuf request object.
# The request isn't a proto-plus wrapped type,
# so it must be constructed via keyword expansion.
if isinstance(request, dict):
request = operations_pb2.GetOperationRequest(**request)

# Wrap the RPC method; this adds retry and timeout information,
# and friendly error handling.
rpc = gapic_v1.method.wrap_method(
self._transport.get_operation,
default_timeout=None,
client_info=DEFAULT_CLIENT_INFO,
)

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

# Send the request.
response = rpc(
request,
retry=retry,
timeout=timeout,
metadata=metadata,
)

# Done; return the response.
return response


DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo(
gapic_version=package_version.__version__
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,18 @@
from .base import CompanyServiceTransport
from .grpc import CompanyServiceGrpcTransport
from .grpc_asyncio import CompanyServiceGrpcAsyncIOTransport
from .rest import CompanyServiceRestInterceptor, CompanyServiceRestTransport

# Compile a registry of transports.
_transport_registry = OrderedDict() # type: Dict[str, Type[CompanyServiceTransport]]
_transport_registry["grpc"] = CompanyServiceGrpcTransport
_transport_registry["grpc_asyncio"] = CompanyServiceGrpcAsyncIOTransport
_transport_registry["rest"] = CompanyServiceRestTransport

__all__ = (
"CompanyServiceTransport",
"CompanyServiceGrpcTransport",
"CompanyServiceGrpcAsyncIOTransport",
"CompanyServiceRestTransport",
"CompanyServiceRestInterceptor",
)
10 changes: 10 additions & 0 deletions google/cloud/talent_v4/services/company_service/transports/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
from google.api_core import retry as retries
import google.auth # type: ignore
from google.auth import credentials as ga_credentials # type: ignore
from google.longrunning import operations_pb2
from google.oauth2 import service_account # type: ignore
from google.protobuf import empty_pb2 # type: ignore

Expand Down Expand Up @@ -242,6 +243,15 @@ def list_companies(
]:
raise NotImplementedError()

@property
def get_operation(
self,
) -> Callable[
[operations_pb2.GetOperationRequest],
Union[operations_pb2.Operation, Awaitable[operations_pb2.Operation]],
]:
raise NotImplementedError()

@property
def kind(self) -> str:
raise NotImplementedError()
Expand Down
18 changes: 18 additions & 0 deletions google/cloud/talent_v4/services/company_service/transports/grpc.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import google.auth # type: ignore
from google.auth import credentials as ga_credentials # type: ignore
from google.auth.transport.grpc import SslCredentials # type: ignore
from google.longrunning import operations_pb2
from google.protobuf import empty_pb2 # type: ignore
import grpc # type: ignore

Expand Down Expand Up @@ -369,6 +370,23 @@ def list_companies(
def close(self):
self.grpc_channel.close()

@property
def get_operation(
self,
) -> Callable[[operations_pb2.GetOperationRequest], operations_pb2.Operation]:
r"""Return a callable for the get_operation method over gRPC."""
# Generate a "stub function" on-the-fly which will actually make
# the request.
# gRPC handles serialization and deserialization, so we just need
# to pass in the functions for each.
if "get_operation" not in self._stubs:
self._stubs["get_operation"] = self.grpc_channel.unary_unary(
"/google.longrunning.Operations/GetOperation",
request_serializer=operations_pb2.GetOperationRequest.SerializeToString,
response_deserializer=operations_pb2.Operation.FromString,
)
return self._stubs["get_operation"]

@property
def kind(self) -> str:
return "grpc"
Expand Down
Loading

0 comments on commit 6c4bf6e

Please sign in to comment.