diff --git a/README.rst b/README.rst index 546baf0c..a81daaa9 100644 --- a/README.rst +++ b/README.rst @@ -34,6 +34,16 @@ In order to use this library, you first need to go through the following steps: .. _Enable the Cloud Talent Solution API.: https://cloud.google.com/jobs .. _Setup Authentication.: https://googleapis.dev/python/google-api-core/latest/auth.html +Supported Python Versions +^^^^^^^^^^^^^^^^^^^^^^^^^ +Python >= 3.6 + +Deprecated Python Versions +^^^^^^^^^^^^^^^^^^^^^^^^^^ +Python == 2.7. + +The last version of this library compatible with Python 2.7 is google-cloud-talent==0.6.1. + Installation ~~~~~~~~~~~~ diff --git a/UPGRADING.md b/UPGRADING.md new file mode 100644 index 00000000..cb385ee6 --- /dev/null +++ b/UPGRADING.md @@ -0,0 +1,106 @@ +# 1.0.0 Migration Guide + +The 1.0.0 release of the `google-cloud-talent` client is a significant upgrade based on a [next-gen code generator](https://github.com/googleapis/gapic-generator-python), and includes substantial interface changes. Existing code written for earlier versions of this library will likely require updates to use this version. This document describes the changes that have been made, and what you need to do to update your usage. + +If you experience issues or have questions, please file an [issue](https://github.com/googleapis/python-talent/issues). + +## Supported Python Versions + +> **WARNING**: Breaking change +The 1.0.0 release requires Python 3.6+. + +## Method Calls + +> **WARNING**: Breaking change +Methods expect request objects. We provide a script that will convert most common use cases. +* Install the library +```py +python3 -m pip install google-cloud-talent +``` + +* The scripts `fixup_talent_v4beta1_keywords.py` shipped with the library. It expects +an input directory (with the code to convert) and an empty destination directory. + +```sh +$ fixup_talent_v1_keywords.py --input-directory .samples/ --output-directory samples/ +``` + +**Before:** +```py +from google.cloud import talent_v4beta1 +client = talent_v4beta1.JobServiceClient() +parent = client.project_path('[PROJECT]') +# TODO: Initialize `jobs`: +jobs = [] +response = client.batch_create_jobs(parent, jobs) +``` + +**After:** +```py +response = client.batch_create_jobs(request={"parent": "''", "jobs": "[]"}) +``` + +### More Details + +In `google-cloud-talent<1.0.0`, parameters required by the API were positional parameters and optional parameters were keyword parameters. + +**Before:** +```py + def batch_create_jobs( + self, + parent, + jobs, + retry=google.api_core.gapic_v1.method.DEFAULT, + timeout=google.api_core.gapic_v1.method.DEFAULT, + metadata=None, + ): +``` + +In the 1.0.0 release, all methods have a single positional parameter `request`. Method docstrings indicate whether a parameter is required or optional. + +Some methods have additional keyword only parameters. The available parameters depend on the [`google.api.method_signature` annotation] (https://github.com/googleapis/googleapis/blob/master/google/cloud/talent/v4beta1/job_service.proto#L73) specified by the API producer. + + +**After:** +```py + def batch_create_jobs( + self, + request: job_service.BatchCreateJobsRequest = None, + *, + parent: str = None, + jobs: Sequence[job.Job] = None, + retry: retries.Retry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> operation.Operation: +``` + +> **NOTE:** The `request` parameter and flattened keyword parameters for the API are mutually exclusive. +> Passing both will result in an error. +Both of these calls are valid: +```py +response = client.batch_create_jobs( + request={ + "parent": parent, + "jobs": jobs, + } +) +``` + +```py +response = client.batch_create_jobs( + parent=parent, + jobs=jobs, +) +``` + +This call is invalid because it mixes `request` with a keyword argument `jobs`. Executing this code will result in an error. + +```py +response = client.batch_create_jobs( + request={ + "parent": parent, + }, + jobs=jobs +) +``` \ No newline at end of file diff --git a/docs/UPGRADING.md b/docs/UPGRADING.md new file mode 120000 index 00000000..01097c8c --- /dev/null +++ b/docs/UPGRADING.md @@ -0,0 +1 @@ +../UPGRADING.md \ No newline at end of file diff --git a/docs/gapic/v4beta1/api.rst b/docs/gapic/v4beta1/api.rst deleted file mode 100644 index 7c2b844e..00000000 --- a/docs/gapic/v4beta1/api.rst +++ /dev/null @@ -1,6 +0,0 @@ -Client for Cloud Talent Solution API -==================================== - -.. automodule:: google.cloud.talent_v4beta1 - :members: - :inherited-members: \ No newline at end of file diff --git a/docs/gapic/v4beta1/types.rst b/docs/gapic/v4beta1/types.rst deleted file mode 100644 index af0bf0f2..00000000 --- a/docs/gapic/v4beta1/types.rst +++ /dev/null @@ -1,5 +0,0 @@ -Types for Cloud Talent Solution API Client -========================================== - -.. automodule:: google.cloud.talent_v4beta1.types - :members: \ No newline at end of file diff --git a/docs/index.rst b/docs/index.rst index 8bd49270..d181d6e9 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -7,10 +7,20 @@ Api Reference .. toctree:: :maxdepth: 2 - gapic/v4beta1/api - gapic/v4beta1/types + talent_v4beta1/services + talent_v4beta1/types changelog +Migration Guide +--------------- + +See the guide below for instructions on migrating to the 2.x release of this library. + +.. toctree:: + :maxdepth: 2 + + UPGRADING + Changelog --------- diff --git a/docs/talent_v4beta1/services.rst b/docs/talent_v4beta1/services.rst new file mode 100644 index 00000000..babbaa4e --- /dev/null +++ b/docs/talent_v4beta1/services.rst @@ -0,0 +1,24 @@ +Services for Google Cloud Talent v4beta1 API +============================================ + +.. automodule:: google.cloud.talent_v4beta1.services.application_service + :members: + :inherited-members: +.. automodule:: google.cloud.talent_v4beta1.services.company_service + :members: + :inherited-members: +.. automodule:: google.cloud.talent_v4beta1.services.completion + :members: + :inherited-members: +.. automodule:: google.cloud.talent_v4beta1.services.event_service + :members: + :inherited-members: +.. automodule:: google.cloud.talent_v4beta1.services.job_service + :members: + :inherited-members: +.. automodule:: google.cloud.talent_v4beta1.services.profile_service + :members: + :inherited-members: +.. automodule:: google.cloud.talent_v4beta1.services.tenant_service + :members: + :inherited-members: diff --git a/docs/talent_v4beta1/types.rst b/docs/talent_v4beta1/types.rst new file mode 100644 index 00000000..c483abcd --- /dev/null +++ b/docs/talent_v4beta1/types.rst @@ -0,0 +1,5 @@ +Types for Google Cloud Talent v4beta1 API +========================================= + +.. automodule:: google.cloud.talent_v4beta1.types + :members: diff --git a/google/cloud/talent.py b/google/cloud/talent.py deleted file mode 100644 index 431f7eb5..00000000 --- a/google/cloud/talent.py +++ /dev/null @@ -1,41 +0,0 @@ -# -*- 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 -# -# https://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. - - -from __future__ import absolute_import - -from google.cloud.talent_v4beta1 import ApplicationServiceClient -from google.cloud.talent_v4beta1 import CompanyServiceClient -from google.cloud.talent_v4beta1 import CompletionClient -from google.cloud.talent_v4beta1 import EventServiceClient -from google.cloud.talent_v4beta1 import JobServiceClient -from google.cloud.talent_v4beta1 import ProfileServiceClient -from google.cloud.talent_v4beta1 import TenantServiceClient -from google.cloud.talent_v4beta1 import enums -from google.cloud.talent_v4beta1 import types - - -__all__ = ( - "enums", - "types", - "ApplicationServiceClient", - "CompanyServiceClient", - "CompletionClient", - "EventServiceClient", - "JobServiceClient", - "ProfileServiceClient", - "TenantServiceClient", -) diff --git a/google/cloud/talent/__init__.py b/google/cloud/talent/__init__.py new file mode 100644 index 00000000..cb19a827 --- /dev/null +++ b/google/cloud/talent/__init__.py @@ -0,0 +1,302 @@ +# -*- 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. +# + +from google.cloud.talent_v4beta1.services.application_service.async_client import ( + ApplicationServiceAsyncClient, +) +from google.cloud.talent_v4beta1.services.application_service.client import ( + ApplicationServiceClient, +) +from google.cloud.talent_v4beta1.services.company_service.async_client import ( + CompanyServiceAsyncClient, +) +from google.cloud.talent_v4beta1.services.company_service.client import ( + CompanyServiceClient, +) +from google.cloud.talent_v4beta1.services.completion.async_client import ( + CompletionAsyncClient, +) +from google.cloud.talent_v4beta1.services.completion.client import CompletionClient +from google.cloud.talent_v4beta1.services.event_service.async_client import ( + EventServiceAsyncClient, +) +from google.cloud.talent_v4beta1.services.event_service.client import EventServiceClient +from google.cloud.talent_v4beta1.services.job_service.async_client import ( + JobServiceAsyncClient, +) +from google.cloud.talent_v4beta1.services.job_service.client import JobServiceClient +from google.cloud.talent_v4beta1.services.profile_service.async_client import ( + ProfileServiceAsyncClient, +) +from google.cloud.talent_v4beta1.services.profile_service.client import ( + ProfileServiceClient, +) +from google.cloud.talent_v4beta1.services.tenant_service.async_client import ( + TenantServiceAsyncClient, +) +from google.cloud.talent_v4beta1.services.tenant_service.client import ( + TenantServiceClient, +) +from google.cloud.talent_v4beta1.types.application import Application +from google.cloud.talent_v4beta1.types.application_service import ( + CreateApplicationRequest, +) +from google.cloud.talent_v4beta1.types.application_service import ( + DeleteApplicationRequest, +) +from google.cloud.talent_v4beta1.types.application_service import GetApplicationRequest +from google.cloud.talent_v4beta1.types.application_service import ( + ListApplicationsRequest, +) +from google.cloud.talent_v4beta1.types.application_service import ( + ListApplicationsResponse, +) +from google.cloud.talent_v4beta1.types.application_service import ( + UpdateApplicationRequest, +) +from google.cloud.talent_v4beta1.types.common import AvailabilitySignalType +from google.cloud.talent_v4beta1.types.common import BatchOperationMetadata +from google.cloud.talent_v4beta1.types.common import Certification +from google.cloud.talent_v4beta1.types.common import CommuteMethod +from google.cloud.talent_v4beta1.types.common import CompanySize +from google.cloud.talent_v4beta1.types.common import CompensationInfo +from google.cloud.talent_v4beta1.types.common import ContactInfoUsage +from google.cloud.talent_v4beta1.types.common import CustomAttribute +from google.cloud.talent_v4beta1.types.common import DegreeType +from google.cloud.talent_v4beta1.types.common import DeviceInfo +from google.cloud.talent_v4beta1.types.common import EmploymentType +from google.cloud.talent_v4beta1.types.common import HtmlSanitization +from google.cloud.talent_v4beta1.types.common import Interview +from google.cloud.talent_v4beta1.types.common import JobBenefit +from google.cloud.talent_v4beta1.types.common import JobCategory +from google.cloud.talent_v4beta1.types.common import JobLevel +from google.cloud.talent_v4beta1.types.common import Location +from google.cloud.talent_v4beta1.types.common import Outcome +from google.cloud.talent_v4beta1.types.common import PostingRegion +from google.cloud.talent_v4beta1.types.common import Rating +from google.cloud.talent_v4beta1.types.common import RequestMetadata +from google.cloud.talent_v4beta1.types.common import ResponseMetadata +from google.cloud.talent_v4beta1.types.common import Skill +from google.cloud.talent_v4beta1.types.common import SkillProficiencyLevel +from google.cloud.talent_v4beta1.types.common import SpellingCorrection +from google.cloud.talent_v4beta1.types.common import TimestampRange +from google.cloud.talent_v4beta1.types.common import Visibility +from google.cloud.talent_v4beta1.types.company import Company +from google.cloud.talent_v4beta1.types.company_service import CreateCompanyRequest +from google.cloud.talent_v4beta1.types.company_service import DeleteCompanyRequest +from google.cloud.talent_v4beta1.types.company_service import GetCompanyRequest +from google.cloud.talent_v4beta1.types.company_service import ListCompaniesRequest +from google.cloud.talent_v4beta1.types.company_service import ListCompaniesResponse +from google.cloud.talent_v4beta1.types.company_service import UpdateCompanyRequest +from google.cloud.talent_v4beta1.types.completion_service import CompleteQueryRequest +from google.cloud.talent_v4beta1.types.completion_service import CompleteQueryResponse +from google.cloud.talent_v4beta1.types.event import ClientEvent +from google.cloud.talent_v4beta1.types.event import JobEvent +from google.cloud.talent_v4beta1.types.event import ProfileEvent +from google.cloud.talent_v4beta1.types.event_service import CreateClientEventRequest +from google.cloud.talent_v4beta1.types.filters import ApplicationDateFilter +from google.cloud.talent_v4beta1.types.filters import ApplicationJobFilter +from google.cloud.talent_v4beta1.types.filters import ApplicationOutcomeNotesFilter +from google.cloud.talent_v4beta1.types.filters import AvailabilityFilter +from google.cloud.talent_v4beta1.types.filters import CandidateAvailabilityFilter +from google.cloud.talent_v4beta1.types.filters import CommuteFilter +from google.cloud.talent_v4beta1.types.filters import CompensationFilter +from google.cloud.talent_v4beta1.types.filters import EducationFilter +from google.cloud.talent_v4beta1.types.filters import EmployerFilter +from google.cloud.talent_v4beta1.types.filters import JobQuery +from google.cloud.talent_v4beta1.types.filters import JobTitleFilter +from google.cloud.talent_v4beta1.types.filters import LocationFilter +from google.cloud.talent_v4beta1.types.filters import PersonNameFilter +from google.cloud.talent_v4beta1.types.filters import ProfileQuery +from google.cloud.talent_v4beta1.types.filters import SkillFilter +from google.cloud.talent_v4beta1.types.filters import TimeFilter +from google.cloud.talent_v4beta1.types.filters import WorkExperienceFilter +from google.cloud.talent_v4beta1.types.histogram import HistogramQuery +from google.cloud.talent_v4beta1.types.histogram import HistogramQueryResult +from google.cloud.talent_v4beta1.types.job import Job +from google.cloud.talent_v4beta1.types.job_service import BatchCreateJobsRequest +from google.cloud.talent_v4beta1.types.job_service import BatchDeleteJobsRequest +from google.cloud.talent_v4beta1.types.job_service import BatchUpdateJobsRequest +from google.cloud.talent_v4beta1.types.job_service import CreateJobRequest +from google.cloud.talent_v4beta1.types.job_service import DeleteJobRequest +from google.cloud.talent_v4beta1.types.job_service import GetJobRequest +from google.cloud.talent_v4beta1.types.job_service import JobOperationResult +from google.cloud.talent_v4beta1.types.job_service import JobView +from google.cloud.talent_v4beta1.types.job_service import ListJobsRequest +from google.cloud.talent_v4beta1.types.job_service import ListJobsResponse +from google.cloud.talent_v4beta1.types.job_service import SearchJobsRequest +from google.cloud.talent_v4beta1.types.job_service import SearchJobsResponse +from google.cloud.talent_v4beta1.types.job_service import UpdateJobRequest +from google.cloud.talent_v4beta1.types.profile import Activity +from google.cloud.talent_v4beta1.types.profile import AdditionalContactInfo +from google.cloud.talent_v4beta1.types.profile import Address +from google.cloud.talent_v4beta1.types.profile import AvailabilitySignal +from google.cloud.talent_v4beta1.types.profile import Degree +from google.cloud.talent_v4beta1.types.profile import EducationRecord +from google.cloud.talent_v4beta1.types.profile import Email +from google.cloud.talent_v4beta1.types.profile import EmploymentRecord +from google.cloud.talent_v4beta1.types.profile import Patent +from google.cloud.talent_v4beta1.types.profile import PersonName +from google.cloud.talent_v4beta1.types.profile import PersonalUri +from google.cloud.talent_v4beta1.types.profile import Phone +from google.cloud.talent_v4beta1.types.profile import Profile +from google.cloud.talent_v4beta1.types.profile import Publication +from google.cloud.talent_v4beta1.types.profile import Resume +from google.cloud.talent_v4beta1.types.profile_service import CreateProfileRequest +from google.cloud.talent_v4beta1.types.profile_service import DeleteProfileRequest +from google.cloud.talent_v4beta1.types.profile_service import GetProfileRequest +from google.cloud.talent_v4beta1.types.profile_service import ListProfilesRequest +from google.cloud.talent_v4beta1.types.profile_service import ListProfilesResponse +from google.cloud.talent_v4beta1.types.profile_service import SearchProfilesRequest +from google.cloud.talent_v4beta1.types.profile_service import SearchProfilesResponse +from google.cloud.talent_v4beta1.types.profile_service import SummarizedProfile +from google.cloud.talent_v4beta1.types.profile_service import UpdateProfileRequest +from google.cloud.talent_v4beta1.types.tenant import Tenant +from google.cloud.talent_v4beta1.types.tenant_service import CreateTenantRequest +from google.cloud.talent_v4beta1.types.tenant_service import DeleteTenantRequest +from google.cloud.talent_v4beta1.types.tenant_service import GetTenantRequest +from google.cloud.talent_v4beta1.types.tenant_service import ListTenantsRequest +from google.cloud.talent_v4beta1.types.tenant_service import ListTenantsResponse +from google.cloud.talent_v4beta1.types.tenant_service import UpdateTenantRequest + +__all__ = ( + "Activity", + "AdditionalContactInfo", + "Address", + "Application", + "ApplicationDateFilter", + "ApplicationJobFilter", + "ApplicationOutcomeNotesFilter", + "ApplicationServiceAsyncClient", + "ApplicationServiceClient", + "AvailabilityFilter", + "AvailabilitySignal", + "AvailabilitySignalType", + "BatchCreateJobsRequest", + "BatchDeleteJobsRequest", + "BatchOperationMetadata", + "BatchUpdateJobsRequest", + "CandidateAvailabilityFilter", + "Certification", + "ClientEvent", + "CommuteFilter", + "CommuteMethod", + "Company", + "CompanyServiceAsyncClient", + "CompanyServiceClient", + "CompanySize", + "CompensationFilter", + "CompensationInfo", + "CompleteQueryRequest", + "CompleteQueryResponse", + "CompletionAsyncClient", + "CompletionClient", + "ContactInfoUsage", + "CreateApplicationRequest", + "CreateClientEventRequest", + "CreateCompanyRequest", + "CreateJobRequest", + "CreateProfileRequest", + "CreateTenantRequest", + "CustomAttribute", + "Degree", + "DegreeType", + "DeleteApplicationRequest", + "DeleteCompanyRequest", + "DeleteJobRequest", + "DeleteProfileRequest", + "DeleteTenantRequest", + "DeviceInfo", + "EducationFilter", + "EducationRecord", + "Email", + "EmployerFilter", + "EmploymentRecord", + "EmploymentType", + "EventServiceAsyncClient", + "EventServiceClient", + "GetApplicationRequest", + "GetCompanyRequest", + "GetJobRequest", + "GetProfileRequest", + "GetTenantRequest", + "HistogramQuery", + "HistogramQueryResult", + "HtmlSanitization", + "Interview", + "Job", + "JobBenefit", + "JobCategory", + "JobEvent", + "JobLevel", + "JobOperationResult", + "JobQuery", + "JobServiceAsyncClient", + "JobServiceClient", + "JobTitleFilter", + "JobView", + "ListApplicationsRequest", + "ListApplicationsResponse", + "ListCompaniesRequest", + "ListCompaniesResponse", + "ListJobsRequest", + "ListJobsResponse", + "ListProfilesRequest", + "ListProfilesResponse", + "ListTenantsRequest", + "ListTenantsResponse", + "Location", + "LocationFilter", + "Outcome", + "Patent", + "PersonName", + "PersonNameFilter", + "PersonalUri", + "Phone", + "PostingRegion", + "Profile", + "ProfileEvent", + "ProfileQuery", + "ProfileServiceAsyncClient", + "ProfileServiceClient", + "Publication", + "Rating", + "RequestMetadata", + "ResponseMetadata", + "Resume", + "SearchJobsRequest", + "SearchJobsResponse", + "SearchProfilesRequest", + "SearchProfilesResponse", + "Skill", + "SkillFilter", + "SkillProficiencyLevel", + "SpellingCorrection", + "SummarizedProfile", + "Tenant", + "TenantServiceAsyncClient", + "TenantServiceClient", + "TimeFilter", + "TimestampRange", + "UpdateApplicationRequest", + "UpdateCompanyRequest", + "UpdateJobRequest", + "UpdateProfileRequest", + "UpdateTenantRequest", + "Visibility", + "WorkExperienceFilter", +) diff --git a/google/cloud/talent/py.typed b/google/cloud/talent/py.typed new file mode 100644 index 00000000..d9645927 --- /dev/null +++ b/google/cloud/talent/py.typed @@ -0,0 +1,2 @@ +# Marker file for PEP 561. +# The google-cloud-talent package uses inline types. diff --git a/google/cloud/talent_v4beta1/__init__.py b/google/cloud/talent_v4beta1/__init__.py index 54a597f5..4743ac58 100644 --- a/google/cloud/talent_v4beta1/__init__.py +++ b/google/cloud/talent_v4beta1/__init__.py @@ -1,87 +1,257 @@ # -*- 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 # -# https://www.apache.org/licenses/LICENSE-2.0 +# 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. +# - -from __future__ import absolute_import -import sys -import warnings - -from google.cloud.talent_v4beta1 import types -from google.cloud.talent_v4beta1.gapic import application_service_client -from google.cloud.talent_v4beta1.gapic import company_service_client -from google.cloud.talent_v4beta1.gapic import completion_client -from google.cloud.talent_v4beta1.gapic import enums -from google.cloud.talent_v4beta1.gapic import event_service_client -from google.cloud.talent_v4beta1.gapic import job_service_client -from google.cloud.talent_v4beta1.gapic import profile_service_client -from google.cloud.talent_v4beta1.gapic import tenant_service_client - - -if sys.version_info[:2] == (2, 7): - message = ( - "A future version of this library will drop support for Python 2.7. " - "More details about Python 2 support for Google Cloud Client Libraries " - "can be found at https://cloud.google.com/python/docs/python2-sunset/" - ) - warnings.warn(message, DeprecationWarning) - - -class ApplicationServiceClient(application_service_client.ApplicationServiceClient): - __doc__ = application_service_client.ApplicationServiceClient.__doc__ - enums = enums - - -class CompanyServiceClient(company_service_client.CompanyServiceClient): - __doc__ = company_service_client.CompanyServiceClient.__doc__ - enums = enums - - -class CompletionClient(completion_client.CompletionClient): - __doc__ = completion_client.CompletionClient.__doc__ - enums = enums - - -class EventServiceClient(event_service_client.EventServiceClient): - __doc__ = event_service_client.EventServiceClient.__doc__ - enums = enums - - -class JobServiceClient(job_service_client.JobServiceClient): - __doc__ = job_service_client.JobServiceClient.__doc__ - enums = enums - - -class ProfileServiceClient(profile_service_client.ProfileServiceClient): - __doc__ = profile_service_client.ProfileServiceClient.__doc__ - enums = enums - - -class TenantServiceClient(tenant_service_client.TenantServiceClient): - __doc__ = tenant_service_client.TenantServiceClient.__doc__ - enums = enums +from .services.application_service import ApplicationServiceClient +from .services.company_service import CompanyServiceClient +from .services.completion import CompletionClient +from .services.event_service import EventServiceClient +from .services.job_service import JobServiceClient +from .services.profile_service import ProfileServiceClient +from .services.tenant_service import TenantServiceClient +from .types.application import Application +from .types.application_service import CreateApplicationRequest +from .types.application_service import DeleteApplicationRequest +from .types.application_service import GetApplicationRequest +from .types.application_service import ListApplicationsRequest +from .types.application_service import ListApplicationsResponse +from .types.application_service import UpdateApplicationRequest +from .types.common import AvailabilitySignalType +from .types.common import BatchOperationMetadata +from .types.common import Certification +from .types.common import CommuteMethod +from .types.common import CompanySize +from .types.common import CompensationInfo +from .types.common import ContactInfoUsage +from .types.common import CustomAttribute +from .types.common import DegreeType +from .types.common import DeviceInfo +from .types.common import EmploymentType +from .types.common import HtmlSanitization +from .types.common import Interview +from .types.common import JobBenefit +from .types.common import JobCategory +from .types.common import JobLevel +from .types.common import Location +from .types.common import Outcome +from .types.common import PostingRegion +from .types.common import Rating +from .types.common import RequestMetadata +from .types.common import ResponseMetadata +from .types.common import Skill +from .types.common import SkillProficiencyLevel +from .types.common import SpellingCorrection +from .types.common import TimestampRange +from .types.common import Visibility +from .types.company import Company +from .types.company_service import CreateCompanyRequest +from .types.company_service import DeleteCompanyRequest +from .types.company_service import GetCompanyRequest +from .types.company_service import ListCompaniesRequest +from .types.company_service import ListCompaniesResponse +from .types.company_service import UpdateCompanyRequest +from .types.completion_service import CompleteQueryRequest +from .types.completion_service import CompleteQueryResponse +from .types.event import ClientEvent +from .types.event import JobEvent +from .types.event import ProfileEvent +from .types.event_service import CreateClientEventRequest +from .types.filters import ApplicationDateFilter +from .types.filters import ApplicationJobFilter +from .types.filters import ApplicationOutcomeNotesFilter +from .types.filters import AvailabilityFilter +from .types.filters import CandidateAvailabilityFilter +from .types.filters import CommuteFilter +from .types.filters import CompensationFilter +from .types.filters import EducationFilter +from .types.filters import EmployerFilter +from .types.filters import JobQuery +from .types.filters import JobTitleFilter +from .types.filters import LocationFilter +from .types.filters import PersonNameFilter +from .types.filters import ProfileQuery +from .types.filters import SkillFilter +from .types.filters import TimeFilter +from .types.filters import WorkExperienceFilter +from .types.histogram import HistogramQuery +from .types.histogram import HistogramQueryResult +from .types.job import Job +from .types.job_service import BatchCreateJobsRequest +from .types.job_service import BatchDeleteJobsRequest +from .types.job_service import BatchUpdateJobsRequest +from .types.job_service import CreateJobRequest +from .types.job_service import DeleteJobRequest +from .types.job_service import GetJobRequest +from .types.job_service import JobOperationResult +from .types.job_service import JobView +from .types.job_service import ListJobsRequest +from .types.job_service import ListJobsResponse +from .types.job_service import SearchJobsRequest +from .types.job_service import SearchJobsResponse +from .types.job_service import UpdateJobRequest +from .types.profile import Activity +from .types.profile import AdditionalContactInfo +from .types.profile import Address +from .types.profile import AvailabilitySignal +from .types.profile import Degree +from .types.profile import EducationRecord +from .types.profile import Email +from .types.profile import EmploymentRecord +from .types.profile import Patent +from .types.profile import PersonName +from .types.profile import PersonalUri +from .types.profile import Phone +from .types.profile import Profile +from .types.profile import Publication +from .types.profile import Resume +from .types.profile_service import CreateProfileRequest +from .types.profile_service import DeleteProfileRequest +from .types.profile_service import GetProfileRequest +from .types.profile_service import ListProfilesRequest +from .types.profile_service import ListProfilesResponse +from .types.profile_service import SearchProfilesRequest +from .types.profile_service import SearchProfilesResponse +from .types.profile_service import SummarizedProfile +from .types.profile_service import UpdateProfileRequest +from .types.tenant import Tenant +from .types.tenant_service import CreateTenantRequest +from .types.tenant_service import DeleteTenantRequest +from .types.tenant_service import GetTenantRequest +from .types.tenant_service import ListTenantsRequest +from .types.tenant_service import ListTenantsResponse +from .types.tenant_service import UpdateTenantRequest __all__ = ( - "enums", - "types", + "Activity", + "AdditionalContactInfo", + "Address", + "Application", + "ApplicationDateFilter", + "ApplicationJobFilter", + "ApplicationOutcomeNotesFilter", "ApplicationServiceClient", + "AvailabilityFilter", + "AvailabilitySignal", + "AvailabilitySignalType", + "BatchCreateJobsRequest", + "BatchDeleteJobsRequest", + "BatchOperationMetadata", + "BatchUpdateJobsRequest", + "CandidateAvailabilityFilter", + "Certification", + "ClientEvent", + "CommuteFilter", + "CommuteMethod", + "Company", "CompanyServiceClient", + "CompanySize", + "CompensationFilter", + "CompensationInfo", + "CompleteQueryRequest", + "CompleteQueryResponse", "CompletionClient", + "ContactInfoUsage", + "CreateApplicationRequest", + "CreateClientEventRequest", + "CreateCompanyRequest", + "CreateJobRequest", + "CreateProfileRequest", + "CreateTenantRequest", + "CustomAttribute", + "Degree", + "DegreeType", + "DeleteApplicationRequest", + "DeleteCompanyRequest", + "DeleteJobRequest", + "DeleteProfileRequest", + "DeleteTenantRequest", + "DeviceInfo", + "EducationFilter", + "EducationRecord", + "Email", + "EmployerFilter", + "EmploymentRecord", + "EmploymentType", "EventServiceClient", + "GetApplicationRequest", + "GetCompanyRequest", + "GetJobRequest", + "GetProfileRequest", + "GetTenantRequest", + "HistogramQuery", + "HistogramQueryResult", + "HtmlSanitization", + "Interview", + "Job", + "JobBenefit", + "JobCategory", + "JobEvent", + "JobLevel", + "JobOperationResult", + "JobQuery", "JobServiceClient", + "JobTitleFilter", + "JobView", + "ListApplicationsRequest", + "ListApplicationsResponse", + "ListCompaniesRequest", + "ListCompaniesResponse", + "ListJobsRequest", + "ListJobsResponse", + "ListProfilesRequest", + "ListProfilesResponse", + "ListTenantsRequest", + "ListTenantsResponse", + "Location", + "LocationFilter", + "Outcome", + "Patent", + "PersonName", + "PersonNameFilter", + "PersonalUri", + "Phone", + "PostingRegion", + "Profile", + "ProfileEvent", + "ProfileQuery", "ProfileServiceClient", + "Publication", + "Rating", + "RequestMetadata", + "ResponseMetadata", + "Resume", + "SearchJobsRequest", + "SearchJobsResponse", + "SearchProfilesRequest", + "SearchProfilesResponse", + "Skill", + "SkillFilter", + "SkillProficiencyLevel", + "SpellingCorrection", + "SummarizedProfile", + "Tenant", + "TimeFilter", + "TimestampRange", + "UpdateApplicationRequest", + "UpdateCompanyRequest", + "UpdateJobRequest", + "UpdateProfileRequest", + "UpdateTenantRequest", + "Visibility", + "WorkExperienceFilter", "TenantServiceClient", ) diff --git a/google/cloud/talent_v4beta1/gapic/__init__.py b/google/cloud/talent_v4beta1/gapic/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/google/cloud/talent_v4beta1/gapic/application_service_client.py b/google/cloud/talent_v4beta1/gapic/application_service_client.py deleted file mode 100644 index 459c1ff8..00000000 --- a/google/cloud/talent_v4beta1/gapic/application_service_client.py +++ /dev/null @@ -1,669 +0,0 @@ -# -*- 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 -# -# https://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. - -"""Accesses the google.cloud.talent.v4beta1 ApplicationService API.""" - -import functools -import pkg_resources -import warnings - -from google.oauth2 import service_account -import google.api_core.client_options -import google.api_core.gapic_v1.client_info -import google.api_core.gapic_v1.config -import google.api_core.gapic_v1.method -import google.api_core.gapic_v1.routing_header -import google.api_core.grpc_helpers -import google.api_core.page_iterator -import google.api_core.path_template -import grpc - -from google.cloud.talent_v4beta1.gapic import application_service_client_config -from google.cloud.talent_v4beta1.gapic import enums -from google.cloud.talent_v4beta1.gapic.transports import ( - application_service_grpc_transport, -) -from google.cloud.talent_v4beta1.proto import application_pb2 -from google.cloud.talent_v4beta1.proto import application_service_pb2 -from google.cloud.talent_v4beta1.proto import application_service_pb2_grpc -from google.protobuf import empty_pb2 -from google.protobuf import field_mask_pb2 - - -_GAPIC_LIBRARY_VERSION = pkg_resources.get_distribution("google-cloud-talent",).version - - -class ApplicationServiceClient(object): - """ - A service that handles application management, including CRUD and - enumeration. - """ - - SERVICE_ADDRESS = "jobs.googleapis.com:443" - """The default address of the service.""" - - # The name of the interface for this client. This is the key used to - # find the method configuration in the client_config dictionary. - _INTERFACE_NAME = "google.cloud.talent.v4beta1.ApplicationService" - - @classmethod - def from_service_account_file(cls, filename, *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: - ApplicationServiceClient: The constructed client. - """ - credentials = service_account.Credentials.from_service_account_file(filename) - kwargs["credentials"] = credentials - return cls(*args, **kwargs) - - from_service_account_json = from_service_account_file - - @classmethod - def application_path(cls, project, tenant, profile, application): - """Return a fully-qualified application string.""" - return google.api_core.path_template.expand( - "projects/{project}/tenants/{tenant}/profiles/{profile}/applications/{application}", - project=project, - tenant=tenant, - profile=profile, - application=application, - ) - - @classmethod - def company_path(cls, project, tenant, company): - """Return a fully-qualified company string.""" - return google.api_core.path_template.expand( - "projects/{project}/tenants/{tenant}/companies/{company}", - project=project, - tenant=tenant, - company=company, - ) - - @classmethod - def company_without_tenant_path(cls, project, company): - """Return a fully-qualified company_without_tenant string.""" - return google.api_core.path_template.expand( - "projects/{project}/companies/{company}", project=project, company=company, - ) - - @classmethod - def job_path(cls, project, tenant, job): - """Return a fully-qualified job string.""" - return google.api_core.path_template.expand( - "projects/{project}/tenants/{tenant}/jobs/{job}", - project=project, - tenant=tenant, - job=job, - ) - - @classmethod - def job_without_tenant_path(cls, project, job): - """Return a fully-qualified job_without_tenant string.""" - return google.api_core.path_template.expand( - "projects/{project}/jobs/{job}", project=project, job=job, - ) - - @classmethod - def profile_path(cls, project, tenant, profile): - """Return a fully-qualified profile string.""" - return google.api_core.path_template.expand( - "projects/{project}/tenants/{tenant}/profiles/{profile}", - project=project, - tenant=tenant, - profile=profile, - ) - - def __init__( - self, - transport=None, - channel=None, - credentials=None, - client_config=None, - client_info=None, - client_options=None, - ): - """Constructor. - - Args: - transport (Union[~.ApplicationServiceGrpcTransport, - Callable[[~.Credentials, type], ~.ApplicationServiceGrpcTransport]): A transport - instance, responsible for actually making the API calls. - The default transport uses the gRPC protocol. - This argument may also be a callable which returns a - transport instance. Callables will be sent the credentials - as the first argument and the default transport class as - the second argument. - channel (grpc.Channel): DEPRECATED. A ``Channel`` instance - through which to make calls. This argument is mutually exclusive - with ``credentials``; providing both will raise an exception. - credentials (google.auth.credentials.Credentials): The - authorization credentials to attach to requests. These - credentials identify this application to the service. If none - are specified, the client will attempt to ascertain the - credentials from the environment. - This argument is mutually exclusive with providing a - transport instance to ``transport``; doing so will raise - an exception. - client_config (dict): DEPRECATED. A dictionary of call options for - each method. If not specified, the default configuration is used. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - client_options (Union[dict, google.api_core.client_options.ClientOptions]): - Client options used to set user options on the client. API Endpoint - should be set through client_options. - """ - # Raise deprecation warnings for things we want to go away. - if client_config is not None: - warnings.warn( - "The `client_config` argument is deprecated.", - PendingDeprecationWarning, - stacklevel=2, - ) - else: - client_config = application_service_client_config.config - - if channel: - warnings.warn( - "The `channel` argument is deprecated; use " "`transport` instead.", - PendingDeprecationWarning, - stacklevel=2, - ) - - api_endpoint = self.SERVICE_ADDRESS - if client_options: - if type(client_options) == dict: - client_options = google.api_core.client_options.from_dict( - client_options - ) - if client_options.api_endpoint: - api_endpoint = client_options.api_endpoint - - # Instantiate the transport. - # The transport is responsible for handling serialization and - # deserialization and actually sending data to the service. - if transport: - if callable(transport): - self.transport = transport( - credentials=credentials, - default_class=application_service_grpc_transport.ApplicationServiceGrpcTransport, - address=api_endpoint, - ) - else: - if credentials: - raise ValueError( - "Received both a transport instance and " - "credentials; these are mutually exclusive." - ) - self.transport = transport - else: - self.transport = application_service_grpc_transport.ApplicationServiceGrpcTransport( - address=api_endpoint, channel=channel, credentials=credentials, - ) - - if client_info is None: - client_info = google.api_core.gapic_v1.client_info.ClientInfo( - gapic_version=_GAPIC_LIBRARY_VERSION, - ) - else: - client_info.gapic_version = _GAPIC_LIBRARY_VERSION - self._client_info = client_info - - # Parse out the default settings for retry and timeout for each RPC - # from the client configuration. - # (Ordinarily, these are the defaults specified in the `*_config.py` - # file next to this one.) - self._method_configs = google.api_core.gapic_v1.config.parse_method_configs( - client_config["interfaces"][self._INTERFACE_NAME], - ) - - # Save a dictionary of cached API call functions. - # These are the actual callables which invoke the proper - # transport methods, wrapped with `wrap_method` to add retry, - # timeout, and the like. - self._inner_api_calls = {} - - # Service calls - def create_application( - self, - parent, - application, - retry=google.api_core.gapic_v1.method.DEFAULT, - timeout=google.api_core.gapic_v1.method.DEFAULT, - metadata=None, - ): - """ - Creates a new application entity. - - Example: - >>> from google.cloud import talent_v4beta1 - >>> - >>> client = talent_v4beta1.ApplicationServiceClient() - >>> - >>> parent = client.profile_path('[PROJECT]', '[TENANT]', '[PROFILE]') - >>> - >>> # TODO: Initialize `application`: - >>> application = {} - >>> - >>> response = client.create_application(parent, application) - - Args: - parent (str): Required. Resource name of the profile under which the application - is created. - - The format is - "projects/{project_id}/tenants/{tenant_id}/profiles/{profile_id}". For - example, "projects/foo/tenants/bar/profiles/baz". - application (Union[dict, ~google.cloud.talent_v4beta1.types.Application]): Required. The application to be created. - - If a dict is provided, it must be of the same form as the protobuf - message :class:`~google.cloud.talent_v4beta1.types.Application` - retry (Optional[google.api_core.retry.Retry]): A retry object used - to retry requests. If ``None`` is specified, requests will - be retried using a default configuration. - timeout (Optional[float]): The amount of time, in seconds, to wait - for the request to complete. Note that if ``retry`` is - specified, the timeout applies to each individual attempt. - metadata (Optional[Sequence[Tuple[str, str]]]): Additional metadata - that is provided to the method. - - Returns: - A :class:`~google.cloud.talent_v4beta1.types.Application` instance. - - Raises: - google.api_core.exceptions.GoogleAPICallError: If the request - failed for any reason. - google.api_core.exceptions.RetryError: If the request failed due - to a retryable error and retry attempts failed. - ValueError: If the parameters are invalid. - """ - # Wrap the transport method to add retry and timeout logic. - if "create_application" not in self._inner_api_calls: - self._inner_api_calls[ - "create_application" - ] = google.api_core.gapic_v1.method.wrap_method( - self.transport.create_application, - default_retry=self._method_configs["CreateApplication"].retry, - default_timeout=self._method_configs["CreateApplication"].timeout, - client_info=self._client_info, - ) - - request = application_service_pb2.CreateApplicationRequest( - parent=parent, application=application, - ) - if metadata is None: - metadata = [] - metadata = list(metadata) - try: - routing_header = [("parent", parent)] - except AttributeError: - pass - else: - routing_metadata = google.api_core.gapic_v1.routing_header.to_grpc_metadata( - routing_header - ) - metadata.append(routing_metadata) - - return self._inner_api_calls["create_application"]( - request, retry=retry, timeout=timeout, metadata=metadata - ) - - def get_application( - self, - name, - retry=google.api_core.gapic_v1.method.DEFAULT, - timeout=google.api_core.gapic_v1.method.DEFAULT, - metadata=None, - ): - """ - Retrieves specified application. - - Example: - >>> from google.cloud import talent_v4beta1 - >>> - >>> client = talent_v4beta1.ApplicationServiceClient() - >>> - >>> name = client.application_path('[PROJECT]', '[TENANT]', '[PROFILE]', '[APPLICATION]') - >>> - >>> response = client.get_application(name) - - Args: - name (str): Required. The resource name of the application to be retrieved. - - The format is - "projects/{project_id}/tenants/{tenant_id}/profiles/{profile_id}/applications/{application_id}". - For example, "projects/foo/tenants/bar/profiles/baz/applications/qux". - retry (Optional[google.api_core.retry.Retry]): A retry object used - to retry requests. If ``None`` is specified, requests will - be retried using a default configuration. - timeout (Optional[float]): The amount of time, in seconds, to wait - for the request to complete. Note that if ``retry`` is - specified, the timeout applies to each individual attempt. - metadata (Optional[Sequence[Tuple[str, str]]]): Additional metadata - that is provided to the method. - - Returns: - A :class:`~google.cloud.talent_v4beta1.types.Application` instance. - - Raises: - google.api_core.exceptions.GoogleAPICallError: If the request - failed for any reason. - google.api_core.exceptions.RetryError: If the request failed due - to a retryable error and retry attempts failed. - ValueError: If the parameters are invalid. - """ - # Wrap the transport method to add retry and timeout logic. - if "get_application" not in self._inner_api_calls: - self._inner_api_calls[ - "get_application" - ] = google.api_core.gapic_v1.method.wrap_method( - self.transport.get_application, - default_retry=self._method_configs["GetApplication"].retry, - default_timeout=self._method_configs["GetApplication"].timeout, - client_info=self._client_info, - ) - - request = application_service_pb2.GetApplicationRequest(name=name,) - if metadata is None: - metadata = [] - metadata = list(metadata) - try: - routing_header = [("name", name)] - except AttributeError: - pass - else: - routing_metadata = google.api_core.gapic_v1.routing_header.to_grpc_metadata( - routing_header - ) - metadata.append(routing_metadata) - - return self._inner_api_calls["get_application"]( - request, retry=retry, timeout=timeout, metadata=metadata - ) - - def update_application( - self, - application, - update_mask=None, - retry=google.api_core.gapic_v1.method.DEFAULT, - timeout=google.api_core.gapic_v1.method.DEFAULT, - metadata=None, - ): - """ - Updates specified application. - - Example: - >>> from google.cloud import talent_v4beta1 - >>> - >>> client = talent_v4beta1.ApplicationServiceClient() - >>> - >>> # TODO: Initialize `application`: - >>> application = {} - >>> - >>> response = client.update_application(application) - - Args: - application (Union[dict, ~google.cloud.talent_v4beta1.types.Application]): Required. The application resource to replace the current resource in the system. - - If a dict is provided, it must be of the same form as the protobuf - message :class:`~google.cloud.talent_v4beta1.types.Application` - update_mask (Union[dict, ~google.cloud.talent_v4beta1.types.FieldMask]): Strongly recommended for the best service experience. - - If ``update_mask`` is provided, only the specified fields in - ``application`` are updated. Otherwise all the fields are updated. - - A field mask to specify the application fields to be updated. Only top - level fields of ``Application`` are supported. - - If a dict is provided, it must be of the same form as the protobuf - message :class:`~google.cloud.talent_v4beta1.types.FieldMask` - retry (Optional[google.api_core.retry.Retry]): A retry object used - to retry requests. If ``None`` is specified, requests will - be retried using a default configuration. - timeout (Optional[float]): The amount of time, in seconds, to wait - for the request to complete. Note that if ``retry`` is - specified, the timeout applies to each individual attempt. - metadata (Optional[Sequence[Tuple[str, str]]]): Additional metadata - that is provided to the method. - - Returns: - A :class:`~google.cloud.talent_v4beta1.types.Application` instance. - - Raises: - google.api_core.exceptions.GoogleAPICallError: If the request - failed for any reason. - google.api_core.exceptions.RetryError: If the request failed due - to a retryable error and retry attempts failed. - ValueError: If the parameters are invalid. - """ - # Wrap the transport method to add retry and timeout logic. - if "update_application" not in self._inner_api_calls: - self._inner_api_calls[ - "update_application" - ] = google.api_core.gapic_v1.method.wrap_method( - self.transport.update_application, - default_retry=self._method_configs["UpdateApplication"].retry, - default_timeout=self._method_configs["UpdateApplication"].timeout, - client_info=self._client_info, - ) - - request = application_service_pb2.UpdateApplicationRequest( - application=application, update_mask=update_mask, - ) - if metadata is None: - metadata = [] - metadata = list(metadata) - try: - routing_header = [("application.name", application.name)] - except AttributeError: - pass - else: - routing_metadata = google.api_core.gapic_v1.routing_header.to_grpc_metadata( - routing_header - ) - metadata.append(routing_metadata) - - return self._inner_api_calls["update_application"]( - request, retry=retry, timeout=timeout, metadata=metadata - ) - - def delete_application( - self, - name, - retry=google.api_core.gapic_v1.method.DEFAULT, - timeout=google.api_core.gapic_v1.method.DEFAULT, - metadata=None, - ): - """ - Deletes specified application. - - Example: - >>> from google.cloud import talent_v4beta1 - >>> - >>> client = talent_v4beta1.ApplicationServiceClient() - >>> - >>> name = client.application_path('[PROJECT]', '[TENANT]', '[PROFILE]', '[APPLICATION]') - >>> - >>> client.delete_application(name) - - Args: - name (str): Required. The resource name of the application to be deleted. - - The format is - "projects/{project_id}/tenants/{tenant_id}/profiles/{profile_id}/applications/{application_id}". - For example, "projects/foo/tenants/bar/profiles/baz/applications/qux". - retry (Optional[google.api_core.retry.Retry]): A retry object used - to retry requests. If ``None`` is specified, requests will - be retried using a default configuration. - timeout (Optional[float]): The amount of time, in seconds, to wait - for the request to complete. Note that if ``retry`` is - specified, the timeout applies to each individual attempt. - metadata (Optional[Sequence[Tuple[str, str]]]): Additional metadata - that is provided to the method. - - Raises: - google.api_core.exceptions.GoogleAPICallError: If the request - failed for any reason. - google.api_core.exceptions.RetryError: If the request failed due - to a retryable error and retry attempts failed. - ValueError: If the parameters are invalid. - """ - # Wrap the transport method to add retry and timeout logic. - if "delete_application" not in self._inner_api_calls: - self._inner_api_calls[ - "delete_application" - ] = google.api_core.gapic_v1.method.wrap_method( - self.transport.delete_application, - default_retry=self._method_configs["DeleteApplication"].retry, - default_timeout=self._method_configs["DeleteApplication"].timeout, - client_info=self._client_info, - ) - - request = application_service_pb2.DeleteApplicationRequest(name=name,) - if metadata is None: - metadata = [] - metadata = list(metadata) - try: - routing_header = [("name", name)] - except AttributeError: - pass - else: - routing_metadata = google.api_core.gapic_v1.routing_header.to_grpc_metadata( - routing_header - ) - metadata.append(routing_metadata) - - self._inner_api_calls["delete_application"]( - request, retry=retry, timeout=timeout, metadata=metadata - ) - - def list_applications( - self, - parent, - page_size=None, - retry=google.api_core.gapic_v1.method.DEFAULT, - timeout=google.api_core.gapic_v1.method.DEFAULT, - metadata=None, - ): - """ - Lists all applications associated with the profile. - - Example: - >>> from google.cloud import talent_v4beta1 - >>> - >>> client = talent_v4beta1.ApplicationServiceClient() - >>> - >>> parent = client.profile_path('[PROJECT]', '[TENANT]', '[PROFILE]') - >>> - >>> # Iterate over all results - >>> for element in client.list_applications(parent): - ... # process element - ... pass - >>> - >>> - >>> # Alternatively: - >>> - >>> # Iterate over results one page at a time - >>> for page in client.list_applications(parent).pages: - ... for element in page: - ... # process element - ... pass - - Args: - parent (str): Required. Resource name of the profile under which the application - is created. - - The format is - "projects/{project_id}/tenants/{tenant_id}/profiles/{profile_id}", for - example, "projects/foo/tenants/bar/profiles/baz". - page_size (int): The maximum number of resources contained in the - underlying API response. If page streaming is performed per- - resource, this parameter does not affect the return value. If page - streaming is performed per-page, this determines the maximum number - of resources in a page. - retry (Optional[google.api_core.retry.Retry]): A retry object used - to retry requests. If ``None`` is specified, requests will - be retried using a default configuration. - timeout (Optional[float]): The amount of time, in seconds, to wait - for the request to complete. Note that if ``retry`` is - specified, the timeout applies to each individual attempt. - metadata (Optional[Sequence[Tuple[str, str]]]): Additional metadata - that is provided to the method. - - Returns: - A :class:`~google.api_core.page_iterator.PageIterator` instance. - An iterable of :class:`~google.cloud.talent_v4beta1.types.Application` instances. - You can also iterate over the pages of the response - using its `pages` property. - - Raises: - google.api_core.exceptions.GoogleAPICallError: If the request - failed for any reason. - google.api_core.exceptions.RetryError: If the request failed due - to a retryable error and retry attempts failed. - ValueError: If the parameters are invalid. - """ - # Wrap the transport method to add retry and timeout logic. - if "list_applications" not in self._inner_api_calls: - self._inner_api_calls[ - "list_applications" - ] = google.api_core.gapic_v1.method.wrap_method( - self.transport.list_applications, - default_retry=self._method_configs["ListApplications"].retry, - default_timeout=self._method_configs["ListApplications"].timeout, - client_info=self._client_info, - ) - - request = application_service_pb2.ListApplicationsRequest( - parent=parent, page_size=page_size, - ) - if metadata is None: - metadata = [] - metadata = list(metadata) - try: - routing_header = [("parent", parent)] - except AttributeError: - pass - else: - routing_metadata = google.api_core.gapic_v1.routing_header.to_grpc_metadata( - routing_header - ) - metadata.append(routing_metadata) - - iterator = google.api_core.page_iterator.GRPCIterator( - client=None, - method=functools.partial( - self._inner_api_calls["list_applications"], - retry=retry, - timeout=timeout, - metadata=metadata, - ), - request=request, - items_field="applications", - request_token_field="page_token", - response_token_field="next_page_token", - ) - return iterator diff --git a/google/cloud/talent_v4beta1/gapic/application_service_client_config.py b/google/cloud/talent_v4beta1/gapic/application_service_client_config.py deleted file mode 100644 index 291a8858..00000000 --- a/google/cloud/talent_v4beta1/gapic/application_service_client_config.py +++ /dev/null @@ -1,167 +0,0 @@ -config = { - "interfaces": { - "google.cloud.talent.v4beta1.ApplicationService": { - "retry_codes": { - "retry_policy_1_codes": ["DEADLINE_EXCEEDED", "UNAVAILABLE"], - "no_retry_2_codes": [], - "retry_policy_6_codes": ["DEADLINE_EXCEEDED", "UNAVAILABLE"], - "no_retry_codes": [], - "no_retry_3_codes": [], - "retry_policy_3_codes": ["DEADLINE_EXCEEDED", "UNAVAILABLE"], - "retry_policy_2_codes": ["DEADLINE_EXCEEDED", "UNAVAILABLE"], - "retry_policy_4_codes": ["DEADLINE_EXCEEDED", "UNAVAILABLE"], - "no_retry_4_codes": [], - "no_retry_6_codes": [], - "no_retry_1_codes": [], - "retry_policy_5_codes": ["DEADLINE_EXCEEDED", "UNAVAILABLE"], - "no_retry_5_codes": [], - }, - "retry_params": { - "no_retry_3_params": { - "initial_retry_delay_millis": 0, - "retry_delay_multiplier": 0.0, - "max_retry_delay_millis": 0, - "initial_rpc_timeout_millis": 30000, - "rpc_timeout_multiplier": 1.0, - "max_rpc_timeout_millis": 30000, - "total_timeout_millis": 30000, - }, - "retry_policy_6_params": { - "initial_retry_delay_millis": 100, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 60000, - "initial_rpc_timeout_millis": 30000, - "rpc_timeout_multiplier": 1.0, - "max_rpc_timeout_millis": 30000, - "total_timeout_millis": 30000, - }, - "no_retry_params": { - "initial_retry_delay_millis": 0, - "retry_delay_multiplier": 0.0, - "max_retry_delay_millis": 0, - "initial_rpc_timeout_millis": 0, - "rpc_timeout_multiplier": 1.0, - "max_rpc_timeout_millis": 0, - "total_timeout_millis": 0, - }, - "no_retry_5_params": { - "initial_retry_delay_millis": 0, - "retry_delay_multiplier": 0.0, - "max_retry_delay_millis": 0, - "initial_rpc_timeout_millis": 30000, - "rpc_timeout_multiplier": 1.0, - "max_rpc_timeout_millis": 30000, - "total_timeout_millis": 30000, - }, - "no_retry_1_params": { - "initial_retry_delay_millis": 0, - "retry_delay_multiplier": 0.0, - "max_retry_delay_millis": 0, - "initial_rpc_timeout_millis": 30000, - "rpc_timeout_multiplier": 1.0, - "max_rpc_timeout_millis": 30000, - "total_timeout_millis": 30000, - }, - "no_retry_2_params": { - "initial_retry_delay_millis": 0, - "retry_delay_multiplier": 0.0, - "max_retry_delay_millis": 0, - "initial_rpc_timeout_millis": 30000, - "rpc_timeout_multiplier": 1.0, - "max_rpc_timeout_millis": 30000, - "total_timeout_millis": 30000, - }, - "no_retry_4_params": { - "initial_retry_delay_millis": 0, - "retry_delay_multiplier": 0.0, - "max_retry_delay_millis": 0, - "initial_rpc_timeout_millis": 30000, - "rpc_timeout_multiplier": 1.0, - "max_rpc_timeout_millis": 30000, - "total_timeout_millis": 30000, - }, - "no_retry_6_params": { - "initial_retry_delay_millis": 0, - "retry_delay_multiplier": 0.0, - "max_retry_delay_millis": 0, - "initial_rpc_timeout_millis": 30000, - "rpc_timeout_multiplier": 1.0, - "max_rpc_timeout_millis": 30000, - "total_timeout_millis": 30000, - }, - "retry_policy_1_params": { - "initial_retry_delay_millis": 100, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 60000, - "initial_rpc_timeout_millis": 30000, - "rpc_timeout_multiplier": 1.0, - "max_rpc_timeout_millis": 30000, - "total_timeout_millis": 30000, - }, - "retry_policy_3_params": { - "initial_retry_delay_millis": 100, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 60000, - "initial_rpc_timeout_millis": 30000, - "rpc_timeout_multiplier": 1.0, - "max_rpc_timeout_millis": 30000, - "total_timeout_millis": 30000, - }, - "retry_policy_2_params": { - "initial_retry_delay_millis": 100, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 60000, - "initial_rpc_timeout_millis": 30000, - "rpc_timeout_multiplier": 1.0, - "max_rpc_timeout_millis": 30000, - "total_timeout_millis": 30000, - }, - "retry_policy_4_params": { - "initial_retry_delay_millis": 100, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 60000, - "initial_rpc_timeout_millis": 30000, - "rpc_timeout_multiplier": 1.0, - "max_rpc_timeout_millis": 30000, - "total_timeout_millis": 30000, - }, - "retry_policy_5_params": { - "initial_retry_delay_millis": 100, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 60000, - "initial_rpc_timeout_millis": 30000, - "rpc_timeout_multiplier": 1.0, - "max_rpc_timeout_millis": 30000, - "total_timeout_millis": 30000, - }, - }, - "methods": { - "CreateApplication": { - "timeout_millis": 30000, - "retry_codes_name": "no_retry_5_codes", - "retry_params_name": "no_retry_5_params", - }, - "GetApplication": { - "timeout_millis": 30000, - "retry_codes_name": "retry_policy_2_codes", - "retry_params_name": "retry_policy_2_params", - }, - "UpdateApplication": { - "timeout_millis": 30000, - "retry_codes_name": "no_retry_5_codes", - "retry_params_name": "no_retry_5_params", - }, - "DeleteApplication": { - "timeout_millis": 30000, - "retry_codes_name": "retry_policy_2_codes", - "retry_params_name": "retry_policy_2_params", - }, - "ListApplications": { - "timeout_millis": 30000, - "retry_codes_name": "retry_policy_2_codes", - "retry_params_name": "retry_policy_2_params", - }, - }, - } - } -} diff --git a/google/cloud/talent_v4beta1/gapic/company_service_client.py b/google/cloud/talent_v4beta1/gapic/company_service_client.py deleted file mode 100644 index 5a72226a..00000000 --- a/google/cloud/talent_v4beta1/gapic/company_service_client.py +++ /dev/null @@ -1,659 +0,0 @@ -# -*- 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 -# -# https://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. - -"""Accesses the google.cloud.talent.v4beta1 CompanyService API.""" - -import functools -import pkg_resources -import warnings - -from google.oauth2 import service_account -import google.api_core.client_options -import google.api_core.gapic_v1.client_info -import google.api_core.gapic_v1.config -import google.api_core.gapic_v1.method -import google.api_core.gapic_v1.routing_header -import google.api_core.grpc_helpers -import google.api_core.page_iterator -import google.api_core.path_template -import grpc - -from google.cloud.talent_v4beta1.gapic import company_service_client_config -from google.cloud.talent_v4beta1.gapic import enums -from google.cloud.talent_v4beta1.gapic.transports import company_service_grpc_transport -from google.cloud.talent_v4beta1.proto import application_pb2 -from google.cloud.talent_v4beta1.proto import application_service_pb2 -from google.cloud.talent_v4beta1.proto import application_service_pb2_grpc -from google.cloud.talent_v4beta1.proto import company_pb2 -from google.cloud.talent_v4beta1.proto import company_service_pb2 -from google.cloud.talent_v4beta1.proto import company_service_pb2_grpc -from google.protobuf import empty_pb2 -from google.protobuf import field_mask_pb2 - - -_GAPIC_LIBRARY_VERSION = pkg_resources.get_distribution("google-cloud-talent",).version - - -class CompanyServiceClient(object): - """A service that handles company management, including CRUD and enumeration.""" - - SERVICE_ADDRESS = "jobs.googleapis.com:443" - """The default address of the service.""" - - # The name of the interface for this client. This is the key used to - # find the method configuration in the client_config dictionary. - _INTERFACE_NAME = "google.cloud.talent.v4beta1.CompanyService" - - @classmethod - def from_service_account_file(cls, filename, *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: - CompanyServiceClient: The constructed client. - """ - credentials = service_account.Credentials.from_service_account_file(filename) - kwargs["credentials"] = credentials - return cls(*args, **kwargs) - - from_service_account_json = from_service_account_file - - @classmethod - def company_path(cls, project, tenant, company): - """Return a fully-qualified company string.""" - return google.api_core.path_template.expand( - "projects/{project}/tenants/{tenant}/companies/{company}", - project=project, - tenant=tenant, - company=company, - ) - - @classmethod - def company_without_tenant_path(cls, project, company): - """Return a fully-qualified company_without_tenant string.""" - return google.api_core.path_template.expand( - "projects/{project}/companies/{company}", project=project, company=company, - ) - - @classmethod - def project_path(cls, project): - """Return a fully-qualified project string.""" - return google.api_core.path_template.expand( - "projects/{project}", project=project, - ) - - @classmethod - def tenant_path(cls, project, tenant): - """Return a fully-qualified tenant string.""" - return google.api_core.path_template.expand( - "projects/{project}/tenants/{tenant}", project=project, tenant=tenant, - ) - - def __init__( - self, - transport=None, - channel=None, - credentials=None, - client_config=None, - client_info=None, - client_options=None, - ): - """Constructor. - - Args: - transport (Union[~.CompanyServiceGrpcTransport, - Callable[[~.Credentials, type], ~.CompanyServiceGrpcTransport]): A transport - instance, responsible for actually making the API calls. - The default transport uses the gRPC protocol. - This argument may also be a callable which returns a - transport instance. Callables will be sent the credentials - as the first argument and the default transport class as - the second argument. - channel (grpc.Channel): DEPRECATED. A ``Channel`` instance - through which to make calls. This argument is mutually exclusive - with ``credentials``; providing both will raise an exception. - credentials (google.auth.credentials.Credentials): The - authorization credentials to attach to requests. These - credentials identify this application to the service. If none - are specified, the client will attempt to ascertain the - credentials from the environment. - This argument is mutually exclusive with providing a - transport instance to ``transport``; doing so will raise - an exception. - client_config (dict): DEPRECATED. A dictionary of call options for - each method. If not specified, the default configuration is used. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - client_options (Union[dict, google.api_core.client_options.ClientOptions]): - Client options used to set user options on the client. API Endpoint - should be set through client_options. - """ - # Raise deprecation warnings for things we want to go away. - if client_config is not None: - warnings.warn( - "The `client_config` argument is deprecated.", - PendingDeprecationWarning, - stacklevel=2, - ) - else: - client_config = company_service_client_config.config - - if channel: - warnings.warn( - "The `channel` argument is deprecated; use " "`transport` instead.", - PendingDeprecationWarning, - stacklevel=2, - ) - - api_endpoint = self.SERVICE_ADDRESS - if client_options: - if type(client_options) == dict: - client_options = google.api_core.client_options.from_dict( - client_options - ) - if client_options.api_endpoint: - api_endpoint = client_options.api_endpoint - - # Instantiate the transport. - # The transport is responsible for handling serialization and - # deserialization and actually sending data to the service. - if transport: - if callable(transport): - self.transport = transport( - credentials=credentials, - default_class=company_service_grpc_transport.CompanyServiceGrpcTransport, - address=api_endpoint, - ) - else: - if credentials: - raise ValueError( - "Received both a transport instance and " - "credentials; these are mutually exclusive." - ) - self.transport = transport - else: - self.transport = company_service_grpc_transport.CompanyServiceGrpcTransport( - address=api_endpoint, channel=channel, credentials=credentials, - ) - - if client_info is None: - client_info = google.api_core.gapic_v1.client_info.ClientInfo( - gapic_version=_GAPIC_LIBRARY_VERSION, - ) - else: - client_info.gapic_version = _GAPIC_LIBRARY_VERSION - self._client_info = client_info - - # Parse out the default settings for retry and timeout for each RPC - # from the client configuration. - # (Ordinarily, these are the defaults specified in the `*_config.py` - # file next to this one.) - self._method_configs = google.api_core.gapic_v1.config.parse_method_configs( - client_config["interfaces"][self._INTERFACE_NAME], - ) - - # Save a dictionary of cached API call functions. - # These are the actual callables which invoke the proper - # transport methods, wrapped with `wrap_method` to add retry, - # timeout, and the like. - self._inner_api_calls = {} - - # Service calls - def create_company( - self, - parent, - company, - retry=google.api_core.gapic_v1.method.DEFAULT, - timeout=google.api_core.gapic_v1.method.DEFAULT, - metadata=None, - ): - """ - Creates a new company entity. - - Example: - >>> from google.cloud import talent_v4beta1 - >>> - >>> client = talent_v4beta1.CompanyServiceClient() - >>> - >>> parent = client.tenant_path('[PROJECT]', '[TENANT]') - >>> - >>> # TODO: Initialize `company`: - >>> company = {} - >>> - >>> response = client.create_company(parent, company) - - Args: - parent (str): Required. Resource name of the tenant under which the company is - created. - - The format is "projects/{project_id}/tenants/{tenant_id}", for example, - "projects/foo/tenant/bar". If tenant id is unspecified, a default tenant - is created, for example, "projects/foo". - company (Union[dict, ~google.cloud.talent_v4beta1.types.Company]): Required. The company to be created. - - If a dict is provided, it must be of the same form as the protobuf - message :class:`~google.cloud.talent_v4beta1.types.Company` - retry (Optional[google.api_core.retry.Retry]): A retry object used - to retry requests. If ``None`` is specified, requests will - be retried using a default configuration. - timeout (Optional[float]): The amount of time, in seconds, to wait - for the request to complete. Note that if ``retry`` is - specified, the timeout applies to each individual attempt. - metadata (Optional[Sequence[Tuple[str, str]]]): Additional metadata - that is provided to the method. - - Returns: - A :class:`~google.cloud.talent_v4beta1.types.Company` instance. - - Raises: - google.api_core.exceptions.GoogleAPICallError: If the request - failed for any reason. - google.api_core.exceptions.RetryError: If the request failed due - to a retryable error and retry attempts failed. - ValueError: If the parameters are invalid. - """ - # Wrap the transport method to add retry and timeout logic. - if "create_company" not in self._inner_api_calls: - self._inner_api_calls[ - "create_company" - ] = google.api_core.gapic_v1.method.wrap_method( - self.transport.create_company, - default_retry=self._method_configs["CreateCompany"].retry, - default_timeout=self._method_configs["CreateCompany"].timeout, - client_info=self._client_info, - ) - - request = company_service_pb2.CreateCompanyRequest( - parent=parent, company=company, - ) - if metadata is None: - metadata = [] - metadata = list(metadata) - try: - routing_header = [("parent", parent)] - except AttributeError: - pass - else: - routing_metadata = google.api_core.gapic_v1.routing_header.to_grpc_metadata( - routing_header - ) - metadata.append(routing_metadata) - - return self._inner_api_calls["create_company"]( - request, retry=retry, timeout=timeout, metadata=metadata - ) - - def get_company( - self, - name, - retry=google.api_core.gapic_v1.method.DEFAULT, - timeout=google.api_core.gapic_v1.method.DEFAULT, - metadata=None, - ): - """ - Retrieves specified company. - - Example: - >>> from google.cloud import talent_v4beta1 - >>> - >>> client = talent_v4beta1.CompanyServiceClient() - >>> - >>> name = client.company_path('[PROJECT]', '[TENANT]', '[COMPANY]') - >>> - >>> response = client.get_company(name) - - Args: - name (str): Required. The resource name of the company to be retrieved. - - The format is - "projects/{project_id}/tenants/{tenant_id}/companies/{company_id}", for - example, "projects/api-test-project/tenants/foo/companies/bar". - - If tenant id is unspecified, the default tenant is used, for example, - "projects/api-test-project/companies/bar". - retry (Optional[google.api_core.retry.Retry]): A retry object used - to retry requests. If ``None`` is specified, requests will - be retried using a default configuration. - timeout (Optional[float]): The amount of time, in seconds, to wait - for the request to complete. Note that if ``retry`` is - specified, the timeout applies to each individual attempt. - metadata (Optional[Sequence[Tuple[str, str]]]): Additional metadata - that is provided to the method. - - Returns: - A :class:`~google.cloud.talent_v4beta1.types.Company` instance. - - Raises: - google.api_core.exceptions.GoogleAPICallError: If the request - failed for any reason. - google.api_core.exceptions.RetryError: If the request failed due - to a retryable error and retry attempts failed. - ValueError: If the parameters are invalid. - """ - # Wrap the transport method to add retry and timeout logic. - if "get_company" not in self._inner_api_calls: - self._inner_api_calls[ - "get_company" - ] = google.api_core.gapic_v1.method.wrap_method( - self.transport.get_company, - default_retry=self._method_configs["GetCompany"].retry, - default_timeout=self._method_configs["GetCompany"].timeout, - client_info=self._client_info, - ) - - request = company_service_pb2.GetCompanyRequest(name=name,) - if metadata is None: - metadata = [] - metadata = list(metadata) - try: - routing_header = [("name", name)] - except AttributeError: - pass - else: - routing_metadata = google.api_core.gapic_v1.routing_header.to_grpc_metadata( - routing_header - ) - metadata.append(routing_metadata) - - return self._inner_api_calls["get_company"]( - request, retry=retry, timeout=timeout, metadata=metadata - ) - - def update_company( - self, - company, - update_mask=None, - retry=google.api_core.gapic_v1.method.DEFAULT, - timeout=google.api_core.gapic_v1.method.DEFAULT, - metadata=None, - ): - """ - Updates specified company. - - Example: - >>> from google.cloud import talent_v4beta1 - >>> - >>> client = talent_v4beta1.CompanyServiceClient() - >>> - >>> # TODO: Initialize `company`: - >>> company = {} - >>> - >>> response = client.update_company(company) - - Args: - company (Union[dict, ~google.cloud.talent_v4beta1.types.Company]): Required. The company resource to replace the current resource in the system. - - If a dict is provided, it must be of the same form as the protobuf - message :class:`~google.cloud.talent_v4beta1.types.Company` - update_mask (Union[dict, ~google.cloud.talent_v4beta1.types.FieldMask]): Strongly recommended for the best service experience. - - If ``update_mask`` is provided, only the specified fields in ``company`` - are updated. Otherwise all the fields are updated. - - A field mask to specify the company fields to be updated. Only top level - fields of ``Company`` are supported. - - If a dict is provided, it must be of the same form as the protobuf - message :class:`~google.cloud.talent_v4beta1.types.FieldMask` - retry (Optional[google.api_core.retry.Retry]): A retry object used - to retry requests. If ``None`` is specified, requests will - be retried using a default configuration. - timeout (Optional[float]): The amount of time, in seconds, to wait - for the request to complete. Note that if ``retry`` is - specified, the timeout applies to each individual attempt. - metadata (Optional[Sequence[Tuple[str, str]]]): Additional metadata - that is provided to the method. - - Returns: - A :class:`~google.cloud.talent_v4beta1.types.Company` instance. - - Raises: - google.api_core.exceptions.GoogleAPICallError: If the request - failed for any reason. - google.api_core.exceptions.RetryError: If the request failed due - to a retryable error and retry attempts failed. - ValueError: If the parameters are invalid. - """ - # Wrap the transport method to add retry and timeout logic. - if "update_company" not in self._inner_api_calls: - self._inner_api_calls[ - "update_company" - ] = google.api_core.gapic_v1.method.wrap_method( - self.transport.update_company, - default_retry=self._method_configs["UpdateCompany"].retry, - default_timeout=self._method_configs["UpdateCompany"].timeout, - client_info=self._client_info, - ) - - request = company_service_pb2.UpdateCompanyRequest( - company=company, update_mask=update_mask, - ) - if metadata is None: - metadata = [] - metadata = list(metadata) - try: - routing_header = [("company.name", company.name)] - except AttributeError: - pass - else: - routing_metadata = google.api_core.gapic_v1.routing_header.to_grpc_metadata( - routing_header - ) - metadata.append(routing_metadata) - - return self._inner_api_calls["update_company"]( - request, retry=retry, timeout=timeout, metadata=metadata - ) - - def delete_company( - self, - name, - retry=google.api_core.gapic_v1.method.DEFAULT, - timeout=google.api_core.gapic_v1.method.DEFAULT, - metadata=None, - ): - """ - Deletes specified company. - Prerequisite: The company has no jobs associated with it. - - Example: - >>> from google.cloud import talent_v4beta1 - >>> - >>> client = talent_v4beta1.CompanyServiceClient() - >>> - >>> name = client.company_path('[PROJECT]', '[TENANT]', '[COMPANY]') - >>> - >>> client.delete_company(name) - - Args: - name (str): Required. The resource name of the company to be deleted. - - The format is - "projects/{project_id}/tenants/{tenant_id}/companies/{company_id}", for - example, "projects/foo/tenants/bar/companies/baz". - - If tenant id is unspecified, the default tenant is used, for example, - "projects/foo/companies/bar". - retry (Optional[google.api_core.retry.Retry]): A retry object used - to retry requests. If ``None`` is specified, requests will - be retried using a default configuration. - timeout (Optional[float]): The amount of time, in seconds, to wait - for the request to complete. Note that if ``retry`` is - specified, the timeout applies to each individual attempt. - metadata (Optional[Sequence[Tuple[str, str]]]): Additional metadata - that is provided to the method. - - Raises: - google.api_core.exceptions.GoogleAPICallError: If the request - failed for any reason. - google.api_core.exceptions.RetryError: If the request failed due - to a retryable error and retry attempts failed. - ValueError: If the parameters are invalid. - """ - # Wrap the transport method to add retry and timeout logic. - if "delete_company" not in self._inner_api_calls: - self._inner_api_calls[ - "delete_company" - ] = google.api_core.gapic_v1.method.wrap_method( - self.transport.delete_company, - default_retry=self._method_configs["DeleteCompany"].retry, - default_timeout=self._method_configs["DeleteCompany"].timeout, - client_info=self._client_info, - ) - - request = company_service_pb2.DeleteCompanyRequest(name=name,) - if metadata is None: - metadata = [] - metadata = list(metadata) - try: - routing_header = [("name", name)] - except AttributeError: - pass - else: - routing_metadata = google.api_core.gapic_v1.routing_header.to_grpc_metadata( - routing_header - ) - metadata.append(routing_metadata) - - self._inner_api_calls["delete_company"]( - request, retry=retry, timeout=timeout, metadata=metadata - ) - - def list_companies( - self, - parent, - page_size=None, - require_open_jobs=None, - retry=google.api_core.gapic_v1.method.DEFAULT, - timeout=google.api_core.gapic_v1.method.DEFAULT, - metadata=None, - ): - """ - Lists all companies associated with the project. - - Example: - >>> from google.cloud import talent_v4beta1 - >>> - >>> client = talent_v4beta1.CompanyServiceClient() - >>> - >>> parent = client.tenant_path('[PROJECT]', '[TENANT]') - >>> - >>> # Iterate over all results - >>> for element in client.list_companies(parent): - ... # process element - ... pass - >>> - >>> - >>> # Alternatively: - >>> - >>> # Iterate over results one page at a time - >>> for page in client.list_companies(parent).pages: - ... for element in page: - ... # process element - ... pass - - Args: - parent (str): Required. Resource name of the tenant under which the company is - created. - - The format is "projects/{project_id}/tenants/{tenant_id}", for example, - "projects/foo/tenant/bar". - - If tenant id is unspecified, the default tenant will be used, for - example, "projects/foo". - page_size (int): The maximum number of resources contained in the - underlying API response. If page streaming is performed per- - resource, this parameter does not affect the return value. If page - streaming is performed per-page, this determines the maximum number - of resources in a page. - require_open_jobs (bool): Set to true if the companies requested must have open jobs. - - Defaults to false. - - If true, at most ``page_size`` of companies are fetched, among which - only those with open jobs are returned. - retry (Optional[google.api_core.retry.Retry]): A retry object used - to retry requests. If ``None`` is specified, requests will - be retried using a default configuration. - timeout (Optional[float]): The amount of time, in seconds, to wait - for the request to complete. Note that if ``retry`` is - specified, the timeout applies to each individual attempt. - metadata (Optional[Sequence[Tuple[str, str]]]): Additional metadata - that is provided to the method. - - Returns: - A :class:`~google.api_core.page_iterator.PageIterator` instance. - An iterable of :class:`~google.cloud.talent_v4beta1.types.Company` instances. - You can also iterate over the pages of the response - using its `pages` property. - - Raises: - google.api_core.exceptions.GoogleAPICallError: If the request - failed for any reason. - google.api_core.exceptions.RetryError: If the request failed due - to a retryable error and retry attempts failed. - ValueError: If the parameters are invalid. - """ - # Wrap the transport method to add retry and timeout logic. - if "list_companies" not in self._inner_api_calls: - self._inner_api_calls[ - "list_companies" - ] = google.api_core.gapic_v1.method.wrap_method( - self.transport.list_companies, - default_retry=self._method_configs["ListCompanies"].retry, - default_timeout=self._method_configs["ListCompanies"].timeout, - client_info=self._client_info, - ) - - request = company_service_pb2.ListCompaniesRequest( - parent=parent, page_size=page_size, require_open_jobs=require_open_jobs, - ) - if metadata is None: - metadata = [] - metadata = list(metadata) - try: - routing_header = [("parent", parent)] - except AttributeError: - pass - else: - routing_metadata = google.api_core.gapic_v1.routing_header.to_grpc_metadata( - routing_header - ) - metadata.append(routing_metadata) - - iterator = google.api_core.page_iterator.GRPCIterator( - client=None, - method=functools.partial( - self._inner_api_calls["list_companies"], - retry=retry, - timeout=timeout, - metadata=metadata, - ), - request=request, - items_field="companies", - request_token_field="page_token", - response_token_field="next_page_token", - ) - return iterator diff --git a/google/cloud/talent_v4beta1/gapic/company_service_client_config.py b/google/cloud/talent_v4beta1/gapic/company_service_client_config.py deleted file mode 100644 index 6bcb987a..00000000 --- a/google/cloud/talent_v4beta1/gapic/company_service_client_config.py +++ /dev/null @@ -1,67 +0,0 @@ -config = { - "interfaces": { - "google.cloud.talent.v4beta1.CompanyService": { - "retry_codes": { - "no_retry_6_codes": [], - "no_retry_codes": [], - "retry_policy_5_codes": ["DEADLINE_EXCEEDED", "UNAVAILABLE"], - }, - "retry_params": { - "retry_policy_5_params": { - "initial_retry_delay_millis": 100, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 60000, - "initial_rpc_timeout_millis": 30000, - "rpc_timeout_multiplier": 1.0, - "max_rpc_timeout_millis": 30000, - "total_timeout_millis": 30000, - }, - "no_retry_params": { - "initial_retry_delay_millis": 0, - "retry_delay_multiplier": 0.0, - "max_retry_delay_millis": 0, - "initial_rpc_timeout_millis": 0, - "rpc_timeout_multiplier": 1.0, - "max_rpc_timeout_millis": 0, - "total_timeout_millis": 0, - }, - "no_retry_6_params": { - "initial_retry_delay_millis": 0, - "retry_delay_multiplier": 0.0, - "max_retry_delay_millis": 0, - "initial_rpc_timeout_millis": 30000, - "rpc_timeout_multiplier": 1.0, - "max_rpc_timeout_millis": 30000, - "total_timeout_millis": 30000, - }, - }, - "methods": { - "CreateCompany": { - "timeout_millis": 30000, - "retry_codes_name": "no_retry_6_codes", - "retry_params_name": "no_retry_6_params", - }, - "GetCompany": { - "timeout_millis": 30000, - "retry_codes_name": "retry_policy_5_codes", - "retry_params_name": "retry_policy_5_params", - }, - "UpdateCompany": { - "timeout_millis": 30000, - "retry_codes_name": "no_retry_6_codes", - "retry_params_name": "no_retry_6_params", - }, - "DeleteCompany": { - "timeout_millis": 30000, - "retry_codes_name": "retry_policy_5_codes", - "retry_params_name": "retry_policy_5_params", - }, - "ListCompanies": { - "timeout_millis": 30000, - "retry_codes_name": "retry_policy_5_codes", - "retry_params_name": "retry_policy_5_params", - }, - }, - } - } -} diff --git a/google/cloud/talent_v4beta1/gapic/completion_client.py b/google/cloud/talent_v4beta1/gapic/completion_client.py deleted file mode 100644 index fadb3253..00000000 --- a/google/cloud/talent_v4beta1/gapic/completion_client.py +++ /dev/null @@ -1,341 +0,0 @@ -# -*- 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 -# -# https://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. - -"""Accesses the google.cloud.talent.v4beta1 Completion API.""" - -import pkg_resources -import warnings - -from google.oauth2 import service_account -import google.api_core.client_options -import google.api_core.gapic_v1.client_info -import google.api_core.gapic_v1.config -import google.api_core.gapic_v1.method -import google.api_core.gapic_v1.routing_header -import google.api_core.grpc_helpers -import google.api_core.path_template -import grpc - -from google.cloud.talent_v4beta1.gapic import completion_client_config -from google.cloud.talent_v4beta1.gapic import enums -from google.cloud.talent_v4beta1.gapic.transports import completion_grpc_transport -from google.cloud.talent_v4beta1.proto import application_pb2 -from google.cloud.talent_v4beta1.proto import application_service_pb2 -from google.cloud.talent_v4beta1.proto import application_service_pb2_grpc -from google.cloud.talent_v4beta1.proto import company_pb2 -from google.cloud.talent_v4beta1.proto import company_service_pb2 -from google.cloud.talent_v4beta1.proto import company_service_pb2_grpc -from google.cloud.talent_v4beta1.proto import completion_service_pb2 -from google.cloud.talent_v4beta1.proto import completion_service_pb2_grpc -from google.protobuf import empty_pb2 -from google.protobuf import field_mask_pb2 - - -_GAPIC_LIBRARY_VERSION = pkg_resources.get_distribution("google-cloud-talent",).version - - -class CompletionClient(object): - """A service handles auto completion.""" - - SERVICE_ADDRESS = "jobs.googleapis.com:443" - """The default address of the service.""" - - # The name of the interface for this client. This is the key used to - # find the method configuration in the client_config dictionary. - _INTERFACE_NAME = "google.cloud.talent.v4beta1.Completion" - - @classmethod - def from_service_account_file(cls, filename, *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: - CompletionClient: The constructed client. - """ - credentials = service_account.Credentials.from_service_account_file(filename) - kwargs["credentials"] = credentials - return cls(*args, **kwargs) - - from_service_account_json = from_service_account_file - - @classmethod - def company_path(cls, project, tenant, company): - """Return a fully-qualified company string.""" - return google.api_core.path_template.expand( - "projects/{project}/tenants/{tenant}/companies/{company}", - project=project, - tenant=tenant, - company=company, - ) - - @classmethod - def company_without_tenant_path(cls, project, company): - """Return a fully-qualified company_without_tenant string.""" - return google.api_core.path_template.expand( - "projects/{project}/companies/{company}", project=project, company=company, - ) - - @classmethod - def project_path(cls, project): - """Return a fully-qualified project string.""" - return google.api_core.path_template.expand( - "projects/{project}", project=project, - ) - - @classmethod - def tenant_path(cls, project, tenant): - """Return a fully-qualified tenant string.""" - return google.api_core.path_template.expand( - "projects/{project}/tenants/{tenant}", project=project, tenant=tenant, - ) - - def __init__( - self, - transport=None, - channel=None, - credentials=None, - client_config=None, - client_info=None, - client_options=None, - ): - """Constructor. - - Args: - transport (Union[~.CompletionGrpcTransport, - Callable[[~.Credentials, type], ~.CompletionGrpcTransport]): A transport - instance, responsible for actually making the API calls. - The default transport uses the gRPC protocol. - This argument may also be a callable which returns a - transport instance. Callables will be sent the credentials - as the first argument and the default transport class as - the second argument. - channel (grpc.Channel): DEPRECATED. A ``Channel`` instance - through which to make calls. This argument is mutually exclusive - with ``credentials``; providing both will raise an exception. - credentials (google.auth.credentials.Credentials): The - authorization credentials to attach to requests. These - credentials identify this application to the service. If none - are specified, the client will attempt to ascertain the - credentials from the environment. - This argument is mutually exclusive with providing a - transport instance to ``transport``; doing so will raise - an exception. - client_config (dict): DEPRECATED. A dictionary of call options for - each method. If not specified, the default configuration is used. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - client_options (Union[dict, google.api_core.client_options.ClientOptions]): - Client options used to set user options on the client. API Endpoint - should be set through client_options. - """ - # Raise deprecation warnings for things we want to go away. - if client_config is not None: - warnings.warn( - "The `client_config` argument is deprecated.", - PendingDeprecationWarning, - stacklevel=2, - ) - else: - client_config = completion_client_config.config - - if channel: - warnings.warn( - "The `channel` argument is deprecated; use " "`transport` instead.", - PendingDeprecationWarning, - stacklevel=2, - ) - - api_endpoint = self.SERVICE_ADDRESS - if client_options: - if type(client_options) == dict: - client_options = google.api_core.client_options.from_dict( - client_options - ) - if client_options.api_endpoint: - api_endpoint = client_options.api_endpoint - - # Instantiate the transport. - # The transport is responsible for handling serialization and - # deserialization and actually sending data to the service. - if transport: - if callable(transport): - self.transport = transport( - credentials=credentials, - default_class=completion_grpc_transport.CompletionGrpcTransport, - address=api_endpoint, - ) - else: - if credentials: - raise ValueError( - "Received both a transport instance and " - "credentials; these are mutually exclusive." - ) - self.transport = transport - else: - self.transport = completion_grpc_transport.CompletionGrpcTransport( - address=api_endpoint, channel=channel, credentials=credentials, - ) - - if client_info is None: - client_info = google.api_core.gapic_v1.client_info.ClientInfo( - gapic_version=_GAPIC_LIBRARY_VERSION, - ) - else: - client_info.gapic_version = _GAPIC_LIBRARY_VERSION - self._client_info = client_info - - # Parse out the default settings for retry and timeout for each RPC - # from the client configuration. - # (Ordinarily, these are the defaults specified in the `*_config.py` - # file next to this one.) - self._method_configs = google.api_core.gapic_v1.config.parse_method_configs( - client_config["interfaces"][self._INTERFACE_NAME], - ) - - # Save a dictionary of cached API call functions. - # These are the actual callables which invoke the proper - # transport methods, wrapped with `wrap_method` to add retry, - # timeout, and the like. - self._inner_api_calls = {} - - # Service calls - def complete_query( - self, - parent, - query, - page_size, - language_codes=None, - company=None, - scope=None, - type_=None, - retry=google.api_core.gapic_v1.method.DEFAULT, - timeout=google.api_core.gapic_v1.method.DEFAULT, - metadata=None, - ): - """ - Completes the specified prefix with keyword suggestions. - Intended for use by a job search auto-complete search box. - - Example: - >>> from google.cloud import talent_v4beta1 - >>> - >>> client = talent_v4beta1.CompletionClient() - >>> - >>> parent = client.tenant_path('[PROJECT]', '[TENANT]') - >>> - >>> # TODO: Initialize `query`: - >>> query = '' - >>> - >>> # TODO: Initialize `page_size`: - >>> page_size = 0 - >>> - >>> response = client.complete_query(parent, query, page_size) - - Args: - parent (str): Required. Resource name of tenant the completion is performed - within. - - The format is "projects/{project_id}/tenants/{tenant_id}", for example, - "projects/foo/tenant/bar". - - If tenant id is unspecified, the default tenant is used, for example, - "projects/foo". - query (str): Required. The query used to generate suggestions. - - The maximum number of allowed characters is 255. - page_size (int): Required. Completion result count. - - The maximum allowed page size is 10. - language_codes (list[str]): The list of languages of the query. This is the BCP-47 language - code, such as "en-US" or "sr-Latn". For more information, see `Tags for - Identifying Languages `__. - - The maximum number of allowed characters is 255. - company (str): If provided, restricts completion to specified company. - - The format is - "projects/{project_id}/tenants/{tenant_id}/companies/{company_id}", for - example, "projects/foo/tenants/bar/companies/baz". - - If tenant id is unspecified, the default tenant is used, for example, - "projects/foo". - scope (~google.cloud.talent_v4beta1.types.CompletionScope): The scope of the completion. The defaults is - ``CompletionScope.PUBLIC``. - type_ (~google.cloud.talent_v4beta1.types.CompletionType): The completion topic. The default is ``CompletionType.COMBINED``. - retry (Optional[google.api_core.retry.Retry]): A retry object used - to retry requests. If ``None`` is specified, requests will - be retried using a default configuration. - timeout (Optional[float]): The amount of time, in seconds, to wait - for the request to complete. Note that if ``retry`` is - specified, the timeout applies to each individual attempt. - metadata (Optional[Sequence[Tuple[str, str]]]): Additional metadata - that is provided to the method. - - Returns: - A :class:`~google.cloud.talent_v4beta1.types.CompleteQueryResponse` instance. - - Raises: - google.api_core.exceptions.GoogleAPICallError: If the request - failed for any reason. - google.api_core.exceptions.RetryError: If the request failed due - to a retryable error and retry attempts failed. - ValueError: If the parameters are invalid. - """ - # Wrap the transport method to add retry and timeout logic. - if "complete_query" not in self._inner_api_calls: - self._inner_api_calls[ - "complete_query" - ] = google.api_core.gapic_v1.method.wrap_method( - self.transport.complete_query, - default_retry=self._method_configs["CompleteQuery"].retry, - default_timeout=self._method_configs["CompleteQuery"].timeout, - client_info=self._client_info, - ) - - request = completion_service_pb2.CompleteQueryRequest( - parent=parent, - query=query, - page_size=page_size, - language_codes=language_codes, - company=company, - scope=scope, - type=type_, - ) - if metadata is None: - metadata = [] - metadata = list(metadata) - try: - routing_header = [("parent", parent)] - except AttributeError: - pass - else: - routing_metadata = google.api_core.gapic_v1.routing_header.to_grpc_metadata( - routing_header - ) - metadata.append(routing_metadata) - - return self._inner_api_calls["complete_query"]( - request, retry=retry, timeout=timeout, metadata=metadata - ) diff --git a/google/cloud/talent_v4beta1/gapic/completion_client_config.py b/google/cloud/talent_v4beta1/gapic/completion_client_config.py deleted file mode 100644 index 3ae252e0..00000000 --- a/google/cloud/talent_v4beta1/gapic/completion_client_config.py +++ /dev/null @@ -1,37 +0,0 @@ -config = { - "interfaces": { - "google.cloud.talent.v4beta1.Completion": { - "retry_codes": { - "retry_policy_6_codes": ["DEADLINE_EXCEEDED", "UNAVAILABLE"], - "no_retry_codes": [], - }, - "retry_params": { - "retry_policy_6_params": { - "initial_retry_delay_millis": 100, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 60000, - "initial_rpc_timeout_millis": 30000, - "rpc_timeout_multiplier": 1.0, - "max_rpc_timeout_millis": 30000, - "total_timeout_millis": 30000, - }, - "no_retry_params": { - "initial_retry_delay_millis": 0, - "retry_delay_multiplier": 0.0, - "max_retry_delay_millis": 0, - "initial_rpc_timeout_millis": 0, - "rpc_timeout_multiplier": 1.0, - "max_rpc_timeout_millis": 0, - "total_timeout_millis": 0, - }, - }, - "methods": { - "CompleteQuery": { - "timeout_millis": 30000, - "retry_codes_name": "retry_policy_6_codes", - "retry_params_name": "retry_policy_6_params", - } - }, - } - } -} diff --git a/google/cloud/talent_v4beta1/gapic/enums.py b/google/cloud/talent_v4beta1/gapic/enums.py deleted file mode 100644 index fb58db48..00000000 --- a/google/cloud/talent_v4beta1/gapic/enums.py +++ /dev/null @@ -1,1155 +0,0 @@ -# -*- 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 -# -# https://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. - -"""Wrappers for protocol buffer enum types.""" - -import enum - - -class AvailabilitySignalType(enum.IntEnum): - """ - The type of candidate availability signal. - - Attributes: - AVAILABILITY_SIGNAL_TYPE_UNSPECIFIED (int): Default value. - JOB_APPLICATION (int): Job application signal. - - In the context of ``Profile.availability_signals``, this signal is - related to the candidate's most recent application. ``last_update_time`` - is calculated from max(\ ``Application.create_time``) from all - ``Application`` records where ``Application.source`` is any of the - following: ``APPLY_DIRECT_WEB`` ``APPLY_DIRECT_MOBILE_WEB`` - ``APPLY_DIRECT_MOBILE_APP`` ``APPLY_DIRECT_IN_PERSON`` - ``APPLY_INDIRECT`` - - In the context of ``AvailabilityFilter``, the filter is applied on - ``Profile.availability_signals`` where ``type`` is JOB_APPLICATION. - RESUME_UPDATE (int): Resume update signal. - - In the context of ``Profile.availability_signals``, this signal is - related to the candidate's most recent update to their resume. For a - ``SummarizedProfile.summary``, ``last_update_time`` is calculated from - max(\ ``Profile.resume_update_time``) from all - ``SummarizedProfile.profiles``. - - In the context of ``AvailabilityFilter``, the filter is applied on - ``Profile.availability_signals`` where ``type`` is RESUME_UPDATE. - CANDIDATE_UPDATE (int): Candidate update signal. - - In the context of ``Profile.availability_signals``, this signal is - related to the candidate's most recent update to their profile. For a - ``SummarizedProfile.summary``, ``last_update_time`` is calculated from - max(\ ``Profile.candidate_update_time``) from all - ``SummarizedProfile.profiles``. - - In the context of ``AvailabilityFilter``, the filter is applied on - ``Profile.availability_signals`` where ``type`` is CANDIDATE_UPDATE. - CLIENT_SUBMISSION (int): Client submission signal. - - In the context of ``Profile.availability_signals``, this signal is - related to the candidate's most recent submission. ``last_update_time`` - is calculated from max(\ ``Application.create_time``) from all - ``Application`` records where ``Application.stage`` is any of the - following: ``HIRING_MANAGER_REVIEW`` ``INTERVIEW`` ``OFFER_EXTENDED`` - ``OFFER_ACCEPTED`` ``STARTED`` - - In the context of ``AvailabilityFilter``, the filter is applied on - ``Profile.availability_signals`` where ``type`` is CLIENT_SUBMISSION. - """ - - AVAILABILITY_SIGNAL_TYPE_UNSPECIFIED = 0 - JOB_APPLICATION = 1 - RESUME_UPDATE = 2 - CANDIDATE_UPDATE = 3 - CLIENT_SUBMISSION = 4 - - -class CommuteMethod(enum.IntEnum): - """ - Method for commute. - - Attributes: - COMMUTE_METHOD_UNSPECIFIED (int): Commute method isn't specified. - DRIVING (int): Commute time is calculated based on driving time. - TRANSIT (int): Commute time is calculated based on public transit including bus, metro, - subway, and so on. - WALKING (int): Commute time is calculated based on walking time. - CYCLING (int): Commute time is calculated based on biking time. - """ - - COMMUTE_METHOD_UNSPECIFIED = 0 - DRIVING = 1 - TRANSIT = 2 - WALKING = 3 - CYCLING = 4 - - -class CompanySize(enum.IntEnum): - """ - An enum that represents the size of the company. - - Attributes: - COMPANY_SIZE_UNSPECIFIED (int): Default value if the size isn't specified. - MINI (int): The company has less than 50 employees. - SMALL (int): The company has between 50 and 99 employees. - SMEDIUM (int): The company has between 100 and 499 employees. - MEDIUM (int): The company has between 500 and 999 employees. - BIG (int): The company has between 1,000 and 4,999 employees. - BIGGER (int): The company has between 5,000 and 9,999 employees. - GIANT (int): The company has 10,000 or more employees. - """ - - COMPANY_SIZE_UNSPECIFIED = 0 - MINI = 1 - SMALL = 2 - SMEDIUM = 3 - MEDIUM = 4 - BIG = 5 - BIGGER = 6 - GIANT = 7 - - -class ContactInfoUsage(enum.IntEnum): - """ - Enum that represents the usage of the contact information. - - Attributes: - CONTACT_INFO_USAGE_UNSPECIFIED (int): Default value. - PERSONAL (int): Personal use. - WORK (int): Work use. - SCHOOL (int): School use. - """ - - CONTACT_INFO_USAGE_UNSPECIFIED = 0 - PERSONAL = 1 - WORK = 2 - SCHOOL = 3 - - -class DegreeType(enum.IntEnum): - """ - Educational degree level defined in International Standard Classification - of Education (ISCED). - - Attributes: - DEGREE_TYPE_UNSPECIFIED (int): Default value. Represents no degree, or early childhood education. - Maps to ISCED code 0. - Ex) Kindergarten - PRIMARY_EDUCATION (int): Primary education which is typically the first stage of compulsory - education. ISCED code 1. - Ex) Elementary school - LOWER_SECONDARY_EDUCATION (int): Lower secondary education; First stage of secondary education building on - primary education, typically with a more subject-oriented curriculum. - ISCED code 2. - Ex) Middle school - UPPER_SECONDARY_EDUCATION (int): Middle education; Second/final stage of secondary education preparing for - tertiary education and/or providing skills relevant to employment. - Usually with an increased range of subject options and streams. ISCED - code 3. - Ex) High school - ADULT_REMEDIAL_EDUCATION (int): Adult Remedial Education; Programmes providing learning experiences that - build on secondary education and prepare for labour market entry and/or - tertiary education. The content is broader than secondary but not as - complex as tertiary education. ISCED code 4. - ASSOCIATES_OR_EQUIVALENT (int): Associate's or equivalent; Short first tertiary programmes that are - typically practically-based, occupationally-specific and prepare for - labour market entry. These programmes may also provide a pathway to other - tertiary programmes. ISCED code 5. - BACHELORS_OR_EQUIVALENT (int): Bachelor's or equivalent; Programmes designed to provide intermediate - academic and/or professional knowledge, skills and competencies leading - to a first tertiary degree or equivalent qualification. ISCED code 6. - MASTERS_OR_EQUIVALENT (int): Master's or equivalent; Programmes designed to provide advanced academic - and/or professional knowledge, skills and competencies leading to a - second tertiary degree or equivalent qualification. ISCED code 7. - DOCTORAL_OR_EQUIVALENT (int): Doctoral or equivalent; Programmes designed primarily to lead to an - advanced research qualification, usually concluding with the submission - and defense of a substantive dissertation of publishable quality based on - original research. ISCED code 8. - """ - - DEGREE_TYPE_UNSPECIFIED = 0 - PRIMARY_EDUCATION = 1 - LOWER_SECONDARY_EDUCATION = 2 - UPPER_SECONDARY_EDUCATION = 3 - ADULT_REMEDIAL_EDUCATION = 4 - ASSOCIATES_OR_EQUIVALENT = 5 - BACHELORS_OR_EQUIVALENT = 6 - MASTERS_OR_EQUIVALENT = 7 - DOCTORAL_OR_EQUIVALENT = 8 - - -class EmploymentType(enum.IntEnum): - """ - An enum that represents the employment type of a job. - - Attributes: - EMPLOYMENT_TYPE_UNSPECIFIED (int): The default value if the employment type isn't specified. - FULL_TIME (int): The job requires working a number of hours that constitute full - time employment, typically 40 or more hours per week. - PART_TIME (int): The job entails working fewer hours than a full time job, - typically less than 40 hours a week. - CONTRACTOR (int): The job is offered as a contracted, as opposed to a salaried employee, - position. - CONTRACT_TO_HIRE (int): The job is offered as a contracted position with the understanding - that it's converted into a full-time position at the end of the - contract. Jobs of this type are also returned by a search for - ``EmploymentType.CONTRACTOR`` jobs. - TEMPORARY (int): The job is offered as a temporary employment opportunity, usually - a short-term engagement. - INTERN (int): The job is a fixed-term opportunity for students or entry-level job - seekers to obtain on-the-job training, typically offered as a summer - position. - VOLUNTEER (int): The is an opportunity for an individual to volunteer, where there's no - expectation of compensation for the provided services. - PER_DIEM (int): The job requires an employee to work on an as-needed basis with a - flexible schedule. - FLY_IN_FLY_OUT (int): The job involves employing people in remote areas and flying them - temporarily to the work site instead of relocating employees and their - families permanently. - OTHER_EMPLOYMENT_TYPE (int): The job does not fit any of the other listed types. - """ - - EMPLOYMENT_TYPE_UNSPECIFIED = 0 - FULL_TIME = 1 - PART_TIME = 2 - CONTRACTOR = 3 - CONTRACT_TO_HIRE = 4 - TEMPORARY = 5 - INTERN = 6 - VOLUNTEER = 7 - PER_DIEM = 8 - FLY_IN_FLY_OUT = 9 - OTHER_EMPLOYMENT_TYPE = 10 - - -class HtmlSanitization(enum.IntEnum): - """ - Option for HTML content sanitization on user input fields, for example, job - description. By setting this option, user can determine whether and how - sanitization is performed on these fields. - - Attributes: - HTML_SANITIZATION_UNSPECIFIED (int): Default value. - HTML_SANITIZATION_DISABLED (int): Disables sanitization on HTML input. - SIMPLE_FORMATTING_ONLY (int): Sanitizes HTML input, only accepts bold, italic, ordered list, and - unordered list markup tags. - """ - - HTML_SANITIZATION_UNSPECIFIED = 0 - HTML_SANITIZATION_DISABLED = 1 - SIMPLE_FORMATTING_ONLY = 2 - - -class JobBenefit(enum.IntEnum): - """ - An enum that represents employee benefits included with the job. - - Attributes: - JOB_BENEFIT_UNSPECIFIED (int): Default value if the type isn't specified. - CHILD_CARE (int): The job includes access to programs that support child care, such - as daycare. - DENTAL (int): The job includes dental services covered by a dental - insurance plan. - DOMESTIC_PARTNER (int): The job offers specific benefits to domestic partners. - FLEXIBLE_HOURS (int): The job allows for a flexible work schedule. - MEDICAL (int): The job includes health services covered by a medical insurance plan. - LIFE_INSURANCE (int): The job includes a life insurance plan provided by the employer or - available for purchase by the employee. - PARENTAL_LEAVE (int): The job allows for a leave of absence to a parent to care for a newborn - child. - RETIREMENT_PLAN (int): The job includes a workplace retirement plan provided by the - employer or available for purchase by the employee. - SICK_DAYS (int): The job allows for paid time off due to illness. - VACATION (int): The job includes paid time off for vacation. - VISION (int): The job includes vision services covered by a vision - insurance plan. - """ - - JOB_BENEFIT_UNSPECIFIED = 0 - CHILD_CARE = 1 - DENTAL = 2 - DOMESTIC_PARTNER = 3 - FLEXIBLE_HOURS = 4 - MEDICAL = 5 - LIFE_INSURANCE = 6 - PARENTAL_LEAVE = 7 - RETIREMENT_PLAN = 8 - SICK_DAYS = 9 - VACATION = 10 - VISION = 11 - - -class JobCategory(enum.IntEnum): - """ - An enum that represents the categorization or primary focus of specific - role. This value is different than the "industry" associated with a role, - which is related to the categorization of the company listing the job. - - Attributes: - JOB_CATEGORY_UNSPECIFIED (int): The default value if the category isn't specified. - ACCOUNTING_AND_FINANCE (int): An accounting and finance job, such as an Accountant. - ADMINISTRATIVE_AND_OFFICE (int): An administrative and office job, such as an Administrative Assistant. - ADVERTISING_AND_MARKETING (int): An advertising and marketing job, such as Marketing Manager. - ANIMAL_CARE (int): An animal care job, such as Veterinarian. - ART_FASHION_AND_DESIGN (int): An art, fashion, or design job, such as Designer. - BUSINESS_OPERATIONS (int): A business operations job, such as Business Operations Manager. - CLEANING_AND_FACILITIES (int): A cleaning and facilities job, such as Custodial Staff. - COMPUTER_AND_IT (int): A computer and IT job, such as Systems Administrator. - CONSTRUCTION (int): A construction job, such as General Laborer. - CUSTOMER_SERVICE (int): A customer service job, such s Cashier. - EDUCATION (int): An education job, such as School Teacher. - ENTERTAINMENT_AND_TRAVEL (int): An entertainment and travel job, such as Flight Attendant. - FARMING_AND_OUTDOORS (int): A farming or outdoor job, such as Park Ranger. - HEALTHCARE (int): A healthcare job, such as Registered Nurse. - HUMAN_RESOURCES (int): A human resources job, such as Human Resources Director. - INSTALLATION_MAINTENANCE_AND_REPAIR (int): An installation, maintenance, or repair job, such as Electrician. - LEGAL (int): A legal job, such as Law Clerk. - MANAGEMENT (int): A management job, often used in conjunction with another category, - such as Store Manager. - MANUFACTURING_AND_WAREHOUSE (int): A manufacturing or warehouse job, such as Assembly Technician. - MEDIA_COMMUNICATIONS_AND_WRITING (int): A media, communications, or writing job, such as Media Relations. - OIL_GAS_AND_MINING (int): An oil, gas or mining job, such as Offshore Driller. - PERSONAL_CARE_AND_SERVICES (int): A personal care and services job, such as Hair Stylist. - PROTECTIVE_SERVICES (int): A protective services job, such as Security Guard. - REAL_ESTATE (int): A real estate job, such as Buyer's Agent. - RESTAURANT_AND_HOSPITALITY (int): A restaurant and hospitality job, such as Restaurant Server. - SALES_AND_RETAIL (int): A sales and/or retail job, such Sales Associate. - SCIENCE_AND_ENGINEERING (int): A science and engineering job, such as Lab Technician. - SOCIAL_SERVICES_AND_NON_PROFIT (int): A social services or non-profit job, such as Case Worker. - SPORTS_FITNESS_AND_RECREATION (int): A sports, fitness, or recreation job, such as Personal Trainer. - TRANSPORTATION_AND_LOGISTICS (int): A transportation or logistics job, such as Truck Driver. - """ - - JOB_CATEGORY_UNSPECIFIED = 0 - ACCOUNTING_AND_FINANCE = 1 - ADMINISTRATIVE_AND_OFFICE = 2 - ADVERTISING_AND_MARKETING = 3 - ANIMAL_CARE = 4 - ART_FASHION_AND_DESIGN = 5 - BUSINESS_OPERATIONS = 6 - CLEANING_AND_FACILITIES = 7 - COMPUTER_AND_IT = 8 - CONSTRUCTION = 9 - CUSTOMER_SERVICE = 10 - EDUCATION = 11 - ENTERTAINMENT_AND_TRAVEL = 12 - FARMING_AND_OUTDOORS = 13 - HEALTHCARE = 14 - HUMAN_RESOURCES = 15 - INSTALLATION_MAINTENANCE_AND_REPAIR = 16 - LEGAL = 17 - MANAGEMENT = 18 - MANUFACTURING_AND_WAREHOUSE = 19 - MEDIA_COMMUNICATIONS_AND_WRITING = 20 - OIL_GAS_AND_MINING = 21 - PERSONAL_CARE_AND_SERVICES = 22 - PROTECTIVE_SERVICES = 23 - REAL_ESTATE = 24 - RESTAURANT_AND_HOSPITALITY = 25 - SALES_AND_RETAIL = 26 - SCIENCE_AND_ENGINEERING = 27 - SOCIAL_SERVICES_AND_NON_PROFIT = 28 - SPORTS_FITNESS_AND_RECREATION = 29 - TRANSPORTATION_AND_LOGISTICS = 30 - - -class JobLevel(enum.IntEnum): - """ - An enum that represents the required experience level required for the job. - - Attributes: - JOB_LEVEL_UNSPECIFIED (int): The default value if the level isn't specified. - ENTRY_LEVEL (int): Entry-level individual contributors, typically with less than 2 years of - experience in a similar role. Includes interns. - EXPERIENCED (int): Experienced individual contributors, typically with 2+ years of - experience in a similar role. - MANAGER (int): Entry- to mid-level managers responsible for managing a team of people. - DIRECTOR (int): Senior-level managers responsible for managing teams of managers. - EXECUTIVE (int): Executive-level managers and above, including C-level positions. - """ - - JOB_LEVEL_UNSPECIFIED = 0 - ENTRY_LEVEL = 1 - EXPERIENCED = 2 - MANAGER = 3 - DIRECTOR = 4 - EXECUTIVE = 5 - - -class JobView(enum.IntEnum): - """ - An enum that specifies the job attributes that are returned in the - ``MatchingJob.job`` or ``ListJobsResponse.jobs`` fields. - - Attributes: - JOB_VIEW_UNSPECIFIED (int): Default value. - JOB_VIEW_ID_ONLY (int): A ID only view of job, with following attributes: ``Job.name``, - ``Job.requisition_id``, ``Job.language_code``. - JOB_VIEW_MINIMAL (int): A minimal view of the job, with the following attributes: - ``Job.name``, ``Job.requisition_id``, ``Job.title``, ``Job.company``, - ``Job.DerivedInfo.locations``, ``Job.language_code``. - JOB_VIEW_SMALL (int): A small view of the job, with the following attributes in the search - results: ``Job.name``, ``Job.requisition_id``, ``Job.title``, - ``Job.company``, ``Job.DerivedInfo.locations``, ``Job.visibility``, - ``Job.language_code``, ``Job.description``. - JOB_VIEW_FULL (int): All available attributes are included in the search results. - """ - - JOB_VIEW_UNSPECIFIED = 0 - JOB_VIEW_ID_ONLY = 1 - JOB_VIEW_MINIMAL = 2 - JOB_VIEW_SMALL = 3 - JOB_VIEW_FULL = 4 - - -class Outcome(enum.IntEnum): - """ - The overall outcome /decision / result indicator. - - Attributes: - OUTCOME_UNSPECIFIED (int): Default value. - POSITIVE (int): A positive outcome / passing indicator (for example, candidate was - recommended for hiring or to be moved forward in the hiring process, - candidate passed a test). - NEUTRAL (int): A neutral outcome / no clear indicator (for example, no strong - reccommendation either to move forward / not move forward, neutral score). - NEGATIVE (int): A negative outcome / failing indicator (for example, candidate was - recommended to NOT move forward in the hiring process, failed a test). - OUTCOME_NOT_AVAILABLE (int): The assessment outcome is not available or otherwise unknown (for example, - candidate did not complete assessment). - """ - - OUTCOME_UNSPECIFIED = 0 - POSITIVE = 1 - NEUTRAL = 2 - NEGATIVE = 3 - OUTCOME_NOT_AVAILABLE = 4 - - -class PostingRegion(enum.IntEnum): - """ - An enum that represents the job posting region. In most cases, job postings - don't need to specify a region. If a region is given, jobs are - eligible for searches in the specified region. - - Attributes: - POSTING_REGION_UNSPECIFIED (int): If the region is unspecified, the job is only returned if it matches - the ``LocationFilter``. - ADMINISTRATIVE_AREA (int): In addition to exact location matching, job posting is returned when - the ``LocationFilter`` in the search query is in the same administrative - area as the returned job posting. For example, if a - ``ADMINISTRATIVE_AREA`` job is posted in "CA, USA", it's returned if - ``LocationFilter`` has "Mountain View". - - Administrative area refers to top-level administrative subdivision of - this country. For example, US state, IT region, UK constituent nation - and JP prefecture. - NATION (int): In addition to exact location matching, job is returned when - ``LocationFilter`` in search query is in the same country as this job. - For example, if a ``NATION_WIDE`` job is posted in "USA", it's returned - if ``LocationFilter`` has 'Mountain View'. - TELECOMMUTE (int): Job allows employees to work remotely (telecommute). - If locations are provided with this value, the job is - considered as having a location, but telecommuting is allowed. - """ - - POSTING_REGION_UNSPECIFIED = 0 - ADMINISTRATIVE_AREA = 1 - NATION = 2 - TELECOMMUTE = 3 - - -class SkillProficiencyLevel(enum.IntEnum): - """ - Enum that represents the skill proficiency level. - - Attributes: - SKILL_PROFICIENCY_LEVEL_UNSPECIFIED (int): Default value. - UNSKILLED (int): Lacks any proficiency in this skill. - FUNDAMENTAL_AWARENESS (int): Have a common knowledge or an understanding of basic techniques and - concepts. - NOVICE (int): Have the level of experience gained in a classroom and/or experimental - scenarios or as a trainee on-the-job. - INTERMEDIATE (int): Be able to successfully complete tasks in this skill as requested. Help - from an expert may be required from time to time, but can usually perform - skill independently. - ADVANCED (int): Can perform the actions associated with this skill without assistance. - EXPERT (int): Known as an expert in this area. - """ - - SKILL_PROFICIENCY_LEVEL_UNSPECIFIED = 0 - UNSKILLED = 6 - FUNDAMENTAL_AWARENESS = 1 - NOVICE = 2 - INTERMEDIATE = 3 - ADVANCED = 4 - EXPERT = 5 - - -class Visibility(enum.IntEnum): - """ - Deprecated. All resources are only visible to the owner. - - An enum that represents who has view access to the resource. - - Attributes: - VISIBILITY_UNSPECIFIED (int): Default value. - ACCOUNT_ONLY (int): The resource is only visible to the GCP account who owns it. - SHARED_WITH_GOOGLE (int): The resource is visible to the owner and may be visible to other - applications and processes at Google. - SHARED_WITH_PUBLIC (int): The resource is visible to the owner and may be visible to all other API - clients. - """ - - VISIBILITY_UNSPECIFIED = 0 - ACCOUNT_ONLY = 1 - SHARED_WITH_GOOGLE = 2 - SHARED_WITH_PUBLIC = 3 - - -class Application(object): - class ApplicationStage(enum.IntEnum): - """ - The stage of the application. - - Attributes: - APPLICATION_STAGE_UNSPECIFIED (int): Default value. - NEW (int): Candidate has applied or a recruiter put candidate into consideration but - candidate is not yet screened / no decision has been made to move or not - move the candidate to the next stage. - SCREEN (int): A recruiter decided to screen the candidate for this role. - HIRING_MANAGER_REVIEW (int): Candidate is being / was sent to the customer / hiring manager for - detailed review. - INTERVIEW (int): Candidate was approved by the client / hiring manager and is being / was - interviewed for the role. - OFFER_EXTENDED (int): Candidate will be / has been given an offer of employment. - OFFER_ACCEPTED (int): Candidate has accepted their offer of employment. - STARTED (int): Candidate has begun (or completed) their employment or assignment with - the employer. - """ - - APPLICATION_STAGE_UNSPECIFIED = 0 - NEW = 1 - SCREEN = 2 - HIRING_MANAGER_REVIEW = 3 - INTERVIEW = 4 - OFFER_EXTENDED = 5 - OFFER_ACCEPTED = 6 - STARTED = 7 - - class ApplicationState(enum.IntEnum): - """ - Enum that represents the application status. - - Attributes: - APPLICATION_STATE_UNSPECIFIED (int): Default value. - IN_PROGRESS (int): The current stage is in progress or pending, for example, interviews in - progress. - CANDIDATE_WITHDREW (int): The current stage was terminated by a candidate decision. - EMPLOYER_WITHDREW (int): The current stage was terminated by an employer or agency decision. - COMPLETED (int): The current stage is successfully completed, but the next stage (if - applicable) has not begun. - CLOSED (int): The current stage was closed without an exception, or terminated for - reasons unrealated to the candidate. - """ - - APPLICATION_STATE_UNSPECIFIED = 0 - IN_PROGRESS = 1 - CANDIDATE_WITHDREW = 2 - EMPLOYER_WITHDREW = 3 - COMPLETED = 4 - CLOSED = 5 - - -class BatchOperationMetadata(object): - class State(enum.IntEnum): - """ - Attributes: - STATE_UNSPECIFIED (int): Default value. - INITIALIZING (int): The batch operation is being prepared for processing. - PROCESSING (int): The batch operation is actively being processed. - SUCCEEDED (int): The batch operation is processed, and at least one item has been - successfully processed. - FAILED (int): The batch operation is done and no item has been successfully processed. - CANCELLING (int): The batch operation is in the process of cancelling after - ``google.longrunning.Operations.CancelOperation`` is called. - CANCELLED (int): The batch operation is done after - ``google.longrunning.Operations.CancelOperation`` is called. Any items - processed before cancelling are returned in the response. - """ - - STATE_UNSPECIFIED = 0 - INITIALIZING = 1 - PROCESSING = 2 - SUCCEEDED = 3 - FAILED = 4 - CANCELLING = 5 - CANCELLED = 6 - - -class CommuteFilter(object): - class RoadTraffic(enum.IntEnum): - """ - The traffic density to use when calculating commute time. - - Attributes: - ROAD_TRAFFIC_UNSPECIFIED (int): Road traffic situation isn't specified. - TRAFFIC_FREE (int): Optimal commute time without considering any traffic impact. - BUSY_HOUR (int): Commute time calculation takes in account the peak traffic impact. - """ - - ROAD_TRAFFIC_UNSPECIFIED = 0 - TRAFFIC_FREE = 1 - BUSY_HOUR = 2 - - -class CompensationFilter(object): - class FilterType(enum.IntEnum): - """ - Specify the type of filtering. - - Attributes: - FILTER_TYPE_UNSPECIFIED (int): Filter type unspecified. Position holder, INVALID, should never be used. - UNIT_ONLY (int): Filter by ``base compensation entry's`` unit. A job is a match if - and only if the job contains a base CompensationEntry and the base - CompensationEntry's unit matches provided ``units``. Populate one or - more ``units``. - - See ``CompensationInfo.CompensationEntry`` for definition of base - compensation entry. - UNIT_AND_AMOUNT (int): Filter by ``base compensation entry's`` unit and amount / range. A - job is a match if and only if the job contains a base CompensationEntry, - and the base entry's unit matches provided ``CompensationUnit`` and - amount or range overlaps with provided ``CompensationRange``. - - See ``CompensationInfo.CompensationEntry`` for definition of base - compensation entry. - - Set exactly one ``units`` and populate ``range``. - ANNUALIZED_BASE_AMOUNT (int): Filter by annualized base compensation amount and - ``base compensation entry's`` unit. Populate ``range`` and zero or more - ``units``. - ANNUALIZED_TOTAL_AMOUNT (int): Filter by annualized total compensation amount and - ``base compensation entry's`` unit . Populate ``range`` and zero or more - ``units``. - """ - - FILTER_TYPE_UNSPECIFIED = 0 - UNIT_ONLY = 1 - UNIT_AND_AMOUNT = 2 - ANNUALIZED_BASE_AMOUNT = 3 - ANNUALIZED_TOTAL_AMOUNT = 4 - - -class CompensationInfo(object): - class CompensationType(enum.IntEnum): - """ - The type of compensation. - - For compensation amounts specified in non-monetary amounts, describe the - compensation scheme in the ``CompensationEntry.description``. - - For example, tipping format is described in - ``CompensationEntry.description`` (for example, "expect 15-20% tips - based on customer bill.") and an estimate of the tips provided in - ``CompensationEntry.amount`` or ``CompensationEntry.range`` ($10 per - hour). - - For example, equity is described in ``CompensationEntry.description`` - (for example, "1% - 2% equity vesting over 4 years, 1 year cliff") and - value estimated in ``CompensationEntry.amount`` or - ``CompensationEntry.range``. If no value estimate is possible, units are - ``CompensationUnit.COMPENSATION_UNIT_UNSPECIFIED`` and then further - clarified in ``CompensationEntry.description`` field. - - Attributes: - COMPENSATION_TYPE_UNSPECIFIED (int): Default value. - BASE (int): Base compensation: Refers to the fixed amount of money paid to an - employee by an employer in return for work performed. Base compensation - does not include benefits, bonuses or any other potential compensation - from an employer. - BONUS (int): Bonus. - SIGNING_BONUS (int): Signing bonus. - EQUITY (int): Equity. - PROFIT_SHARING (int): Profit sharing. - COMMISSIONS (int): Commission. - TIPS (int): Tips. - OTHER_COMPENSATION_TYPE (int): Other compensation type. - """ - - COMPENSATION_TYPE_UNSPECIFIED = 0 - BASE = 1 - BONUS = 2 - SIGNING_BONUS = 3 - EQUITY = 4 - PROFIT_SHARING = 5 - COMMISSIONS = 6 - TIPS = 7 - OTHER_COMPENSATION_TYPE = 8 - - class CompensationUnit(enum.IntEnum): - """ - Pay frequency. - - Attributes: - COMPENSATION_UNIT_UNSPECIFIED (int): Default value. - HOURLY (int): Hourly. - DAILY (int): Daily. - WEEKLY (int): Weekly - MONTHLY (int): Monthly. - YEARLY (int): Yearly. - ONE_TIME (int): One time. - OTHER_COMPENSATION_UNIT (int): Other compensation units. - """ - - COMPENSATION_UNIT_UNSPECIFIED = 0 - HOURLY = 1 - DAILY = 2 - WEEKLY = 3 - MONTHLY = 4 - YEARLY = 5 - ONE_TIME = 6 - OTHER_COMPENSATION_UNIT = 7 - - -class CompleteQueryRequest(object): - class CompletionScope(enum.IntEnum): - """ - Enum to specify the scope of completion. - - Attributes: - COMPLETION_SCOPE_UNSPECIFIED (int): Default value. - TENANT (int): Suggestions are based only on the data provided by the client. - PUBLIC (int): Suggestions are based on all jobs data in the system that's visible to - the client - """ - - COMPLETION_SCOPE_UNSPECIFIED = 0 - TENANT = 1 - PUBLIC = 2 - - class CompletionType(enum.IntEnum): - """ - Enum to specify auto-completion topics. - - Attributes: - COMPLETION_TYPE_UNSPECIFIED (int): Default value. - JOB_TITLE (int): Suggest job titles for jobs autocomplete. - - For ``CompletionType.JOB_TITLE`` type, only open jobs with the same - ``language_codes`` are returned. - COMPANY_NAME (int): Suggest company names for jobs autocomplete. - - For ``CompletionType.COMPANY_NAME`` type, only companies having open - jobs with the same ``language_codes`` are returned. - COMBINED (int): Suggest both job titles and company names for jobs autocomplete. - - For ``CompletionType.COMBINED`` type, only open jobs with the same - ``language_codes`` or companies having open jobs with the same - ``language_codes`` are returned. - """ - - COMPLETION_TYPE_UNSPECIFIED = 0 - JOB_TITLE = 1 - COMPANY_NAME = 2 - COMBINED = 3 - - -class DeviceInfo(object): - class DeviceType(enum.IntEnum): - """ - An enumeration describing an API access portal and exposure mechanism. - - Attributes: - DEVICE_TYPE_UNSPECIFIED (int): The device type isn't specified. - WEB (int): A desktop web browser, such as, Chrome, Firefox, Safari, or Internet - Explorer) - MOBILE_WEB (int): A mobile device web browser, such as a phone or tablet with a Chrome - browser. - ANDROID (int): An Android device native application. - IOS (int): An iOS device native application. - BOT (int): A bot, as opposed to a device operated by human beings, such as a web - crawler. - OTHER (int): Other devices types. - """ - - DEVICE_TYPE_UNSPECIFIED = 0 - WEB = 1 - MOBILE_WEB = 2 - ANDROID = 3 - IOS = 4 - BOT = 5 - OTHER = 6 - - -class EmployerFilter(object): - class EmployerFilterMode(enum.IntEnum): - """ - Enum indicating which set of ``Profile.employment_records`` to - search against. - - Attributes: - EMPLOYER_FILTER_MODE_UNSPECIFIED (int): Default value. - ALL_EMPLOYMENT_RECORDS (int): Apply to all employers in ``Profile.employment_records``. - CURRENT_EMPLOYMENT_RECORDS_ONLY (int): Apply only to current employer in ``Profile.employment_records``. - PAST_EMPLOYMENT_RECORDS_ONLY (int): Apply only to past (not current) employers in - ``Profile.employment_records``. - """ - - EMPLOYER_FILTER_MODE_UNSPECIFIED = 0 - ALL_EMPLOYMENT_RECORDS = 1 - CURRENT_EMPLOYMENT_RECORDS_ONLY = 2 - PAST_EMPLOYMENT_RECORDS_ONLY = 3 - - -class JobEvent(object): - class JobEventType(enum.IntEnum): - """ - An enumeration of an event attributed to the behavior of the end user, - such as a job seeker. - - Attributes: - JOB_EVENT_TYPE_UNSPECIFIED (int): The event is unspecified by other provided values. - IMPRESSION (int): The job seeker or other entity interacting with the service has - had a job rendered in their view, such as in a list of search results in - a compressed or clipped format. This event is typically associated with - the viewing of a jobs list on a single page by a job seeker. - VIEW (int): The job seeker, or other entity interacting with the service, has - viewed the details of a job, including the full description. This event - doesn't apply to the viewing a snippet of a job appearing as a part of - the job search results. Viewing a snippet is associated with an - ``impression``). - VIEW_REDIRECT (int): The job seeker or other entity interacting with the service - performed an action to view a job and was redirected to a different - website for job. - APPLICATION_START (int): The job seeker or other entity interacting with the service - began the process or demonstrated the intention of applying for a job. - APPLICATION_FINISH (int): The job seeker or other entity interacting with the service - submitted an application for a job. - APPLICATION_QUICK_SUBMISSION (int): The job seeker or other entity interacting with the service - submitted an application for a job with a single click without entering - information. If a job seeker performs this action, send only this event - to the service. Do not also send ``JobEventType.APPLICATION_START`` or - ``JobEventType.APPLICATION_FINISH`` events. - APPLICATION_REDIRECT (int): The job seeker or other entity interacting with the service - performed an action to apply to a job and was redirected to a different - website to complete the application. - APPLICATION_START_FROM_SEARCH (int): The job seeker or other entity interacting with the service began the - process or demonstrated the intention of applying for a job from the - search results page without viewing the details of the job posting. - If sending this event, JobEventType.VIEW event shouldn't be sent. - APPLICATION_REDIRECT_FROM_SEARCH (int): The job seeker, or other entity interacting with the service, - performs an action with a single click from the search results page to - apply to a job (without viewing the details of the job posting), and is - redirected to a different website to complete the application. If a - candidate performs this action, send only this event to the service. Do - not also send ``JobEventType.APPLICATION_START``, - ``JobEventType.APPLICATION_FINISH`` or ``JobEventType.VIEW`` events. - APPLICATION_COMPANY_SUBMIT (int): This event should be used when a company submits an application - on behalf of a job seeker. This event is intended for use by staffing - agencies attempting to place candidates. - BOOKMARK (int): The job seeker or other entity interacting with the service demonstrated - an interest in a job by bookmarking or saving it. - NOTIFICATION (int): The job seeker or other entity interacting with the service was - sent a notification, such as an email alert or device notification, - containing one or more jobs listings generated by the service. - HIRED (int): The job seeker or other entity interacting with the service was - employed by the hiring entity (employer). Send this event - only if the job seeker was hired through an application that was - initiated by a search conducted through the Cloud Talent Solution - service. - SENT_CV (int): A recruiter or staffing agency submitted an application on behalf of the - candidate after interacting with the service to identify a suitable job - posting. - INTERVIEW_GRANTED (int): The entity interacting with the service (for example, the job seeker), - was granted an initial interview by the hiring entity (employer). This - event should only be sent if the job seeker was granted an interview as - part of an application that was initiated by a search conducted through / - recommendation provided by the Cloud Talent Solution service. - """ - - JOB_EVENT_TYPE_UNSPECIFIED = 0 - IMPRESSION = 1 - VIEW = 2 - VIEW_REDIRECT = 3 - APPLICATION_START = 4 - APPLICATION_FINISH = 5 - APPLICATION_QUICK_SUBMISSION = 6 - APPLICATION_REDIRECT = 7 - APPLICATION_START_FROM_SEARCH = 8 - APPLICATION_REDIRECT_FROM_SEARCH = 9 - APPLICATION_COMPANY_SUBMIT = 10 - BOOKMARK = 11 - NOTIFICATION = 12 - HIRED = 13 - SENT_CV = 14 - INTERVIEW_GRANTED = 15 - - -class Location(object): - class LocationType(enum.IntEnum): - """ - An enum which represents the type of a location. - - Attributes: - LOCATION_TYPE_UNSPECIFIED (int): Default value if the type isn't specified. - COUNTRY (int): A country level location. - ADMINISTRATIVE_AREA (int): A state or equivalent level location. - SUB_ADMINISTRATIVE_AREA (int): A county or equivalent level location. - LOCALITY (int): A city or equivalent level location. - POSTAL_CODE (int): A postal code level location. - SUB_LOCALITY (int): A sublocality is a subdivision of a locality, for example a city borough, - ward, or arrondissement. Sublocalities are usually recognized by a local - political authority. For example, Manhattan and Brooklyn are recognized - as boroughs by the City of New York, and are therefore modeled as - sublocalities. - SUB_LOCALITY_1 (int): A district or equivalent level location. - SUB_LOCALITY_2 (int): A smaller district or equivalent level display. - NEIGHBORHOOD (int): A neighborhood level location. - STREET_ADDRESS (int): A street address level location. - """ - - LOCATION_TYPE_UNSPECIFIED = 0 - COUNTRY = 1 - ADMINISTRATIVE_AREA = 2 - SUB_ADMINISTRATIVE_AREA = 3 - LOCALITY = 4 - POSTAL_CODE = 5 - SUB_LOCALITY = 6 - SUB_LOCALITY_1 = 7 - SUB_LOCALITY_2 = 8 - NEIGHBORHOOD = 9 - STREET_ADDRESS = 10 - - -class LocationFilter(object): - class TelecommutePreference(enum.IntEnum): - """ - Specify whether to include telecommute jobs. - - Attributes: - TELECOMMUTE_PREFERENCE_UNSPECIFIED (int): Default value if the telecommute preference isn't specified. - TELECOMMUTE_EXCLUDED (int): Exclude telecommute jobs. - TELECOMMUTE_ALLOWED (int): Allow telecommute jobs. - """ - - TELECOMMUTE_PREFERENCE_UNSPECIFIED = 0 - TELECOMMUTE_EXCLUDED = 1 - TELECOMMUTE_ALLOWED = 2 - - -class Phone(object): - class PhoneType(enum.IntEnum): - """ - Enum that represents the type of the telephone. - - Attributes: - PHONE_TYPE_UNSPECIFIED (int): Default value. - LANDLINE (int): A landline. - MOBILE (int): A mobile. - FAX (int): A fax. - PAGER (int): A pager. - TTY_OR_TDD (int): A TTY (test telephone) or TDD (telecommunication device for the deaf). - VOICEMAIL (int): A voicemail. - VIRTUAL (int): A virtual telephone number is a number that can be routed to another - number and managed by the user via Web, SMS, IVR, and so on. It is - associated with a particular person, and may be routed to either a - MOBILE or LANDLINE number. The ``phone usage`` should be set to PERSONAL - for these phone types. Some more information can be found here: - https://en.wikipedia.org/wiki/Personal_Numbers - VOIP (int): Voice over IP numbers. This includes TSoIP (Telephony Service over IP). - MOBILE_OR_LANDLINE (int): In some regions (e.g. the USA), it is impossible to distinguish between - fixed-line and mobile numbers by looking at the phone number itself. - """ - - PHONE_TYPE_UNSPECIFIED = 0 - LANDLINE = 1 - MOBILE = 2 - FAX = 3 - PAGER = 4 - TTY_OR_TDD = 5 - VOICEMAIL = 6 - VIRTUAL = 7 - VOIP = 8 - MOBILE_OR_LANDLINE = 9 - - -class ProfileEvent(object): - class ProfileEventType(enum.IntEnum): - """ - The enum represents types of client events for a candidate profile. - - Attributes: - PROFILE_EVENT_TYPE_UNSPECIFIED (int): Default value. - IMPRESSION (int): Send this event when a ``ProfileEvent.profiles`` was sent as a part - of a result set for a CTS API call and was rendered in the end user's UI - (that is, the ``ProfileEvent.recruiter``). - VIEW (int): The VIEW event records the action of a candidate's profile being - viewed by an end user. This is critical to tracking product metrics and - should be sent for every profile VIEW that happens in your system, - whether the event is associated with an API call (for example, a - recruiter making a request for a result set and clicking on a profile) - or not (a recruiter using the system to view profile details without - making a request). - - For a VIEW events associated with API calls, the - ``ClientEvent.request_id`` should be populated. If the VIEW is not - associated with an API call, ``request_id`` should not be populated. - - This event requires a valid recruiter and one valid ID in profiles. - BOOKMARK (int): The profile is bookmarked. - """ - - PROFILE_EVENT_TYPE_UNSPECIFIED = 0 - IMPRESSION = 1 - VIEW = 2 - BOOKMARK = 3 - - -class Resume(object): - class ResumeType(enum.IntEnum): - """ - The format of a structured resume. - - Attributes: - RESUME_TYPE_UNSPECIFIED (int): Default value. - HRXML (int): The profile contents in HR-XML format. - See https://schemas.liquid-technologies.com/hr-xml/2007-04-15/ for more - information about Human Resources XML. - OTHER_RESUME_TYPE (int): Resume type not specified. - """ - - RESUME_TYPE_UNSPECIFIED = 0 - HRXML = 1 - OTHER_RESUME_TYPE = 2 - - -class SearchJobsRequest(object): - class DiversificationLevel(enum.IntEnum): - """ - Controls whether highly similar jobs are returned next to each other in - the search results. Jobs are identified as highly similar based on - their titles, job categories, and locations. Highly similar results are - clustered so that only one representative job of the cluster is - displayed to the job seeker higher up in the results, with the other jobs - being displayed lower down in the results. - - Attributes: - DIVERSIFICATION_LEVEL_UNSPECIFIED (int): The diversification level isn't specified. - DISABLED (int): Disables diversification. Jobs that would normally be pushed to the last - page would not have their positions altered. This may result in highly - similar jobs appearing in sequence in the search results. - SIMPLE (int): Default diversifying behavior. The result list is ordered so that - highly similar results are pushed to the end of the last page of search - results. If you are using pageToken to page through the result set, - latency might be lower but we can't guarantee that all results are - returned. If you are using page offset, latency might be higher but all - results are returned. - """ - - DIVERSIFICATION_LEVEL_UNSPECIFIED = 0 - DISABLED = 1 - SIMPLE = 2 - - class SearchMode(enum.IntEnum): - """ - A string-represented enumeration of the job search mode. The service - operate differently for different modes of service. - - Attributes: - SEARCH_MODE_UNSPECIFIED (int): The mode of the search method isn't specified. The default search - behavior is identical to JOB_SEARCH search behavior. - JOB_SEARCH (int): The job search matches against all jobs, and featured jobs - (jobs with promotionValue > 0) are not specially handled. - FEATURED_JOB_SEARCH (int): The job search matches only against featured jobs (jobs with a - promotionValue > 0). This method doesn't return any jobs having a - promotionValue <= 0. The search results order is determined by the - promotionValue (jobs with a higher promotionValue are returned higher up - in the search results), with relevance being used as a tiebreaker. - """ - - SEARCH_MODE_UNSPECIFIED = 0 - JOB_SEARCH = 1 - FEATURED_JOB_SEARCH = 2 - - class CustomRankingInfo(object): - class ImportanceLevel(enum.IntEnum): - """ - The importance level for ``CustomRankingInfo.ranking_expression``. - - Attributes: - IMPORTANCE_LEVEL_UNSPECIFIED (int): Default value if the importance level isn't specified. - NONE (int): The given ranking expression is of None importance, existing relevance - score (determined by API algorithm) dominates job's final ranking - position. - LOW (int): The given ranking expression is of Low importance in terms of job's - final ranking position compared to existing relevance - score (determined by API algorithm). - MILD (int): The given ranking expression is of Mild importance in terms of job's - final ranking position compared to existing relevance - score (determined by API algorithm). - MEDIUM (int): The given ranking expression is of Medium importance in terms of job's - final ranking position compared to existing relevance - score (determined by API algorithm). - HIGH (int): The given ranking expression is of High importance in terms of job's - final ranking position compared to existing relevance - score (determined by API algorithm). - EXTREME (int): The given ranking expression is of Extreme importance, and dominates - job's final ranking position with existing relevance - score (determined by API algorithm) ignored. - """ - - IMPORTANCE_LEVEL_UNSPECIFIED = 0 - NONE = 1 - LOW = 2 - MILD = 3 - MEDIUM = 4 - HIGH = 5 - EXTREME = 6 - - -class Tenant(object): - class DataUsageType(enum.IntEnum): - """ - Enum that represents how user data owned by the tenant is used. - - Attributes: - DATA_USAGE_TYPE_UNSPECIFIED (int): Default value. - AGGREGATED (int): Data owned by this tenant is used to improve search/recommendation - quality across tenants. - ISOLATED (int): Data owned by this tenant is used to improve search/recommendation - quality for this tenant only. - """ - - DATA_USAGE_TYPE_UNSPECIFIED = 0 - AGGREGATED = 1 - ISOLATED = 2 - - -class TimeFilter(object): - class TimeField(enum.IntEnum): - """ - Time fields can be used in TimeFilter. - - Attributes: - TIME_FIELD_UNSPECIFIED (int): Default value. - CREATE_TIME (int): Earliest profile create time. - UPDATE_TIME (int): Latest profile update time. - """ - - TIME_FIELD_UNSPECIFIED = 0 - CREATE_TIME = 1 - UPDATE_TIME = 2 diff --git a/google/cloud/talent_v4beta1/gapic/event_service_client.py b/google/cloud/talent_v4beta1/gapic/event_service_client.py deleted file mode 100644 index a0e95c4f..00000000 --- a/google/cloud/talent_v4beta1/gapic/event_service_client.py +++ /dev/null @@ -1,299 +0,0 @@ -# -*- 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 -# -# https://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. - -"""Accesses the google.cloud.talent.v4beta1 EventService API.""" - -import pkg_resources -import warnings - -from google.oauth2 import service_account -import google.api_core.client_options -import google.api_core.gapic_v1.client_info -import google.api_core.gapic_v1.config -import google.api_core.gapic_v1.method -import google.api_core.gapic_v1.routing_header -import google.api_core.grpc_helpers -import google.api_core.path_template -import grpc - -from google.cloud.talent_v4beta1.gapic import enums -from google.cloud.talent_v4beta1.gapic import event_service_client_config -from google.cloud.talent_v4beta1.gapic.transports import event_service_grpc_transport -from google.cloud.talent_v4beta1.proto import application_pb2 -from google.cloud.talent_v4beta1.proto import application_service_pb2 -from google.cloud.talent_v4beta1.proto import application_service_pb2_grpc -from google.cloud.talent_v4beta1.proto import company_pb2 -from google.cloud.talent_v4beta1.proto import company_service_pb2 -from google.cloud.talent_v4beta1.proto import company_service_pb2_grpc -from google.cloud.talent_v4beta1.proto import completion_service_pb2 -from google.cloud.talent_v4beta1.proto import completion_service_pb2_grpc -from google.cloud.talent_v4beta1.proto import event_pb2 -from google.cloud.talent_v4beta1.proto import event_service_pb2 -from google.cloud.talent_v4beta1.proto import event_service_pb2_grpc -from google.protobuf import empty_pb2 -from google.protobuf import field_mask_pb2 - - -_GAPIC_LIBRARY_VERSION = pkg_resources.get_distribution("google-cloud-talent",).version - - -class EventServiceClient(object): - """A service handles client event report.""" - - SERVICE_ADDRESS = "jobs.googleapis.com:443" - """The default address of the service.""" - - # The name of the interface for this client. This is the key used to - # find the method configuration in the client_config dictionary. - _INTERFACE_NAME = "google.cloud.talent.v4beta1.EventService" - - @classmethod - def from_service_account_file(cls, filename, *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: - EventServiceClient: The constructed client. - """ - credentials = service_account.Credentials.from_service_account_file(filename) - kwargs["credentials"] = credentials - return cls(*args, **kwargs) - - from_service_account_json = from_service_account_file - - @classmethod - def project_path(cls, project): - """Return a fully-qualified project string.""" - return google.api_core.path_template.expand( - "projects/{project}", project=project, - ) - - @classmethod - def tenant_path(cls, project, tenant): - """Return a fully-qualified tenant string.""" - return google.api_core.path_template.expand( - "projects/{project}/tenants/{tenant}", project=project, tenant=tenant, - ) - - def __init__( - self, - transport=None, - channel=None, - credentials=None, - client_config=None, - client_info=None, - client_options=None, - ): - """Constructor. - - Args: - transport (Union[~.EventServiceGrpcTransport, - Callable[[~.Credentials, type], ~.EventServiceGrpcTransport]): A transport - instance, responsible for actually making the API calls. - The default transport uses the gRPC protocol. - This argument may also be a callable which returns a - transport instance. Callables will be sent the credentials - as the first argument and the default transport class as - the second argument. - channel (grpc.Channel): DEPRECATED. A ``Channel`` instance - through which to make calls. This argument is mutually exclusive - with ``credentials``; providing both will raise an exception. - credentials (google.auth.credentials.Credentials): The - authorization credentials to attach to requests. These - credentials identify this application to the service. If none - are specified, the client will attempt to ascertain the - credentials from the environment. - This argument is mutually exclusive with providing a - transport instance to ``transport``; doing so will raise - an exception. - client_config (dict): DEPRECATED. A dictionary of call options for - each method. If not specified, the default configuration is used. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - client_options (Union[dict, google.api_core.client_options.ClientOptions]): - Client options used to set user options on the client. API Endpoint - should be set through client_options. - """ - # Raise deprecation warnings for things we want to go away. - if client_config is not None: - warnings.warn( - "The `client_config` argument is deprecated.", - PendingDeprecationWarning, - stacklevel=2, - ) - else: - client_config = event_service_client_config.config - - if channel: - warnings.warn( - "The `channel` argument is deprecated; use " "`transport` instead.", - PendingDeprecationWarning, - stacklevel=2, - ) - - api_endpoint = self.SERVICE_ADDRESS - if client_options: - if type(client_options) == dict: - client_options = google.api_core.client_options.from_dict( - client_options - ) - if client_options.api_endpoint: - api_endpoint = client_options.api_endpoint - - # Instantiate the transport. - # The transport is responsible for handling serialization and - # deserialization and actually sending data to the service. - if transport: - if callable(transport): - self.transport = transport( - credentials=credentials, - default_class=event_service_grpc_transport.EventServiceGrpcTransport, - address=api_endpoint, - ) - else: - if credentials: - raise ValueError( - "Received both a transport instance and " - "credentials; these are mutually exclusive." - ) - self.transport = transport - else: - self.transport = event_service_grpc_transport.EventServiceGrpcTransport( - address=api_endpoint, channel=channel, credentials=credentials, - ) - - if client_info is None: - client_info = google.api_core.gapic_v1.client_info.ClientInfo( - gapic_version=_GAPIC_LIBRARY_VERSION, - ) - else: - client_info.gapic_version = _GAPIC_LIBRARY_VERSION - self._client_info = client_info - - # Parse out the default settings for retry and timeout for each RPC - # from the client configuration. - # (Ordinarily, these are the defaults specified in the `*_config.py` - # file next to this one.) - self._method_configs = google.api_core.gapic_v1.config.parse_method_configs( - client_config["interfaces"][self._INTERFACE_NAME], - ) - - # Save a dictionary of cached API call functions. - # These are the actual callables which invoke the proper - # transport methods, wrapped with `wrap_method` to add retry, - # timeout, and the like. - self._inner_api_calls = {} - - # Service calls - def create_client_event( - self, - parent, - client_event, - retry=google.api_core.gapic_v1.method.DEFAULT, - timeout=google.api_core.gapic_v1.method.DEFAULT, - metadata=None, - ): - """ - Report events issued when end user interacts with customer's - application that uses Cloud Talent Solution. You may inspect the created - events in `self service - tools `__. - `Learn - more `__ - about self service tools. - - Example: - >>> from google.cloud import talent_v4beta1 - >>> - >>> client = talent_v4beta1.EventServiceClient() - >>> - >>> parent = client.tenant_path('[PROJECT]', '[TENANT]') - >>> - >>> # TODO: Initialize `client_event`: - >>> client_event = {} - >>> - >>> response = client.create_client_event(parent, client_event) - - Args: - parent (str): Required. Resource name of the tenant under which the event is - created. - - The format is "projects/{project_id}/tenants/{tenant_id}", for example, - "projects/foo/tenant/bar". If tenant id is unspecified, a default tenant - is created, for example, "projects/foo". - client_event (Union[dict, ~google.cloud.talent_v4beta1.types.ClientEvent]): Required. Events issued when end user interacts with customer's application that - uses Cloud Talent Solution. - - If a dict is provided, it must be of the same form as the protobuf - message :class:`~google.cloud.talent_v4beta1.types.ClientEvent` - retry (Optional[google.api_core.retry.Retry]): A retry object used - to retry requests. If ``None`` is specified, requests will - be retried using a default configuration. - timeout (Optional[float]): The amount of time, in seconds, to wait - for the request to complete. Note that if ``retry`` is - specified, the timeout applies to each individual attempt. - metadata (Optional[Sequence[Tuple[str, str]]]): Additional metadata - that is provided to the method. - - Returns: - A :class:`~google.cloud.talent_v4beta1.types.ClientEvent` instance. - - Raises: - google.api_core.exceptions.GoogleAPICallError: If the request - failed for any reason. - google.api_core.exceptions.RetryError: If the request failed due - to a retryable error and retry attempts failed. - ValueError: If the parameters are invalid. - """ - # Wrap the transport method to add retry and timeout logic. - if "create_client_event" not in self._inner_api_calls: - self._inner_api_calls[ - "create_client_event" - ] = google.api_core.gapic_v1.method.wrap_method( - self.transport.create_client_event, - default_retry=self._method_configs["CreateClientEvent"].retry, - default_timeout=self._method_configs["CreateClientEvent"].timeout, - client_info=self._client_info, - ) - - request = event_service_pb2.CreateClientEventRequest( - parent=parent, client_event=client_event, - ) - if metadata is None: - metadata = [] - metadata = list(metadata) - try: - routing_header = [("parent", parent)] - except AttributeError: - pass - else: - routing_metadata = google.api_core.gapic_v1.routing_header.to_grpc_metadata( - routing_header - ) - metadata.append(routing_metadata) - - return self._inner_api_calls["create_client_event"]( - request, retry=retry, timeout=timeout, metadata=metadata - ) diff --git a/google/cloud/talent_v4beta1/gapic/event_service_client_config.py b/google/cloud/talent_v4beta1/gapic/event_service_client_config.py deleted file mode 100644 index 4886b0cb..00000000 --- a/google/cloud/talent_v4beta1/gapic/event_service_client_config.py +++ /dev/null @@ -1,34 +0,0 @@ -config = { - "interfaces": { - "google.cloud.talent.v4beta1.EventService": { - "retry_codes": {"no_retry_codes": [], "no_retry_1_codes": []}, - "retry_params": { - "no_retry_params": { - "initial_retry_delay_millis": 0, - "retry_delay_multiplier": 0.0, - "max_retry_delay_millis": 0, - "initial_rpc_timeout_millis": 0, - "rpc_timeout_multiplier": 1.0, - "max_rpc_timeout_millis": 0, - "total_timeout_millis": 0, - }, - "no_retry_1_params": { - "initial_retry_delay_millis": 0, - "retry_delay_multiplier": 0.0, - "max_retry_delay_millis": 0, - "initial_rpc_timeout_millis": 30000, - "rpc_timeout_multiplier": 1.0, - "max_rpc_timeout_millis": 30000, - "total_timeout_millis": 30000, - }, - }, - "methods": { - "CreateClientEvent": { - "timeout_millis": 30000, - "retry_codes_name": "no_retry_1_codes", - "retry_params_name": "no_retry_1_params", - } - }, - } - } -} diff --git a/google/cloud/talent_v4beta1/gapic/job_service_client.py b/google/cloud/talent_v4beta1/gapic/job_service_client.py deleted file mode 100644 index 0b2f3f08..00000000 --- a/google/cloud/talent_v4beta1/gapic/job_service_client.py +++ /dev/null @@ -1,1719 +0,0 @@ -# -*- 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 -# -# https://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. - -"""Accesses the google.cloud.talent.v4beta1 JobService API.""" - -import functools -import pkg_resources -import warnings - -from google.oauth2 import service_account -import google.api_core.client_options -import google.api_core.gapic_v1.client_info -import google.api_core.gapic_v1.config -import google.api_core.gapic_v1.method -import google.api_core.gapic_v1.routing_header -import google.api_core.grpc_helpers -import google.api_core.operation -import google.api_core.operations_v1 -import google.api_core.page_iterator -import google.api_core.path_template -import grpc - -from google.cloud.talent_v4beta1.gapic import enums -from google.cloud.talent_v4beta1.gapic import job_service_client_config -from google.cloud.talent_v4beta1.gapic.transports import job_service_grpc_transport -from google.cloud.talent_v4beta1.proto import application_pb2 -from google.cloud.talent_v4beta1.proto import application_service_pb2 -from google.cloud.talent_v4beta1.proto import application_service_pb2_grpc -from google.cloud.talent_v4beta1.proto import common_pb2 -from google.cloud.talent_v4beta1.proto import company_pb2 -from google.cloud.talent_v4beta1.proto import company_service_pb2 -from google.cloud.talent_v4beta1.proto import company_service_pb2_grpc -from google.cloud.talent_v4beta1.proto import completion_service_pb2 -from google.cloud.talent_v4beta1.proto import completion_service_pb2_grpc -from google.cloud.talent_v4beta1.proto import event_pb2 -from google.cloud.talent_v4beta1.proto import event_service_pb2 -from google.cloud.talent_v4beta1.proto import event_service_pb2_grpc -from google.cloud.talent_v4beta1.proto import filters_pb2 -from google.cloud.talent_v4beta1.proto import histogram_pb2 -from google.cloud.talent_v4beta1.proto import job_pb2 -from google.cloud.talent_v4beta1.proto import job_service_pb2 -from google.cloud.talent_v4beta1.proto import job_service_pb2_grpc -from google.longrunning import operations_pb2 -from google.protobuf import empty_pb2 -from google.protobuf import field_mask_pb2 - - -_GAPIC_LIBRARY_VERSION = pkg_resources.get_distribution("google-cloud-talent",).version - - -class JobServiceClient(object): - """A service handles job management, including job CRUD, enumeration and search.""" - - SERVICE_ADDRESS = "jobs.googleapis.com:443" - """The default address of the service.""" - - # The name of the interface for this client. This is the key used to - # find the method configuration in the client_config dictionary. - _INTERFACE_NAME = "google.cloud.talent.v4beta1.JobService" - - @classmethod - def from_service_account_file(cls, filename, *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: - JobServiceClient: The constructed client. - """ - credentials = service_account.Credentials.from_service_account_file(filename) - kwargs["credentials"] = credentials - return cls(*args, **kwargs) - - from_service_account_json = from_service_account_file - - @classmethod - def company_path(cls, project, tenant, company): - """Return a fully-qualified company string.""" - return google.api_core.path_template.expand( - "projects/{project}/tenants/{tenant}/companies/{company}", - project=project, - tenant=tenant, - company=company, - ) - - @classmethod - def company_without_tenant_path(cls, project, company): - """Return a fully-qualified company_without_tenant string.""" - return google.api_core.path_template.expand( - "projects/{project}/companies/{company}", project=project, company=company, - ) - - @classmethod - def job_path(cls, project, tenant, job): - """Return a fully-qualified job string.""" - return google.api_core.path_template.expand( - "projects/{project}/tenants/{tenant}/jobs/{job}", - project=project, - tenant=tenant, - job=job, - ) - - @classmethod - def job_without_tenant_path(cls, project, job): - """Return a fully-qualified job_without_tenant string.""" - return google.api_core.path_template.expand( - "projects/{project}/jobs/{job}", project=project, job=job, - ) - - @classmethod - def project_path(cls, project): - """Return a fully-qualified project string.""" - return google.api_core.path_template.expand( - "projects/{project}", project=project, - ) - - @classmethod - def tenant_path(cls, project, tenant): - """Return a fully-qualified tenant string.""" - return google.api_core.path_template.expand( - "projects/{project}/tenants/{tenant}", project=project, tenant=tenant, - ) - - def __init__( - self, - transport=None, - channel=None, - credentials=None, - client_config=None, - client_info=None, - client_options=None, - ): - """Constructor. - - Args: - transport (Union[~.JobServiceGrpcTransport, - Callable[[~.Credentials, type], ~.JobServiceGrpcTransport]): A transport - instance, responsible for actually making the API calls. - The default transport uses the gRPC protocol. - This argument may also be a callable which returns a - transport instance. Callables will be sent the credentials - as the first argument and the default transport class as - the second argument. - channel (grpc.Channel): DEPRECATED. A ``Channel`` instance - through which to make calls. This argument is mutually exclusive - with ``credentials``; providing both will raise an exception. - credentials (google.auth.credentials.Credentials): The - authorization credentials to attach to requests. These - credentials identify this application to the service. If none - are specified, the client will attempt to ascertain the - credentials from the environment. - This argument is mutually exclusive with providing a - transport instance to ``transport``; doing so will raise - an exception. - client_config (dict): DEPRECATED. A dictionary of call options for - each method. If not specified, the default configuration is used. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - client_options (Union[dict, google.api_core.client_options.ClientOptions]): - Client options used to set user options on the client. API Endpoint - should be set through client_options. - """ - # Raise deprecation warnings for things we want to go away. - if client_config is not None: - warnings.warn( - "The `client_config` argument is deprecated.", - PendingDeprecationWarning, - stacklevel=2, - ) - else: - client_config = job_service_client_config.config - - if channel: - warnings.warn( - "The `channel` argument is deprecated; use " "`transport` instead.", - PendingDeprecationWarning, - stacklevel=2, - ) - - api_endpoint = self.SERVICE_ADDRESS - if client_options: - if type(client_options) == dict: - client_options = google.api_core.client_options.from_dict( - client_options - ) - if client_options.api_endpoint: - api_endpoint = client_options.api_endpoint - - # Instantiate the transport. - # The transport is responsible for handling serialization and - # deserialization and actually sending data to the service. - if transport: - if callable(transport): - self.transport = transport( - credentials=credentials, - default_class=job_service_grpc_transport.JobServiceGrpcTransport, - address=api_endpoint, - ) - else: - if credentials: - raise ValueError( - "Received both a transport instance and " - "credentials; these are mutually exclusive." - ) - self.transport = transport - else: - self.transport = job_service_grpc_transport.JobServiceGrpcTransport( - address=api_endpoint, channel=channel, credentials=credentials, - ) - - if client_info is None: - client_info = google.api_core.gapic_v1.client_info.ClientInfo( - gapic_version=_GAPIC_LIBRARY_VERSION, - ) - else: - client_info.gapic_version = _GAPIC_LIBRARY_VERSION - self._client_info = client_info - - # Parse out the default settings for retry and timeout for each RPC - # from the client configuration. - # (Ordinarily, these are the defaults specified in the `*_config.py` - # file next to this one.) - self._method_configs = google.api_core.gapic_v1.config.parse_method_configs( - client_config["interfaces"][self._INTERFACE_NAME], - ) - - # Save a dictionary of cached API call functions. - # These are the actual callables which invoke the proper - # transport methods, wrapped with `wrap_method` to add retry, - # timeout, and the like. - self._inner_api_calls = {} - - # Service calls - def create_job( - self, - parent, - job, - retry=google.api_core.gapic_v1.method.DEFAULT, - timeout=google.api_core.gapic_v1.method.DEFAULT, - metadata=None, - ): - """ - Creates a new job. - - Typically, the job becomes searchable within 10 seconds, but it may take - up to 5 minutes. - - Example: - >>> from google.cloud import talent_v4beta1 - >>> - >>> client = talent_v4beta1.JobServiceClient() - >>> - >>> parent = client.tenant_path('[PROJECT]', '[TENANT]') - >>> - >>> # TODO: Initialize `job`: - >>> job = {} - >>> - >>> response = client.create_job(parent, job) - - Args: - parent (str): Required. The resource name of the tenant under which the job is - created. - - The format is "projects/{project_id}/tenants/{tenant_id}". For example, - "projects/foo/tenant/bar". If tenant id is unspecified a default tenant - is created. For example, "projects/foo". - job (Union[dict, ~google.cloud.talent_v4beta1.types.Job]): Required. The Job to be created. - - If a dict is provided, it must be of the same form as the protobuf - message :class:`~google.cloud.talent_v4beta1.types.Job` - retry (Optional[google.api_core.retry.Retry]): A retry object used - to retry requests. If ``None`` is specified, requests will - be retried using a default configuration. - timeout (Optional[float]): The amount of time, in seconds, to wait - for the request to complete. Note that if ``retry`` is - specified, the timeout applies to each individual attempt. - metadata (Optional[Sequence[Tuple[str, str]]]): Additional metadata - that is provided to the method. - - Returns: - A :class:`~google.cloud.talent_v4beta1.types.Job` instance. - - Raises: - google.api_core.exceptions.GoogleAPICallError: If the request - failed for any reason. - google.api_core.exceptions.RetryError: If the request failed due - to a retryable error and retry attempts failed. - ValueError: If the parameters are invalid. - """ - # Wrap the transport method to add retry and timeout logic. - if "create_job" not in self._inner_api_calls: - self._inner_api_calls[ - "create_job" - ] = google.api_core.gapic_v1.method.wrap_method( - self.transport.create_job, - default_retry=self._method_configs["CreateJob"].retry, - default_timeout=self._method_configs["CreateJob"].timeout, - client_info=self._client_info, - ) - - request = job_service_pb2.CreateJobRequest(parent=parent, job=job,) - if metadata is None: - metadata = [] - metadata = list(metadata) - try: - routing_header = [("parent", parent)] - except AttributeError: - pass - else: - routing_metadata = google.api_core.gapic_v1.routing_header.to_grpc_metadata( - routing_header - ) - metadata.append(routing_metadata) - - return self._inner_api_calls["create_job"]( - request, retry=retry, timeout=timeout, metadata=metadata - ) - - def batch_create_jobs( - self, - parent, - jobs, - retry=google.api_core.gapic_v1.method.DEFAULT, - timeout=google.api_core.gapic_v1.method.DEFAULT, - metadata=None, - ): - """ - Begins executing a batch create jobs operation. - - Example: - >>> from google.cloud import talent_v4beta1 - >>> - >>> client = talent_v4beta1.JobServiceClient() - >>> - >>> parent = client.tenant_path('[PROJECT]', '[TENANT]') - >>> - >>> # TODO: Initialize `jobs`: - >>> jobs = [] - >>> - >>> response = client.batch_create_jobs(parent, jobs) - >>> - >>> def callback(operation_future): - ... # Handle result. - ... result = operation_future.result() - >>> - >>> response.add_done_callback(callback) - >>> - >>> # Handle metadata. - >>> metadata = response.metadata() - - Args: - parent (str): Required. The resource name of the tenant under which the job is - created. - - The format is "projects/{project_id}/tenants/{tenant_id}". For example, - "projects/foo/tenant/bar". If tenant id is unspecified, a default tenant - is created. For example, "projects/foo". - jobs (list[Union[dict, ~google.cloud.talent_v4beta1.types.Job]]): Required. The jobs to be created. - - If a dict is provided, it must be of the same form as the protobuf - message :class:`~google.cloud.talent_v4beta1.types.Job` - retry (Optional[google.api_core.retry.Retry]): A retry object used - to retry requests. If ``None`` is specified, requests will - be retried using a default configuration. - timeout (Optional[float]): The amount of time, in seconds, to wait - for the request to complete. Note that if ``retry`` is - specified, the timeout applies to each individual attempt. - metadata (Optional[Sequence[Tuple[str, str]]]): Additional metadata - that is provided to the method. - - Returns: - A :class:`~google.cloud.talent_v4beta1.types._OperationFuture` instance. - - Raises: - google.api_core.exceptions.GoogleAPICallError: If the request - failed for any reason. - google.api_core.exceptions.RetryError: If the request failed due - to a retryable error and retry attempts failed. - ValueError: If the parameters are invalid. - """ - # Wrap the transport method to add retry and timeout logic. - if "batch_create_jobs" not in self._inner_api_calls: - self._inner_api_calls[ - "batch_create_jobs" - ] = google.api_core.gapic_v1.method.wrap_method( - self.transport.batch_create_jobs, - default_retry=self._method_configs["BatchCreateJobs"].retry, - default_timeout=self._method_configs["BatchCreateJobs"].timeout, - client_info=self._client_info, - ) - - request = job_service_pb2.BatchCreateJobsRequest(parent=parent, jobs=jobs,) - if metadata is None: - metadata = [] - metadata = list(metadata) - try: - routing_header = [("parent", parent)] - except AttributeError: - pass - else: - routing_metadata = google.api_core.gapic_v1.routing_header.to_grpc_metadata( - routing_header - ) - metadata.append(routing_metadata) - - operation = self._inner_api_calls["batch_create_jobs"]( - request, retry=retry, timeout=timeout, metadata=metadata - ) - return google.api_core.operation.from_gapic( - operation, - self.transport._operations_client, - job_service_pb2.JobOperationResult, - metadata_type=common_pb2.BatchOperationMetadata, - ) - - def get_job( - self, - name, - retry=google.api_core.gapic_v1.method.DEFAULT, - timeout=google.api_core.gapic_v1.method.DEFAULT, - metadata=None, - ): - """ - Retrieves the specified job, whose status is OPEN or recently EXPIRED - within the last 90 days. - - Example: - >>> from google.cloud import talent_v4beta1 - >>> - >>> client = talent_v4beta1.JobServiceClient() - >>> - >>> name = client.job_path('[PROJECT]', '[TENANT]', '[JOB]') - >>> - >>> response = client.get_job(name) - - Args: - name (str): Required. The resource name of the job to retrieve. - - The format is "projects/{project_id}/tenants/{tenant_id}/jobs/{job_id}". - For example, "projects/foo/tenants/bar/jobs/baz". - - If tenant id is unspecified, the default tenant is used. For example, - "projects/foo/jobs/bar". - retry (Optional[google.api_core.retry.Retry]): A retry object used - to retry requests. If ``None`` is specified, requests will - be retried using a default configuration. - timeout (Optional[float]): The amount of time, in seconds, to wait - for the request to complete. Note that if ``retry`` is - specified, the timeout applies to each individual attempt. - metadata (Optional[Sequence[Tuple[str, str]]]): Additional metadata - that is provided to the method. - - Returns: - A :class:`~google.cloud.talent_v4beta1.types.Job` instance. - - Raises: - google.api_core.exceptions.GoogleAPICallError: If the request - failed for any reason. - google.api_core.exceptions.RetryError: If the request failed due - to a retryable error and retry attempts failed. - ValueError: If the parameters are invalid. - """ - # Wrap the transport method to add retry and timeout logic. - if "get_job" not in self._inner_api_calls: - self._inner_api_calls[ - "get_job" - ] = google.api_core.gapic_v1.method.wrap_method( - self.transport.get_job, - default_retry=self._method_configs["GetJob"].retry, - default_timeout=self._method_configs["GetJob"].timeout, - client_info=self._client_info, - ) - - request = job_service_pb2.GetJobRequest(name=name,) - if metadata is None: - metadata = [] - metadata = list(metadata) - try: - routing_header = [("name", name)] - except AttributeError: - pass - else: - routing_metadata = google.api_core.gapic_v1.routing_header.to_grpc_metadata( - routing_header - ) - metadata.append(routing_metadata) - - return self._inner_api_calls["get_job"]( - request, retry=retry, timeout=timeout, metadata=metadata - ) - - def update_job( - self, - job, - update_mask=None, - retry=google.api_core.gapic_v1.method.DEFAULT, - timeout=google.api_core.gapic_v1.method.DEFAULT, - metadata=None, - ): - """ - Updates specified job. - - Typically, updated contents become visible in search results within 10 - seconds, but it may take up to 5 minutes. - - Example: - >>> from google.cloud import talent_v4beta1 - >>> - >>> client = talent_v4beta1.JobServiceClient() - >>> - >>> # TODO: Initialize `job`: - >>> job = {} - >>> - >>> response = client.update_job(job) - - Args: - job (Union[dict, ~google.cloud.talent_v4beta1.types.Job]): Required. The Job to be updated. - - If a dict is provided, it must be of the same form as the protobuf - message :class:`~google.cloud.talent_v4beta1.types.Job` - update_mask (Union[dict, ~google.cloud.talent_v4beta1.types.FieldMask]): Strongly recommended for the best service experience. - - If ``update_mask`` is provided, only the specified fields in ``job`` are - updated. Otherwise all the fields are updated. - - A field mask to restrict the fields that are updated. Only top level - fields of ``Job`` are supported. - - If a dict is provided, it must be of the same form as the protobuf - message :class:`~google.cloud.talent_v4beta1.types.FieldMask` - retry (Optional[google.api_core.retry.Retry]): A retry object used - to retry requests. If ``None`` is specified, requests will - be retried using a default configuration. - timeout (Optional[float]): The amount of time, in seconds, to wait - for the request to complete. Note that if ``retry`` is - specified, the timeout applies to each individual attempt. - metadata (Optional[Sequence[Tuple[str, str]]]): Additional metadata - that is provided to the method. - - Returns: - A :class:`~google.cloud.talent_v4beta1.types.Job` instance. - - Raises: - google.api_core.exceptions.GoogleAPICallError: If the request - failed for any reason. - google.api_core.exceptions.RetryError: If the request failed due - to a retryable error and retry attempts failed. - ValueError: If the parameters are invalid. - """ - # Wrap the transport method to add retry and timeout logic. - if "update_job" not in self._inner_api_calls: - self._inner_api_calls[ - "update_job" - ] = google.api_core.gapic_v1.method.wrap_method( - self.transport.update_job, - default_retry=self._method_configs["UpdateJob"].retry, - default_timeout=self._method_configs["UpdateJob"].timeout, - client_info=self._client_info, - ) - - request = job_service_pb2.UpdateJobRequest(job=job, update_mask=update_mask,) - if metadata is None: - metadata = [] - metadata = list(metadata) - try: - routing_header = [("job.name", job.name)] - except AttributeError: - pass - else: - routing_metadata = google.api_core.gapic_v1.routing_header.to_grpc_metadata( - routing_header - ) - metadata.append(routing_metadata) - - return self._inner_api_calls["update_job"]( - request, retry=retry, timeout=timeout, metadata=metadata - ) - - def batch_update_jobs( - self, - parent, - jobs, - update_mask=None, - retry=google.api_core.gapic_v1.method.DEFAULT, - timeout=google.api_core.gapic_v1.method.DEFAULT, - metadata=None, - ): - """ - Begins executing a batch update jobs operation. - - Example: - >>> from google.cloud import talent_v4beta1 - >>> - >>> client = talent_v4beta1.JobServiceClient() - >>> - >>> parent = client.tenant_path('[PROJECT]', '[TENANT]') - >>> - >>> # TODO: Initialize `jobs`: - >>> jobs = [] - >>> - >>> response = client.batch_update_jobs(parent, jobs) - >>> - >>> def callback(operation_future): - ... # Handle result. - ... result = operation_future.result() - >>> - >>> response.add_done_callback(callback) - >>> - >>> # Handle metadata. - >>> metadata = response.metadata() - - Args: - parent (str): Required. The resource name of the tenant under which the job is - created. - - The format is "projects/{project_id}/tenants/{tenant_id}". For example, - "projects/foo/tenant/bar". If tenant id is unspecified, a default tenant - is created. For example, "projects/foo". - jobs (list[Union[dict, ~google.cloud.talent_v4beta1.types.Job]]): Required. The jobs to be updated. - - If a dict is provided, it must be of the same form as the protobuf - message :class:`~google.cloud.talent_v4beta1.types.Job` - update_mask (Union[dict, ~google.cloud.talent_v4beta1.types.FieldMask]): Strongly recommended for the best service experience. Be aware that - it will also increase latency when checking the status of a batch - operation. - - If ``update_mask`` is provided, only the specified fields in ``Job`` are - updated. Otherwise all the fields are updated. - - A field mask to restrict the fields that are updated. Only top level - fields of ``Job`` are supported. - - If ``update_mask`` is provided, The ``Job`` inside ``JobResult`` will - only contains fields that is updated, plus the Id of the Job. Otherwise, - ``Job`` will include all fields, which can yield a very large response. - - If a dict is provided, it must be of the same form as the protobuf - message :class:`~google.cloud.talent_v4beta1.types.FieldMask` - retry (Optional[google.api_core.retry.Retry]): A retry object used - to retry requests. If ``None`` is specified, requests will - be retried using a default configuration. - timeout (Optional[float]): The amount of time, in seconds, to wait - for the request to complete. Note that if ``retry`` is - specified, the timeout applies to each individual attempt. - metadata (Optional[Sequence[Tuple[str, str]]]): Additional metadata - that is provided to the method. - - Returns: - A :class:`~google.cloud.talent_v4beta1.types._OperationFuture` instance. - - Raises: - google.api_core.exceptions.GoogleAPICallError: If the request - failed for any reason. - google.api_core.exceptions.RetryError: If the request failed due - to a retryable error and retry attempts failed. - ValueError: If the parameters are invalid. - """ - # Wrap the transport method to add retry and timeout logic. - if "batch_update_jobs" not in self._inner_api_calls: - self._inner_api_calls[ - "batch_update_jobs" - ] = google.api_core.gapic_v1.method.wrap_method( - self.transport.batch_update_jobs, - default_retry=self._method_configs["BatchUpdateJobs"].retry, - default_timeout=self._method_configs["BatchUpdateJobs"].timeout, - client_info=self._client_info, - ) - - request = job_service_pb2.BatchUpdateJobsRequest( - parent=parent, jobs=jobs, update_mask=update_mask, - ) - if metadata is None: - metadata = [] - metadata = list(metadata) - try: - routing_header = [("parent", parent)] - except AttributeError: - pass - else: - routing_metadata = google.api_core.gapic_v1.routing_header.to_grpc_metadata( - routing_header - ) - metadata.append(routing_metadata) - - operation = self._inner_api_calls["batch_update_jobs"]( - request, retry=retry, timeout=timeout, metadata=metadata - ) - return google.api_core.operation.from_gapic( - operation, - self.transport._operations_client, - job_service_pb2.JobOperationResult, - metadata_type=common_pb2.BatchOperationMetadata, - ) - - def delete_job( - self, - name, - retry=google.api_core.gapic_v1.method.DEFAULT, - timeout=google.api_core.gapic_v1.method.DEFAULT, - metadata=None, - ): - """ - Deletes the specified job. - - Typically, the job becomes unsearchable within 10 seconds, but it may take - up to 5 minutes. - - Example: - >>> from google.cloud import talent_v4beta1 - >>> - >>> client = talent_v4beta1.JobServiceClient() - >>> - >>> name = client.job_path('[PROJECT]', '[TENANT]', '[JOB]') - >>> - >>> client.delete_job(name) - - Args: - name (str): Required. The resource name of the job to be deleted. - - The format is "projects/{project_id}/tenants/{tenant_id}/jobs/{job_id}". - For example, "projects/foo/tenants/bar/jobs/baz". - - If tenant id is unspecified, the default tenant is used. For example, - "projects/foo/jobs/bar". - retry (Optional[google.api_core.retry.Retry]): A retry object used - to retry requests. If ``None`` is specified, requests will - be retried using a default configuration. - timeout (Optional[float]): The amount of time, in seconds, to wait - for the request to complete. Note that if ``retry`` is - specified, the timeout applies to each individual attempt. - metadata (Optional[Sequence[Tuple[str, str]]]): Additional metadata - that is provided to the method. - - Raises: - google.api_core.exceptions.GoogleAPICallError: If the request - failed for any reason. - google.api_core.exceptions.RetryError: If the request failed due - to a retryable error and retry attempts failed. - ValueError: If the parameters are invalid. - """ - # Wrap the transport method to add retry and timeout logic. - if "delete_job" not in self._inner_api_calls: - self._inner_api_calls[ - "delete_job" - ] = google.api_core.gapic_v1.method.wrap_method( - self.transport.delete_job, - default_retry=self._method_configs["DeleteJob"].retry, - default_timeout=self._method_configs["DeleteJob"].timeout, - client_info=self._client_info, - ) - - request = job_service_pb2.DeleteJobRequest(name=name,) - if metadata is None: - metadata = [] - metadata = list(metadata) - try: - routing_header = [("name", name)] - except AttributeError: - pass - else: - routing_metadata = google.api_core.gapic_v1.routing_header.to_grpc_metadata( - routing_header - ) - metadata.append(routing_metadata) - - self._inner_api_calls["delete_job"]( - request, retry=retry, timeout=timeout, metadata=metadata - ) - - def batch_delete_jobs( - self, - parent, - filter_, - retry=google.api_core.gapic_v1.method.DEFAULT, - timeout=google.api_core.gapic_v1.method.DEFAULT, - metadata=None, - ): - """ - Deletes a list of ``Job``\ s by filter. - - Example: - >>> from google.cloud import talent_v4beta1 - >>> - >>> client = talent_v4beta1.JobServiceClient() - >>> - >>> parent = client.tenant_path('[PROJECT]', '[TENANT]') - >>> - >>> # TODO: Initialize `filter_`: - >>> filter_ = '' - >>> - >>> client.batch_delete_jobs(parent, filter_) - - Args: - parent (str): Required. The resource name of the tenant under which the job is - created. - - The format is "projects/{project_id}/tenants/{tenant_id}". For example, - "projects/foo/tenant/bar". If tenant id is unspecified, a default tenant - is created. For example, "projects/foo". - filter_ (str): Required. The filter string specifies the jobs to be deleted. - - Supported operator: =, AND - - The fields eligible for filtering are: - - - ``companyName`` (Required) - - ``requisitionId`` (Required) - - Sample Query: companyName = "projects/foo/companies/bar" AND - requisitionId = "req-1" - retry (Optional[google.api_core.retry.Retry]): A retry object used - to retry requests. If ``None`` is specified, requests will - be retried using a default configuration. - timeout (Optional[float]): The amount of time, in seconds, to wait - for the request to complete. Note that if ``retry`` is - specified, the timeout applies to each individual attempt. - metadata (Optional[Sequence[Tuple[str, str]]]): Additional metadata - that is provided to the method. - - Raises: - google.api_core.exceptions.GoogleAPICallError: If the request - failed for any reason. - google.api_core.exceptions.RetryError: If the request failed due - to a retryable error and retry attempts failed. - ValueError: If the parameters are invalid. - """ - # Wrap the transport method to add retry and timeout logic. - if "batch_delete_jobs" not in self._inner_api_calls: - self._inner_api_calls[ - "batch_delete_jobs" - ] = google.api_core.gapic_v1.method.wrap_method( - self.transport.batch_delete_jobs, - default_retry=self._method_configs["BatchDeleteJobs"].retry, - default_timeout=self._method_configs["BatchDeleteJobs"].timeout, - client_info=self._client_info, - ) - - request = job_service_pb2.BatchDeleteJobsRequest(parent=parent, filter=filter_,) - if metadata is None: - metadata = [] - metadata = list(metadata) - try: - routing_header = [("parent", parent)] - except AttributeError: - pass - else: - routing_metadata = google.api_core.gapic_v1.routing_header.to_grpc_metadata( - routing_header - ) - metadata.append(routing_metadata) - - self._inner_api_calls["batch_delete_jobs"]( - request, retry=retry, timeout=timeout, metadata=metadata - ) - - def list_jobs( - self, - parent, - filter_, - page_size=None, - job_view=None, - retry=google.api_core.gapic_v1.method.DEFAULT, - timeout=google.api_core.gapic_v1.method.DEFAULT, - metadata=None, - ): - """ - Lists jobs by filter. - - Example: - >>> from google.cloud import talent_v4beta1 - >>> - >>> client = talent_v4beta1.JobServiceClient() - >>> - >>> parent = client.tenant_path('[PROJECT]', '[TENANT]') - >>> - >>> # TODO: Initialize `filter_`: - >>> filter_ = '' - >>> - >>> # Iterate over all results - >>> for element in client.list_jobs(parent, filter_): - ... # process element - ... pass - >>> - >>> - >>> # Alternatively: - >>> - >>> # Iterate over results one page at a time - >>> for page in client.list_jobs(parent, filter_).pages: - ... for element in page: - ... # process element - ... pass - - Args: - parent (str): Required. The resource name of the tenant under which the job is - created. - - The format is "projects/{project_id}/tenants/{tenant_id}". For example, - "projects/foo/tenant/bar". If tenant id is unspecified, a default tenant - is created. For example, "projects/foo". - filter_ (str): Required. The filter string specifies the jobs to be enumerated. - - Supported operator: =, AND - - The fields eligible for filtering are: - - - ``companyName`` (Required) - - ``requisitionId`` - - ``status`` Available values: OPEN, EXPIRED, ALL. Defaults to OPEN if - no value is specified. - - Sample Query: - - - companyName = "projects/foo/tenants/bar/companies/baz" - - companyName = "projects/foo/tenants/bar/companies/baz" AND - requisitionId = "req-1" - - companyName = "projects/foo/tenants/bar/companies/baz" AND status = - "EXPIRED" - page_size (int): The maximum number of resources contained in the - underlying API response. If page streaming is performed per- - resource, this parameter does not affect the return value. If page - streaming is performed per-page, this determines the maximum number - of resources in a page. - job_view (~google.cloud.talent_v4beta1.types.JobView): The desired job attributes returned for jobs in the search response. - Defaults to ``JobView.JOB_VIEW_FULL`` if no value is specified. - retry (Optional[google.api_core.retry.Retry]): A retry object used - to retry requests. If ``None`` is specified, requests will - be retried using a default configuration. - timeout (Optional[float]): The amount of time, in seconds, to wait - for the request to complete. Note that if ``retry`` is - specified, the timeout applies to each individual attempt. - metadata (Optional[Sequence[Tuple[str, str]]]): Additional metadata - that is provided to the method. - - Returns: - A :class:`~google.api_core.page_iterator.PageIterator` instance. - An iterable of :class:`~google.cloud.talent_v4beta1.types.Job` instances. - You can also iterate over the pages of the response - using its `pages` property. - - Raises: - google.api_core.exceptions.GoogleAPICallError: If the request - failed for any reason. - google.api_core.exceptions.RetryError: If the request failed due - to a retryable error and retry attempts failed. - ValueError: If the parameters are invalid. - """ - # Wrap the transport method to add retry and timeout logic. - if "list_jobs" not in self._inner_api_calls: - self._inner_api_calls[ - "list_jobs" - ] = google.api_core.gapic_v1.method.wrap_method( - self.transport.list_jobs, - default_retry=self._method_configs["ListJobs"].retry, - default_timeout=self._method_configs["ListJobs"].timeout, - client_info=self._client_info, - ) - - request = job_service_pb2.ListJobsRequest( - parent=parent, filter=filter_, page_size=page_size, job_view=job_view, - ) - if metadata is None: - metadata = [] - metadata = list(metadata) - try: - routing_header = [("parent", parent)] - except AttributeError: - pass - else: - routing_metadata = google.api_core.gapic_v1.routing_header.to_grpc_metadata( - routing_header - ) - metadata.append(routing_metadata) - - iterator = google.api_core.page_iterator.GRPCIterator( - client=None, - method=functools.partial( - self._inner_api_calls["list_jobs"], - retry=retry, - timeout=timeout, - metadata=metadata, - ), - request=request, - items_field="jobs", - request_token_field="page_token", - response_token_field="next_page_token", - ) - return iterator - - def search_jobs( - self, - parent, - request_metadata, - search_mode=None, - job_query=None, - enable_broadening=None, - require_precise_result_size=None, - histogram_queries=None, - job_view=None, - offset=None, - page_size=None, - order_by=None, - diversification_level=None, - custom_ranking_info=None, - disable_keyword_match=None, - retry=google.api_core.gapic_v1.method.DEFAULT, - timeout=google.api_core.gapic_v1.method.DEFAULT, - metadata=None, - ): - """ - Searches for jobs using the provided ``SearchJobsRequest``. - - This call constrains the ``visibility`` of jobs present in the database, - and only returns jobs that the caller has permission to search against. - - Example: - >>> from google.cloud import talent_v4beta1 - >>> - >>> client = talent_v4beta1.JobServiceClient() - >>> - >>> parent = client.tenant_path('[PROJECT]', '[TENANT]') - >>> - >>> # TODO: Initialize `request_metadata`: - >>> request_metadata = {} - >>> - >>> # Iterate over all results - >>> for element in client.search_jobs(parent, request_metadata): - ... # process element - ... pass - >>> - >>> - >>> # Alternatively: - >>> - >>> # Iterate over results one page at a time - >>> for page in client.search_jobs(parent, request_metadata).pages: - ... for element in page: - ... # process element - ... pass - - Args: - parent (str): Required. The resource name of the tenant to search within. - - The format is "projects/{project_id}/tenants/{tenant_id}". For example, - "projects/foo/tenant/bar". If tenant id is unspecified, a default tenant - is created. For example, "projects/foo". - request_metadata (Union[dict, ~google.cloud.talent_v4beta1.types.RequestMetadata]): Required. The meta information collected about the job searcher, - used to improve the search quality of the service. The identifiers (such - as ``user_id``) are provided by users, and must be unique and - consistent. - - If a dict is provided, it must be of the same form as the protobuf - message :class:`~google.cloud.talent_v4beta1.types.RequestMetadata` - search_mode (~google.cloud.talent_v4beta1.types.SearchMode): Mode of a search. - - Defaults to ``SearchMode.JOB_SEARCH``. - job_query (Union[dict, ~google.cloud.talent_v4beta1.types.JobQuery]): Query used to search against jobs, such as keyword, location filters, etc. - - If a dict is provided, it must be of the same form as the protobuf - message :class:`~google.cloud.talent_v4beta1.types.JobQuery` - enable_broadening (bool): Controls whether to broaden the search when it produces sparse results. - Broadened queries append results to the end of the matching results - list. - - Defaults to false. - require_precise_result_size (bool): Controls if the search job request requires the return of a precise - count of the first 300 results. Setting this to ``true`` ensures - consistency in the number of results per page. Best practice is to set - this value to true if a client allows users to jump directly to a - non-sequential search results page. - - Enabling this flag may adversely impact performance. - - Defaults to false. - histogram_queries (list[Union[dict, ~google.cloud.talent_v4beta1.types.HistogramQuery]]): An expression specifies a histogram request against matching jobs. - - Expression syntax is an aggregation function call with histogram facets - and other options. - - Available aggregation function calls are: - - - ``count(string_histogram_facet)``: Count the number of matching - entities, for each distinct attribute value. - - ``count(numeric_histogram_facet, list of buckets)``: Count the number - of matching entities within each bucket. - - Data types: - - - Histogram facet: facet names with format [a-zA-Z][a-zA-Z0-9\_]+. - - String: string like "any string with backslash escape for quote(")." - - Number: whole number and floating point number like 10, -1 and -0.01. - - List: list of elements with comma(,) separator surrounded by square - brackets, for example, [1, 2, 3] and ["one", "two", "three"]. - - Built-in constants: - - - MIN (minimum number similar to java Double.MIN_VALUE) - - MAX (maximum number similar to java Double.MAX_VALUE) - - Built-in functions: - - - bucket(start, end[, label]): bucket built-in function creates a - bucket with range of \`start, end). Note that the end is exclusive, - for example, bucket(1, MAX, "positive number") or bucket(1, 10). - - Job histogram facets: - - - company_display_name: histogram by [Job.company_display_name`. - - employment_type: histogram by ``Job.employment_types``, for example, - "FULL_TIME", "PART_TIME". - - company_size: histogram by ``CompanySize``, for example, "SMALL", - "MEDIUM", "BIG". - - publish_time_in_month: histogram by the ``Job.posting_publish_time`` - in months. Must specify list of numeric buckets in spec. - - publish_time_in_year: histogram by the ``Job.posting_publish_time`` - in years. Must specify list of numeric buckets in spec. - - degree_types: histogram by the ``Job.degree_types``, for example, - "Bachelors", "Masters". - - job_level: histogram by the ``Job.job_level``, for example, "Entry - Level". - - country: histogram by the country code of jobs, for example, "US", - "FR". - - admin1: histogram by the admin1 code of jobs, which is a global - placeholder referring to the state, province, or the particular term - a country uses to define the geographic structure below the country - level, for example, "CA", "IL". - - city: histogram by a combination of the "city name, admin1 code". For - example, "Mountain View, CA", "New York, NY". - - admin1_country: histogram by a combination of the "admin1 code, - country", for example, "CA, US", "IL, US". - - city_coordinate: histogram by the city center's GPS coordinates - (latitude and longitude), for example, 37.4038522,-122.0987765. Since - the coordinates of a city center can change, customers may need to - refresh them periodically. - - locale: histogram by the ``Job.language_code``, for example, "en-US", - "fr-FR". - - language: histogram by the language subtag of the - ``Job.language_code``, for example, "en", "fr". - - category: histogram by the ``JobCategory``, for example, - "COMPUTER_AND_IT", "HEALTHCARE". - - base_compensation_unit: histogram by the - ``CompensationInfo.CompensationUnit`` of base salary, for example, - "WEEKLY", "MONTHLY". - - base_compensation: histogram by the base salary. Must specify list of - numeric buckets to group results by. - - annualized_base_compensation: histogram by the base annualized - salary. Must specify list of numeric buckets to group results by. - - annualized_total_compensation: histogram by the total annualized - salary. Must specify list of numeric buckets to group results by. - - string_custom_attribute: histogram by string - ``Job.custom_attributes``. Values can be accessed via square bracket - notations like string_custom_attribute["key1"]. - - numeric_custom_attribute: histogram by numeric - ``Job.custom_attributes``. Values can be accessed via square bracket - notations like numeric_custom_attribute["key1"]. Must specify list of - numeric buckets to group results by. - - Example expressions: - - - ``count(admin1)`` - - ``count(base_compensation, [bucket(1000, 10000), bucket(10000, 100000), bucket(100000, MAX)])`` - - ``count(string_custom_attribute["some-string-custom-attribute"])`` - - ``count(numeric_custom_attribute["some-numeric-custom-attribute"], [bucket(MIN, 0, "negative"), bucket(0, MAX, "non-negative"])`` - - If a dict is provided, it must be of the same form as the protobuf - message :class:`~google.cloud.talent_v4beta1.types.HistogramQuery` - job_view (~google.cloud.talent_v4beta1.types.JobView): The desired job attributes returned for jobs in the search response. - Defaults to ``JobView.JOB_VIEW_SMALL`` if no value is specified. - offset (int): An integer that specifies the current offset (that is, starting - result location, amongst the jobs deemed by the API as relevant) in - search results. This field is only considered if ``page_token`` is - unset. - - The maximum allowed value is 5000. Otherwise an error is thrown. - - For example, 0 means to return results starting from the first matching - job, and 10 means to return from the 11th job. This can be used for - pagination, (for example, pageSize = 10 and offset = 10 means to return - from the second page). - page_size (int): The maximum number of resources contained in the - underlying API response. If page streaming is performed per- - resource, this parameter does not affect the return value. If page - streaming is performed per-page, this determines the maximum number - of resources in a page. - order_by (str): The criteria determining how search results are sorted. Default is - ``"relevance desc"``. - - Supported options are: - - - ``"relevance desc"``: By relevance descending, as determined by the - API algorithms. Relevance thresholding of query results is only - available with this ordering. - - ``"posting_publish_time desc"``: By ``Job.posting_publish_time`` - descending. - - ``"posting_update_time desc"``: By ``Job.posting_update_time`` - descending. - - ``"title"``: By ``Job.title`` ascending. - - ``"title desc"``: By ``Job.title`` descending. - - ``"annualized_base_compensation"``: By job's - ``CompensationInfo.annualized_base_compensation_range`` ascending. - Jobs whose annualized base compensation is unspecified are put at the - end of search results. - - ``"annualized_base_compensation desc"``: By job's - ``CompensationInfo.annualized_base_compensation_range`` descending. - Jobs whose annualized base compensation is unspecified are put at the - end of search results. - - ``"annualized_total_compensation"``: By job's - ``CompensationInfo.annualized_total_compensation_range`` ascending. - Jobs whose annualized base compensation is unspecified are put at the - end of search results. - - ``"annualized_total_compensation desc"``: By job's - ``CompensationInfo.annualized_total_compensation_range`` descending. - Jobs whose annualized base compensation is unspecified are put at the - end of search results. - - ``"custom_ranking desc"``: By the relevance score adjusted to the - ``SearchJobsRequest.CustomRankingInfo.ranking_expression`` with - weight factor assigned by - ``SearchJobsRequest.CustomRankingInfo.importance_level`` in - descending order. - - Location sorting: Use the special syntax to order jobs by distance: - ``"distance_from('Hawaii')"``: Order by distance from Hawaii. - ``"distance_from(19.89, 155.5)"``: Order by distance from a - coordinate. - ``"distance_from('Hawaii'), distance_from('Puerto Rico')"``: Order by - multiple locations. See details below. - ``"distance_from('Hawaii'), distance_from(19.89, 155.5)"``: Order by - multiple locations. See details below. The string can have a maximum - of 256 characters. When multiple distance centers are provided, a job - that is close to any of the distance centers would have a high rank. - When a job has multiple locations, the job location closest to one of - the distance centers will be used. Jobs that don't have locations - will be ranked at the bottom. Distance is calculated with a precision - of 11.3 meters (37.4 feet). Diversification strategy is still applied - unless explicitly disabled in ``diversification_level``. - diversification_level (~google.cloud.talent_v4beta1.types.DiversificationLevel): Controls whether highly similar jobs are returned next to each other - in the search results. Jobs are identified as highly similar based on - their titles, job categories, and locations. Highly similar results are - clustered so that only one representative job of the cluster is - displayed to the job seeker higher up in the results, with the other - jobs being displayed lower down in the results. - - Defaults to ``DiversificationLevel.SIMPLE`` if no value is specified. - custom_ranking_info (Union[dict, ~google.cloud.talent_v4beta1.types.CustomRankingInfo]): Controls over how job documents get ranked on top of existing relevance - score (determined by API algorithm). - - If a dict is provided, it must be of the same form as the protobuf - message :class:`~google.cloud.talent_v4beta1.types.CustomRankingInfo` - disable_keyword_match (bool): Controls whether to disable exact keyword match on ``Job.title``, - ``Job.description``, ``Job.company_display_name``, ``Job.addresses``, - ``Job.qualifications``. When disable keyword match is turned off, a - keyword match returns jobs that do not match given category filters when - there are matching keywords. For example, for the query "program - manager," a result is returned even if the job posting has the title - "software developer," which doesn't fall into "program manager" - ontology, but does have "program manager" appearing in its description. - - For queries like "cloud" that don't contain title or location specific - ontology, jobs with "cloud" keyword matches are returned regardless of - this flag's value. - - Use ``Company.keyword_searchable_job_custom_attributes`` if - company-specific globally matched custom field/attribute string values - are needed. Enabling keyword match improves recall of subsequent search - requests. - - Defaults to false. - retry (Optional[google.api_core.retry.Retry]): A retry object used - to retry requests. If ``None`` is specified, requests will - be retried using a default configuration. - timeout (Optional[float]): The amount of time, in seconds, to wait - for the request to complete. Note that if ``retry`` is - specified, the timeout applies to each individual attempt. - metadata (Optional[Sequence[Tuple[str, str]]]): Additional metadata - that is provided to the method. - - Returns: - A :class:`~google.api_core.page_iterator.PageIterator` instance. - An iterable of :class:`~google.cloud.talent_v4beta1.types.MatchingJob` instances. - You can also iterate over the pages of the response - using its `pages` property. - - Raises: - google.api_core.exceptions.GoogleAPICallError: If the request - failed for any reason. - google.api_core.exceptions.RetryError: If the request failed due - to a retryable error and retry attempts failed. - ValueError: If the parameters are invalid. - """ - # Wrap the transport method to add retry and timeout logic. - if "search_jobs" not in self._inner_api_calls: - self._inner_api_calls[ - "search_jobs" - ] = google.api_core.gapic_v1.method.wrap_method( - self.transport.search_jobs, - default_retry=self._method_configs["SearchJobs"].retry, - default_timeout=self._method_configs["SearchJobs"].timeout, - client_info=self._client_info, - ) - - request = job_service_pb2.SearchJobsRequest( - parent=parent, - request_metadata=request_metadata, - search_mode=search_mode, - job_query=job_query, - enable_broadening=enable_broadening, - require_precise_result_size=require_precise_result_size, - histogram_queries=histogram_queries, - job_view=job_view, - offset=offset, - page_size=page_size, - order_by=order_by, - diversification_level=diversification_level, - custom_ranking_info=custom_ranking_info, - disable_keyword_match=disable_keyword_match, - ) - if metadata is None: - metadata = [] - metadata = list(metadata) - try: - routing_header = [("parent", parent)] - except AttributeError: - pass - else: - routing_metadata = google.api_core.gapic_v1.routing_header.to_grpc_metadata( - routing_header - ) - metadata.append(routing_metadata) - - iterator = google.api_core.page_iterator.GRPCIterator( - client=None, - method=functools.partial( - self._inner_api_calls["search_jobs"], - retry=retry, - timeout=timeout, - metadata=metadata, - ), - request=request, - items_field="matching_jobs", - request_token_field="page_token", - response_token_field="next_page_token", - ) - return iterator - - def search_jobs_for_alert( - self, - parent, - request_metadata, - search_mode=None, - job_query=None, - enable_broadening=None, - require_precise_result_size=None, - histogram_queries=None, - job_view=None, - offset=None, - page_size=None, - order_by=None, - diversification_level=None, - custom_ranking_info=None, - disable_keyword_match=None, - retry=google.api_core.gapic_v1.method.DEFAULT, - timeout=google.api_core.gapic_v1.method.DEFAULT, - metadata=None, - ): - """ - Searches for jobs using the provided ``SearchJobsRequest``. - - This API call is intended for the use case of targeting passive job - seekers (for example, job seekers who have signed up to receive email - alerts about potential job opportunities), and has different algorithmic - adjustments that are targeted to passive job seekers. - - This call constrains the ``visibility`` of jobs present in the database, - and only returns jobs the caller has permission to search against. - - Example: - >>> from google.cloud import talent_v4beta1 - >>> - >>> client = talent_v4beta1.JobServiceClient() - >>> - >>> parent = client.tenant_path('[PROJECT]', '[TENANT]') - >>> - >>> # TODO: Initialize `request_metadata`: - >>> request_metadata = {} - >>> - >>> # Iterate over all results - >>> for element in client.search_jobs_for_alert(parent, request_metadata): - ... # process element - ... pass - >>> - >>> - >>> # Alternatively: - >>> - >>> # Iterate over results one page at a time - >>> for page in client.search_jobs_for_alert(parent, request_metadata).pages: - ... for element in page: - ... # process element - ... pass - - Args: - parent (str): Required. The resource name of the tenant to search within. - - The format is "projects/{project_id}/tenants/{tenant_id}". For example, - "projects/foo/tenant/bar". If tenant id is unspecified, a default tenant - is created. For example, "projects/foo". - request_metadata (Union[dict, ~google.cloud.talent_v4beta1.types.RequestMetadata]): Required. The meta information collected about the job searcher, - used to improve the search quality of the service. The identifiers (such - as ``user_id``) are provided by users, and must be unique and - consistent. - - If a dict is provided, it must be of the same form as the protobuf - message :class:`~google.cloud.talent_v4beta1.types.RequestMetadata` - search_mode (~google.cloud.talent_v4beta1.types.SearchMode): Mode of a search. - - Defaults to ``SearchMode.JOB_SEARCH``. - job_query (Union[dict, ~google.cloud.talent_v4beta1.types.JobQuery]): Query used to search against jobs, such as keyword, location filters, etc. - - If a dict is provided, it must be of the same form as the protobuf - message :class:`~google.cloud.talent_v4beta1.types.JobQuery` - enable_broadening (bool): Controls whether to broaden the search when it produces sparse results. - Broadened queries append results to the end of the matching results - list. - - Defaults to false. - require_precise_result_size (bool): Controls if the search job request requires the return of a precise - count of the first 300 results. Setting this to ``true`` ensures - consistency in the number of results per page. Best practice is to set - this value to true if a client allows users to jump directly to a - non-sequential search results page. - - Enabling this flag may adversely impact performance. - - Defaults to false. - histogram_queries (list[Union[dict, ~google.cloud.talent_v4beta1.types.HistogramQuery]]): An expression specifies a histogram request against matching jobs. - - Expression syntax is an aggregation function call with histogram facets - and other options. - - Available aggregation function calls are: - - - ``count(string_histogram_facet)``: Count the number of matching - entities, for each distinct attribute value. - - ``count(numeric_histogram_facet, list of buckets)``: Count the number - of matching entities within each bucket. - - Data types: - - - Histogram facet: facet names with format [a-zA-Z][a-zA-Z0-9\_]+. - - String: string like "any string with backslash escape for quote(")." - - Number: whole number and floating point number like 10, -1 and -0.01. - - List: list of elements with comma(,) separator surrounded by square - brackets, for example, [1, 2, 3] and ["one", "two", "three"]. - - Built-in constants: - - - MIN (minimum number similar to java Double.MIN_VALUE) - - MAX (maximum number similar to java Double.MAX_VALUE) - - Built-in functions: - - - bucket(start, end[, label]): bucket built-in function creates a - bucket with range of \`start, end). Note that the end is exclusive, - for example, bucket(1, MAX, "positive number") or bucket(1, 10). - - Job histogram facets: - - - company_display_name: histogram by [Job.company_display_name`. - - employment_type: histogram by ``Job.employment_types``, for example, - "FULL_TIME", "PART_TIME". - - company_size: histogram by ``CompanySize``, for example, "SMALL", - "MEDIUM", "BIG". - - publish_time_in_month: histogram by the ``Job.posting_publish_time`` - in months. Must specify list of numeric buckets in spec. - - publish_time_in_year: histogram by the ``Job.posting_publish_time`` - in years. Must specify list of numeric buckets in spec. - - degree_types: histogram by the ``Job.degree_types``, for example, - "Bachelors", "Masters". - - job_level: histogram by the ``Job.job_level``, for example, "Entry - Level". - - country: histogram by the country code of jobs, for example, "US", - "FR". - - admin1: histogram by the admin1 code of jobs, which is a global - placeholder referring to the state, province, or the particular term - a country uses to define the geographic structure below the country - level, for example, "CA", "IL". - - city: histogram by a combination of the "city name, admin1 code". For - example, "Mountain View, CA", "New York, NY". - - admin1_country: histogram by a combination of the "admin1 code, - country", for example, "CA, US", "IL, US". - - city_coordinate: histogram by the city center's GPS coordinates - (latitude and longitude), for example, 37.4038522,-122.0987765. Since - the coordinates of a city center can change, customers may need to - refresh them periodically. - - locale: histogram by the ``Job.language_code``, for example, "en-US", - "fr-FR". - - language: histogram by the language subtag of the - ``Job.language_code``, for example, "en", "fr". - - category: histogram by the ``JobCategory``, for example, - "COMPUTER_AND_IT", "HEALTHCARE". - - base_compensation_unit: histogram by the - ``CompensationInfo.CompensationUnit`` of base salary, for example, - "WEEKLY", "MONTHLY". - - base_compensation: histogram by the base salary. Must specify list of - numeric buckets to group results by. - - annualized_base_compensation: histogram by the base annualized - salary. Must specify list of numeric buckets to group results by. - - annualized_total_compensation: histogram by the total annualized - salary. Must specify list of numeric buckets to group results by. - - string_custom_attribute: histogram by string - ``Job.custom_attributes``. Values can be accessed via square bracket - notations like string_custom_attribute["key1"]. - - numeric_custom_attribute: histogram by numeric - ``Job.custom_attributes``. Values can be accessed via square bracket - notations like numeric_custom_attribute["key1"]. Must specify list of - numeric buckets to group results by. - - Example expressions: - - - ``count(admin1)`` - - ``count(base_compensation, [bucket(1000, 10000), bucket(10000, 100000), bucket(100000, MAX)])`` - - ``count(string_custom_attribute["some-string-custom-attribute"])`` - - ``count(numeric_custom_attribute["some-numeric-custom-attribute"], [bucket(MIN, 0, "negative"), bucket(0, MAX, "non-negative"])`` - - If a dict is provided, it must be of the same form as the protobuf - message :class:`~google.cloud.talent_v4beta1.types.HistogramQuery` - job_view (~google.cloud.talent_v4beta1.types.JobView): The desired job attributes returned for jobs in the search response. - Defaults to ``JobView.JOB_VIEW_SMALL`` if no value is specified. - offset (int): An integer that specifies the current offset (that is, starting - result location, amongst the jobs deemed by the API as relevant) in - search results. This field is only considered if ``page_token`` is - unset. - - The maximum allowed value is 5000. Otherwise an error is thrown. - - For example, 0 means to return results starting from the first matching - job, and 10 means to return from the 11th job. This can be used for - pagination, (for example, pageSize = 10 and offset = 10 means to return - from the second page). - page_size (int): The maximum number of resources contained in the - underlying API response. If page streaming is performed per- - resource, this parameter does not affect the return value. If page - streaming is performed per-page, this determines the maximum number - of resources in a page. - order_by (str): The criteria determining how search results are sorted. Default is - ``"relevance desc"``. - - Supported options are: - - - ``"relevance desc"``: By relevance descending, as determined by the - API algorithms. Relevance thresholding of query results is only - available with this ordering. - - ``"posting_publish_time desc"``: By ``Job.posting_publish_time`` - descending. - - ``"posting_update_time desc"``: By ``Job.posting_update_time`` - descending. - - ``"title"``: By ``Job.title`` ascending. - - ``"title desc"``: By ``Job.title`` descending. - - ``"annualized_base_compensation"``: By job's - ``CompensationInfo.annualized_base_compensation_range`` ascending. - Jobs whose annualized base compensation is unspecified are put at the - end of search results. - - ``"annualized_base_compensation desc"``: By job's - ``CompensationInfo.annualized_base_compensation_range`` descending. - Jobs whose annualized base compensation is unspecified are put at the - end of search results. - - ``"annualized_total_compensation"``: By job's - ``CompensationInfo.annualized_total_compensation_range`` ascending. - Jobs whose annualized base compensation is unspecified are put at the - end of search results. - - ``"annualized_total_compensation desc"``: By job's - ``CompensationInfo.annualized_total_compensation_range`` descending. - Jobs whose annualized base compensation is unspecified are put at the - end of search results. - - ``"custom_ranking desc"``: By the relevance score adjusted to the - ``SearchJobsRequest.CustomRankingInfo.ranking_expression`` with - weight factor assigned by - ``SearchJobsRequest.CustomRankingInfo.importance_level`` in - descending order. - - Location sorting: Use the special syntax to order jobs by distance: - ``"distance_from('Hawaii')"``: Order by distance from Hawaii. - ``"distance_from(19.89, 155.5)"``: Order by distance from a - coordinate. - ``"distance_from('Hawaii'), distance_from('Puerto Rico')"``: Order by - multiple locations. See details below. - ``"distance_from('Hawaii'), distance_from(19.89, 155.5)"``: Order by - multiple locations. See details below. The string can have a maximum - of 256 characters. When multiple distance centers are provided, a job - that is close to any of the distance centers would have a high rank. - When a job has multiple locations, the job location closest to one of - the distance centers will be used. Jobs that don't have locations - will be ranked at the bottom. Distance is calculated with a precision - of 11.3 meters (37.4 feet). Diversification strategy is still applied - unless explicitly disabled in ``diversification_level``. - diversification_level (~google.cloud.talent_v4beta1.types.DiversificationLevel): Controls whether highly similar jobs are returned next to each other - in the search results. Jobs are identified as highly similar based on - their titles, job categories, and locations. Highly similar results are - clustered so that only one representative job of the cluster is - displayed to the job seeker higher up in the results, with the other - jobs being displayed lower down in the results. - - Defaults to ``DiversificationLevel.SIMPLE`` if no value is specified. - custom_ranking_info (Union[dict, ~google.cloud.talent_v4beta1.types.CustomRankingInfo]): Controls over how job documents get ranked on top of existing relevance - score (determined by API algorithm). - - If a dict is provided, it must be of the same form as the protobuf - message :class:`~google.cloud.talent_v4beta1.types.CustomRankingInfo` - disable_keyword_match (bool): Controls whether to disable exact keyword match on ``Job.title``, - ``Job.description``, ``Job.company_display_name``, ``Job.addresses``, - ``Job.qualifications``. When disable keyword match is turned off, a - keyword match returns jobs that do not match given category filters when - there are matching keywords. For example, for the query "program - manager," a result is returned even if the job posting has the title - "software developer," which doesn't fall into "program manager" - ontology, but does have "program manager" appearing in its description. - - For queries like "cloud" that don't contain title or location specific - ontology, jobs with "cloud" keyword matches are returned regardless of - this flag's value. - - Use ``Company.keyword_searchable_job_custom_attributes`` if - company-specific globally matched custom field/attribute string values - are needed. Enabling keyword match improves recall of subsequent search - requests. - - Defaults to false. - retry (Optional[google.api_core.retry.Retry]): A retry object used - to retry requests. If ``None`` is specified, requests will - be retried using a default configuration. - timeout (Optional[float]): The amount of time, in seconds, to wait - for the request to complete. Note that if ``retry`` is - specified, the timeout applies to each individual attempt. - metadata (Optional[Sequence[Tuple[str, str]]]): Additional metadata - that is provided to the method. - - Returns: - A :class:`~google.api_core.page_iterator.PageIterator` instance. - An iterable of :class:`~google.cloud.talent_v4beta1.types.MatchingJob` instances. - You can also iterate over the pages of the response - using its `pages` property. - - Raises: - google.api_core.exceptions.GoogleAPICallError: If the request - failed for any reason. - google.api_core.exceptions.RetryError: If the request failed due - to a retryable error and retry attempts failed. - ValueError: If the parameters are invalid. - """ - # Wrap the transport method to add retry and timeout logic. - if "search_jobs_for_alert" not in self._inner_api_calls: - self._inner_api_calls[ - "search_jobs_for_alert" - ] = google.api_core.gapic_v1.method.wrap_method( - self.transport.search_jobs_for_alert, - default_retry=self._method_configs["SearchJobsForAlert"].retry, - default_timeout=self._method_configs["SearchJobsForAlert"].timeout, - client_info=self._client_info, - ) - - request = job_service_pb2.SearchJobsRequest( - parent=parent, - request_metadata=request_metadata, - search_mode=search_mode, - job_query=job_query, - enable_broadening=enable_broadening, - require_precise_result_size=require_precise_result_size, - histogram_queries=histogram_queries, - job_view=job_view, - offset=offset, - page_size=page_size, - order_by=order_by, - diversification_level=diversification_level, - custom_ranking_info=custom_ranking_info, - disable_keyword_match=disable_keyword_match, - ) - if metadata is None: - metadata = [] - metadata = list(metadata) - try: - routing_header = [("parent", parent)] - except AttributeError: - pass - else: - routing_metadata = google.api_core.gapic_v1.routing_header.to_grpc_metadata( - routing_header - ) - metadata.append(routing_metadata) - - iterator = google.api_core.page_iterator.GRPCIterator( - client=None, - method=functools.partial( - self._inner_api_calls["search_jobs_for_alert"], - retry=retry, - timeout=timeout, - metadata=metadata, - ), - request=request, - items_field="matching_jobs", - request_token_field="page_token", - response_token_field="next_page_token", - ) - return iterator diff --git a/google/cloud/talent_v4beta1/gapic/job_service_client_config.py b/google/cloud/talent_v4beta1/gapic/job_service_client_config.py deleted file mode 100644 index 27199eaa..00000000 --- a/google/cloud/talent_v4beta1/gapic/job_service_client_config.py +++ /dev/null @@ -1,92 +0,0 @@ -config = { - "interfaces": { - "google.cloud.talent.v4beta1.JobService": { - "retry_codes": { - "no_retry_codes": [], - "no_retry_3_codes": [], - "retry_policy_3_codes": ["DEADLINE_EXCEEDED", "UNAVAILABLE"], - }, - "retry_params": { - "no_retry_3_params": { - "initial_retry_delay_millis": 0, - "retry_delay_multiplier": 0.0, - "max_retry_delay_millis": 0, - "initial_rpc_timeout_millis": 30000, - "rpc_timeout_multiplier": 1.0, - "max_rpc_timeout_millis": 30000, - "total_timeout_millis": 30000, - }, - "retry_policy_3_params": { - "initial_retry_delay_millis": 100, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 60000, - "initial_rpc_timeout_millis": 30000, - "rpc_timeout_multiplier": 1.0, - "max_rpc_timeout_millis": 30000, - "total_timeout_millis": 30000, - }, - "no_retry_params": { - "initial_retry_delay_millis": 0, - "retry_delay_multiplier": 0.0, - "max_retry_delay_millis": 0, - "initial_rpc_timeout_millis": 0, - "rpc_timeout_multiplier": 1.0, - "max_rpc_timeout_millis": 0, - "total_timeout_millis": 0, - }, - }, - "methods": { - "CreateJob": { - "timeout_millis": 30000, - "retry_codes_name": "no_retry_3_codes", - "retry_params_name": "no_retry_3_params", - }, - "BatchCreateJobs": { - "timeout_millis": 30000, - "retry_codes_name": "no_retry_3_codes", - "retry_params_name": "no_retry_3_params", - }, - "GetJob": { - "timeout_millis": 30000, - "retry_codes_name": "retry_policy_3_codes", - "retry_params_name": "retry_policy_3_params", - }, - "UpdateJob": { - "timeout_millis": 30000, - "retry_codes_name": "no_retry_3_codes", - "retry_params_name": "no_retry_3_params", - }, - "BatchUpdateJobs": { - "timeout_millis": 30000, - "retry_codes_name": "no_retry_3_codes", - "retry_params_name": "no_retry_3_params", - }, - "DeleteJob": { - "timeout_millis": 30000, - "retry_codes_name": "retry_policy_3_codes", - "retry_params_name": "retry_policy_3_params", - }, - "BatchDeleteJobs": { - "timeout_millis": 30000, - "retry_codes_name": "no_retry_3_codes", - "retry_params_name": "no_retry_3_params", - }, - "ListJobs": { - "timeout_millis": 30000, - "retry_codes_name": "retry_policy_3_codes", - "retry_params_name": "retry_policy_3_params", - }, - "SearchJobs": { - "timeout_millis": 30000, - "retry_codes_name": "no_retry_3_codes", - "retry_params_name": "no_retry_3_params", - }, - "SearchJobsForAlert": { - "timeout_millis": 30000, - "retry_codes_name": "no_retry_3_codes", - "retry_params_name": "no_retry_3_params", - }, - }, - } - } -} diff --git a/google/cloud/talent_v4beta1/gapic/profile_service_client.py b/google/cloud/talent_v4beta1/gapic/profile_service_client.py deleted file mode 100644 index dab2ca91..00000000 --- a/google/cloud/talent_v4beta1/gapic/profile_service_client.py +++ /dev/null @@ -1,961 +0,0 @@ -# -*- 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 -# -# https://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. - -"""Accesses the google.cloud.talent.v4beta1 ProfileService API.""" - -import functools -import pkg_resources -import warnings - -from google.oauth2 import service_account -import google.api_core.client_options -import google.api_core.gapic_v1.client_info -import google.api_core.gapic_v1.config -import google.api_core.gapic_v1.method -import google.api_core.gapic_v1.routing_header -import google.api_core.grpc_helpers -import google.api_core.page_iterator -import google.api_core.path_template -import grpc - -from google.cloud.talent_v4beta1.gapic import enums -from google.cloud.talent_v4beta1.gapic import profile_service_client_config -from google.cloud.talent_v4beta1.gapic.transports import profile_service_grpc_transport -from google.cloud.talent_v4beta1.proto import application_pb2 -from google.cloud.talent_v4beta1.proto import application_service_pb2 -from google.cloud.talent_v4beta1.proto import application_service_pb2_grpc -from google.cloud.talent_v4beta1.proto import common_pb2 -from google.cloud.talent_v4beta1.proto import company_pb2 -from google.cloud.talent_v4beta1.proto import company_service_pb2 -from google.cloud.talent_v4beta1.proto import company_service_pb2_grpc -from google.cloud.talent_v4beta1.proto import completion_service_pb2 -from google.cloud.talent_v4beta1.proto import completion_service_pb2_grpc -from google.cloud.talent_v4beta1.proto import event_pb2 -from google.cloud.talent_v4beta1.proto import event_service_pb2 -from google.cloud.talent_v4beta1.proto import event_service_pb2_grpc -from google.cloud.talent_v4beta1.proto import filters_pb2 -from google.cloud.talent_v4beta1.proto import histogram_pb2 -from google.cloud.talent_v4beta1.proto import job_pb2 -from google.cloud.talent_v4beta1.proto import job_service_pb2 -from google.cloud.talent_v4beta1.proto import job_service_pb2_grpc -from google.cloud.talent_v4beta1.proto import profile_pb2 -from google.cloud.talent_v4beta1.proto import profile_service_pb2 -from google.cloud.talent_v4beta1.proto import profile_service_pb2_grpc -from google.longrunning import operations_pb2 -from google.protobuf import empty_pb2 -from google.protobuf import field_mask_pb2 - - -_GAPIC_LIBRARY_VERSION = pkg_resources.get_distribution("google-cloud-talent",).version - - -class ProfileServiceClient(object): - """ - A service that handles profile management, including profile CRUD, - enumeration and search. - """ - - SERVICE_ADDRESS = "jobs.googleapis.com:443" - """The default address of the service.""" - - # The name of the interface for this client. This is the key used to - # find the method configuration in the client_config dictionary. - _INTERFACE_NAME = "google.cloud.talent.v4beta1.ProfileService" - - @classmethod - def from_service_account_file(cls, filename, *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: - ProfileServiceClient: The constructed client. - """ - credentials = service_account.Credentials.from_service_account_file(filename) - kwargs["credentials"] = credentials - return cls(*args, **kwargs) - - from_service_account_json = from_service_account_file - - @classmethod - def profile_path(cls, project, tenant, profile): - """Return a fully-qualified profile string.""" - return google.api_core.path_template.expand( - "projects/{project}/tenants/{tenant}/profiles/{profile}", - project=project, - tenant=tenant, - profile=profile, - ) - - @classmethod - def tenant_path(cls, project, tenant): - """Return a fully-qualified tenant string.""" - return google.api_core.path_template.expand( - "projects/{project}/tenants/{tenant}", project=project, tenant=tenant, - ) - - def __init__( - self, - transport=None, - channel=None, - credentials=None, - client_config=None, - client_info=None, - client_options=None, - ): - """Constructor. - - Args: - transport (Union[~.ProfileServiceGrpcTransport, - Callable[[~.Credentials, type], ~.ProfileServiceGrpcTransport]): A transport - instance, responsible for actually making the API calls. - The default transport uses the gRPC protocol. - This argument may also be a callable which returns a - transport instance. Callables will be sent the credentials - as the first argument and the default transport class as - the second argument. - channel (grpc.Channel): DEPRECATED. A ``Channel`` instance - through which to make calls. This argument is mutually exclusive - with ``credentials``; providing both will raise an exception. - credentials (google.auth.credentials.Credentials): The - authorization credentials to attach to requests. These - credentials identify this application to the service. If none - are specified, the client will attempt to ascertain the - credentials from the environment. - This argument is mutually exclusive with providing a - transport instance to ``transport``; doing so will raise - an exception. - client_config (dict): DEPRECATED. A dictionary of call options for - each method. If not specified, the default configuration is used. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - client_options (Union[dict, google.api_core.client_options.ClientOptions]): - Client options used to set user options on the client. API Endpoint - should be set through client_options. - """ - # Raise deprecation warnings for things we want to go away. - if client_config is not None: - warnings.warn( - "The `client_config` argument is deprecated.", - PendingDeprecationWarning, - stacklevel=2, - ) - else: - client_config = profile_service_client_config.config - - if channel: - warnings.warn( - "The `channel` argument is deprecated; use " "`transport` instead.", - PendingDeprecationWarning, - stacklevel=2, - ) - - api_endpoint = self.SERVICE_ADDRESS - if client_options: - if type(client_options) == dict: - client_options = google.api_core.client_options.from_dict( - client_options - ) - if client_options.api_endpoint: - api_endpoint = client_options.api_endpoint - - # Instantiate the transport. - # The transport is responsible for handling serialization and - # deserialization and actually sending data to the service. - if transport: - if callable(transport): - self.transport = transport( - credentials=credentials, - default_class=profile_service_grpc_transport.ProfileServiceGrpcTransport, - address=api_endpoint, - ) - else: - if credentials: - raise ValueError( - "Received both a transport instance and " - "credentials; these are mutually exclusive." - ) - self.transport = transport - else: - self.transport = profile_service_grpc_transport.ProfileServiceGrpcTransport( - address=api_endpoint, channel=channel, credentials=credentials, - ) - - if client_info is None: - client_info = google.api_core.gapic_v1.client_info.ClientInfo( - gapic_version=_GAPIC_LIBRARY_VERSION, - ) - else: - client_info.gapic_version = _GAPIC_LIBRARY_VERSION - self._client_info = client_info - - # Parse out the default settings for retry and timeout for each RPC - # from the client configuration. - # (Ordinarily, these are the defaults specified in the `*_config.py` - # file next to this one.) - self._method_configs = google.api_core.gapic_v1.config.parse_method_configs( - client_config["interfaces"][self._INTERFACE_NAME], - ) - - # Save a dictionary of cached API call functions. - # These are the actual callables which invoke the proper - # transport methods, wrapped with `wrap_method` to add retry, - # timeout, and the like. - self._inner_api_calls = {} - - # Service calls - def search_profiles( - self, - parent, - request_metadata, - profile_query=None, - page_size=None, - offset=None, - disable_spell_check=None, - order_by=None, - case_sensitive_sort=None, - histogram_queries=None, - result_set_id=None, - strict_keywords_search=None, - retry=google.api_core.gapic_v1.method.DEFAULT, - timeout=google.api_core.gapic_v1.method.DEFAULT, - metadata=None, - ): - """ - Searches for profiles within a tenant. - - For example, search by raw queries "software engineer in Mountain View" - or search by structured filters (location filter, education filter, - etc.). - - See ``SearchProfilesRequest`` for more information. - - Example: - >>> from google.cloud import talent_v4beta1 - >>> - >>> client = talent_v4beta1.ProfileServiceClient() - >>> - >>> parent = client.tenant_path('[PROJECT]', '[TENANT]') - >>> - >>> # TODO: Initialize `request_metadata`: - >>> request_metadata = {} - >>> - >>> # Iterate over all results - >>> for element in client.search_profiles(parent, request_metadata): - ... # process element - ... pass - >>> - >>> - >>> # Alternatively: - >>> - >>> # Iterate over results one page at a time - >>> for page in client.search_profiles(parent, request_metadata).pages: - ... for element in page: - ... # process element - ... pass - - Args: - parent (str): Required. The resource name of the tenant to search within. - - The format is "projects/{project_id}/tenants/{tenant_id}". For example, - "projects/foo/tenants/bar". - request_metadata (Union[dict, ~google.cloud.talent_v4beta1.types.RequestMetadata]): Required. The meta information collected about the profile search user. This is used - to improve the search quality of the service. These values are provided by - users, and must be precise and consistent. - - If a dict is provided, it must be of the same form as the protobuf - message :class:`~google.cloud.talent_v4beta1.types.RequestMetadata` - profile_query (Union[dict, ~google.cloud.talent_v4beta1.types.ProfileQuery]): Search query to execute. See ``ProfileQuery`` for more details. - - If a dict is provided, it must be of the same form as the protobuf - message :class:`~google.cloud.talent_v4beta1.types.ProfileQuery` - page_size (int): The maximum number of resources contained in the - underlying API response. If page streaming is performed per- - resource, this parameter does not affect the return value. If page - streaming is performed per-page, this determines the maximum number - of resources in a page. - offset (int): An integer that specifies the current offset (that is, starting - result) in search results. This field is only considered if - ``page_token`` is unset. - - The maximum allowed value is 5000. Otherwise an error is thrown. - - For example, 0 means to search from the first profile, and 10 means to - search from the 11th profile. This can be used for pagination, for - example pageSize = 10 and offset = 10 means to search from the second - page. - disable_spell_check (bool): This flag controls the spell-check feature. If ``false``, the - service attempts to correct a misspelled query. - - For example, "enginee" is corrected to "engineer". - order_by (str): The criteria that determines how search results are sorted. Defaults - is "relevance desc" if no value is specified. - - Supported options are: - - - "relevance desc": By descending relevance, as determined by the API - algorithms. - - "update_date desc": Sort by ``Profile.update_time`` in descending - order (recently updated profiles first). - - "create_date desc": Sort by ``Profile.create_time`` in descending - order (recently created profiles first). - - "first_name": Sort by ``PersonName.PersonStructuredName.given_name`` - in ascending order. - - "first_name desc": Sort by - ``PersonName.PersonStructuredName.given_name`` in descending order. - - "last_name": Sort by ``PersonName.PersonStructuredName.family_name`` - in ascending order. - - "last_name desc": Sort by - ``PersonName.PersonStructuredName.family_name`` in ascending order. - case_sensitive_sort (bool): When sort by field is based on alphabetical order, sort values case - sensitively (based on ASCII) when the value is set to true. Default value - is case in-sensitive sort (false). - histogram_queries (list[Union[dict, ~google.cloud.talent_v4beta1.types.HistogramQuery]]): A list of expressions specifies histogram requests against matching - profiles for ``SearchProfilesRequest``. - - The expression syntax looks like a function definition with parameters. - - Function syntax: function_name(histogram_facet[, list of buckets]) - - Data types: - - - Histogram facet: facet names with format [a-zA-Z][a-zA-Z0-9\_]+. - - String: string like "any string with backslash escape for quote(")." - - Number: whole number and floating point number like 10, -1 and -0.01. - - List: list of elements with comma(,) separator surrounded by square - brackets. For example, [1, 2, 3] and ["one", "two", "three"]. - - Built-in constants: - - - MIN (minimum number similar to java Double.MIN_VALUE) - - MAX (maximum number similar to java Double.MAX_VALUE) - - Built-in functions: - - - bucket(start, end[, label]) Bucket build-in function creates a bucket - with range of \`start, end). Note that the end is exclusive. For - example, bucket(1, MAX, "positive number") or bucket(1, 10). - - Histogram Facets: - - - admin1: Admin1 is a global placeholder for referring to state, - province, or the particular term a country uses to define the - geographic structure below the country level. Examples include states - codes such as "CA", "IL", "NY", and provinces, such as "BC". - - locality: Locality is a global placeholder for referring to city, - town, or the particular term a country uses to define the geographic - structure below the admin1 level. Examples include city names such as - "Mountain View" and "New York". - - extended_locality: Extended locality is concatenated version of - admin1 and locality with comma separator. For example, "Mountain - View, CA" and "New York, NY". - - postal_code: Postal code of profile which follows locale code. - - country: Country code (ISO-3166-1 alpha-2 code) of profile, such as - US, JP, GB. - - job_title: Normalized job titles specified in EmploymentHistory. - - company_name: Normalized company name of profiles to match on. - - institution: The school name. For example, "MIT", "University of - California, Berkeley" - - degree: Highest education degree in ISCED code. Each value in degree - covers a specific level of education, without any expansion to upper - nor lower levels of education degree. - - experience_in_months: experience in months. 0 means 0 month to 1 - month (exclusive). - - application_date: The application date specifies application start - dates. See [ApplicationDateFilter\` for more details. - - application_outcome_notes: The application outcome reason specifies - the reasons behind the outcome of the job application. See - ``ApplicationOutcomeNotesFilter`` for more details. - - application_job_title: The application job title specifies the job - applied for in the application. See ``ApplicationJobFilter`` for more - details. - - hirable_status: Hirable status specifies the profile's hirable - status. - - string_custom_attribute: String custom attributes. Values can be - accessed via square bracket notation like - string_custom_attribute["key1"]. - - numeric_custom_attribute: Numeric custom attributes. Values can be - accessed via square bracket notation like - numeric_custom_attribute["key1"]. - - Example expressions: - - - count(admin1) - - count(experience_in_months, [bucket(0, 12, "1 year"), bucket(12, 36, - "1-3 years"), bucket(36, MAX, "3+ years")]) - - count(string_custom_attribute["assigned_recruiter"]) - - count(numeric_custom_attribute["favorite_number"], [bucket(MIN, 0, - "negative"), bucket(0, MAX, "non-negative")]) - - If a dict is provided, it must be of the same form as the protobuf - message :class:`~google.cloud.talent_v4beta1.types.HistogramQuery` - result_set_id (str): An id that uniquely identifies the result set of a - ``SearchProfiles`` call. The id should be retrieved from the - ``SearchProfilesResponse`` message returned from a previous invocation - of ``SearchProfiles``. - - A result set is an ordered list of search results. - - If this field is not set, a new result set is computed based on the - ``profile_query``. A new ``result_set_id`` is returned as a handle to - access this result set. - - If this field is set, the service will ignore the resource and - ``profile_query`` values, and simply retrieve a page of results from the - corresponding result set. In this case, one and only one of - ``page_token`` or ``offset`` must be set. - - A typical use case is to invoke ``SearchProfilesRequest`` without this - field, then use the resulting ``result_set_id`` in - ``SearchProfilesResponse`` to page through the results. - strict_keywords_search (bool): This flag is used to indicate whether the service will attempt to - understand synonyms and terms related to the search query or treat the - query "as is" when it generates a set of results. By default this flag is - set to false, thus allowing expanded results to also be returned. For - example a search for "software engineer" might also return candidates who - have experience in jobs similar to software engineer positions. By setting - this flag to true, the service will only attempt to deliver candidates has - software engineer in his/her global fields by treating "software engineer" - as a keyword. - - It is recommended to provide a feature in the UI (such as a checkbox) to - allow recruiters to set this flag to true if they intend to search for - longer boolean strings. - retry (Optional[google.api_core.retry.Retry]): A retry object used - to retry requests. If ``None`` is specified, requests will - be retried using a default configuration. - timeout (Optional[float]): The amount of time, in seconds, to wait - for the request to complete. Note that if ``retry`` is - specified, the timeout applies to each individual attempt. - metadata (Optional[Sequence[Tuple[str, str]]]): Additional metadata - that is provided to the method. - - Returns: - A :class:`~google.api_core.page_iterator.PageIterator` instance. - An iterable of :class:`~google.cloud.talent_v4beta1.types.SummarizedProfile` instances. - You can also iterate over the pages of the response - using its `pages` property. - - Raises: - google.api_core.exceptions.GoogleAPICallError: If the request - failed for any reason. - google.api_core.exceptions.RetryError: If the request failed due - to a retryable error and retry attempts failed. - ValueError: If the parameters are invalid. - """ - # Wrap the transport method to add retry and timeout logic. - if "search_profiles" not in self._inner_api_calls: - self._inner_api_calls[ - "search_profiles" - ] = google.api_core.gapic_v1.method.wrap_method( - self.transport.search_profiles, - default_retry=self._method_configs["SearchProfiles"].retry, - default_timeout=self._method_configs["SearchProfiles"].timeout, - client_info=self._client_info, - ) - - request = profile_service_pb2.SearchProfilesRequest( - parent=parent, - request_metadata=request_metadata, - profile_query=profile_query, - page_size=page_size, - offset=offset, - disable_spell_check=disable_spell_check, - order_by=order_by, - case_sensitive_sort=case_sensitive_sort, - histogram_queries=histogram_queries, - result_set_id=result_set_id, - strict_keywords_search=strict_keywords_search, - ) - if metadata is None: - metadata = [] - metadata = list(metadata) - try: - routing_header = [("parent", parent)] - except AttributeError: - pass - else: - routing_metadata = google.api_core.gapic_v1.routing_header.to_grpc_metadata( - routing_header - ) - metadata.append(routing_metadata) - - iterator = google.api_core.page_iterator.GRPCIterator( - client=None, - method=functools.partial( - self._inner_api_calls["search_profiles"], - retry=retry, - timeout=timeout, - metadata=metadata, - ), - request=request, - items_field="summarized_profiles", - request_token_field="page_token", - response_token_field="next_page_token", - ) - return iterator - - def list_profiles( - self, - parent, - filter_=None, - page_size=None, - read_mask=None, - retry=google.api_core.gapic_v1.method.DEFAULT, - timeout=google.api_core.gapic_v1.method.DEFAULT, - metadata=None, - ): - """ - Lists profiles by filter. The order is unspecified. - - Example: - >>> from google.cloud import talent_v4beta1 - >>> - >>> client = talent_v4beta1.ProfileServiceClient() - >>> - >>> parent = client.tenant_path('[PROJECT]', '[TENANT]') - >>> - >>> # Iterate over all results - >>> for element in client.list_profiles(parent): - ... # process element - ... pass - >>> - >>> - >>> # Alternatively: - >>> - >>> # Iterate over results one page at a time - >>> for page in client.list_profiles(parent).pages: - ... for element in page: - ... # process element - ... pass - - Args: - parent (str): Required. The resource name of the tenant under which the profile is - created. - - The format is "projects/{project_id}/tenants/{tenant_id}". For example, - "projects/foo/tenants/bar". - filter_ (str): The filter string specifies the profiles to be enumerated. - - Supported operator: =, AND - - The field(s) eligible for filtering are: - - - ``externalId`` - - ``groupId`` - - externalId and groupId cannot be specified at the same time. If both - externalId and groupId are provided, the API will return a bad request - error. - - Sample Query: - - - externalId = "externalId-1" - - groupId = "groupId-1" - page_size (int): The maximum number of resources contained in the - underlying API response. If page streaming is performed per- - resource, this parameter does not affect the return value. If page - streaming is performed per-page, this determines the maximum number - of resources in a page. - read_mask (Union[dict, ~google.cloud.talent_v4beta1.types.FieldMask]): A field mask to specify the profile fields to be listed in response. - All fields are listed if it is unset. - - Valid values are: - - - name - - If a dict is provided, it must be of the same form as the protobuf - message :class:`~google.cloud.talent_v4beta1.types.FieldMask` - retry (Optional[google.api_core.retry.Retry]): A retry object used - to retry requests. If ``None`` is specified, requests will - be retried using a default configuration. - timeout (Optional[float]): The amount of time, in seconds, to wait - for the request to complete. Note that if ``retry`` is - specified, the timeout applies to each individual attempt. - metadata (Optional[Sequence[Tuple[str, str]]]): Additional metadata - that is provided to the method. - - Returns: - A :class:`~google.api_core.page_iterator.PageIterator` instance. - An iterable of :class:`~google.cloud.talent_v4beta1.types.Profile` instances. - You can also iterate over the pages of the response - using its `pages` property. - - Raises: - google.api_core.exceptions.GoogleAPICallError: If the request - failed for any reason. - google.api_core.exceptions.RetryError: If the request failed due - to a retryable error and retry attempts failed. - ValueError: If the parameters are invalid. - """ - # Wrap the transport method to add retry and timeout logic. - if "list_profiles" not in self._inner_api_calls: - self._inner_api_calls[ - "list_profiles" - ] = google.api_core.gapic_v1.method.wrap_method( - self.transport.list_profiles, - default_retry=self._method_configs["ListProfiles"].retry, - default_timeout=self._method_configs["ListProfiles"].timeout, - client_info=self._client_info, - ) - - request = profile_service_pb2.ListProfilesRequest( - parent=parent, filter=filter_, page_size=page_size, read_mask=read_mask, - ) - if metadata is None: - metadata = [] - metadata = list(metadata) - try: - routing_header = [("parent", parent)] - except AttributeError: - pass - else: - routing_metadata = google.api_core.gapic_v1.routing_header.to_grpc_metadata( - routing_header - ) - metadata.append(routing_metadata) - - iterator = google.api_core.page_iterator.GRPCIterator( - client=None, - method=functools.partial( - self._inner_api_calls["list_profiles"], - retry=retry, - timeout=timeout, - metadata=metadata, - ), - request=request, - items_field="profiles", - request_token_field="page_token", - response_token_field="next_page_token", - ) - return iterator - - def create_profile( - self, - parent, - profile, - retry=google.api_core.gapic_v1.method.DEFAULT, - timeout=google.api_core.gapic_v1.method.DEFAULT, - metadata=None, - ): - """ - Creates and returns a new profile. - - Example: - >>> from google.cloud import talent_v4beta1 - >>> - >>> client = talent_v4beta1.ProfileServiceClient() - >>> - >>> parent = client.tenant_path('[PROJECT]', '[TENANT]') - >>> - >>> # TODO: Initialize `profile`: - >>> profile = {} - >>> - >>> response = client.create_profile(parent, profile) - - Args: - parent (str): Required. The name of the tenant this profile belongs to. - - The format is "projects/{project_id}/tenants/{tenant_id}". For example, - "projects/foo/tenants/bar". - profile (Union[dict, ~google.cloud.talent_v4beta1.types.Profile]): Required. The profile to be created. - - If a dict is provided, it must be of the same form as the protobuf - message :class:`~google.cloud.talent_v4beta1.types.Profile` - retry (Optional[google.api_core.retry.Retry]): A retry object used - to retry requests. If ``None`` is specified, requests will - be retried using a default configuration. - timeout (Optional[float]): The amount of time, in seconds, to wait - for the request to complete. Note that if ``retry`` is - specified, the timeout applies to each individual attempt. - metadata (Optional[Sequence[Tuple[str, str]]]): Additional metadata - that is provided to the method. - - Returns: - A :class:`~google.cloud.talent_v4beta1.types.Profile` instance. - - Raises: - google.api_core.exceptions.GoogleAPICallError: If the request - failed for any reason. - google.api_core.exceptions.RetryError: If the request failed due - to a retryable error and retry attempts failed. - ValueError: If the parameters are invalid. - """ - # Wrap the transport method to add retry and timeout logic. - if "create_profile" not in self._inner_api_calls: - self._inner_api_calls[ - "create_profile" - ] = google.api_core.gapic_v1.method.wrap_method( - self.transport.create_profile, - default_retry=self._method_configs["CreateProfile"].retry, - default_timeout=self._method_configs["CreateProfile"].timeout, - client_info=self._client_info, - ) - - request = profile_service_pb2.CreateProfileRequest( - parent=parent, profile=profile, - ) - if metadata is None: - metadata = [] - metadata = list(metadata) - try: - routing_header = [("parent", parent)] - except AttributeError: - pass - else: - routing_metadata = google.api_core.gapic_v1.routing_header.to_grpc_metadata( - routing_header - ) - metadata.append(routing_metadata) - - return self._inner_api_calls["create_profile"]( - request, retry=retry, timeout=timeout, metadata=metadata - ) - - def get_profile( - self, - name, - retry=google.api_core.gapic_v1.method.DEFAULT, - timeout=google.api_core.gapic_v1.method.DEFAULT, - metadata=None, - ): - """ - Gets the specified profile. - - Example: - >>> from google.cloud import talent_v4beta1 - >>> - >>> client = talent_v4beta1.ProfileServiceClient() - >>> - >>> name = client.profile_path('[PROJECT]', '[TENANT]', '[PROFILE]') - >>> - >>> response = client.get_profile(name) - - Args: - name (str): Required. Resource name of the profile to get. - - The format is - "projects/{project_id}/tenants/{tenant_id}/profiles/{profile_id}". For - example, "projects/foo/tenants/bar/profiles/baz". - retry (Optional[google.api_core.retry.Retry]): A retry object used - to retry requests. If ``None`` is specified, requests will - be retried using a default configuration. - timeout (Optional[float]): The amount of time, in seconds, to wait - for the request to complete. Note that if ``retry`` is - specified, the timeout applies to each individual attempt. - metadata (Optional[Sequence[Tuple[str, str]]]): Additional metadata - that is provided to the method. - - Returns: - A :class:`~google.cloud.talent_v4beta1.types.Profile` instance. - - Raises: - google.api_core.exceptions.GoogleAPICallError: If the request - failed for any reason. - google.api_core.exceptions.RetryError: If the request failed due - to a retryable error and retry attempts failed. - ValueError: If the parameters are invalid. - """ - # Wrap the transport method to add retry and timeout logic. - if "get_profile" not in self._inner_api_calls: - self._inner_api_calls[ - "get_profile" - ] = google.api_core.gapic_v1.method.wrap_method( - self.transport.get_profile, - default_retry=self._method_configs["GetProfile"].retry, - default_timeout=self._method_configs["GetProfile"].timeout, - client_info=self._client_info, - ) - - request = profile_service_pb2.GetProfileRequest(name=name,) - if metadata is None: - metadata = [] - metadata = list(metadata) - try: - routing_header = [("name", name)] - except AttributeError: - pass - else: - routing_metadata = google.api_core.gapic_v1.routing_header.to_grpc_metadata( - routing_header - ) - metadata.append(routing_metadata) - - return self._inner_api_calls["get_profile"]( - request, retry=retry, timeout=timeout, metadata=metadata - ) - - def update_profile( - self, - profile, - update_mask=None, - retry=google.api_core.gapic_v1.method.DEFAULT, - timeout=google.api_core.gapic_v1.method.DEFAULT, - metadata=None, - ): - """ - Updates the specified profile and returns the updated result. - - Example: - >>> from google.cloud import talent_v4beta1 - >>> - >>> client = talent_v4beta1.ProfileServiceClient() - >>> - >>> # TODO: Initialize `profile`: - >>> profile = {} - >>> - >>> response = client.update_profile(profile) - - Args: - profile (Union[dict, ~google.cloud.talent_v4beta1.types.Profile]): Required. Profile to be updated. - - If a dict is provided, it must be of the same form as the protobuf - message :class:`~google.cloud.talent_v4beta1.types.Profile` - update_mask (Union[dict, ~google.cloud.talent_v4beta1.types.FieldMask]): A field mask to specify the profile fields to update. - - A full update is performed if it is unset. - - If a dict is provided, it must be of the same form as the protobuf - message :class:`~google.cloud.talent_v4beta1.types.FieldMask` - retry (Optional[google.api_core.retry.Retry]): A retry object used - to retry requests. If ``None`` is specified, requests will - be retried using a default configuration. - timeout (Optional[float]): The amount of time, in seconds, to wait - for the request to complete. Note that if ``retry`` is - specified, the timeout applies to each individual attempt. - metadata (Optional[Sequence[Tuple[str, str]]]): Additional metadata - that is provided to the method. - - Returns: - A :class:`~google.cloud.talent_v4beta1.types.Profile` instance. - - Raises: - google.api_core.exceptions.GoogleAPICallError: If the request - failed for any reason. - google.api_core.exceptions.RetryError: If the request failed due - to a retryable error and retry attempts failed. - ValueError: If the parameters are invalid. - """ - # Wrap the transport method to add retry and timeout logic. - if "update_profile" not in self._inner_api_calls: - self._inner_api_calls[ - "update_profile" - ] = google.api_core.gapic_v1.method.wrap_method( - self.transport.update_profile, - default_retry=self._method_configs["UpdateProfile"].retry, - default_timeout=self._method_configs["UpdateProfile"].timeout, - client_info=self._client_info, - ) - - request = profile_service_pb2.UpdateProfileRequest( - profile=profile, update_mask=update_mask, - ) - if metadata is None: - metadata = [] - metadata = list(metadata) - try: - routing_header = [("profile.name", profile.name)] - except AttributeError: - pass - else: - routing_metadata = google.api_core.gapic_v1.routing_header.to_grpc_metadata( - routing_header - ) - metadata.append(routing_metadata) - - return self._inner_api_calls["update_profile"]( - request, retry=retry, timeout=timeout, metadata=metadata - ) - - def delete_profile( - self, - name, - retry=google.api_core.gapic_v1.method.DEFAULT, - timeout=google.api_core.gapic_v1.method.DEFAULT, - metadata=None, - ): - """ - Deletes the specified profile. - Prerequisite: The profile has no associated applications or assignments - associated. - - Example: - >>> from google.cloud import talent_v4beta1 - >>> - >>> client = talent_v4beta1.ProfileServiceClient() - >>> - >>> name = client.profile_path('[PROJECT]', '[TENANT]', '[PROFILE]') - >>> - >>> client.delete_profile(name) - - Args: - name (str): Required. Resource name of the profile to be deleted. - - The format is - "projects/{project_id}/tenants/{tenant_id}/profiles/{profile_id}". For - example, "projects/foo/tenants/bar/profiles/baz". - retry (Optional[google.api_core.retry.Retry]): A retry object used - to retry requests. If ``None`` is specified, requests will - be retried using a default configuration. - timeout (Optional[float]): The amount of time, in seconds, to wait - for the request to complete. Note that if ``retry`` is - specified, the timeout applies to each individual attempt. - metadata (Optional[Sequence[Tuple[str, str]]]): Additional metadata - that is provided to the method. - - Raises: - google.api_core.exceptions.GoogleAPICallError: If the request - failed for any reason. - google.api_core.exceptions.RetryError: If the request failed due - to a retryable error and retry attempts failed. - ValueError: If the parameters are invalid. - """ - # Wrap the transport method to add retry and timeout logic. - if "delete_profile" not in self._inner_api_calls: - self._inner_api_calls[ - "delete_profile" - ] = google.api_core.gapic_v1.method.wrap_method( - self.transport.delete_profile, - default_retry=self._method_configs["DeleteProfile"].retry, - default_timeout=self._method_configs["DeleteProfile"].timeout, - client_info=self._client_info, - ) - - request = profile_service_pb2.DeleteProfileRequest(name=name,) - if metadata is None: - metadata = [] - metadata = list(metadata) - try: - routing_header = [("name", name)] - except AttributeError: - pass - else: - routing_metadata = google.api_core.gapic_v1.routing_header.to_grpc_metadata( - routing_header - ) - metadata.append(routing_metadata) - - self._inner_api_calls["delete_profile"]( - request, retry=retry, timeout=timeout, metadata=metadata - ) diff --git a/google/cloud/talent_v4beta1/gapic/profile_service_client_config.py b/google/cloud/talent_v4beta1/gapic/profile_service_client_config.py deleted file mode 100644 index 67cbd7c1..00000000 --- a/google/cloud/talent_v4beta1/gapic/profile_service_client_config.py +++ /dev/null @@ -1,72 +0,0 @@ -config = { - "interfaces": { - "google.cloud.talent.v4beta1.ProfileService": { - "retry_codes": { - "retry_policy_4_codes": ["DEADLINE_EXCEEDED", "UNAVAILABLE"], - "no_retry_2_codes": [], - "no_retry_codes": [], - }, - "retry_params": { - "retry_policy_4_params": { - "initial_retry_delay_millis": 100, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 60000, - "initial_rpc_timeout_millis": 30000, - "rpc_timeout_multiplier": 1.0, - "max_rpc_timeout_millis": 30000, - "total_timeout_millis": 30000, - }, - "no_retry_params": { - "initial_retry_delay_millis": 0, - "retry_delay_multiplier": 0.0, - "max_retry_delay_millis": 0, - "initial_rpc_timeout_millis": 0, - "rpc_timeout_multiplier": 1.0, - "max_rpc_timeout_millis": 0, - "total_timeout_millis": 0, - }, - "no_retry_2_params": { - "initial_retry_delay_millis": 0, - "retry_delay_multiplier": 0.0, - "max_retry_delay_millis": 0, - "initial_rpc_timeout_millis": 30000, - "rpc_timeout_multiplier": 1.0, - "max_rpc_timeout_millis": 30000, - "total_timeout_millis": 30000, - }, - }, - "methods": { - "SearchProfiles": { - "timeout_millis": 30000, - "retry_codes_name": "no_retry_2_codes", - "retry_params_name": "no_retry_2_params", - }, - "ListProfiles": { - "timeout_millis": 30000, - "retry_codes_name": "retry_policy_4_codes", - "retry_params_name": "retry_policy_4_params", - }, - "CreateProfile": { - "timeout_millis": 30000, - "retry_codes_name": "no_retry_2_codes", - "retry_params_name": "no_retry_2_params", - }, - "GetProfile": { - "timeout_millis": 30000, - "retry_codes_name": "retry_policy_4_codes", - "retry_params_name": "retry_policy_4_params", - }, - "UpdateProfile": { - "timeout_millis": 30000, - "retry_codes_name": "no_retry_2_codes", - "retry_params_name": "no_retry_2_params", - }, - "DeleteProfile": { - "timeout_millis": 30000, - "retry_codes_name": "retry_policy_4_codes", - "retry_params_name": "retry_policy_4_params", - }, - }, - } - } -} diff --git a/google/cloud/talent_v4beta1/gapic/tenant_service_client.py b/google/cloud/talent_v4beta1/gapic/tenant_service_client.py deleted file mode 100644 index 57bf8378..00000000 --- a/google/cloud/talent_v4beta1/gapic/tenant_service_client.py +++ /dev/null @@ -1,636 +0,0 @@ -# -*- 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 -# -# https://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. - -"""Accesses the google.cloud.talent.v4beta1 TenantService API.""" - -import functools -import pkg_resources -import warnings - -from google.oauth2 import service_account -import google.api_core.client_options -import google.api_core.gapic_v1.client_info -import google.api_core.gapic_v1.config -import google.api_core.gapic_v1.method -import google.api_core.gapic_v1.routing_header -import google.api_core.grpc_helpers -import google.api_core.page_iterator -import google.api_core.path_template -import grpc - -from google.cloud.talent_v4beta1.gapic import enums -from google.cloud.talent_v4beta1.gapic import tenant_service_client_config -from google.cloud.talent_v4beta1.gapic.transports import tenant_service_grpc_transport -from google.cloud.talent_v4beta1.proto import application_pb2 -from google.cloud.talent_v4beta1.proto import application_service_pb2 -from google.cloud.talent_v4beta1.proto import application_service_pb2_grpc -from google.cloud.talent_v4beta1.proto import common_pb2 -from google.cloud.talent_v4beta1.proto import company_pb2 -from google.cloud.talent_v4beta1.proto import company_service_pb2 -from google.cloud.talent_v4beta1.proto import company_service_pb2_grpc -from google.cloud.talent_v4beta1.proto import completion_service_pb2 -from google.cloud.talent_v4beta1.proto import completion_service_pb2_grpc -from google.cloud.talent_v4beta1.proto import event_pb2 -from google.cloud.talent_v4beta1.proto import event_service_pb2 -from google.cloud.talent_v4beta1.proto import event_service_pb2_grpc -from google.cloud.talent_v4beta1.proto import filters_pb2 -from google.cloud.talent_v4beta1.proto import histogram_pb2 -from google.cloud.talent_v4beta1.proto import job_pb2 -from google.cloud.talent_v4beta1.proto import job_service_pb2 -from google.cloud.talent_v4beta1.proto import job_service_pb2_grpc -from google.cloud.talent_v4beta1.proto import profile_pb2 -from google.cloud.talent_v4beta1.proto import profile_service_pb2 -from google.cloud.talent_v4beta1.proto import profile_service_pb2_grpc -from google.cloud.talent_v4beta1.proto import tenant_pb2 -from google.cloud.talent_v4beta1.proto import tenant_service_pb2 -from google.cloud.talent_v4beta1.proto import tenant_service_pb2_grpc -from google.longrunning import operations_pb2 -from google.protobuf import empty_pb2 -from google.protobuf import field_mask_pb2 - - -_GAPIC_LIBRARY_VERSION = pkg_resources.get_distribution("google-cloud-talent",).version - - -class TenantServiceClient(object): - """A service that handles tenant management, including CRUD and enumeration.""" - - SERVICE_ADDRESS = "jobs.googleapis.com:443" - """The default address of the service.""" - - # The name of the interface for this client. This is the key used to - # find the method configuration in the client_config dictionary. - _INTERFACE_NAME = "google.cloud.talent.v4beta1.TenantService" - - @classmethod - def from_service_account_file(cls, filename, *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: - TenantServiceClient: The constructed client. - """ - credentials = service_account.Credentials.from_service_account_file(filename) - kwargs["credentials"] = credentials - return cls(*args, **kwargs) - - from_service_account_json = from_service_account_file - - @classmethod - def project_path(cls, project): - """Return a fully-qualified project string.""" - return google.api_core.path_template.expand( - "projects/{project}", project=project, - ) - - @classmethod - def tenant_path(cls, project, tenant): - """Return a fully-qualified tenant string.""" - return google.api_core.path_template.expand( - "projects/{project}/tenants/{tenant}", project=project, tenant=tenant, - ) - - def __init__( - self, - transport=None, - channel=None, - credentials=None, - client_config=None, - client_info=None, - client_options=None, - ): - """Constructor. - - Args: - transport (Union[~.TenantServiceGrpcTransport, - Callable[[~.Credentials, type], ~.TenantServiceGrpcTransport]): A transport - instance, responsible for actually making the API calls. - The default transport uses the gRPC protocol. - This argument may also be a callable which returns a - transport instance. Callables will be sent the credentials - as the first argument and the default transport class as - the second argument. - channel (grpc.Channel): DEPRECATED. A ``Channel`` instance - through which to make calls. This argument is mutually exclusive - with ``credentials``; providing both will raise an exception. - credentials (google.auth.credentials.Credentials): The - authorization credentials to attach to requests. These - credentials identify this application to the service. If none - are specified, the client will attempt to ascertain the - credentials from the environment. - This argument is mutually exclusive with providing a - transport instance to ``transport``; doing so will raise - an exception. - client_config (dict): DEPRECATED. A dictionary of call options for - each method. If not specified, the default configuration is used. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - client_options (Union[dict, google.api_core.client_options.ClientOptions]): - Client options used to set user options on the client. API Endpoint - should be set through client_options. - """ - # Raise deprecation warnings for things we want to go away. - if client_config is not None: - warnings.warn( - "The `client_config` argument is deprecated.", - PendingDeprecationWarning, - stacklevel=2, - ) - else: - client_config = tenant_service_client_config.config - - if channel: - warnings.warn( - "The `channel` argument is deprecated; use " "`transport` instead.", - PendingDeprecationWarning, - stacklevel=2, - ) - - api_endpoint = self.SERVICE_ADDRESS - if client_options: - if type(client_options) == dict: - client_options = google.api_core.client_options.from_dict( - client_options - ) - if client_options.api_endpoint: - api_endpoint = client_options.api_endpoint - - # Instantiate the transport. - # The transport is responsible for handling serialization and - # deserialization and actually sending data to the service. - if transport: - if callable(transport): - self.transport = transport( - credentials=credentials, - default_class=tenant_service_grpc_transport.TenantServiceGrpcTransport, - address=api_endpoint, - ) - else: - if credentials: - raise ValueError( - "Received both a transport instance and " - "credentials; these are mutually exclusive." - ) - self.transport = transport - else: - self.transport = tenant_service_grpc_transport.TenantServiceGrpcTransport( - address=api_endpoint, channel=channel, credentials=credentials, - ) - - if client_info is None: - client_info = google.api_core.gapic_v1.client_info.ClientInfo( - gapic_version=_GAPIC_LIBRARY_VERSION, - ) - else: - client_info.gapic_version = _GAPIC_LIBRARY_VERSION - self._client_info = client_info - - # Parse out the default settings for retry and timeout for each RPC - # from the client configuration. - # (Ordinarily, these are the defaults specified in the `*_config.py` - # file next to this one.) - self._method_configs = google.api_core.gapic_v1.config.parse_method_configs( - client_config["interfaces"][self._INTERFACE_NAME], - ) - - # Save a dictionary of cached API call functions. - # These are the actual callables which invoke the proper - # transport methods, wrapped with `wrap_method` to add retry, - # timeout, and the like. - self._inner_api_calls = {} - - # Service calls - def create_tenant( - self, - parent, - tenant, - retry=google.api_core.gapic_v1.method.DEFAULT, - timeout=google.api_core.gapic_v1.method.DEFAULT, - metadata=None, - ): - """ - Creates a new tenant entity. - - Example: - >>> from google.cloud import talent_v4beta1 - >>> - >>> client = talent_v4beta1.TenantServiceClient() - >>> - >>> parent = client.project_path('[PROJECT]') - >>> - >>> # TODO: Initialize `tenant`: - >>> tenant = {} - >>> - >>> response = client.create_tenant(parent, tenant) - - Args: - parent (str): Required. Resource name of the project under which the tenant is - created. - - The format is "projects/{project_id}", for example, "projects/foo". - tenant (Union[dict, ~google.cloud.talent_v4beta1.types.Tenant]): Required. The tenant to be created. - - If a dict is provided, it must be of the same form as the protobuf - message :class:`~google.cloud.talent_v4beta1.types.Tenant` - retry (Optional[google.api_core.retry.Retry]): A retry object used - to retry requests. If ``None`` is specified, requests will - be retried using a default configuration. - timeout (Optional[float]): The amount of time, in seconds, to wait - for the request to complete. Note that if ``retry`` is - specified, the timeout applies to each individual attempt. - metadata (Optional[Sequence[Tuple[str, str]]]): Additional metadata - that is provided to the method. - - Returns: - A :class:`~google.cloud.talent_v4beta1.types.Tenant` instance. - - Raises: - google.api_core.exceptions.GoogleAPICallError: If the request - failed for any reason. - google.api_core.exceptions.RetryError: If the request failed due - to a retryable error and retry attempts failed. - ValueError: If the parameters are invalid. - """ - # Wrap the transport method to add retry and timeout logic. - if "create_tenant" not in self._inner_api_calls: - self._inner_api_calls[ - "create_tenant" - ] = google.api_core.gapic_v1.method.wrap_method( - self.transport.create_tenant, - default_retry=self._method_configs["CreateTenant"].retry, - default_timeout=self._method_configs["CreateTenant"].timeout, - client_info=self._client_info, - ) - - request = tenant_service_pb2.CreateTenantRequest(parent=parent, tenant=tenant,) - if metadata is None: - metadata = [] - metadata = list(metadata) - try: - routing_header = [("parent", parent)] - except AttributeError: - pass - else: - routing_metadata = google.api_core.gapic_v1.routing_header.to_grpc_metadata( - routing_header - ) - metadata.append(routing_metadata) - - return self._inner_api_calls["create_tenant"]( - request, retry=retry, timeout=timeout, metadata=metadata - ) - - def get_tenant( - self, - name, - retry=google.api_core.gapic_v1.method.DEFAULT, - timeout=google.api_core.gapic_v1.method.DEFAULT, - metadata=None, - ): - """ - Retrieves specified tenant. - - Example: - >>> from google.cloud import talent_v4beta1 - >>> - >>> client = talent_v4beta1.TenantServiceClient() - >>> - >>> name = client.tenant_path('[PROJECT]', '[TENANT]') - >>> - >>> response = client.get_tenant(name) - - Args: - name (str): Required. The resource name of the tenant to be retrieved. - - The format is "projects/{project_id}/tenants/{tenant_id}", for example, - "projects/foo/tenants/bar". - retry (Optional[google.api_core.retry.Retry]): A retry object used - to retry requests. If ``None`` is specified, requests will - be retried using a default configuration. - timeout (Optional[float]): The amount of time, in seconds, to wait - for the request to complete. Note that if ``retry`` is - specified, the timeout applies to each individual attempt. - metadata (Optional[Sequence[Tuple[str, str]]]): Additional metadata - that is provided to the method. - - Returns: - A :class:`~google.cloud.talent_v4beta1.types.Tenant` instance. - - Raises: - google.api_core.exceptions.GoogleAPICallError: If the request - failed for any reason. - google.api_core.exceptions.RetryError: If the request failed due - to a retryable error and retry attempts failed. - ValueError: If the parameters are invalid. - """ - # Wrap the transport method to add retry and timeout logic. - if "get_tenant" not in self._inner_api_calls: - self._inner_api_calls[ - "get_tenant" - ] = google.api_core.gapic_v1.method.wrap_method( - self.transport.get_tenant, - default_retry=self._method_configs["GetTenant"].retry, - default_timeout=self._method_configs["GetTenant"].timeout, - client_info=self._client_info, - ) - - request = tenant_service_pb2.GetTenantRequest(name=name,) - if metadata is None: - metadata = [] - metadata = list(metadata) - try: - routing_header = [("name", name)] - except AttributeError: - pass - else: - routing_metadata = google.api_core.gapic_v1.routing_header.to_grpc_metadata( - routing_header - ) - metadata.append(routing_metadata) - - return self._inner_api_calls["get_tenant"]( - request, retry=retry, timeout=timeout, metadata=metadata - ) - - def update_tenant( - self, - tenant, - update_mask=None, - retry=google.api_core.gapic_v1.method.DEFAULT, - timeout=google.api_core.gapic_v1.method.DEFAULT, - metadata=None, - ): - """ - Updates specified tenant. - - Example: - >>> from google.cloud import talent_v4beta1 - >>> - >>> client = talent_v4beta1.TenantServiceClient() - >>> - >>> # TODO: Initialize `tenant`: - >>> tenant = {} - >>> - >>> response = client.update_tenant(tenant) - - Args: - tenant (Union[dict, ~google.cloud.talent_v4beta1.types.Tenant]): Required. The tenant resource to replace the current resource in the system. - - If a dict is provided, it must be of the same form as the protobuf - message :class:`~google.cloud.talent_v4beta1.types.Tenant` - update_mask (Union[dict, ~google.cloud.talent_v4beta1.types.FieldMask]): Strongly recommended for the best service experience. - - If ``update_mask`` is provided, only the specified fields in ``tenant`` - are updated. Otherwise all the fields are updated. - - A field mask to specify the tenant fields to be updated. Only top level - fields of ``Tenant`` are supported. - - If a dict is provided, it must be of the same form as the protobuf - message :class:`~google.cloud.talent_v4beta1.types.FieldMask` - retry (Optional[google.api_core.retry.Retry]): A retry object used - to retry requests. If ``None`` is specified, requests will - be retried using a default configuration. - timeout (Optional[float]): The amount of time, in seconds, to wait - for the request to complete. Note that if ``retry`` is - specified, the timeout applies to each individual attempt. - metadata (Optional[Sequence[Tuple[str, str]]]): Additional metadata - that is provided to the method. - - Returns: - A :class:`~google.cloud.talent_v4beta1.types.Tenant` instance. - - Raises: - google.api_core.exceptions.GoogleAPICallError: If the request - failed for any reason. - google.api_core.exceptions.RetryError: If the request failed due - to a retryable error and retry attempts failed. - ValueError: If the parameters are invalid. - """ - # Wrap the transport method to add retry and timeout logic. - if "update_tenant" not in self._inner_api_calls: - self._inner_api_calls[ - "update_tenant" - ] = google.api_core.gapic_v1.method.wrap_method( - self.transport.update_tenant, - default_retry=self._method_configs["UpdateTenant"].retry, - default_timeout=self._method_configs["UpdateTenant"].timeout, - client_info=self._client_info, - ) - - request = tenant_service_pb2.UpdateTenantRequest( - tenant=tenant, update_mask=update_mask, - ) - if metadata is None: - metadata = [] - metadata = list(metadata) - try: - routing_header = [("tenant.name", tenant.name)] - except AttributeError: - pass - else: - routing_metadata = google.api_core.gapic_v1.routing_header.to_grpc_metadata( - routing_header - ) - metadata.append(routing_metadata) - - return self._inner_api_calls["update_tenant"]( - request, retry=retry, timeout=timeout, metadata=metadata - ) - - def delete_tenant( - self, - name, - retry=google.api_core.gapic_v1.method.DEFAULT, - timeout=google.api_core.gapic_v1.method.DEFAULT, - metadata=None, - ): - """ - Deletes specified tenant. - - Example: - >>> from google.cloud import talent_v4beta1 - >>> - >>> client = talent_v4beta1.TenantServiceClient() - >>> - >>> name = client.tenant_path('[PROJECT]', '[TENANT]') - >>> - >>> client.delete_tenant(name) - - Args: - name (str): Required. The resource name of the tenant to be deleted. - - The format is "projects/{project_id}/tenants/{tenant_id}", for example, - "projects/foo/tenants/bar". - retry (Optional[google.api_core.retry.Retry]): A retry object used - to retry requests. If ``None`` is specified, requests will - be retried using a default configuration. - timeout (Optional[float]): The amount of time, in seconds, to wait - for the request to complete. Note that if ``retry`` is - specified, the timeout applies to each individual attempt. - metadata (Optional[Sequence[Tuple[str, str]]]): Additional metadata - that is provided to the method. - - Raises: - google.api_core.exceptions.GoogleAPICallError: If the request - failed for any reason. - google.api_core.exceptions.RetryError: If the request failed due - to a retryable error and retry attempts failed. - ValueError: If the parameters are invalid. - """ - # Wrap the transport method to add retry and timeout logic. - if "delete_tenant" not in self._inner_api_calls: - self._inner_api_calls[ - "delete_tenant" - ] = google.api_core.gapic_v1.method.wrap_method( - self.transport.delete_tenant, - default_retry=self._method_configs["DeleteTenant"].retry, - default_timeout=self._method_configs["DeleteTenant"].timeout, - client_info=self._client_info, - ) - - request = tenant_service_pb2.DeleteTenantRequest(name=name,) - if metadata is None: - metadata = [] - metadata = list(metadata) - try: - routing_header = [("name", name)] - except AttributeError: - pass - else: - routing_metadata = google.api_core.gapic_v1.routing_header.to_grpc_metadata( - routing_header - ) - metadata.append(routing_metadata) - - self._inner_api_calls["delete_tenant"]( - request, retry=retry, timeout=timeout, metadata=metadata - ) - - def list_tenants( - self, - parent, - page_size=None, - retry=google.api_core.gapic_v1.method.DEFAULT, - timeout=google.api_core.gapic_v1.method.DEFAULT, - metadata=None, - ): - """ - Lists all tenants associated with the project. - - Example: - >>> from google.cloud import talent_v4beta1 - >>> - >>> client = talent_v4beta1.TenantServiceClient() - >>> - >>> parent = client.project_path('[PROJECT]') - >>> - >>> # Iterate over all results - >>> for element in client.list_tenants(parent): - ... # process element - ... pass - >>> - >>> - >>> # Alternatively: - >>> - >>> # Iterate over results one page at a time - >>> for page in client.list_tenants(parent).pages: - ... for element in page: - ... # process element - ... pass - - Args: - parent (str): Required. Resource name of the project under which the tenant is - created. - - The format is "projects/{project_id}", for example, "projects/foo". - page_size (int): The maximum number of resources contained in the - underlying API response. If page streaming is performed per- - resource, this parameter does not affect the return value. If page - streaming is performed per-page, this determines the maximum number - of resources in a page. - retry (Optional[google.api_core.retry.Retry]): A retry object used - to retry requests. If ``None`` is specified, requests will - be retried using a default configuration. - timeout (Optional[float]): The amount of time, in seconds, to wait - for the request to complete. Note that if ``retry`` is - specified, the timeout applies to each individual attempt. - metadata (Optional[Sequence[Tuple[str, str]]]): Additional metadata - that is provided to the method. - - Returns: - A :class:`~google.api_core.page_iterator.PageIterator` instance. - An iterable of :class:`~google.cloud.talent_v4beta1.types.Tenant` instances. - You can also iterate over the pages of the response - using its `pages` property. - - Raises: - google.api_core.exceptions.GoogleAPICallError: If the request - failed for any reason. - google.api_core.exceptions.RetryError: If the request failed due - to a retryable error and retry attempts failed. - ValueError: If the parameters are invalid. - """ - # Wrap the transport method to add retry and timeout logic. - if "list_tenants" not in self._inner_api_calls: - self._inner_api_calls[ - "list_tenants" - ] = google.api_core.gapic_v1.method.wrap_method( - self.transport.list_tenants, - default_retry=self._method_configs["ListTenants"].retry, - default_timeout=self._method_configs["ListTenants"].timeout, - client_info=self._client_info, - ) - - request = tenant_service_pb2.ListTenantsRequest( - parent=parent, page_size=page_size, - ) - if metadata is None: - metadata = [] - metadata = list(metadata) - try: - routing_header = [("parent", parent)] - except AttributeError: - pass - else: - routing_metadata = google.api_core.gapic_v1.routing_header.to_grpc_metadata( - routing_header - ) - metadata.append(routing_metadata) - - iterator = google.api_core.page_iterator.GRPCIterator( - client=None, - method=functools.partial( - self._inner_api_calls["list_tenants"], - retry=retry, - timeout=timeout, - metadata=metadata, - ), - request=request, - items_field="tenants", - request_token_field="page_token", - response_token_field="next_page_token", - ) - return iterator diff --git a/google/cloud/talent_v4beta1/gapic/tenant_service_client_config.py b/google/cloud/talent_v4beta1/gapic/tenant_service_client_config.py deleted file mode 100644 index d5eaaabe..00000000 --- a/google/cloud/talent_v4beta1/gapic/tenant_service_client_config.py +++ /dev/null @@ -1,167 +0,0 @@ -config = { - "interfaces": { - "google.cloud.talent.v4beta1.TenantService": { - "retry_codes": { - "retry_policy_1_codes": ["DEADLINE_EXCEEDED", "UNAVAILABLE"], - "no_retry_2_codes": [], - "retry_policy_6_codes": ["DEADLINE_EXCEEDED", "UNAVAILABLE"], - "no_retry_codes": [], - "no_retry_3_codes": [], - "retry_policy_3_codes": ["DEADLINE_EXCEEDED", "UNAVAILABLE"], - "retry_policy_2_codes": ["DEADLINE_EXCEEDED", "UNAVAILABLE"], - "retry_policy_4_codes": ["DEADLINE_EXCEEDED", "UNAVAILABLE"], - "no_retry_4_codes": [], - "no_retry_6_codes": [], - "no_retry_1_codes": [], - "retry_policy_5_codes": ["DEADLINE_EXCEEDED", "UNAVAILABLE"], - "no_retry_5_codes": [], - }, - "retry_params": { - "no_retry_3_params": { - "initial_retry_delay_millis": 0, - "retry_delay_multiplier": 0.0, - "max_retry_delay_millis": 0, - "initial_rpc_timeout_millis": 30000, - "rpc_timeout_multiplier": 1.0, - "max_rpc_timeout_millis": 30000, - "total_timeout_millis": 30000, - }, - "retry_policy_6_params": { - "initial_retry_delay_millis": 100, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 60000, - "initial_rpc_timeout_millis": 30000, - "rpc_timeout_multiplier": 1.0, - "max_rpc_timeout_millis": 30000, - "total_timeout_millis": 30000, - }, - "no_retry_params": { - "initial_retry_delay_millis": 0, - "retry_delay_multiplier": 0.0, - "max_retry_delay_millis": 0, - "initial_rpc_timeout_millis": 0, - "rpc_timeout_multiplier": 1.0, - "max_rpc_timeout_millis": 0, - "total_timeout_millis": 0, - }, - "no_retry_5_params": { - "initial_retry_delay_millis": 0, - "retry_delay_multiplier": 0.0, - "max_retry_delay_millis": 0, - "initial_rpc_timeout_millis": 30000, - "rpc_timeout_multiplier": 1.0, - "max_rpc_timeout_millis": 30000, - "total_timeout_millis": 30000, - }, - "no_retry_1_params": { - "initial_retry_delay_millis": 0, - "retry_delay_multiplier": 0.0, - "max_retry_delay_millis": 0, - "initial_rpc_timeout_millis": 30000, - "rpc_timeout_multiplier": 1.0, - "max_rpc_timeout_millis": 30000, - "total_timeout_millis": 30000, - }, - "no_retry_2_params": { - "initial_retry_delay_millis": 0, - "retry_delay_multiplier": 0.0, - "max_retry_delay_millis": 0, - "initial_rpc_timeout_millis": 30000, - "rpc_timeout_multiplier": 1.0, - "max_rpc_timeout_millis": 30000, - "total_timeout_millis": 30000, - }, - "no_retry_4_params": { - "initial_retry_delay_millis": 0, - "retry_delay_multiplier": 0.0, - "max_retry_delay_millis": 0, - "initial_rpc_timeout_millis": 30000, - "rpc_timeout_multiplier": 1.0, - "max_rpc_timeout_millis": 30000, - "total_timeout_millis": 30000, - }, - "no_retry_6_params": { - "initial_retry_delay_millis": 0, - "retry_delay_multiplier": 0.0, - "max_retry_delay_millis": 0, - "initial_rpc_timeout_millis": 30000, - "rpc_timeout_multiplier": 1.0, - "max_rpc_timeout_millis": 30000, - "total_timeout_millis": 30000, - }, - "retry_policy_1_params": { - "initial_retry_delay_millis": 100, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 60000, - "initial_rpc_timeout_millis": 30000, - "rpc_timeout_multiplier": 1.0, - "max_rpc_timeout_millis": 30000, - "total_timeout_millis": 30000, - }, - "retry_policy_3_params": { - "initial_retry_delay_millis": 100, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 60000, - "initial_rpc_timeout_millis": 30000, - "rpc_timeout_multiplier": 1.0, - "max_rpc_timeout_millis": 30000, - "total_timeout_millis": 30000, - }, - "retry_policy_2_params": { - "initial_retry_delay_millis": 100, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 60000, - "initial_rpc_timeout_millis": 30000, - "rpc_timeout_multiplier": 1.0, - "max_rpc_timeout_millis": 30000, - "total_timeout_millis": 30000, - }, - "retry_policy_4_params": { - "initial_retry_delay_millis": 100, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 60000, - "initial_rpc_timeout_millis": 30000, - "rpc_timeout_multiplier": 1.0, - "max_rpc_timeout_millis": 30000, - "total_timeout_millis": 30000, - }, - "retry_policy_5_params": { - "initial_retry_delay_millis": 100, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 60000, - "initial_rpc_timeout_millis": 30000, - "rpc_timeout_multiplier": 1.0, - "max_rpc_timeout_millis": 30000, - "total_timeout_millis": 30000, - }, - }, - "methods": { - "CreateTenant": { - "timeout_millis": 30000, - "retry_codes_name": "no_retry_4_codes", - "retry_params_name": "no_retry_4_params", - }, - "GetTenant": { - "timeout_millis": 30000, - "retry_codes_name": "retry_policy_1_codes", - "retry_params_name": "retry_policy_1_params", - }, - "UpdateTenant": { - "timeout_millis": 30000, - "retry_codes_name": "no_retry_4_codes", - "retry_params_name": "no_retry_4_params", - }, - "DeleteTenant": { - "timeout_millis": 30000, - "retry_codes_name": "retry_policy_1_codes", - "retry_params_name": "retry_policy_1_params", - }, - "ListTenants": { - "timeout_millis": 30000, - "retry_codes_name": "retry_policy_1_codes", - "retry_params_name": "retry_policy_1_params", - }, - }, - } - } -} diff --git a/google/cloud/talent_v4beta1/gapic/transports/__init__.py b/google/cloud/talent_v4beta1/gapic/transports/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/google/cloud/talent_v4beta1/gapic/transports/application_service_grpc_transport.py b/google/cloud/talent_v4beta1/gapic/transports/application_service_grpc_transport.py deleted file mode 100644 index f288ddc1..00000000 --- a/google/cloud/talent_v4beta1/gapic/transports/application_service_grpc_transport.py +++ /dev/null @@ -1,178 +0,0 @@ -# -*- 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 -# -# https://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. - - -import google.api_core.grpc_helpers - -from google.cloud.talent_v4beta1.proto import application_service_pb2_grpc - - -class ApplicationServiceGrpcTransport(object): - """gRPC transport class providing stubs for - google.cloud.talent.v4beta1 ApplicationService API. - - The transport provides access to the raw gRPC stubs, - which can be used to take advantage of advanced - features of gRPC. - """ - - # The scopes needed to make gRPC calls to all of the methods defined - # in this service. - _OAUTH_SCOPES = ( - "https://www.googleapis.com/auth/cloud-platform", - "https://www.googleapis.com/auth/jobs", - ) - - def __init__( - self, channel=None, credentials=None, address="jobs.googleapis.com:443" - ): - """Instantiate the transport class. - - Args: - channel (grpc.Channel): A ``Channel`` instance through - which to make calls. This argument is mutually exclusive - with ``credentials``; providing both will raise an exception. - credentials (google.auth.credentials.Credentials): The - authorization credentials to attach to requests. These - credentials identify this application to the service. If none - are specified, the client will attempt to ascertain the - credentials from the environment. - address (str): The address where the service is hosted. - """ - # If both `channel` and `credentials` are specified, raise an - # exception (channels come with credentials baked in already). - if channel is not None and credentials is not None: - raise ValueError( - "The `channel` and `credentials` arguments are mutually " "exclusive.", - ) - - # Create the channel. - if channel is None: - channel = self.create_channel( - address=address, - credentials=credentials, - options={ - "grpc.max_send_message_length": -1, - "grpc.max_receive_message_length": -1, - }.items(), - ) - - self._channel = channel - - # gRPC uses objects called "stubs" that are bound to the - # channel and provide a basic method for each RPC. - self._stubs = { - "application_service_stub": application_service_pb2_grpc.ApplicationServiceStub( - channel - ), - } - - @classmethod - def create_channel( - cls, address="jobs.googleapis.com:443", credentials=None, **kwargs - ): - """Create and return a gRPC channel object. - - Args: - address (str): The host for the channel to use. - credentials (~.Credentials): The - authorization credentials to attach to requests. These - credentials identify this application to the service. If - none are specified, the client will attempt to ascertain - the credentials from the environment. - kwargs (dict): Keyword arguments, which are passed to the - channel creation. - - Returns: - grpc.Channel: A gRPC channel object. - """ - return google.api_core.grpc_helpers.create_channel( - address, credentials=credentials, scopes=cls._OAUTH_SCOPES, **kwargs - ) - - @property - def channel(self): - """The gRPC channel used by the transport. - - Returns: - grpc.Channel: A gRPC channel object. - """ - return self._channel - - @property - def create_application(self): - """Return the gRPC stub for :meth:`ApplicationServiceClient.create_application`. - - Creates a new application entity. - - Returns: - Callable: A callable which accepts the appropriate - deserialized request object and returns a - deserialized response object. - """ - return self._stubs["application_service_stub"].CreateApplication - - @property - def get_application(self): - """Return the gRPC stub for :meth:`ApplicationServiceClient.get_application`. - - Retrieves specified application. - - Returns: - Callable: A callable which accepts the appropriate - deserialized request object and returns a - deserialized response object. - """ - return self._stubs["application_service_stub"].GetApplication - - @property - def update_application(self): - """Return the gRPC stub for :meth:`ApplicationServiceClient.update_application`. - - Updates specified application. - - Returns: - Callable: A callable which accepts the appropriate - deserialized request object and returns a - deserialized response object. - """ - return self._stubs["application_service_stub"].UpdateApplication - - @property - def delete_application(self): - """Return the gRPC stub for :meth:`ApplicationServiceClient.delete_application`. - - Deletes specified application. - - Returns: - Callable: A callable which accepts the appropriate - deserialized request object and returns a - deserialized response object. - """ - return self._stubs["application_service_stub"].DeleteApplication - - @property - def list_applications(self): - """Return the gRPC stub for :meth:`ApplicationServiceClient.list_applications`. - - Lists all applications associated with the profile. - - Returns: - Callable: A callable which accepts the appropriate - deserialized request object and returns a - deserialized response object. - """ - return self._stubs["application_service_stub"].ListApplications diff --git a/google/cloud/talent_v4beta1/gapic/transports/company_service_grpc_transport.py b/google/cloud/talent_v4beta1/gapic/transports/company_service_grpc_transport.py deleted file mode 100644 index 86f3898f..00000000 --- a/google/cloud/talent_v4beta1/gapic/transports/company_service_grpc_transport.py +++ /dev/null @@ -1,179 +0,0 @@ -# -*- 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 -# -# https://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. - - -import google.api_core.grpc_helpers - -from google.cloud.talent_v4beta1.proto import company_service_pb2_grpc - - -class CompanyServiceGrpcTransport(object): - """gRPC transport class providing stubs for - google.cloud.talent.v4beta1 CompanyService API. - - The transport provides access to the raw gRPC stubs, - which can be used to take advantage of advanced - features of gRPC. - """ - - # The scopes needed to make gRPC calls to all of the methods defined - # in this service. - _OAUTH_SCOPES = ( - "https://www.googleapis.com/auth/cloud-platform", - "https://www.googleapis.com/auth/jobs", - ) - - def __init__( - self, channel=None, credentials=None, address="jobs.googleapis.com:443" - ): - """Instantiate the transport class. - - Args: - channel (grpc.Channel): A ``Channel`` instance through - which to make calls. This argument is mutually exclusive - with ``credentials``; providing both will raise an exception. - credentials (google.auth.credentials.Credentials): The - authorization credentials to attach to requests. These - credentials identify this application to the service. If none - are specified, the client will attempt to ascertain the - credentials from the environment. - address (str): The address where the service is hosted. - """ - # If both `channel` and `credentials` are specified, raise an - # exception (channels come with credentials baked in already). - if channel is not None and credentials is not None: - raise ValueError( - "The `channel` and `credentials` arguments are mutually " "exclusive.", - ) - - # Create the channel. - if channel is None: - channel = self.create_channel( - address=address, - credentials=credentials, - options={ - "grpc.max_send_message_length": -1, - "grpc.max_receive_message_length": -1, - }.items(), - ) - - self._channel = channel - - # gRPC uses objects called "stubs" that are bound to the - # channel and provide a basic method for each RPC. - self._stubs = { - "company_service_stub": company_service_pb2_grpc.CompanyServiceStub( - channel - ), - } - - @classmethod - def create_channel( - cls, address="jobs.googleapis.com:443", credentials=None, **kwargs - ): - """Create and return a gRPC channel object. - - Args: - address (str): The host for the channel to use. - credentials (~.Credentials): The - authorization credentials to attach to requests. These - credentials identify this application to the service. If - none are specified, the client will attempt to ascertain - the credentials from the environment. - kwargs (dict): Keyword arguments, which are passed to the - channel creation. - - Returns: - grpc.Channel: A gRPC channel object. - """ - return google.api_core.grpc_helpers.create_channel( - address, credentials=credentials, scopes=cls._OAUTH_SCOPES, **kwargs - ) - - @property - def channel(self): - """The gRPC channel used by the transport. - - Returns: - grpc.Channel: A gRPC channel object. - """ - return self._channel - - @property - def create_company(self): - """Return the gRPC stub for :meth:`CompanyServiceClient.create_company`. - - Creates a new company entity. - - Returns: - Callable: A callable which accepts the appropriate - deserialized request object and returns a - deserialized response object. - """ - return self._stubs["company_service_stub"].CreateCompany - - @property - def get_company(self): - """Return the gRPC stub for :meth:`CompanyServiceClient.get_company`. - - Retrieves specified company. - - Returns: - Callable: A callable which accepts the appropriate - deserialized request object and returns a - deserialized response object. - """ - return self._stubs["company_service_stub"].GetCompany - - @property - def update_company(self): - """Return the gRPC stub for :meth:`CompanyServiceClient.update_company`. - - Updates specified company. - - Returns: - Callable: A callable which accepts the appropriate - deserialized request object and returns a - deserialized response object. - """ - return self._stubs["company_service_stub"].UpdateCompany - - @property - def delete_company(self): - """Return the gRPC stub for :meth:`CompanyServiceClient.delete_company`. - - Deletes specified company. - Prerequisite: The company has no jobs associated with it. - - Returns: - Callable: A callable which accepts the appropriate - deserialized request object and returns a - deserialized response object. - """ - return self._stubs["company_service_stub"].DeleteCompany - - @property - def list_companies(self): - """Return the gRPC stub for :meth:`CompanyServiceClient.list_companies`. - - Lists all companies associated with the project. - - Returns: - Callable: A callable which accepts the appropriate - deserialized request object and returns a - deserialized response object. - """ - return self._stubs["company_service_stub"].ListCompanies diff --git a/google/cloud/talent_v4beta1/gapic/transports/completion_grpc_transport.py b/google/cloud/talent_v4beta1/gapic/transports/completion_grpc_transport.py deleted file mode 100644 index f73a61d8..00000000 --- a/google/cloud/talent_v4beta1/gapic/transports/completion_grpc_transport.py +++ /dev/null @@ -1,125 +0,0 @@ -# -*- 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 -# -# https://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. - - -import google.api_core.grpc_helpers - -from google.cloud.talent_v4beta1.proto import completion_service_pb2_grpc - - -class CompletionGrpcTransport(object): - """gRPC transport class providing stubs for - google.cloud.talent.v4beta1 Completion API. - - The transport provides access to the raw gRPC stubs, - which can be used to take advantage of advanced - features of gRPC. - """ - - # The scopes needed to make gRPC calls to all of the methods defined - # in this service. - _OAUTH_SCOPES = ( - "https://www.googleapis.com/auth/cloud-platform", - "https://www.googleapis.com/auth/jobs", - ) - - def __init__( - self, channel=None, credentials=None, address="jobs.googleapis.com:443" - ): - """Instantiate the transport class. - - Args: - channel (grpc.Channel): A ``Channel`` instance through - which to make calls. This argument is mutually exclusive - with ``credentials``; providing both will raise an exception. - credentials (google.auth.credentials.Credentials): The - authorization credentials to attach to requests. These - credentials identify this application to the service. If none - are specified, the client will attempt to ascertain the - credentials from the environment. - address (str): The address where the service is hosted. - """ - # If both `channel` and `credentials` are specified, raise an - # exception (channels come with credentials baked in already). - if channel is not None and credentials is not None: - raise ValueError( - "The `channel` and `credentials` arguments are mutually " "exclusive.", - ) - - # Create the channel. - if channel is None: - channel = self.create_channel( - address=address, - credentials=credentials, - options={ - "grpc.max_send_message_length": -1, - "grpc.max_receive_message_length": -1, - }.items(), - ) - - self._channel = channel - - # gRPC uses objects called "stubs" that are bound to the - # channel and provide a basic method for each RPC. - self._stubs = { - "completion_stub": completion_service_pb2_grpc.CompletionStub(channel), - } - - @classmethod - def create_channel( - cls, address="jobs.googleapis.com:443", credentials=None, **kwargs - ): - """Create and return a gRPC channel object. - - Args: - address (str): The host for the channel to use. - credentials (~.Credentials): The - authorization credentials to attach to requests. These - credentials identify this application to the service. If - none are specified, the client will attempt to ascertain - the credentials from the environment. - kwargs (dict): Keyword arguments, which are passed to the - channel creation. - - Returns: - grpc.Channel: A gRPC channel object. - """ - return google.api_core.grpc_helpers.create_channel( - address, credentials=credentials, scopes=cls._OAUTH_SCOPES, **kwargs - ) - - @property - def channel(self): - """The gRPC channel used by the transport. - - Returns: - grpc.Channel: A gRPC channel object. - """ - return self._channel - - @property - def complete_query(self): - """Return the gRPC stub for :meth:`CompletionClient.complete_query`. - - Completes the specified prefix with keyword suggestions. - Intended for use by a job search auto-complete search box. - - Returns: - Callable: A callable which accepts the appropriate - deserialized request object and returns a - deserialized response object. - """ - return self._stubs["completion_stub"].CompleteQuery diff --git a/google/cloud/talent_v4beta1/gapic/transports/event_service_grpc_transport.py b/google/cloud/talent_v4beta1/gapic/transports/event_service_grpc_transport.py deleted file mode 100644 index 8d9c2b88..00000000 --- a/google/cloud/talent_v4beta1/gapic/transports/event_service_grpc_transport.py +++ /dev/null @@ -1,130 +0,0 @@ -# -*- 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 -# -# https://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. - - -import google.api_core.grpc_helpers - -from google.cloud.talent_v4beta1.proto import event_service_pb2_grpc - - -class EventServiceGrpcTransport(object): - """gRPC transport class providing stubs for - google.cloud.talent.v4beta1 EventService API. - - The transport provides access to the raw gRPC stubs, - which can be used to take advantage of advanced - features of gRPC. - """ - - # The scopes needed to make gRPC calls to all of the methods defined - # in this service. - _OAUTH_SCOPES = ( - "https://www.googleapis.com/auth/cloud-platform", - "https://www.googleapis.com/auth/jobs", - ) - - def __init__( - self, channel=None, credentials=None, address="jobs.googleapis.com:443" - ): - """Instantiate the transport class. - - Args: - channel (grpc.Channel): A ``Channel`` instance through - which to make calls. This argument is mutually exclusive - with ``credentials``; providing both will raise an exception. - credentials (google.auth.credentials.Credentials): The - authorization credentials to attach to requests. These - credentials identify this application to the service. If none - are specified, the client will attempt to ascertain the - credentials from the environment. - address (str): The address where the service is hosted. - """ - # If both `channel` and `credentials` are specified, raise an - # exception (channels come with credentials baked in already). - if channel is not None and credentials is not None: - raise ValueError( - "The `channel` and `credentials` arguments are mutually " "exclusive.", - ) - - # Create the channel. - if channel is None: - channel = self.create_channel( - address=address, - credentials=credentials, - options={ - "grpc.max_send_message_length": -1, - "grpc.max_receive_message_length": -1, - }.items(), - ) - - self._channel = channel - - # gRPC uses objects called "stubs" that are bound to the - # channel and provide a basic method for each RPC. - self._stubs = { - "event_service_stub": event_service_pb2_grpc.EventServiceStub(channel), - } - - @classmethod - def create_channel( - cls, address="jobs.googleapis.com:443", credentials=None, **kwargs - ): - """Create and return a gRPC channel object. - - Args: - address (str): The host for the channel to use. - credentials (~.Credentials): The - authorization credentials to attach to requests. These - credentials identify this application to the service. If - none are specified, the client will attempt to ascertain - the credentials from the environment. - kwargs (dict): Keyword arguments, which are passed to the - channel creation. - - Returns: - grpc.Channel: A gRPC channel object. - """ - return google.api_core.grpc_helpers.create_channel( - address, credentials=credentials, scopes=cls._OAUTH_SCOPES, **kwargs - ) - - @property - def channel(self): - """The gRPC channel used by the transport. - - Returns: - grpc.Channel: A gRPC channel object. - """ - return self._channel - - @property - def create_client_event(self): - """Return the gRPC stub for :meth:`EventServiceClient.create_client_event`. - - Report events issued when end user interacts with customer's - application that uses Cloud Talent Solution. You may inspect the created - events in `self service - tools `__. - `Learn - more `__ - about self service tools. - - Returns: - Callable: A callable which accepts the appropriate - deserialized request object and returns a - deserialized response object. - """ - return self._stubs["event_service_stub"].CreateClientEvent diff --git a/google/cloud/talent_v4beta1/gapic/transports/job_service_grpc_transport.py b/google/cloud/talent_v4beta1/gapic/transports/job_service_grpc_transport.py deleted file mode 100644 index 5100175e..00000000 --- a/google/cloud/talent_v4beta1/gapic/transports/job_service_grpc_transport.py +++ /dev/null @@ -1,270 +0,0 @@ -# -*- 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 -# -# https://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. - - -import google.api_core.grpc_helpers -import google.api_core.operations_v1 - -from google.cloud.talent_v4beta1.proto import job_service_pb2_grpc - - -class JobServiceGrpcTransport(object): - """gRPC transport class providing stubs for - google.cloud.talent.v4beta1 JobService API. - - The transport provides access to the raw gRPC stubs, - which can be used to take advantage of advanced - features of gRPC. - """ - - # The scopes needed to make gRPC calls to all of the methods defined - # in this service. - _OAUTH_SCOPES = ( - "https://www.googleapis.com/auth/cloud-platform", - "https://www.googleapis.com/auth/jobs", - ) - - def __init__( - self, channel=None, credentials=None, address="jobs.googleapis.com:443" - ): - """Instantiate the transport class. - - Args: - channel (grpc.Channel): A ``Channel`` instance through - which to make calls. This argument is mutually exclusive - with ``credentials``; providing both will raise an exception. - credentials (google.auth.credentials.Credentials): The - authorization credentials to attach to requests. These - credentials identify this application to the service. If none - are specified, the client will attempt to ascertain the - credentials from the environment. - address (str): The address where the service is hosted. - """ - # If both `channel` and `credentials` are specified, raise an - # exception (channels come with credentials baked in already). - if channel is not None and credentials is not None: - raise ValueError( - "The `channel` and `credentials` arguments are mutually " "exclusive.", - ) - - # Create the channel. - if channel is None: - channel = self.create_channel( - address=address, - credentials=credentials, - options={ - "grpc.max_send_message_length": -1, - "grpc.max_receive_message_length": -1, - }.items(), - ) - - self._channel = channel - - # gRPC uses objects called "stubs" that are bound to the - # channel and provide a basic method for each RPC. - self._stubs = { - "job_service_stub": job_service_pb2_grpc.JobServiceStub(channel), - } - - # Because this API includes a method that returns a - # long-running operation (proto: google.longrunning.Operation), - # instantiate an LRO client. - self._operations_client = google.api_core.operations_v1.OperationsClient( - channel - ) - - @classmethod - def create_channel( - cls, address="jobs.googleapis.com:443", credentials=None, **kwargs - ): - """Create and return a gRPC channel object. - - Args: - address (str): The host for the channel to use. - credentials (~.Credentials): The - authorization credentials to attach to requests. These - credentials identify this application to the service. If - none are specified, the client will attempt to ascertain - the credentials from the environment. - kwargs (dict): Keyword arguments, which are passed to the - channel creation. - - Returns: - grpc.Channel: A gRPC channel object. - """ - return google.api_core.grpc_helpers.create_channel( - address, credentials=credentials, scopes=cls._OAUTH_SCOPES, **kwargs - ) - - @property - def channel(self): - """The gRPC channel used by the transport. - - Returns: - grpc.Channel: A gRPC channel object. - """ - return self._channel - - @property - def create_job(self): - """Return the gRPC stub for :meth:`JobServiceClient.create_job`. - - Creates a new job. - - Typically, the job becomes searchable within 10 seconds, but it may take - up to 5 minutes. - - Returns: - Callable: A callable which accepts the appropriate - deserialized request object and returns a - deserialized response object. - """ - return self._stubs["job_service_stub"].CreateJob - - @property - def batch_create_jobs(self): - """Return the gRPC stub for :meth:`JobServiceClient.batch_create_jobs`. - - Begins executing a batch create jobs operation. - - Returns: - Callable: A callable which accepts the appropriate - deserialized request object and returns a - deserialized response object. - """ - return self._stubs["job_service_stub"].BatchCreateJobs - - @property - def get_job(self): - """Return the gRPC stub for :meth:`JobServiceClient.get_job`. - - Retrieves the specified job, whose status is OPEN or recently EXPIRED - within the last 90 days. - - Returns: - Callable: A callable which accepts the appropriate - deserialized request object and returns a - deserialized response object. - """ - return self._stubs["job_service_stub"].GetJob - - @property - def update_job(self): - """Return the gRPC stub for :meth:`JobServiceClient.update_job`. - - Updates specified job. - - Typically, updated contents become visible in search results within 10 - seconds, but it may take up to 5 minutes. - - Returns: - Callable: A callable which accepts the appropriate - deserialized request object and returns a - deserialized response object. - """ - return self._stubs["job_service_stub"].UpdateJob - - @property - def batch_update_jobs(self): - """Return the gRPC stub for :meth:`JobServiceClient.batch_update_jobs`. - - Begins executing a batch update jobs operation. - - Returns: - Callable: A callable which accepts the appropriate - deserialized request object and returns a - deserialized response object. - """ - return self._stubs["job_service_stub"].BatchUpdateJobs - - @property - def delete_job(self): - """Return the gRPC stub for :meth:`JobServiceClient.delete_job`. - - Deletes the specified job. - - Typically, the job becomes unsearchable within 10 seconds, but it may take - up to 5 minutes. - - Returns: - Callable: A callable which accepts the appropriate - deserialized request object and returns a - deserialized response object. - """ - return self._stubs["job_service_stub"].DeleteJob - - @property - def batch_delete_jobs(self): - """Return the gRPC stub for :meth:`JobServiceClient.batch_delete_jobs`. - - Deletes a list of ``Job``\ s by filter. - - Returns: - Callable: A callable which accepts the appropriate - deserialized request object and returns a - deserialized response object. - """ - return self._stubs["job_service_stub"].BatchDeleteJobs - - @property - def list_jobs(self): - """Return the gRPC stub for :meth:`JobServiceClient.list_jobs`. - - Lists jobs by filter. - - Returns: - Callable: A callable which accepts the appropriate - deserialized request object and returns a - deserialized response object. - """ - return self._stubs["job_service_stub"].ListJobs - - @property - def search_jobs(self): - """Return the gRPC stub for :meth:`JobServiceClient.search_jobs`. - - Searches for jobs using the provided ``SearchJobsRequest``. - - This call constrains the ``visibility`` of jobs present in the database, - and only returns jobs that the caller has permission to search against. - - Returns: - Callable: A callable which accepts the appropriate - deserialized request object and returns a - deserialized response object. - """ - return self._stubs["job_service_stub"].SearchJobs - - @property - def search_jobs_for_alert(self): - """Return the gRPC stub for :meth:`JobServiceClient.search_jobs_for_alert`. - - Searches for jobs using the provided ``SearchJobsRequest``. - - This API call is intended for the use case of targeting passive job - seekers (for example, job seekers who have signed up to receive email - alerts about potential job opportunities), and has different algorithmic - adjustments that are targeted to passive job seekers. - - This call constrains the ``visibility`` of jobs present in the database, - and only returns jobs the caller has permission to search against. - - Returns: - Callable: A callable which accepts the appropriate - deserialized request object and returns a - deserialized response object. - """ - return self._stubs["job_service_stub"].SearchJobsForAlert diff --git a/google/cloud/talent_v4beta1/gapic/transports/profile_service_grpc_transport.py b/google/cloud/talent_v4beta1/gapic/transports/profile_service_grpc_transport.py deleted file mode 100644 index 636334d9..00000000 --- a/google/cloud/talent_v4beta1/gapic/transports/profile_service_grpc_transport.py +++ /dev/null @@ -1,199 +0,0 @@ -# -*- 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 -# -# https://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. - - -import google.api_core.grpc_helpers - -from google.cloud.talent_v4beta1.proto import profile_service_pb2_grpc - - -class ProfileServiceGrpcTransport(object): - """gRPC transport class providing stubs for - google.cloud.talent.v4beta1 ProfileService API. - - The transport provides access to the raw gRPC stubs, - which can be used to take advantage of advanced - features of gRPC. - """ - - # The scopes needed to make gRPC calls to all of the methods defined - # in this service. - _OAUTH_SCOPES = ( - "https://www.googleapis.com/auth/cloud-platform", - "https://www.googleapis.com/auth/jobs", - ) - - def __init__( - self, channel=None, credentials=None, address="jobs.googleapis.com:443" - ): - """Instantiate the transport class. - - Args: - channel (grpc.Channel): A ``Channel`` instance through - which to make calls. This argument is mutually exclusive - with ``credentials``; providing both will raise an exception. - credentials (google.auth.credentials.Credentials): The - authorization credentials to attach to requests. These - credentials identify this application to the service. If none - are specified, the client will attempt to ascertain the - credentials from the environment. - address (str): The address where the service is hosted. - """ - # If both `channel` and `credentials` are specified, raise an - # exception (channels come with credentials baked in already). - if channel is not None and credentials is not None: - raise ValueError( - "The `channel` and `credentials` arguments are mutually " "exclusive.", - ) - - # Create the channel. - if channel is None: - channel = self.create_channel( - address=address, - credentials=credentials, - options={ - "grpc.max_send_message_length": -1, - "grpc.max_receive_message_length": -1, - }.items(), - ) - - self._channel = channel - - # gRPC uses objects called "stubs" that are bound to the - # channel and provide a basic method for each RPC. - self._stubs = { - "profile_service_stub": profile_service_pb2_grpc.ProfileServiceStub( - channel - ), - } - - @classmethod - def create_channel( - cls, address="jobs.googleapis.com:443", credentials=None, **kwargs - ): - """Create and return a gRPC channel object. - - Args: - address (str): The host for the channel to use. - credentials (~.Credentials): The - authorization credentials to attach to requests. These - credentials identify this application to the service. If - none are specified, the client will attempt to ascertain - the credentials from the environment. - kwargs (dict): Keyword arguments, which are passed to the - channel creation. - - Returns: - grpc.Channel: A gRPC channel object. - """ - return google.api_core.grpc_helpers.create_channel( - address, credentials=credentials, scopes=cls._OAUTH_SCOPES, **kwargs - ) - - @property - def channel(self): - """The gRPC channel used by the transport. - - Returns: - grpc.Channel: A gRPC channel object. - """ - return self._channel - - @property - def search_profiles(self): - """Return the gRPC stub for :meth:`ProfileServiceClient.search_profiles`. - - Searches for profiles within a tenant. - - For example, search by raw queries "software engineer in Mountain View" - or search by structured filters (location filter, education filter, - etc.). - - See ``SearchProfilesRequest`` for more information. - - Returns: - Callable: A callable which accepts the appropriate - deserialized request object and returns a - deserialized response object. - """ - return self._stubs["profile_service_stub"].SearchProfiles - - @property - def list_profiles(self): - """Return the gRPC stub for :meth:`ProfileServiceClient.list_profiles`. - - Lists profiles by filter. The order is unspecified. - - Returns: - Callable: A callable which accepts the appropriate - deserialized request object and returns a - deserialized response object. - """ - return self._stubs["profile_service_stub"].ListProfiles - - @property - def create_profile(self): - """Return the gRPC stub for :meth:`ProfileServiceClient.create_profile`. - - Creates and returns a new profile. - - Returns: - Callable: A callable which accepts the appropriate - deserialized request object and returns a - deserialized response object. - """ - return self._stubs["profile_service_stub"].CreateProfile - - @property - def get_profile(self): - """Return the gRPC stub for :meth:`ProfileServiceClient.get_profile`. - - Gets the specified profile. - - Returns: - Callable: A callable which accepts the appropriate - deserialized request object and returns a - deserialized response object. - """ - return self._stubs["profile_service_stub"].GetProfile - - @property - def update_profile(self): - """Return the gRPC stub for :meth:`ProfileServiceClient.update_profile`. - - Updates the specified profile and returns the updated result. - - Returns: - Callable: A callable which accepts the appropriate - deserialized request object and returns a - deserialized response object. - """ - return self._stubs["profile_service_stub"].UpdateProfile - - @property - def delete_profile(self): - """Return the gRPC stub for :meth:`ProfileServiceClient.delete_profile`. - - Deletes the specified profile. - Prerequisite: The profile has no associated applications or assignments - associated. - - Returns: - Callable: A callable which accepts the appropriate - deserialized request object and returns a - deserialized response object. - """ - return self._stubs["profile_service_stub"].DeleteProfile diff --git a/google/cloud/talent_v4beta1/gapic/transports/tenant_service_grpc_transport.py b/google/cloud/talent_v4beta1/gapic/transports/tenant_service_grpc_transport.py deleted file mode 100644 index 1158072b..00000000 --- a/google/cloud/talent_v4beta1/gapic/transports/tenant_service_grpc_transport.py +++ /dev/null @@ -1,176 +0,0 @@ -# -*- 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 -# -# https://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. - - -import google.api_core.grpc_helpers - -from google.cloud.talent_v4beta1.proto import tenant_service_pb2_grpc - - -class TenantServiceGrpcTransport(object): - """gRPC transport class providing stubs for - google.cloud.talent.v4beta1 TenantService API. - - The transport provides access to the raw gRPC stubs, - which can be used to take advantage of advanced - features of gRPC. - """ - - # The scopes needed to make gRPC calls to all of the methods defined - # in this service. - _OAUTH_SCOPES = ( - "https://www.googleapis.com/auth/cloud-platform", - "https://www.googleapis.com/auth/jobs", - ) - - def __init__( - self, channel=None, credentials=None, address="jobs.googleapis.com:443" - ): - """Instantiate the transport class. - - Args: - channel (grpc.Channel): A ``Channel`` instance through - which to make calls. This argument is mutually exclusive - with ``credentials``; providing both will raise an exception. - credentials (google.auth.credentials.Credentials): The - authorization credentials to attach to requests. These - credentials identify this application to the service. If none - are specified, the client will attempt to ascertain the - credentials from the environment. - address (str): The address where the service is hosted. - """ - # If both `channel` and `credentials` are specified, raise an - # exception (channels come with credentials baked in already). - if channel is not None and credentials is not None: - raise ValueError( - "The `channel` and `credentials` arguments are mutually " "exclusive.", - ) - - # Create the channel. - if channel is None: - channel = self.create_channel( - address=address, - credentials=credentials, - options={ - "grpc.max_send_message_length": -1, - "grpc.max_receive_message_length": -1, - }.items(), - ) - - self._channel = channel - - # gRPC uses objects called "stubs" that are bound to the - # channel and provide a basic method for each RPC. - self._stubs = { - "tenant_service_stub": tenant_service_pb2_grpc.TenantServiceStub(channel), - } - - @classmethod - def create_channel( - cls, address="jobs.googleapis.com:443", credentials=None, **kwargs - ): - """Create and return a gRPC channel object. - - Args: - address (str): The host for the channel to use. - credentials (~.Credentials): The - authorization credentials to attach to requests. These - credentials identify this application to the service. If - none are specified, the client will attempt to ascertain - the credentials from the environment. - kwargs (dict): Keyword arguments, which are passed to the - channel creation. - - Returns: - grpc.Channel: A gRPC channel object. - """ - return google.api_core.grpc_helpers.create_channel( - address, credentials=credentials, scopes=cls._OAUTH_SCOPES, **kwargs - ) - - @property - def channel(self): - """The gRPC channel used by the transport. - - Returns: - grpc.Channel: A gRPC channel object. - """ - return self._channel - - @property - def create_tenant(self): - """Return the gRPC stub for :meth:`TenantServiceClient.create_tenant`. - - Creates a new tenant entity. - - Returns: - Callable: A callable which accepts the appropriate - deserialized request object and returns a - deserialized response object. - """ - return self._stubs["tenant_service_stub"].CreateTenant - - @property - def get_tenant(self): - """Return the gRPC stub for :meth:`TenantServiceClient.get_tenant`. - - Retrieves specified tenant. - - Returns: - Callable: A callable which accepts the appropriate - deserialized request object and returns a - deserialized response object. - """ - return self._stubs["tenant_service_stub"].GetTenant - - @property - def update_tenant(self): - """Return the gRPC stub for :meth:`TenantServiceClient.update_tenant`. - - Updates specified tenant. - - Returns: - Callable: A callable which accepts the appropriate - deserialized request object and returns a - deserialized response object. - """ - return self._stubs["tenant_service_stub"].UpdateTenant - - @property - def delete_tenant(self): - """Return the gRPC stub for :meth:`TenantServiceClient.delete_tenant`. - - Deletes specified tenant. - - Returns: - Callable: A callable which accepts the appropriate - deserialized request object and returns a - deserialized response object. - """ - return self._stubs["tenant_service_stub"].DeleteTenant - - @property - def list_tenants(self): - """Return the gRPC stub for :meth:`TenantServiceClient.list_tenants`. - - Lists all tenants associated with the project. - - Returns: - Callable: A callable which accepts the appropriate - deserialized request object and returns a - deserialized response object. - """ - return self._stubs["tenant_service_stub"].ListTenants diff --git a/google/cloud/talent_v4beta1/proto/__init__.py b/google/cloud/talent_v4beta1/proto/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/google/cloud/talent_v4beta1/proto/application_pb2.py b/google/cloud/talent_v4beta1/proto/application_pb2.py deleted file mode 100644 index ae4d5d29..00000000 --- a/google/cloud/talent_v4beta1/proto/application_pb2.py +++ /dev/null @@ -1,628 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by the protocol buffer compiler. DO NOT EDIT! -# source: google/cloud/talent_v4beta1/proto/application.proto -"""Generated protocol buffer code.""" -from google.protobuf import descriptor as _descriptor -from google.protobuf import message as _message -from google.protobuf import reflection as _reflection -from google.protobuf import symbol_database as _symbol_database - -# @@protoc_insertion_point(imports) - -_sym_db = _symbol_database.Default() - - -from google.api import annotations_pb2 as google_dot_api_dot_annotations__pb2 -from google.api import field_behavior_pb2 as google_dot_api_dot_field__behavior__pb2 -from google.api import resource_pb2 as google_dot_api_dot_resource__pb2 -from google.cloud.talent_v4beta1.proto import ( - common_pb2 as google_dot_cloud_dot_talent__v4beta1_dot_proto_dot_common__pb2, -) -from google.protobuf import timestamp_pb2 as google_dot_protobuf_dot_timestamp__pb2 -from google.protobuf import wrappers_pb2 as google_dot_protobuf_dot_wrappers__pb2 -from google.type import date_pb2 as google_dot_type_dot_date__pb2 - - -DESCRIPTOR = _descriptor.FileDescriptor( - name="google/cloud/talent_v4beta1/proto/application.proto", - package="google.cloud.talent.v4beta1", - syntax="proto3", - serialized_options=b"\n\037com.google.cloud.talent.v4beta1B\030ApplicationResourceProtoP\001ZAgoogle.golang.org/genproto/googleapis/cloud/talent/v4beta1;talent\242\002\003CTS", - create_key=_descriptor._internal_create_key, - serialized_pb=b'\n3google/cloud/talent_v4beta1/proto/application.proto\x12\x1bgoogle.cloud.talent.v4beta1\x1a\x1cgoogle/api/annotations.proto\x1a\x1fgoogle/api/field_behavior.proto\x1a\x19google/api/resource.proto\x1a.google/cloud/talent_v4beta1/proto/common.proto\x1a\x1fgoogle/protobuf/timestamp.proto\x1a\x1egoogle/protobuf/wrappers.proto\x1a\x16google/type/date.proto"\x9c\t\n\x0b\x41pplication\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\x18\n\x0b\x65xternal_id\x18\x1f \x01(\tB\x03\xe0\x41\x02\x12\x14\n\x07profile\x18\x02 \x01(\tB\x03\xe0\x41\x03\x12,\n\x03job\x18\x04 \x01(\tB\x1f\xfa\x41\x19\n\x17jobs.googleapis.com/Job\xe0\x41\x02\x12\x31\n\x07\x63ompany\x18\x05 \x01(\tB \xfa\x41\x1d\n\x1bjobs.googleapis.com/Company\x12+\n\x10\x61pplication_date\x18\x07 \x01(\x0b\x32\x11.google.type.Date\x12M\n\x05stage\x18\x0b \x01(\x0e\x32\x39.google.cloud.talent.v4beta1.Application.ApplicationStageB\x03\xe0\x41\x02\x12H\n\x05state\x18\r \x01(\x0e\x32\x39.google.cloud.talent.v4beta1.Application.ApplicationState\x12:\n\ninterviews\x18\x10 \x03(\x0b\x32&.google.cloud.talent.v4beta1.Interview\x12,\n\x08referral\x18\x12 \x01(\x0b\x32\x1a.google.protobuf.BoolValue\x12\x34\n\x0b\x63reate_time\x18\x13 \x01(\x0b\x32\x1a.google.protobuf.TimestampB\x03\xe0\x41\x02\x12/\n\x0bupdate_time\x18\x14 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12\x15\n\routcome_notes\x18\x15 \x01(\t\x12\x35\n\x07outcome\x18\x16 \x01(\x0e\x32$.google.cloud.talent.v4beta1.Outcome\x12\x31\n\x08is_match\x18\x1c \x01(\x0b\x32\x1a.google.protobuf.BoolValueB\x03\xe0\x41\x03\x12\x1e\n\x11job_title_snippet\x18\x1d \x01(\tB\x03\xe0\x41\x03"\x90\x01\n\x10\x41pplicationState\x12!\n\x1d\x41PPLICATION_STATE_UNSPECIFIED\x10\x00\x12\x0f\n\x0bIN_PROGRESS\x10\x01\x12\x16\n\x12\x43\x41NDIDATE_WITHDREW\x10\x02\x12\x15\n\x11\x45MPLOYER_WITHDREW\x10\x03\x12\r\n\tCOMPLETED\x10\x04\x12\n\n\x06\x43LOSED\x10\x05"\xa9\x01\n\x10\x41pplicationStage\x12!\n\x1d\x41PPLICATION_STAGE_UNSPECIFIED\x10\x00\x12\x07\n\x03NEW\x10\x01\x12\n\n\x06SCREEN\x10\x02\x12\x19\n\x15HIRING_MANAGER_REVIEW\x10\x03\x12\r\n\tINTERVIEW\x10\x04\x12\x12\n\x0eOFFER_EXTENDED\x10\x05\x12\x12\n\x0eOFFER_ACCEPTED\x10\x06\x12\x0b\n\x07STARTED\x10\x07:w\xea\x41t\n\x1fjobs.googleapis.com/Application\x12Qprojects/{project}/tenants/{tenant}/profiles/{profile}/applications/{application}B\x86\x01\n\x1f\x63om.google.cloud.talent.v4beta1B\x18\x41pplicationResourceProtoP\x01ZAgoogle.golang.org/genproto/googleapis/cloud/talent/v4beta1;talent\xa2\x02\x03\x43TSb\x06proto3', - dependencies=[ - google_dot_api_dot_annotations__pb2.DESCRIPTOR, - google_dot_api_dot_field__behavior__pb2.DESCRIPTOR, - google_dot_api_dot_resource__pb2.DESCRIPTOR, - google_dot_cloud_dot_talent__v4beta1_dot_proto_dot_common__pb2.DESCRIPTOR, - google_dot_protobuf_dot_timestamp__pb2.DESCRIPTOR, - google_dot_protobuf_dot_wrappers__pb2.DESCRIPTOR, - google_dot_type_dot_date__pb2.DESCRIPTOR, - ], -) - - -_APPLICATION_APPLICATIONSTATE = _descriptor.EnumDescriptor( - name="ApplicationState", - full_name="google.cloud.talent.v4beta1.Application.ApplicationState", - filename=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - values=[ - _descriptor.EnumValueDescriptor( - name="APPLICATION_STATE_UNSPECIFIED", - index=0, - number=0, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="IN_PROGRESS", - index=1, - number=1, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="CANDIDATE_WITHDREW", - index=2, - number=2, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="EMPLOYER_WITHDREW", - index=3, - number=3, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="COMPLETED", - index=4, - number=4, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="CLOSED", - index=5, - number=5, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - ], - containing_type=None, - serialized_options=None, - serialized_start=1055, - serialized_end=1199, -) -_sym_db.RegisterEnumDescriptor(_APPLICATION_APPLICATIONSTATE) - -_APPLICATION_APPLICATIONSTAGE = _descriptor.EnumDescriptor( - name="ApplicationStage", - full_name="google.cloud.talent.v4beta1.Application.ApplicationStage", - filename=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - values=[ - _descriptor.EnumValueDescriptor( - name="APPLICATION_STAGE_UNSPECIFIED", - index=0, - number=0, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="NEW", - index=1, - number=1, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="SCREEN", - index=2, - number=2, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="HIRING_MANAGER_REVIEW", - index=3, - number=3, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="INTERVIEW", - index=4, - number=4, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="OFFER_EXTENDED", - index=5, - number=5, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="OFFER_ACCEPTED", - index=6, - number=6, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="STARTED", - index=7, - number=7, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - ], - containing_type=None, - serialized_options=None, - serialized_start=1202, - serialized_end=1371, -) -_sym_db.RegisterEnumDescriptor(_APPLICATION_APPLICATIONSTAGE) - - -_APPLICATION = _descriptor.Descriptor( - name="Application", - full_name="google.cloud.talent.v4beta1.Application", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="name", - full_name="google.cloud.talent.v4beta1.Application.name", - index=0, - number=1, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="external_id", - full_name="google.cloud.talent.v4beta1.Application.external_id", - index=1, - number=31, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\002", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="profile", - full_name="google.cloud.talent.v4beta1.Application.profile", - index=2, - number=2, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\003", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="job", - full_name="google.cloud.talent.v4beta1.Application.job", - index=3, - number=4, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\372A\031\n\027jobs.googleapis.com/Job\340A\002", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="company", - full_name="google.cloud.talent.v4beta1.Application.company", - index=4, - number=5, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\372A\035\n\033jobs.googleapis.com/Company", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="application_date", - full_name="google.cloud.talent.v4beta1.Application.application_date", - index=5, - number=7, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="stage", - full_name="google.cloud.talent.v4beta1.Application.stage", - index=6, - number=11, - type=14, - cpp_type=8, - label=1, - has_default_value=False, - default_value=0, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\002", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="state", - full_name="google.cloud.talent.v4beta1.Application.state", - index=7, - number=13, - type=14, - cpp_type=8, - label=1, - has_default_value=False, - default_value=0, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="interviews", - full_name="google.cloud.talent.v4beta1.Application.interviews", - index=8, - number=16, - type=11, - cpp_type=10, - label=3, - has_default_value=False, - default_value=[], - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="referral", - full_name="google.cloud.talent.v4beta1.Application.referral", - index=9, - number=18, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="create_time", - full_name="google.cloud.talent.v4beta1.Application.create_time", - index=10, - number=19, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\002", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="update_time", - full_name="google.cloud.talent.v4beta1.Application.update_time", - index=11, - number=20, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="outcome_notes", - full_name="google.cloud.talent.v4beta1.Application.outcome_notes", - index=12, - number=21, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="outcome", - full_name="google.cloud.talent.v4beta1.Application.outcome", - index=13, - number=22, - type=14, - cpp_type=8, - label=1, - has_default_value=False, - default_value=0, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="is_match", - full_name="google.cloud.talent.v4beta1.Application.is_match", - index=14, - number=28, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\003", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="job_title_snippet", - full_name="google.cloud.talent.v4beta1.Application.job_title_snippet", - index=15, - number=29, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\003", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[], - enum_types=[_APPLICATION_APPLICATIONSTATE, _APPLICATION_APPLICATIONSTAGE,], - serialized_options=b"\352At\n\037jobs.googleapis.com/Application\022Qprojects/{project}/tenants/{tenant}/profiles/{profile}/applications/{application}", - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=312, - serialized_end=1492, -) - -_APPLICATION.fields_by_name[ - "application_date" -].message_type = google_dot_type_dot_date__pb2._DATE -_APPLICATION.fields_by_name["stage"].enum_type = _APPLICATION_APPLICATIONSTAGE -_APPLICATION.fields_by_name["state"].enum_type = _APPLICATION_APPLICATIONSTATE -_APPLICATION.fields_by_name[ - "interviews" -].message_type = ( - google_dot_cloud_dot_talent__v4beta1_dot_proto_dot_common__pb2._INTERVIEW -) -_APPLICATION.fields_by_name[ - "referral" -].message_type = google_dot_protobuf_dot_wrappers__pb2._BOOLVALUE -_APPLICATION.fields_by_name[ - "create_time" -].message_type = google_dot_protobuf_dot_timestamp__pb2._TIMESTAMP -_APPLICATION.fields_by_name[ - "update_time" -].message_type = google_dot_protobuf_dot_timestamp__pb2._TIMESTAMP -_APPLICATION.fields_by_name[ - "outcome" -].enum_type = google_dot_cloud_dot_talent__v4beta1_dot_proto_dot_common__pb2._OUTCOME -_APPLICATION.fields_by_name[ - "is_match" -].message_type = google_dot_protobuf_dot_wrappers__pb2._BOOLVALUE -_APPLICATION_APPLICATIONSTATE.containing_type = _APPLICATION -_APPLICATION_APPLICATIONSTAGE.containing_type = _APPLICATION -DESCRIPTOR.message_types_by_name["Application"] = _APPLICATION -_sym_db.RegisterFileDescriptor(DESCRIPTOR) - -Application = _reflection.GeneratedProtocolMessageType( - "Application", - (_message.Message,), - { - "DESCRIPTOR": _APPLICATION, - "__module__": "google.cloud.talent_v4beta1.proto.application_pb2", - "__doc__": """Resource that represents a job application record of a candidate. - - Attributes: - name: - Required during application update. Resource name assigned to - an application by the API. The format is “projects/{project_i - d}/tenants/{tenant_id}/profiles/{profile_id}/applications/{app - lication_id}”. For example, - “projects/foo/tenants/bar/profiles/baz/applications/qux”. - external_id: - Required. Client side application identifier, used to uniquely - identify the application. The maximum number of allowed - characters is 255. - profile: - Output only. Resource name of the candidate of this - application. The format is “projects/{project_id}/tenants/{te - nant_id}/profiles/{profile_id}”. For example, - “projects/foo/tenants/bar/profiles/baz”. - job: - Required. Resource name of the job which the candidate applied - for. The format is - “projects/{project_id}/tenants/{tenant_id}/jobs/{job_id}”. For - example, “projects/foo/tenants/bar/jobs/baz”. - company: - Resource name of the company which the candidate applied for. - The format is “projects/{project_id}/tenants/{tenant_id}/compa - nies/{company_id}”. For example, - “projects/foo/tenants/bar/companies/baz”. - application_date: - The application date. - stage: - Required. What is the most recent stage of the application - (that is, new, screen, send cv, hired, finished work)? This - field is intentionally not comprehensive of every possible - status, but instead, represents statuses that would be used to - indicate to the ML models good / bad matches. - state: - The application state. - interviews: - All interviews (screen, onsite, and so on) conducted as part - of this application (includes details such as user conducting - the interview, timestamp, feedback, and so on). - referral: - If the candidate is referred by a employee. - create_time: - Required. Reflects the time that the application was created. - update_time: - The last update timestamp. - outcome_notes: - Free text reason behind the recruitement outcome (for example, - reason for withdraw / reject, reason for an unsuccessful - finish, and so on). Number of characters allowed is 100. - outcome: - Outcome positiveness shows how positive the outcome is. - is_match: - Output only. Indicates whether this job application is a match - to application related filters. This value is only applicable - in profile search response. - job_title_snippet: - Output only. Job title snippet shows how the job title is - related to a search query. It’s empty if the job title isn’t - related to the search query. - """, - # @@protoc_insertion_point(class_scope:google.cloud.talent.v4beta1.Application) - }, -) -_sym_db.RegisterMessage(Application) - - -DESCRIPTOR._options = None -_APPLICATION.fields_by_name["external_id"]._options = None -_APPLICATION.fields_by_name["profile"]._options = None -_APPLICATION.fields_by_name["job"]._options = None -_APPLICATION.fields_by_name["company"]._options = None -_APPLICATION.fields_by_name["stage"]._options = None -_APPLICATION.fields_by_name["create_time"]._options = None -_APPLICATION.fields_by_name["is_match"]._options = None -_APPLICATION.fields_by_name["job_title_snippet"]._options = None -_APPLICATION._options = None -# @@protoc_insertion_point(module_scope) diff --git a/google/cloud/talent_v4beta1/proto/application_pb2_grpc.py b/google/cloud/talent_v4beta1/proto/application_pb2_grpc.py deleted file mode 100644 index 8a939394..00000000 --- a/google/cloud/talent_v4beta1/proto/application_pb2_grpc.py +++ /dev/null @@ -1,3 +0,0 @@ -# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT! -"""Client and server classes corresponding to protobuf-defined services.""" -import grpc diff --git a/google/cloud/talent_v4beta1/proto/application_service_pb2.py b/google/cloud/talent_v4beta1/proto/application_service_pb2.py deleted file mode 100644 index b06ef577..00000000 --- a/google/cloud/talent_v4beta1/proto/application_service_pb2.py +++ /dev/null @@ -1,652 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by the protocol buffer compiler. DO NOT EDIT! -# source: google/cloud/talent_v4beta1/proto/application_service.proto -"""Generated protocol buffer code.""" -from google.protobuf import descriptor as _descriptor -from google.protobuf import message as _message -from google.protobuf import reflection as _reflection -from google.protobuf import symbol_database as _symbol_database - -# @@protoc_insertion_point(imports) - -_sym_db = _symbol_database.Default() - - -from google.api import annotations_pb2 as google_dot_api_dot_annotations__pb2 -from google.api import client_pb2 as google_dot_api_dot_client__pb2 -from google.api import field_behavior_pb2 as google_dot_api_dot_field__behavior__pb2 -from google.api import resource_pb2 as google_dot_api_dot_resource__pb2 -from google.cloud.talent_v4beta1.proto import ( - application_pb2 as google_dot_cloud_dot_talent__v4beta1_dot_proto_dot_application__pb2, -) -from google.cloud.talent_v4beta1.proto import ( - common_pb2 as google_dot_cloud_dot_talent__v4beta1_dot_proto_dot_common__pb2, -) -from google.protobuf import empty_pb2 as google_dot_protobuf_dot_empty__pb2 -from google.protobuf import field_mask_pb2 as google_dot_protobuf_dot_field__mask__pb2 - - -DESCRIPTOR = _descriptor.FileDescriptor( - name="google/cloud/talent_v4beta1/proto/application_service.proto", - package="google.cloud.talent.v4beta1", - syntax="proto3", - serialized_options=b"\n\037com.google.cloud.talent.v4beta1B\027ApplicationServiceProtoP\001ZAgoogle.golang.org/genproto/googleapis/cloud/talent/v4beta1;talent\242\002\003CTS", - create_key=_descriptor._internal_create_key, - serialized_pb=b'\n;google/cloud/talent_v4beta1/proto/application_service.proto\x12\x1bgoogle.cloud.talent.v4beta1\x1a\x1cgoogle/api/annotations.proto\x1a\x17google/api/client.proto\x1a\x1fgoogle/api/field_behavior.proto\x1a\x19google/api/resource.proto\x1a\x33google/cloud/talent_v4beta1/proto/application.proto\x1a.google/cloud/talent_v4beta1/proto/common.proto\x1a\x1bgoogle/protobuf/empty.proto\x1a google/protobuf/field_mask.proto"\x93\x01\n\x18\x43reateApplicationRequest\x12\x33\n\x06parent\x18\x01 \x01(\tB#\xe0\x41\x02\xfa\x41\x1d\n\x1bjobs.googleapis.com/Profile\x12\x42\n\x0b\x61pplication\x18\x02 \x01(\x0b\x32(.google.cloud.talent.v4beta1.ApplicationB\x03\xe0\x41\x02"N\n\x15GetApplicationRequest\x12\x35\n\x04name\x18\x01 \x01(\tB\'\xe0\x41\x02\xfa\x41!\n\x1fjobs.googleapis.com/Application"\x8f\x01\n\x18UpdateApplicationRequest\x12\x42\n\x0b\x61pplication\x18\x01 \x01(\x0b\x32(.google.cloud.talent.v4beta1.ApplicationB\x03\xe0\x41\x02\x12/\n\x0bupdate_mask\x18\x02 \x01(\x0b\x32\x1a.google.protobuf.FieldMask"Q\n\x18\x44\x65leteApplicationRequest\x12\x35\n\x04name\x18\x01 \x01(\tB\'\xe0\x41\x02\xfa\x41!\n\x1fjobs.googleapis.com/Application"u\n\x17ListApplicationsRequest\x12\x33\n\x06parent\x18\x01 \x01(\tB#\xe0\x41\x02\xfa\x41\x1d\n\x1bjobs.googleapis.com/Profile\x12\x12\n\npage_token\x18\x02 \x01(\t\x12\x11\n\tpage_size\x18\x03 \x01(\x05"\xb4\x01\n\x18ListApplicationsResponse\x12>\n\x0c\x61pplications\x18\x01 \x03(\x0b\x32(.google.cloud.talent.v4beta1.Application\x12\x17\n\x0fnext_page_token\x18\x02 \x01(\t\x12?\n\x08metadata\x18\x03 \x01(\x0b\x32-.google.cloud.talent.v4beta1.ResponseMetadata2\xfc\x08\n\x12\x41pplicationService\x12\xd4\x01\n\x11\x43reateApplication\x12\x35.google.cloud.talent.v4beta1.CreateApplicationRequest\x1a(.google.cloud.talent.v4beta1.Application"^\x82\xd3\xe4\x93\x02\x43">/v4beta1/{parent=projects/*/tenants/*/profiles/*}/applications:\x01*\xda\x41\x12parent,application\x12\xbd\x01\n\x0eGetApplication\x12\x32.google.cloud.talent.v4beta1.GetApplicationRequest\x1a(.google.cloud.talent.v4beta1.Application"M\x82\xd3\xe4\x93\x02@\x12>/v4beta1/{name=projects/*/tenants/*/profiles/*/applications/*}\xda\x41\x04name\x12\xd9\x01\n\x11UpdateApplication\x12\x35.google.cloud.talent.v4beta1.UpdateApplicationRequest\x1a(.google.cloud.talent.v4beta1.Application"c\x82\xd3\xe4\x93\x02O2J/v4beta1/{application.name=projects/*/tenants/*/profiles/*/applications/*}:\x01*\xda\x41\x0b\x61pplication\x12\xb1\x01\n\x11\x44\x65leteApplication\x12\x35.google.cloud.talent.v4beta1.DeleteApplicationRequest\x1a\x16.google.protobuf.Empty"M\x82\xd3\xe4\x93\x02@*>/v4beta1/{name=projects/*/tenants/*/profiles/*/applications/*}\xda\x41\x04name\x12\xd0\x01\n\x10ListApplications\x12\x34.google.cloud.talent.v4beta1.ListApplicationsRequest\x1a\x35.google.cloud.talent.v4beta1.ListApplicationsResponse"O\x82\xd3\xe4\x93\x02@\x12>/v4beta1/{parent=projects/*/tenants/*/profiles/*}/applications\xda\x41\x06parent\x1al\xca\x41\x13jobs.googleapis.com\xd2\x41Shttps://www.googleapis.com/auth/cloud-platform,https://www.googleapis.com/auth/jobsB\x85\x01\n\x1f\x63om.google.cloud.talent.v4beta1B\x17\x41pplicationServiceProtoP\x01ZAgoogle.golang.org/genproto/googleapis/cloud/talent/v4beta1;talent\xa2\x02\x03\x43TSb\x06proto3', - dependencies=[ - google_dot_api_dot_annotations__pb2.DESCRIPTOR, - google_dot_api_dot_client__pb2.DESCRIPTOR, - google_dot_api_dot_field__behavior__pb2.DESCRIPTOR, - google_dot_api_dot_resource__pb2.DESCRIPTOR, - google_dot_cloud_dot_talent__v4beta1_dot_proto_dot_application__pb2.DESCRIPTOR, - google_dot_cloud_dot_talent__v4beta1_dot_proto_dot_common__pb2.DESCRIPTOR, - google_dot_protobuf_dot_empty__pb2.DESCRIPTOR, - google_dot_protobuf_dot_field__mask__pb2.DESCRIPTOR, - ], -) - - -_CREATEAPPLICATIONREQUEST = _descriptor.Descriptor( - name="CreateApplicationRequest", - full_name="google.cloud.talent.v4beta1.CreateApplicationRequest", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="parent", - full_name="google.cloud.talent.v4beta1.CreateApplicationRequest.parent", - index=0, - number=1, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\002\372A\035\n\033jobs.googleapis.com/Profile", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="application", - full_name="google.cloud.talent.v4beta1.CreateApplicationRequest.application", - index=1, - number=2, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\002", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=372, - serialized_end=519, -) - - -_GETAPPLICATIONREQUEST = _descriptor.Descriptor( - name="GetApplicationRequest", - full_name="google.cloud.talent.v4beta1.GetApplicationRequest", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="name", - full_name="google.cloud.talent.v4beta1.GetApplicationRequest.name", - index=0, - number=1, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\002\372A!\n\037jobs.googleapis.com/Application", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=521, - serialized_end=599, -) - - -_UPDATEAPPLICATIONREQUEST = _descriptor.Descriptor( - name="UpdateApplicationRequest", - full_name="google.cloud.talent.v4beta1.UpdateApplicationRequest", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="application", - full_name="google.cloud.talent.v4beta1.UpdateApplicationRequest.application", - index=0, - number=1, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\002", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="update_mask", - full_name="google.cloud.talent.v4beta1.UpdateApplicationRequest.update_mask", - index=1, - number=2, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=602, - serialized_end=745, -) - - -_DELETEAPPLICATIONREQUEST = _descriptor.Descriptor( - name="DeleteApplicationRequest", - full_name="google.cloud.talent.v4beta1.DeleteApplicationRequest", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="name", - full_name="google.cloud.talent.v4beta1.DeleteApplicationRequest.name", - index=0, - number=1, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\002\372A!\n\037jobs.googleapis.com/Application", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=747, - serialized_end=828, -) - - -_LISTAPPLICATIONSREQUEST = _descriptor.Descriptor( - name="ListApplicationsRequest", - full_name="google.cloud.talent.v4beta1.ListApplicationsRequest", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="parent", - full_name="google.cloud.talent.v4beta1.ListApplicationsRequest.parent", - index=0, - number=1, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\002\372A\035\n\033jobs.googleapis.com/Profile", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="page_token", - full_name="google.cloud.talent.v4beta1.ListApplicationsRequest.page_token", - index=1, - number=2, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="page_size", - full_name="google.cloud.talent.v4beta1.ListApplicationsRequest.page_size", - index=2, - number=3, - type=5, - cpp_type=1, - label=1, - has_default_value=False, - default_value=0, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=830, - serialized_end=947, -) - - -_LISTAPPLICATIONSRESPONSE = _descriptor.Descriptor( - name="ListApplicationsResponse", - full_name="google.cloud.talent.v4beta1.ListApplicationsResponse", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="applications", - full_name="google.cloud.talent.v4beta1.ListApplicationsResponse.applications", - index=0, - number=1, - type=11, - cpp_type=10, - label=3, - has_default_value=False, - default_value=[], - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="next_page_token", - full_name="google.cloud.talent.v4beta1.ListApplicationsResponse.next_page_token", - index=1, - number=2, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="metadata", - full_name="google.cloud.talent.v4beta1.ListApplicationsResponse.metadata", - index=2, - number=3, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=950, - serialized_end=1130, -) - -_CREATEAPPLICATIONREQUEST.fields_by_name[ - "application" -].message_type = ( - google_dot_cloud_dot_talent__v4beta1_dot_proto_dot_application__pb2._APPLICATION -) -_UPDATEAPPLICATIONREQUEST.fields_by_name[ - "application" -].message_type = ( - google_dot_cloud_dot_talent__v4beta1_dot_proto_dot_application__pb2._APPLICATION -) -_UPDATEAPPLICATIONREQUEST.fields_by_name[ - "update_mask" -].message_type = google_dot_protobuf_dot_field__mask__pb2._FIELDMASK -_LISTAPPLICATIONSRESPONSE.fields_by_name[ - "applications" -].message_type = ( - google_dot_cloud_dot_talent__v4beta1_dot_proto_dot_application__pb2._APPLICATION -) -_LISTAPPLICATIONSRESPONSE.fields_by_name[ - "metadata" -].message_type = ( - google_dot_cloud_dot_talent__v4beta1_dot_proto_dot_common__pb2._RESPONSEMETADATA -) -DESCRIPTOR.message_types_by_name["CreateApplicationRequest"] = _CREATEAPPLICATIONREQUEST -DESCRIPTOR.message_types_by_name["GetApplicationRequest"] = _GETAPPLICATIONREQUEST -DESCRIPTOR.message_types_by_name["UpdateApplicationRequest"] = _UPDATEAPPLICATIONREQUEST -DESCRIPTOR.message_types_by_name["DeleteApplicationRequest"] = _DELETEAPPLICATIONREQUEST -DESCRIPTOR.message_types_by_name["ListApplicationsRequest"] = _LISTAPPLICATIONSREQUEST -DESCRIPTOR.message_types_by_name["ListApplicationsResponse"] = _LISTAPPLICATIONSRESPONSE -_sym_db.RegisterFileDescriptor(DESCRIPTOR) - -CreateApplicationRequest = _reflection.GeneratedProtocolMessageType( - "CreateApplicationRequest", - (_message.Message,), - { - "DESCRIPTOR": _CREATEAPPLICATIONREQUEST, - "__module__": "google.cloud.talent_v4beta1.proto.application_service_pb2", - "__doc__": """The Request of the CreateApplication method. - - Attributes: - parent: - Required. Resource name of the profile under which the - application is created. The format is “projects/{project_id}/ - tenants/{tenant_id}/profiles/{profile_id}”. For example, - “projects/foo/tenants/bar/profiles/baz”. - application: - Required. The application to be created. - """, - # @@protoc_insertion_point(class_scope:google.cloud.talent.v4beta1.CreateApplicationRequest) - }, -) -_sym_db.RegisterMessage(CreateApplicationRequest) - -GetApplicationRequest = _reflection.GeneratedProtocolMessageType( - "GetApplicationRequest", - (_message.Message,), - { - "DESCRIPTOR": _GETAPPLICATIONREQUEST, - "__module__": "google.cloud.talent_v4beta1.proto.application_service_pb2", - "__doc__": """Request for getting a application by name. - - Attributes: - name: - Required. The resource name of the application to be - retrieved. The format is “projects/{project_id}/tenants/{tena - nt_id}/profiles/{profile_id}/applications/{application_id}”. - For example, - “projects/foo/tenants/bar/profiles/baz/applications/qux”. - """, - # @@protoc_insertion_point(class_scope:google.cloud.talent.v4beta1.GetApplicationRequest) - }, -) -_sym_db.RegisterMessage(GetApplicationRequest) - -UpdateApplicationRequest = _reflection.GeneratedProtocolMessageType( - "UpdateApplicationRequest", - (_message.Message,), - { - "DESCRIPTOR": _UPDATEAPPLICATIONREQUEST, - "__module__": "google.cloud.talent_v4beta1.proto.application_service_pb2", - "__doc__": """Request for updating a specified application. - - Attributes: - application: - Required. The application resource to replace the current - resource in the system. - update_mask: - Strongly recommended for the best service experience. If [upd - ate_mask][google.cloud.talent.v4beta1.UpdateApplicationRequest - .update_mask] is provided, only the specified fields in [appli - cation][google.cloud.talent.v4beta1.UpdateApplicationRequest.a - pplication] are updated. Otherwise all the fields are updated. - A field mask to specify the application fields to be updated. - Only top level fields of - [Application][google.cloud.talent.v4beta1.Application] are - supported. - """, - # @@protoc_insertion_point(class_scope:google.cloud.talent.v4beta1.UpdateApplicationRequest) - }, -) -_sym_db.RegisterMessage(UpdateApplicationRequest) - -DeleteApplicationRequest = _reflection.GeneratedProtocolMessageType( - "DeleteApplicationRequest", - (_message.Message,), - { - "DESCRIPTOR": _DELETEAPPLICATIONREQUEST, - "__module__": "google.cloud.talent_v4beta1.proto.application_service_pb2", - "__doc__": """Request to delete a application. - - Attributes: - name: - Required. The resource name of the application to be deleted. - The format is “projects/{project_id}/tenants/{tenant_id}/profi - les/{profile_id}/applications/{application_id}”. For example, - “projects/foo/tenants/bar/profiles/baz/applications/qux”. - """, - # @@protoc_insertion_point(class_scope:google.cloud.talent.v4beta1.DeleteApplicationRequest) - }, -) -_sym_db.RegisterMessage(DeleteApplicationRequest) - -ListApplicationsRequest = _reflection.GeneratedProtocolMessageType( - "ListApplicationsRequest", - (_message.Message,), - { - "DESCRIPTOR": _LISTAPPLICATIONSREQUEST, - "__module__": "google.cloud.talent_v4beta1.proto.application_service_pb2", - "__doc__": """List applications for which the client has ACL visibility. - - Attributes: - parent: - Required. Resource name of the profile under which the - application is created. The format is “projects/{project_id}/ - tenants/{tenant_id}/profiles/{profile_id}”, for example, - “projects/foo/tenants/bar/profiles/baz”. - page_token: - The starting indicator from which to return results. - page_size: - The maximum number of applications to be returned, at most - 100. Default is 100 if a non-positive number is provided. - """, - # @@protoc_insertion_point(class_scope:google.cloud.talent.v4beta1.ListApplicationsRequest) - }, -) -_sym_db.RegisterMessage(ListApplicationsRequest) - -ListApplicationsResponse = _reflection.GeneratedProtocolMessageType( - "ListApplicationsResponse", - (_message.Message,), - { - "DESCRIPTOR": _LISTAPPLICATIONSRESPONSE, - "__module__": "google.cloud.talent_v4beta1.proto.application_service_pb2", - "__doc__": """The List applications response object. - - Attributes: - applications: - Applications for the current client. - next_page_token: - A token to retrieve the next page of results. - metadata: - Additional information for the API invocation, such as the - request tracking id. - """, - # @@protoc_insertion_point(class_scope:google.cloud.talent.v4beta1.ListApplicationsResponse) - }, -) -_sym_db.RegisterMessage(ListApplicationsResponse) - - -DESCRIPTOR._options = None -_CREATEAPPLICATIONREQUEST.fields_by_name["parent"]._options = None -_CREATEAPPLICATIONREQUEST.fields_by_name["application"]._options = None -_GETAPPLICATIONREQUEST.fields_by_name["name"]._options = None -_UPDATEAPPLICATIONREQUEST.fields_by_name["application"]._options = None -_DELETEAPPLICATIONREQUEST.fields_by_name["name"]._options = None -_LISTAPPLICATIONSREQUEST.fields_by_name["parent"]._options = None - -_APPLICATIONSERVICE = _descriptor.ServiceDescriptor( - name="ApplicationService", - full_name="google.cloud.talent.v4beta1.ApplicationService", - file=DESCRIPTOR, - index=0, - serialized_options=b"\312A\023jobs.googleapis.com\322AShttps://www.googleapis.com/auth/cloud-platform,https://www.googleapis.com/auth/jobs", - create_key=_descriptor._internal_create_key, - serialized_start=1133, - serialized_end=2281, - methods=[ - _descriptor.MethodDescriptor( - name="CreateApplication", - full_name="google.cloud.talent.v4beta1.ApplicationService.CreateApplication", - index=0, - containing_service=None, - input_type=_CREATEAPPLICATIONREQUEST, - output_type=google_dot_cloud_dot_talent__v4beta1_dot_proto_dot_application__pb2._APPLICATION, - serialized_options=b'\202\323\344\223\002C">/v4beta1/{parent=projects/*/tenants/*/profiles/*}/applications:\001*\332A\022parent,application', - create_key=_descriptor._internal_create_key, - ), - _descriptor.MethodDescriptor( - name="GetApplication", - full_name="google.cloud.talent.v4beta1.ApplicationService.GetApplication", - index=1, - containing_service=None, - input_type=_GETAPPLICATIONREQUEST, - output_type=google_dot_cloud_dot_talent__v4beta1_dot_proto_dot_application__pb2._APPLICATION, - serialized_options=b"\202\323\344\223\002@\022>/v4beta1/{name=projects/*/tenants/*/profiles/*/applications/*}\332A\004name", - create_key=_descriptor._internal_create_key, - ), - _descriptor.MethodDescriptor( - name="UpdateApplication", - full_name="google.cloud.talent.v4beta1.ApplicationService.UpdateApplication", - index=2, - containing_service=None, - input_type=_UPDATEAPPLICATIONREQUEST, - output_type=google_dot_cloud_dot_talent__v4beta1_dot_proto_dot_application__pb2._APPLICATION, - serialized_options=b"\202\323\344\223\002O2J/v4beta1/{application.name=projects/*/tenants/*/profiles/*/applications/*}:\001*\332A\013application", - create_key=_descriptor._internal_create_key, - ), - _descriptor.MethodDescriptor( - name="DeleteApplication", - full_name="google.cloud.talent.v4beta1.ApplicationService.DeleteApplication", - index=3, - containing_service=None, - input_type=_DELETEAPPLICATIONREQUEST, - output_type=google_dot_protobuf_dot_empty__pb2._EMPTY, - serialized_options=b"\202\323\344\223\002@*>/v4beta1/{name=projects/*/tenants/*/profiles/*/applications/*}\332A\004name", - create_key=_descriptor._internal_create_key, - ), - _descriptor.MethodDescriptor( - name="ListApplications", - full_name="google.cloud.talent.v4beta1.ApplicationService.ListApplications", - index=4, - containing_service=None, - input_type=_LISTAPPLICATIONSREQUEST, - output_type=_LISTAPPLICATIONSRESPONSE, - serialized_options=b"\202\323\344\223\002@\022>/v4beta1/{parent=projects/*/tenants/*/profiles/*}/applications\332A\006parent", - create_key=_descriptor._internal_create_key, - ), - ], -) -_sym_db.RegisterServiceDescriptor(_APPLICATIONSERVICE) - -DESCRIPTOR.services_by_name["ApplicationService"] = _APPLICATIONSERVICE - -# @@protoc_insertion_point(module_scope) diff --git a/google/cloud/talent_v4beta1/proto/application_service_pb2_grpc.py b/google/cloud/talent_v4beta1/proto/application_service_pb2_grpc.py deleted file mode 100644 index c1eb0953..00000000 --- a/google/cloud/talent_v4beta1/proto/application_service_pb2_grpc.py +++ /dev/null @@ -1,266 +0,0 @@ -# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT! -"""Client and server classes corresponding to protobuf-defined services.""" -import grpc - -from google.cloud.talent_v4beta1.proto import ( - application_pb2 as google_dot_cloud_dot_talent__v4beta1_dot_proto_dot_application__pb2, -) -from google.cloud.talent_v4beta1.proto import ( - application_service_pb2 as google_dot_cloud_dot_talent__v4beta1_dot_proto_dot_application__service__pb2, -) -from google.protobuf import empty_pb2 as google_dot_protobuf_dot_empty__pb2 - - -class ApplicationServiceStub(object): - """A service that handles application management, including CRUD and - enumeration. - """ - - def __init__(self, channel): - """Constructor. - - Args: - channel: A grpc.Channel. - """ - self.CreateApplication = channel.unary_unary( - "/google.cloud.talent.v4beta1.ApplicationService/CreateApplication", - request_serializer=google_dot_cloud_dot_talent__v4beta1_dot_proto_dot_application__service__pb2.CreateApplicationRequest.SerializeToString, - response_deserializer=google_dot_cloud_dot_talent__v4beta1_dot_proto_dot_application__pb2.Application.FromString, - ) - self.GetApplication = channel.unary_unary( - "/google.cloud.talent.v4beta1.ApplicationService/GetApplication", - request_serializer=google_dot_cloud_dot_talent__v4beta1_dot_proto_dot_application__service__pb2.GetApplicationRequest.SerializeToString, - response_deserializer=google_dot_cloud_dot_talent__v4beta1_dot_proto_dot_application__pb2.Application.FromString, - ) - self.UpdateApplication = channel.unary_unary( - "/google.cloud.talent.v4beta1.ApplicationService/UpdateApplication", - request_serializer=google_dot_cloud_dot_talent__v4beta1_dot_proto_dot_application__service__pb2.UpdateApplicationRequest.SerializeToString, - response_deserializer=google_dot_cloud_dot_talent__v4beta1_dot_proto_dot_application__pb2.Application.FromString, - ) - self.DeleteApplication = channel.unary_unary( - "/google.cloud.talent.v4beta1.ApplicationService/DeleteApplication", - request_serializer=google_dot_cloud_dot_talent__v4beta1_dot_proto_dot_application__service__pb2.DeleteApplicationRequest.SerializeToString, - response_deserializer=google_dot_protobuf_dot_empty__pb2.Empty.FromString, - ) - self.ListApplications = channel.unary_unary( - "/google.cloud.talent.v4beta1.ApplicationService/ListApplications", - request_serializer=google_dot_cloud_dot_talent__v4beta1_dot_proto_dot_application__service__pb2.ListApplicationsRequest.SerializeToString, - response_deserializer=google_dot_cloud_dot_talent__v4beta1_dot_proto_dot_application__service__pb2.ListApplicationsResponse.FromString, - ) - - -class ApplicationServiceServicer(object): - """A service that handles application management, including CRUD and - enumeration. - """ - - def CreateApplication(self, request, context): - """Creates a new application entity. - """ - context.set_code(grpc.StatusCode.UNIMPLEMENTED) - context.set_details("Method not implemented!") - raise NotImplementedError("Method not implemented!") - - def GetApplication(self, request, context): - """Retrieves specified application. - """ - context.set_code(grpc.StatusCode.UNIMPLEMENTED) - context.set_details("Method not implemented!") - raise NotImplementedError("Method not implemented!") - - def UpdateApplication(self, request, context): - """Updates specified application. - """ - context.set_code(grpc.StatusCode.UNIMPLEMENTED) - context.set_details("Method not implemented!") - raise NotImplementedError("Method not implemented!") - - def DeleteApplication(self, request, context): - """Deletes specified application. - """ - context.set_code(grpc.StatusCode.UNIMPLEMENTED) - context.set_details("Method not implemented!") - raise NotImplementedError("Method not implemented!") - - def ListApplications(self, request, context): - """Lists all applications associated with the profile. - """ - context.set_code(grpc.StatusCode.UNIMPLEMENTED) - context.set_details("Method not implemented!") - raise NotImplementedError("Method not implemented!") - - -def add_ApplicationServiceServicer_to_server(servicer, server): - rpc_method_handlers = { - "CreateApplication": grpc.unary_unary_rpc_method_handler( - servicer.CreateApplication, - request_deserializer=google_dot_cloud_dot_talent__v4beta1_dot_proto_dot_application__service__pb2.CreateApplicationRequest.FromString, - response_serializer=google_dot_cloud_dot_talent__v4beta1_dot_proto_dot_application__pb2.Application.SerializeToString, - ), - "GetApplication": grpc.unary_unary_rpc_method_handler( - servicer.GetApplication, - request_deserializer=google_dot_cloud_dot_talent__v4beta1_dot_proto_dot_application__service__pb2.GetApplicationRequest.FromString, - response_serializer=google_dot_cloud_dot_talent__v4beta1_dot_proto_dot_application__pb2.Application.SerializeToString, - ), - "UpdateApplication": grpc.unary_unary_rpc_method_handler( - servicer.UpdateApplication, - request_deserializer=google_dot_cloud_dot_talent__v4beta1_dot_proto_dot_application__service__pb2.UpdateApplicationRequest.FromString, - response_serializer=google_dot_cloud_dot_talent__v4beta1_dot_proto_dot_application__pb2.Application.SerializeToString, - ), - "DeleteApplication": grpc.unary_unary_rpc_method_handler( - servicer.DeleteApplication, - request_deserializer=google_dot_cloud_dot_talent__v4beta1_dot_proto_dot_application__service__pb2.DeleteApplicationRequest.FromString, - response_serializer=google_dot_protobuf_dot_empty__pb2.Empty.SerializeToString, - ), - "ListApplications": grpc.unary_unary_rpc_method_handler( - servicer.ListApplications, - request_deserializer=google_dot_cloud_dot_talent__v4beta1_dot_proto_dot_application__service__pb2.ListApplicationsRequest.FromString, - response_serializer=google_dot_cloud_dot_talent__v4beta1_dot_proto_dot_application__service__pb2.ListApplicationsResponse.SerializeToString, - ), - } - generic_handler = grpc.method_handlers_generic_handler( - "google.cloud.talent.v4beta1.ApplicationService", rpc_method_handlers - ) - server.add_generic_rpc_handlers((generic_handler,)) - - -# This class is part of an EXPERIMENTAL API. -class ApplicationService(object): - """A service that handles application management, including CRUD and - enumeration. - """ - - @staticmethod - def CreateApplication( - request, - target, - options=(), - channel_credentials=None, - call_credentials=None, - compression=None, - wait_for_ready=None, - timeout=None, - metadata=None, - ): - return grpc.experimental.unary_unary( - request, - target, - "/google.cloud.talent.v4beta1.ApplicationService/CreateApplication", - google_dot_cloud_dot_talent__v4beta1_dot_proto_dot_application__service__pb2.CreateApplicationRequest.SerializeToString, - google_dot_cloud_dot_talent__v4beta1_dot_proto_dot_application__pb2.Application.FromString, - options, - channel_credentials, - call_credentials, - compression, - wait_for_ready, - timeout, - metadata, - ) - - @staticmethod - def GetApplication( - request, - target, - options=(), - channel_credentials=None, - call_credentials=None, - compression=None, - wait_for_ready=None, - timeout=None, - metadata=None, - ): - return grpc.experimental.unary_unary( - request, - target, - "/google.cloud.talent.v4beta1.ApplicationService/GetApplication", - google_dot_cloud_dot_talent__v4beta1_dot_proto_dot_application__service__pb2.GetApplicationRequest.SerializeToString, - google_dot_cloud_dot_talent__v4beta1_dot_proto_dot_application__pb2.Application.FromString, - options, - channel_credentials, - call_credentials, - compression, - wait_for_ready, - timeout, - metadata, - ) - - @staticmethod - def UpdateApplication( - request, - target, - options=(), - channel_credentials=None, - call_credentials=None, - compression=None, - wait_for_ready=None, - timeout=None, - metadata=None, - ): - return grpc.experimental.unary_unary( - request, - target, - "/google.cloud.talent.v4beta1.ApplicationService/UpdateApplication", - google_dot_cloud_dot_talent__v4beta1_dot_proto_dot_application__service__pb2.UpdateApplicationRequest.SerializeToString, - google_dot_cloud_dot_talent__v4beta1_dot_proto_dot_application__pb2.Application.FromString, - options, - channel_credentials, - call_credentials, - compression, - wait_for_ready, - timeout, - metadata, - ) - - @staticmethod - def DeleteApplication( - request, - target, - options=(), - channel_credentials=None, - call_credentials=None, - compression=None, - wait_for_ready=None, - timeout=None, - metadata=None, - ): - return grpc.experimental.unary_unary( - request, - target, - "/google.cloud.talent.v4beta1.ApplicationService/DeleteApplication", - google_dot_cloud_dot_talent__v4beta1_dot_proto_dot_application__service__pb2.DeleteApplicationRequest.SerializeToString, - google_dot_protobuf_dot_empty__pb2.Empty.FromString, - options, - channel_credentials, - call_credentials, - compression, - wait_for_ready, - timeout, - metadata, - ) - - @staticmethod - def ListApplications( - request, - target, - options=(), - channel_credentials=None, - call_credentials=None, - compression=None, - wait_for_ready=None, - timeout=None, - metadata=None, - ): - return grpc.experimental.unary_unary( - request, - target, - "/google.cloud.talent.v4beta1.ApplicationService/ListApplications", - google_dot_cloud_dot_talent__v4beta1_dot_proto_dot_application__service__pb2.ListApplicationsRequest.SerializeToString, - google_dot_cloud_dot_talent__v4beta1_dot_proto_dot_application__service__pb2.ListApplicationsResponse.FromString, - options, - channel_credentials, - call_credentials, - compression, - wait_for_ready, - timeout, - metadata, - ) diff --git a/google/cloud/talent_v4beta1/proto/batch_pb2.py b/google/cloud/talent_v4beta1/proto/batch_pb2.py deleted file mode 100644 index 51ac00de..00000000 --- a/google/cloud/talent_v4beta1/proto/batch_pb2.py +++ /dev/null @@ -1,33 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by the protocol buffer compiler. DO NOT EDIT! -# source: google/cloud/talent_v4beta1/proto/batch.proto -"""Generated protocol buffer code.""" -from google.protobuf import descriptor as _descriptor -from google.protobuf import message as _message -from google.protobuf import reflection as _reflection -from google.protobuf import symbol_database as _symbol_database - -# @@protoc_insertion_point(imports) - -_sym_db = _symbol_database.Default() - - -from google.api import annotations_pb2 as google_dot_api_dot_annotations__pb2 - - -DESCRIPTOR = _descriptor.FileDescriptor( - name="google/cloud/talent_v4beta1/proto/batch.proto", - package="google.cloud.talent.v4beta1", - syntax="proto3", - serialized_options=b"\n\037com.google.cloud.talent.v4beta1B\nBatchProtoP\001ZAgoogle.golang.org/genproto/googleapis/cloud/talent/v4beta1;talent\242\002\003CTS", - create_key=_descriptor._internal_create_key, - serialized_pb=b"\n-google/cloud/talent_v4beta1/proto/batch.proto\x12\x1bgoogle.cloud.talent.v4beta1\x1a\x1cgoogle/api/annotations.protoBx\n\x1f\x63om.google.cloud.talent.v4beta1B\nBatchProtoP\x01ZAgoogle.golang.org/genproto/googleapis/cloud/talent/v4beta1;talent\xa2\x02\x03\x43TSb\x06proto3", - dependencies=[google_dot_api_dot_annotations__pb2.DESCRIPTOR,], -) - - -_sym_db.RegisterFileDescriptor(DESCRIPTOR) - - -DESCRIPTOR._options = None -# @@protoc_insertion_point(module_scope) diff --git a/google/cloud/talent_v4beta1/proto/batch_pb2_grpc.py b/google/cloud/talent_v4beta1/proto/batch_pb2_grpc.py deleted file mode 100644 index 8a939394..00000000 --- a/google/cloud/talent_v4beta1/proto/batch_pb2_grpc.py +++ /dev/null @@ -1,3 +0,0 @@ -# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT! -"""Client and server classes corresponding to protobuf-defined services.""" -import grpc diff --git a/google/cloud/talent_v4beta1/proto/common_pb2.py b/google/cloud/talent_v4beta1/proto/common_pb2.py deleted file mode 100644 index 2c48fafc..00000000 --- a/google/cloud/talent_v4beta1/proto/common_pb2.py +++ /dev/null @@ -1,3711 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by the protocol buffer compiler. DO NOT EDIT! -# source: google/cloud/talent_v4beta1/proto/common.proto -"""Generated protocol buffer code.""" -from google.protobuf.internal import enum_type_wrapper -from google.protobuf import descriptor as _descriptor -from google.protobuf import message as _message -from google.protobuf import reflection as _reflection -from google.protobuf import symbol_database as _symbol_database - -# @@protoc_insertion_point(imports) - -_sym_db = _symbol_database.Default() - - -from google.api import field_behavior_pb2 as google_dot_api_dot_field__behavior__pb2 -from google.protobuf import timestamp_pb2 as google_dot_protobuf_dot_timestamp__pb2 -from google.protobuf import wrappers_pb2 as google_dot_protobuf_dot_wrappers__pb2 -from google.type import date_pb2 as google_dot_type_dot_date__pb2 -from google.type import latlng_pb2 as google_dot_type_dot_latlng__pb2 -from google.type import money_pb2 as google_dot_type_dot_money__pb2 -from google.type import postal_address_pb2 as google_dot_type_dot_postal__address__pb2 -from google.type import timeofday_pb2 as google_dot_type_dot_timeofday__pb2 -from google.api import annotations_pb2 as google_dot_api_dot_annotations__pb2 - - -DESCRIPTOR = _descriptor.FileDescriptor( - name="google/cloud/talent_v4beta1/proto/common.proto", - package="google.cloud.talent.v4beta1", - syntax="proto3", - serialized_options=b"\n\037com.google.cloud.talent.v4beta1B\013CommonProtoP\001ZAgoogle.golang.org/genproto/googleapis/cloud/talent/v4beta1;talent\242\002\003CTS", - create_key=_descriptor._internal_create_key, - serialized_pb=b'\n.google/cloud/talent_v4beta1/proto/common.proto\x12\x1bgoogle.cloud.talent.v4beta1\x1a\x1fgoogle/api/field_behavior.proto\x1a\x1fgoogle/protobuf/timestamp.proto\x1a\x1egoogle/protobuf/wrappers.proto\x1a\x16google/type/date.proto\x1a\x18google/type/latlng.proto\x1a\x17google/type/money.proto\x1a google/type/postal_address.proto\x1a\x1bgoogle/type/timeofday.proto\x1a\x1cgoogle/api/annotations.proto"n\n\x0eTimestampRange\x12.\n\nstart_time\x18\x01 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12,\n\x08\x65nd_time\x18\x02 \x01(\x0b\x32\x1a.google.protobuf.Timestamp"\xb7\x03\n\x08Location\x12I\n\rlocation_type\x18\x01 \x01(\x0e\x32\x32.google.cloud.talent.v4beta1.Location.LocationType\x12\x32\n\x0epostal_address\x18\x02 \x01(\x0b\x32\x1a.google.type.PostalAddress\x12$\n\x07lat_lng\x18\x03 \x01(\x0b\x32\x13.google.type.LatLng\x12\x14\n\x0cradius_miles\x18\x04 \x01(\x01"\xef\x01\n\x0cLocationType\x12\x1d\n\x19LOCATION_TYPE_UNSPECIFIED\x10\x00\x12\x0b\n\x07\x43OUNTRY\x10\x01\x12\x17\n\x13\x41\x44MINISTRATIVE_AREA\x10\x02\x12\x1b\n\x17SUB_ADMINISTRATIVE_AREA\x10\x03\x12\x0c\n\x08LOCALITY\x10\x04\x12\x0f\n\x0bPOSTAL_CODE\x10\x05\x12\x10\n\x0cSUB_LOCALITY\x10\x06\x12\x12\n\x0eSUB_LOCALITY_1\x10\x07\x12\x12\n\x0eSUB_LOCALITY_2\x10\x08\x12\x10\n\x0cNEIGHBORHOOD\x10\t\x12\x12\n\x0eSTREET_ADDRESS\x10\n"\x9f\x01\n\x0fRequestMetadata\x12\x0e\n\x06\x64omain\x18\x01 \x01(\t\x12\x12\n\nsession_id\x18\x02 \x01(\t\x12\x0f\n\x07user_id\x18\x03 \x01(\t\x12\x19\n\x11\x61llow_missing_ids\x18\x04 \x01(\x08\x12<\n\x0b\x64\x65vice_info\x18\x05 \x01(\x0b\x32\'.google.cloud.talent.v4beta1.DeviceInfo"&\n\x10ResponseMetadata\x12\x12\n\nrequest_id\x18\x01 \x01(\t"\xcf\x01\n\nDeviceInfo\x12G\n\x0b\x64\x65vice_type\x18\x01 \x01(\x0e\x32\x32.google.cloud.talent.v4beta1.DeviceInfo.DeviceType\x12\n\n\x02id\x18\x02 \x01(\t"l\n\nDeviceType\x12\x1b\n\x17\x44\x45VICE_TYPE_UNSPECIFIED\x10\x00\x12\x07\n\x03WEB\x10\x01\x12\x0e\n\nMOBILE_WEB\x10\x02\x12\x0b\n\x07\x41NDROID\x10\x03\x12\x07\n\x03IOS\x10\x04\x12\x07\n\x03\x42OT\x10\x05\x12\t\n\x05OTHER\x10\x06"Q\n\x0f\x43ustomAttribute\x12\x15\n\rstring_values\x18\x01 \x03(\t\x12\x13\n\x0blong_values\x18\x02 \x03(\x03\x12\x12\n\nfilterable\x18\x03 \x01(\x08"W\n\x12SpellingCorrection\x12\x11\n\tcorrected\x18\x01 \x01(\x08\x12\x16\n\x0e\x63orrected_text\x18\x02 \x01(\t\x12\x16\n\x0e\x63orrected_html\x18\x03 \x01(\t"\xa6\t\n\x10\x43ompensationInfo\x12P\n\x07\x65ntries\x18\x01 \x03(\x0b\x32?.google.cloud.talent.v4beta1.CompensationInfo.CompensationEntry\x12p\n"annualized_base_compensation_range\x18\x02 \x01(\x0b\x32?.google.cloud.talent.v4beta1.CompensationInfo.CompensationRangeB\x03\xe0\x41\x03\x12q\n#annualized_total_compensation_range\x18\x03 \x01(\x0b\x32?.google.cloud.talent.v4beta1.CompensationInfo.CompensationRangeB\x03\xe0\x41\x03\x1a\x92\x03\n\x11\x43ompensationEntry\x12L\n\x04type\x18\x01 \x01(\x0e\x32>.google.cloud.talent.v4beta1.CompensationInfo.CompensationType\x12L\n\x04unit\x18\x02 \x01(\x0e\x32>.google.cloud.talent.v4beta1.CompensationInfo.CompensationUnit\x12$\n\x06\x61mount\x18\x03 \x01(\x0b\x32\x12.google.type.MoneyH\x00\x12P\n\x05range\x18\x04 \x01(\x0b\x32?.google.cloud.talent.v4beta1.CompensationInfo.CompensationRangeH\x00\x12\x13\n\x0b\x64\x65scription\x18\x05 \x01(\t\x12=\n\x17\x65xpected_units_per_year\x18\x06 \x01(\x0b\x32\x1c.google.protobuf.DoubleValueB\x15\n\x13\x63ompensation_amount\x1ao\n\x11\x43ompensationRange\x12,\n\x10max_compensation\x18\x02 \x01(\x0b\x32\x12.google.type.Money\x12,\n\x10min_compensation\x18\x01 \x01(\x0b\x32\x12.google.type.Money"\xb5\x01\n\x10\x43ompensationType\x12!\n\x1d\x43OMPENSATION_TYPE_UNSPECIFIED\x10\x00\x12\x08\n\x04\x42\x41SE\x10\x01\x12\t\n\x05\x42ONUS\x10\x02\x12\x11\n\rSIGNING_BONUS\x10\x03\x12\n\n\x06\x45QUITY\x10\x04\x12\x12\n\x0ePROFIT_SHARING\x10\x05\x12\x0f\n\x0b\x43OMMISSIONS\x10\x06\x12\x08\n\x04TIPS\x10\x07\x12\x1b\n\x17OTHER_COMPENSATION_TYPE\x10\x08"\x9c\x01\n\x10\x43ompensationUnit\x12!\n\x1d\x43OMPENSATION_UNIT_UNSPECIFIED\x10\x00\x12\n\n\x06HOURLY\x10\x01\x12\t\n\x05\x44\x41ILY\x10\x02\x12\n\n\x06WEEKLY\x10\x03\x12\x0b\n\x07MONTHLY\x10\x04\x12\n\n\x06YEARLY\x10\x05\x12\x0c\n\x08ONE_TIME\x10\x06\x12\x1b\n\x17OTHER_COMPENSATION_UNIT\x10\x07"\x9e\x01\n\rCertification\x12\x14\n\x0c\x64isplay_name\x18\x01 \x01(\t\x12\'\n\x0c\x61\x63quire_date\x18\x02 \x01(\x0b\x32\x11.google.type.Date\x12&\n\x0b\x65xpire_date\x18\x03 \x01(\x0b\x32\x11.google.type.Date\x12\x11\n\tauthority\x18\x04 \x01(\t\x12\x13\n\x0b\x64\x65scription\x18\x05 \x01(\t"\xbd\x01\n\x05Skill\x12\x14\n\x0c\x64isplay_name\x18\x01 \x01(\t\x12)\n\x0elast_used_date\x18\x02 \x01(\x0b\x32\x11.google.type.Date\x12\x41\n\x05level\x18\x03 \x01(\x0e\x32\x32.google.cloud.talent.v4beta1.SkillProficiencyLevel\x12\x0f\n\x07\x63ontext\x18\x04 \x01(\t\x12\x1f\n\x12skill_name_snippet\x18\x05 \x01(\tB\x03\xe0\x41\x03"|\n\tInterview\x12\x33\n\x06rating\x18\x06 \x01(\x0b\x32#.google.cloud.talent.v4beta1.Rating\x12:\n\x07outcome\x18\x07 \x01(\x0e\x32$.google.cloud.talent.v4beta1.OutcomeB\x03\xe0\x41\x02"E\n\x06Rating\x12\x0f\n\x07overall\x18\x01 \x01(\x01\x12\x0b\n\x03min\x18\x02 \x01(\x01\x12\x0b\n\x03max\x18\x03 \x01(\x01\x12\x10\n\x08interval\x18\x04 \x01(\x01"\xcc\x03\n\x16\x42\x61tchOperationMetadata\x12H\n\x05state\x18\x01 \x01(\x0e\x32\x39.google.cloud.talent.v4beta1.BatchOperationMetadata.State\x12\x19\n\x11state_description\x18\x02 \x01(\t\x12\x15\n\rsuccess_count\x18\x03 \x01(\x05\x12\x15\n\rfailure_count\x18\x04 \x01(\x05\x12\x13\n\x0btotal_count\x18\x05 \x01(\x05\x12/\n\x0b\x63reate_time\x18\x06 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12/\n\x0bupdate_time\x18\x07 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12,\n\x08\x65nd_time\x18\x08 \x01(\x0b\x32\x1a.google.protobuf.Timestamp"z\n\x05State\x12\x15\n\x11STATE_UNSPECIFIED\x10\x00\x12\x10\n\x0cINITIALIZING\x10\x01\x12\x0e\n\nPROCESSING\x10\x02\x12\r\n\tSUCCEEDED\x10\x03\x12\n\n\x06\x46\x41ILED\x10\x04\x12\x0e\n\nCANCELLING\x10\x05\x12\r\n\tCANCELLED\x10\x06*y\n\x0b\x43ompanySize\x12\x1c\n\x18\x43OMPANY_SIZE_UNSPECIFIED\x10\x00\x12\x08\n\x04MINI\x10\x01\x12\t\n\x05SMALL\x10\x02\x12\x0b\n\x07SMEDIUM\x10\x03\x12\n\n\x06MEDIUM\x10\x04\x12\x07\n\x03\x42IG\x10\x05\x12\n\n\x06\x42IGGER\x10\x06\x12\t\n\x05GIANT\x10\x07*\xe2\x01\n\nJobBenefit\x12\x1b\n\x17JOB_BENEFIT_UNSPECIFIED\x10\x00\x12\x0e\n\nCHILD_CARE\x10\x01\x12\n\n\x06\x44\x45NTAL\x10\x02\x12\x14\n\x10\x44OMESTIC_PARTNER\x10\x03\x12\x12\n\x0e\x46LEXIBLE_HOURS\x10\x04\x12\x0b\n\x07MEDICAL\x10\x05\x12\x12\n\x0eLIFE_INSURANCE\x10\x06\x12\x12\n\x0ePARENTAL_LEAVE\x10\x07\x12\x13\n\x0fRETIREMENT_PLAN\x10\x08\x12\r\n\tSICK_DAYS\x10\t\x12\x0c\n\x08VACATION\x10\n\x12\n\n\x06VISION\x10\x0b*\x8e\x02\n\nDegreeType\x12\x1b\n\x17\x44\x45GREE_TYPE_UNSPECIFIED\x10\x00\x12\x15\n\x11PRIMARY_EDUCATION\x10\x01\x12\x1d\n\x19LOWER_SECONDARY_EDUCATION\x10\x02\x12\x1d\n\x19UPPER_SECONDARY_EDUCATION\x10\x03\x12\x1c\n\x18\x41\x44ULT_REMEDIAL_EDUCATION\x10\x04\x12\x1c\n\x18\x41SSOCIATES_OR_EQUIVALENT\x10\x05\x12\x1b\n\x17\x42\x41\x43HELORS_OR_EQUIVALENT\x10\x06\x12\x19\n\x15MASTERS_OR_EQUIVALENT\x10\x07\x12\x1a\n\x16\x44OCTORAL_OR_EQUIVALENT\x10\x08*\xdc\x01\n\x0e\x45mploymentType\x12\x1f\n\x1b\x45MPLOYMENT_TYPE_UNSPECIFIED\x10\x00\x12\r\n\tFULL_TIME\x10\x01\x12\r\n\tPART_TIME\x10\x02\x12\x0e\n\nCONTRACTOR\x10\x03\x12\x14\n\x10\x43ONTRACT_TO_HIRE\x10\x04\x12\r\n\tTEMPORARY\x10\x05\x12\n\n\x06INTERN\x10\x06\x12\r\n\tVOLUNTEER\x10\x07\x12\x0c\n\x08PER_DIEM\x10\x08\x12\x12\n\x0e\x46LY_IN_FLY_OUT\x10\t\x12\x19\n\x15OTHER_EMPLOYMENT_TYPE\x10\n*q\n\x08JobLevel\x12\x19\n\x15JOB_LEVEL_UNSPECIFIED\x10\x00\x12\x0f\n\x0b\x45NTRY_LEVEL\x10\x01\x12\x0f\n\x0b\x45XPERIENCED\x10\x02\x12\x0b\n\x07MANAGER\x10\x03\x12\x0c\n\x08\x44IRECTOR\x10\x04\x12\r\n\tEXECUTIVE\x10\x05*\xba\x06\n\x0bJobCategory\x12\x1c\n\x18JOB_CATEGORY_UNSPECIFIED\x10\x00\x12\x1a\n\x16\x41\x43\x43OUNTING_AND_FINANCE\x10\x01\x12\x1d\n\x19\x41\x44MINISTRATIVE_AND_OFFICE\x10\x02\x12\x1d\n\x19\x41\x44VERTISING_AND_MARKETING\x10\x03\x12\x0f\n\x0b\x41NIMAL_CARE\x10\x04\x12\x1a\n\x16\x41RT_FASHION_AND_DESIGN\x10\x05\x12\x17\n\x13\x42USINESS_OPERATIONS\x10\x06\x12\x1b\n\x17\x43LEANING_AND_FACILITIES\x10\x07\x12\x13\n\x0f\x43OMPUTER_AND_IT\x10\x08\x12\x10\n\x0c\x43ONSTRUCTION\x10\t\x12\x14\n\x10\x43USTOMER_SERVICE\x10\n\x12\r\n\tEDUCATION\x10\x0b\x12\x1c\n\x18\x45NTERTAINMENT_AND_TRAVEL\x10\x0c\x12\x18\n\x14\x46\x41RMING_AND_OUTDOORS\x10\r\x12\x0e\n\nHEALTHCARE\x10\x0e\x12\x13\n\x0fHUMAN_RESOURCES\x10\x0f\x12\'\n#INSTALLATION_MAINTENANCE_AND_REPAIR\x10\x10\x12\t\n\x05LEGAL\x10\x11\x12\x0e\n\nMANAGEMENT\x10\x12\x12\x1f\n\x1bMANUFACTURING_AND_WAREHOUSE\x10\x13\x12$\n MEDIA_COMMUNICATIONS_AND_WRITING\x10\x14\x12\x16\n\x12OIL_GAS_AND_MINING\x10\x15\x12\x1e\n\x1aPERSONAL_CARE_AND_SERVICES\x10\x16\x12\x17\n\x13PROTECTIVE_SERVICES\x10\x17\x12\x0f\n\x0bREAL_ESTATE\x10\x18\x12\x1e\n\x1aRESTAURANT_AND_HOSPITALITY\x10\x19\x12\x14\n\x10SALES_AND_RETAIL\x10\x1a\x12\x1b\n\x17SCIENCE_AND_ENGINEERING\x10\x1b\x12"\n\x1eSOCIAL_SERVICES_AND_NON_PROFIT\x10\x1c\x12!\n\x1dSPORTS_FITNESS_AND_RECREATION\x10\x1d\x12 \n\x1cTRANSPORTATION_AND_LOGISTICS\x10\x1e*e\n\rPostingRegion\x12\x1e\n\x1aPOSTING_REGION_UNSPECIFIED\x10\x00\x12\x17\n\x13\x41\x44MINISTRATIVE_AREA\x10\x01\x12\n\n\x06NATION\x10\x02\x12\x0f\n\x0bTELECOMMUTE\x10\x03*n\n\nVisibility\x12\x1a\n\x16VISIBILITY_UNSPECIFIED\x10\x00\x12\x10\n\x0c\x41\x43\x43OUNT_ONLY\x10\x01\x12\x16\n\x12SHARED_WITH_GOOGLE\x10\x02\x12\x16\n\x12SHARED_WITH_PUBLIC\x10\x03\x1a\x02\x18\x01*Z\n\x10\x43ontactInfoUsage\x12"\n\x1e\x43ONTACT_INFO_USAGE_UNSPECIFIED\x10\x00\x12\x0c\n\x08PERSONAL\x10\x01\x12\x08\n\x04WORK\x10\x02\x12\n\n\x06SCHOOL\x10\x03*q\n\x10HtmlSanitization\x12!\n\x1dHTML_SANITIZATION_UNSPECIFIED\x10\x00\x12\x1e\n\x1aHTML_SANITIZATION_DISABLED\x10\x01\x12\x1a\n\x16SIMPLE_FORMATTING_ONLY\x10\x02*c\n\rCommuteMethod\x12\x1e\n\x1a\x43OMMUTE_METHOD_UNSPECIFIED\x10\x00\x12\x0b\n\x07\x44RIVING\x10\x01\x12\x0b\n\x07TRANSIT\x10\x02\x12\x0b\n\x07WALKING\x10\x03\x12\x0b\n\x07\x43YCLING\x10\x04*\xa2\x01\n\x15SkillProficiencyLevel\x12\'\n#SKILL_PROFICIENCY_LEVEL_UNSPECIFIED\x10\x00\x12\r\n\tUNSKILLED\x10\x06\x12\x19\n\x15\x46UNDAMENTAL_AWARENESS\x10\x01\x12\n\n\x06NOVICE\x10\x02\x12\x10\n\x0cINTERMEDIATE\x10\x03\x12\x0c\n\x08\x41\x44VANCED\x10\x04\x12\n\n\x06\x45XPERT\x10\x05*f\n\x07Outcome\x12\x17\n\x13OUTCOME_UNSPECIFIED\x10\x00\x12\x0c\n\x08POSITIVE\x10\x01\x12\x0b\n\x07NEUTRAL\x10\x02\x12\x0c\n\x08NEGATIVE\x10\x03\x12\x19\n\x15OUTCOME_NOT_AVAILABLE\x10\x04*\x97\x01\n\x16\x41vailabilitySignalType\x12(\n$AVAILABILITY_SIGNAL_TYPE_UNSPECIFIED\x10\x00\x12\x13\n\x0fJOB_APPLICATION\x10\x01\x12\x11\n\rRESUME_UPDATE\x10\x02\x12\x14\n\x10\x43\x41NDIDATE_UPDATE\x10\x03\x12\x15\n\x11\x43LIENT_SUBMISSION\x10\x04\x42y\n\x1f\x63om.google.cloud.talent.v4beta1B\x0b\x43ommonProtoP\x01ZAgoogle.golang.org/genproto/googleapis/cloud/talent/v4beta1;talent\xa2\x02\x03\x43TSb\x06proto3', - dependencies=[ - google_dot_api_dot_field__behavior__pb2.DESCRIPTOR, - google_dot_protobuf_dot_timestamp__pb2.DESCRIPTOR, - google_dot_protobuf_dot_wrappers__pb2.DESCRIPTOR, - google_dot_type_dot_date__pb2.DESCRIPTOR, - google_dot_type_dot_latlng__pb2.DESCRIPTOR, - google_dot_type_dot_money__pb2.DESCRIPTOR, - google_dot_type_dot_postal__address__pb2.DESCRIPTOR, - google_dot_type_dot_timeofday__pb2.DESCRIPTOR, - google_dot_api_dot_annotations__pb2.DESCRIPTOR, - ], -) - -_COMPANYSIZE = _descriptor.EnumDescriptor( - name="CompanySize", - full_name="google.cloud.talent.v4beta1.CompanySize", - filename=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - values=[ - _descriptor.EnumValueDescriptor( - name="COMPANY_SIZE_UNSPECIFIED", - index=0, - number=0, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="MINI", - index=1, - number=1, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="SMALL", - index=2, - number=2, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="SMEDIUM", - index=3, - number=3, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="MEDIUM", - index=4, - number=4, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="BIG", - index=5, - number=5, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="BIGGER", - index=6, - number=6, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="GIANT", - index=7, - number=7, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - ], - containing_type=None, - serialized_options=None, - serialized_start=3689, - serialized_end=3810, -) -_sym_db.RegisterEnumDescriptor(_COMPANYSIZE) - -CompanySize = enum_type_wrapper.EnumTypeWrapper(_COMPANYSIZE) -_JOBBENEFIT = _descriptor.EnumDescriptor( - name="JobBenefit", - full_name="google.cloud.talent.v4beta1.JobBenefit", - filename=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - values=[ - _descriptor.EnumValueDescriptor( - name="JOB_BENEFIT_UNSPECIFIED", - index=0, - number=0, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="CHILD_CARE", - index=1, - number=1, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="DENTAL", - index=2, - number=2, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="DOMESTIC_PARTNER", - index=3, - number=3, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="FLEXIBLE_HOURS", - index=4, - number=4, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="MEDICAL", - index=5, - number=5, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="LIFE_INSURANCE", - index=6, - number=6, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="PARENTAL_LEAVE", - index=7, - number=7, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="RETIREMENT_PLAN", - index=8, - number=8, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="SICK_DAYS", - index=9, - number=9, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="VACATION", - index=10, - number=10, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="VISION", - index=11, - number=11, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - ], - containing_type=None, - serialized_options=None, - serialized_start=3813, - serialized_end=4039, -) -_sym_db.RegisterEnumDescriptor(_JOBBENEFIT) - -JobBenefit = enum_type_wrapper.EnumTypeWrapper(_JOBBENEFIT) -_DEGREETYPE = _descriptor.EnumDescriptor( - name="DegreeType", - full_name="google.cloud.talent.v4beta1.DegreeType", - filename=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - values=[ - _descriptor.EnumValueDescriptor( - name="DEGREE_TYPE_UNSPECIFIED", - index=0, - number=0, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="PRIMARY_EDUCATION", - index=1, - number=1, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="LOWER_SECONDARY_EDUCATION", - index=2, - number=2, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="UPPER_SECONDARY_EDUCATION", - index=3, - number=3, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="ADULT_REMEDIAL_EDUCATION", - index=4, - number=4, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="ASSOCIATES_OR_EQUIVALENT", - index=5, - number=5, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="BACHELORS_OR_EQUIVALENT", - index=6, - number=6, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="MASTERS_OR_EQUIVALENT", - index=7, - number=7, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="DOCTORAL_OR_EQUIVALENT", - index=8, - number=8, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - ], - containing_type=None, - serialized_options=None, - serialized_start=4042, - serialized_end=4312, -) -_sym_db.RegisterEnumDescriptor(_DEGREETYPE) - -DegreeType = enum_type_wrapper.EnumTypeWrapper(_DEGREETYPE) -_EMPLOYMENTTYPE = _descriptor.EnumDescriptor( - name="EmploymentType", - full_name="google.cloud.talent.v4beta1.EmploymentType", - filename=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - values=[ - _descriptor.EnumValueDescriptor( - name="EMPLOYMENT_TYPE_UNSPECIFIED", - index=0, - number=0, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="FULL_TIME", - index=1, - number=1, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="PART_TIME", - index=2, - number=2, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="CONTRACTOR", - index=3, - number=3, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="CONTRACT_TO_HIRE", - index=4, - number=4, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="TEMPORARY", - index=5, - number=5, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="INTERN", - index=6, - number=6, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="VOLUNTEER", - index=7, - number=7, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="PER_DIEM", - index=8, - number=8, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="FLY_IN_FLY_OUT", - index=9, - number=9, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="OTHER_EMPLOYMENT_TYPE", - index=10, - number=10, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - ], - containing_type=None, - serialized_options=None, - serialized_start=4315, - serialized_end=4535, -) -_sym_db.RegisterEnumDescriptor(_EMPLOYMENTTYPE) - -EmploymentType = enum_type_wrapper.EnumTypeWrapper(_EMPLOYMENTTYPE) -_JOBLEVEL = _descriptor.EnumDescriptor( - name="JobLevel", - full_name="google.cloud.talent.v4beta1.JobLevel", - filename=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - values=[ - _descriptor.EnumValueDescriptor( - name="JOB_LEVEL_UNSPECIFIED", - index=0, - number=0, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="ENTRY_LEVEL", - index=1, - number=1, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="EXPERIENCED", - index=2, - number=2, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="MANAGER", - index=3, - number=3, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="DIRECTOR", - index=4, - number=4, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="EXECUTIVE", - index=5, - number=5, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - ], - containing_type=None, - serialized_options=None, - serialized_start=4537, - serialized_end=4650, -) -_sym_db.RegisterEnumDescriptor(_JOBLEVEL) - -JobLevel = enum_type_wrapper.EnumTypeWrapper(_JOBLEVEL) -_JOBCATEGORY = _descriptor.EnumDescriptor( - name="JobCategory", - full_name="google.cloud.talent.v4beta1.JobCategory", - filename=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - values=[ - _descriptor.EnumValueDescriptor( - name="JOB_CATEGORY_UNSPECIFIED", - index=0, - number=0, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="ACCOUNTING_AND_FINANCE", - index=1, - number=1, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="ADMINISTRATIVE_AND_OFFICE", - index=2, - number=2, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="ADVERTISING_AND_MARKETING", - index=3, - number=3, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="ANIMAL_CARE", - index=4, - number=4, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="ART_FASHION_AND_DESIGN", - index=5, - number=5, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="BUSINESS_OPERATIONS", - index=6, - number=6, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="CLEANING_AND_FACILITIES", - index=7, - number=7, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="COMPUTER_AND_IT", - index=8, - number=8, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="CONSTRUCTION", - index=9, - number=9, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="CUSTOMER_SERVICE", - index=10, - number=10, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="EDUCATION", - index=11, - number=11, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="ENTERTAINMENT_AND_TRAVEL", - index=12, - number=12, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="FARMING_AND_OUTDOORS", - index=13, - number=13, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="HEALTHCARE", - index=14, - number=14, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="HUMAN_RESOURCES", - index=15, - number=15, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="INSTALLATION_MAINTENANCE_AND_REPAIR", - index=16, - number=16, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="LEGAL", - index=17, - number=17, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="MANAGEMENT", - index=18, - number=18, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="MANUFACTURING_AND_WAREHOUSE", - index=19, - number=19, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="MEDIA_COMMUNICATIONS_AND_WRITING", - index=20, - number=20, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="OIL_GAS_AND_MINING", - index=21, - number=21, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="PERSONAL_CARE_AND_SERVICES", - index=22, - number=22, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="PROTECTIVE_SERVICES", - index=23, - number=23, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="REAL_ESTATE", - index=24, - number=24, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="RESTAURANT_AND_HOSPITALITY", - index=25, - number=25, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="SALES_AND_RETAIL", - index=26, - number=26, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="SCIENCE_AND_ENGINEERING", - index=27, - number=27, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="SOCIAL_SERVICES_AND_NON_PROFIT", - index=28, - number=28, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="SPORTS_FITNESS_AND_RECREATION", - index=29, - number=29, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="TRANSPORTATION_AND_LOGISTICS", - index=30, - number=30, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - ], - containing_type=None, - serialized_options=None, - serialized_start=4653, - serialized_end=5479, -) -_sym_db.RegisterEnumDescriptor(_JOBCATEGORY) - -JobCategory = enum_type_wrapper.EnumTypeWrapper(_JOBCATEGORY) -_POSTINGREGION = _descriptor.EnumDescriptor( - name="PostingRegion", - full_name="google.cloud.talent.v4beta1.PostingRegion", - filename=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - values=[ - _descriptor.EnumValueDescriptor( - name="POSTING_REGION_UNSPECIFIED", - index=0, - number=0, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="ADMINISTRATIVE_AREA", - index=1, - number=1, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="NATION", - index=2, - number=2, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="TELECOMMUTE", - index=3, - number=3, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - ], - containing_type=None, - serialized_options=None, - serialized_start=5481, - serialized_end=5582, -) -_sym_db.RegisterEnumDescriptor(_POSTINGREGION) - -PostingRegion = enum_type_wrapper.EnumTypeWrapper(_POSTINGREGION) -_VISIBILITY = _descriptor.EnumDescriptor( - name="Visibility", - full_name="google.cloud.talent.v4beta1.Visibility", - filename=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - values=[ - _descriptor.EnumValueDescriptor( - name="VISIBILITY_UNSPECIFIED", - index=0, - number=0, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="ACCOUNT_ONLY", - index=1, - number=1, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="SHARED_WITH_GOOGLE", - index=2, - number=2, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="SHARED_WITH_PUBLIC", - index=3, - number=3, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - ], - containing_type=None, - serialized_options=b"\030\001", - serialized_start=5584, - serialized_end=5694, -) -_sym_db.RegisterEnumDescriptor(_VISIBILITY) - -Visibility = enum_type_wrapper.EnumTypeWrapper(_VISIBILITY) -_CONTACTINFOUSAGE = _descriptor.EnumDescriptor( - name="ContactInfoUsage", - full_name="google.cloud.talent.v4beta1.ContactInfoUsage", - filename=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - values=[ - _descriptor.EnumValueDescriptor( - name="CONTACT_INFO_USAGE_UNSPECIFIED", - index=0, - number=0, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="PERSONAL", - index=1, - number=1, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="WORK", - index=2, - number=2, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="SCHOOL", - index=3, - number=3, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - ], - containing_type=None, - serialized_options=None, - serialized_start=5696, - serialized_end=5786, -) -_sym_db.RegisterEnumDescriptor(_CONTACTINFOUSAGE) - -ContactInfoUsage = enum_type_wrapper.EnumTypeWrapper(_CONTACTINFOUSAGE) -_HTMLSANITIZATION = _descriptor.EnumDescriptor( - name="HtmlSanitization", - full_name="google.cloud.talent.v4beta1.HtmlSanitization", - filename=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - values=[ - _descriptor.EnumValueDescriptor( - name="HTML_SANITIZATION_UNSPECIFIED", - index=0, - number=0, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="HTML_SANITIZATION_DISABLED", - index=1, - number=1, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="SIMPLE_FORMATTING_ONLY", - index=2, - number=2, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - ], - containing_type=None, - serialized_options=None, - serialized_start=5788, - serialized_end=5901, -) -_sym_db.RegisterEnumDescriptor(_HTMLSANITIZATION) - -HtmlSanitization = enum_type_wrapper.EnumTypeWrapper(_HTMLSANITIZATION) -_COMMUTEMETHOD = _descriptor.EnumDescriptor( - name="CommuteMethod", - full_name="google.cloud.talent.v4beta1.CommuteMethod", - filename=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - values=[ - _descriptor.EnumValueDescriptor( - name="COMMUTE_METHOD_UNSPECIFIED", - index=0, - number=0, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="DRIVING", - index=1, - number=1, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="TRANSIT", - index=2, - number=2, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="WALKING", - index=3, - number=3, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="CYCLING", - index=4, - number=4, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - ], - containing_type=None, - serialized_options=None, - serialized_start=5903, - serialized_end=6002, -) -_sym_db.RegisterEnumDescriptor(_COMMUTEMETHOD) - -CommuteMethod = enum_type_wrapper.EnumTypeWrapper(_COMMUTEMETHOD) -_SKILLPROFICIENCYLEVEL = _descriptor.EnumDescriptor( - name="SkillProficiencyLevel", - full_name="google.cloud.talent.v4beta1.SkillProficiencyLevel", - filename=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - values=[ - _descriptor.EnumValueDescriptor( - name="SKILL_PROFICIENCY_LEVEL_UNSPECIFIED", - index=0, - number=0, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="UNSKILLED", - index=1, - number=6, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="FUNDAMENTAL_AWARENESS", - index=2, - number=1, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="NOVICE", - index=3, - number=2, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="INTERMEDIATE", - index=4, - number=3, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="ADVANCED", - index=5, - number=4, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="EXPERT", - index=6, - number=5, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - ], - containing_type=None, - serialized_options=None, - serialized_start=6005, - serialized_end=6167, -) -_sym_db.RegisterEnumDescriptor(_SKILLPROFICIENCYLEVEL) - -SkillProficiencyLevel = enum_type_wrapper.EnumTypeWrapper(_SKILLPROFICIENCYLEVEL) -_OUTCOME = _descriptor.EnumDescriptor( - name="Outcome", - full_name="google.cloud.talent.v4beta1.Outcome", - filename=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - values=[ - _descriptor.EnumValueDescriptor( - name="OUTCOME_UNSPECIFIED", - index=0, - number=0, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="POSITIVE", - index=1, - number=1, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="NEUTRAL", - index=2, - number=2, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="NEGATIVE", - index=3, - number=3, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="OUTCOME_NOT_AVAILABLE", - index=4, - number=4, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - ], - containing_type=None, - serialized_options=None, - serialized_start=6169, - serialized_end=6271, -) -_sym_db.RegisterEnumDescriptor(_OUTCOME) - -Outcome = enum_type_wrapper.EnumTypeWrapper(_OUTCOME) -_AVAILABILITYSIGNALTYPE = _descriptor.EnumDescriptor( - name="AvailabilitySignalType", - full_name="google.cloud.talent.v4beta1.AvailabilitySignalType", - filename=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - values=[ - _descriptor.EnumValueDescriptor( - name="AVAILABILITY_SIGNAL_TYPE_UNSPECIFIED", - index=0, - number=0, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="JOB_APPLICATION", - index=1, - number=1, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="RESUME_UPDATE", - index=2, - number=2, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="CANDIDATE_UPDATE", - index=3, - number=3, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="CLIENT_SUBMISSION", - index=4, - number=4, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - ], - containing_type=None, - serialized_options=None, - serialized_start=6274, - serialized_end=6425, -) -_sym_db.RegisterEnumDescriptor(_AVAILABILITYSIGNALTYPE) - -AvailabilitySignalType = enum_type_wrapper.EnumTypeWrapper(_AVAILABILITYSIGNALTYPE) -COMPANY_SIZE_UNSPECIFIED = 0 -MINI = 1 -SMALL = 2 -SMEDIUM = 3 -MEDIUM = 4 -BIG = 5 -BIGGER = 6 -GIANT = 7 -JOB_BENEFIT_UNSPECIFIED = 0 -CHILD_CARE = 1 -DENTAL = 2 -DOMESTIC_PARTNER = 3 -FLEXIBLE_HOURS = 4 -MEDICAL = 5 -LIFE_INSURANCE = 6 -PARENTAL_LEAVE = 7 -RETIREMENT_PLAN = 8 -SICK_DAYS = 9 -VACATION = 10 -VISION = 11 -DEGREE_TYPE_UNSPECIFIED = 0 -PRIMARY_EDUCATION = 1 -LOWER_SECONDARY_EDUCATION = 2 -UPPER_SECONDARY_EDUCATION = 3 -ADULT_REMEDIAL_EDUCATION = 4 -ASSOCIATES_OR_EQUIVALENT = 5 -BACHELORS_OR_EQUIVALENT = 6 -MASTERS_OR_EQUIVALENT = 7 -DOCTORAL_OR_EQUIVALENT = 8 -EMPLOYMENT_TYPE_UNSPECIFIED = 0 -FULL_TIME = 1 -PART_TIME = 2 -CONTRACTOR = 3 -CONTRACT_TO_HIRE = 4 -TEMPORARY = 5 -INTERN = 6 -VOLUNTEER = 7 -PER_DIEM = 8 -FLY_IN_FLY_OUT = 9 -OTHER_EMPLOYMENT_TYPE = 10 -JOB_LEVEL_UNSPECIFIED = 0 -ENTRY_LEVEL = 1 -EXPERIENCED = 2 -MANAGER = 3 -DIRECTOR = 4 -EXECUTIVE = 5 -JOB_CATEGORY_UNSPECIFIED = 0 -ACCOUNTING_AND_FINANCE = 1 -ADMINISTRATIVE_AND_OFFICE = 2 -ADVERTISING_AND_MARKETING = 3 -ANIMAL_CARE = 4 -ART_FASHION_AND_DESIGN = 5 -BUSINESS_OPERATIONS = 6 -CLEANING_AND_FACILITIES = 7 -COMPUTER_AND_IT = 8 -CONSTRUCTION = 9 -CUSTOMER_SERVICE = 10 -EDUCATION = 11 -ENTERTAINMENT_AND_TRAVEL = 12 -FARMING_AND_OUTDOORS = 13 -HEALTHCARE = 14 -HUMAN_RESOURCES = 15 -INSTALLATION_MAINTENANCE_AND_REPAIR = 16 -LEGAL = 17 -MANAGEMENT = 18 -MANUFACTURING_AND_WAREHOUSE = 19 -MEDIA_COMMUNICATIONS_AND_WRITING = 20 -OIL_GAS_AND_MINING = 21 -PERSONAL_CARE_AND_SERVICES = 22 -PROTECTIVE_SERVICES = 23 -REAL_ESTATE = 24 -RESTAURANT_AND_HOSPITALITY = 25 -SALES_AND_RETAIL = 26 -SCIENCE_AND_ENGINEERING = 27 -SOCIAL_SERVICES_AND_NON_PROFIT = 28 -SPORTS_FITNESS_AND_RECREATION = 29 -TRANSPORTATION_AND_LOGISTICS = 30 -POSTING_REGION_UNSPECIFIED = 0 -ADMINISTRATIVE_AREA = 1 -NATION = 2 -TELECOMMUTE = 3 -VISIBILITY_UNSPECIFIED = 0 -ACCOUNT_ONLY = 1 -SHARED_WITH_GOOGLE = 2 -SHARED_WITH_PUBLIC = 3 -CONTACT_INFO_USAGE_UNSPECIFIED = 0 -PERSONAL = 1 -WORK = 2 -SCHOOL = 3 -HTML_SANITIZATION_UNSPECIFIED = 0 -HTML_SANITIZATION_DISABLED = 1 -SIMPLE_FORMATTING_ONLY = 2 -COMMUTE_METHOD_UNSPECIFIED = 0 -DRIVING = 1 -TRANSIT = 2 -WALKING = 3 -CYCLING = 4 -SKILL_PROFICIENCY_LEVEL_UNSPECIFIED = 0 -UNSKILLED = 6 -FUNDAMENTAL_AWARENESS = 1 -NOVICE = 2 -INTERMEDIATE = 3 -ADVANCED = 4 -EXPERT = 5 -OUTCOME_UNSPECIFIED = 0 -POSITIVE = 1 -NEUTRAL = 2 -NEGATIVE = 3 -OUTCOME_NOT_AVAILABLE = 4 -AVAILABILITY_SIGNAL_TYPE_UNSPECIFIED = 0 -JOB_APPLICATION = 1 -RESUME_UPDATE = 2 -CANDIDATE_UPDATE = 3 -CLIENT_SUBMISSION = 4 - - -_LOCATION_LOCATIONTYPE = _descriptor.EnumDescriptor( - name="LocationType", - full_name="google.cloud.talent.v4beta1.Location.LocationType", - filename=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - values=[ - _descriptor.EnumValueDescriptor( - name="LOCATION_TYPE_UNSPECIFIED", - index=0, - number=0, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="COUNTRY", - index=1, - number=1, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="ADMINISTRATIVE_AREA", - index=2, - number=2, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="SUB_ADMINISTRATIVE_AREA", - index=3, - number=3, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="LOCALITY", - index=4, - number=4, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="POSTAL_CODE", - index=5, - number=5, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="SUB_LOCALITY", - index=6, - number=6, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="SUB_LOCALITY_1", - index=7, - number=7, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="SUB_LOCALITY_2", - index=8, - number=8, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="NEIGHBORHOOD", - index=9, - number=9, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="STREET_ADDRESS", - index=10, - number=10, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - ], - containing_type=None, - serialized_options=None, - serialized_start=658, - serialized_end=897, -) -_sym_db.RegisterEnumDescriptor(_LOCATION_LOCATIONTYPE) - -_DEVICEINFO_DEVICETYPE = _descriptor.EnumDescriptor( - name="DeviceType", - full_name="google.cloud.talent.v4beta1.DeviceInfo.DeviceType", - filename=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - values=[ - _descriptor.EnumValueDescriptor( - name="DEVICE_TYPE_UNSPECIFIED", - index=0, - number=0, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="WEB", - index=1, - number=1, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="MOBILE_WEB", - index=2, - number=2, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="ANDROID", - index=3, - number=3, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="IOS", - index=4, - number=4, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="BOT", - index=5, - number=5, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="OTHER", - index=6, - number=6, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - ], - containing_type=None, - serialized_options=None, - serialized_start=1201, - serialized_end=1309, -) -_sym_db.RegisterEnumDescriptor(_DEVICEINFO_DEVICETYPE) - -_COMPENSATIONINFO_COMPENSATIONTYPE = _descriptor.EnumDescriptor( - name="CompensationType", - full_name="google.cloud.talent.v4beta1.CompensationInfo.CompensationType", - filename=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - values=[ - _descriptor.EnumValueDescriptor( - name="COMPENSATION_TYPE_UNSPECIFIED", - index=0, - number=0, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="BASE", - index=1, - number=1, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="BONUS", - index=2, - number=2, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="SIGNING_BONUS", - index=3, - number=3, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="EQUITY", - index=4, - number=4, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="PROFIT_SHARING", - index=5, - number=5, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="COMMISSIONS", - index=6, - number=6, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="TIPS", - index=7, - number=7, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="OTHER_COMPENSATION_TYPE", - index=8, - number=8, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - ], - containing_type=None, - serialized_options=None, - serialized_start=2334, - serialized_end=2515, -) -_sym_db.RegisterEnumDescriptor(_COMPENSATIONINFO_COMPENSATIONTYPE) - -_COMPENSATIONINFO_COMPENSATIONUNIT = _descriptor.EnumDescriptor( - name="CompensationUnit", - full_name="google.cloud.talent.v4beta1.CompensationInfo.CompensationUnit", - filename=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - values=[ - _descriptor.EnumValueDescriptor( - name="COMPENSATION_UNIT_UNSPECIFIED", - index=0, - number=0, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="HOURLY", - index=1, - number=1, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="DAILY", - index=2, - number=2, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="WEEKLY", - index=3, - number=3, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="MONTHLY", - index=4, - number=4, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="YEARLY", - index=5, - number=5, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="ONE_TIME", - index=6, - number=6, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="OTHER_COMPENSATION_UNIT", - index=7, - number=7, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - ], - containing_type=None, - serialized_options=None, - serialized_start=2518, - serialized_end=2674, -) -_sym_db.RegisterEnumDescriptor(_COMPENSATIONINFO_COMPENSATIONUNIT) - -_BATCHOPERATIONMETADATA_STATE = _descriptor.EnumDescriptor( - name="State", - full_name="google.cloud.talent.v4beta1.BatchOperationMetadata.State", - filename=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - values=[ - _descriptor.EnumValueDescriptor( - name="STATE_UNSPECIFIED", - index=0, - number=0, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="INITIALIZING", - index=1, - number=1, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="PROCESSING", - index=2, - number=2, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="SUCCEEDED", - index=3, - number=3, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="FAILED", - index=4, - number=4, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="CANCELLING", - index=5, - number=5, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="CANCELLED", - index=6, - number=6, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - ], - containing_type=None, - serialized_options=None, - serialized_start=3565, - serialized_end=3687, -) -_sym_db.RegisterEnumDescriptor(_BATCHOPERATIONMETADATA_STATE) - - -_TIMESTAMPRANGE = _descriptor.Descriptor( - name="TimestampRange", - full_name="google.cloud.talent.v4beta1.TimestampRange", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="start_time", - full_name="google.cloud.talent.v4beta1.TimestampRange.start_time", - index=0, - number=1, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="end_time", - full_name="google.cloud.talent.v4beta1.TimestampRange.end_time", - index=1, - number=2, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=345, - serialized_end=455, -) - - -_LOCATION = _descriptor.Descriptor( - name="Location", - full_name="google.cloud.talent.v4beta1.Location", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="location_type", - full_name="google.cloud.talent.v4beta1.Location.location_type", - index=0, - number=1, - type=14, - cpp_type=8, - label=1, - has_default_value=False, - default_value=0, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="postal_address", - full_name="google.cloud.talent.v4beta1.Location.postal_address", - index=1, - number=2, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="lat_lng", - full_name="google.cloud.talent.v4beta1.Location.lat_lng", - index=2, - number=3, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="radius_miles", - full_name="google.cloud.talent.v4beta1.Location.radius_miles", - index=3, - number=4, - type=1, - cpp_type=5, - label=1, - has_default_value=False, - default_value=float(0), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[], - enum_types=[_LOCATION_LOCATIONTYPE,], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=458, - serialized_end=897, -) - - -_REQUESTMETADATA = _descriptor.Descriptor( - name="RequestMetadata", - full_name="google.cloud.talent.v4beta1.RequestMetadata", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="domain", - full_name="google.cloud.talent.v4beta1.RequestMetadata.domain", - index=0, - number=1, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="session_id", - full_name="google.cloud.talent.v4beta1.RequestMetadata.session_id", - index=1, - number=2, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="user_id", - full_name="google.cloud.talent.v4beta1.RequestMetadata.user_id", - index=2, - number=3, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="allow_missing_ids", - full_name="google.cloud.talent.v4beta1.RequestMetadata.allow_missing_ids", - index=3, - number=4, - type=8, - cpp_type=7, - label=1, - has_default_value=False, - default_value=False, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="device_info", - full_name="google.cloud.talent.v4beta1.RequestMetadata.device_info", - index=4, - number=5, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=900, - serialized_end=1059, -) - - -_RESPONSEMETADATA = _descriptor.Descriptor( - name="ResponseMetadata", - full_name="google.cloud.talent.v4beta1.ResponseMetadata", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="request_id", - full_name="google.cloud.talent.v4beta1.ResponseMetadata.request_id", - index=0, - number=1, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=1061, - serialized_end=1099, -) - - -_DEVICEINFO = _descriptor.Descriptor( - name="DeviceInfo", - full_name="google.cloud.talent.v4beta1.DeviceInfo", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="device_type", - full_name="google.cloud.talent.v4beta1.DeviceInfo.device_type", - index=0, - number=1, - type=14, - cpp_type=8, - label=1, - has_default_value=False, - default_value=0, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="id", - full_name="google.cloud.talent.v4beta1.DeviceInfo.id", - index=1, - number=2, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[], - enum_types=[_DEVICEINFO_DEVICETYPE,], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=1102, - serialized_end=1309, -) - - -_CUSTOMATTRIBUTE = _descriptor.Descriptor( - name="CustomAttribute", - full_name="google.cloud.talent.v4beta1.CustomAttribute", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="string_values", - full_name="google.cloud.talent.v4beta1.CustomAttribute.string_values", - index=0, - number=1, - type=9, - cpp_type=9, - label=3, - has_default_value=False, - default_value=[], - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="long_values", - full_name="google.cloud.talent.v4beta1.CustomAttribute.long_values", - index=1, - number=2, - type=3, - cpp_type=2, - label=3, - has_default_value=False, - default_value=[], - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="filterable", - full_name="google.cloud.talent.v4beta1.CustomAttribute.filterable", - index=2, - number=3, - type=8, - cpp_type=7, - label=1, - has_default_value=False, - default_value=False, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=1311, - serialized_end=1392, -) - - -_SPELLINGCORRECTION = _descriptor.Descriptor( - name="SpellingCorrection", - full_name="google.cloud.talent.v4beta1.SpellingCorrection", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="corrected", - full_name="google.cloud.talent.v4beta1.SpellingCorrection.corrected", - index=0, - number=1, - type=8, - cpp_type=7, - label=1, - has_default_value=False, - default_value=False, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="corrected_text", - full_name="google.cloud.talent.v4beta1.SpellingCorrection.corrected_text", - index=1, - number=2, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="corrected_html", - full_name="google.cloud.talent.v4beta1.SpellingCorrection.corrected_html", - index=2, - number=3, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=1394, - serialized_end=1481, -) - - -_COMPENSATIONINFO_COMPENSATIONENTRY = _descriptor.Descriptor( - name="CompensationEntry", - full_name="google.cloud.talent.v4beta1.CompensationInfo.CompensationEntry", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="type", - full_name="google.cloud.talent.v4beta1.CompensationInfo.CompensationEntry.type", - index=0, - number=1, - type=14, - cpp_type=8, - label=1, - has_default_value=False, - default_value=0, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="unit", - full_name="google.cloud.talent.v4beta1.CompensationInfo.CompensationEntry.unit", - index=1, - number=2, - type=14, - cpp_type=8, - label=1, - has_default_value=False, - default_value=0, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="amount", - full_name="google.cloud.talent.v4beta1.CompensationInfo.CompensationEntry.amount", - index=2, - number=3, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="range", - full_name="google.cloud.talent.v4beta1.CompensationInfo.CompensationEntry.range", - index=3, - number=4, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="description", - full_name="google.cloud.talent.v4beta1.CompensationInfo.CompensationEntry.description", - index=4, - number=5, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="expected_units_per_year", - full_name="google.cloud.talent.v4beta1.CompensationInfo.CompensationEntry.expected_units_per_year", - index=5, - number=6, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[ - _descriptor.OneofDescriptor( - name="compensation_amount", - full_name="google.cloud.talent.v4beta1.CompensationInfo.CompensationEntry.compensation_amount", - index=0, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[], - ), - ], - serialized_start=1816, - serialized_end=2218, -) - -_COMPENSATIONINFO_COMPENSATIONRANGE = _descriptor.Descriptor( - name="CompensationRange", - full_name="google.cloud.talent.v4beta1.CompensationInfo.CompensationRange", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="max_compensation", - full_name="google.cloud.talent.v4beta1.CompensationInfo.CompensationRange.max_compensation", - index=0, - number=2, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="min_compensation", - full_name="google.cloud.talent.v4beta1.CompensationInfo.CompensationRange.min_compensation", - index=1, - number=1, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=2220, - serialized_end=2331, -) - -_COMPENSATIONINFO = _descriptor.Descriptor( - name="CompensationInfo", - full_name="google.cloud.talent.v4beta1.CompensationInfo", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="entries", - full_name="google.cloud.talent.v4beta1.CompensationInfo.entries", - index=0, - number=1, - type=11, - cpp_type=10, - label=3, - has_default_value=False, - default_value=[], - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="annualized_base_compensation_range", - full_name="google.cloud.talent.v4beta1.CompensationInfo.annualized_base_compensation_range", - index=1, - number=2, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\003", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="annualized_total_compensation_range", - full_name="google.cloud.talent.v4beta1.CompensationInfo.annualized_total_compensation_range", - index=2, - number=3, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\003", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[ - _COMPENSATIONINFO_COMPENSATIONENTRY, - _COMPENSATIONINFO_COMPENSATIONRANGE, - ], - enum_types=[ - _COMPENSATIONINFO_COMPENSATIONTYPE, - _COMPENSATIONINFO_COMPENSATIONUNIT, - ], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=1484, - serialized_end=2674, -) - - -_CERTIFICATION = _descriptor.Descriptor( - name="Certification", - full_name="google.cloud.talent.v4beta1.Certification", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="display_name", - full_name="google.cloud.talent.v4beta1.Certification.display_name", - index=0, - number=1, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="acquire_date", - full_name="google.cloud.talent.v4beta1.Certification.acquire_date", - index=1, - number=2, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="expire_date", - full_name="google.cloud.talent.v4beta1.Certification.expire_date", - index=2, - number=3, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="authority", - full_name="google.cloud.talent.v4beta1.Certification.authority", - index=3, - number=4, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="description", - full_name="google.cloud.talent.v4beta1.Certification.description", - index=4, - number=5, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=2677, - serialized_end=2835, -) - - -_SKILL = _descriptor.Descriptor( - name="Skill", - full_name="google.cloud.talent.v4beta1.Skill", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="display_name", - full_name="google.cloud.talent.v4beta1.Skill.display_name", - index=0, - number=1, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="last_used_date", - full_name="google.cloud.talent.v4beta1.Skill.last_used_date", - index=1, - number=2, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="level", - full_name="google.cloud.talent.v4beta1.Skill.level", - index=2, - number=3, - type=14, - cpp_type=8, - label=1, - has_default_value=False, - default_value=0, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="context", - full_name="google.cloud.talent.v4beta1.Skill.context", - index=3, - number=4, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="skill_name_snippet", - full_name="google.cloud.talent.v4beta1.Skill.skill_name_snippet", - index=4, - number=5, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\003", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=2838, - serialized_end=3027, -) - - -_INTERVIEW = _descriptor.Descriptor( - name="Interview", - full_name="google.cloud.talent.v4beta1.Interview", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="rating", - full_name="google.cloud.talent.v4beta1.Interview.rating", - index=0, - number=6, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="outcome", - full_name="google.cloud.talent.v4beta1.Interview.outcome", - index=1, - number=7, - type=14, - cpp_type=8, - label=1, - has_default_value=False, - default_value=0, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\002", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=3029, - serialized_end=3153, -) - - -_RATING = _descriptor.Descriptor( - name="Rating", - full_name="google.cloud.talent.v4beta1.Rating", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="overall", - full_name="google.cloud.talent.v4beta1.Rating.overall", - index=0, - number=1, - type=1, - cpp_type=5, - label=1, - has_default_value=False, - default_value=float(0), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="min", - full_name="google.cloud.talent.v4beta1.Rating.min", - index=1, - number=2, - type=1, - cpp_type=5, - label=1, - has_default_value=False, - default_value=float(0), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="max", - full_name="google.cloud.talent.v4beta1.Rating.max", - index=2, - number=3, - type=1, - cpp_type=5, - label=1, - has_default_value=False, - default_value=float(0), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="interval", - full_name="google.cloud.talent.v4beta1.Rating.interval", - index=3, - number=4, - type=1, - cpp_type=5, - label=1, - has_default_value=False, - default_value=float(0), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=3155, - serialized_end=3224, -) - - -_BATCHOPERATIONMETADATA = _descriptor.Descriptor( - name="BatchOperationMetadata", - full_name="google.cloud.talent.v4beta1.BatchOperationMetadata", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="state", - full_name="google.cloud.talent.v4beta1.BatchOperationMetadata.state", - index=0, - number=1, - type=14, - cpp_type=8, - label=1, - has_default_value=False, - default_value=0, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="state_description", - full_name="google.cloud.talent.v4beta1.BatchOperationMetadata.state_description", - index=1, - number=2, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="success_count", - full_name="google.cloud.talent.v4beta1.BatchOperationMetadata.success_count", - index=2, - number=3, - type=5, - cpp_type=1, - label=1, - has_default_value=False, - default_value=0, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="failure_count", - full_name="google.cloud.talent.v4beta1.BatchOperationMetadata.failure_count", - index=3, - number=4, - type=5, - cpp_type=1, - label=1, - has_default_value=False, - default_value=0, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="total_count", - full_name="google.cloud.talent.v4beta1.BatchOperationMetadata.total_count", - index=4, - number=5, - type=5, - cpp_type=1, - label=1, - has_default_value=False, - default_value=0, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="create_time", - full_name="google.cloud.talent.v4beta1.BatchOperationMetadata.create_time", - index=5, - number=6, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="update_time", - full_name="google.cloud.talent.v4beta1.BatchOperationMetadata.update_time", - index=6, - number=7, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="end_time", - full_name="google.cloud.talent.v4beta1.BatchOperationMetadata.end_time", - index=7, - number=8, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[], - enum_types=[_BATCHOPERATIONMETADATA_STATE,], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=3227, - serialized_end=3687, -) - -_TIMESTAMPRANGE.fields_by_name[ - "start_time" -].message_type = google_dot_protobuf_dot_timestamp__pb2._TIMESTAMP -_TIMESTAMPRANGE.fields_by_name[ - "end_time" -].message_type = google_dot_protobuf_dot_timestamp__pb2._TIMESTAMP -_LOCATION.fields_by_name["location_type"].enum_type = _LOCATION_LOCATIONTYPE -_LOCATION.fields_by_name[ - "postal_address" -].message_type = google_dot_type_dot_postal__address__pb2._POSTALADDRESS -_LOCATION.fields_by_name[ - "lat_lng" -].message_type = google_dot_type_dot_latlng__pb2._LATLNG -_LOCATION_LOCATIONTYPE.containing_type = _LOCATION -_REQUESTMETADATA.fields_by_name["device_info"].message_type = _DEVICEINFO -_DEVICEINFO.fields_by_name["device_type"].enum_type = _DEVICEINFO_DEVICETYPE -_DEVICEINFO_DEVICETYPE.containing_type = _DEVICEINFO -_COMPENSATIONINFO_COMPENSATIONENTRY.fields_by_name[ - "type" -].enum_type = _COMPENSATIONINFO_COMPENSATIONTYPE -_COMPENSATIONINFO_COMPENSATIONENTRY.fields_by_name[ - "unit" -].enum_type = _COMPENSATIONINFO_COMPENSATIONUNIT -_COMPENSATIONINFO_COMPENSATIONENTRY.fields_by_name[ - "amount" -].message_type = google_dot_type_dot_money__pb2._MONEY -_COMPENSATIONINFO_COMPENSATIONENTRY.fields_by_name[ - "range" -].message_type = _COMPENSATIONINFO_COMPENSATIONRANGE -_COMPENSATIONINFO_COMPENSATIONENTRY.fields_by_name[ - "expected_units_per_year" -].message_type = google_dot_protobuf_dot_wrappers__pb2._DOUBLEVALUE -_COMPENSATIONINFO_COMPENSATIONENTRY.containing_type = _COMPENSATIONINFO -_COMPENSATIONINFO_COMPENSATIONENTRY.oneofs_by_name["compensation_amount"].fields.append( - _COMPENSATIONINFO_COMPENSATIONENTRY.fields_by_name["amount"] -) -_COMPENSATIONINFO_COMPENSATIONENTRY.fields_by_name[ - "amount" -].containing_oneof = _COMPENSATIONINFO_COMPENSATIONENTRY.oneofs_by_name[ - "compensation_amount" -] -_COMPENSATIONINFO_COMPENSATIONENTRY.oneofs_by_name["compensation_amount"].fields.append( - _COMPENSATIONINFO_COMPENSATIONENTRY.fields_by_name["range"] -) -_COMPENSATIONINFO_COMPENSATIONENTRY.fields_by_name[ - "range" -].containing_oneof = _COMPENSATIONINFO_COMPENSATIONENTRY.oneofs_by_name[ - "compensation_amount" -] -_COMPENSATIONINFO_COMPENSATIONRANGE.fields_by_name[ - "max_compensation" -].message_type = google_dot_type_dot_money__pb2._MONEY -_COMPENSATIONINFO_COMPENSATIONRANGE.fields_by_name[ - "min_compensation" -].message_type = google_dot_type_dot_money__pb2._MONEY -_COMPENSATIONINFO_COMPENSATIONRANGE.containing_type = _COMPENSATIONINFO -_COMPENSATIONINFO.fields_by_name[ - "entries" -].message_type = _COMPENSATIONINFO_COMPENSATIONENTRY -_COMPENSATIONINFO.fields_by_name[ - "annualized_base_compensation_range" -].message_type = _COMPENSATIONINFO_COMPENSATIONRANGE -_COMPENSATIONINFO.fields_by_name[ - "annualized_total_compensation_range" -].message_type = _COMPENSATIONINFO_COMPENSATIONRANGE -_COMPENSATIONINFO_COMPENSATIONTYPE.containing_type = _COMPENSATIONINFO -_COMPENSATIONINFO_COMPENSATIONUNIT.containing_type = _COMPENSATIONINFO -_CERTIFICATION.fields_by_name[ - "acquire_date" -].message_type = google_dot_type_dot_date__pb2._DATE -_CERTIFICATION.fields_by_name[ - "expire_date" -].message_type = google_dot_type_dot_date__pb2._DATE -_SKILL.fields_by_name[ - "last_used_date" -].message_type = google_dot_type_dot_date__pb2._DATE -_SKILL.fields_by_name["level"].enum_type = _SKILLPROFICIENCYLEVEL -_INTERVIEW.fields_by_name["rating"].message_type = _RATING -_INTERVIEW.fields_by_name["outcome"].enum_type = _OUTCOME -_BATCHOPERATIONMETADATA.fields_by_name[ - "state" -].enum_type = _BATCHOPERATIONMETADATA_STATE -_BATCHOPERATIONMETADATA.fields_by_name[ - "create_time" -].message_type = google_dot_protobuf_dot_timestamp__pb2._TIMESTAMP -_BATCHOPERATIONMETADATA.fields_by_name[ - "update_time" -].message_type = google_dot_protobuf_dot_timestamp__pb2._TIMESTAMP -_BATCHOPERATIONMETADATA.fields_by_name[ - "end_time" -].message_type = google_dot_protobuf_dot_timestamp__pb2._TIMESTAMP -_BATCHOPERATIONMETADATA_STATE.containing_type = _BATCHOPERATIONMETADATA -DESCRIPTOR.message_types_by_name["TimestampRange"] = _TIMESTAMPRANGE -DESCRIPTOR.message_types_by_name["Location"] = _LOCATION -DESCRIPTOR.message_types_by_name["RequestMetadata"] = _REQUESTMETADATA -DESCRIPTOR.message_types_by_name["ResponseMetadata"] = _RESPONSEMETADATA -DESCRIPTOR.message_types_by_name["DeviceInfo"] = _DEVICEINFO -DESCRIPTOR.message_types_by_name["CustomAttribute"] = _CUSTOMATTRIBUTE -DESCRIPTOR.message_types_by_name["SpellingCorrection"] = _SPELLINGCORRECTION -DESCRIPTOR.message_types_by_name["CompensationInfo"] = _COMPENSATIONINFO -DESCRIPTOR.message_types_by_name["Certification"] = _CERTIFICATION -DESCRIPTOR.message_types_by_name["Skill"] = _SKILL -DESCRIPTOR.message_types_by_name["Interview"] = _INTERVIEW -DESCRIPTOR.message_types_by_name["Rating"] = _RATING -DESCRIPTOR.message_types_by_name["BatchOperationMetadata"] = _BATCHOPERATIONMETADATA -DESCRIPTOR.enum_types_by_name["CompanySize"] = _COMPANYSIZE -DESCRIPTOR.enum_types_by_name["JobBenefit"] = _JOBBENEFIT -DESCRIPTOR.enum_types_by_name["DegreeType"] = _DEGREETYPE -DESCRIPTOR.enum_types_by_name["EmploymentType"] = _EMPLOYMENTTYPE -DESCRIPTOR.enum_types_by_name["JobLevel"] = _JOBLEVEL -DESCRIPTOR.enum_types_by_name["JobCategory"] = _JOBCATEGORY -DESCRIPTOR.enum_types_by_name["PostingRegion"] = _POSTINGREGION -DESCRIPTOR.enum_types_by_name["Visibility"] = _VISIBILITY -DESCRIPTOR.enum_types_by_name["ContactInfoUsage"] = _CONTACTINFOUSAGE -DESCRIPTOR.enum_types_by_name["HtmlSanitization"] = _HTMLSANITIZATION -DESCRIPTOR.enum_types_by_name["CommuteMethod"] = _COMMUTEMETHOD -DESCRIPTOR.enum_types_by_name["SkillProficiencyLevel"] = _SKILLPROFICIENCYLEVEL -DESCRIPTOR.enum_types_by_name["Outcome"] = _OUTCOME -DESCRIPTOR.enum_types_by_name["AvailabilitySignalType"] = _AVAILABILITYSIGNALTYPE -_sym_db.RegisterFileDescriptor(DESCRIPTOR) - -TimestampRange = _reflection.GeneratedProtocolMessageType( - "TimestampRange", - (_message.Message,), - { - "DESCRIPTOR": _TIMESTAMPRANGE, - "__module__": "google.cloud.talent_v4beta1.proto.common_pb2", - "__doc__": """Message representing a period of time between two timestamps. - - Attributes: - start_time: - Begin of the period (inclusive). - end_time: - End of the period (exclusive). - """, - # @@protoc_insertion_point(class_scope:google.cloud.talent.v4beta1.TimestampRange) - }, -) -_sym_db.RegisterMessage(TimestampRange) - -Location = _reflection.GeneratedProtocolMessageType( - "Location", - (_message.Message,), - { - "DESCRIPTOR": _LOCATION, - "__module__": "google.cloud.talent_v4beta1.proto.common_pb2", - "__doc__": """A resource that represents a location with full geographic - information. - - Attributes: - location_type: - The type of a location, which corresponds to the address lines - field of - [google.type.PostalAddress][google.type.PostalAddress]. For - example, “Downtown, Atlanta, GA, USA” has a type of [LocationT - ype.NEIGHBORHOOD][google.cloud.talent.v4beta1.Location.Locatio - nType.NEIGHBORHOOD], and “Kansas City, KS, USA” has a type of - [LocationType.LOCALITY][google.cloud.talent.v4beta1.Location.L - ocationType.LOCALITY]. - postal_address: - Postal address of the location that includes human readable - information, such as postal delivery and payments addresses. - Given a postal address, a postal service can deliver items to - a premises, P.O. Box, or other delivery location. - lat_lng: - An object representing a latitude/longitude pair. - radius_miles: - Radius in miles of the job location. This value is derived - from the location bounding box in which a circle with the - specified radius centered from - [google.type.LatLng][google.type.LatLng] covers the area - associated with the job location. For example, currently, - “Mountain View, CA, USA” has a radius of 6.17 miles. - """, - # @@protoc_insertion_point(class_scope:google.cloud.talent.v4beta1.Location) - }, -) -_sym_db.RegisterMessage(Location) - -RequestMetadata = _reflection.GeneratedProtocolMessageType( - "RequestMetadata", - (_message.Message,), - { - "DESCRIPTOR": _REQUESTMETADATA, - "__module__": "google.cloud.talent_v4beta1.proto.common_pb2", - "__doc__": """Meta information related to the job searcher or entity conducting the - job search. This information is used to improve the performance of the - service. - - Attributes: - domain: - Required if [allow_missing_ids][google.cloud.talent.v4beta1.Re - questMetadata.allow_missing_ids] is unset or ``false``. The - client-defined scope or source of the service call, which - typically is the domain on which the service has been - implemented and is currently being run. For example, if the - service is being run by client Foo, Inc., on job board - www.foo.com and career site www.bar.com, then this field is - set to “foo.com” for use on the job board, and “bar.com” for - use on the career site. Note that any improvements to the - model for a particular tenant site rely on this field being - set correctly to a unique domain. The maximum number of - allowed characters is 255. - session_id: - Required if [allow_missing_ids][google.cloud.talent.v4beta1.Re - questMetadata.allow_missing_ids] is unset or ``false``. A - unique session identification string. A session is defined as - the duration of an end user’s interaction with the service - over a certain period. Obfuscate this field for privacy - concerns before providing it to the service. Note that any - improvements to the model for a particular tenant site rely on - this field being set correctly to a unique session ID. The - maximum number of allowed characters is 255. - user_id: - Required if [allow_missing_ids][google.cloud.talent.v4beta1.Re - questMetadata.allow_missing_ids] is unset or ``false``. A - unique user identification string, as determined by the - client. To have the strongest positive impact on search - quality make sure the client-level is unique. Obfuscate this - field for privacy concerns before providing it to the service. - Note that any improvements to the model for a particular - tenant site rely on this field being set correctly to a unique - user ID. The maximum number of allowed characters is 255. - allow_missing_ids: - Only set when any of - [domain][google.cloud.talent.v4beta1.RequestMetadata.domain], - [session_id][google.cloud.talent.v4beta1.RequestMetadata.sessi - on_id] and - [user_id][google.cloud.talent.v4beta1.RequestMetadata.user_id] - isn’t available for some reason. It is highly recommended not - to set this field and provide accurate - [domain][google.cloud.talent.v4beta1.RequestMetadata.domain], - [session_id][google.cloud.talent.v4beta1.RequestMetadata.sessi - on_id] and - [user_id][google.cloud.talent.v4beta1.RequestMetadata.user_id] - for the best service experience. - device_info: - The type of device used by the job seeker at the time of the - call to the service. - """, - # @@protoc_insertion_point(class_scope:google.cloud.talent.v4beta1.RequestMetadata) - }, -) -_sym_db.RegisterMessage(RequestMetadata) - -ResponseMetadata = _reflection.GeneratedProtocolMessageType( - "ResponseMetadata", - (_message.Message,), - { - "DESCRIPTOR": _RESPONSEMETADATA, - "__module__": "google.cloud.talent_v4beta1.proto.common_pb2", - "__doc__": """Additional information returned to client, such as debugging - information. - - Attributes: - request_id: - A unique id associated with this call. This id is logged for - tracking purposes. - """, - # @@protoc_insertion_point(class_scope:google.cloud.talent.v4beta1.ResponseMetadata) - }, -) -_sym_db.RegisterMessage(ResponseMetadata) - -DeviceInfo = _reflection.GeneratedProtocolMessageType( - "DeviceInfo", - (_message.Message,), - { - "DESCRIPTOR": _DEVICEINFO, - "__module__": "google.cloud.talent_v4beta1.proto.common_pb2", - "__doc__": """Device information collected from the job seeker, candidate, or other - entity conducting the job search. Providing this information improves - the quality of the search results across devices. - - Attributes: - device_type: - Type of the device. - id: - A device-specific ID. The ID must be a unique identifier that - distinguishes the device from other devices. - """, - # @@protoc_insertion_point(class_scope:google.cloud.talent.v4beta1.DeviceInfo) - }, -) -_sym_db.RegisterMessage(DeviceInfo) - -CustomAttribute = _reflection.GeneratedProtocolMessageType( - "CustomAttribute", - (_message.Message,), - { - "DESCRIPTOR": _CUSTOMATTRIBUTE, - "__module__": "google.cloud.talent_v4beta1.proto.common_pb2", - "__doc__": """Custom attribute values that are either filterable or non-filterable. - - Attributes: - string_values: - Exactly one of [string_values][google.cloud.talent.v4beta1.Cus - tomAttribute.string_values] or [long_values][google.cloud.tale - nt.v4beta1.CustomAttribute.long_values] must be specified. - This field is used to perform a string match - (``CASE_SENSITIVE_MATCH`` or ``CASE_INSENSITIVE_MATCH``) - search. For filterable ``string_value``\ s, a maximum total - number of 200 values is allowed, with each ``string_value`` - has a byte size of no more than 500B. For unfilterable - ``string_values``, the maximum total byte size of unfilterable - ``string_values`` is 50KB. Empty string isn’t allowed. - long_values: - Exactly one of [string_values][google.cloud.talent.v4beta1.Cus - tomAttribute.string_values] or [long_values][google.cloud.tale - nt.v4beta1.CustomAttribute.long_values] must be specified. - This field is used to perform number range search. (``EQ``, - ``GT``, ``GE``, ``LE``, ``LT``) over filterable - ``long_value``. Currently at most 1 [long_values][google.clou - d.talent.v4beta1.CustomAttribute.long_values] is supported. - filterable: - If the ``filterable`` flag is true, custom field values are - searchable. If false, values are not searchable. Default is - false. - """, - # @@protoc_insertion_point(class_scope:google.cloud.talent.v4beta1.CustomAttribute) - }, -) -_sym_db.RegisterMessage(CustomAttribute) - -SpellingCorrection = _reflection.GeneratedProtocolMessageType( - "SpellingCorrection", - (_message.Message,), - { - "DESCRIPTOR": _SPELLINGCORRECTION, - "__module__": "google.cloud.talent_v4beta1.proto.common_pb2", - "__doc__": """Spell check result. - - Attributes: - corrected: - Indicates if the query was corrected by the spell checker. - corrected_text: - Correction output consisting of the corrected keyword string. - corrected_html: - Corrected output with html tags to highlight the corrected - words. Corrected words are called out with the “…” html tags. - For example, the user input query is “software enginear”, - where the second word, “enginear,” is incorrect. It should be - “engineer”. When spelling correction is enabled, this value is - “software engineer”. - """, - # @@protoc_insertion_point(class_scope:google.cloud.talent.v4beta1.SpellingCorrection) - }, -) -_sym_db.RegisterMessage(SpellingCorrection) - -CompensationInfo = _reflection.GeneratedProtocolMessageType( - "CompensationInfo", - (_message.Message,), - { - "CompensationEntry": _reflection.GeneratedProtocolMessageType( - "CompensationEntry", - (_message.Message,), - { - "DESCRIPTOR": _COMPENSATIONINFO_COMPENSATIONENTRY, - "__module__": "google.cloud.talent_v4beta1.proto.common_pb2", - "__doc__": """A compensation entry that represents one component of compensation, - such as base pay, bonus, or other compensation type. Annualization: - One compensation entry can be annualized if - it contains valid [amoun - t][google.cloud.talent.v4beta1.CompensationInfo.CompensationEntry.amou - nt] or [range][google.cloud.talent.v4beta1.CompensationInfo.Compensati - onEntry.range]. - and its [expected_units_per_year][google.cloud.talen - t.v4beta1.CompensationInfo.CompensationEntry.expected_units_per_year] - is set or can be derived. Its annualized range is determined as ([amou - nt][google.cloud.talent.v4beta1.CompensationInfo.CompensationEntry.amo - unt] or [range][google.cloud.talent.v4beta1.CompensationInfo.Compensat - ionEntry.range]) times [expected_units_per_year][google.cloud.talent.v - 4beta1.CompensationInfo.CompensationEntry.expected_units_per_year]. - - Attributes: - type: - Compensation type. Default is [CompensationType.COMPENSATION\_ - TYPE_UNSPECIFIED][google.cloud.talent.v4beta1.CompensationInfo - .CompensationType.COMPENSATION_TYPE_UNSPECIFIED]. - unit: - Frequency of the specified amount. Default is [CompensationUn - it.COMPENSATION_UNIT_UNSPECIFIED][google.cloud.talent.v4beta1. - CompensationInfo.CompensationUnit.COMPENSATION_UNIT_UNSPECIFIE - D]. - compensation_amount: - Compensation amount. It could be a fixed amount or a floating - range. - amount: - Compensation amount. - range: - Compensation range. - description: - Compensation description. For example, could indicate equity - terms or provide additional context to an estimated bonus. - expected_units_per_year: - Expected number of units paid each year. If not specified, - when [Job.employment_types][google.cloud.talent.v4beta1.Job.em - ployment_types] is FULLTIME, a default value is inferred based - on [unit][google.cloud.talent.v4beta1.CompensationInfo.Compens - ationEntry.unit]. Default values: - HOURLY: 2080 - DAILY: 260 - - WEEKLY: 52 - MONTHLY: 12 - ANNUAL: 1 - """, - # @@protoc_insertion_point(class_scope:google.cloud.talent.v4beta1.CompensationInfo.CompensationEntry) - }, - ), - "CompensationRange": _reflection.GeneratedProtocolMessageType( - "CompensationRange", - (_message.Message,), - { - "DESCRIPTOR": _COMPENSATIONINFO_COMPENSATIONRANGE, - "__module__": "google.cloud.talent_v4beta1.proto.common_pb2", - "__doc__": """Compensation range. - - Attributes: - max_compensation: - The maximum amount of compensation. If left empty, the value - is set to a maximal compensation value and the currency code - is set to match the [currency - code][google.type.Money.currency_code] of min_compensation. - min_compensation: - The minimum amount of compensation. If left empty, the value - is set to zero and the currency code is set to match the - [currency code][google.type.Money.currency_code] of - max_compensation. - """, - # @@protoc_insertion_point(class_scope:google.cloud.talent.v4beta1.CompensationInfo.CompensationRange) - }, - ), - "DESCRIPTOR": _COMPENSATIONINFO, - "__module__": "google.cloud.talent_v4beta1.proto.common_pb2", - "__doc__": """Job compensation details. - - Attributes: - entries: - Job compensation information. At most one entry can be of - type [CompensationInfo.CompensationType.BASE][google.cloud.tal - ent.v4beta1.CompensationInfo.CompensationType.BASE], which is - referred as **base compensation entry** for the job. - annualized_base_compensation_range: - Output only. Annualized base compensation range. Computed as - base compensation entry’s [CompensationEntry.amount][google.cl - oud.talent.v4beta1.CompensationInfo.CompensationEntry.amount] - times [CompensationEntry.expected_units_per_year][google.cloud - .talent.v4beta1.CompensationInfo.CompensationEntry.expected_un - its_per_year]. See [CompensationEntry][google.cloud.talent.v4 - beta1.CompensationInfo.CompensationEntry] for explanation on - compensation annualization. - annualized_total_compensation_range: - Output only. Annualized total compensation range. Computed as - all compensation entries’ [CompensationEntry.amount][google.cl - oud.talent.v4beta1.CompensationInfo.CompensationEntry.amount] - times [CompensationEntry.expected_units_per_year][google.cloud - .talent.v4beta1.CompensationInfo.CompensationEntry.expected_un - its_per_year]. See [CompensationEntry][google.cloud.talent.v4 - beta1.CompensationInfo.CompensationEntry] for explanation on - compensation annualization. - """, - # @@protoc_insertion_point(class_scope:google.cloud.talent.v4beta1.CompensationInfo) - }, -) -_sym_db.RegisterMessage(CompensationInfo) -_sym_db.RegisterMessage(CompensationInfo.CompensationEntry) -_sym_db.RegisterMessage(CompensationInfo.CompensationRange) - -Certification = _reflection.GeneratedProtocolMessageType( - "Certification", - (_message.Message,), - { - "DESCRIPTOR": _CERTIFICATION, - "__module__": "google.cloud.talent_v4beta1.proto.common_pb2", - "__doc__": """Resource that represents a license or certification. - - Attributes: - display_name: - Name of license or certification. Number of characters - allowed is 100. - acquire_date: - Acquisition date or effective date of license or - certification. - expire_date: - Expiration date of license of certification. - authority: - Authority of license, such as government. Number of - characters allowed is 100. - description: - Description of license or certification. Number of characters - allowed is 100,000. - """, - # @@protoc_insertion_point(class_scope:google.cloud.talent.v4beta1.Certification) - }, -) -_sym_db.RegisterMessage(Certification) - -Skill = _reflection.GeneratedProtocolMessageType( - "Skill", - (_message.Message,), - { - "DESCRIPTOR": _SKILL, - "__module__": "google.cloud.talent_v4beta1.proto.common_pb2", - "__doc__": """Resource that represents a skill of a candidate. - - Attributes: - display_name: - Skill display name. For example, “Java”, “Python”. Number of - characters allowed is 100. - last_used_date: - The last time this skill was used. - level: - Skill proficiency level which indicates how proficient the - candidate is at this skill. - context: - A paragraph describes context of this skill. Number of - characters allowed is 100,000. - skill_name_snippet: - Output only. Skill name snippet shows how the - [display_name][google.cloud.talent.v4beta1.Skill.display_name] - is related to a search query. It’s empty if the - [display_name][google.cloud.talent.v4beta1.Skill.display_name] - isn’t related to the search query. - """, - # @@protoc_insertion_point(class_scope:google.cloud.talent.v4beta1.Skill) - }, -) -_sym_db.RegisterMessage(Skill) - -Interview = _reflection.GeneratedProtocolMessageType( - "Interview", - (_message.Message,), - { - "DESCRIPTOR": _INTERVIEW, - "__module__": "google.cloud.talent_v4beta1.proto.common_pb2", - "__doc__": """Details of an interview. - - Attributes: - rating: - The rating on this interview. - outcome: - Required. The overall decision resulting from this interview - (positive, negative, nuetral). - """, - # @@protoc_insertion_point(class_scope:google.cloud.talent.v4beta1.Interview) - }, -) -_sym_db.RegisterMessage(Interview) - -Rating = _reflection.GeneratedProtocolMessageType( - "Rating", - (_message.Message,), - { - "DESCRIPTOR": _RATING, - "__module__": "google.cloud.talent_v4beta1.proto.common_pb2", - "__doc__": """The details of the score received for an assessment or interview. - - Attributes: - overall: - Overall score. - min: - The minimum value for the score. - max: - The maximum value for the score. - interval: - The steps within the score (for example, interval = 1 max = 5 - min = 1 indicates that the score can be 1, 2, 3, 4, or 5) - """, - # @@protoc_insertion_point(class_scope:google.cloud.talent.v4beta1.Rating) - }, -) -_sym_db.RegisterMessage(Rating) - -BatchOperationMetadata = _reflection.GeneratedProtocolMessageType( - "BatchOperationMetadata", - (_message.Message,), - { - "DESCRIPTOR": _BATCHOPERATIONMETADATA, - "__module__": "google.cloud.talent_v4beta1.proto.common_pb2", - "__doc__": """Metadata used for long running operations returned by CTS batch APIs. - It’s used to replace [google.longrunning.Operation.metadata][google.lo - ngrunning.Operation.metadata]. - - Attributes: - state: - The state of a long running operation. - state_description: - More detailed information about operation state. - success_count: - Count of successful item(s) inside an operation. - failure_count: - Count of failed item(s) inside an operation. - total_count: - Count of total item(s) inside an operation. - create_time: - The time when the batch operation is created. - update_time: - The time when the batch operation status is updated. The - metadata and the [update_time][google.cloud.talent.v4beta1.Bat - chOperationMetadata.update_time] is refreshed every minute - otherwise cached data is returned. - end_time: - The time when the batch operation is finished and [google.long - running.Operation.done][google.longrunning.Operation.done] is - set to ``true``. - """, - # @@protoc_insertion_point(class_scope:google.cloud.talent.v4beta1.BatchOperationMetadata) - }, -) -_sym_db.RegisterMessage(BatchOperationMetadata) - - -DESCRIPTOR._options = None -_VISIBILITY._options = None -_COMPENSATIONINFO.fields_by_name["annualized_base_compensation_range"]._options = None -_COMPENSATIONINFO.fields_by_name["annualized_total_compensation_range"]._options = None -_SKILL.fields_by_name["skill_name_snippet"]._options = None -_INTERVIEW.fields_by_name["outcome"]._options = None -# @@protoc_insertion_point(module_scope) diff --git a/google/cloud/talent_v4beta1/proto/common_pb2_grpc.py b/google/cloud/talent_v4beta1/proto/common_pb2_grpc.py deleted file mode 100644 index 8a939394..00000000 --- a/google/cloud/talent_v4beta1/proto/common_pb2_grpc.py +++ /dev/null @@ -1,3 +0,0 @@ -# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT! -"""Client and server classes corresponding to protobuf-defined services.""" -import grpc diff --git a/google/cloud/talent_v4beta1/proto/company_pb2.py b/google/cloud/talent_v4beta1/proto/company_pb2.py deleted file mode 100644 index c15977b7..00000000 --- a/google/cloud/talent_v4beta1/proto/company_pb2.py +++ /dev/null @@ -1,460 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by the protocol buffer compiler. DO NOT EDIT! -# source: google/cloud/talent_v4beta1/proto/company.proto -"""Generated protocol buffer code.""" -from google.protobuf import descriptor as _descriptor -from google.protobuf import message as _message -from google.protobuf import reflection as _reflection -from google.protobuf import symbol_database as _symbol_database - -# @@protoc_insertion_point(imports) - -_sym_db = _symbol_database.Default() - - -from google.api import field_behavior_pb2 as google_dot_api_dot_field__behavior__pb2 -from google.api import resource_pb2 as google_dot_api_dot_resource__pb2 -from google.cloud.talent_v4beta1.proto import ( - common_pb2 as google_dot_cloud_dot_talent__v4beta1_dot_proto_dot_common__pb2, -) -from google.api import annotations_pb2 as google_dot_api_dot_annotations__pb2 - - -DESCRIPTOR = _descriptor.FileDescriptor( - name="google/cloud/talent_v4beta1/proto/company.proto", - package="google.cloud.talent.v4beta1", - syntax="proto3", - serialized_options=b"\n\037com.google.cloud.talent.v4beta1B\024CompanyResourceProtoP\001ZAgoogle.golang.org/genproto/googleapis/cloud/talent/v4beta1;talent\242\002\003CTS", - create_key=_descriptor._internal_create_key, - serialized_pb=b'\n/google/cloud/talent_v4beta1/proto/company.proto\x12\x1bgoogle.cloud.talent.v4beta1\x1a\x1fgoogle/api/field_behavior.proto\x1a\x19google/api/resource.proto\x1a.google/cloud/talent_v4beta1/proto/common.proto\x1a\x1cgoogle/api/annotations.proto"\xfc\x04\n\x07\x43ompany\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\x19\n\x0c\x64isplay_name\x18\x02 \x01(\tB\x03\xe0\x41\x02\x12\x18\n\x0b\x65xternal_id\x18\x03 \x01(\tB\x03\xe0\x41\x02\x12\x36\n\x04size\x18\x04 \x01(\x0e\x32(.google.cloud.talent.v4beta1.CompanySize\x12\x1c\n\x14headquarters_address\x18\x05 \x01(\t\x12\x15\n\rhiring_agency\x18\x06 \x01(\x08\x12\x10\n\x08\x65\x65o_text\x18\x07 \x01(\t\x12\x13\n\x0bwebsite_uri\x18\x08 \x01(\t\x12\x17\n\x0f\x63\x61reer_site_uri\x18\t \x01(\t\x12\x11\n\timage_uri\x18\n \x01(\t\x12\x30\n(keyword_searchable_job_custom_attributes\x18\x0b \x03(\t\x12K\n\x0c\x64\x65rived_info\x18\x0c \x01(\x0b\x32\x30.google.cloud.talent.v4beta1.Company.DerivedInfoB\x03\xe0\x41\x03\x12\x16\n\tsuspended\x18\r \x01(\x08\x42\x03\xe0\x41\x03\x1aS\n\x0b\x44\x65rivedInfo\x12\x44\n\x15headquarters_location\x18\x01 \x01(\x0b\x32%.google.cloud.talent.v4beta1.Location:\x81\x01\xea\x41~\n\x1bjobs.googleapis.com/Company\x12\x37projects/{project}/tenants/{tenant}/companies/{company}\x12&projects/{project}/companies/{company}B\x82\x01\n\x1f\x63om.google.cloud.talent.v4beta1B\x14\x43ompanyResourceProtoP\x01ZAgoogle.golang.org/genproto/googleapis/cloud/talent/v4beta1;talent\xa2\x02\x03\x43TSb\x06proto3', - dependencies=[ - google_dot_api_dot_field__behavior__pb2.DESCRIPTOR, - google_dot_api_dot_resource__pb2.DESCRIPTOR, - google_dot_cloud_dot_talent__v4beta1_dot_proto_dot_common__pb2.DESCRIPTOR, - google_dot_api_dot_annotations__pb2.DESCRIPTOR, - ], -) - - -_COMPANY_DERIVEDINFO = _descriptor.Descriptor( - name="DerivedInfo", - full_name="google.cloud.talent.v4beta1.Company.DerivedInfo", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="headquarters_location", - full_name="google.cloud.talent.v4beta1.Company.DerivedInfo.headquarters_location", - index=0, - number=1, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=640, - serialized_end=723, -) - -_COMPANY = _descriptor.Descriptor( - name="Company", - full_name="google.cloud.talent.v4beta1.Company", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="name", - full_name="google.cloud.talent.v4beta1.Company.name", - index=0, - number=1, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="display_name", - full_name="google.cloud.talent.v4beta1.Company.display_name", - index=1, - number=2, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\002", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="external_id", - full_name="google.cloud.talent.v4beta1.Company.external_id", - index=2, - number=3, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\002", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="size", - full_name="google.cloud.talent.v4beta1.Company.size", - index=3, - number=4, - type=14, - cpp_type=8, - label=1, - has_default_value=False, - default_value=0, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="headquarters_address", - full_name="google.cloud.talent.v4beta1.Company.headquarters_address", - index=4, - number=5, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="hiring_agency", - full_name="google.cloud.talent.v4beta1.Company.hiring_agency", - index=5, - number=6, - type=8, - cpp_type=7, - label=1, - has_default_value=False, - default_value=False, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="eeo_text", - full_name="google.cloud.talent.v4beta1.Company.eeo_text", - index=6, - number=7, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="website_uri", - full_name="google.cloud.talent.v4beta1.Company.website_uri", - index=7, - number=8, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="career_site_uri", - full_name="google.cloud.talent.v4beta1.Company.career_site_uri", - index=8, - number=9, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="image_uri", - full_name="google.cloud.talent.v4beta1.Company.image_uri", - index=9, - number=10, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="keyword_searchable_job_custom_attributes", - full_name="google.cloud.talent.v4beta1.Company.keyword_searchable_job_custom_attributes", - index=10, - number=11, - type=9, - cpp_type=9, - label=3, - has_default_value=False, - default_value=[], - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="derived_info", - full_name="google.cloud.talent.v4beta1.Company.derived_info", - index=11, - number=12, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\003", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="suspended", - full_name="google.cloud.talent.v4beta1.Company.suspended", - index=12, - number=13, - type=8, - cpp_type=7, - label=1, - has_default_value=False, - default_value=False, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\003", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[_COMPANY_DERIVEDINFO,], - enum_types=[], - serialized_options=b"\352A~\n\033jobs.googleapis.com/Company\0227projects/{project}/tenants/{tenant}/companies/{company}\022&projects/{project}/companies/{company}", - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=219, - serialized_end=855, -) - -_COMPANY_DERIVEDINFO.fields_by_name[ - "headquarters_location" -].message_type = ( - google_dot_cloud_dot_talent__v4beta1_dot_proto_dot_common__pb2._LOCATION -) -_COMPANY_DERIVEDINFO.containing_type = _COMPANY -_COMPANY.fields_by_name[ - "size" -].enum_type = ( - google_dot_cloud_dot_talent__v4beta1_dot_proto_dot_common__pb2._COMPANYSIZE -) -_COMPANY.fields_by_name["derived_info"].message_type = _COMPANY_DERIVEDINFO -DESCRIPTOR.message_types_by_name["Company"] = _COMPANY -_sym_db.RegisterFileDescriptor(DESCRIPTOR) - -Company = _reflection.GeneratedProtocolMessageType( - "Company", - (_message.Message,), - { - "DerivedInfo": _reflection.GeneratedProtocolMessageType( - "DerivedInfo", - (_message.Message,), - { - "DESCRIPTOR": _COMPANY_DERIVEDINFO, - "__module__": "google.cloud.talent_v4beta1.proto.company_pb2", - "__doc__": """Derived details about the company. - - Attributes: - headquarters_location: - A structured headquarters location of the company, resolved - from [Company.headquarters_address][google.cloud.talent.v4beta - 1.Company.headquarters_address] if provided. - """, - # @@protoc_insertion_point(class_scope:google.cloud.talent.v4beta1.Company.DerivedInfo) - }, - ), - "DESCRIPTOR": _COMPANY, - "__module__": "google.cloud.talent_v4beta1.proto.company_pb2", - "__doc__": """A Company resource represents a company in the service. A company is - the entity that owns job postings, that is, the hiring entity - responsible for employing applicants for the job position. - - Attributes: - name: - Required during company update. The resource name for a - company. This is generated by the service when a company is - created. The format is “projects/{project_id}/tenants/{tenant - _id}/companies/{company_id}”, for example, - “projects/foo/tenants/bar/companies/baz”. If tenant id is - unspecified, the default tenant is used. For example, - “projects/foo/companies/bar”. - display_name: - Required. The display name of the company, for example, - “Google LLC”. - external_id: - Required. Client side company identifier, used to uniquely - identify the company. The maximum number of allowed - characters is 255. - size: - The employer’s company size. - headquarters_address: - The street address of the company’s main headquarters, which - may be different from the job location. The service attempts - to geolocate the provided address, and populates a more - specific location wherever possible in [DerivedInfo.headquarte - rs_location][google.cloud.talent.v4beta1.Company.DerivedInfo.h - eadquarters_location]. - hiring_agency: - Set to true if it is the hiring agency that post jobs for - other employers. Defaults to false if not provided. - eeo_text: - Equal Employment Opportunity legal disclaimer text to be - associated with all jobs, and typically to be displayed in all - roles. The maximum number of allowed characters is 500. - website_uri: - The URI representing the company’s primary web site or home - page, for example, “https://www.google.com”. The maximum - number of allowed characters is 255. - career_site_uri: - The URI to employer’s career site or careers page on the - employer’s web site, for example, - “https://careers.google.com”. - image_uri: - A URI that hosts the employer’s company logo. - keyword_searchable_job_custom_attributes: - A list of keys of filterable [Job.custom_attributes][google.cl - oud.talent.v4beta1.Job.custom_attributes], whose corresponding - ``string_values`` are used in keyword searches. Jobs with - ``string_values`` under these specified field keys are - returned if any of the values match the search keyword. Custom - field values with parenthesis, brackets and special symbols - are not searchable as-is, and those keyword queries must be - surrounded by quotes. - derived_info: - Output only. Derived details about the company. - suspended: - Output only. Indicates whether a company is flagged to be - suspended from public availability by the service when job - content appears suspicious, abusive, or spammy. - """, - # @@protoc_insertion_point(class_scope:google.cloud.talent.v4beta1.Company) - }, -) -_sym_db.RegisterMessage(Company) -_sym_db.RegisterMessage(Company.DerivedInfo) - - -DESCRIPTOR._options = None -_COMPANY.fields_by_name["display_name"]._options = None -_COMPANY.fields_by_name["external_id"]._options = None -_COMPANY.fields_by_name["derived_info"]._options = None -_COMPANY.fields_by_name["suspended"]._options = None -_COMPANY._options = None -# @@protoc_insertion_point(module_scope) diff --git a/google/cloud/talent_v4beta1/proto/company_pb2_grpc.py b/google/cloud/talent_v4beta1/proto/company_pb2_grpc.py deleted file mode 100644 index 8a939394..00000000 --- a/google/cloud/talent_v4beta1/proto/company_pb2_grpc.py +++ /dev/null @@ -1,3 +0,0 @@ -# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT! -"""Client and server classes corresponding to protobuf-defined services.""" -import grpc diff --git a/google/cloud/talent_v4beta1/proto/company_service_pb2.py b/google/cloud/talent_v4beta1/proto/company_service_pb2.py deleted file mode 100644 index 818b72ac..00000000 --- a/google/cloud/talent_v4beta1/proto/company_service_pb2.py +++ /dev/null @@ -1,681 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by the protocol buffer compiler. DO NOT EDIT! -# source: google/cloud/talent_v4beta1/proto/company_service.proto -"""Generated protocol buffer code.""" -from google.protobuf import descriptor as _descriptor -from google.protobuf import message as _message -from google.protobuf import reflection as _reflection -from google.protobuf import symbol_database as _symbol_database - -# @@protoc_insertion_point(imports) - -_sym_db = _symbol_database.Default() - - -from google.api import annotations_pb2 as google_dot_api_dot_annotations__pb2 -from google.api import client_pb2 as google_dot_api_dot_client__pb2 -from google.api import field_behavior_pb2 as google_dot_api_dot_field__behavior__pb2 -from google.api import resource_pb2 as google_dot_api_dot_resource__pb2 -from google.cloud.talent_v4beta1.proto import ( - common_pb2 as google_dot_cloud_dot_talent__v4beta1_dot_proto_dot_common__pb2, -) -from google.cloud.talent_v4beta1.proto import ( - company_pb2 as google_dot_cloud_dot_talent__v4beta1_dot_proto_dot_company__pb2, -) -from google.protobuf import empty_pb2 as google_dot_protobuf_dot_empty__pb2 -from google.protobuf import field_mask_pb2 as google_dot_protobuf_dot_field__mask__pb2 - - -DESCRIPTOR = _descriptor.FileDescriptor( - name="google/cloud/talent_v4beta1/proto/company_service.proto", - package="google.cloud.talent.v4beta1", - syntax="proto3", - serialized_options=b"\n\037com.google.cloud.talent.v4beta1B\023CompanyServiceProtoP\001ZAgoogle.golang.org/genproto/googleapis/cloud/talent/v4beta1;talent\242\002\003CTS", - create_key=_descriptor._internal_create_key, - serialized_pb=b'\n7google/cloud/talent_v4beta1/proto/company_service.proto\x12\x1bgoogle.cloud.talent.v4beta1\x1a\x1cgoogle/api/annotations.proto\x1a\x17google/api/client.proto\x1a\x1fgoogle/api/field_behavior.proto\x1a\x19google/api/resource.proto\x1a.google/cloud/talent_v4beta1/proto/common.proto\x1a/google/cloud/talent_v4beta1/proto/company.proto\x1a\x1bgoogle/protobuf/empty.proto\x1a google/protobuf/field_mask.proto"\x87\x01\n\x14\x43reateCompanyRequest\x12\x33\n\x06parent\x18\x01 \x01(\tB#\xe0\x41\x02\xfa\x41\x1d\x12\x1bjobs.googleapis.com/Company\x12:\n\x07\x63ompany\x18\x02 \x01(\x0b\x32$.google.cloud.talent.v4beta1.CompanyB\x03\xe0\x41\x02"F\n\x11GetCompanyRequest\x12\x31\n\x04name\x18\x01 \x01(\tB#\xe0\x41\x02\xfa\x41\x1d\n\x1bjobs.googleapis.com/Company"\x83\x01\n\x14UpdateCompanyRequest\x12:\n\x07\x63ompany\x18\x01 \x01(\x0b\x32$.google.cloud.talent.v4beta1.CompanyB\x03\xe0\x41\x02\x12/\n\x0bupdate_mask\x18\x02 \x01(\x0b\x32\x1a.google.protobuf.FieldMask"I\n\x14\x44\x65leteCompanyRequest\x12\x31\n\x04name\x18\x01 \x01(\tB#\xe0\x41\x02\xfa\x41\x1d\n\x1bjobs.googleapis.com/Company"\x8d\x01\n\x14ListCompaniesRequest\x12\x33\n\x06parent\x18\x01 \x01(\tB#\xe0\x41\x02\xfa\x41\x1d\x12\x1bjobs.googleapis.com/Company\x12\x12\n\npage_token\x18\x02 \x01(\t\x12\x11\n\tpage_size\x18\x03 \x01(\x05\x12\x19\n\x11require_open_jobs\x18\x04 \x01(\x08"\xaa\x01\n\x15ListCompaniesResponse\x12\x37\n\tcompanies\x18\x01 \x03(\x0b\x32$.google.cloud.talent.v4beta1.Company\x12\x17\n\x0fnext_page_token\x18\x02 \x01(\t\x12?\n\x08metadata\x18\x03 \x01(\x0b\x32-.google.cloud.talent.v4beta1.ResponseMetadata2\xd2\t\n\x0e\x43ompanyService\x12\xe3\x01\n\rCreateCompany\x12\x31.google.cloud.talent.v4beta1.CreateCompanyRequest\x1a$.google.cloud.talent.v4beta1.Company"y\x82\xd3\xe4\x93\x02\x62"0/v4beta1/{parent=projects/*/tenants/*}/companies:\x01*Z+"&/v4beta1/{parent=projects/*}/companies:\x01*\xda\x41\x0eparent,company\x12\xcd\x01\n\nGetCompany\x12..google.cloud.talent.v4beta1.GetCompanyRequest\x1a$.google.cloud.talent.v4beta1.Company"i\x82\xd3\xe4\x93\x02\\\x12\x30/v4beta1/{name=projects/*/tenants/*/companies/*}Z(\x12&/v4beta1/{name=projects/*/companies/*}\xda\x41\x04name\x12\xed\x01\n\rUpdateCompany\x12\x31.google.cloud.talent.v4beta1.UpdateCompanyRequest\x1a$.google.cloud.talent.v4beta1.Company"\x82\x01\x82\xd3\xe4\x93\x02r28/v4beta1/{company.name=projects/*/tenants/*/companies/*}:\x01*Z32./v4beta1/{company.name=projects/*/companies/*}:\x01*\xda\x41\x07\x63ompany\x12\xc5\x01\n\rDeleteCompany\x12\x31.google.cloud.talent.v4beta1.DeleteCompanyRequest\x1a\x16.google.protobuf.Empty"i\x82\xd3\xe4\x93\x02\\*0/v4beta1/{name=projects/*/tenants/*/companies/*}Z(*&/v4beta1/{name=projects/*/companies/*}\xda\x41\x04name\x12\xe3\x01\n\rListCompanies\x12\x31.google.cloud.talent.v4beta1.ListCompaniesRequest\x1a\x32.google.cloud.talent.v4beta1.ListCompaniesResponse"k\x82\xd3\xe4\x93\x02\\\x12\x30/v4beta1/{parent=projects/*/tenants/*}/companiesZ(\x12&/v4beta1/{parent=projects/*}/companies\xda\x41\x06parent\x1al\xca\x41\x13jobs.googleapis.com\xd2\x41Shttps://www.googleapis.com/auth/cloud-platform,https://www.googleapis.com/auth/jobsB\x81\x01\n\x1f\x63om.google.cloud.talent.v4beta1B\x13\x43ompanyServiceProtoP\x01ZAgoogle.golang.org/genproto/googleapis/cloud/talent/v4beta1;talent\xa2\x02\x03\x43TSb\x06proto3', - dependencies=[ - google_dot_api_dot_annotations__pb2.DESCRIPTOR, - google_dot_api_dot_client__pb2.DESCRIPTOR, - google_dot_api_dot_field__behavior__pb2.DESCRIPTOR, - google_dot_api_dot_resource__pb2.DESCRIPTOR, - google_dot_cloud_dot_talent__v4beta1_dot_proto_dot_common__pb2.DESCRIPTOR, - google_dot_cloud_dot_talent__v4beta1_dot_proto_dot_company__pb2.DESCRIPTOR, - google_dot_protobuf_dot_empty__pb2.DESCRIPTOR, - google_dot_protobuf_dot_field__mask__pb2.DESCRIPTOR, - ], -) - - -_CREATECOMPANYREQUEST = _descriptor.Descriptor( - name="CreateCompanyRequest", - full_name="google.cloud.talent.v4beta1.CreateCompanyRequest", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="parent", - full_name="google.cloud.talent.v4beta1.CreateCompanyRequest.parent", - index=0, - number=1, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\002\372A\035\022\033jobs.googleapis.com/Company", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="company", - full_name="google.cloud.talent.v4beta1.CreateCompanyRequest.company", - index=1, - number=2, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\002", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=364, - serialized_end=499, -) - - -_GETCOMPANYREQUEST = _descriptor.Descriptor( - name="GetCompanyRequest", - full_name="google.cloud.talent.v4beta1.GetCompanyRequest", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="name", - full_name="google.cloud.talent.v4beta1.GetCompanyRequest.name", - index=0, - number=1, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\002\372A\035\n\033jobs.googleapis.com/Company", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=501, - serialized_end=571, -) - - -_UPDATECOMPANYREQUEST = _descriptor.Descriptor( - name="UpdateCompanyRequest", - full_name="google.cloud.talent.v4beta1.UpdateCompanyRequest", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="company", - full_name="google.cloud.talent.v4beta1.UpdateCompanyRequest.company", - index=0, - number=1, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\002", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="update_mask", - full_name="google.cloud.talent.v4beta1.UpdateCompanyRequest.update_mask", - index=1, - number=2, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=574, - serialized_end=705, -) - - -_DELETECOMPANYREQUEST = _descriptor.Descriptor( - name="DeleteCompanyRequest", - full_name="google.cloud.talent.v4beta1.DeleteCompanyRequest", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="name", - full_name="google.cloud.talent.v4beta1.DeleteCompanyRequest.name", - index=0, - number=1, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\002\372A\035\n\033jobs.googleapis.com/Company", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=707, - serialized_end=780, -) - - -_LISTCOMPANIESREQUEST = _descriptor.Descriptor( - name="ListCompaniesRequest", - full_name="google.cloud.talent.v4beta1.ListCompaniesRequest", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="parent", - full_name="google.cloud.talent.v4beta1.ListCompaniesRequest.parent", - index=0, - number=1, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\002\372A\035\022\033jobs.googleapis.com/Company", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="page_token", - full_name="google.cloud.talent.v4beta1.ListCompaniesRequest.page_token", - index=1, - number=2, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="page_size", - full_name="google.cloud.talent.v4beta1.ListCompaniesRequest.page_size", - index=2, - number=3, - type=5, - cpp_type=1, - label=1, - has_default_value=False, - default_value=0, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="require_open_jobs", - full_name="google.cloud.talent.v4beta1.ListCompaniesRequest.require_open_jobs", - index=3, - number=4, - type=8, - cpp_type=7, - label=1, - has_default_value=False, - default_value=False, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=783, - serialized_end=924, -) - - -_LISTCOMPANIESRESPONSE = _descriptor.Descriptor( - name="ListCompaniesResponse", - full_name="google.cloud.talent.v4beta1.ListCompaniesResponse", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="companies", - full_name="google.cloud.talent.v4beta1.ListCompaniesResponse.companies", - index=0, - number=1, - type=11, - cpp_type=10, - label=3, - has_default_value=False, - default_value=[], - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="next_page_token", - full_name="google.cloud.talent.v4beta1.ListCompaniesResponse.next_page_token", - index=1, - number=2, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="metadata", - full_name="google.cloud.talent.v4beta1.ListCompaniesResponse.metadata", - index=2, - number=3, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=927, - serialized_end=1097, -) - -_CREATECOMPANYREQUEST.fields_by_name[ - "company" -].message_type = ( - google_dot_cloud_dot_talent__v4beta1_dot_proto_dot_company__pb2._COMPANY -) -_UPDATECOMPANYREQUEST.fields_by_name[ - "company" -].message_type = ( - google_dot_cloud_dot_talent__v4beta1_dot_proto_dot_company__pb2._COMPANY -) -_UPDATECOMPANYREQUEST.fields_by_name[ - "update_mask" -].message_type = google_dot_protobuf_dot_field__mask__pb2._FIELDMASK -_LISTCOMPANIESRESPONSE.fields_by_name[ - "companies" -].message_type = ( - google_dot_cloud_dot_talent__v4beta1_dot_proto_dot_company__pb2._COMPANY -) -_LISTCOMPANIESRESPONSE.fields_by_name[ - "metadata" -].message_type = ( - google_dot_cloud_dot_talent__v4beta1_dot_proto_dot_common__pb2._RESPONSEMETADATA -) -DESCRIPTOR.message_types_by_name["CreateCompanyRequest"] = _CREATECOMPANYREQUEST -DESCRIPTOR.message_types_by_name["GetCompanyRequest"] = _GETCOMPANYREQUEST -DESCRIPTOR.message_types_by_name["UpdateCompanyRequest"] = _UPDATECOMPANYREQUEST -DESCRIPTOR.message_types_by_name["DeleteCompanyRequest"] = _DELETECOMPANYREQUEST -DESCRIPTOR.message_types_by_name["ListCompaniesRequest"] = _LISTCOMPANIESREQUEST -DESCRIPTOR.message_types_by_name["ListCompaniesResponse"] = _LISTCOMPANIESRESPONSE -_sym_db.RegisterFileDescriptor(DESCRIPTOR) - -CreateCompanyRequest = _reflection.GeneratedProtocolMessageType( - "CreateCompanyRequest", - (_message.Message,), - { - "DESCRIPTOR": _CREATECOMPANYREQUEST, - "__module__": "google.cloud.talent_v4beta1.proto.company_service_pb2", - "__doc__": """The Request of the CreateCompany method. - - Attributes: - parent: - Required. Resource name of the tenant under which the company - is created. The format is - “projects/{project_id}/tenants/{tenant_id}”, for example, - “projects/foo/tenant/bar”. If tenant id is unspecified, a - default tenant is created, for example, “projects/foo”. - company: - Required. The company to be created. - """, - # @@protoc_insertion_point(class_scope:google.cloud.talent.v4beta1.CreateCompanyRequest) - }, -) -_sym_db.RegisterMessage(CreateCompanyRequest) - -GetCompanyRequest = _reflection.GeneratedProtocolMessageType( - "GetCompanyRequest", - (_message.Message,), - { - "DESCRIPTOR": _GETCOMPANYREQUEST, - "__module__": "google.cloud.talent_v4beta1.proto.company_service_pb2", - "__doc__": """Request for getting a company by name. - - Attributes: - name: - Required. The resource name of the company to be retrieved. - The format is “projects/{project_id}/tenants/{tenant_id}/compa - nies/{company_id}”, for example, “projects/api-test- - project/tenants/foo/companies/bar”. If tenant id is - unspecified, the default tenant is used, for example, - “projects/api-test-project/companies/bar”. - """, - # @@protoc_insertion_point(class_scope:google.cloud.talent.v4beta1.GetCompanyRequest) - }, -) -_sym_db.RegisterMessage(GetCompanyRequest) - -UpdateCompanyRequest = _reflection.GeneratedProtocolMessageType( - "UpdateCompanyRequest", - (_message.Message,), - { - "DESCRIPTOR": _UPDATECOMPANYREQUEST, - "__module__": "google.cloud.talent_v4beta1.proto.company_service_pb2", - "__doc__": """Request for updating a specified company. - - Attributes: - company: - Required. The company resource to replace the current resource - in the system. - update_mask: - Strongly recommended for the best service experience. If [upd - ate_mask][google.cloud.talent.v4beta1.UpdateCompanyRequest.upd - ate_mask] is provided, only the specified fields in [company][ - google.cloud.talent.v4beta1.UpdateCompanyRequest.company] are - updated. Otherwise all the fields are updated. A field mask - to specify the company fields to be updated. Only top level - fields of [Company][google.cloud.talent.v4beta1.Company] are - supported. - """, - # @@protoc_insertion_point(class_scope:google.cloud.talent.v4beta1.UpdateCompanyRequest) - }, -) -_sym_db.RegisterMessage(UpdateCompanyRequest) - -DeleteCompanyRequest = _reflection.GeneratedProtocolMessageType( - "DeleteCompanyRequest", - (_message.Message,), - { - "DESCRIPTOR": _DELETECOMPANYREQUEST, - "__module__": "google.cloud.talent_v4beta1.proto.company_service_pb2", - "__doc__": """Request to delete a company. - - Attributes: - name: - Required. The resource name of the company to be deleted. The - format is “projects/{project_id}/tenants/{tenant_id}/companies - /{company_id}”, for example, - “projects/foo/tenants/bar/companies/baz”. If tenant id is - unspecified, the default tenant is used, for example, - “projects/foo/companies/bar”. - """, - # @@protoc_insertion_point(class_scope:google.cloud.talent.v4beta1.DeleteCompanyRequest) - }, -) -_sym_db.RegisterMessage(DeleteCompanyRequest) - -ListCompaniesRequest = _reflection.GeneratedProtocolMessageType( - "ListCompaniesRequest", - (_message.Message,), - { - "DESCRIPTOR": _LISTCOMPANIESREQUEST, - "__module__": "google.cloud.talent_v4beta1.proto.company_service_pb2", - "__doc__": """List companies for which the client has ACL visibility. - - Attributes: - parent: - Required. Resource name of the tenant under which the company - is created. The format is - “projects/{project_id}/tenants/{tenant_id}”, for example, - “projects/foo/tenant/bar”. If tenant id is unspecified, the - default tenant will be used, for example, “projects/foo”. - page_token: - The starting indicator from which to return results. - page_size: - The maximum number of companies to be returned, at most 100. - Default is 100 if a non-positive number is provided. - require_open_jobs: - Set to true if the companies requested must have open jobs. - Defaults to false. If true, at most [page_size][google.cloud. - talent.v4beta1.ListCompaniesRequest.page_size] of companies - are fetched, among which only those with open jobs are - returned. - """, - # @@protoc_insertion_point(class_scope:google.cloud.talent.v4beta1.ListCompaniesRequest) - }, -) -_sym_db.RegisterMessage(ListCompaniesRequest) - -ListCompaniesResponse = _reflection.GeneratedProtocolMessageType( - "ListCompaniesResponse", - (_message.Message,), - { - "DESCRIPTOR": _LISTCOMPANIESRESPONSE, - "__module__": "google.cloud.talent_v4beta1.proto.company_service_pb2", - "__doc__": """The List companies response object. - - Attributes: - companies: - Companies for the current client. - next_page_token: - A token to retrieve the next page of results. - metadata: - Additional information for the API invocation, such as the - request tracking id. - """, - # @@protoc_insertion_point(class_scope:google.cloud.talent.v4beta1.ListCompaniesResponse) - }, -) -_sym_db.RegisterMessage(ListCompaniesResponse) - - -DESCRIPTOR._options = None -_CREATECOMPANYREQUEST.fields_by_name["parent"]._options = None -_CREATECOMPANYREQUEST.fields_by_name["company"]._options = None -_GETCOMPANYREQUEST.fields_by_name["name"]._options = None -_UPDATECOMPANYREQUEST.fields_by_name["company"]._options = None -_DELETECOMPANYREQUEST.fields_by_name["name"]._options = None -_LISTCOMPANIESREQUEST.fields_by_name["parent"]._options = None - -_COMPANYSERVICE = _descriptor.ServiceDescriptor( - name="CompanyService", - full_name="google.cloud.talent.v4beta1.CompanyService", - file=DESCRIPTOR, - index=0, - serialized_options=b"\312A\023jobs.googleapis.com\322AShttps://www.googleapis.com/auth/cloud-platform,https://www.googleapis.com/auth/jobs", - create_key=_descriptor._internal_create_key, - serialized_start=1100, - serialized_end=2334, - methods=[ - _descriptor.MethodDescriptor( - name="CreateCompany", - full_name="google.cloud.talent.v4beta1.CompanyService.CreateCompany", - index=0, - containing_service=None, - input_type=_CREATECOMPANYREQUEST, - output_type=google_dot_cloud_dot_talent__v4beta1_dot_proto_dot_company__pb2._COMPANY, - serialized_options=b'\202\323\344\223\002b"0/v4beta1/{parent=projects/*/tenants/*}/companies:\001*Z+"&/v4beta1/{parent=projects/*}/companies:\001*\332A\016parent,company', - create_key=_descriptor._internal_create_key, - ), - _descriptor.MethodDescriptor( - name="GetCompany", - full_name="google.cloud.talent.v4beta1.CompanyService.GetCompany", - index=1, - containing_service=None, - input_type=_GETCOMPANYREQUEST, - output_type=google_dot_cloud_dot_talent__v4beta1_dot_proto_dot_company__pb2._COMPANY, - serialized_options=b"\202\323\344\223\002\\\0220/v4beta1/{name=projects/*/tenants/*/companies/*}Z(\022&/v4beta1/{name=projects/*/companies/*}\332A\004name", - create_key=_descriptor._internal_create_key, - ), - _descriptor.MethodDescriptor( - name="UpdateCompany", - full_name="google.cloud.talent.v4beta1.CompanyService.UpdateCompany", - index=2, - containing_service=None, - input_type=_UPDATECOMPANYREQUEST, - output_type=google_dot_cloud_dot_talent__v4beta1_dot_proto_dot_company__pb2._COMPANY, - serialized_options=b"\202\323\344\223\002r28/v4beta1/{company.name=projects/*/tenants/*/companies/*}:\001*Z32./v4beta1/{company.name=projects/*/companies/*}:\001*\332A\007company", - create_key=_descriptor._internal_create_key, - ), - _descriptor.MethodDescriptor( - name="DeleteCompany", - full_name="google.cloud.talent.v4beta1.CompanyService.DeleteCompany", - index=3, - containing_service=None, - input_type=_DELETECOMPANYREQUEST, - output_type=google_dot_protobuf_dot_empty__pb2._EMPTY, - serialized_options=b"\202\323\344\223\002\\*0/v4beta1/{name=projects/*/tenants/*/companies/*}Z(*&/v4beta1/{name=projects/*/companies/*}\332A\004name", - create_key=_descriptor._internal_create_key, - ), - _descriptor.MethodDescriptor( - name="ListCompanies", - full_name="google.cloud.talent.v4beta1.CompanyService.ListCompanies", - index=4, - containing_service=None, - input_type=_LISTCOMPANIESREQUEST, - output_type=_LISTCOMPANIESRESPONSE, - serialized_options=b"\202\323\344\223\002\\\0220/v4beta1/{parent=projects/*/tenants/*}/companiesZ(\022&/v4beta1/{parent=projects/*}/companies\332A\006parent", - create_key=_descriptor._internal_create_key, - ), - ], -) -_sym_db.RegisterServiceDescriptor(_COMPANYSERVICE) - -DESCRIPTOR.services_by_name["CompanyService"] = _COMPANYSERVICE - -# @@protoc_insertion_point(module_scope) diff --git a/google/cloud/talent_v4beta1/proto/company_service_pb2_grpc.py b/google/cloud/talent_v4beta1/proto/company_service_pb2_grpc.py deleted file mode 100644 index b733bff2..00000000 --- a/google/cloud/talent_v4beta1/proto/company_service_pb2_grpc.py +++ /dev/null @@ -1,264 +0,0 @@ -# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT! -"""Client and server classes corresponding to protobuf-defined services.""" -import grpc - -from google.cloud.talent_v4beta1.proto import ( - company_pb2 as google_dot_cloud_dot_talent__v4beta1_dot_proto_dot_company__pb2, -) -from google.cloud.talent_v4beta1.proto import ( - company_service_pb2 as google_dot_cloud_dot_talent__v4beta1_dot_proto_dot_company__service__pb2, -) -from google.protobuf import empty_pb2 as google_dot_protobuf_dot_empty__pb2 - - -class CompanyServiceStub(object): - """A service that handles company management, including CRUD and enumeration. - """ - - def __init__(self, channel): - """Constructor. - - Args: - channel: A grpc.Channel. - """ - self.CreateCompany = channel.unary_unary( - "/google.cloud.talent.v4beta1.CompanyService/CreateCompany", - request_serializer=google_dot_cloud_dot_talent__v4beta1_dot_proto_dot_company__service__pb2.CreateCompanyRequest.SerializeToString, - response_deserializer=google_dot_cloud_dot_talent__v4beta1_dot_proto_dot_company__pb2.Company.FromString, - ) - self.GetCompany = channel.unary_unary( - "/google.cloud.talent.v4beta1.CompanyService/GetCompany", - request_serializer=google_dot_cloud_dot_talent__v4beta1_dot_proto_dot_company__service__pb2.GetCompanyRequest.SerializeToString, - response_deserializer=google_dot_cloud_dot_talent__v4beta1_dot_proto_dot_company__pb2.Company.FromString, - ) - self.UpdateCompany = channel.unary_unary( - "/google.cloud.talent.v4beta1.CompanyService/UpdateCompany", - request_serializer=google_dot_cloud_dot_talent__v4beta1_dot_proto_dot_company__service__pb2.UpdateCompanyRequest.SerializeToString, - response_deserializer=google_dot_cloud_dot_talent__v4beta1_dot_proto_dot_company__pb2.Company.FromString, - ) - self.DeleteCompany = channel.unary_unary( - "/google.cloud.talent.v4beta1.CompanyService/DeleteCompany", - request_serializer=google_dot_cloud_dot_talent__v4beta1_dot_proto_dot_company__service__pb2.DeleteCompanyRequest.SerializeToString, - response_deserializer=google_dot_protobuf_dot_empty__pb2.Empty.FromString, - ) - self.ListCompanies = channel.unary_unary( - "/google.cloud.talent.v4beta1.CompanyService/ListCompanies", - request_serializer=google_dot_cloud_dot_talent__v4beta1_dot_proto_dot_company__service__pb2.ListCompaniesRequest.SerializeToString, - response_deserializer=google_dot_cloud_dot_talent__v4beta1_dot_proto_dot_company__service__pb2.ListCompaniesResponse.FromString, - ) - - -class CompanyServiceServicer(object): - """A service that handles company management, including CRUD and enumeration. - """ - - def CreateCompany(self, request, context): - """Creates a new company entity. - """ - context.set_code(grpc.StatusCode.UNIMPLEMENTED) - context.set_details("Method not implemented!") - raise NotImplementedError("Method not implemented!") - - def GetCompany(self, request, context): - """Retrieves specified company. - """ - context.set_code(grpc.StatusCode.UNIMPLEMENTED) - context.set_details("Method not implemented!") - raise NotImplementedError("Method not implemented!") - - def UpdateCompany(self, request, context): - """Updates specified company. - """ - context.set_code(grpc.StatusCode.UNIMPLEMENTED) - context.set_details("Method not implemented!") - raise NotImplementedError("Method not implemented!") - - def DeleteCompany(self, request, context): - """Deletes specified company. - Prerequisite: The company has no jobs associated with it. - """ - context.set_code(grpc.StatusCode.UNIMPLEMENTED) - context.set_details("Method not implemented!") - raise NotImplementedError("Method not implemented!") - - def ListCompanies(self, request, context): - """Lists all companies associated with the project. - """ - context.set_code(grpc.StatusCode.UNIMPLEMENTED) - context.set_details("Method not implemented!") - raise NotImplementedError("Method not implemented!") - - -def add_CompanyServiceServicer_to_server(servicer, server): - rpc_method_handlers = { - "CreateCompany": grpc.unary_unary_rpc_method_handler( - servicer.CreateCompany, - request_deserializer=google_dot_cloud_dot_talent__v4beta1_dot_proto_dot_company__service__pb2.CreateCompanyRequest.FromString, - response_serializer=google_dot_cloud_dot_talent__v4beta1_dot_proto_dot_company__pb2.Company.SerializeToString, - ), - "GetCompany": grpc.unary_unary_rpc_method_handler( - servicer.GetCompany, - request_deserializer=google_dot_cloud_dot_talent__v4beta1_dot_proto_dot_company__service__pb2.GetCompanyRequest.FromString, - response_serializer=google_dot_cloud_dot_talent__v4beta1_dot_proto_dot_company__pb2.Company.SerializeToString, - ), - "UpdateCompany": grpc.unary_unary_rpc_method_handler( - servicer.UpdateCompany, - request_deserializer=google_dot_cloud_dot_talent__v4beta1_dot_proto_dot_company__service__pb2.UpdateCompanyRequest.FromString, - response_serializer=google_dot_cloud_dot_talent__v4beta1_dot_proto_dot_company__pb2.Company.SerializeToString, - ), - "DeleteCompany": grpc.unary_unary_rpc_method_handler( - servicer.DeleteCompany, - request_deserializer=google_dot_cloud_dot_talent__v4beta1_dot_proto_dot_company__service__pb2.DeleteCompanyRequest.FromString, - response_serializer=google_dot_protobuf_dot_empty__pb2.Empty.SerializeToString, - ), - "ListCompanies": grpc.unary_unary_rpc_method_handler( - servicer.ListCompanies, - request_deserializer=google_dot_cloud_dot_talent__v4beta1_dot_proto_dot_company__service__pb2.ListCompaniesRequest.FromString, - response_serializer=google_dot_cloud_dot_talent__v4beta1_dot_proto_dot_company__service__pb2.ListCompaniesResponse.SerializeToString, - ), - } - generic_handler = grpc.method_handlers_generic_handler( - "google.cloud.talent.v4beta1.CompanyService", rpc_method_handlers - ) - server.add_generic_rpc_handlers((generic_handler,)) - - -# This class is part of an EXPERIMENTAL API. -class CompanyService(object): - """A service that handles company management, including CRUD and enumeration. - """ - - @staticmethod - def CreateCompany( - request, - target, - options=(), - channel_credentials=None, - call_credentials=None, - compression=None, - wait_for_ready=None, - timeout=None, - metadata=None, - ): - return grpc.experimental.unary_unary( - request, - target, - "/google.cloud.talent.v4beta1.CompanyService/CreateCompany", - google_dot_cloud_dot_talent__v4beta1_dot_proto_dot_company__service__pb2.CreateCompanyRequest.SerializeToString, - google_dot_cloud_dot_talent__v4beta1_dot_proto_dot_company__pb2.Company.FromString, - options, - channel_credentials, - call_credentials, - compression, - wait_for_ready, - timeout, - metadata, - ) - - @staticmethod - def GetCompany( - request, - target, - options=(), - channel_credentials=None, - call_credentials=None, - compression=None, - wait_for_ready=None, - timeout=None, - metadata=None, - ): - return grpc.experimental.unary_unary( - request, - target, - "/google.cloud.talent.v4beta1.CompanyService/GetCompany", - google_dot_cloud_dot_talent__v4beta1_dot_proto_dot_company__service__pb2.GetCompanyRequest.SerializeToString, - google_dot_cloud_dot_talent__v4beta1_dot_proto_dot_company__pb2.Company.FromString, - options, - channel_credentials, - call_credentials, - compression, - wait_for_ready, - timeout, - metadata, - ) - - @staticmethod - def UpdateCompany( - request, - target, - options=(), - channel_credentials=None, - call_credentials=None, - compression=None, - wait_for_ready=None, - timeout=None, - metadata=None, - ): - return grpc.experimental.unary_unary( - request, - target, - "/google.cloud.talent.v4beta1.CompanyService/UpdateCompany", - google_dot_cloud_dot_talent__v4beta1_dot_proto_dot_company__service__pb2.UpdateCompanyRequest.SerializeToString, - google_dot_cloud_dot_talent__v4beta1_dot_proto_dot_company__pb2.Company.FromString, - options, - channel_credentials, - call_credentials, - compression, - wait_for_ready, - timeout, - metadata, - ) - - @staticmethod - def DeleteCompany( - request, - target, - options=(), - channel_credentials=None, - call_credentials=None, - compression=None, - wait_for_ready=None, - timeout=None, - metadata=None, - ): - return grpc.experimental.unary_unary( - request, - target, - "/google.cloud.talent.v4beta1.CompanyService/DeleteCompany", - google_dot_cloud_dot_talent__v4beta1_dot_proto_dot_company__service__pb2.DeleteCompanyRequest.SerializeToString, - google_dot_protobuf_dot_empty__pb2.Empty.FromString, - options, - channel_credentials, - call_credentials, - compression, - wait_for_ready, - timeout, - metadata, - ) - - @staticmethod - def ListCompanies( - request, - target, - options=(), - channel_credentials=None, - call_credentials=None, - compression=None, - wait_for_ready=None, - timeout=None, - metadata=None, - ): - return grpc.experimental.unary_unary( - request, - target, - "/google.cloud.talent.v4beta1.CompanyService/ListCompanies", - google_dot_cloud_dot_talent__v4beta1_dot_proto_dot_company__service__pb2.ListCompaniesRequest.SerializeToString, - google_dot_cloud_dot_talent__v4beta1_dot_proto_dot_company__service__pb2.ListCompaniesResponse.FromString, - options, - channel_credentials, - call_credentials, - compression, - wait_for_ready, - timeout, - metadata, - ) diff --git a/google/cloud/talent_v4beta1/proto/completion_service_pb2.py b/google/cloud/talent_v4beta1/proto/completion_service_pb2.py deleted file mode 100644 index 098a6643..00000000 --- a/google/cloud/talent_v4beta1/proto/completion_service_pb2.py +++ /dev/null @@ -1,570 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by the protocol buffer compiler. DO NOT EDIT! -# source: google/cloud/talent_v4beta1/proto/completion_service.proto -"""Generated protocol buffer code.""" -from google.protobuf import descriptor as _descriptor -from google.protobuf import message as _message -from google.protobuf import reflection as _reflection -from google.protobuf import symbol_database as _symbol_database - -# @@protoc_insertion_point(imports) - -_sym_db = _symbol_database.Default() - - -from google.api import annotations_pb2 as google_dot_api_dot_annotations__pb2 -from google.api import field_behavior_pb2 as google_dot_api_dot_field__behavior__pb2 -from google.api import resource_pb2 as google_dot_api_dot_resource__pb2 -from google.cloud.talent_v4beta1.proto import ( - common_pb2 as google_dot_cloud_dot_talent__v4beta1_dot_proto_dot_common__pb2, -) -from google.api import client_pb2 as google_dot_api_dot_client__pb2 - - -DESCRIPTOR = _descriptor.FileDescriptor( - name="google/cloud/talent_v4beta1/proto/completion_service.proto", - package="google.cloud.talent.v4beta1", - syntax="proto3", - serialized_options=b"\n\037com.google.cloud.talent.v4beta1B\026CompletionServiceProtoP\001ZAgoogle.golang.org/genproto/googleapis/cloud/talent/v4beta1;talent\242\002\003CTS", - create_key=_descriptor._internal_create_key, - serialized_pb=b'\n:google/cloud/talent_v4beta1/proto/completion_service.proto\x12\x1bgoogle.cloud.talent.v4beta1\x1a\x1cgoogle/api/annotations.proto\x1a\x1fgoogle/api/field_behavior.proto\x1a\x19google/api/resource.proto\x1a.google/cloud/talent_v4beta1/proto/common.proto\x1a\x17google/api/client.proto"\x93\x04\n\x14\x43ompleteQueryRequest\x12\x33\n\x06parent\x18\x01 \x01(\tB#\xe0\x41\x02\xfa\x41\x1d\x12\x1bjobs.googleapis.com/Company\x12\x12\n\x05query\x18\x02 \x01(\tB\x03\xe0\x41\x02\x12\x16\n\x0elanguage_codes\x18\x03 \x03(\t\x12\x16\n\tpage_size\x18\x04 \x01(\x05\x42\x03\xe0\x41\x02\x12\x31\n\x07\x63ompany\x18\x05 \x01(\tB \xfa\x41\x1d\n\x1bjobs.googleapis.com/Company\x12P\n\x05scope\x18\x06 \x01(\x0e\x32\x41.google.cloud.talent.v4beta1.CompleteQueryRequest.CompletionScope\x12N\n\x04type\x18\x07 \x01(\x0e\x32@.google.cloud.talent.v4beta1.CompleteQueryRequest.CompletionType"K\n\x0f\x43ompletionScope\x12 \n\x1c\x43OMPLETION_SCOPE_UNSPECIFIED\x10\x00\x12\n\n\x06TENANT\x10\x01\x12\n\n\x06PUBLIC\x10\x02"`\n\x0e\x43ompletionType\x12\x1f\n\x1b\x43OMPLETION_TYPE_UNSPECIFIED\x10\x00\x12\r\n\tJOB_TITLE\x10\x01\x12\x10\n\x0c\x43OMPANY_NAME\x10\x02\x12\x0c\n\x08\x43OMBINED\x10\x03"\xc5\x02\n\x15\x43ompleteQueryResponse\x12_\n\x12\x63ompletion_results\x18\x01 \x03(\x0b\x32\x43.google.cloud.talent.v4beta1.CompleteQueryResponse.CompletionResult\x12?\n\x08metadata\x18\x02 \x01(\x0b\x32-.google.cloud.talent.v4beta1.ResponseMetadata\x1a\x89\x01\n\x10\x43ompletionResult\x12\x12\n\nsuggestion\x18\x01 \x01(\t\x12N\n\x04type\x18\x02 \x01(\x0e\x32@.google.cloud.talent.v4beta1.CompleteQueryRequest.CompletionType\x12\x11\n\timage_uri\x18\x03 \x01(\t2\xd5\x02\n\nCompletion\x12\xd8\x01\n\rCompleteQuery\x12\x31.google.cloud.talent.v4beta1.CompleteQueryRequest\x1a\x32.google.cloud.talent.v4beta1.CompleteQueryResponse"`\x82\xd3\xe4\x93\x02Z\x12//v4beta1/{parent=projects/*/tenants/*}:completeZ\'\x12%/v4beta1/{parent=projects/*}:complete\x1al\xca\x41\x13jobs.googleapis.com\xd2\x41Shttps://www.googleapis.com/auth/cloud-platform,https://www.googleapis.com/auth/jobsB\x84\x01\n\x1f\x63om.google.cloud.talent.v4beta1B\x16\x43ompletionServiceProtoP\x01ZAgoogle.golang.org/genproto/googleapis/cloud/talent/v4beta1;talent\xa2\x02\x03\x43TSb\x06proto3', - dependencies=[ - google_dot_api_dot_annotations__pb2.DESCRIPTOR, - google_dot_api_dot_field__behavior__pb2.DESCRIPTOR, - google_dot_api_dot_resource__pb2.DESCRIPTOR, - google_dot_cloud_dot_talent__v4beta1_dot_proto_dot_common__pb2.DESCRIPTOR, - google_dot_api_dot_client__pb2.DESCRIPTOR, - ], -) - - -_COMPLETEQUERYREQUEST_COMPLETIONSCOPE = _descriptor.EnumDescriptor( - name="CompletionScope", - full_name="google.cloud.talent.v4beta1.CompleteQueryRequest.CompletionScope", - filename=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - values=[ - _descriptor.EnumValueDescriptor( - name="COMPLETION_SCOPE_UNSPECIFIED", - index=0, - number=0, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="TENANT", - index=1, - number=1, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="PUBLIC", - index=2, - number=2, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - ], - containing_type=None, - serialized_options=None, - serialized_start=613, - serialized_end=688, -) -_sym_db.RegisterEnumDescriptor(_COMPLETEQUERYREQUEST_COMPLETIONSCOPE) - -_COMPLETEQUERYREQUEST_COMPLETIONTYPE = _descriptor.EnumDescriptor( - name="CompletionType", - full_name="google.cloud.talent.v4beta1.CompleteQueryRequest.CompletionType", - filename=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - values=[ - _descriptor.EnumValueDescriptor( - name="COMPLETION_TYPE_UNSPECIFIED", - index=0, - number=0, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="JOB_TITLE", - index=1, - number=1, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="COMPANY_NAME", - index=2, - number=2, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="COMBINED", - index=3, - number=3, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - ], - containing_type=None, - serialized_options=None, - serialized_start=690, - serialized_end=786, -) -_sym_db.RegisterEnumDescriptor(_COMPLETEQUERYREQUEST_COMPLETIONTYPE) - - -_COMPLETEQUERYREQUEST = _descriptor.Descriptor( - name="CompleteQueryRequest", - full_name="google.cloud.talent.v4beta1.CompleteQueryRequest", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="parent", - full_name="google.cloud.talent.v4beta1.CompleteQueryRequest.parent", - index=0, - number=1, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\002\372A\035\022\033jobs.googleapis.com/Company", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="query", - full_name="google.cloud.talent.v4beta1.CompleteQueryRequest.query", - index=1, - number=2, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\002", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="language_codes", - full_name="google.cloud.talent.v4beta1.CompleteQueryRequest.language_codes", - index=2, - number=3, - type=9, - cpp_type=9, - label=3, - has_default_value=False, - default_value=[], - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="page_size", - full_name="google.cloud.talent.v4beta1.CompleteQueryRequest.page_size", - index=3, - number=4, - type=5, - cpp_type=1, - label=1, - has_default_value=False, - default_value=0, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\002", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="company", - full_name="google.cloud.talent.v4beta1.CompleteQueryRequest.company", - index=4, - number=5, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\372A\035\n\033jobs.googleapis.com/Company", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="scope", - full_name="google.cloud.talent.v4beta1.CompleteQueryRequest.scope", - index=5, - number=6, - type=14, - cpp_type=8, - label=1, - has_default_value=False, - default_value=0, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="type", - full_name="google.cloud.talent.v4beta1.CompleteQueryRequest.type", - index=6, - number=7, - type=14, - cpp_type=8, - label=1, - has_default_value=False, - default_value=0, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[], - enum_types=[ - _COMPLETEQUERYREQUEST_COMPLETIONSCOPE, - _COMPLETEQUERYREQUEST_COMPLETIONTYPE, - ], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=255, - serialized_end=786, -) - - -_COMPLETEQUERYRESPONSE_COMPLETIONRESULT = _descriptor.Descriptor( - name="CompletionResult", - full_name="google.cloud.talent.v4beta1.CompleteQueryResponse.CompletionResult", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="suggestion", - full_name="google.cloud.talent.v4beta1.CompleteQueryResponse.CompletionResult.suggestion", - index=0, - number=1, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="type", - full_name="google.cloud.talent.v4beta1.CompleteQueryResponse.CompletionResult.type", - index=1, - number=2, - type=14, - cpp_type=8, - label=1, - has_default_value=False, - default_value=0, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="image_uri", - full_name="google.cloud.talent.v4beta1.CompleteQueryResponse.CompletionResult.image_uri", - index=2, - number=3, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=977, - serialized_end=1114, -) - -_COMPLETEQUERYRESPONSE = _descriptor.Descriptor( - name="CompleteQueryResponse", - full_name="google.cloud.talent.v4beta1.CompleteQueryResponse", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="completion_results", - full_name="google.cloud.talent.v4beta1.CompleteQueryResponse.completion_results", - index=0, - number=1, - type=11, - cpp_type=10, - label=3, - has_default_value=False, - default_value=[], - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="metadata", - full_name="google.cloud.talent.v4beta1.CompleteQueryResponse.metadata", - index=1, - number=2, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[_COMPLETEQUERYRESPONSE_COMPLETIONRESULT,], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=789, - serialized_end=1114, -) - -_COMPLETEQUERYREQUEST.fields_by_name[ - "scope" -].enum_type = _COMPLETEQUERYREQUEST_COMPLETIONSCOPE -_COMPLETEQUERYREQUEST.fields_by_name[ - "type" -].enum_type = _COMPLETEQUERYREQUEST_COMPLETIONTYPE -_COMPLETEQUERYREQUEST_COMPLETIONSCOPE.containing_type = _COMPLETEQUERYREQUEST -_COMPLETEQUERYREQUEST_COMPLETIONTYPE.containing_type = _COMPLETEQUERYREQUEST -_COMPLETEQUERYRESPONSE_COMPLETIONRESULT.fields_by_name[ - "type" -].enum_type = _COMPLETEQUERYREQUEST_COMPLETIONTYPE -_COMPLETEQUERYRESPONSE_COMPLETIONRESULT.containing_type = _COMPLETEQUERYRESPONSE -_COMPLETEQUERYRESPONSE.fields_by_name[ - "completion_results" -].message_type = _COMPLETEQUERYRESPONSE_COMPLETIONRESULT -_COMPLETEQUERYRESPONSE.fields_by_name[ - "metadata" -].message_type = ( - google_dot_cloud_dot_talent__v4beta1_dot_proto_dot_common__pb2._RESPONSEMETADATA -) -DESCRIPTOR.message_types_by_name["CompleteQueryRequest"] = _COMPLETEQUERYREQUEST -DESCRIPTOR.message_types_by_name["CompleteQueryResponse"] = _COMPLETEQUERYRESPONSE -_sym_db.RegisterFileDescriptor(DESCRIPTOR) - -CompleteQueryRequest = _reflection.GeneratedProtocolMessageType( - "CompleteQueryRequest", - (_message.Message,), - { - "DESCRIPTOR": _COMPLETEQUERYREQUEST, - "__module__": "google.cloud.talent_v4beta1.proto.completion_service_pb2", - "__doc__": """Auto-complete parameters. - - Attributes: - parent: - Required. Resource name of tenant the completion is performed - within. The format is - “projects/{project_id}/tenants/{tenant_id}”, for example, - “projects/foo/tenant/bar”. If tenant id is unspecified, the - default tenant is used, for example, “projects/foo”. - query: - Required. The query used to generate suggestions. The maximum - number of allowed characters is 255. - language_codes: - The list of languages of the query. This is the BCP-47 - language code, such as “en-US” or “sr-Latn”. For more - information, see `Tags for Identifying Languages - `__. The maximum number of - allowed characters is 255. - page_size: - Required. Completion result count. The maximum allowed page - size is 10. - company: - If provided, restricts completion to specified company. The - format is “projects/{project_id}/tenants/{tenant_id}/companies - /{company_id}”, for example, - “projects/foo/tenants/bar/companies/baz”. If tenant id is - unspecified, the default tenant is used, for example, - “projects/foo”. - scope: - The scope of the completion. The defaults is [CompletionScope. - PUBLIC][google.cloud.talent.v4beta1.CompleteQueryRequest.Compl - etionScope.PUBLIC]. - type: - The completion topic. The default is [CompletionType.COMBINED] - [google.cloud.talent.v4beta1.CompleteQueryRequest.CompletionTy - pe.COMBINED]. - """, - # @@protoc_insertion_point(class_scope:google.cloud.talent.v4beta1.CompleteQueryRequest) - }, -) -_sym_db.RegisterMessage(CompleteQueryRequest) - -CompleteQueryResponse = _reflection.GeneratedProtocolMessageType( - "CompleteQueryResponse", - (_message.Message,), - { - "CompletionResult": _reflection.GeneratedProtocolMessageType( - "CompletionResult", - (_message.Message,), - { - "DESCRIPTOR": _COMPLETEQUERYRESPONSE_COMPLETIONRESULT, - "__module__": "google.cloud.talent_v4beta1.proto.completion_service_pb2", - "__doc__": """Resource that represents completion results. - - Attributes: - suggestion: - The suggestion for the query. - type: - The completion topic. - image_uri: - The URI of the company image for [COMPANY_NAME][google.cloud.t - alent.v4beta1.CompleteQueryRequest.CompletionType.COMPANY_NAME - ]. - """, - # @@protoc_insertion_point(class_scope:google.cloud.talent.v4beta1.CompleteQueryResponse.CompletionResult) - }, - ), - "DESCRIPTOR": _COMPLETEQUERYRESPONSE, - "__module__": "google.cloud.talent_v4beta1.proto.completion_service_pb2", - "__doc__": """Response of auto-complete query. - - Attributes: - completion_results: - Results of the matching job/company candidates. - metadata: - Additional information for the API invocation, such as the - request tracking id. - """, - # @@protoc_insertion_point(class_scope:google.cloud.talent.v4beta1.CompleteQueryResponse) - }, -) -_sym_db.RegisterMessage(CompleteQueryResponse) -_sym_db.RegisterMessage(CompleteQueryResponse.CompletionResult) - - -DESCRIPTOR._options = None -_COMPLETEQUERYREQUEST.fields_by_name["parent"]._options = None -_COMPLETEQUERYREQUEST.fields_by_name["query"]._options = None -_COMPLETEQUERYREQUEST.fields_by_name["page_size"]._options = None -_COMPLETEQUERYREQUEST.fields_by_name["company"]._options = None - -_COMPLETION = _descriptor.ServiceDescriptor( - name="Completion", - full_name="google.cloud.talent.v4beta1.Completion", - file=DESCRIPTOR, - index=0, - serialized_options=b"\312A\023jobs.googleapis.com\322AShttps://www.googleapis.com/auth/cloud-platform,https://www.googleapis.com/auth/jobs", - create_key=_descriptor._internal_create_key, - serialized_start=1117, - serialized_end=1458, - methods=[ - _descriptor.MethodDescriptor( - name="CompleteQuery", - full_name="google.cloud.talent.v4beta1.Completion.CompleteQuery", - index=0, - containing_service=None, - input_type=_COMPLETEQUERYREQUEST, - output_type=_COMPLETEQUERYRESPONSE, - serialized_options=b"\202\323\344\223\002Z\022//v4beta1/{parent=projects/*/tenants/*}:completeZ'\022%/v4beta1/{parent=projects/*}:complete", - create_key=_descriptor._internal_create_key, - ), - ], -) -_sym_db.RegisterServiceDescriptor(_COMPLETION) - -DESCRIPTOR.services_by_name["Completion"] = _COMPLETION - -# @@protoc_insertion_point(module_scope) diff --git a/google/cloud/talent_v4beta1/proto/completion_service_pb2_grpc.py b/google/cloud/talent_v4beta1/proto/completion_service_pb2_grpc.py deleted file mode 100644 index 779c5b42..00000000 --- a/google/cloud/talent_v4beta1/proto/completion_service_pb2_grpc.py +++ /dev/null @@ -1,84 +0,0 @@ -# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT! -"""Client and server classes corresponding to protobuf-defined services.""" -import grpc - -from google.cloud.talent_v4beta1.proto import ( - completion_service_pb2 as google_dot_cloud_dot_talent__v4beta1_dot_proto_dot_completion__service__pb2, -) - - -class CompletionStub(object): - """A service handles auto completion. - """ - - def __init__(self, channel): - """Constructor. - - Args: - channel: A grpc.Channel. - """ - self.CompleteQuery = channel.unary_unary( - "/google.cloud.talent.v4beta1.Completion/CompleteQuery", - request_serializer=google_dot_cloud_dot_talent__v4beta1_dot_proto_dot_completion__service__pb2.CompleteQueryRequest.SerializeToString, - response_deserializer=google_dot_cloud_dot_talent__v4beta1_dot_proto_dot_completion__service__pb2.CompleteQueryResponse.FromString, - ) - - -class CompletionServicer(object): - """A service handles auto completion. - """ - - def CompleteQuery(self, request, context): - """Completes the specified prefix with keyword suggestions. - Intended for use by a job search auto-complete search box. - """ - context.set_code(grpc.StatusCode.UNIMPLEMENTED) - context.set_details("Method not implemented!") - raise NotImplementedError("Method not implemented!") - - -def add_CompletionServicer_to_server(servicer, server): - rpc_method_handlers = { - "CompleteQuery": grpc.unary_unary_rpc_method_handler( - servicer.CompleteQuery, - request_deserializer=google_dot_cloud_dot_talent__v4beta1_dot_proto_dot_completion__service__pb2.CompleteQueryRequest.FromString, - response_serializer=google_dot_cloud_dot_talent__v4beta1_dot_proto_dot_completion__service__pb2.CompleteQueryResponse.SerializeToString, - ), - } - generic_handler = grpc.method_handlers_generic_handler( - "google.cloud.talent.v4beta1.Completion", rpc_method_handlers - ) - server.add_generic_rpc_handlers((generic_handler,)) - - -# This class is part of an EXPERIMENTAL API. -class Completion(object): - """A service handles auto completion. - """ - - @staticmethod - def CompleteQuery( - request, - target, - options=(), - channel_credentials=None, - call_credentials=None, - compression=None, - wait_for_ready=None, - timeout=None, - metadata=None, - ): - return grpc.experimental.unary_unary( - request, - target, - "/google.cloud.talent.v4beta1.Completion/CompleteQuery", - google_dot_cloud_dot_talent__v4beta1_dot_proto_dot_completion__service__pb2.CompleteQueryRequest.SerializeToString, - google_dot_cloud_dot_talent__v4beta1_dot_proto_dot_completion__service__pb2.CompleteQueryResponse.FromString, - options, - channel_credentials, - call_credentials, - compression, - wait_for_ready, - timeout, - metadata, - ) diff --git a/google/cloud/talent_v4beta1/proto/event_pb2.py b/google/cloud/talent_v4beta1/proto/event_pb2.py deleted file mode 100644 index cb5c90c7..00000000 --- a/google/cloud/talent_v4beta1/proto/event_pb2.py +++ /dev/null @@ -1,669 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by the protocol buffer compiler. DO NOT EDIT! -# source: google/cloud/talent_v4beta1/proto/event.proto -"""Generated protocol buffer code.""" -from google.protobuf import descriptor as _descriptor -from google.protobuf import message as _message -from google.protobuf import reflection as _reflection -from google.protobuf import symbol_database as _symbol_database - -# @@protoc_insertion_point(imports) - -_sym_db = _symbol_database.Default() - - -from google.api import field_behavior_pb2 as google_dot_api_dot_field__behavior__pb2 -from google.protobuf import timestamp_pb2 as google_dot_protobuf_dot_timestamp__pb2 -from google.api import annotations_pb2 as google_dot_api_dot_annotations__pb2 - - -DESCRIPTOR = _descriptor.FileDescriptor( - name="google/cloud/talent_v4beta1/proto/event.proto", - package="google.cloud.talent.v4beta1", - syntax="proto3", - serialized_options=b"\n\037com.google.cloud.talent.v4beta1B\nEventProtoP\001ZAgoogle.golang.org/genproto/googleapis/cloud/talent/v4beta1;talent\242\002\003CTS", - create_key=_descriptor._internal_create_key, - serialized_pb=b'\n-google/cloud/talent_v4beta1/proto/event.proto\x12\x1bgoogle.cloud.talent.v4beta1\x1a\x1fgoogle/api/field_behavior.proto\x1a\x1fgoogle/protobuf/timestamp.proto\x1a\x1cgoogle/api/annotations.proto"\x8c\x02\n\x0b\x43lientEvent\x12\x12\n\nrequest_id\x18\x01 \x01(\t\x12\x15\n\x08\x65vent_id\x18\x02 \x01(\tB\x03\xe0\x41\x02\x12\x34\n\x0b\x63reate_time\x18\x04 \x01(\x0b\x32\x1a.google.protobuf.TimestampB\x03\xe0\x41\x02\x12:\n\tjob_event\x18\x05 \x01(\x0b\x32%.google.cloud.talent.v4beta1.JobEventH\x00\x12\x42\n\rprofile_event\x18\x06 \x01(\x0b\x32).google.cloud.talent.v4beta1.ProfileEventH\x00\x12\x13\n\x0b\x65vent_notes\x18\t \x01(\tB\x07\n\x05\x65vent"\xf6\x03\n\x08JobEvent\x12\x45\n\x04type\x18\x01 \x01(\x0e\x32\x32.google.cloud.talent.v4beta1.JobEvent.JobEventTypeB\x03\xe0\x41\x02\x12\x11\n\x04jobs\x18\x02 \x03(\tB\x03\xe0\x41\x02\x12\x0f\n\x07profile\x18\x03 \x01(\t"\xfe\x02\n\x0cJobEventType\x12\x1e\n\x1aJOB_EVENT_TYPE_UNSPECIFIED\x10\x00\x12\x0e\n\nIMPRESSION\x10\x01\x12\x08\n\x04VIEW\x10\x02\x12\x11\n\rVIEW_REDIRECT\x10\x03\x12\x15\n\x11\x41PPLICATION_START\x10\x04\x12\x16\n\x12\x41PPLICATION_FINISH\x10\x05\x12 \n\x1c\x41PPLICATION_QUICK_SUBMISSION\x10\x06\x12\x18\n\x14\x41PPLICATION_REDIRECT\x10\x07\x12!\n\x1d\x41PPLICATION_START_FROM_SEARCH\x10\x08\x12$\n APPLICATION_REDIRECT_FROM_SEARCH\x10\t\x12\x1e\n\x1a\x41PPLICATION_COMPANY_SUBMIT\x10\n\x12\x0c\n\x08\x42OOKMARK\x10\x0b\x12\x10\n\x0cNOTIFICATION\x10\x0c\x12\t\n\x05HIRED\x10\r\x12\x0b\n\x07SENT_CV\x10\x0e\x12\x15\n\x11INTERVIEW_GRANTED\x10\x0f"\xe2\x01\n\x0cProfileEvent\x12M\n\x04type\x18\x01 \x01(\x0e\x32:.google.cloud.talent.v4beta1.ProfileEvent.ProfileEventTypeB\x03\xe0\x41\x02\x12\x15\n\x08profiles\x18\x02 \x03(\tB\x03\xe0\x41\x02\x12\x0c\n\x04jobs\x18\x06 \x03(\t"^\n\x10ProfileEventType\x12"\n\x1ePROFILE_EVENT_TYPE_UNSPECIFIED\x10\x00\x12\x0e\n\nIMPRESSION\x10\x01\x12\x08\n\x04VIEW\x10\x02\x12\x0c\n\x08\x42OOKMARK\x10\x03\x42x\n\x1f\x63om.google.cloud.talent.v4beta1B\nEventProtoP\x01ZAgoogle.golang.org/genproto/googleapis/cloud/talent/v4beta1;talent\xa2\x02\x03\x43TSb\x06proto3', - dependencies=[ - google_dot_api_dot_field__behavior__pb2.DESCRIPTOR, - google_dot_protobuf_dot_timestamp__pb2.DESCRIPTOR, - google_dot_api_dot_annotations__pb2.DESCRIPTOR, - ], -) - - -_JOBEVENT_JOBEVENTTYPE = _descriptor.EnumDescriptor( - name="JobEventType", - full_name="google.cloud.talent.v4beta1.JobEvent.JobEventType", - filename=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - values=[ - _descriptor.EnumValueDescriptor( - name="JOB_EVENT_TYPE_UNSPECIFIED", - index=0, - number=0, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="IMPRESSION", - index=1, - number=1, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="VIEW", - index=2, - number=2, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="VIEW_REDIRECT", - index=3, - number=3, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="APPLICATION_START", - index=4, - number=4, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="APPLICATION_FINISH", - index=5, - number=5, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="APPLICATION_QUICK_SUBMISSION", - index=6, - number=6, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="APPLICATION_REDIRECT", - index=7, - number=7, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="APPLICATION_START_FROM_SEARCH", - index=8, - number=8, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="APPLICATION_REDIRECT_FROM_SEARCH", - index=9, - number=9, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="APPLICATION_COMPANY_SUBMIT", - index=10, - number=10, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="BOOKMARK", - index=11, - number=11, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="NOTIFICATION", - index=12, - number=12, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="HIRED", - index=13, - number=13, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="SENT_CV", - index=14, - number=14, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="INTERVIEW_GRANTED", - index=15, - number=15, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - ], - containing_type=None, - serialized_options=None, - serialized_start=566, - serialized_end=948, -) -_sym_db.RegisterEnumDescriptor(_JOBEVENT_JOBEVENTTYPE) - -_PROFILEEVENT_PROFILEEVENTTYPE = _descriptor.EnumDescriptor( - name="ProfileEventType", - full_name="google.cloud.talent.v4beta1.ProfileEvent.ProfileEventType", - filename=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - values=[ - _descriptor.EnumValueDescriptor( - name="PROFILE_EVENT_TYPE_UNSPECIFIED", - index=0, - number=0, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="IMPRESSION", - index=1, - number=1, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="VIEW", - index=2, - number=2, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="BOOKMARK", - index=3, - number=3, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - ], - containing_type=None, - serialized_options=None, - serialized_start=1083, - serialized_end=1177, -) -_sym_db.RegisterEnumDescriptor(_PROFILEEVENT_PROFILEEVENTTYPE) - - -_CLIENTEVENT = _descriptor.Descriptor( - name="ClientEvent", - full_name="google.cloud.talent.v4beta1.ClientEvent", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="request_id", - full_name="google.cloud.talent.v4beta1.ClientEvent.request_id", - index=0, - number=1, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="event_id", - full_name="google.cloud.talent.v4beta1.ClientEvent.event_id", - index=1, - number=2, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\002", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="create_time", - full_name="google.cloud.talent.v4beta1.ClientEvent.create_time", - index=2, - number=4, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\002", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="job_event", - full_name="google.cloud.talent.v4beta1.ClientEvent.job_event", - index=3, - number=5, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="profile_event", - full_name="google.cloud.talent.v4beta1.ClientEvent.profile_event", - index=4, - number=6, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="event_notes", - full_name="google.cloud.talent.v4beta1.ClientEvent.event_notes", - index=5, - number=9, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[ - _descriptor.OneofDescriptor( - name="event", - full_name="google.cloud.talent.v4beta1.ClientEvent.event", - index=0, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[], - ), - ], - serialized_start=175, - serialized_end=443, -) - - -_JOBEVENT = _descriptor.Descriptor( - name="JobEvent", - full_name="google.cloud.talent.v4beta1.JobEvent", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="type", - full_name="google.cloud.talent.v4beta1.JobEvent.type", - index=0, - number=1, - type=14, - cpp_type=8, - label=1, - has_default_value=False, - default_value=0, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\002", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="jobs", - full_name="google.cloud.talent.v4beta1.JobEvent.jobs", - index=1, - number=2, - type=9, - cpp_type=9, - label=3, - has_default_value=False, - default_value=[], - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\002", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="profile", - full_name="google.cloud.talent.v4beta1.JobEvent.profile", - index=2, - number=3, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[], - enum_types=[_JOBEVENT_JOBEVENTTYPE,], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=446, - serialized_end=948, -) - - -_PROFILEEVENT = _descriptor.Descriptor( - name="ProfileEvent", - full_name="google.cloud.talent.v4beta1.ProfileEvent", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="type", - full_name="google.cloud.talent.v4beta1.ProfileEvent.type", - index=0, - number=1, - type=14, - cpp_type=8, - label=1, - has_default_value=False, - default_value=0, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\002", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="profiles", - full_name="google.cloud.talent.v4beta1.ProfileEvent.profiles", - index=1, - number=2, - type=9, - cpp_type=9, - label=3, - has_default_value=False, - default_value=[], - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\002", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="jobs", - full_name="google.cloud.talent.v4beta1.ProfileEvent.jobs", - index=2, - number=6, - type=9, - cpp_type=9, - label=3, - has_default_value=False, - default_value=[], - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[], - enum_types=[_PROFILEEVENT_PROFILEEVENTTYPE,], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=951, - serialized_end=1177, -) - -_CLIENTEVENT.fields_by_name[ - "create_time" -].message_type = google_dot_protobuf_dot_timestamp__pb2._TIMESTAMP -_CLIENTEVENT.fields_by_name["job_event"].message_type = _JOBEVENT -_CLIENTEVENT.fields_by_name["profile_event"].message_type = _PROFILEEVENT -_CLIENTEVENT.oneofs_by_name["event"].fields.append( - _CLIENTEVENT.fields_by_name["job_event"] -) -_CLIENTEVENT.fields_by_name["job_event"].containing_oneof = _CLIENTEVENT.oneofs_by_name[ - "event" -] -_CLIENTEVENT.oneofs_by_name["event"].fields.append( - _CLIENTEVENT.fields_by_name["profile_event"] -) -_CLIENTEVENT.fields_by_name[ - "profile_event" -].containing_oneof = _CLIENTEVENT.oneofs_by_name["event"] -_JOBEVENT.fields_by_name["type"].enum_type = _JOBEVENT_JOBEVENTTYPE -_JOBEVENT_JOBEVENTTYPE.containing_type = _JOBEVENT -_PROFILEEVENT.fields_by_name["type"].enum_type = _PROFILEEVENT_PROFILEEVENTTYPE -_PROFILEEVENT_PROFILEEVENTTYPE.containing_type = _PROFILEEVENT -DESCRIPTOR.message_types_by_name["ClientEvent"] = _CLIENTEVENT -DESCRIPTOR.message_types_by_name["JobEvent"] = _JOBEVENT -DESCRIPTOR.message_types_by_name["ProfileEvent"] = _PROFILEEVENT -_sym_db.RegisterFileDescriptor(DESCRIPTOR) - -ClientEvent = _reflection.GeneratedProtocolMessageType( - "ClientEvent", - (_message.Message,), - { - "DESCRIPTOR": _CLIENTEVENT, - "__module__": "google.cloud.talent_v4beta1.proto.event_pb2", - "__doc__": """An event issued when an end user interacts with the application that - implements Cloud Talent Solution. Providing this information improves - the quality of results for the API clients, enabling the service to - perform optimally. The number of events sent must be consistent with - other calls, such as job searches, issued to the service by the - client. - - Attributes: - request_id: - Strongly recommended for the best service experience. A - unique ID generated in the API responses. It can be found in [ - ResponseMetadata.request_id][google.cloud.talent.v4beta1.Respo - nseMetadata.request_id]. - event_id: - Required. A unique identifier, generated by the client - application. - create_time: - Required. The timestamp of the event. - event: - Required. The detail information of a specific event type. - job_event: - An event issued when a job seeker interacts with the - application that implements Cloud Talent Solution. - profile_event: - An event issued when a profile searcher interacts with the - application that implements Cloud Talent Solution. - event_notes: - Notes about the event provided by recruiters or other users, - for example, feedback on why a profile was bookmarked. - """, - # @@protoc_insertion_point(class_scope:google.cloud.talent.v4beta1.ClientEvent) - }, -) -_sym_db.RegisterMessage(ClientEvent) - -JobEvent = _reflection.GeneratedProtocolMessageType( - "JobEvent", - (_message.Message,), - { - "DESCRIPTOR": _JOBEVENT, - "__module__": "google.cloud.talent_v4beta1.proto.event_pb2", - "__doc__": """An event issued when a job seeker interacts with the application that - implements Cloud Talent Solution. - - Attributes: - type: - Required. The type of the event (see [JobEventType][google.clo - ud.talent.v4beta1.JobEvent.JobEventType]). - jobs: - Required. The [job - name(s)][google.cloud.talent.v4beta1.Job.name] associated with - this event. For example, if this is an [impression][google.clo - ud.talent.v4beta1.JobEvent.JobEventType.IMPRESSION] event, - this field contains the identifiers of all jobs shown to the - job seeker. If this was a - [view][google.cloud.talent.v4beta1.JobEvent.JobEventType.VIEW] - event, this field contains the identifier of the viewed job. - The format is - “projects/{project_id}/tenants/{tenant_id}/jobs/{job_id}”, for - example, “projects/foo/tenants/bar/jobs/baz”. - profile: - The [profile name][google.cloud.talent.v4beta1.Profile.name] - associated with this client event. The format is “projects/{p - roject_id}/tenants/{tenant_id}/profiles/{profile_id}”, for - example, “projects/foo/tenants/bar/profiles/baz”. - """, - # @@protoc_insertion_point(class_scope:google.cloud.talent.v4beta1.JobEvent) - }, -) -_sym_db.RegisterMessage(JobEvent) - -ProfileEvent = _reflection.GeneratedProtocolMessageType( - "ProfileEvent", - (_message.Message,), - { - "DESCRIPTOR": _PROFILEEVENT, - "__module__": "google.cloud.talent_v4beta1.proto.event_pb2", - "__doc__": """An event issued when a profile searcher interacts with the application - that implements Cloud Talent Solution. - - Attributes: - type: - Required. Type of event. - profiles: - Required. The [profile - name(s)][google.cloud.talent.v4beta1.Profile.name] associated - with this client event. The format is “projects/{project_id}/ - tenants/{tenant_id}/profiles/{profile_id}”, for example, - “projects/foo/tenants/bar/profiles/baz”. - jobs: - The [job name(s)][google.cloud.talent.v4beta1.Job.name] - associated with this client event. Leave it empty if the event - isn’t associated with a job. The format is - “projects/{project_id}/tenants/{tenant_id}/jobs/{job_id}”, for - example, “projects/foo/tenants/bar/jobs/baz”. - """, - # @@protoc_insertion_point(class_scope:google.cloud.talent.v4beta1.ProfileEvent) - }, -) -_sym_db.RegisterMessage(ProfileEvent) - - -DESCRIPTOR._options = None -_CLIENTEVENT.fields_by_name["event_id"]._options = None -_CLIENTEVENT.fields_by_name["create_time"]._options = None -_JOBEVENT.fields_by_name["type"]._options = None -_JOBEVENT.fields_by_name["jobs"]._options = None -_PROFILEEVENT.fields_by_name["type"]._options = None -_PROFILEEVENT.fields_by_name["profiles"]._options = None -# @@protoc_insertion_point(module_scope) diff --git a/google/cloud/talent_v4beta1/proto/event_pb2_grpc.py b/google/cloud/talent_v4beta1/proto/event_pb2_grpc.py deleted file mode 100644 index 8a939394..00000000 --- a/google/cloud/talent_v4beta1/proto/event_pb2_grpc.py +++ /dev/null @@ -1,3 +0,0 @@ -# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT! -"""Client and server classes corresponding to protobuf-defined services.""" -import grpc diff --git a/google/cloud/talent_v4beta1/proto/event_service_pb2.py b/google/cloud/talent_v4beta1/proto/event_service_pb2.py deleted file mode 100644 index b0c23b35..00000000 --- a/google/cloud/talent_v4beta1/proto/event_service_pb2.py +++ /dev/null @@ -1,163 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by the protocol buffer compiler. DO NOT EDIT! -# source: google/cloud/talent_v4beta1/proto/event_service.proto -"""Generated protocol buffer code.""" -from google.protobuf import descriptor as _descriptor -from google.protobuf import message as _message -from google.protobuf import reflection as _reflection -from google.protobuf import symbol_database as _symbol_database - -# @@protoc_insertion_point(imports) - -_sym_db = _symbol_database.Default() - - -from google.api import annotations_pb2 as google_dot_api_dot_annotations__pb2 -from google.api import client_pb2 as google_dot_api_dot_client__pb2 -from google.api import field_behavior_pb2 as google_dot_api_dot_field__behavior__pb2 -from google.api import resource_pb2 as google_dot_api_dot_resource__pb2 -from google.cloud.talent_v4beta1.proto import ( - event_pb2 as google_dot_cloud_dot_talent__v4beta1_dot_proto_dot_event__pb2, -) - - -DESCRIPTOR = _descriptor.FileDescriptor( - name="google/cloud/talent_v4beta1/proto/event_service.proto", - package="google.cloud.talent.v4beta1", - syntax="proto3", - serialized_options=b"\n\037com.google.cloud.talent.v4beta1B\021EventServiceProtoP\001ZAgoogle.golang.org/genproto/googleapis/cloud/talent/v4beta1;talent\242\002\003CTS", - create_key=_descriptor._internal_create_key, - serialized_pb=b'\n5google/cloud/talent_v4beta1/proto/event_service.proto\x12\x1bgoogle.cloud.talent.v4beta1\x1a\x1cgoogle/api/annotations.proto\x1a\x17google/api/client.proto\x1a\x1fgoogle/api/field_behavior.proto\x1a\x19google/api/resource.proto\x1a-google/cloud/talent_v4beta1/proto/event.proto"\x94\x01\n\x18\x43reateClientEventRequest\x12\x33\n\x06parent\x18\x01 \x01(\tB#\xe0\x41\x02\xfa\x41\x1d\x12\x1bjobs.googleapis.com/Company\x12\x43\n\x0c\x63lient_event\x18\x02 \x01(\x0b\x32(.google.cloud.talent.v4beta1.ClientEventB\x03\xe0\x41\x02\x32\xfa\x02\n\x0c\x45ventService\x12\xfb\x01\n\x11\x43reateClientEvent\x12\x35.google.cloud.talent.v4beta1.CreateClientEventRequest\x1a(.google.cloud.talent.v4beta1.ClientEvent"\x84\x01\x82\xd3\xe4\x93\x02h"3/v4beta1/{parent=projects/*/tenants/*}/clientEvents:\x01*Z.")/v4beta1/{parent=projects/*}/clientEvents:\x01*\xda\x41\x13parent,client_event\x1al\xca\x41\x13jobs.googleapis.com\xd2\x41Shttps://www.googleapis.com/auth/cloud-platform,https://www.googleapis.com/auth/jobsB\x7f\n\x1f\x63om.google.cloud.talent.v4beta1B\x11\x45ventServiceProtoP\x01ZAgoogle.golang.org/genproto/googleapis/cloud/talent/v4beta1;talent\xa2\x02\x03\x43TSb\x06proto3', - dependencies=[ - google_dot_api_dot_annotations__pb2.DESCRIPTOR, - google_dot_api_dot_client__pb2.DESCRIPTOR, - google_dot_api_dot_field__behavior__pb2.DESCRIPTOR, - google_dot_api_dot_resource__pb2.DESCRIPTOR, - google_dot_cloud_dot_talent__v4beta1_dot_proto_dot_event__pb2.DESCRIPTOR, - ], -) - - -_CREATECLIENTEVENTREQUEST = _descriptor.Descriptor( - name="CreateClientEventRequest", - full_name="google.cloud.talent.v4beta1.CreateClientEventRequest", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="parent", - full_name="google.cloud.talent.v4beta1.CreateClientEventRequest.parent", - index=0, - number=1, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\002\372A\035\022\033jobs.googleapis.com/Company", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="client_event", - full_name="google.cloud.talent.v4beta1.CreateClientEventRequest.client_event", - index=1, - number=2, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\002", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=249, - serialized_end=397, -) - -_CREATECLIENTEVENTREQUEST.fields_by_name[ - "client_event" -].message_type = ( - google_dot_cloud_dot_talent__v4beta1_dot_proto_dot_event__pb2._CLIENTEVENT -) -DESCRIPTOR.message_types_by_name["CreateClientEventRequest"] = _CREATECLIENTEVENTREQUEST -_sym_db.RegisterFileDescriptor(DESCRIPTOR) - -CreateClientEventRequest = _reflection.GeneratedProtocolMessageType( - "CreateClientEventRequest", - (_message.Message,), - { - "DESCRIPTOR": _CREATECLIENTEVENTREQUEST, - "__module__": "google.cloud.talent_v4beta1.proto.event_service_pb2", - "__doc__": """The report event request. - - Attributes: - parent: - Required. Resource name of the tenant under which the event is - created. The format is - “projects/{project_id}/tenants/{tenant_id}”, for example, - “projects/foo/tenant/bar”. If tenant id is unspecified, a - default tenant is created, for example, “projects/foo”. - client_event: - Required. Events issued when end user interacts with - customer’s application that uses Cloud Talent Solution. - """, - # @@protoc_insertion_point(class_scope:google.cloud.talent.v4beta1.CreateClientEventRequest) - }, -) -_sym_db.RegisterMessage(CreateClientEventRequest) - - -DESCRIPTOR._options = None -_CREATECLIENTEVENTREQUEST.fields_by_name["parent"]._options = None -_CREATECLIENTEVENTREQUEST.fields_by_name["client_event"]._options = None - -_EVENTSERVICE = _descriptor.ServiceDescriptor( - name="EventService", - full_name="google.cloud.talent.v4beta1.EventService", - file=DESCRIPTOR, - index=0, - serialized_options=b"\312A\023jobs.googleapis.com\322AShttps://www.googleapis.com/auth/cloud-platform,https://www.googleapis.com/auth/jobs", - create_key=_descriptor._internal_create_key, - serialized_start=400, - serialized_end=778, - methods=[ - _descriptor.MethodDescriptor( - name="CreateClientEvent", - full_name="google.cloud.talent.v4beta1.EventService.CreateClientEvent", - index=0, - containing_service=None, - input_type=_CREATECLIENTEVENTREQUEST, - output_type=google_dot_cloud_dot_talent__v4beta1_dot_proto_dot_event__pb2._CLIENTEVENT, - serialized_options=b'\202\323\344\223\002h"3/v4beta1/{parent=projects/*/tenants/*}/clientEvents:\001*Z.")/v4beta1/{parent=projects/*}/clientEvents:\001*\332A\023parent,client_event', - create_key=_descriptor._internal_create_key, - ), - ], -) -_sym_db.RegisterServiceDescriptor(_EVENTSERVICE) - -DESCRIPTOR.services_by_name["EventService"] = _EVENTSERVICE - -# @@protoc_insertion_point(module_scope) diff --git a/google/cloud/talent_v4beta1/proto/event_service_pb2_grpc.py b/google/cloud/talent_v4beta1/proto/event_service_pb2_grpc.py deleted file mode 100644 index e3cb01c3..00000000 --- a/google/cloud/talent_v4beta1/proto/event_service_pb2_grpc.py +++ /dev/null @@ -1,92 +0,0 @@ -# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT! -"""Client and server classes corresponding to protobuf-defined services.""" -import grpc - -from google.cloud.talent_v4beta1.proto import ( - event_pb2 as google_dot_cloud_dot_talent__v4beta1_dot_proto_dot_event__pb2, -) -from google.cloud.talent_v4beta1.proto import ( - event_service_pb2 as google_dot_cloud_dot_talent__v4beta1_dot_proto_dot_event__service__pb2, -) - - -class EventServiceStub(object): - """A service handles client event report. - """ - - def __init__(self, channel): - """Constructor. - - Args: - channel: A grpc.Channel. - """ - self.CreateClientEvent = channel.unary_unary( - "/google.cloud.talent.v4beta1.EventService/CreateClientEvent", - request_serializer=google_dot_cloud_dot_talent__v4beta1_dot_proto_dot_event__service__pb2.CreateClientEventRequest.SerializeToString, - response_deserializer=google_dot_cloud_dot_talent__v4beta1_dot_proto_dot_event__pb2.ClientEvent.FromString, - ) - - -class EventServiceServicer(object): - """A service handles client event report. - """ - - def CreateClientEvent(self, request, context): - """Report events issued when end user interacts with customer's application - that uses Cloud Talent Solution. You may inspect the created events in - [self service - tools](https://console.cloud.google.com/talent-solution/overview). - [Learn - more](https://cloud.google.com/talent-solution/docs/management-tools) - about self service tools. - """ - context.set_code(grpc.StatusCode.UNIMPLEMENTED) - context.set_details("Method not implemented!") - raise NotImplementedError("Method not implemented!") - - -def add_EventServiceServicer_to_server(servicer, server): - rpc_method_handlers = { - "CreateClientEvent": grpc.unary_unary_rpc_method_handler( - servicer.CreateClientEvent, - request_deserializer=google_dot_cloud_dot_talent__v4beta1_dot_proto_dot_event__service__pb2.CreateClientEventRequest.FromString, - response_serializer=google_dot_cloud_dot_talent__v4beta1_dot_proto_dot_event__pb2.ClientEvent.SerializeToString, - ), - } - generic_handler = grpc.method_handlers_generic_handler( - "google.cloud.talent.v4beta1.EventService", rpc_method_handlers - ) - server.add_generic_rpc_handlers((generic_handler,)) - - -# This class is part of an EXPERIMENTAL API. -class EventService(object): - """A service handles client event report. - """ - - @staticmethod - def CreateClientEvent( - request, - target, - options=(), - channel_credentials=None, - call_credentials=None, - compression=None, - wait_for_ready=None, - timeout=None, - metadata=None, - ): - return grpc.experimental.unary_unary( - request, - target, - "/google.cloud.talent.v4beta1.EventService/CreateClientEvent", - google_dot_cloud_dot_talent__v4beta1_dot_proto_dot_event__service__pb2.CreateClientEventRequest.SerializeToString, - google_dot_cloud_dot_talent__v4beta1_dot_proto_dot_event__pb2.ClientEvent.FromString, - options, - channel_credentials, - call_credentials, - compression, - wait_for_ready, - timeout, - metadata, - ) diff --git a/google/cloud/talent_v4beta1/proto/filters_pb2.py b/google/cloud/talent_v4beta1/proto/filters_pb2.py deleted file mode 100644 index 6e95d46f..00000000 --- a/google/cloud/talent_v4beta1/proto/filters_pb2.py +++ /dev/null @@ -1,3000 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by the protocol buffer compiler. DO NOT EDIT! -# source: google/cloud/talent_v4beta1/proto/filters.proto -"""Generated protocol buffer code.""" -from google.protobuf import descriptor as _descriptor -from google.protobuf import message as _message -from google.protobuf import reflection as _reflection -from google.protobuf import symbol_database as _symbol_database - -# @@protoc_insertion_point(imports) - -_sym_db = _symbol_database.Default() - - -from google.api import field_behavior_pb2 as google_dot_api_dot_field__behavior__pb2 -from google.cloud.talent_v4beta1.proto import ( - common_pb2 as google_dot_cloud_dot_talent__v4beta1_dot_proto_dot_common__pb2, -) -from google.protobuf import duration_pb2 as google_dot_protobuf_dot_duration__pb2 -from google.protobuf import field_mask_pb2 as google_dot_protobuf_dot_field__mask__pb2 -from google.protobuf import timestamp_pb2 as google_dot_protobuf_dot_timestamp__pb2 -from google.protobuf import wrappers_pb2 as google_dot_protobuf_dot_wrappers__pb2 -from google.type import date_pb2 as google_dot_type_dot_date__pb2 -from google.type import latlng_pb2 as google_dot_type_dot_latlng__pb2 -from google.type import timeofday_pb2 as google_dot_type_dot_timeofday__pb2 -from google.api import annotations_pb2 as google_dot_api_dot_annotations__pb2 - - -DESCRIPTOR = _descriptor.FileDescriptor( - name="google/cloud/talent_v4beta1/proto/filters.proto", - package="google.cloud.talent.v4beta1", - syntax="proto3", - serialized_options=b"\n\037com.google.cloud.talent.v4beta1B\014FiltersProtoP\001ZAgoogle.golang.org/genproto/googleapis/cloud/talent/v4beta1;talent\242\002\003CTS", - create_key=_descriptor._internal_create_key, - serialized_pb=b'\n/google/cloud/talent_v4beta1/proto/filters.proto\x12\x1bgoogle.cloud.talent.v4beta1\x1a\x1fgoogle/api/field_behavior.proto\x1a.google/cloud/talent_v4beta1/proto/common.proto\x1a\x1egoogle/protobuf/duration.proto\x1a google/protobuf/field_mask.proto\x1a\x1fgoogle/protobuf/timestamp.proto\x1a\x1egoogle/protobuf/wrappers.proto\x1a\x16google/type/date.proto\x1a\x18google/type/latlng.proto\x1a\x1bgoogle/type/timeofday.proto\x1a\x1cgoogle/api/annotations.proto"\x80\x05\n\x08JobQuery\x12\r\n\x05query\x18\x01 \x01(\t\x12\x1b\n\x13query_language_code\x18\x0e \x01(\t\x12\x11\n\tcompanies\x18\x02 \x03(\t\x12\x45\n\x10location_filters\x18\x03 \x03(\x0b\x32+.google.cloud.talent.v4beta1.LocationFilter\x12@\n\x0ejob_categories\x18\x04 \x03(\x0e\x32(.google.cloud.talent.v4beta1.JobCategory\x12\x42\n\x0e\x63ommute_filter\x18\x05 \x01(\x0b\x32*.google.cloud.talent.v4beta1.CommuteFilter\x12\x1d\n\x15\x63ompany_display_names\x18\x06 \x03(\t\x12L\n\x13\x63ompensation_filter\x18\x07 \x01(\x0b\x32/.google.cloud.talent.v4beta1.CompensationFilter\x12\x1f\n\x17\x63ustom_attribute_filter\x18\x08 \x01(\t\x12\x1b\n\x13\x64isable_spell_check\x18\t \x01(\x08\x12\x45\n\x10\x65mployment_types\x18\n \x03(\x0e\x32+.google.cloud.talent.v4beta1.EmploymentType\x12\x16\n\x0elanguage_codes\x18\x0b \x03(\t\x12G\n\x12publish_time_range\x18\x0c \x01(\x0b\x32+.google.cloud.talent.v4beta1.TimestampRange\x12\x15\n\rexcluded_jobs\x18\r \x03(\t"\xf5\x08\n\x0cProfileQuery\x12\r\n\x05query\x18\x01 \x01(\t\x12\x45\n\x10location_filters\x18\x02 \x03(\x0b\x32+.google.cloud.talent.v4beta1.LocationFilter\x12\x46\n\x11job_title_filters\x18\x03 \x03(\x0b\x32+.google.cloud.talent.v4beta1.JobTitleFilter\x12\x45\n\x10\x65mployer_filters\x18\x04 \x03(\x0b\x32+.google.cloud.talent.v4beta1.EmployerFilter\x12G\n\x11\x65\x64ucation_filters\x18\x05 \x03(\x0b\x32,.google.cloud.talent.v4beta1.EducationFilter\x12?\n\rskill_filters\x18\x06 \x03(\x0b\x32(.google.cloud.talent.v4beta1.SkillFilter\x12Q\n\x16work_experience_filter\x18\x07 \x03(\x0b\x32\x31.google.cloud.talent.v4beta1.WorkExperienceFilter\x12=\n\x0ctime_filters\x18\x08 \x03(\x0b\x32\'.google.cloud.talent.v4beta1.TimeFilter\x12\x32\n\x0ehirable_filter\x18\t \x01(\x0b\x32\x1a.google.protobuf.BoolValue\x12T\n\x18\x61pplication_date_filters\x18\n \x03(\x0b\x32\x32.google.cloud.talent.v4beta1.ApplicationDateFilter\x12\x65\n!application_outcome_notes_filters\x18\x0b \x03(\x0b\x32:.google.cloud.talent.v4beta1.ApplicationOutcomeNotesFilter\x12R\n\x17\x61pplication_job_filters\x18\r \x03(\x0b\x32\x31.google.cloud.talent.v4beta1.ApplicationJobFilter\x12\x1f\n\x17\x63ustom_attribute_filter\x18\x0f \x01(\t\x12\x63\n\x1d\x63\x61ndidate_availability_filter\x18\x10 \x01(\x0b\x32\x38.google.cloud.talent.v4beta1.CandidateAvailabilityFilterB\x02\x18\x01\x12M\n\x14\x61vailability_filters\x18\x12 \x03(\x0b\x32/.google.cloud.talent.v4beta1.AvailabilityFilter\x12J\n\x13person_name_filters\x18\x11 \x03(\x0b\x32-.google.cloud.talent.v4beta1.PersonNameFilter"\xdf\x02\n\x0eLocationFilter\x12\x0f\n\x07\x61\x64\x64ress\x18\x01 \x01(\t\x12\x13\n\x0bregion_code\x18\x02 \x01(\t\x12$\n\x07lat_lng\x18\x03 \x01(\x0b\x32\x13.google.type.LatLng\x12\x19\n\x11\x64istance_in_miles\x18\x04 \x01(\x01\x12\x61\n\x16telecommute_preference\x18\x05 \x01(\x0e\x32\x41.google.cloud.talent.v4beta1.LocationFilter.TelecommutePreference\x12\x0f\n\x07negated\x18\x06 \x01(\x08"r\n\x15TelecommutePreference\x12&\n"TELECOMMUTE_PREFERENCE_UNSPECIFIED\x10\x00\x12\x18\n\x14TELECOMMUTE_EXCLUDED\x10\x01\x12\x17\n\x13TELECOMMUTE_ALLOWED\x10\x02"\xca\x03\n\x12\x43ompensationFilter\x12M\n\x04type\x18\x01 \x01(\x0e\x32:.google.cloud.talent.v4beta1.CompensationFilter.FilterTypeB\x03\xe0\x41\x02\x12R\n\x05units\x18\x02 \x03(\x0e\x32>.google.cloud.talent.v4beta1.CompensationInfo.CompensationUnitB\x03\xe0\x41\x02\x12N\n\x05range\x18\x03 \x01(\x0b\x32?.google.cloud.talent.v4beta1.CompensationInfo.CompensationRange\x12\x38\n0include_jobs_with_unspecified_compensation_range\x18\x04 \x01(\x08"\x86\x01\n\nFilterType\x12\x1b\n\x17\x46ILTER_TYPE_UNSPECIFIED\x10\x00\x12\r\n\tUNIT_ONLY\x10\x01\x12\x13\n\x0fUNIT_AND_AMOUNT\x10\x02\x12\x1a\n\x16\x41NNUALIZED_BASE_AMOUNT\x10\x03\x12\x1b\n\x17\x41NNUALIZED_TOTAL_AMOUNT\x10\x04"\xcb\x03\n\rCommuteFilter\x12G\n\x0e\x63ommute_method\x18\x01 \x01(\x0e\x32*.google.cloud.talent.v4beta1.CommuteMethodB\x03\xe0\x41\x02\x12\x33\n\x11start_coordinates\x18\x02 \x01(\x0b\x32\x13.google.type.LatLngB\x03\xe0\x41\x02\x12\x37\n\x0ftravel_duration\x18\x03 \x01(\x0b\x32\x19.google.protobuf.DurationB\x03\xe0\x41\x02\x12!\n\x19\x61llow_imprecise_addresses\x18\x04 \x01(\x08\x12N\n\x0croad_traffic\x18\x05 \x01(\x0e\x32\x36.google.cloud.talent.v4beta1.CommuteFilter.RoadTrafficH\x00\x12\x30\n\x0e\x64\x65parture_time\x18\x06 \x01(\x0b\x32\x16.google.type.TimeOfDayH\x00"L\n\x0bRoadTraffic\x12\x1c\n\x18ROAD_TRAFFIC_UNSPECIFIED\x10\x00\x12\x10\n\x0cTRAFFIC_FREE\x10\x01\x12\r\n\tBUSY_HOUR\x10\x02\x42\x10\n\x0etraffic_option"9\n\x0eJobTitleFilter\x12\x16\n\tjob_title\x18\x01 \x01(\tB\x03\xe0\x41\x02\x12\x0f\n\x07negated\x18\x02 \x01(\x08"2\n\x0bSkillFilter\x12\x12\n\x05skill\x18\x01 \x01(\tB\x03\xe0\x41\x02\x12\x0f\n\x07negated\x18\x02 \x01(\x08"\xa6\x02\n\x0e\x45mployerFilter\x12\x15\n\x08\x65mployer\x18\x01 \x01(\tB\x03\xe0\x41\x02\x12L\n\x04mode\x18\x02 \x01(\x0e\x32>.google.cloud.talent.v4beta1.EmployerFilter.EmployerFilterMode\x12\x0f\n\x07negated\x18\x03 \x01(\x08"\x9d\x01\n\x12\x45mployerFilterMode\x12$\n EMPLOYER_FILTER_MODE_UNSPECIFIED\x10\x00\x12\x1a\n\x16\x41LL_EMPLOYMENT_RECORDS\x10\x01\x12#\n\x1f\x43URRENT_EMPLOYMENT_RECORDS_ONLY\x10\x02\x12 \n\x1cPAST_EMPLOYMENT_RECORDS_ONLY\x10\x03"\x88\x01\n\x0f\x45\x64ucationFilter\x12\x0e\n\x06school\x18\x01 \x01(\t\x12\x16\n\x0e\x66ield_of_study\x18\x02 \x01(\t\x12<\n\x0b\x64\x65gree_type\x18\x03 \x01(\x0e\x32\'.google.cloud.talent.v4beta1.DegreeType\x12\x0f\n\x07negated\x18\x06 \x01(\x08"|\n\x14WorkExperienceFilter\x12\x31\n\x0emin_experience\x18\x01 \x01(\x0b\x32\x19.google.protobuf.Duration\x12\x31\n\x0emax_experience\x18\x02 \x01(\x0b\x32\x19.google.protobuf.Duration"c\n\x15\x41pplicationDateFilter\x12%\n\nstart_date\x18\x01 \x01(\x0b\x32\x11.google.type.Date\x12#\n\x08\x65nd_date\x18\x02 \x01(\x0b\x32\x11.google.type.Date"L\n\x1d\x41pplicationOutcomeNotesFilter\x12\x1a\n\routcome_notes\x18\x01 \x01(\tB\x03\xe0\x41\x02\x12\x0f\n\x07negated\x18\x02 \x01(\x08"V\n\x14\x41pplicationJobFilter\x12\x1a\n\x12job_requisition_id\x18\x02 \x01(\t\x12\x11\n\tjob_title\x18\x03 \x01(\t\x12\x0f\n\x07negated\x18\x04 \x01(\x08"\xfc\x01\n\nTimeFilter\x12.\n\nstart_time\x18\x01 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12,\n\x08\x65nd_time\x18\x02 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12\x45\n\ntime_field\x18\x03 \x01(\x0e\x32\x31.google.cloud.talent.v4beta1.TimeFilter.TimeField"I\n\tTimeField\x12\x1a\n\x16TIME_FIELD_UNSPECIFIED\x10\x00\x12\x0f\n\x0b\x43REATE_TIME\x10\x01\x12\x0f\n\x0bUPDATE_TIME\x10\x02"2\n\x1b\x43\x61ndidateAvailabilityFilter\x12\x0f\n\x07negated\x18\x01 \x01(\x08:\x02\x18\x01"\xb6\x01\n\x12\x41vailabilityFilter\x12M\n\x0bsignal_type\x18\x01 \x01(\x0e\x32\x33.google.cloud.talent.v4beta1.AvailabilitySignalTypeB\x03\xe0\x41\x02\x12?\n\x05range\x18\x02 \x01(\x0b\x32+.google.cloud.talent.v4beta1.TimestampRangeB\x03\xe0\x41\x02\x12\x10\n\x08required\x18\x03 \x01(\x08",\n\x10PersonNameFilter\x12\x18\n\x0bperson_name\x18\x01 \x01(\tB\x03\xe0\x41\x02\x42z\n\x1f\x63om.google.cloud.talent.v4beta1B\x0c\x46iltersProtoP\x01ZAgoogle.golang.org/genproto/googleapis/cloud/talent/v4beta1;talent\xa2\x02\x03\x43TSb\x06proto3', - dependencies=[ - google_dot_api_dot_field__behavior__pb2.DESCRIPTOR, - google_dot_cloud_dot_talent__v4beta1_dot_proto_dot_common__pb2.DESCRIPTOR, - google_dot_protobuf_dot_duration__pb2.DESCRIPTOR, - google_dot_protobuf_dot_field__mask__pb2.DESCRIPTOR, - google_dot_protobuf_dot_timestamp__pb2.DESCRIPTOR, - google_dot_protobuf_dot_wrappers__pb2.DESCRIPTOR, - google_dot_type_dot_date__pb2.DESCRIPTOR, - google_dot_type_dot_latlng__pb2.DESCRIPTOR, - google_dot_type_dot_timeofday__pb2.DESCRIPTOR, - google_dot_api_dot_annotations__pb2.DESCRIPTOR, - ], -) - - -_LOCATIONFILTER_TELECOMMUTEPREFERENCE = _descriptor.EnumDescriptor( - name="TelecommutePreference", - full_name="google.cloud.talent.v4beta1.LocationFilter.TelecommutePreference", - filename=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - values=[ - _descriptor.EnumValueDescriptor( - name="TELECOMMUTE_PREFERENCE_UNSPECIFIED", - index=0, - number=0, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="TELECOMMUTE_EXCLUDED", - index=1, - number=1, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="TELECOMMUTE_ALLOWED", - index=2, - number=2, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - ], - containing_type=None, - serialized_options=None, - serialized_start=2426, - serialized_end=2540, -) -_sym_db.RegisterEnumDescriptor(_LOCATIONFILTER_TELECOMMUTEPREFERENCE) - -_COMPENSATIONFILTER_FILTERTYPE = _descriptor.EnumDescriptor( - name="FilterType", - full_name="google.cloud.talent.v4beta1.CompensationFilter.FilterType", - filename=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - values=[ - _descriptor.EnumValueDescriptor( - name="FILTER_TYPE_UNSPECIFIED", - index=0, - number=0, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="UNIT_ONLY", - index=1, - number=1, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="UNIT_AND_AMOUNT", - index=2, - number=2, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="ANNUALIZED_BASE_AMOUNT", - index=3, - number=3, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="ANNUALIZED_TOTAL_AMOUNT", - index=4, - number=4, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - ], - containing_type=None, - serialized_options=None, - serialized_start=2867, - serialized_end=3001, -) -_sym_db.RegisterEnumDescriptor(_COMPENSATIONFILTER_FILTERTYPE) - -_COMMUTEFILTER_ROADTRAFFIC = _descriptor.EnumDescriptor( - name="RoadTraffic", - full_name="google.cloud.talent.v4beta1.CommuteFilter.RoadTraffic", - filename=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - values=[ - _descriptor.EnumValueDescriptor( - name="ROAD_TRAFFIC_UNSPECIFIED", - index=0, - number=0, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="TRAFFIC_FREE", - index=1, - number=1, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="BUSY_HOUR", - index=2, - number=2, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - ], - containing_type=None, - serialized_options=None, - serialized_start=3369, - serialized_end=3445, -) -_sym_db.RegisterEnumDescriptor(_COMMUTEFILTER_ROADTRAFFIC) - -_EMPLOYERFILTER_EMPLOYERFILTERMODE = _descriptor.EnumDescriptor( - name="EmployerFilterMode", - full_name="google.cloud.talent.v4beta1.EmployerFilter.EmployerFilterMode", - filename=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - values=[ - _descriptor.EnumValueDescriptor( - name="EMPLOYER_FILTER_MODE_UNSPECIFIED", - index=0, - number=0, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="ALL_EMPLOYMENT_RECORDS", - index=1, - number=1, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="CURRENT_EMPLOYMENT_RECORDS_ONLY", - index=2, - number=2, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="PAST_EMPLOYMENT_RECORDS_ONLY", - index=3, - number=3, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - ], - containing_type=None, - serialized_options=None, - serialized_start=3714, - serialized_end=3871, -) -_sym_db.RegisterEnumDescriptor(_EMPLOYERFILTER_EMPLOYERFILTERMODE) - -_TIMEFILTER_TIMEFIELD = _descriptor.EnumDescriptor( - name="TimeField", - full_name="google.cloud.talent.v4beta1.TimeFilter.TimeField", - filename=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - values=[ - _descriptor.EnumValueDescriptor( - name="TIME_FIELD_UNSPECIFIED", - index=0, - number=0, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="CREATE_TIME", - index=1, - number=1, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="UPDATE_TIME", - index=2, - number=2, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - ], - containing_type=None, - serialized_options=None, - serialized_start=4585, - serialized_end=4658, -) -_sym_db.RegisterEnumDescriptor(_TIMEFILTER_TIMEFIELD) - - -_JOBQUERY = _descriptor.Descriptor( - name="JobQuery", - full_name="google.cloud.talent.v4beta1.JobQuery", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="query", - full_name="google.cloud.talent.v4beta1.JobQuery.query", - index=0, - number=1, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="query_language_code", - full_name="google.cloud.talent.v4beta1.JobQuery.query_language_code", - index=1, - number=14, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="companies", - full_name="google.cloud.talent.v4beta1.JobQuery.companies", - index=2, - number=2, - type=9, - cpp_type=9, - label=3, - has_default_value=False, - default_value=[], - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="location_filters", - full_name="google.cloud.talent.v4beta1.JobQuery.location_filters", - index=3, - number=3, - type=11, - cpp_type=10, - label=3, - has_default_value=False, - default_value=[], - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="job_categories", - full_name="google.cloud.talent.v4beta1.JobQuery.job_categories", - index=4, - number=4, - type=14, - cpp_type=8, - label=3, - has_default_value=False, - default_value=[], - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="commute_filter", - full_name="google.cloud.talent.v4beta1.JobQuery.commute_filter", - index=5, - number=5, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="company_display_names", - full_name="google.cloud.talent.v4beta1.JobQuery.company_display_names", - index=6, - number=6, - type=9, - cpp_type=9, - label=3, - has_default_value=False, - default_value=[], - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="compensation_filter", - full_name="google.cloud.talent.v4beta1.JobQuery.compensation_filter", - index=7, - number=7, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="custom_attribute_filter", - full_name="google.cloud.talent.v4beta1.JobQuery.custom_attribute_filter", - index=8, - number=8, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="disable_spell_check", - full_name="google.cloud.talent.v4beta1.JobQuery.disable_spell_check", - index=9, - number=9, - type=8, - cpp_type=7, - label=1, - has_default_value=False, - default_value=False, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="employment_types", - full_name="google.cloud.talent.v4beta1.JobQuery.employment_types", - index=10, - number=10, - type=14, - cpp_type=8, - label=3, - has_default_value=False, - default_value=[], - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="language_codes", - full_name="google.cloud.talent.v4beta1.JobQuery.language_codes", - index=11, - number=11, - type=9, - cpp_type=9, - label=3, - has_default_value=False, - default_value=[], - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="publish_time_range", - full_name="google.cloud.talent.v4beta1.JobQuery.publish_time_range", - index=12, - number=12, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="excluded_jobs", - full_name="google.cloud.talent.v4beta1.JobQuery.excluded_jobs", - index=13, - number=13, - type=9, - cpp_type=9, - label=3, - has_default_value=False, - default_value=[], - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=402, - serialized_end=1042, -) - - -_PROFILEQUERY = _descriptor.Descriptor( - name="ProfileQuery", - full_name="google.cloud.talent.v4beta1.ProfileQuery", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="query", - full_name="google.cloud.talent.v4beta1.ProfileQuery.query", - index=0, - number=1, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="location_filters", - full_name="google.cloud.talent.v4beta1.ProfileQuery.location_filters", - index=1, - number=2, - type=11, - cpp_type=10, - label=3, - has_default_value=False, - default_value=[], - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="job_title_filters", - full_name="google.cloud.talent.v4beta1.ProfileQuery.job_title_filters", - index=2, - number=3, - type=11, - cpp_type=10, - label=3, - has_default_value=False, - default_value=[], - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="employer_filters", - full_name="google.cloud.talent.v4beta1.ProfileQuery.employer_filters", - index=3, - number=4, - type=11, - cpp_type=10, - label=3, - has_default_value=False, - default_value=[], - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="education_filters", - full_name="google.cloud.talent.v4beta1.ProfileQuery.education_filters", - index=4, - number=5, - type=11, - cpp_type=10, - label=3, - has_default_value=False, - default_value=[], - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="skill_filters", - full_name="google.cloud.talent.v4beta1.ProfileQuery.skill_filters", - index=5, - number=6, - type=11, - cpp_type=10, - label=3, - has_default_value=False, - default_value=[], - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="work_experience_filter", - full_name="google.cloud.talent.v4beta1.ProfileQuery.work_experience_filter", - index=6, - number=7, - type=11, - cpp_type=10, - label=3, - has_default_value=False, - default_value=[], - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="time_filters", - full_name="google.cloud.talent.v4beta1.ProfileQuery.time_filters", - index=7, - number=8, - type=11, - cpp_type=10, - label=3, - has_default_value=False, - default_value=[], - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="hirable_filter", - full_name="google.cloud.talent.v4beta1.ProfileQuery.hirable_filter", - index=8, - number=9, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="application_date_filters", - full_name="google.cloud.talent.v4beta1.ProfileQuery.application_date_filters", - index=9, - number=10, - type=11, - cpp_type=10, - label=3, - has_default_value=False, - default_value=[], - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="application_outcome_notes_filters", - full_name="google.cloud.talent.v4beta1.ProfileQuery.application_outcome_notes_filters", - index=10, - number=11, - type=11, - cpp_type=10, - label=3, - has_default_value=False, - default_value=[], - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="application_job_filters", - full_name="google.cloud.talent.v4beta1.ProfileQuery.application_job_filters", - index=11, - number=13, - type=11, - cpp_type=10, - label=3, - has_default_value=False, - default_value=[], - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="custom_attribute_filter", - full_name="google.cloud.talent.v4beta1.ProfileQuery.custom_attribute_filter", - index=12, - number=15, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="candidate_availability_filter", - full_name="google.cloud.talent.v4beta1.ProfileQuery.candidate_availability_filter", - index=13, - number=16, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\030\001", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="availability_filters", - full_name="google.cloud.talent.v4beta1.ProfileQuery.availability_filters", - index=14, - number=18, - type=11, - cpp_type=10, - label=3, - has_default_value=False, - default_value=[], - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="person_name_filters", - full_name="google.cloud.talent.v4beta1.ProfileQuery.person_name_filters", - index=15, - number=17, - type=11, - cpp_type=10, - label=3, - has_default_value=False, - default_value=[], - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=1045, - serialized_end=2186, -) - - -_LOCATIONFILTER = _descriptor.Descriptor( - name="LocationFilter", - full_name="google.cloud.talent.v4beta1.LocationFilter", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="address", - full_name="google.cloud.talent.v4beta1.LocationFilter.address", - index=0, - number=1, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="region_code", - full_name="google.cloud.talent.v4beta1.LocationFilter.region_code", - index=1, - number=2, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="lat_lng", - full_name="google.cloud.talent.v4beta1.LocationFilter.lat_lng", - index=2, - number=3, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="distance_in_miles", - full_name="google.cloud.talent.v4beta1.LocationFilter.distance_in_miles", - index=3, - number=4, - type=1, - cpp_type=5, - label=1, - has_default_value=False, - default_value=float(0), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="telecommute_preference", - full_name="google.cloud.talent.v4beta1.LocationFilter.telecommute_preference", - index=4, - number=5, - type=14, - cpp_type=8, - label=1, - has_default_value=False, - default_value=0, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="negated", - full_name="google.cloud.talent.v4beta1.LocationFilter.negated", - index=5, - number=6, - type=8, - cpp_type=7, - label=1, - has_default_value=False, - default_value=False, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[], - enum_types=[_LOCATIONFILTER_TELECOMMUTEPREFERENCE,], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=2189, - serialized_end=2540, -) - - -_COMPENSATIONFILTER = _descriptor.Descriptor( - name="CompensationFilter", - full_name="google.cloud.talent.v4beta1.CompensationFilter", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="type", - full_name="google.cloud.talent.v4beta1.CompensationFilter.type", - index=0, - number=1, - type=14, - cpp_type=8, - label=1, - has_default_value=False, - default_value=0, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\002", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="units", - full_name="google.cloud.talent.v4beta1.CompensationFilter.units", - index=1, - number=2, - type=14, - cpp_type=8, - label=3, - has_default_value=False, - default_value=[], - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\002", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="range", - full_name="google.cloud.talent.v4beta1.CompensationFilter.range", - index=2, - number=3, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="include_jobs_with_unspecified_compensation_range", - full_name="google.cloud.talent.v4beta1.CompensationFilter.include_jobs_with_unspecified_compensation_range", - index=3, - number=4, - type=8, - cpp_type=7, - label=1, - has_default_value=False, - default_value=False, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[], - enum_types=[_COMPENSATIONFILTER_FILTERTYPE,], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=2543, - serialized_end=3001, -) - - -_COMMUTEFILTER = _descriptor.Descriptor( - name="CommuteFilter", - full_name="google.cloud.talent.v4beta1.CommuteFilter", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="commute_method", - full_name="google.cloud.talent.v4beta1.CommuteFilter.commute_method", - index=0, - number=1, - type=14, - cpp_type=8, - label=1, - has_default_value=False, - default_value=0, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\002", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="start_coordinates", - full_name="google.cloud.talent.v4beta1.CommuteFilter.start_coordinates", - index=1, - number=2, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\002", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="travel_duration", - full_name="google.cloud.talent.v4beta1.CommuteFilter.travel_duration", - index=2, - number=3, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\002", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="allow_imprecise_addresses", - full_name="google.cloud.talent.v4beta1.CommuteFilter.allow_imprecise_addresses", - index=3, - number=4, - type=8, - cpp_type=7, - label=1, - has_default_value=False, - default_value=False, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="road_traffic", - full_name="google.cloud.talent.v4beta1.CommuteFilter.road_traffic", - index=4, - number=5, - type=14, - cpp_type=8, - label=1, - has_default_value=False, - default_value=0, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="departure_time", - full_name="google.cloud.talent.v4beta1.CommuteFilter.departure_time", - index=5, - number=6, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[], - enum_types=[_COMMUTEFILTER_ROADTRAFFIC,], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[ - _descriptor.OneofDescriptor( - name="traffic_option", - full_name="google.cloud.talent.v4beta1.CommuteFilter.traffic_option", - index=0, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[], - ), - ], - serialized_start=3004, - serialized_end=3463, -) - - -_JOBTITLEFILTER = _descriptor.Descriptor( - name="JobTitleFilter", - full_name="google.cloud.talent.v4beta1.JobTitleFilter", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="job_title", - full_name="google.cloud.talent.v4beta1.JobTitleFilter.job_title", - index=0, - number=1, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\002", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="negated", - full_name="google.cloud.talent.v4beta1.JobTitleFilter.negated", - index=1, - number=2, - type=8, - cpp_type=7, - label=1, - has_default_value=False, - default_value=False, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=3465, - serialized_end=3522, -) - - -_SKILLFILTER = _descriptor.Descriptor( - name="SkillFilter", - full_name="google.cloud.talent.v4beta1.SkillFilter", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="skill", - full_name="google.cloud.talent.v4beta1.SkillFilter.skill", - index=0, - number=1, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\002", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="negated", - full_name="google.cloud.talent.v4beta1.SkillFilter.negated", - index=1, - number=2, - type=8, - cpp_type=7, - label=1, - has_default_value=False, - default_value=False, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=3524, - serialized_end=3574, -) - - -_EMPLOYERFILTER = _descriptor.Descriptor( - name="EmployerFilter", - full_name="google.cloud.talent.v4beta1.EmployerFilter", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="employer", - full_name="google.cloud.talent.v4beta1.EmployerFilter.employer", - index=0, - number=1, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\002", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="mode", - full_name="google.cloud.talent.v4beta1.EmployerFilter.mode", - index=1, - number=2, - type=14, - cpp_type=8, - label=1, - has_default_value=False, - default_value=0, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="negated", - full_name="google.cloud.talent.v4beta1.EmployerFilter.negated", - index=2, - number=3, - type=8, - cpp_type=7, - label=1, - has_default_value=False, - default_value=False, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[], - enum_types=[_EMPLOYERFILTER_EMPLOYERFILTERMODE,], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=3577, - serialized_end=3871, -) - - -_EDUCATIONFILTER = _descriptor.Descriptor( - name="EducationFilter", - full_name="google.cloud.talent.v4beta1.EducationFilter", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="school", - full_name="google.cloud.talent.v4beta1.EducationFilter.school", - index=0, - number=1, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="field_of_study", - full_name="google.cloud.talent.v4beta1.EducationFilter.field_of_study", - index=1, - number=2, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="degree_type", - full_name="google.cloud.talent.v4beta1.EducationFilter.degree_type", - index=2, - number=3, - type=14, - cpp_type=8, - label=1, - has_default_value=False, - default_value=0, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="negated", - full_name="google.cloud.talent.v4beta1.EducationFilter.negated", - index=3, - number=6, - type=8, - cpp_type=7, - label=1, - has_default_value=False, - default_value=False, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=3874, - serialized_end=4010, -) - - -_WORKEXPERIENCEFILTER = _descriptor.Descriptor( - name="WorkExperienceFilter", - full_name="google.cloud.talent.v4beta1.WorkExperienceFilter", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="min_experience", - full_name="google.cloud.talent.v4beta1.WorkExperienceFilter.min_experience", - index=0, - number=1, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="max_experience", - full_name="google.cloud.talent.v4beta1.WorkExperienceFilter.max_experience", - index=1, - number=2, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=4012, - serialized_end=4136, -) - - -_APPLICATIONDATEFILTER = _descriptor.Descriptor( - name="ApplicationDateFilter", - full_name="google.cloud.talent.v4beta1.ApplicationDateFilter", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="start_date", - full_name="google.cloud.talent.v4beta1.ApplicationDateFilter.start_date", - index=0, - number=1, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="end_date", - full_name="google.cloud.talent.v4beta1.ApplicationDateFilter.end_date", - index=1, - number=2, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=4138, - serialized_end=4237, -) - - -_APPLICATIONOUTCOMENOTESFILTER = _descriptor.Descriptor( - name="ApplicationOutcomeNotesFilter", - full_name="google.cloud.talent.v4beta1.ApplicationOutcomeNotesFilter", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="outcome_notes", - full_name="google.cloud.talent.v4beta1.ApplicationOutcomeNotesFilter.outcome_notes", - index=0, - number=1, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\002", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="negated", - full_name="google.cloud.talent.v4beta1.ApplicationOutcomeNotesFilter.negated", - index=1, - number=2, - type=8, - cpp_type=7, - label=1, - has_default_value=False, - default_value=False, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=4239, - serialized_end=4315, -) - - -_APPLICATIONJOBFILTER = _descriptor.Descriptor( - name="ApplicationJobFilter", - full_name="google.cloud.talent.v4beta1.ApplicationJobFilter", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="job_requisition_id", - full_name="google.cloud.talent.v4beta1.ApplicationJobFilter.job_requisition_id", - index=0, - number=2, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="job_title", - full_name="google.cloud.talent.v4beta1.ApplicationJobFilter.job_title", - index=1, - number=3, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="negated", - full_name="google.cloud.talent.v4beta1.ApplicationJobFilter.negated", - index=2, - number=4, - type=8, - cpp_type=7, - label=1, - has_default_value=False, - default_value=False, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=4317, - serialized_end=4403, -) - - -_TIMEFILTER = _descriptor.Descriptor( - name="TimeFilter", - full_name="google.cloud.talent.v4beta1.TimeFilter", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="start_time", - full_name="google.cloud.talent.v4beta1.TimeFilter.start_time", - index=0, - number=1, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="end_time", - full_name="google.cloud.talent.v4beta1.TimeFilter.end_time", - index=1, - number=2, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="time_field", - full_name="google.cloud.talent.v4beta1.TimeFilter.time_field", - index=2, - number=3, - type=14, - cpp_type=8, - label=1, - has_default_value=False, - default_value=0, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[], - enum_types=[_TIMEFILTER_TIMEFIELD,], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=4406, - serialized_end=4658, -) - - -_CANDIDATEAVAILABILITYFILTER = _descriptor.Descriptor( - name="CandidateAvailabilityFilter", - full_name="google.cloud.talent.v4beta1.CandidateAvailabilityFilter", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="negated", - full_name="google.cloud.talent.v4beta1.CandidateAvailabilityFilter.negated", - index=0, - number=1, - type=8, - cpp_type=7, - label=1, - has_default_value=False, - default_value=False, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=b"\030\001", - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=4660, - serialized_end=4710, -) - - -_AVAILABILITYFILTER = _descriptor.Descriptor( - name="AvailabilityFilter", - full_name="google.cloud.talent.v4beta1.AvailabilityFilter", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="signal_type", - full_name="google.cloud.talent.v4beta1.AvailabilityFilter.signal_type", - index=0, - number=1, - type=14, - cpp_type=8, - label=1, - has_default_value=False, - default_value=0, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\002", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="range", - full_name="google.cloud.talent.v4beta1.AvailabilityFilter.range", - index=1, - number=2, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\002", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="required", - full_name="google.cloud.talent.v4beta1.AvailabilityFilter.required", - index=2, - number=3, - type=8, - cpp_type=7, - label=1, - has_default_value=False, - default_value=False, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=4713, - serialized_end=4895, -) - - -_PERSONNAMEFILTER = _descriptor.Descriptor( - name="PersonNameFilter", - full_name="google.cloud.talent.v4beta1.PersonNameFilter", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="person_name", - full_name="google.cloud.talent.v4beta1.PersonNameFilter.person_name", - index=0, - number=1, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\002", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=4897, - serialized_end=4941, -) - -_JOBQUERY.fields_by_name["location_filters"].message_type = _LOCATIONFILTER -_JOBQUERY.fields_by_name[ - "job_categories" -].enum_type = ( - google_dot_cloud_dot_talent__v4beta1_dot_proto_dot_common__pb2._JOBCATEGORY -) -_JOBQUERY.fields_by_name["commute_filter"].message_type = _COMMUTEFILTER -_JOBQUERY.fields_by_name["compensation_filter"].message_type = _COMPENSATIONFILTER -_JOBQUERY.fields_by_name[ - "employment_types" -].enum_type = ( - google_dot_cloud_dot_talent__v4beta1_dot_proto_dot_common__pb2._EMPLOYMENTTYPE -) -_JOBQUERY.fields_by_name[ - "publish_time_range" -].message_type = ( - google_dot_cloud_dot_talent__v4beta1_dot_proto_dot_common__pb2._TIMESTAMPRANGE -) -_PROFILEQUERY.fields_by_name["location_filters"].message_type = _LOCATIONFILTER -_PROFILEQUERY.fields_by_name["job_title_filters"].message_type = _JOBTITLEFILTER -_PROFILEQUERY.fields_by_name["employer_filters"].message_type = _EMPLOYERFILTER -_PROFILEQUERY.fields_by_name["education_filters"].message_type = _EDUCATIONFILTER -_PROFILEQUERY.fields_by_name["skill_filters"].message_type = _SKILLFILTER -_PROFILEQUERY.fields_by_name[ - "work_experience_filter" -].message_type = _WORKEXPERIENCEFILTER -_PROFILEQUERY.fields_by_name["time_filters"].message_type = _TIMEFILTER -_PROFILEQUERY.fields_by_name[ - "hirable_filter" -].message_type = google_dot_protobuf_dot_wrappers__pb2._BOOLVALUE -_PROFILEQUERY.fields_by_name[ - "application_date_filters" -].message_type = _APPLICATIONDATEFILTER -_PROFILEQUERY.fields_by_name[ - "application_outcome_notes_filters" -].message_type = _APPLICATIONOUTCOMENOTESFILTER -_PROFILEQUERY.fields_by_name[ - "application_job_filters" -].message_type = _APPLICATIONJOBFILTER -_PROFILEQUERY.fields_by_name[ - "candidate_availability_filter" -].message_type = _CANDIDATEAVAILABILITYFILTER -_PROFILEQUERY.fields_by_name["availability_filters"].message_type = _AVAILABILITYFILTER -_PROFILEQUERY.fields_by_name["person_name_filters"].message_type = _PERSONNAMEFILTER -_LOCATIONFILTER.fields_by_name[ - "lat_lng" -].message_type = google_dot_type_dot_latlng__pb2._LATLNG -_LOCATIONFILTER.fields_by_name[ - "telecommute_preference" -].enum_type = _LOCATIONFILTER_TELECOMMUTEPREFERENCE -_LOCATIONFILTER_TELECOMMUTEPREFERENCE.containing_type = _LOCATIONFILTER -_COMPENSATIONFILTER.fields_by_name["type"].enum_type = _COMPENSATIONFILTER_FILTERTYPE -_COMPENSATIONFILTER.fields_by_name[ - "units" -].enum_type = ( - google_dot_cloud_dot_talent__v4beta1_dot_proto_dot_common__pb2._COMPENSATIONINFO_COMPENSATIONUNIT -) -_COMPENSATIONFILTER.fields_by_name[ - "range" -].message_type = ( - google_dot_cloud_dot_talent__v4beta1_dot_proto_dot_common__pb2._COMPENSATIONINFO_COMPENSATIONRANGE -) -_COMPENSATIONFILTER_FILTERTYPE.containing_type = _COMPENSATIONFILTER -_COMMUTEFILTER.fields_by_name[ - "commute_method" -].enum_type = ( - google_dot_cloud_dot_talent__v4beta1_dot_proto_dot_common__pb2._COMMUTEMETHOD -) -_COMMUTEFILTER.fields_by_name[ - "start_coordinates" -].message_type = google_dot_type_dot_latlng__pb2._LATLNG -_COMMUTEFILTER.fields_by_name[ - "travel_duration" -].message_type = google_dot_protobuf_dot_duration__pb2._DURATION -_COMMUTEFILTER.fields_by_name["road_traffic"].enum_type = _COMMUTEFILTER_ROADTRAFFIC -_COMMUTEFILTER.fields_by_name[ - "departure_time" -].message_type = google_dot_type_dot_timeofday__pb2._TIMEOFDAY -_COMMUTEFILTER_ROADTRAFFIC.containing_type = _COMMUTEFILTER -_COMMUTEFILTER.oneofs_by_name["traffic_option"].fields.append( - _COMMUTEFILTER.fields_by_name["road_traffic"] -) -_COMMUTEFILTER.fields_by_name[ - "road_traffic" -].containing_oneof = _COMMUTEFILTER.oneofs_by_name["traffic_option"] -_COMMUTEFILTER.oneofs_by_name["traffic_option"].fields.append( - _COMMUTEFILTER.fields_by_name["departure_time"] -) -_COMMUTEFILTER.fields_by_name[ - "departure_time" -].containing_oneof = _COMMUTEFILTER.oneofs_by_name["traffic_option"] -_EMPLOYERFILTER.fields_by_name["mode"].enum_type = _EMPLOYERFILTER_EMPLOYERFILTERMODE -_EMPLOYERFILTER_EMPLOYERFILTERMODE.containing_type = _EMPLOYERFILTER -_EDUCATIONFILTER.fields_by_name[ - "degree_type" -].enum_type = google_dot_cloud_dot_talent__v4beta1_dot_proto_dot_common__pb2._DEGREETYPE -_WORKEXPERIENCEFILTER.fields_by_name[ - "min_experience" -].message_type = google_dot_protobuf_dot_duration__pb2._DURATION -_WORKEXPERIENCEFILTER.fields_by_name[ - "max_experience" -].message_type = google_dot_protobuf_dot_duration__pb2._DURATION -_APPLICATIONDATEFILTER.fields_by_name[ - "start_date" -].message_type = google_dot_type_dot_date__pb2._DATE -_APPLICATIONDATEFILTER.fields_by_name[ - "end_date" -].message_type = google_dot_type_dot_date__pb2._DATE -_TIMEFILTER.fields_by_name[ - "start_time" -].message_type = google_dot_protobuf_dot_timestamp__pb2._TIMESTAMP -_TIMEFILTER.fields_by_name[ - "end_time" -].message_type = google_dot_protobuf_dot_timestamp__pb2._TIMESTAMP -_TIMEFILTER.fields_by_name["time_field"].enum_type = _TIMEFILTER_TIMEFIELD -_TIMEFILTER_TIMEFIELD.containing_type = _TIMEFILTER -_AVAILABILITYFILTER.fields_by_name[ - "signal_type" -].enum_type = ( - google_dot_cloud_dot_talent__v4beta1_dot_proto_dot_common__pb2._AVAILABILITYSIGNALTYPE -) -_AVAILABILITYFILTER.fields_by_name[ - "range" -].message_type = ( - google_dot_cloud_dot_talent__v4beta1_dot_proto_dot_common__pb2._TIMESTAMPRANGE -) -DESCRIPTOR.message_types_by_name["JobQuery"] = _JOBQUERY -DESCRIPTOR.message_types_by_name["ProfileQuery"] = _PROFILEQUERY -DESCRIPTOR.message_types_by_name["LocationFilter"] = _LOCATIONFILTER -DESCRIPTOR.message_types_by_name["CompensationFilter"] = _COMPENSATIONFILTER -DESCRIPTOR.message_types_by_name["CommuteFilter"] = _COMMUTEFILTER -DESCRIPTOR.message_types_by_name["JobTitleFilter"] = _JOBTITLEFILTER -DESCRIPTOR.message_types_by_name["SkillFilter"] = _SKILLFILTER -DESCRIPTOR.message_types_by_name["EmployerFilter"] = _EMPLOYERFILTER -DESCRIPTOR.message_types_by_name["EducationFilter"] = _EDUCATIONFILTER -DESCRIPTOR.message_types_by_name["WorkExperienceFilter"] = _WORKEXPERIENCEFILTER -DESCRIPTOR.message_types_by_name["ApplicationDateFilter"] = _APPLICATIONDATEFILTER -DESCRIPTOR.message_types_by_name[ - "ApplicationOutcomeNotesFilter" -] = _APPLICATIONOUTCOMENOTESFILTER -DESCRIPTOR.message_types_by_name["ApplicationJobFilter"] = _APPLICATIONJOBFILTER -DESCRIPTOR.message_types_by_name["TimeFilter"] = _TIMEFILTER -DESCRIPTOR.message_types_by_name[ - "CandidateAvailabilityFilter" -] = _CANDIDATEAVAILABILITYFILTER -DESCRIPTOR.message_types_by_name["AvailabilityFilter"] = _AVAILABILITYFILTER -DESCRIPTOR.message_types_by_name["PersonNameFilter"] = _PERSONNAMEFILTER -_sym_db.RegisterFileDescriptor(DESCRIPTOR) - -JobQuery = _reflection.GeneratedProtocolMessageType( - "JobQuery", - (_message.Message,), - { - "DESCRIPTOR": _JOBQUERY, - "__module__": "google.cloud.talent_v4beta1.proto.filters_pb2", - "__doc__": """The query required to perform a search query. - - Attributes: - query: - The query string that matches against the job title, - description, and location fields. The maximum number of - allowed characters is 255. - query_language_code: - The language code of - [query][google.cloud.talent.v4beta1.JobQuery.query]. For - example, “en-US”. This field helps to better interpret the - query. If a value isn’t specified, the query language code is - automatically detected, which may not be accurate. Language - code should be in BCP-47 format, such as “en-US” or “sr-Latn”. - For more information, see `Tags for Identifying Languages - `__. - companies: - This filter specifies the company entities to search against. - If a value isn’t specified, jobs are searched for against all - companies. If multiple values are specified, jobs are - searched against the companies specified. The format is “proj - ects/{project_id}/tenants/{tenant_id}/companies/{company_id}”. - For example, “projects/foo/tenants/bar/companies/baz”. If - tenant id is unspecified, the default tenant is used. For - example, “projects/foo/companies/bar”. At most 20 company - filters are allowed. - location_filters: - The location filter specifies geo-regions containing the jobs - to search against. See - [LocationFilter][google.cloud.talent.v4beta1.LocationFilter] - for more information. If a location value isn’t specified, - jobs fitting the other search criteria are retrieved - regardless of where they’re located. If multiple values are - specified, jobs are retrieved from any of the specified - locations. If different values are specified for the [Location - Filter.distance_in_miles][google.cloud.talent.v4beta1.Location - Filter.distance_in_miles] parameter, the maximum provided - distance is used for all locations. At most 5 location - filters are allowed. - job_categories: - The category filter specifies the categories of jobs to search - against. See - [JobCategory][google.cloud.talent.v4beta1.JobCategory] for - more information. If a value isn’t specified, jobs from any - category are searched against. If multiple values are - specified, jobs from any of the specified categories are - searched against. - commute_filter: - Allows filtering jobs by commute time with different travel - methods (for example, driving or public transit). Note: This - only works when you specify a - [CommuteMethod][google.cloud.talent.v4beta1.CommuteMethod]. In - this case, [location_filters][google.cloud.talent.v4beta1.JobQ - uery.location_filters] is ignored. Currently we don’t support - sorting by commute time. - company_display_names: - This filter specifies the exact company [Company.display_name] - [google.cloud.talent.v4beta1.Company.display_name] of the jobs - to search against. If a value isn’t specified, jobs within - the search results are associated with any company. If - multiple values are specified, jobs within the search results - may be associated with any of the specified companies. At - most 20 company display name filters are allowed. - compensation_filter: - This search filter is applied only to [Job.compensation_info][ - google.cloud.talent.v4beta1.Job.compensation_info]. For - example, if the filter is specified as “Hourly job with per- - hour compensation > $15”, only jobs meeting these criteria are - searched. If a filter isn’t defined, all open jobs are - searched. - custom_attribute_filter: - This filter specifies a structured syntax to match against the - [Job.custom_attributes][google.cloud.talent.v4beta1.Job.custom - _attributes] marked as ``filterable``. The syntax for this - expression is a subset of SQL syntax. Supported operators - are: ``=``, ``!=``, ``<``, ``<=``, ``>``, and ``>=`` where the - left of the operator is a custom field key and the right of - the operator is a number or a quoted string. You must escape - backslash (\) and quote (") characters. Supported functions - are ``LOWER([field_name])`` to perform a case insensitive - match and ``EMPTY([field_name])`` to filter on the existence - of a key. Boolean expressions (AND/OR/NOT) are supported up - to 3 levels of nesting (for example, “((A AND B AND C) OR NOT - D) AND E”), a maximum of 100 comparisons or functions are - allowed in the expression. The expression must be < 6000 bytes - in length. Sample Query: ``(LOWER(driving_license)="class - \"a\"" OR EMPTY(driving_license)) AND driving_years > 10`` - disable_spell_check: - This flag controls the spell-check feature. If false, the - service attempts to correct a misspelled query, for example, - “enginee” is corrected to “engineer”. Defaults to false: a - spell check is performed. - employment_types: - The employment type filter specifies the employment type of - jobs to search against, such as [EmploymentType.FULL_TIME][goo - gle.cloud.talent.v4beta1.EmploymentType.FULL_TIME]. If a - value isn’t specified, jobs in the search results includes any - employment type. If multiple values are specified, jobs in - the search results include any of the specified employment - types. - language_codes: - This filter specifies the locale of jobs to search against, - for example, “en-US”. If a value isn’t specified, the search - results can contain jobs in any locale. Language codes should - be in BCP-47 format, such as “en-US” or “sr-Latn”. For more - information, see `Tags for Identifying Languages - `__. At most 10 language - code filters are allowed. - publish_time_range: - Jobs published within a range specified by this filter are - searched against. - excluded_jobs: - This filter specifies a list of job names to be excluded - during search. At most 400 excluded job names are allowed. - """, - # @@protoc_insertion_point(class_scope:google.cloud.talent.v4beta1.JobQuery) - }, -) -_sym_db.RegisterMessage(JobQuery) - -ProfileQuery = _reflection.GeneratedProtocolMessageType( - "ProfileQuery", - (_message.Message,), - { - "DESCRIPTOR": _PROFILEQUERY, - "__module__": "google.cloud.talent_v4beta1.proto.filters_pb2", - "__doc__": """Filters to apply when performing the search query. - - Attributes: - query: - Keywords to match any text fields of profiles. For example, - “software engineer in Palo Alto”. - location_filters: - The location filter specifies geo-regions containing the - profiles to search against. One of [LocationFilter.address][g - oogle.cloud.talent.v4beta1.LocationFilter.address] or [Locatio - nFilter.lat_lng][google.cloud.talent.v4beta1.LocationFilter.la - t_lng] must be provided or an error is thrown. If both [Locati - onFilter.address][google.cloud.talent.v4beta1.LocationFilter.a - ddress] and [LocationFilter.lat_lng][google.cloud.talent.v4bet - a1.LocationFilter.lat_lng] are provided, an error is thrown. - The following logic is used to determine which locations in - the profile to filter against: 1. All of the profile’s - geocoded [Profile.addresses][google.cloud.talent.v4beta1.Pr - ofile.addresses] where - [Address.usage][google.cloud.talent.v4beta1.Address.usage] is - PERSONAL and - [Address.current][google.cloud.talent.v4beta1.Address.current] - is true. 2. If the above set of locations is empty, all of - the profile’s geocoded [Profile.addresses][google.cloud.tal - ent.v4beta1.Profile.addresses] where - [Address.usage][google.cloud.talent.v4beta1.Address.usage] is - CONTACT_INFO_USAGE_UNSPECIFIED and - [Address.current][google.cloud.talent.v4beta1.Address.current] - is true. 3. If the above set of locations is empty, all of - the profile’s geocoded [Profile.addresses][google.cloud.tal - ent.v4beta1.Profile.addresses] where - [Address.usage][google.cloud.talent.v4beta1.Address.usage] is - PERSONAL or CONTACT_INFO_USAGE_UNSPECIFIED and - [Address.current][google.cloud.talent.v4beta1.Address.current] - is not set. This means that any profiles without any [Prof - ile.addresses][google.cloud.talent.v4beta1.Profile.addresses] - that match any of the above criteria will not be included in a - search with location filter. Furthermore, any [Profile.address - es][google.cloud.talent.v4beta1.Profile.addresses] where - [Address.usage][google.cloud.talent.v4beta1.Address.usage] is - WORK or SCHOOL or where - [Address.current][google.cloud.talent.v4beta1.Address.current] - is false are not considered for location filter. If a - location filter isn’t specified, profiles fitting the other - search criteria are retrieved regardless of where they’re - located. If [LocationFilter.negated][google.cloud.talent.v4be - ta1.LocationFilter.negated] is specified, the result doesn’t - contain profiles from that location. If [LocationFilter.addre - ss][google.cloud.talent.v4beta1.LocationFilter.address] is - provided, the [LocationType][google.cloud.talent.v4beta1.Locat - ion.LocationType], center point (latitude and longitude), and - radius are automatically detected by the Google Maps Geocoding - API and included as well. If [LocationFilter.address][google.c - loud.talent.v4beta1.LocationFilter.address] cannot be - geocoded, the filter falls back to keyword search. If the - detected [LocationType][google.cloud.talent.v4beta1.Location.L - ocationType] is [LocationType.SUB_ADMINISTRATIVE_AREA][google. - cloud.talent.v4beta1.Location.LocationType.SUB_ADMINISTRATIVE\_ - AREA], [LocationType.ADMINISTRATIVE_AREA][google.cloud.talent. - v4beta1.Location.LocationType.ADMINISTRATIVE_AREA], or [Locati - onType.COUNTRY][google.cloud.talent.v4beta1.Location.LocationT - ype.COUNTRY], the filter is performed against the detected - location name (using exact text matching). Otherwise, the - filter is performed against the detected center point and a - radius of detected location radius + [LocationFilter.distance\_ - in_miles][google.cloud.talent.v4beta1.LocationFilter.distance\_ - in_miles]. If [LocationFilter.address][google.cloud.talent.v4 - beta1.LocationFilter.address] is provided, [LocationFilter.dis - tance_in_miles][google.cloud.talent.v4beta1.LocationFilter.dis - tance_in_miles] is the additional radius on top of the radius - of the location geocoded from [LocationFilter.address][google. - cloud.talent.v4beta1.LocationFilter.address]. If [LocationFilt - er.lat_lng][google.cloud.talent.v4beta1.LocationFilter.lat_lng - ] is provided, [LocationFilter.distance_in_miles][google.cloud - .talent.v4beta1.LocationFilter.distance_in_miles] is the only - radius that is used. [LocationFilter.distance_in_miles][googl - e.cloud.talent.v4beta1.LocationFilter.distance_in_miles] is 10 - by default. Note that the value of [LocationFilter.distance_in - _miles][google.cloud.talent.v4beta1.LocationFilter.distance_in - _miles] is 0 if it is unset, so the server does not - differentiate [LocationFilter.distance_in_miles][google.cloud. - talent.v4beta1.LocationFilter.distance_in_miles] that is - explicitly set to 0 and [LocationFilter.distance_in_miles][goo - gle.cloud.talent.v4beta1.LocationFilter.distance_in_miles] - that is not set. Which means that if [LocationFilter.distance\_ - in_miles][google.cloud.talent.v4beta1.LocationFilter.distance\_ - in_miles] is explicitly set to 0, the server will use the - default value of [LocationFilter.distance_in_miles][google.clo - ud.talent.v4beta1.LocationFilter.distance_in_miles] which is - 10. To work around this and effectively set [LocationFilter.di - stance_in_miles][google.cloud.talent.v4beta1.LocationFilter.di - stance_in_miles] to 0, we recommend setting [LocationFilter.di - stance_in_miles][google.cloud.talent.v4beta1.LocationFilter.di - stance_in_miles] to a very small decimal number (such as - 0.00001). If [LocationFilter.distance_in_miles][google.cloud. - talent.v4beta1.LocationFilter.distance_in_miles] is negative, - an error is thrown. - job_title_filters: - Job title filter specifies job titles of profiles to match on. - If a job title isn’t specified, profiles with any titles are - retrieved. If multiple values are specified, profiles are - retrieved with any of the specified job titles. If [JobTitleF - ilter.negated][google.cloud.talent.v4beta1.JobTitleFilter.nega - ted] is specified, the result won’t contain profiles with the - job titles. For example, search for profiles with a job title - “Product Manager”. - employer_filters: - Employer filter specifies employers of profiles to match on. - If an employer filter isn’t specified, profiles with any - employers are retrieved. If multiple employer filters are - specified, profiles with any matching employers are retrieved. - If [EmployerFilter.negated][google.cloud.talent.v4beta1.Employ - erFilter.negated] is specified, the result won’t contain - profiles that match the employers. For example, search for - profiles that have working experience at “Google LLC”. - education_filters: - Education filter specifies education of profiles to match on. - If an education filter isn’t specified, profiles with any - education are retrieved. If multiple education filters are - specified, profiles that match any education filters are - retrieved. If [EducationFilter.negated][google.cloud.talent.v - 4beta1.EducationFilter.negated] is specified, the result won’t - contain profiles that match the educations. For example, - search for profiles with a master degree. - skill_filters: - Skill filter specifies skill of profiles to match on. If a - skill filter isn’t specified, profiles with any skills are - retrieved. If multiple skill filters are specified, profiles - that match any skill filters are retrieved. If [SkillFilter.n - egated][google.cloud.talent.v4beta1.SkillFilter.negated] is - specified, the result won’t contain profiles that match the - skills. For example, search for profiles that have “Java” and - “Python” in skill list. - work_experience_filter: - Work experience filter specifies the total working experience - of profiles to match on. If a work experience filter isn’t - specified, profiles with any professional experience are - retrieved. If multiple work experience filters are specified, - profiles that match any work experience filters are retrieved. - For example, search for profiles with 10 years of work - experience. - time_filters: - Time filter specifies the create/update timestamp of the - profiles to match on. For example, search for profiles - created since “2018-1-1”. - hirable_filter: - The hirable filter specifies the profile’s hirable status to - match on. - application_date_filters: - The application date filters specify application date ranges - to match on. - application_outcome_notes_filters: - The application outcome notes filters specify the notes for - the outcome of the job application. - application_job_filters: - The application job filters specify the job applied for in the - application. - custom_attribute_filter: - This filter specifies a structured syntax to match against the - [Profile.custom_attributes][google.cloud.talent.v4beta1.Profil - e.custom_attributes] that are marked as ``filterable``. The - syntax for this expression is a subset of Google SQL syntax. - String custom attributes: supported operators are =, != where - the left of the operator is a custom field key and the right - of the operator is a string (surrounded by quotes) value. - Numeric custom attributes: Supported operators are ‘>’, ‘<’ or - ‘=’ operators where the left of the operator is a custom field - key and the right of the operator is a numeric value. - Supported functions are LOWER() to perform case insensitive - match and EMPTY() to filter on the existence of a key. - Boolean expressions (AND/OR/NOT) are supported up to 3 levels - of nesting (for example “((A AND B AND C) OR NOT D) AND E”), - and there can be a maximum of 50 comparisons/functions in the - expression. The expression must be < 2000 characters in - length. Sample Query: (key1 = “TEST” OR LOWER(key1)=“test” OR - NOT EMPTY(key1)) - candidate_availability_filter: - Deprecated. Use availability_filters instead. The candidate - availability filter which filters based on availability - signals. Signal 1: Number of days since most recent job - application. See [Availability.JobApplicationAvailabilitySigna - l][google.cloud.talent.v4beta1.Availability.JobApplicationAvai - labilitySignal] for the details of this signal. Signal 2: - Number of days since last profile update. See [Availability.Pr - ofileUpdateAvailabilitySignal][google.cloud.talent.v4beta1.Ava - ilability.ProfileUpdateAvailabilitySignal] for the details of - this signal. The candidate availability filter helps a - recruiter understand if a specific candidate is likely to be - actively seeking new job opportunities based on an aggregated - set of signals. Specifically, the intent is NOT to indicate - the candidate’s potential qualification / interest / close - ability for a specific job. - availability_filters: - The availability filter which filters based on [Profile.availa - bility_signals][google.cloud.talent.v4beta1.Profile.availabili - ty_signals]. The availability filter helps a recruiter - understand if a specific candidate is likely to be actively - seeking new job opportunities based on an aggregated set of - signals. Specifically, the intent is NOT to indicate the - candidate’s potential qualification / interest / close ability - for a specific job. There can be at most one [AvailabilityFil - ter][google.cloud.talent.v4beta1.AvailabilityFilter] per [sign - al_type][google.cloud.talent.v4beta1.AvailabilityFilter.signal - _type]. If there are multiple [AvailabilityFilter][google.clou - d.talent.v4beta1.AvailabilityFilter] for a [signal_type][googl - e.cloud.talent.v4beta1.AvailabilityFilter.signal_type], an - error is thrown. - person_name_filters: - Person name filter specifies person name of profiles to match - on. If multiple person name filters are specified, profiles - that match any person name filters are retrieved. For - example, search for profiles of candidates with name “John - Smith”. - """, - # @@protoc_insertion_point(class_scope:google.cloud.talent.v4beta1.ProfileQuery) - }, -) -_sym_db.RegisterMessage(ProfileQuery) - -LocationFilter = _reflection.GeneratedProtocolMessageType( - "LocationFilter", - (_message.Message,), - { - "DESCRIPTOR": _LOCATIONFILTER, - "__module__": "google.cloud.talent_v4beta1.proto.filters_pb2", - "__doc__": """Geographic region of the search. - - Attributes: - address: - The address name, such as “Mountain View” or “Bay Area”. - region_code: - CLDR region code of the country/region of the address. This is - used to address ambiguity of the user-input location, for - example, “Liverpool” against “Liverpool, NY, US” or - “Liverpool, UK”. Set this field to bias location resolution - toward a specific country or territory. If this field is not - set, application behavior is biased toward the United States - by default. See https://www.unicode.org/cldr/charts/30/supple - mental/territory_information.html for details. Example: “CH” - for Switzerland. Note that this filter is not applicable for - Profile Search related queries. - lat_lng: - The latitude and longitude of the geographic center to search - from. This field is ignored if ``address`` is provided. - distance_in_miles: - The distance_in_miles is applied when the location being - searched for is identified as a city or smaller. This field is - ignored if the location being searched for is a state or - larger. - telecommute_preference: - Allows the client to return jobs without a set location, - specifically, telecommuting jobs (telecommuting is considered - by the service as a special location. [Job.posting_region][goo - gle.cloud.talent.v4beta1.Job.posting_region] indicates if a - job permits telecommuting. If this field is set to [Telecommut - ePreference.TELECOMMUTE_ALLOWED][google.cloud.talent.v4beta1.L - ocationFilter.TelecommutePreference.TELECOMMUTE_ALLOWED], - telecommuting jobs are searched, and - [address][google.cloud.talent.v4beta1.LocationFilter.address] - and - [lat_lng][google.cloud.talent.v4beta1.LocationFilter.lat_lng] - are ignored. If not set or set to [TelecommutePreference.TELEC - OMMUTE_EXCLUDED][google.cloud.talent.v4beta1.LocationFilter.Te - lecommutePreference.TELECOMMUTE_EXCLUDED], telecommute job are - not searched. This filter can be used by itself to search - exclusively for telecommuting jobs, or it can be combined with - another location filter to search for a combination of job - locations, such as “Mountain View” or “telecommuting” jobs. - However, when used in combination with other location filters, - telecommuting jobs can be treated as less relevant than other - jobs in the search response. This field is only used for job - search requests. - negated: - Whether to apply negation to the filter so profiles matching - the filter are excluded. Currently only supported in profile - search. - """, - # @@protoc_insertion_point(class_scope:google.cloud.talent.v4beta1.LocationFilter) - }, -) -_sym_db.RegisterMessage(LocationFilter) - -CompensationFilter = _reflection.GeneratedProtocolMessageType( - "CompensationFilter", - (_message.Message,), - { - "DESCRIPTOR": _COMPENSATIONFILTER, - "__module__": "google.cloud.talent_v4beta1.proto.filters_pb2", - "__doc__": """Filter on job compensation type and amount. - - Attributes: - type: - Required. Type of filter. - units: - Required. Specify desired ``base compensation entry's`` [Compe - nsationInfo.CompensationUnit][google.cloud.talent.v4beta1.Comp - ensationInfo.CompensationUnit]. - range: - Compensation range. - include_jobs_with_unspecified_compensation_range: - If set to true, jobs with unspecified compensation range - fields are included. - """, - # @@protoc_insertion_point(class_scope:google.cloud.talent.v4beta1.CompensationFilter) - }, -) -_sym_db.RegisterMessage(CompensationFilter) - -CommuteFilter = _reflection.GeneratedProtocolMessageType( - "CommuteFilter", - (_message.Message,), - { - "DESCRIPTOR": _COMMUTEFILTER, - "__module__": "google.cloud.talent_v4beta1.proto.filters_pb2", - "__doc__": """Parameters needed for commute search. - - Attributes: - commute_method: - Required. The method of transportation to calculate the - commute time for. - start_coordinates: - Required. The latitude and longitude of the location to - calculate the commute time from. - travel_duration: - Required. The maximum travel time in seconds. The maximum - allowed value is ``3600s`` (one hour). Format is ``123s``. - allow_imprecise_addresses: - If ``true``, jobs without street level addresses may also be - returned. For city level addresses, the city center is used. - For state and coarser level addresses, text matching is used. - If this field is set to ``false`` or isn’t specified, only - jobs that include street level addresses will be returned by - commute search. - traffic_option: - Traffic factor to take into account while searching by - commute. - road_traffic: - Specifies the traffic density to use when calculating commute - time. - departure_time: - The departure time used to calculate traffic impact, - represented as [google.type.TimeOfDay][google.type.TimeOfDay] - in local time zone. Currently traffic model is restricted to - hour level resolution. - """, - # @@protoc_insertion_point(class_scope:google.cloud.talent.v4beta1.CommuteFilter) - }, -) -_sym_db.RegisterMessage(CommuteFilter) - -JobTitleFilter = _reflection.GeneratedProtocolMessageType( - "JobTitleFilter", - (_message.Message,), - { - "DESCRIPTOR": _JOBTITLEFILTER, - "__module__": "google.cloud.talent_v4beta1.proto.filters_pb2", - "__doc__": """Job title of the search. - - Attributes: - job_title: - Required. The job title. For example, “Software engineer”, or - “Product manager”. - negated: - Whether to apply negation to the filter so profiles matching - the filter are excluded. - """, - # @@protoc_insertion_point(class_scope:google.cloud.talent.v4beta1.JobTitleFilter) - }, -) -_sym_db.RegisterMessage(JobTitleFilter) - -SkillFilter = _reflection.GeneratedProtocolMessageType( - "SkillFilter", - (_message.Message,), - { - "DESCRIPTOR": _SKILLFILTER, - "__module__": "google.cloud.talent_v4beta1.proto.filters_pb2", - "__doc__": """Skill filter of the search. - - Attributes: - skill: - Required. The skill name. For example, “java”, “j2ee”, and so - on. - negated: - Whether to apply negation to the filter so profiles matching - the filter are excluded. - """, - # @@protoc_insertion_point(class_scope:google.cloud.talent.v4beta1.SkillFilter) - }, -) -_sym_db.RegisterMessage(SkillFilter) - -EmployerFilter = _reflection.GeneratedProtocolMessageType( - "EmployerFilter", - (_message.Message,), - { - "DESCRIPTOR": _EMPLOYERFILTER, - "__module__": "google.cloud.talent_v4beta1.proto.filters_pb2", - "__doc__": """Employer filter of the search. - - Attributes: - employer: - Required. The name of the employer, for example “Google”, - “Alphabet”. - mode: - Define set of [EmploymentRecord][google.cloud.talent.v4beta1.E - mploymentRecord]s to search against. Defaults to [EmployerFil - terMode.ALL_EMPLOYMENT_RECORDS][google.cloud.talent.v4beta1.Em - ployerFilter.EmployerFilterMode.ALL_EMPLOYMENT_RECORDS]. - negated: - Whether to apply negation to the filter so profiles matching - the filter is excluded. - """, - # @@protoc_insertion_point(class_scope:google.cloud.talent.v4beta1.EmployerFilter) - }, -) -_sym_db.RegisterMessage(EmployerFilter) - -EducationFilter = _reflection.GeneratedProtocolMessageType( - "EducationFilter", - (_message.Message,), - { - "DESCRIPTOR": _EDUCATIONFILTER, - "__module__": "google.cloud.talent_v4beta1.proto.filters_pb2", - "__doc__": """Education filter of the search. - - Attributes: - school: - The school name. For example “MIT”, “University of California, - Berkeley”. - field_of_study: - The field of study. This is to search against value provided - in [Degree.fields_of_study][google.cloud.talent.v4beta1.Degree - .fields_of_study]. For example “Computer Science”, - “Mathematics”. - degree_type: - Education degree in ISCED code. Each value in degree covers a - specific level of education, without any expansion to upper - nor lower levels of education degree. - negated: - Whether to apply negation to the filter so profiles matching - the filter is excluded. - """, - # @@protoc_insertion_point(class_scope:google.cloud.talent.v4beta1.EducationFilter) - }, -) -_sym_db.RegisterMessage(EducationFilter) - -WorkExperienceFilter = _reflection.GeneratedProtocolMessageType( - "WorkExperienceFilter", - (_message.Message,), - { - "DESCRIPTOR": _WORKEXPERIENCEFILTER, - "__module__": "google.cloud.talent_v4beta1.proto.filters_pb2", - "__doc__": """Work experience filter. This filter is used to search for profiles - with working experience length between [min_experience][google.cloud.t - alent.v4beta1.WorkExperienceFilter.min_experience] and [max_experience - ][google.cloud.talent.v4beta1.WorkExperienceFilter.max_experience]. - - Attributes: - min_experience: - The minimum duration of the work experience (inclusive). - max_experience: - The maximum duration of the work experience (exclusive). - """, - # @@protoc_insertion_point(class_scope:google.cloud.talent.v4beta1.WorkExperienceFilter) - }, -) -_sym_db.RegisterMessage(WorkExperienceFilter) - -ApplicationDateFilter = _reflection.GeneratedProtocolMessageType( - "ApplicationDateFilter", - (_message.Message,), - { - "DESCRIPTOR": _APPLICATIONDATEFILTER, - "__module__": "google.cloud.talent_v4beta1.proto.filters_pb2", - "__doc__": """Application Date Range Filter. The API matches profiles with [Applica - tion.application_date][google.cloud.talent.v4beta1.Application.applica - tion_date] between start date and end date (both boundaries are - inclusive). The filter is ignored if both [start_date][google.cloud.ta - lent.v4beta1.ApplicationDateFilter.start_date] and - [end_date][google.cloud.talent.v4beta1.ApplicationDateFilter.end_date] - are missing. - - Attributes: - start_date: - Start date. If it’s missing, The API matches profiles with - application date not after the end date. - end_date: - End date. If it’s missing, The API matches profiles with - application date not before the start date. - """, - # @@protoc_insertion_point(class_scope:google.cloud.talent.v4beta1.ApplicationDateFilter) - }, -) -_sym_db.RegisterMessage(ApplicationDateFilter) - -ApplicationOutcomeNotesFilter = _reflection.GeneratedProtocolMessageType( - "ApplicationOutcomeNotesFilter", - (_message.Message,), - { - "DESCRIPTOR": _APPLICATIONOUTCOMENOTESFILTER, - "__module__": "google.cloud.talent_v4beta1.proto.filters_pb2", - "__doc__": """Outcome Notes Filter. - - Attributes: - outcome_notes: - Required. User entered or selected outcome reason. The API - does an exact match on the [Application.outcome_notes][google. - cloud.talent.v4beta1.Application.outcome_notes] in profiles. - negated: - If true, The API excludes all candidates with any [Application - .outcome_notes][google.cloud.talent.v4beta1.Application.outcom - e_notes] matching the outcome reason specified in the filter. - """, - # @@protoc_insertion_point(class_scope:google.cloud.talent.v4beta1.ApplicationOutcomeNotesFilter) - }, -) -_sym_db.RegisterMessage(ApplicationOutcomeNotesFilter) - -ApplicationJobFilter = _reflection.GeneratedProtocolMessageType( - "ApplicationJobFilter", - (_message.Message,), - { - "DESCRIPTOR": _APPLICATIONJOBFILTER, - "__module__": "google.cloud.talent_v4beta1.proto.filters_pb2", - "__doc__": """Filter on the job information of Application. - - Attributes: - job_requisition_id: - The job requisition id in the application. The API does an - exact match on the [Job.requisition_id][google.cloud.talent.v4 - beta1.Job.requisition_id] of - [Application.job][google.cloud.talent.v4beta1.Application.job] - in profiles. - job_title: - The job title in the application. The API does an exact match - on the [Job.title][google.cloud.talent.v4beta1.Job.title] of - [Application.job][google.cloud.talent.v4beta1.Application.job] - in profiles. - negated: - If true, the API excludes all profiles with any - [Application.job][google.cloud.talent.v4beta1.Application.job] - matching the filters. - """, - # @@protoc_insertion_point(class_scope:google.cloud.talent.v4beta1.ApplicationJobFilter) - }, -) -_sym_db.RegisterMessage(ApplicationJobFilter) - -TimeFilter = _reflection.GeneratedProtocolMessageType( - "TimeFilter", - (_message.Message,), - { - "DESCRIPTOR": _TIMEFILTER, - "__module__": "google.cloud.talent_v4beta1.proto.filters_pb2", - "__doc__": """Filter on create timestamp or update timestamp of profiles. - - Attributes: - start_time: - Start timestamp, matching profiles with the start time. If - this field missing, The API matches profiles with create / - update timestamp before the end timestamp. - end_time: - End timestamp, matching profiles with the end time. If this - field missing, The API matches profiles with create / update - timestamp after the start timestamp. - time_field: - Specifies which time field to filter profiles. Defaults to [T - imeField.CREATE_TIME][google.cloud.talent.v4beta1.TimeFilter.T - imeField.CREATE_TIME]. - """, - # @@protoc_insertion_point(class_scope:google.cloud.talent.v4beta1.TimeFilter) - }, -) -_sym_db.RegisterMessage(TimeFilter) - -CandidateAvailabilityFilter = _reflection.GeneratedProtocolMessageType( - "CandidateAvailabilityFilter", - (_message.Message,), - { - "DESCRIPTOR": _CANDIDATEAVAILABILITYFILTER, - "__module__": "google.cloud.talent_v4beta1.proto.filters_pb2", - "__doc__": """Deprecated. Use AvailabilityFilter instead. Filter on availability - signals. - - Attributes: - negated: - It is false by default. If true, API excludes all the - potential available profiles. - """, - # @@protoc_insertion_point(class_scope:google.cloud.talent.v4beta1.CandidateAvailabilityFilter) - }, -) -_sym_db.RegisterMessage(CandidateAvailabilityFilter) - -AvailabilityFilter = _reflection.GeneratedProtocolMessageType( - "AvailabilityFilter", - (_message.Message,), - { - "DESCRIPTOR": _AVAILABILITYFILTER, - "__module__": "google.cloud.talent_v4beta1.proto.filters_pb2", - "__doc__": """Filter on availability signals. - - Attributes: - signal_type: - Required. Type of signal to apply filter on. - range: - Required. Range of times to filter candidate signals by. - required: - If multiple [AvailabilityFilter][google.cloud.talent.v4beta1.A - vailabilityFilter] are provided, the default behavior is to OR - all filters, but if this field is set to true, this particular - [AvailabilityFilter][google.cloud.talent.v4beta1.AvailabilityF - ilter] will be AND’ed against other [AvailabilityFilter][googl - e.cloud.talent.v4beta1.AvailabilityFilter]. - """, - # @@protoc_insertion_point(class_scope:google.cloud.talent.v4beta1.AvailabilityFilter) - }, -) -_sym_db.RegisterMessage(AvailabilityFilter) - -PersonNameFilter = _reflection.GeneratedProtocolMessageType( - "PersonNameFilter", - (_message.Message,), - { - "DESCRIPTOR": _PERSONNAMEFILTER, - "__module__": "google.cloud.talent_v4beta1.proto.filters_pb2", - "__doc__": """Filter on person name. - - Attributes: - person_name: - Required. The person name. For example, “John Smith”. Can be - any combination of [PersonName.structured_name.given_name][], - [PersonName.structured_name.middle_initial][], - [PersonName.structured_name.family_name][], and [PersonName.fo - rmatted_name][google.cloud.talent.v4beta1.PersonName.formatted - _name]. - """, - # @@protoc_insertion_point(class_scope:google.cloud.talent.v4beta1.PersonNameFilter) - }, -) -_sym_db.RegisterMessage(PersonNameFilter) - - -DESCRIPTOR._options = None -_PROFILEQUERY.fields_by_name["candidate_availability_filter"]._options = None -_COMPENSATIONFILTER.fields_by_name["type"]._options = None -_COMPENSATIONFILTER.fields_by_name["units"]._options = None -_COMMUTEFILTER.fields_by_name["commute_method"]._options = None -_COMMUTEFILTER.fields_by_name["start_coordinates"]._options = None -_COMMUTEFILTER.fields_by_name["travel_duration"]._options = None -_JOBTITLEFILTER.fields_by_name["job_title"]._options = None -_SKILLFILTER.fields_by_name["skill"]._options = None -_EMPLOYERFILTER.fields_by_name["employer"]._options = None -_APPLICATIONOUTCOMENOTESFILTER.fields_by_name["outcome_notes"]._options = None -_CANDIDATEAVAILABILITYFILTER._options = None -_AVAILABILITYFILTER.fields_by_name["signal_type"]._options = None -_AVAILABILITYFILTER.fields_by_name["range"]._options = None -_PERSONNAMEFILTER.fields_by_name["person_name"]._options = None -# @@protoc_insertion_point(module_scope) diff --git a/google/cloud/talent_v4beta1/proto/filters_pb2_grpc.py b/google/cloud/talent_v4beta1/proto/filters_pb2_grpc.py deleted file mode 100644 index 8a939394..00000000 --- a/google/cloud/talent_v4beta1/proto/filters_pb2_grpc.py +++ /dev/null @@ -1,3 +0,0 @@ -# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT! -"""Client and server classes corresponding to protobuf-defined services.""" -import grpc diff --git a/google/cloud/talent_v4beta1/proto/histogram_pb2.py b/google/cloud/talent_v4beta1/proto/histogram_pb2.py deleted file mode 100644 index 683a9684..00000000 --- a/google/cloud/talent_v4beta1/proto/histogram_pb2.py +++ /dev/null @@ -1,260 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by the protocol buffer compiler. DO NOT EDIT! -# source: google/cloud/talent_v4beta1/proto/histogram.proto -"""Generated protocol buffer code.""" -from google.protobuf import descriptor as _descriptor -from google.protobuf import message as _message -from google.protobuf import reflection as _reflection -from google.protobuf import symbol_database as _symbol_database - -# @@protoc_insertion_point(imports) - -_sym_db = _symbol_database.Default() - - -from google.api import annotations_pb2 as google_dot_api_dot_annotations__pb2 - - -DESCRIPTOR = _descriptor.FileDescriptor( - name="google/cloud/talent_v4beta1/proto/histogram.proto", - package="google.cloud.talent.v4beta1", - syntax="proto3", - serialized_options=b"\n\037com.google.cloud.talent.v4beta1B\016HistogramProtoP\001ZAgoogle.golang.org/genproto/googleapis/cloud/talent/v4beta1;talent\242\002\003CTS", - create_key=_descriptor._internal_create_key, - serialized_pb=b'\n1google/cloud/talent_v4beta1/proto/histogram.proto\x12\x1bgoogle.cloud.talent.v4beta1\x1a\x1cgoogle/api/annotations.proto")\n\x0eHistogramQuery\x12\x17\n\x0fhistogram_query\x18\x01 \x01(\t"\xb6\x01\n\x14HistogramQueryResult\x12\x17\n\x0fhistogram_query\x18\x01 \x01(\t\x12S\n\thistogram\x18\x02 \x03(\x0b\x32@.google.cloud.talent.v4beta1.HistogramQueryResult.HistogramEntry\x1a\x30\n\x0eHistogramEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\x03:\x02\x38\x01\x42|\n\x1f\x63om.google.cloud.talent.v4beta1B\x0eHistogramProtoP\x01ZAgoogle.golang.org/genproto/googleapis/cloud/talent/v4beta1;talent\xa2\x02\x03\x43TSb\x06proto3', - dependencies=[google_dot_api_dot_annotations__pb2.DESCRIPTOR,], -) - - -_HISTOGRAMQUERY = _descriptor.Descriptor( - name="HistogramQuery", - full_name="google.cloud.talent.v4beta1.HistogramQuery", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="histogram_query", - full_name="google.cloud.talent.v4beta1.HistogramQuery.histogram_query", - index=0, - number=1, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=112, - serialized_end=153, -) - - -_HISTOGRAMQUERYRESULT_HISTOGRAMENTRY = _descriptor.Descriptor( - name="HistogramEntry", - full_name="google.cloud.talent.v4beta1.HistogramQueryResult.HistogramEntry", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="key", - full_name="google.cloud.talent.v4beta1.HistogramQueryResult.HistogramEntry.key", - index=0, - number=1, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="value", - full_name="google.cloud.talent.v4beta1.HistogramQueryResult.HistogramEntry.value", - index=1, - number=2, - type=3, - cpp_type=2, - label=1, - has_default_value=False, - default_value=0, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=b"8\001", - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=290, - serialized_end=338, -) - -_HISTOGRAMQUERYRESULT = _descriptor.Descriptor( - name="HistogramQueryResult", - full_name="google.cloud.talent.v4beta1.HistogramQueryResult", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="histogram_query", - full_name="google.cloud.talent.v4beta1.HistogramQueryResult.histogram_query", - index=0, - number=1, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="histogram", - full_name="google.cloud.talent.v4beta1.HistogramQueryResult.histogram", - index=1, - number=2, - type=11, - cpp_type=10, - label=3, - has_default_value=False, - default_value=[], - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[_HISTOGRAMQUERYRESULT_HISTOGRAMENTRY,], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=156, - serialized_end=338, -) - -_HISTOGRAMQUERYRESULT_HISTOGRAMENTRY.containing_type = _HISTOGRAMQUERYRESULT -_HISTOGRAMQUERYRESULT.fields_by_name[ - "histogram" -].message_type = _HISTOGRAMQUERYRESULT_HISTOGRAMENTRY -DESCRIPTOR.message_types_by_name["HistogramQuery"] = _HISTOGRAMQUERY -DESCRIPTOR.message_types_by_name["HistogramQueryResult"] = _HISTOGRAMQUERYRESULT -_sym_db.RegisterFileDescriptor(DESCRIPTOR) - -HistogramQuery = _reflection.GeneratedProtocolMessageType( - "HistogramQuery", - (_message.Message,), - { - "DESCRIPTOR": _HISTOGRAMQUERY, - "__module__": "google.cloud.talent_v4beta1.proto.histogram_pb2", - "__doc__": """The histogram request. - - Attributes: - histogram_query: - An expression specifies a histogram request against matching - resources (for example, jobs, profiles) for searches. See [Se - archJobsRequest.histogram_queries][google.cloud.talent.v4beta1 - .SearchJobsRequest.histogram_queries] and [SearchProfilesReque - st.histogram_queries][google.cloud.talent.v4beta1.SearchProfil - esRequest.histogram_queries] for details about syntax. - """, - # @@protoc_insertion_point(class_scope:google.cloud.talent.v4beta1.HistogramQuery) - }, -) -_sym_db.RegisterMessage(HistogramQuery) - -HistogramQueryResult = _reflection.GeneratedProtocolMessageType( - "HistogramQueryResult", - (_message.Message,), - { - "HistogramEntry": _reflection.GeneratedProtocolMessageType( - "HistogramEntry", - (_message.Message,), - { - "DESCRIPTOR": _HISTOGRAMQUERYRESULT_HISTOGRAMENTRY, - "__module__": "google.cloud.talent_v4beta1.proto.histogram_pb2" - # @@protoc_insertion_point(class_scope:google.cloud.talent.v4beta1.HistogramQueryResult.HistogramEntry) - }, - ), - "DESCRIPTOR": _HISTOGRAMQUERYRESULT, - "__module__": "google.cloud.talent_v4beta1.proto.histogram_pb2", - "__doc__": """Histogram result that matches - [HistogramQuery][google.cloud.talent.v4beta1.HistogramQuery] specified - in searches. - - Attributes: - histogram_query: - Requested histogram expression. - histogram: - A map from the values of the facet associated with distinct - values to the number of matching entries with corresponding - value. The key format is: - (for string histogram) string - values stored in the field. - (for named numeric bucket) name - specified in ``bucket()`` function, like for ``bucket(0, - MAX, "non-negative")``, the key will be ``non-negative``. - - (for anonymous numeric bucket) range formatted as - ``-``, for example, ``0-1000``, ``MIN-0``, and - ``0-MAX``. - """, - # @@protoc_insertion_point(class_scope:google.cloud.talent.v4beta1.HistogramQueryResult) - }, -) -_sym_db.RegisterMessage(HistogramQueryResult) -_sym_db.RegisterMessage(HistogramQueryResult.HistogramEntry) - - -DESCRIPTOR._options = None -_HISTOGRAMQUERYRESULT_HISTOGRAMENTRY._options = None -# @@protoc_insertion_point(module_scope) diff --git a/google/cloud/talent_v4beta1/proto/histogram_pb2_grpc.py b/google/cloud/talent_v4beta1/proto/histogram_pb2_grpc.py deleted file mode 100644 index 8a939394..00000000 --- a/google/cloud/talent_v4beta1/proto/histogram_pb2_grpc.py +++ /dev/null @@ -1,3 +0,0 @@ -# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT! -"""Client and server classes corresponding to protobuf-defined services.""" -import grpc diff --git a/google/cloud/talent_v4beta1/proto/job_pb2.py b/google/cloud/talent_v4beta1/proto/job_pb2.py deleted file mode 100644 index eadc3266..00000000 --- a/google/cloud/talent_v4beta1/proto/job_pb2.py +++ /dev/null @@ -1,1312 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by the protocol buffer compiler. DO NOT EDIT! -# source: google/cloud/talent_v4beta1/proto/job.proto -"""Generated protocol buffer code.""" -from google.protobuf import descriptor as _descriptor -from google.protobuf import message as _message -from google.protobuf import reflection as _reflection -from google.protobuf import symbol_database as _symbol_database - -# @@protoc_insertion_point(imports) - -_sym_db = _symbol_database.Default() - - -from google.api import field_behavior_pb2 as google_dot_api_dot_field__behavior__pb2 -from google.api import resource_pb2 as google_dot_api_dot_resource__pb2 -from google.cloud.talent_v4beta1.proto import ( - common_pb2 as google_dot_cloud_dot_talent__v4beta1_dot_proto_dot_common__pb2, -) -from google.protobuf import timestamp_pb2 as google_dot_protobuf_dot_timestamp__pb2 -from google.type import postal_address_pb2 as google_dot_type_dot_postal__address__pb2 -from google.api import annotations_pb2 as google_dot_api_dot_annotations__pb2 - - -DESCRIPTOR = _descriptor.FileDescriptor( - name="google/cloud/talent_v4beta1/proto/job.proto", - package="google.cloud.talent.v4beta1", - syntax="proto3", - serialized_options=b"\n\037com.google.cloud.talent.v4beta1B\020JobResourceProtoP\001ZAgoogle.golang.org/genproto/googleapis/cloud/talent/v4beta1;talent\242\002\003CTS", - create_key=_descriptor._internal_create_key, - serialized_pb=b"\n+google/cloud/talent_v4beta1/proto/job.proto\x12\x1bgoogle.cloud.talent.v4beta1\x1a\x1fgoogle/api/field_behavior.proto\x1a\x19google/api/resource.proto\x1a.google/cloud/talent_v4beta1/proto/common.proto\x1a\x1fgoogle/protobuf/timestamp.proto\x1a google/type/postal_address.proto\x1a\x1cgoogle/api/annotations.proto\"\xe0\x0f\n\x03Job\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\x34\n\x07\x63ompany\x18\x02 \x01(\tB#\xe0\x41\x02\xfa\x41\x1d\n\x1bjobs.googleapis.com/Company\x12\x1b\n\x0erequisition_id\x18\x03 \x01(\tB\x03\xe0\x41\x02\x12\x12\n\x05title\x18\x04 \x01(\tB\x03\xe0\x41\x02\x12\x18\n\x0b\x64\x65scription\x18\x05 \x01(\tB\x03\xe0\x41\x02\x12\x11\n\taddresses\x18\x06 \x03(\t\x12J\n\x10\x61pplication_info\x18\x07 \x01(\x0b\x32\x30.google.cloud.talent.v4beta1.Job.ApplicationInfo\x12=\n\x0cjob_benefits\x18\x08 \x03(\x0e\x32'.google.cloud.talent.v4beta1.JobBenefit\x12H\n\x11\x63ompensation_info\x18\t \x01(\x0b\x32-.google.cloud.talent.v4beta1.CompensationInfo\x12Q\n\x11\x63ustom_attributes\x18\n \x03(\x0b\x32\x36.google.cloud.talent.v4beta1.Job.CustomAttributesEntry\x12=\n\x0c\x64\x65gree_types\x18\x0b \x03(\x0e\x32'.google.cloud.talent.v4beta1.DegreeType\x12\x12\n\ndepartment\x18\x0c \x01(\t\x12\x45\n\x10\x65mployment_types\x18\r \x03(\x0e\x32+.google.cloud.talent.v4beta1.EmploymentType\x12\x12\n\nincentives\x18\x0e \x01(\t\x12\x15\n\rlanguage_code\x18\x0f \x01(\t\x12\x38\n\tjob_level\x18\x10 \x01(\x0e\x32%.google.cloud.talent.v4beta1.JobLevel\x12\x17\n\x0fpromotion_value\x18\x11 \x01(\x05\x12\x16\n\x0equalifications\x18\x12 \x01(\t\x12\x18\n\x10responsibilities\x18\x13 \x01(\t\x12\x42\n\x0eposting_region\x18\x14 \x01(\x0e\x32*.google.cloud.talent.v4beta1.PostingRegion\x12?\n\nvisibility\x18\x15 \x01(\x0e\x32'.google.cloud.talent.v4beta1.VisibilityB\x02\x18\x01\x12\x32\n\x0ejob_start_time\x18\x16 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12\x30\n\x0cjob_end_time\x18\x17 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12\x38\n\x14posting_publish_time\x18\x18 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12\x37\n\x13posting_expire_time\x18\x19 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12<\n\x13posting_create_time\x18\x1a \x01(\x0b\x32\x1a.google.protobuf.TimestampB\x03\xe0\x41\x03\x12<\n\x13posting_update_time\x18\x1b \x01(\x0b\x32\x1a.google.protobuf.TimestampB\x03\xe0\x41\x03\x12!\n\x14\x63ompany_display_name\x18\x1c \x01(\tB\x03\xe0\x41\x03\x12G\n\x0c\x64\x65rived_info\x18\x1d \x01(\x0b\x32,.google.cloud.talent.v4beta1.Job.DerivedInfoB\x03\xe0\x41\x03\x12N\n\x12processing_options\x18\x1e \x01(\x0b\x32\x32.google.cloud.talent.v4beta1.Job.ProcessingOptions\x1a\x44\n\x0f\x41pplicationInfo\x12\x0e\n\x06\x65mails\x18\x01 \x03(\t\x12\x13\n\x0binstruction\x18\x02 \x01(\t\x12\x0c\n\x04uris\x18\x03 \x03(\t\x1a\x89\x01\n\x0b\x44\x65rivedInfo\x12\x38\n\tlocations\x18\x01 \x03(\x0b\x32%.google.cloud.talent.v4beta1.Location\x12@\n\x0ejob_categories\x18\x03 \x03(\x0e\x32(.google.cloud.talent.v4beta1.JobCategory\x1a\x88\x01\n\x11ProcessingOptions\x12)\n!disable_street_address_resolution\x18\x01 \x01(\x08\x12H\n\x11html_sanitization\x18\x02 \x01(\x0e\x32-.google.cloud.talent.v4beta1.HtmlSanitization\x1a\x65\n\x15\x43ustomAttributesEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12;\n\x05value\x18\x02 \x01(\x0b\x32,.google.cloud.talent.v4beta1.CustomAttribute:\x02\x38\x01:k\xea\x41h\n\x17jobs.googleapis.com/Job\x12.projects/{project}/tenants/{tenant}/jobs/{job}\x12\x1dprojects/{project}/jobs/{job}B~\n\x1f\x63om.google.cloud.talent.v4beta1B\x10JobResourceProtoP\x01ZAgoogle.golang.org/genproto/googleapis/cloud/talent/v4beta1;talent\xa2\x02\x03\x43TSb\x06proto3", - dependencies=[ - google_dot_api_dot_field__behavior__pb2.DESCRIPTOR, - google_dot_api_dot_resource__pb2.DESCRIPTOR, - google_dot_cloud_dot_talent__v4beta1_dot_proto_dot_common__pb2.DESCRIPTOR, - google_dot_protobuf_dot_timestamp__pb2.DESCRIPTOR, - google_dot_type_dot_postal__address__pb2.DESCRIPTOR, - google_dot_api_dot_annotations__pb2.DESCRIPTOR, - ], -) - - -_JOB_APPLICATIONINFO = _descriptor.Descriptor( - name="ApplicationInfo", - full_name="google.cloud.talent.v4beta1.Job.ApplicationInfo", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="emails", - full_name="google.cloud.talent.v4beta1.Job.ApplicationInfo.emails", - index=0, - number=1, - type=9, - cpp_type=9, - label=3, - has_default_value=False, - default_value=[], - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="instruction", - full_name="google.cloud.talent.v4beta1.Job.ApplicationInfo.instruction", - index=1, - number=2, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="uris", - full_name="google.cloud.talent.v4beta1.Job.ApplicationInfo.uris", - index=2, - number=3, - type=9, - cpp_type=9, - label=3, - has_default_value=False, - default_value=[], - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=1739, - serialized_end=1807, -) - -_JOB_DERIVEDINFO = _descriptor.Descriptor( - name="DerivedInfo", - full_name="google.cloud.talent.v4beta1.Job.DerivedInfo", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="locations", - full_name="google.cloud.talent.v4beta1.Job.DerivedInfo.locations", - index=0, - number=1, - type=11, - cpp_type=10, - label=3, - has_default_value=False, - default_value=[], - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="job_categories", - full_name="google.cloud.talent.v4beta1.Job.DerivedInfo.job_categories", - index=1, - number=3, - type=14, - cpp_type=8, - label=3, - has_default_value=False, - default_value=[], - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=1810, - serialized_end=1947, -) - -_JOB_PROCESSINGOPTIONS = _descriptor.Descriptor( - name="ProcessingOptions", - full_name="google.cloud.talent.v4beta1.Job.ProcessingOptions", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="disable_street_address_resolution", - full_name="google.cloud.talent.v4beta1.Job.ProcessingOptions.disable_street_address_resolution", - index=0, - number=1, - type=8, - cpp_type=7, - label=1, - has_default_value=False, - default_value=False, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="html_sanitization", - full_name="google.cloud.talent.v4beta1.Job.ProcessingOptions.html_sanitization", - index=1, - number=2, - type=14, - cpp_type=8, - label=1, - has_default_value=False, - default_value=0, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=1950, - serialized_end=2086, -) - -_JOB_CUSTOMATTRIBUTESENTRY = _descriptor.Descriptor( - name="CustomAttributesEntry", - full_name="google.cloud.talent.v4beta1.Job.CustomAttributesEntry", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="key", - full_name="google.cloud.talent.v4beta1.Job.CustomAttributesEntry.key", - index=0, - number=1, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="value", - full_name="google.cloud.talent.v4beta1.Job.CustomAttributesEntry.value", - index=1, - number=2, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=b"8\001", - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=2088, - serialized_end=2189, -) - -_JOB = _descriptor.Descriptor( - name="Job", - full_name="google.cloud.talent.v4beta1.Job", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="name", - full_name="google.cloud.talent.v4beta1.Job.name", - index=0, - number=1, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="company", - full_name="google.cloud.talent.v4beta1.Job.company", - index=1, - number=2, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\002\372A\035\n\033jobs.googleapis.com/Company", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="requisition_id", - full_name="google.cloud.talent.v4beta1.Job.requisition_id", - index=2, - number=3, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\002", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="title", - full_name="google.cloud.talent.v4beta1.Job.title", - index=3, - number=4, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\002", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="description", - full_name="google.cloud.talent.v4beta1.Job.description", - index=4, - number=5, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\002", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="addresses", - full_name="google.cloud.talent.v4beta1.Job.addresses", - index=5, - number=6, - type=9, - cpp_type=9, - label=3, - has_default_value=False, - default_value=[], - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="application_info", - full_name="google.cloud.talent.v4beta1.Job.application_info", - index=6, - number=7, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="job_benefits", - full_name="google.cloud.talent.v4beta1.Job.job_benefits", - index=7, - number=8, - type=14, - cpp_type=8, - label=3, - has_default_value=False, - default_value=[], - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="compensation_info", - full_name="google.cloud.talent.v4beta1.Job.compensation_info", - index=8, - number=9, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="custom_attributes", - full_name="google.cloud.talent.v4beta1.Job.custom_attributes", - index=9, - number=10, - type=11, - cpp_type=10, - label=3, - has_default_value=False, - default_value=[], - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="degree_types", - full_name="google.cloud.talent.v4beta1.Job.degree_types", - index=10, - number=11, - type=14, - cpp_type=8, - label=3, - has_default_value=False, - default_value=[], - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="department", - full_name="google.cloud.talent.v4beta1.Job.department", - index=11, - number=12, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="employment_types", - full_name="google.cloud.talent.v4beta1.Job.employment_types", - index=12, - number=13, - type=14, - cpp_type=8, - label=3, - has_default_value=False, - default_value=[], - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="incentives", - full_name="google.cloud.talent.v4beta1.Job.incentives", - index=13, - number=14, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="language_code", - full_name="google.cloud.talent.v4beta1.Job.language_code", - index=14, - number=15, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="job_level", - full_name="google.cloud.talent.v4beta1.Job.job_level", - index=15, - number=16, - type=14, - cpp_type=8, - label=1, - has_default_value=False, - default_value=0, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="promotion_value", - full_name="google.cloud.talent.v4beta1.Job.promotion_value", - index=16, - number=17, - type=5, - cpp_type=1, - label=1, - has_default_value=False, - default_value=0, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="qualifications", - full_name="google.cloud.talent.v4beta1.Job.qualifications", - index=17, - number=18, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="responsibilities", - full_name="google.cloud.talent.v4beta1.Job.responsibilities", - index=18, - number=19, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="posting_region", - full_name="google.cloud.talent.v4beta1.Job.posting_region", - index=19, - number=20, - type=14, - cpp_type=8, - label=1, - has_default_value=False, - default_value=0, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="visibility", - full_name="google.cloud.talent.v4beta1.Job.visibility", - index=20, - number=21, - type=14, - cpp_type=8, - label=1, - has_default_value=False, - default_value=0, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\030\001", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="job_start_time", - full_name="google.cloud.talent.v4beta1.Job.job_start_time", - index=21, - number=22, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="job_end_time", - full_name="google.cloud.talent.v4beta1.Job.job_end_time", - index=22, - number=23, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="posting_publish_time", - full_name="google.cloud.talent.v4beta1.Job.posting_publish_time", - index=23, - number=24, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="posting_expire_time", - full_name="google.cloud.talent.v4beta1.Job.posting_expire_time", - index=24, - number=25, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="posting_create_time", - full_name="google.cloud.talent.v4beta1.Job.posting_create_time", - index=25, - number=26, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\003", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="posting_update_time", - full_name="google.cloud.talent.v4beta1.Job.posting_update_time", - index=26, - number=27, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\003", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="company_display_name", - full_name="google.cloud.talent.v4beta1.Job.company_display_name", - index=27, - number=28, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\003", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="derived_info", - full_name="google.cloud.talent.v4beta1.Job.derived_info", - index=28, - number=29, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\003", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="processing_options", - full_name="google.cloud.talent.v4beta1.Job.processing_options", - index=29, - number=30, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[ - _JOB_APPLICATIONINFO, - _JOB_DERIVEDINFO, - _JOB_PROCESSINGOPTIONS, - _JOB_CUSTOMATTRIBUTESENTRY, - ], - enum_types=[], - serialized_options=b"\352Ah\n\027jobs.googleapis.com/Job\022.projects/{project}/tenants/{tenant}/jobs/{job}\022\035projects/{project}/jobs/{job}", - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=282, - serialized_end=2298, -) - -_JOB_APPLICATIONINFO.containing_type = _JOB -_JOB_DERIVEDINFO.fields_by_name[ - "locations" -].message_type = ( - google_dot_cloud_dot_talent__v4beta1_dot_proto_dot_common__pb2._LOCATION -) -_JOB_DERIVEDINFO.fields_by_name[ - "job_categories" -].enum_type = ( - google_dot_cloud_dot_talent__v4beta1_dot_proto_dot_common__pb2._JOBCATEGORY -) -_JOB_DERIVEDINFO.containing_type = _JOB -_JOB_PROCESSINGOPTIONS.fields_by_name[ - "html_sanitization" -].enum_type = ( - google_dot_cloud_dot_talent__v4beta1_dot_proto_dot_common__pb2._HTMLSANITIZATION -) -_JOB_PROCESSINGOPTIONS.containing_type = _JOB -_JOB_CUSTOMATTRIBUTESENTRY.fields_by_name[ - "value" -].message_type = ( - google_dot_cloud_dot_talent__v4beta1_dot_proto_dot_common__pb2._CUSTOMATTRIBUTE -) -_JOB_CUSTOMATTRIBUTESENTRY.containing_type = _JOB -_JOB.fields_by_name["application_info"].message_type = _JOB_APPLICATIONINFO -_JOB.fields_by_name[ - "job_benefits" -].enum_type = google_dot_cloud_dot_talent__v4beta1_dot_proto_dot_common__pb2._JOBBENEFIT -_JOB.fields_by_name[ - "compensation_info" -].message_type = ( - google_dot_cloud_dot_talent__v4beta1_dot_proto_dot_common__pb2._COMPENSATIONINFO -) -_JOB.fields_by_name["custom_attributes"].message_type = _JOB_CUSTOMATTRIBUTESENTRY -_JOB.fields_by_name[ - "degree_types" -].enum_type = google_dot_cloud_dot_talent__v4beta1_dot_proto_dot_common__pb2._DEGREETYPE -_JOB.fields_by_name[ - "employment_types" -].enum_type = ( - google_dot_cloud_dot_talent__v4beta1_dot_proto_dot_common__pb2._EMPLOYMENTTYPE -) -_JOB.fields_by_name[ - "job_level" -].enum_type = google_dot_cloud_dot_talent__v4beta1_dot_proto_dot_common__pb2._JOBLEVEL -_JOB.fields_by_name[ - "posting_region" -].enum_type = ( - google_dot_cloud_dot_talent__v4beta1_dot_proto_dot_common__pb2._POSTINGREGION -) -_JOB.fields_by_name[ - "visibility" -].enum_type = google_dot_cloud_dot_talent__v4beta1_dot_proto_dot_common__pb2._VISIBILITY -_JOB.fields_by_name[ - "job_start_time" -].message_type = google_dot_protobuf_dot_timestamp__pb2._TIMESTAMP -_JOB.fields_by_name[ - "job_end_time" -].message_type = google_dot_protobuf_dot_timestamp__pb2._TIMESTAMP -_JOB.fields_by_name[ - "posting_publish_time" -].message_type = google_dot_protobuf_dot_timestamp__pb2._TIMESTAMP -_JOB.fields_by_name[ - "posting_expire_time" -].message_type = google_dot_protobuf_dot_timestamp__pb2._TIMESTAMP -_JOB.fields_by_name[ - "posting_create_time" -].message_type = google_dot_protobuf_dot_timestamp__pb2._TIMESTAMP -_JOB.fields_by_name[ - "posting_update_time" -].message_type = google_dot_protobuf_dot_timestamp__pb2._TIMESTAMP -_JOB.fields_by_name["derived_info"].message_type = _JOB_DERIVEDINFO -_JOB.fields_by_name["processing_options"].message_type = _JOB_PROCESSINGOPTIONS -DESCRIPTOR.message_types_by_name["Job"] = _JOB -_sym_db.RegisterFileDescriptor(DESCRIPTOR) - -Job = _reflection.GeneratedProtocolMessageType( - "Job", - (_message.Message,), - { - "ApplicationInfo": _reflection.GeneratedProtocolMessageType( - "ApplicationInfo", - (_message.Message,), - { - "DESCRIPTOR": _JOB_APPLICATIONINFO, - "__module__": "google.cloud.talent_v4beta1.proto.job_pb2", - "__doc__": """Application related details of a job posting. - - Attributes: - emails: - Use this field to specify email address(es) to which resumes - or applications can be sent. The maximum number of allowed - characters for each entry is 255. - instruction: - Use this field to provide instructions, such as “Mail your - application to …”, that a candidate can follow to apply for - the job. This field accepts and sanitizes HTML input, and - also accepts bold, italic, ordered list, and unordered list - markup tags. The maximum number of allowed characters is - 3,000. - uris: - Use this URI field to direct an applicant to a website, for - example to link to an online application form. The maximum - number of allowed characters for each entry is 2,000. - """, - # @@protoc_insertion_point(class_scope:google.cloud.talent.v4beta1.Job.ApplicationInfo) - }, - ), - "DerivedInfo": _reflection.GeneratedProtocolMessageType( - "DerivedInfo", - (_message.Message,), - { - "DESCRIPTOR": _JOB_DERIVEDINFO, - "__module__": "google.cloud.talent_v4beta1.proto.job_pb2", - "__doc__": """Derived details about the job posting. - - Attributes: - locations: - Structured locations of the job, resolved from - [Job.addresses][google.cloud.talent.v4beta1.Job.addresses]. [ - locations][google.cloud.talent.v4beta1.Job.DerivedInfo.locatio - ns] are exactly matched to - [Job.addresses][google.cloud.talent.v4beta1.Job.addresses] in - the same order. - job_categories: - Job categories derived from - [Job.title][google.cloud.talent.v4beta1.Job.title] and [Job.de - scription][google.cloud.talent.v4beta1.Job.description]. - """, - # @@protoc_insertion_point(class_scope:google.cloud.talent.v4beta1.Job.DerivedInfo) - }, - ), - "ProcessingOptions": _reflection.GeneratedProtocolMessageType( - "ProcessingOptions", - (_message.Message,), - { - "DESCRIPTOR": _JOB_PROCESSINGOPTIONS, - "__module__": "google.cloud.talent_v4beta1.proto.job_pb2", - "__doc__": """Options for job processing. - - Attributes: - disable_street_address_resolution: - If set to ``true``, the service does not attempt to resolve a - more precise address for the job. - html_sanitization: - Option for job HTML content sanitization. Applied fields are: - - description - applicationInfo.instruction - incentives - - qualifications - responsibilities HTML tags in these fields - may be stripped if sanitiazation isn’t disabled. Defaults to - [HtmlSanitization.SIMPLE_FORMATTING_ONLY][google.cloud.talent. - v4beta1.HtmlSanitization.SIMPLE_FORMATTING_ONLY]. - """, - # @@protoc_insertion_point(class_scope:google.cloud.talent.v4beta1.Job.ProcessingOptions) - }, - ), - "CustomAttributesEntry": _reflection.GeneratedProtocolMessageType( - "CustomAttributesEntry", - (_message.Message,), - { - "DESCRIPTOR": _JOB_CUSTOMATTRIBUTESENTRY, - "__module__": "google.cloud.talent_v4beta1.proto.job_pb2" - # @@protoc_insertion_point(class_scope:google.cloud.talent.v4beta1.Job.CustomAttributesEntry) - }, - ), - "DESCRIPTOR": _JOB, - "__module__": "google.cloud.talent_v4beta1.proto.job_pb2", - "__doc__": """A Job resource represents a job posting (also referred to as a “job - listing” or “job requisition”). A job belongs to a - [Company][google.cloud.talent.v4beta1.Company], which is the hiring - entity responsible for the job. - - Attributes: - name: - Required during job update. The resource name for the job. - This is generated by the service when a job is created. The - format is - “projects/{project_id}/tenants/{tenant_id}/jobs/{job_id}”. For - example, “projects/foo/tenants/bar/jobs/baz”. If tenant id is - unspecified, the default tenant is used. For example, - “projects/foo/jobs/bar”. Use of this field in job queries and - API calls is preferred over the use of [requisition_id][google - .cloud.talent.v4beta1.Job.requisition_id] since this value is - unique. - company: - Required. The resource name of the company listing the job. - The format is “projects/{project_id}/tenants/{tenant_id}/compa - nies/{company_id}”. For example, - “projects/foo/tenants/bar/companies/baz”. If tenant id is - unspecified, the default tenant is used. For example, - “projects/foo/companies/bar”. - requisition_id: - Required. The requisition ID, also referred to as the posting - ID, is assigned by the client to identify a job. This field is - intended to be used by clients for client identification and - tracking of postings. A job isn’t allowed to be created if - there is another job with the same - [company][google.cloud.talent.v4beta1.Job.name], - [language_code][google.cloud.talent.v4beta1.Job.language_code] - and [requisition_id][google.cloud.talent.v4beta1.Job.requisiti - on_id]. The maximum number of allowed characters is 255. - title: - Required. The title of the job, such as “Software Engineer” - The maximum number of allowed characters is 500. - description: - Required. The description of the job, which typically includes - a multi-paragraph description of the company and related - information. Separate fields are provided on the job object - for [responsibilities][google.cloud.talent.v4beta1.Job.respons - ibilities], [qualifications][google.cloud.talent.v4beta1.Job.q - ualifications], and other job characteristics. Use of these - separate job fields is recommended. This field accepts and - sanitizes HTML input, and also accepts bold, italic, ordered - list, and unordered list markup tags. The maximum number of - allowed characters is 100,000. - addresses: - Strongly recommended for the best service experience. - Location(s) where the employer is looking to hire for this job - posting. Specifying the full street address(es) of the hiring - location enables better API results, especially job searches - by commute time. At most 50 locations are allowed for best - search performance. If a job has more locations, it is - suggested to split it into multiple jobs with unique [requisit - ion_id][google.cloud.talent.v4beta1.Job.requisition_id]s (e.g. - ‘ReqA’ becomes ‘ReqA-1’, ‘ReqA-2’, and so on.) as multiple - jobs with the same - [company][google.cloud.talent.v4beta1.Job.company], - [language_code][google.cloud.talent.v4beta1.Job.language_code] - and [requisition_id][google.cloud.talent.v4beta1.Job.requisiti - on_id] are not allowed. If the original [requisition_id][googl - e.cloud.talent.v4beta1.Job.requisition_id] must be preserved, - a custom field should be used for storage. It is also - suggested to group the locations that close to each other in - the same job for better search experience. The maximum number - of allowed characters is 500. - application_info: - Job application information. - job_benefits: - The benefits included with the job. - compensation_info: - Job compensation information (a.k.a. “pay rate”) i.e., the - compensation that will paid to the employee. - custom_attributes: - A map of fields to hold both filterable and non-filterable - custom job attributes that are not covered by the provided - structured fields. The keys of the map are strings up to 64 - bytes and must match the pattern: [a-zA-Z][a-zA-Z0-9\_]*. For - example, key0LikeThis or KEY_1_LIKE_THIS. At most 100 - filterable and at most 100 unfilterable keys are supported. - For filterable ``string_values``, across all keys at most 200 - values are allowed, with each string no more than 255 - characters. For unfilterable ``string_values``, the maximum - total size of ``string_values`` across all keys is 50KB. - degree_types: - The desired education degrees for the job, such as Bachelors, - Masters. - department: - The department or functional area within the company with the - open position. The maximum number of allowed characters is - 255. - employment_types: - The employment type(s) of a job, for example, [full - time][google.cloud.talent.v4beta1.EmploymentType.FULL_TIME] or - [part - time][google.cloud.talent.v4beta1.EmploymentType.PART_TIME]. - incentives: - A description of bonus, commission, and other compensation - incentives associated with the job not including salary or - pay. The maximum number of allowed characters is 10,000. - language_code: - The language of the posting. This field is distinct from any - requirements for fluency that are associated with the job. - Language codes must be in BCP-47 format, such as “en-US” or - “sr-Latn”. For more information, see `Tags for Identifying - Languages `__\ {: - class=“external” target="_blank" }. If this field is - unspecified and - [Job.description][google.cloud.talent.v4beta1.Job.description] - is present, detected language code based on - [Job.description][google.cloud.talent.v4beta1.Job.description] - is assigned, otherwise defaults to ‘en_US’. - job_level: - The experience level associated with the job, such as “Entry - Level”. - promotion_value: - A promotion value of the job, as determined by the client. The - value determines the sort order of the jobs returned when - searching for jobs using the featured jobs search call, with - higher promotional values being returned first and ties being - resolved by relevance sort. Only the jobs with a - promotionValue >0 are returned in a FEATURED_JOB_SEARCH. - Default value is 0, and negative values are treated as 0. - qualifications: - A description of the qualifications required to perform the - job. The use of this field is recommended as an alternative to - using the more general - [description][google.cloud.talent.v4beta1.Job.description] - field. This field accepts and sanitizes HTML input, and also - accepts bold, italic, ordered list, and unordered list markup - tags. The maximum number of allowed characters is 10,000. - responsibilities: - A description of job responsibilities. The use of this field - is recommended as an alternative to using the more general - [description][google.cloud.talent.v4beta1.Job.description] - field. This field accepts and sanitizes HTML input, and also - accepts bold, italic, ordered list, and unordered list markup - tags. The maximum number of allowed characters is 10,000. - posting_region: - The job - [PostingRegion][google.cloud.talent.v4beta1.PostingRegion] - (for example, state, country) throughout which the job is - available. If this field is set, a - [LocationFilter][google.cloud.talent.v4beta1.LocationFilter] - in a search query within the job region finds this job posting - if an exact location match isn’t specified. If this field is - set to [PostingRegion.NATION][google.cloud.talent.v4beta1.Post - ingRegion.NATION] or [PostingRegion.ADMINISTRATIVE_AREA][googl - e.cloud.talent.v4beta1.PostingRegion.ADMINISTRATIVE_AREA], - setting job - [Job.addresses][google.cloud.talent.v4beta1.Job.addresses] to - the same location level as this field is strongly recommended. - visibility: - Deprecated. The job is only visible to the owner. The - visibility of the job. Defaults to [Visibility.ACCOUNT_ONLY][ - google.cloud.talent.v4beta1.Visibility.ACCOUNT_ONLY] if not - specified. - job_start_time: - The start timestamp of the job in UTC time zone. Typically - this field is used for contracting engagements. Invalid - timestamps are ignored. - job_end_time: - The end timestamp of the job. Typically this field is used for - contracting engagements. Invalid timestamps are ignored. - posting_publish_time: - The timestamp this job posting was most recently published. - The default value is the time the request arrives at the - server. Invalid timestamps are ignored. - posting_expire_time: - Strongly recommended for the best service experience. The - expiration timestamp of the job. After this timestamp, the job - is marked as expired, and it no longer appears in search - results. The expired job can’t be listed by the - [ListJobs][google.cloud.talent.v4beta1.JobService.ListJobs] - API, but it can be retrieved with the - [GetJob][google.cloud.talent.v4beta1.JobService.GetJob] API or - updated with the - [UpdateJob][google.cloud.talent.v4beta1.JobService.UpdateJob] - API or deleted with the - [DeleteJob][google.cloud.talent.v4beta1.JobService.DeleteJob] - API. An expired job can be updated and opened again by using a - future expiration timestamp. Updating an expired job fails if - there is another existing open job with same - [company][google.cloud.talent.v4beta1.Job.company], - [language_code][google.cloud.talent.v4beta1.Job.language_code] - and [requisition_id][google.cloud.talent.v4beta1.Job.requisiti - on_id]. The expired jobs are retained in our system for 90 - days. However, the overall expired job count cannot exceed 3 - times the maximum number of open jobs over previous 7 days. If - this threshold is exceeded, expired jobs are cleaned out in - order of earliest expire time. Expired jobs are no longer - accessible after they are cleaned out. Invalid timestamps are - ignored, and treated as expire time not provided. If the - timestamp is before the instant request is made, the job is - treated as expired immediately on creation. This kind of job - can not be updated. And when creating a job with past - timestamp, the [posting_publish_time][google.cloud.talent.v4be - ta1.Job.posting_publish_time] must be set before [posting_expi - re_time][google.cloud.talent.v4beta1.Job.posting_expire_time]. - The purpose of this feature is to allow other objects, such as - [Application][google.cloud.talent.v4beta1.Application], to - refer a job that didn’t exist in the system prior to becoming - expired. If you want to modify a job that was expired on - creation, delete it and create a new one. If this value isn’t - provided at the time of job creation or is invalid, the job - posting expires after 30 days from the job’s creation time. - For example, if the job was created on 2017/01/01 13:00AM UTC - with an unspecified expiration date, the job expires after - 2017/01/31 13:00AM UTC. If this value isn’t provided on job - update, it depends on the field masks set by [UpdateJobRequest - .update_mask][google.cloud.talent.v4beta1.UpdateJobRequest.upd - ate_mask]. If the field masks include - [job_end_time][google.cloud.talent.v4beta1.Job.job_end_time], - or the masks are empty meaning that every field is updated, - the job posting expires after 30 days from the job’s last - update time. Otherwise the expiration date isn’t updated. - posting_create_time: - Output only. The timestamp when this job posting was created. - posting_update_time: - Output only. The timestamp when this job posting was last - updated. - company_display_name: - Output only. Display name of the company listing the job. - derived_info: - Output only. Derived details about the job posting. - processing_options: - Options for job processing. - """, - # @@protoc_insertion_point(class_scope:google.cloud.talent.v4beta1.Job) - }, -) -_sym_db.RegisterMessage(Job) -_sym_db.RegisterMessage(Job.ApplicationInfo) -_sym_db.RegisterMessage(Job.DerivedInfo) -_sym_db.RegisterMessage(Job.ProcessingOptions) -_sym_db.RegisterMessage(Job.CustomAttributesEntry) - - -DESCRIPTOR._options = None -_JOB_CUSTOMATTRIBUTESENTRY._options = None -_JOB.fields_by_name["company"]._options = None -_JOB.fields_by_name["requisition_id"]._options = None -_JOB.fields_by_name["title"]._options = None -_JOB.fields_by_name["description"]._options = None -_JOB.fields_by_name["visibility"]._options = None -_JOB.fields_by_name["posting_create_time"]._options = None -_JOB.fields_by_name["posting_update_time"]._options = None -_JOB.fields_by_name["company_display_name"]._options = None -_JOB.fields_by_name["derived_info"]._options = None -_JOB._options = None -# @@protoc_insertion_point(module_scope) diff --git a/google/cloud/talent_v4beta1/proto/job_pb2_grpc.py b/google/cloud/talent_v4beta1/proto/job_pb2_grpc.py deleted file mode 100644 index 8a939394..00000000 --- a/google/cloud/talent_v4beta1/proto/job_pb2_grpc.py +++ /dev/null @@ -1,3 +0,0 @@ -# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT! -"""Client and server classes corresponding to protobuf-defined services.""" -import grpc diff --git a/google/cloud/talent_v4beta1/proto/job_service_pb2.py b/google/cloud/talent_v4beta1/proto/job_service_pb2.py deleted file mode 100644 index 016e580a..00000000 --- a/google/cloud/talent_v4beta1/proto/job_service_pb2.py +++ /dev/null @@ -1,2680 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by the protocol buffer compiler. DO NOT EDIT! -# source: google/cloud/talent_v4beta1/proto/job_service.proto -"""Generated protocol buffer code.""" -from google.protobuf.internal import enum_type_wrapper -from google.protobuf import descriptor as _descriptor -from google.protobuf import message as _message -from google.protobuf import reflection as _reflection -from google.protobuf import symbol_database as _symbol_database - -# @@protoc_insertion_point(imports) - -_sym_db = _symbol_database.Default() - - -from google.api import annotations_pb2 as google_dot_api_dot_annotations__pb2 -from google.api import client_pb2 as google_dot_api_dot_client__pb2 -from google.api import field_behavior_pb2 as google_dot_api_dot_field__behavior__pb2 -from google.api import resource_pb2 as google_dot_api_dot_resource__pb2 -from google.cloud.talent_v4beta1.proto import ( - common_pb2 as google_dot_cloud_dot_talent__v4beta1_dot_proto_dot_common__pb2, -) -from google.cloud.talent_v4beta1.proto import ( - filters_pb2 as google_dot_cloud_dot_talent__v4beta1_dot_proto_dot_filters__pb2, -) -from google.cloud.talent_v4beta1.proto import ( - histogram_pb2 as google_dot_cloud_dot_talent__v4beta1_dot_proto_dot_histogram__pb2, -) -from google.cloud.talent_v4beta1.proto import ( - job_pb2 as google_dot_cloud_dot_talent__v4beta1_dot_proto_dot_job__pb2, -) -from google.longrunning import ( - operations_pb2 as google_dot_longrunning_dot_operations__pb2, -) -from google.protobuf import any_pb2 as google_dot_protobuf_dot_any__pb2 -from google.protobuf import duration_pb2 as google_dot_protobuf_dot_duration__pb2 -from google.protobuf import empty_pb2 as google_dot_protobuf_dot_empty__pb2 -from google.protobuf import field_mask_pb2 as google_dot_protobuf_dot_field__mask__pb2 -from google.rpc import status_pb2 as google_dot_rpc_dot_status__pb2 - - -DESCRIPTOR = _descriptor.FileDescriptor( - name="google/cloud/talent_v4beta1/proto/job_service.proto", - package="google.cloud.talent.v4beta1", - syntax="proto3", - serialized_options=b"\n\037com.google.cloud.talent.v4beta1B\017JobServiceProtoP\001ZAgoogle.golang.org/genproto/googleapis/cloud/talent/v4beta1;talent\242\002\003CTS", - create_key=_descriptor._internal_create_key, - serialized_pb=b'\n3google/cloud/talent_v4beta1/proto/job_service.proto\x12\x1bgoogle.cloud.talent.v4beta1\x1a\x1cgoogle/api/annotations.proto\x1a\x17google/api/client.proto\x1a\x1fgoogle/api/field_behavior.proto\x1a\x19google/api/resource.proto\x1a.google/cloud/talent_v4beta1/proto/common.proto\x1a/google/cloud/talent_v4beta1/proto/filters.proto\x1a\x31google/cloud/talent_v4beta1/proto/histogram.proto\x1a+google/cloud/talent_v4beta1/proto/job.proto\x1a#google/longrunning/operations.proto\x1a\x19google/protobuf/any.proto\x1a\x1egoogle/protobuf/duration.proto\x1a\x1bgoogle/protobuf/empty.proto\x1a google/protobuf/field_mask.proto\x1a\x17google/rpc/status.proto"w\n\x10\x43reateJobRequest\x12/\n\x06parent\x18\x01 \x01(\tB\x1f\xe0\x41\x02\xfa\x41\x19\x12\x17jobs.googleapis.com/Job\x12\x32\n\x03job\x18\x02 \x01(\x0b\x32 .google.cloud.talent.v4beta1.JobB\x03\xe0\x41\x02">\n\rGetJobRequest\x12-\n\x04name\x18\x01 \x01(\tB\x1f\xe0\x41\x02\xfa\x41\x19\n\x17jobs.googleapis.com/Job"w\n\x10UpdateJobRequest\x12\x32\n\x03job\x18\x01 \x01(\x0b\x32 .google.cloud.talent.v4beta1.JobB\x03\xe0\x41\x02\x12/\n\x0bupdate_mask\x18\x02 \x01(\x0b\x32\x1a.google.protobuf.FieldMask"A\n\x10\x44\x65leteJobRequest\x12-\n\x04name\x18\x01 \x01(\tB\x1f\xe0\x41\x02\xfa\x41\x19\n\x17jobs.googleapis.com/Job"^\n\x16\x42\x61tchDeleteJobsRequest\x12/\n\x06parent\x18\x01 \x01(\tB\x1f\xe0\x41\x02\xfa\x41\x19\x12\x17jobs.googleapis.com/Job\x12\x13\n\x06\x66ilter\x18\x02 \x01(\tB\x03\xe0\x41\x02"\xb6\x01\n\x0fListJobsRequest\x12/\n\x06parent\x18\x01 \x01(\tB\x1f\xe0\x41\x02\xfa\x41\x19\x12\x17jobs.googleapis.com/Job\x12\x13\n\x06\x66ilter\x18\x02 \x01(\tB\x03\xe0\x41\x02\x12\x12\n\npage_token\x18\x03 \x01(\t\x12\x11\n\tpage_size\x18\x04 \x01(\x05\x12\x36\n\x08job_view\x18\x05 \x01(\x0e\x32$.google.cloud.talent.v4beta1.JobView"\x9c\x01\n\x10ListJobsResponse\x12.\n\x04jobs\x18\x01 \x03(\x0b\x32 .google.cloud.talent.v4beta1.Job\x12\x17\n\x0fnext_page_token\x18\x02 \x01(\t\x12?\n\x08metadata\x18\x03 \x01(\x0b\x32-.google.cloud.talent.v4beta1.ResponseMetadata"\xd0\t\n\x11SearchJobsRequest\x12/\n\x06parent\x18\x01 \x01(\tB\x1f\xe0\x41\x02\xfa\x41\x19\x12\x17jobs.googleapis.com/Job\x12N\n\x0bsearch_mode\x18\x02 \x01(\x0e\x32\x39.google.cloud.talent.v4beta1.SearchJobsRequest.SearchMode\x12K\n\x10request_metadata\x18\x03 \x01(\x0b\x32,.google.cloud.talent.v4beta1.RequestMetadataB\x03\xe0\x41\x02\x12\x38\n\tjob_query\x18\x04 \x01(\x0b\x32%.google.cloud.talent.v4beta1.JobQuery\x12\x19\n\x11\x65nable_broadening\x18\x05 \x01(\x08\x12#\n\x1brequire_precise_result_size\x18\x06 \x01(\x08\x12\x46\n\x11histogram_queries\x18\x07 \x03(\x0b\x32+.google.cloud.talent.v4beta1.HistogramQuery\x12\x36\n\x08job_view\x18\x08 \x01(\x0e\x32$.google.cloud.talent.v4beta1.JobView\x12\x0e\n\x06offset\x18\t \x01(\x05\x12\x11\n\tpage_size\x18\n \x01(\x05\x12\x12\n\npage_token\x18\x0b \x01(\t\x12\x10\n\x08order_by\x18\x0c \x01(\t\x12\x62\n\x15\x64iversification_level\x18\r \x01(\x0e\x32\x43.google.cloud.talent.v4beta1.SearchJobsRequest.DiversificationLevel\x12]\n\x13\x63ustom_ranking_info\x18\x0e \x01(\x0b\x32@.google.cloud.talent.v4beta1.SearchJobsRequest.CustomRankingInfo\x12\x1d\n\x15\x64isable_keyword_match\x18\x10 \x01(\x08\x1a\x9a\x02\n\x11\x43ustomRankingInfo\x12o\n\x10importance_level\x18\x01 \x01(\x0e\x32P.google.cloud.talent.v4beta1.SearchJobsRequest.CustomRankingInfo.ImportanceLevelB\x03\xe0\x41\x02\x12\x1f\n\x12ranking_expression\x18\x02 \x01(\tB\x03\xe0\x41\x02"s\n\x0fImportanceLevel\x12 \n\x1cIMPORTANCE_LEVEL_UNSPECIFIED\x10\x00\x12\x08\n\x04NONE\x10\x01\x12\x07\n\x03LOW\x10\x02\x12\x08\n\x04MILD\x10\x03\x12\n\n\x06MEDIUM\x10\x04\x12\x08\n\x04HIGH\x10\x05\x12\x0b\n\x07\x45XTREME\x10\x06"R\n\nSearchMode\x12\x1b\n\x17SEARCH_MODE_UNSPECIFIED\x10\x00\x12\x0e\n\nJOB_SEARCH\x10\x01\x12\x17\n\x13\x46\x45\x41TURED_JOB_SEARCH\x10\x02"W\n\x14\x44iversificationLevel\x12%\n!DIVERSIFICATION_LEVEL_UNSPECIFIED\x10\x00\x12\x0c\n\x08\x44ISABLED\x10\x01\x12\n\n\x06SIMPLE\x10\x02"\xd7\x06\n\x12SearchJobsResponse\x12R\n\rmatching_jobs\x18\x01 \x03(\x0b\x32;.google.cloud.talent.v4beta1.SearchJobsResponse.MatchingJob\x12R\n\x17histogram_query_results\x18\x02 \x03(\x0b\x32\x31.google.cloud.talent.v4beta1.HistogramQueryResult\x12\x17\n\x0fnext_page_token\x18\x03 \x01(\t\x12?\n\x10location_filters\x18\x04 \x03(\x0b\x32%.google.cloud.talent.v4beta1.Location\x12\x1c\n\x14\x65stimated_total_size\x18\x05 \x01(\x05\x12\x12\n\ntotal_size\x18\x06 \x01(\x05\x12?\n\x08metadata\x18\x07 \x01(\x0b\x32-.google.cloud.talent.v4beta1.ResponseMetadata\x12"\n\x1a\x62roadened_query_jobs_count\x18\x08 \x01(\x05\x12I\n\x10spell_correction\x18\t \x01(\x0b\x32/.google.cloud.talent.v4beta1.SpellingCorrection\x1a\xdc\x01\n\x0bMatchingJob\x12-\n\x03job\x18\x01 \x01(\x0b\x32 .google.cloud.talent.v4beta1.Job\x12\x13\n\x0bjob_summary\x18\x02 \x01(\t\x12\x19\n\x11job_title_snippet\x18\x03 \x01(\t\x12\x1b\n\x13search_text_snippet\x18\x04 \x01(\t\x12Q\n\x0c\x63ommute_info\x18\x05 \x01(\x0b\x32;.google.cloud.talent.v4beta1.SearchJobsResponse.CommuteInfo\x1a~\n\x0b\x43ommuteInfo\x12;\n\x0cjob_location\x18\x01 \x01(\x0b\x32%.google.cloud.talent.v4beta1.Location\x12\x32\n\x0ftravel_duration\x18\x02 \x01(\x0b\x32\x19.google.protobuf.Duration"~\n\x16\x42\x61tchCreateJobsRequest\x12/\n\x06parent\x18\x01 \x01(\tB\x1f\xe0\x41\x02\xfa\x41\x19\x12\x17jobs.googleapis.com/Job\x12\x33\n\x04jobs\x18\x02 \x03(\x0b\x32 .google.cloud.talent.v4beta1.JobB\x03\xe0\x41\x02"\xaf\x01\n\x16\x42\x61tchUpdateJobsRequest\x12/\n\x06parent\x18\x01 \x01(\tB\x1f\xe0\x41\x02\xfa\x41\x19\x12\x17jobs.googleapis.com/Job\x12\x33\n\x04jobs\x18\x02 \x03(\x0b\x32 .google.cloud.talent.v4beta1.JobB\x03\xe0\x41\x02\x12/\n\x0bupdate_mask\x18\x03 \x01(\x0b\x32\x1a.google.protobuf.FieldMask"\xc4\x01\n\x12JobOperationResult\x12N\n\x0bjob_results\x18\x01 \x03(\x0b\x32\x39.google.cloud.talent.v4beta1.JobOperationResult.JobResult\x1a^\n\tJobResult\x12-\n\x03job\x18\x01 \x01(\x0b\x32 .google.cloud.talent.v4beta1.Job\x12"\n\x06status\x18\x02 \x01(\x0b\x32\x12.google.rpc.Status*v\n\x07JobView\x12\x18\n\x14JOB_VIEW_UNSPECIFIED\x10\x00\x12\x14\n\x10JOB_VIEW_ID_ONLY\x10\x01\x12\x14\n\x10JOB_VIEW_MINIMAL\x10\x02\x12\x12\n\x0eJOB_VIEW_SMALL\x10\x03\x12\x11\n\rJOB_VIEW_FULL\x10\x04\x32\xce\x12\n\nJobService\x12\xc9\x01\n\tCreateJob\x12-.google.cloud.talent.v4beta1.CreateJobRequest\x1a .google.cloud.talent.v4beta1.Job"k\x82\xd3\xe4\x93\x02X"+/v4beta1/{parent=projects/*/tenants/*}/jobs:\x01*Z&"!/v4beta1/{parent=projects/*}/jobs:\x01*\xda\x41\nparent,job\x12\x9b\x02\n\x0f\x42\x61tchCreateJobs\x12\x33.google.cloud.talent.v4beta1.BatchCreateJobsRequest\x1a\x1d.google.longrunning.Operation"\xb3\x01\x82\xd3\xe4\x93\x02p"7/v4beta1/{parent=projects/*/tenants/*}/jobs:batchCreate:\x01*Z2"-/v4beta1/{parent=projects/*}/jobs:batchCreate:\x01*\xda\x41\x0bparent,jobs\xca\x41,\n\x12JobOperationResult\x12\x16\x42\x61tchOperationMetadata\x12\xb7\x01\n\x06GetJob\x12*.google.cloud.talent.v4beta1.GetJobRequest\x1a .google.cloud.talent.v4beta1.Job"_\x82\xd3\xe4\x93\x02R\x12+/v4beta1/{name=projects/*/tenants/*/jobs/*}Z#\x12!/v4beta1/{name=projects/*/jobs/*}\xda\x41\x04name\x12\xca\x01\n\tUpdateJob\x12-.google.cloud.talent.v4beta1.UpdateJobRequest\x1a .google.cloud.talent.v4beta1.Job"l\x82\xd3\xe4\x93\x02`2//v4beta1/{job.name=projects/*/tenants/*/jobs/*}:\x01*Z*2%/v4beta1/{job.name=projects/*/jobs/*}:\x01*\xda\x41\x03job\x12\x9b\x02\n\x0f\x42\x61tchUpdateJobs\x12\x33.google.cloud.talent.v4beta1.BatchUpdateJobsRequest\x1a\x1d.google.longrunning.Operation"\xb3\x01\x82\xd3\xe4\x93\x02p"7/v4beta1/{parent=projects/*/tenants/*}/jobs:batchUpdate:\x01*Z2"-/v4beta1/{parent=projects/*}/jobs:batchUpdate:\x01*\xda\x41\x0bparent,jobs\xca\x41,\n\x12JobOperationResult\x12\x16\x42\x61tchOperationMetadata\x12\xb3\x01\n\tDeleteJob\x12-.google.cloud.talent.v4beta1.DeleteJobRequest\x1a\x16.google.protobuf.Empty"_\x82\xd3\xe4\x93\x02R*+/v4beta1/{name=projects/*/tenants/*/jobs/*}Z#*!/v4beta1/{name=projects/*/jobs/*}\xda\x41\x04name\x12\xe4\x01\n\x0f\x42\x61tchDeleteJobs\x12\x33.google.cloud.talent.v4beta1.BatchDeleteJobsRequest\x1a\x16.google.protobuf.Empty"\x83\x01\x82\xd3\xe4\x93\x02m"7/v4beta1/{parent=projects/*/tenants/*}/jobs:batchDelete:\x01*Z/"-/v4beta1/{parent=projects/*}/jobs:batchDelete\xda\x41\rparent,filter\x12\xd1\x01\n\x08ListJobs\x12,.google.cloud.talent.v4beta1.ListJobsRequest\x1a-.google.cloud.talent.v4beta1.ListJobsResponse"h\x82\xd3\xe4\x93\x02R\x12+/v4beta1/{parent=projects/*/tenants/*}/jobsZ#\x12!/v4beta1/{parent=projects/*}/jobs\xda\x41\rparent,filter\x12\xdb\x01\n\nSearchJobs\x12..google.cloud.talent.v4beta1.SearchJobsRequest\x1a/.google.cloud.talent.v4beta1.SearchJobsResponse"l\x82\xd3\xe4\x93\x02\x66"2/v4beta1/{parent=projects/*/tenants/*}/jobs:search:\x01*Z-"(/v4beta1/{parent=projects/*}/jobs:search:\x01*\x12\xf3\x01\n\x12SearchJobsForAlert\x12..google.cloud.talent.v4beta1.SearchJobsRequest\x1a/.google.cloud.talent.v4beta1.SearchJobsResponse"|\x82\xd3\xe4\x93\x02v":/v4beta1/{parent=projects/*/tenants/*}/jobs:searchForAlert:\x01*Z5"0/v4beta1/{parent=projects/*}/jobs:searchForAlert:\x01*\x1al\xca\x41\x13jobs.googleapis.com\xd2\x41Shttps://www.googleapis.com/auth/cloud-platform,https://www.googleapis.com/auth/jobsB}\n\x1f\x63om.google.cloud.talent.v4beta1B\x0fJobServiceProtoP\x01ZAgoogle.golang.org/genproto/googleapis/cloud/talent/v4beta1;talent\xa2\x02\x03\x43TSb\x06proto3', - dependencies=[ - google_dot_api_dot_annotations__pb2.DESCRIPTOR, - google_dot_api_dot_client__pb2.DESCRIPTOR, - google_dot_api_dot_field__behavior__pb2.DESCRIPTOR, - google_dot_api_dot_resource__pb2.DESCRIPTOR, - google_dot_cloud_dot_talent__v4beta1_dot_proto_dot_common__pb2.DESCRIPTOR, - google_dot_cloud_dot_talent__v4beta1_dot_proto_dot_filters__pb2.DESCRIPTOR, - google_dot_cloud_dot_talent__v4beta1_dot_proto_dot_histogram__pb2.DESCRIPTOR, - google_dot_cloud_dot_talent__v4beta1_dot_proto_dot_job__pb2.DESCRIPTOR, - google_dot_longrunning_dot_operations__pb2.DESCRIPTOR, - google_dot_protobuf_dot_any__pb2.DESCRIPTOR, - google_dot_protobuf_dot_duration__pb2.DESCRIPTOR, - google_dot_protobuf_dot_empty__pb2.DESCRIPTOR, - google_dot_protobuf_dot_field__mask__pb2.DESCRIPTOR, - google_dot_rpc_dot_status__pb2.DESCRIPTOR, - ], -) - -_JOBVIEW = _descriptor.EnumDescriptor( - name="JobView", - full_name="google.cloud.talent.v4beta1.JobView", - filename=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - values=[ - _descriptor.EnumValueDescriptor( - name="JOB_VIEW_UNSPECIFIED", - index=0, - number=0, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="JOB_VIEW_ID_ONLY", - index=1, - number=1, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="JOB_VIEW_MINIMAL", - index=2, - number=2, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="JOB_VIEW_SMALL", - index=3, - number=3, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="JOB_VIEW_FULL", - index=4, - number=4, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - ], - containing_type=None, - serialized_options=None, - serialized_start=3987, - serialized_end=4105, -) -_sym_db.RegisterEnumDescriptor(_JOBVIEW) - -JobView = enum_type_wrapper.EnumTypeWrapper(_JOBVIEW) -JOB_VIEW_UNSPECIFIED = 0 -JOB_VIEW_ID_ONLY = 1 -JOB_VIEW_MINIMAL = 2 -JOB_VIEW_SMALL = 3 -JOB_VIEW_FULL = 4 - - -_SEARCHJOBSREQUEST_CUSTOMRANKINGINFO_IMPORTANCELEVEL = _descriptor.EnumDescriptor( - name="ImportanceLevel", - full_name="google.cloud.talent.v4beta1.SearchJobsRequest.CustomRankingInfo.ImportanceLevel", - filename=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - values=[ - _descriptor.EnumValueDescriptor( - name="IMPORTANCE_LEVEL_UNSPECIFIED", - index=0, - number=0, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="NONE", - index=1, - number=1, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="LOW", - index=2, - number=2, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="MILD", - index=3, - number=3, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="MEDIUM", - index=4, - number=4, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="HIGH", - index=5, - number=5, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="EXTREME", - index=6, - number=6, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - ], - containing_type=None, - serialized_options=None, - serialized_start=2334, - serialized_end=2449, -) -_sym_db.RegisterEnumDescriptor(_SEARCHJOBSREQUEST_CUSTOMRANKINGINFO_IMPORTANCELEVEL) - -_SEARCHJOBSREQUEST_SEARCHMODE = _descriptor.EnumDescriptor( - name="SearchMode", - full_name="google.cloud.talent.v4beta1.SearchJobsRequest.SearchMode", - filename=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - values=[ - _descriptor.EnumValueDescriptor( - name="SEARCH_MODE_UNSPECIFIED", - index=0, - number=0, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="JOB_SEARCH", - index=1, - number=1, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="FEATURED_JOB_SEARCH", - index=2, - number=2, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - ], - containing_type=None, - serialized_options=None, - serialized_start=2451, - serialized_end=2533, -) -_sym_db.RegisterEnumDescriptor(_SEARCHJOBSREQUEST_SEARCHMODE) - -_SEARCHJOBSREQUEST_DIVERSIFICATIONLEVEL = _descriptor.EnumDescriptor( - name="DiversificationLevel", - full_name="google.cloud.talent.v4beta1.SearchJobsRequest.DiversificationLevel", - filename=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - values=[ - _descriptor.EnumValueDescriptor( - name="DIVERSIFICATION_LEVEL_UNSPECIFIED", - index=0, - number=0, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="DISABLED", - index=1, - number=1, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="SIMPLE", - index=2, - number=2, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - ], - containing_type=None, - serialized_options=None, - serialized_start=2535, - serialized_end=2622, -) -_sym_db.RegisterEnumDescriptor(_SEARCHJOBSREQUEST_DIVERSIFICATIONLEVEL) - - -_CREATEJOBREQUEST = _descriptor.Descriptor( - name="CreateJobRequest", - full_name="google.cloud.talent.v4beta1.CreateJobRequest", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="parent", - full_name="google.cloud.talent.v4beta1.CreateJobRequest.parent", - index=0, - number=1, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\002\372A\031\022\027jobs.googleapis.com/Job", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="job", - full_name="google.cloud.talent.v4beta1.CreateJobRequest.job", - index=1, - number=2, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\002", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=576, - serialized_end=695, -) - - -_GETJOBREQUEST = _descriptor.Descriptor( - name="GetJobRequest", - full_name="google.cloud.talent.v4beta1.GetJobRequest", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="name", - full_name="google.cloud.talent.v4beta1.GetJobRequest.name", - index=0, - number=1, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\002\372A\031\n\027jobs.googleapis.com/Job", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=697, - serialized_end=759, -) - - -_UPDATEJOBREQUEST = _descriptor.Descriptor( - name="UpdateJobRequest", - full_name="google.cloud.talent.v4beta1.UpdateJobRequest", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="job", - full_name="google.cloud.talent.v4beta1.UpdateJobRequest.job", - index=0, - number=1, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\002", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="update_mask", - full_name="google.cloud.talent.v4beta1.UpdateJobRequest.update_mask", - index=1, - number=2, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=761, - serialized_end=880, -) - - -_DELETEJOBREQUEST = _descriptor.Descriptor( - name="DeleteJobRequest", - full_name="google.cloud.talent.v4beta1.DeleteJobRequest", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="name", - full_name="google.cloud.talent.v4beta1.DeleteJobRequest.name", - index=0, - number=1, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\002\372A\031\n\027jobs.googleapis.com/Job", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=882, - serialized_end=947, -) - - -_BATCHDELETEJOBSREQUEST = _descriptor.Descriptor( - name="BatchDeleteJobsRequest", - full_name="google.cloud.talent.v4beta1.BatchDeleteJobsRequest", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="parent", - full_name="google.cloud.talent.v4beta1.BatchDeleteJobsRequest.parent", - index=0, - number=1, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\002\372A\031\022\027jobs.googleapis.com/Job", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="filter", - full_name="google.cloud.talent.v4beta1.BatchDeleteJobsRequest.filter", - index=1, - number=2, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\002", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=949, - serialized_end=1043, -) - - -_LISTJOBSREQUEST = _descriptor.Descriptor( - name="ListJobsRequest", - full_name="google.cloud.talent.v4beta1.ListJobsRequest", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="parent", - full_name="google.cloud.talent.v4beta1.ListJobsRequest.parent", - index=0, - number=1, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\002\372A\031\022\027jobs.googleapis.com/Job", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="filter", - full_name="google.cloud.talent.v4beta1.ListJobsRequest.filter", - index=1, - number=2, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\002", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="page_token", - full_name="google.cloud.talent.v4beta1.ListJobsRequest.page_token", - index=2, - number=3, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="page_size", - full_name="google.cloud.talent.v4beta1.ListJobsRequest.page_size", - index=3, - number=4, - type=5, - cpp_type=1, - label=1, - has_default_value=False, - default_value=0, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="job_view", - full_name="google.cloud.talent.v4beta1.ListJobsRequest.job_view", - index=4, - number=5, - type=14, - cpp_type=8, - label=1, - has_default_value=False, - default_value=0, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=1046, - serialized_end=1228, -) - - -_LISTJOBSRESPONSE = _descriptor.Descriptor( - name="ListJobsResponse", - full_name="google.cloud.talent.v4beta1.ListJobsResponse", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="jobs", - full_name="google.cloud.talent.v4beta1.ListJobsResponse.jobs", - index=0, - number=1, - type=11, - cpp_type=10, - label=3, - has_default_value=False, - default_value=[], - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="next_page_token", - full_name="google.cloud.talent.v4beta1.ListJobsResponse.next_page_token", - index=1, - number=2, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="metadata", - full_name="google.cloud.talent.v4beta1.ListJobsResponse.metadata", - index=2, - number=3, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=1231, - serialized_end=1387, -) - - -_SEARCHJOBSREQUEST_CUSTOMRANKINGINFO = _descriptor.Descriptor( - name="CustomRankingInfo", - full_name="google.cloud.talent.v4beta1.SearchJobsRequest.CustomRankingInfo", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="importance_level", - full_name="google.cloud.talent.v4beta1.SearchJobsRequest.CustomRankingInfo.importance_level", - index=0, - number=1, - type=14, - cpp_type=8, - label=1, - has_default_value=False, - default_value=0, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\002", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="ranking_expression", - full_name="google.cloud.talent.v4beta1.SearchJobsRequest.CustomRankingInfo.ranking_expression", - index=1, - number=2, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\002", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[], - enum_types=[_SEARCHJOBSREQUEST_CUSTOMRANKINGINFO_IMPORTANCELEVEL,], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=2167, - serialized_end=2449, -) - -_SEARCHJOBSREQUEST = _descriptor.Descriptor( - name="SearchJobsRequest", - full_name="google.cloud.talent.v4beta1.SearchJobsRequest", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="parent", - full_name="google.cloud.talent.v4beta1.SearchJobsRequest.parent", - index=0, - number=1, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\002\372A\031\022\027jobs.googleapis.com/Job", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="search_mode", - full_name="google.cloud.talent.v4beta1.SearchJobsRequest.search_mode", - index=1, - number=2, - type=14, - cpp_type=8, - label=1, - has_default_value=False, - default_value=0, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="request_metadata", - full_name="google.cloud.talent.v4beta1.SearchJobsRequest.request_metadata", - index=2, - number=3, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\002", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="job_query", - full_name="google.cloud.talent.v4beta1.SearchJobsRequest.job_query", - index=3, - number=4, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="enable_broadening", - full_name="google.cloud.talent.v4beta1.SearchJobsRequest.enable_broadening", - index=4, - number=5, - type=8, - cpp_type=7, - label=1, - has_default_value=False, - default_value=False, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="require_precise_result_size", - full_name="google.cloud.talent.v4beta1.SearchJobsRequest.require_precise_result_size", - index=5, - number=6, - type=8, - cpp_type=7, - label=1, - has_default_value=False, - default_value=False, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="histogram_queries", - full_name="google.cloud.talent.v4beta1.SearchJobsRequest.histogram_queries", - index=6, - number=7, - type=11, - cpp_type=10, - label=3, - has_default_value=False, - default_value=[], - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="job_view", - full_name="google.cloud.talent.v4beta1.SearchJobsRequest.job_view", - index=7, - number=8, - type=14, - cpp_type=8, - label=1, - has_default_value=False, - default_value=0, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="offset", - full_name="google.cloud.talent.v4beta1.SearchJobsRequest.offset", - index=8, - number=9, - type=5, - cpp_type=1, - label=1, - has_default_value=False, - default_value=0, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="page_size", - full_name="google.cloud.talent.v4beta1.SearchJobsRequest.page_size", - index=9, - number=10, - type=5, - cpp_type=1, - label=1, - has_default_value=False, - default_value=0, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="page_token", - full_name="google.cloud.talent.v4beta1.SearchJobsRequest.page_token", - index=10, - number=11, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="order_by", - full_name="google.cloud.talent.v4beta1.SearchJobsRequest.order_by", - index=11, - number=12, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="diversification_level", - full_name="google.cloud.talent.v4beta1.SearchJobsRequest.diversification_level", - index=12, - number=13, - type=14, - cpp_type=8, - label=1, - has_default_value=False, - default_value=0, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="custom_ranking_info", - full_name="google.cloud.talent.v4beta1.SearchJobsRequest.custom_ranking_info", - index=13, - number=14, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="disable_keyword_match", - full_name="google.cloud.talent.v4beta1.SearchJobsRequest.disable_keyword_match", - index=14, - number=16, - type=8, - cpp_type=7, - label=1, - has_default_value=False, - default_value=False, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[_SEARCHJOBSREQUEST_CUSTOMRANKINGINFO,], - enum_types=[ - _SEARCHJOBSREQUEST_SEARCHMODE, - _SEARCHJOBSREQUEST_DIVERSIFICATIONLEVEL, - ], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=1390, - serialized_end=2622, -) - - -_SEARCHJOBSRESPONSE_MATCHINGJOB = _descriptor.Descriptor( - name="MatchingJob", - full_name="google.cloud.talent.v4beta1.SearchJobsResponse.MatchingJob", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="job", - full_name="google.cloud.talent.v4beta1.SearchJobsResponse.MatchingJob.job", - index=0, - number=1, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="job_summary", - full_name="google.cloud.talent.v4beta1.SearchJobsResponse.MatchingJob.job_summary", - index=1, - number=2, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="job_title_snippet", - full_name="google.cloud.talent.v4beta1.SearchJobsResponse.MatchingJob.job_title_snippet", - index=2, - number=3, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="search_text_snippet", - full_name="google.cloud.talent.v4beta1.SearchJobsResponse.MatchingJob.search_text_snippet", - index=3, - number=4, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="commute_info", - full_name="google.cloud.talent.v4beta1.SearchJobsResponse.MatchingJob.commute_info", - index=4, - number=5, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=3132, - serialized_end=3352, -) - -_SEARCHJOBSRESPONSE_COMMUTEINFO = _descriptor.Descriptor( - name="CommuteInfo", - full_name="google.cloud.talent.v4beta1.SearchJobsResponse.CommuteInfo", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="job_location", - full_name="google.cloud.talent.v4beta1.SearchJobsResponse.CommuteInfo.job_location", - index=0, - number=1, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="travel_duration", - full_name="google.cloud.talent.v4beta1.SearchJobsResponse.CommuteInfo.travel_duration", - index=1, - number=2, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=3354, - serialized_end=3480, -) - -_SEARCHJOBSRESPONSE = _descriptor.Descriptor( - name="SearchJobsResponse", - full_name="google.cloud.talent.v4beta1.SearchJobsResponse", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="matching_jobs", - full_name="google.cloud.talent.v4beta1.SearchJobsResponse.matching_jobs", - index=0, - number=1, - type=11, - cpp_type=10, - label=3, - has_default_value=False, - default_value=[], - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="histogram_query_results", - full_name="google.cloud.talent.v4beta1.SearchJobsResponse.histogram_query_results", - index=1, - number=2, - type=11, - cpp_type=10, - label=3, - has_default_value=False, - default_value=[], - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="next_page_token", - full_name="google.cloud.talent.v4beta1.SearchJobsResponse.next_page_token", - index=2, - number=3, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="location_filters", - full_name="google.cloud.talent.v4beta1.SearchJobsResponse.location_filters", - index=3, - number=4, - type=11, - cpp_type=10, - label=3, - has_default_value=False, - default_value=[], - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="estimated_total_size", - full_name="google.cloud.talent.v4beta1.SearchJobsResponse.estimated_total_size", - index=4, - number=5, - type=5, - cpp_type=1, - label=1, - has_default_value=False, - default_value=0, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="total_size", - full_name="google.cloud.talent.v4beta1.SearchJobsResponse.total_size", - index=5, - number=6, - type=5, - cpp_type=1, - label=1, - has_default_value=False, - default_value=0, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="metadata", - full_name="google.cloud.talent.v4beta1.SearchJobsResponse.metadata", - index=6, - number=7, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="broadened_query_jobs_count", - full_name="google.cloud.talent.v4beta1.SearchJobsResponse.broadened_query_jobs_count", - index=7, - number=8, - type=5, - cpp_type=1, - label=1, - has_default_value=False, - default_value=0, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="spell_correction", - full_name="google.cloud.talent.v4beta1.SearchJobsResponse.spell_correction", - index=8, - number=9, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[_SEARCHJOBSRESPONSE_MATCHINGJOB, _SEARCHJOBSRESPONSE_COMMUTEINFO,], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=2625, - serialized_end=3480, -) - - -_BATCHCREATEJOBSREQUEST = _descriptor.Descriptor( - name="BatchCreateJobsRequest", - full_name="google.cloud.talent.v4beta1.BatchCreateJobsRequest", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="parent", - full_name="google.cloud.talent.v4beta1.BatchCreateJobsRequest.parent", - index=0, - number=1, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\002\372A\031\022\027jobs.googleapis.com/Job", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="jobs", - full_name="google.cloud.talent.v4beta1.BatchCreateJobsRequest.jobs", - index=1, - number=2, - type=11, - cpp_type=10, - label=3, - has_default_value=False, - default_value=[], - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\002", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=3482, - serialized_end=3608, -) - - -_BATCHUPDATEJOBSREQUEST = _descriptor.Descriptor( - name="BatchUpdateJobsRequest", - full_name="google.cloud.talent.v4beta1.BatchUpdateJobsRequest", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="parent", - full_name="google.cloud.talent.v4beta1.BatchUpdateJobsRequest.parent", - index=0, - number=1, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\002\372A\031\022\027jobs.googleapis.com/Job", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="jobs", - full_name="google.cloud.talent.v4beta1.BatchUpdateJobsRequest.jobs", - index=1, - number=2, - type=11, - cpp_type=10, - label=3, - has_default_value=False, - default_value=[], - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\002", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="update_mask", - full_name="google.cloud.talent.v4beta1.BatchUpdateJobsRequest.update_mask", - index=2, - number=3, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=3611, - serialized_end=3786, -) - - -_JOBOPERATIONRESULT_JOBRESULT = _descriptor.Descriptor( - name="JobResult", - full_name="google.cloud.talent.v4beta1.JobOperationResult.JobResult", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="job", - full_name="google.cloud.talent.v4beta1.JobOperationResult.JobResult.job", - index=0, - number=1, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="status", - full_name="google.cloud.talent.v4beta1.JobOperationResult.JobResult.status", - index=1, - number=2, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=3891, - serialized_end=3985, -) - -_JOBOPERATIONRESULT = _descriptor.Descriptor( - name="JobOperationResult", - full_name="google.cloud.talent.v4beta1.JobOperationResult", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="job_results", - full_name="google.cloud.talent.v4beta1.JobOperationResult.job_results", - index=0, - number=1, - type=11, - cpp_type=10, - label=3, - has_default_value=False, - default_value=[], - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[_JOBOPERATIONRESULT_JOBRESULT,], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=3789, - serialized_end=3985, -) - -_CREATEJOBREQUEST.fields_by_name[ - "job" -].message_type = google_dot_cloud_dot_talent__v4beta1_dot_proto_dot_job__pb2._JOB -_UPDATEJOBREQUEST.fields_by_name[ - "job" -].message_type = google_dot_cloud_dot_talent__v4beta1_dot_proto_dot_job__pb2._JOB -_UPDATEJOBREQUEST.fields_by_name[ - "update_mask" -].message_type = google_dot_protobuf_dot_field__mask__pb2._FIELDMASK -_LISTJOBSREQUEST.fields_by_name["job_view"].enum_type = _JOBVIEW -_LISTJOBSRESPONSE.fields_by_name[ - "jobs" -].message_type = google_dot_cloud_dot_talent__v4beta1_dot_proto_dot_job__pb2._JOB -_LISTJOBSRESPONSE.fields_by_name[ - "metadata" -].message_type = ( - google_dot_cloud_dot_talent__v4beta1_dot_proto_dot_common__pb2._RESPONSEMETADATA -) -_SEARCHJOBSREQUEST_CUSTOMRANKINGINFO.fields_by_name[ - "importance_level" -].enum_type = _SEARCHJOBSREQUEST_CUSTOMRANKINGINFO_IMPORTANCELEVEL -_SEARCHJOBSREQUEST_CUSTOMRANKINGINFO.containing_type = _SEARCHJOBSREQUEST -_SEARCHJOBSREQUEST_CUSTOMRANKINGINFO_IMPORTANCELEVEL.containing_type = ( - _SEARCHJOBSREQUEST_CUSTOMRANKINGINFO -) -_SEARCHJOBSREQUEST.fields_by_name[ - "search_mode" -].enum_type = _SEARCHJOBSREQUEST_SEARCHMODE -_SEARCHJOBSREQUEST.fields_by_name[ - "request_metadata" -].message_type = ( - google_dot_cloud_dot_talent__v4beta1_dot_proto_dot_common__pb2._REQUESTMETADATA -) -_SEARCHJOBSREQUEST.fields_by_name[ - "job_query" -].message_type = ( - google_dot_cloud_dot_talent__v4beta1_dot_proto_dot_filters__pb2._JOBQUERY -) -_SEARCHJOBSREQUEST.fields_by_name[ - "histogram_queries" -].message_type = ( - google_dot_cloud_dot_talent__v4beta1_dot_proto_dot_histogram__pb2._HISTOGRAMQUERY -) -_SEARCHJOBSREQUEST.fields_by_name["job_view"].enum_type = _JOBVIEW -_SEARCHJOBSREQUEST.fields_by_name[ - "diversification_level" -].enum_type = _SEARCHJOBSREQUEST_DIVERSIFICATIONLEVEL -_SEARCHJOBSREQUEST.fields_by_name[ - "custom_ranking_info" -].message_type = _SEARCHJOBSREQUEST_CUSTOMRANKINGINFO -_SEARCHJOBSREQUEST_SEARCHMODE.containing_type = _SEARCHJOBSREQUEST -_SEARCHJOBSREQUEST_DIVERSIFICATIONLEVEL.containing_type = _SEARCHJOBSREQUEST -_SEARCHJOBSRESPONSE_MATCHINGJOB.fields_by_name[ - "job" -].message_type = google_dot_cloud_dot_talent__v4beta1_dot_proto_dot_job__pb2._JOB -_SEARCHJOBSRESPONSE_MATCHINGJOB.fields_by_name[ - "commute_info" -].message_type = _SEARCHJOBSRESPONSE_COMMUTEINFO -_SEARCHJOBSRESPONSE_MATCHINGJOB.containing_type = _SEARCHJOBSRESPONSE -_SEARCHJOBSRESPONSE_COMMUTEINFO.fields_by_name[ - "job_location" -].message_type = ( - google_dot_cloud_dot_talent__v4beta1_dot_proto_dot_common__pb2._LOCATION -) -_SEARCHJOBSRESPONSE_COMMUTEINFO.fields_by_name[ - "travel_duration" -].message_type = google_dot_protobuf_dot_duration__pb2._DURATION -_SEARCHJOBSRESPONSE_COMMUTEINFO.containing_type = _SEARCHJOBSRESPONSE -_SEARCHJOBSRESPONSE.fields_by_name[ - "matching_jobs" -].message_type = _SEARCHJOBSRESPONSE_MATCHINGJOB -_SEARCHJOBSRESPONSE.fields_by_name[ - "histogram_query_results" -].message_type = ( - google_dot_cloud_dot_talent__v4beta1_dot_proto_dot_histogram__pb2._HISTOGRAMQUERYRESULT -) -_SEARCHJOBSRESPONSE.fields_by_name[ - "location_filters" -].message_type = ( - google_dot_cloud_dot_talent__v4beta1_dot_proto_dot_common__pb2._LOCATION -) -_SEARCHJOBSRESPONSE.fields_by_name[ - "metadata" -].message_type = ( - google_dot_cloud_dot_talent__v4beta1_dot_proto_dot_common__pb2._RESPONSEMETADATA -) -_SEARCHJOBSRESPONSE.fields_by_name[ - "spell_correction" -].message_type = ( - google_dot_cloud_dot_talent__v4beta1_dot_proto_dot_common__pb2._SPELLINGCORRECTION -) -_BATCHCREATEJOBSREQUEST.fields_by_name[ - "jobs" -].message_type = google_dot_cloud_dot_talent__v4beta1_dot_proto_dot_job__pb2._JOB -_BATCHUPDATEJOBSREQUEST.fields_by_name[ - "jobs" -].message_type = google_dot_cloud_dot_talent__v4beta1_dot_proto_dot_job__pb2._JOB -_BATCHUPDATEJOBSREQUEST.fields_by_name[ - "update_mask" -].message_type = google_dot_protobuf_dot_field__mask__pb2._FIELDMASK -_JOBOPERATIONRESULT_JOBRESULT.fields_by_name[ - "job" -].message_type = google_dot_cloud_dot_talent__v4beta1_dot_proto_dot_job__pb2._JOB -_JOBOPERATIONRESULT_JOBRESULT.fields_by_name[ - "status" -].message_type = google_dot_rpc_dot_status__pb2._STATUS -_JOBOPERATIONRESULT_JOBRESULT.containing_type = _JOBOPERATIONRESULT -_JOBOPERATIONRESULT.fields_by_name[ - "job_results" -].message_type = _JOBOPERATIONRESULT_JOBRESULT -DESCRIPTOR.message_types_by_name["CreateJobRequest"] = _CREATEJOBREQUEST -DESCRIPTOR.message_types_by_name["GetJobRequest"] = _GETJOBREQUEST -DESCRIPTOR.message_types_by_name["UpdateJobRequest"] = _UPDATEJOBREQUEST -DESCRIPTOR.message_types_by_name["DeleteJobRequest"] = _DELETEJOBREQUEST -DESCRIPTOR.message_types_by_name["BatchDeleteJobsRequest"] = _BATCHDELETEJOBSREQUEST -DESCRIPTOR.message_types_by_name["ListJobsRequest"] = _LISTJOBSREQUEST -DESCRIPTOR.message_types_by_name["ListJobsResponse"] = _LISTJOBSRESPONSE -DESCRIPTOR.message_types_by_name["SearchJobsRequest"] = _SEARCHJOBSREQUEST -DESCRIPTOR.message_types_by_name["SearchJobsResponse"] = _SEARCHJOBSRESPONSE -DESCRIPTOR.message_types_by_name["BatchCreateJobsRequest"] = _BATCHCREATEJOBSREQUEST -DESCRIPTOR.message_types_by_name["BatchUpdateJobsRequest"] = _BATCHUPDATEJOBSREQUEST -DESCRIPTOR.message_types_by_name["JobOperationResult"] = _JOBOPERATIONRESULT -DESCRIPTOR.enum_types_by_name["JobView"] = _JOBVIEW -_sym_db.RegisterFileDescriptor(DESCRIPTOR) - -CreateJobRequest = _reflection.GeneratedProtocolMessageType( - "CreateJobRequest", - (_message.Message,), - { - "DESCRIPTOR": _CREATEJOBREQUEST, - "__module__": "google.cloud.talent_v4beta1.proto.job_service_pb2", - "__doc__": """Create job request. - - Attributes: - parent: - Required. The resource name of the tenant under which the job - is created. The format is - “projects/{project_id}/tenants/{tenant_id}”. For example, - “projects/foo/tenant/bar”. If tenant id is unspecified a - default tenant is created. For example, “projects/foo”. - job: - Required. The Job to be created. - """, - # @@protoc_insertion_point(class_scope:google.cloud.talent.v4beta1.CreateJobRequest) - }, -) -_sym_db.RegisterMessage(CreateJobRequest) - -GetJobRequest = _reflection.GeneratedProtocolMessageType( - "GetJobRequest", - (_message.Message,), - { - "DESCRIPTOR": _GETJOBREQUEST, - "__module__": "google.cloud.talent_v4beta1.proto.job_service_pb2", - "__doc__": """Get job request. - - Attributes: - name: - Required. The resource name of the job to retrieve. The - format is - “projects/{project_id}/tenants/{tenant_id}/jobs/{job_id}”. For - example, “projects/foo/tenants/bar/jobs/baz”. If tenant id is - unspecified, the default tenant is used. For example, - “projects/foo/jobs/bar”. - """, - # @@protoc_insertion_point(class_scope:google.cloud.talent.v4beta1.GetJobRequest) - }, -) -_sym_db.RegisterMessage(GetJobRequest) - -UpdateJobRequest = _reflection.GeneratedProtocolMessageType( - "UpdateJobRequest", - (_message.Message,), - { - "DESCRIPTOR": _UPDATEJOBREQUEST, - "__module__": "google.cloud.talent_v4beta1.proto.job_service_pb2", - "__doc__": """Update job request. - - Attributes: - job: - Required. The Job to be updated. - update_mask: - Strongly recommended for the best service experience. If [upd - ate_mask][google.cloud.talent.v4beta1.UpdateJobRequest.update\_ - mask] is provided, only the specified fields in - [job][google.cloud.talent.v4beta1.UpdateJobRequest.job] are - updated. Otherwise all the fields are updated. A field mask - to restrict the fields that are updated. Only top level fields - of [Job][google.cloud.talent.v4beta1.Job] are supported. - """, - # @@protoc_insertion_point(class_scope:google.cloud.talent.v4beta1.UpdateJobRequest) - }, -) -_sym_db.RegisterMessage(UpdateJobRequest) - -DeleteJobRequest = _reflection.GeneratedProtocolMessageType( - "DeleteJobRequest", - (_message.Message,), - { - "DESCRIPTOR": _DELETEJOBREQUEST, - "__module__": "google.cloud.talent_v4beta1.proto.job_service_pb2", - "__doc__": """Delete job request. - - Attributes: - name: - Required. The resource name of the job to be deleted. The - format is - “projects/{project_id}/tenants/{tenant_id}/jobs/{job_id}”. For - example, “projects/foo/tenants/bar/jobs/baz”. If tenant id is - unspecified, the default tenant is used. For example, - “projects/foo/jobs/bar”. - """, - # @@protoc_insertion_point(class_scope:google.cloud.talent.v4beta1.DeleteJobRequest) - }, -) -_sym_db.RegisterMessage(DeleteJobRequest) - -BatchDeleteJobsRequest = _reflection.GeneratedProtocolMessageType( - "BatchDeleteJobsRequest", - (_message.Message,), - { - "DESCRIPTOR": _BATCHDELETEJOBSREQUEST, - "__module__": "google.cloud.talent_v4beta1.proto.job_service_pb2", - "__doc__": """Batch delete jobs request. - - Attributes: - parent: - Required. The resource name of the tenant under which the job - is created. The format is - “projects/{project_id}/tenants/{tenant_id}”. For example, - “projects/foo/tenant/bar”. If tenant id is unspecified, a - default tenant is created. For example, “projects/foo”. - filter: - Required. The filter string specifies the jobs to be deleted. - Supported operator: =, AND The fields eligible for filtering - are: - ``companyName`` (Required) - ``requisitionId`` - (Required) Sample Query: companyName = - “projects/foo/companies/bar” AND requisitionId = “req-1” - """, - # @@protoc_insertion_point(class_scope:google.cloud.talent.v4beta1.BatchDeleteJobsRequest) - }, -) -_sym_db.RegisterMessage(BatchDeleteJobsRequest) - -ListJobsRequest = _reflection.GeneratedProtocolMessageType( - "ListJobsRequest", - (_message.Message,), - { - "DESCRIPTOR": _LISTJOBSREQUEST, - "__module__": "google.cloud.talent_v4beta1.proto.job_service_pb2", - "__doc__": """List jobs request. - - Attributes: - parent: - Required. The resource name of the tenant under which the job - is created. The format is - “projects/{project_id}/tenants/{tenant_id}”. For example, - “projects/foo/tenant/bar”. If tenant id is unspecified, a - default tenant is created. For example, “projects/foo”. - filter: - Required. The filter string specifies the jobs to be - enumerated. Supported operator: =, AND The fields eligible - for filtering are: - ``companyName`` (Required) - - ``requisitionId`` - ``status`` Available values: OPEN, - EXPIRED, ALL. Defaults to OPEN if no value is specified. - Sample Query: - companyName = - “projects/foo/tenants/bar/companies/baz” - companyName = - “projects/foo/tenants/bar/companies/baz” AND requisitionId - = “req-1” - companyName = - “projects/foo/tenants/bar/companies/baz” AND status = - “EXPIRED” - page_token: - The starting point of a query result. - page_size: - The maximum number of jobs to be returned per page of results. - If [job_view][google.cloud.talent.v4beta1.ListJobsRequest.job\_ - view] is set to [JobView.JOB_VIEW_ID_ONLY][google.cloud.talent - .v4beta1.JobView.JOB_VIEW_ID_ONLY], the maximum allowed page - size is 1000. Otherwise, the maximum allowed page size is 100. - Default is 100 if empty or a number < 1 is specified. - job_view: - The desired job attributes returned for jobs in the search - response. Defaults to [JobView.JOB_VIEW_FULL][google.cloud.tal - ent.v4beta1.JobView.JOB_VIEW_FULL] if no value is specified. - """, - # @@protoc_insertion_point(class_scope:google.cloud.talent.v4beta1.ListJobsRequest) - }, -) -_sym_db.RegisterMessage(ListJobsRequest) - -ListJobsResponse = _reflection.GeneratedProtocolMessageType( - "ListJobsResponse", - (_message.Message,), - { - "DESCRIPTOR": _LISTJOBSRESPONSE, - "__module__": "google.cloud.talent_v4beta1.proto.job_service_pb2", - "__doc__": """List jobs response. - - Attributes: - jobs: - The Jobs for a given company. The maximum number of items - returned is based on the limit field provided in the request. - next_page_token: - A token to retrieve the next page of results. - metadata: - Additional information for the API invocation, such as the - request tracking id. - """, - # @@protoc_insertion_point(class_scope:google.cloud.talent.v4beta1.ListJobsResponse) - }, -) -_sym_db.RegisterMessage(ListJobsResponse) - -SearchJobsRequest = _reflection.GeneratedProtocolMessageType( - "SearchJobsRequest", - (_message.Message,), - { - "CustomRankingInfo": _reflection.GeneratedProtocolMessageType( - "CustomRankingInfo", - (_message.Message,), - { - "DESCRIPTOR": _SEARCHJOBSREQUEST_CUSTOMRANKINGINFO, - "__module__": "google.cloud.talent_v4beta1.proto.job_service_pb2", - "__doc__": """Custom ranking information for - [SearchJobsRequest][google.cloud.talent.v4beta1.SearchJobsRequest]. - - Attributes: - importance_level: - Required. Controls over how important the score of [CustomRank - ingInfo.ranking_expression][google.cloud.talent.v4beta1.Search - JobsRequest.CustomRankingInfo.ranking_expression] gets applied - to job’s final ranking position. An error is thrown if not - specified. - ranking_expression: - Required. Controls over how job documents get ranked on top of - existing relevance score (determined by API algorithm). A - combination of the ranking expression and relevance score is - used to determine job’s final ranking position. The syntax - for this expression is a subset of Google SQL syntax. - Supported operators are: +, -, \*, /, where the left and right - side of the operator is either a numeric [Job.custom_attribute - s][google.cloud.talent.v4beta1.Job.custom_attributes] key, - integer/double value or an expression that can be evaluated to - a number. Parenthesis are supported to adjust calculation - precedence. The expression must be < 100 characters in length. - The expression is considered invalid for a job if the - expression references custom attributes that are not populated - on the job or if the expression results in a divide by zero. - If an expression is invalid for a job, that job is demoted to - the end of the results. Sample ranking expression (year + 25) - \* 0.25 - (freshness / 0.5) - """, - # @@protoc_insertion_point(class_scope:google.cloud.talent.v4beta1.SearchJobsRequest.CustomRankingInfo) - }, - ), - "DESCRIPTOR": _SEARCHJOBSREQUEST, - "__module__": "google.cloud.talent_v4beta1.proto.job_service_pb2", - "__doc__": """The Request body of the ``SearchJobs`` call. - - Attributes: - parent: - Required. The resource name of the tenant to search within. - The format is “projects/{project_id}/tenants/{tenant_id}”. For - example, “projects/foo/tenant/bar”. If tenant id is - unspecified, a default tenant is created. For example, - “projects/foo”. - search_mode: - Mode of a search. Defaults to [SearchMode.JOB_SEARCH][google. - cloud.talent.v4beta1.SearchJobsRequest.SearchMode.JOB_SEARCH]. - request_metadata: - Required. The meta information collected about the job - searcher, used to improve the search quality of the service. - The identifiers (such as ``user_id``) are provided by users, - and must be unique and consistent. - job_query: - Query used to search against jobs, such as keyword, location - filters, etc. - enable_broadening: - Controls whether to broaden the search when it produces sparse - results. Broadened queries append results to the end of the - matching results list. Defaults to false. - require_precise_result_size: - Controls if the search job request requires the return of a - precise count of the first 300 results. Setting this to - ``true`` ensures consistency in the number of results per - page. Best practice is to set this value to true if a client - allows users to jump directly to a non-sequential search - results page. Enabling this flag may adversely impact - performance. Defaults to false. - histogram_queries: - An expression specifies a histogram request against matching - jobs. Expression syntax is an aggregation function call with - histogram facets and other options. Available aggregation - function calls are: \* ``count(string_histogram_facet)``: - Count the number of matching entities, for each distinct - attribute value. \* ``count(numeric_histogram_facet, list of - buckets)``: Count the number of matching entities within each - bucket. Data types: - Histogram facet: facet names with - format [a-zA-Z][a-zA-Z0-9\_]+. - String: string like “any - string with backslash escape for quote(").” - Number: whole - number and floating point number like 10, -1 and -0.01. - - List: list of elements with comma(,) separator surrounded by - square brackets, for example, [1, 2, 3] and [“one”, “two”, - “three”]. Built-in constants: - MIN (minimum number similar - to java Double.MIN_VALUE) - MAX (maximum number similar to - java Double.MAX_VALUE) Built-in functions: - bucket(start, - end[, label]): bucket built-in function creates a bucket - with range of [start, end). Note that the end is exclusive, - for example, bucket(1, MAX, “positive number”) or bucket(1, - 10). Job histogram facets: - company_display_name: - histogram by [Job.company_display_name][google.cloud.talent - .v4beta1.Job.company_display_name]. - employment_type: - histogram by [Job.employment_types][google.cloud.talent.v4b - eta1.Job.employment_types], for example, “FULL_TIME”, - “PART_TIME”. - company_size: histogram by - [CompanySize][google.cloud.talent.v4beta1.CompanySize], for - example, “SMALL”, “MEDIUM”, “BIG”. - - publish_time_in_month: histogram by the [Job.posting_publis - h_time][google.cloud.talent.v4beta1.Job.posting_publish_time] - in months. Must specify list of numeric buckets in spec. - - publish_time_in_year: histogram by the [Job.posting_publish - _time][google.cloud.talent.v4beta1.Job.posting_publish_time] - in years. Must specify list of numeric buckets in spec. - - degree_types: histogram by the [Job.degree_types][google.cl - oud.talent.v4beta1.Job.degree_types], for example, - “Bachelors”, “Masters”. - job_level: histogram by the - [Job.job_level][google.cloud.talent.v4beta1.Job.job_level], - for example, “Entry Level”. - country: histogram by the - country code of jobs, for example, “US”, “FR”. - admin1: - histogram by the admin1 code of jobs, which is a global - placeholder referring to the state, province, or the - particular term a country uses to define the geographic - structure below the country level, for example, “CA”, “IL”. - - city: histogram by a combination of the “city name, admin1 - code”. For example, “Mountain View, CA”, “New York, NY”. - - admin1_country: histogram by a combination of the “admin1 - code, country”, for example, “CA, US”, “IL, US”. - - city_coordinate: histogram by the city center’s GPS - coordinates (latitude and longitude), for example, - 37.4038522,-122.0987765. Since the coordinates of a city - center can change, customers may need to refresh them - periodically. - locale: histogram by the [Job.language_cod - e][google.cloud.talent.v4beta1.Job.language_code], for - example, “en-US”, “fr-FR”. - language: histogram by the - language subtag of the [Job.language_code][google.cloud.tal - ent.v4beta1.Job.language_code], for example, “en”, “fr”. - - category: histogram by the - [JobCategory][google.cloud.talent.v4beta1.JobCategory], for - example, “COMPUTER_AND_IT”, “HEALTHCARE”. - - base_compensation_unit: histogram by the [CompensationInfo. - CompensationUnit][google.cloud.talent.v4beta1.CompensationInfo - .CompensationUnit] of base salary, for example, “WEEKLY”, - “MONTHLY”. - base_compensation: histogram by the base salary. - Must specify list of numeric buckets to group results by. - - annualized_base_compensation: histogram by the base annualized - salary. Must specify list of numeric buckets to group results - by. - annualized_total_compensation: histogram by the total - annualized salary. Must specify list of numeric buckets to - group results by. - string_custom_attribute: histogram by - string [Job.custom_attributes][google.cloud.talent.v4beta1. - Job.custom_attributes]. Values can be accessed via square - bracket notations like string_custom_attribute[“key1”]. - - numeric_custom_attribute: histogram by numeric [Job.custom\_ - attributes][google.cloud.talent.v4beta1.Job.custom_attributes] - . Values can be accessed via square bracket notations like - numeric_custom_attribute[“key1”]. Must specify list of numeric - buckets to group results by. Example expressions: - - ``count(admin1)`` - ``count(base_compensation, [bucket(1000, - 10000), bucket(10000, 100000), bucket(100000, MAX)])`` - - ``count(string_custom_attribute["some-string-custom- - attribute"])`` - ``count(numeric_custom_attribute["some- - numeric-custom-attribute"], [bucket(MIN, 0, "negative"), - bucket(0, MAX, "non-negative"])`` - job_view: - The desired job attributes returned for jobs in the search - response. Defaults to [JobView.JOB_VIEW_SMALL][google.cloud.ta - lent.v4beta1.JobView.JOB_VIEW_SMALL] if no value is specified. - offset: - An integer that specifies the current offset (that is, - starting result location, amongst the jobs deemed by the API - as relevant) in search results. This field is only considered - if [page_token][google.cloud.talent.v4beta1.SearchJobsRequest. - page_token] is unset. The maximum allowed value is 5000. - Otherwise an error is thrown. For example, 0 means to return - results starting from the first matching job, and 10 means to - return from the 11th job. This can be used for pagination, - (for example, pageSize = 10 and offset = 10 means to return - from the second page). - page_size: - A limit on the number of jobs returned in the search results. - Increasing this value above the default value of 10 can - increase search response time. The value can be between 1 and - 100. - page_token: - The token specifying the current offset within search results. - See [SearchJobsResponse.next_page_token][google.cloud.talent.v - 4beta1.SearchJobsResponse.next_page_token] for an explanation - of how to obtain the next set of query results. - order_by: - The criteria determining how search results are sorted. - Default is ``"relevance desc"``. Supported options are: - - ``"relevance desc"``: By relevance descending, as determined - by the API algorithms. Relevance thresholding of query - results is only available with this ordering. - - ``"posting_publish_time desc"``: By [Job.posting_publish_ti - me][google.cloud.talent.v4beta1.Job.posting_publish_time] - descending. - ``"posting_update_time desc"``: By [Job.post - ing_update_time][google.cloud.talent.v4beta1.Job.posting_updat - e_time] descending. - ``"title"``: By - [Job.title][google.cloud.talent.v4beta1.Job.title] - ascending. - ``"title desc"``: By - [Job.title][google.cloud.talent.v4beta1.Job.title] descending. - - ``"annualized_base_compensation"``: By job’s [Compensati - onInfo.annualized_base_compensation_range][google.cloud.talent - .v4beta1.CompensationInfo.annualized_base_compensation_range] - ascending. Jobs whose annualized base compensation is - unspecified are put at the end of search results. - - ``"annualized_base_compensation desc"``: By job’s [Compensa - tionInfo.annualized_base_compensation_range][google.cloud.tale - nt.v4beta1.CompensationInfo.annualized_base_compensation_range - ] descending. Jobs whose annualized base compensation is - unspecified are put at the end of search results. - - ``"annualized_total_compensation"``: By job’s [Compensation - Info.annualized_total_compensation_range][google.cloud.talent. - v4beta1.CompensationInfo.annualized_total_compensation_range] - ascending. Jobs whose annualized base compensation is - unspecified are put at the end of search results. - - ``"annualized_total_compensation desc"``: By job’s [Compens - ationInfo.annualized_total_compensation_range][google.cloud.ta - lent.v4beta1.CompensationInfo.annualized_total_compensation_ra - nge] descending. Jobs whose annualized base compensation is - unspecified are put at the end of search results. - - ``"custom_ranking desc"``: By the relevance score adjusted to - the [SearchJobsRequest.CustomRankingInfo.ranking_expression - ][google.cloud.talent.v4beta1.SearchJobsRequest.CustomRankingI - nfo.ranking_expression] with weight factor assigned by [ - SearchJobsRequest.CustomRankingInfo.importance_level][google.c - loud.talent.v4beta1.SearchJobsRequest.CustomRankingInfo.import - ance_level] in descending order. - Location sorting: Use - the special syntax to order jobs by distance: - ``"distance_from('Hawaii')"``: Order by distance from Hawaii. - ``"distance_from(19.89, 155.5)"``: Order by distance from a - coordinate. ``"distance_from('Hawaii'), - distance_from('Puerto Rico')"``: Order by multiple - locations. See details below. ``"distance_from('Hawaii'), - distance_from(19.89, 155.5)"``: Order by multiple - locations. See details below. The string can have a maximum - of 256 characters. When multiple distance centers are - provided, a job that is close to any of the distance - centers would have a high rank. When a job has multiple - locations, the job location closest to one of the distance - centers will be used. Jobs that don’t have locations will - be ranked at the bottom. Distance is calculated with a - precision of 11.3 meters (37.4 feet). Diversification - strategy is still applied unless explicitly disabled in - [diversification_level][google.cloud.talent.v4beta1.SearchJobs - Request.diversification_level]. - diversification_level: - Controls whether highly similar jobs are returned next to each - other in the search results. Jobs are identified as highly - similar based on their titles, job categories, and locations. - Highly similar results are clustered so that only one - representative job of the cluster is displayed to the job - seeker higher up in the results, with the other jobs being - displayed lower down in the results. Defaults to [Diversifica - tionLevel.SIMPLE][google.cloud.talent.v4beta1.SearchJobsReques - t.DiversificationLevel.SIMPLE] if no value is specified. - custom_ranking_info: - Controls over how job documents get ranked on top of existing - relevance score (determined by API algorithm). - disable_keyword_match: - Controls whether to disable exact keyword match on - [Job.title][google.cloud.talent.v4beta1.Job.title], [Job.descr - iption][google.cloud.talent.v4beta1.Job.description], [Job.com - pany_display_name][google.cloud.talent.v4beta1.Job.company_dis - play_name], - [Job.addresses][google.cloud.talent.v4beta1.Job.addresses], [J - ob.qualifications][google.cloud.talent.v4beta1.Job.qualificati - ons]. When disable keyword match is turned off, a keyword - match returns jobs that do not match given category filters - when there are matching keywords. For example, for the query - “program manager,” a result is returned even if the job - posting has the title “software developer,” which doesn’t fall - into “program manager” ontology, but does have “program - manager” appearing in its description. For queries like - “cloud” that don’t contain title or location specific - ontology, jobs with “cloud” keyword matches are returned - regardless of this flag’s value. Use [Company.keyword_searcha - ble_job_custom_attributes][google.cloud.talent.v4beta1.Company - .keyword_searchable_job_custom_attributes] if company-specific - globally matched custom field/attribute string values are - needed. Enabling keyword match improves recall of subsequent - search requests. Defaults to false. - """, - # @@protoc_insertion_point(class_scope:google.cloud.talent.v4beta1.SearchJobsRequest) - }, -) -_sym_db.RegisterMessage(SearchJobsRequest) -_sym_db.RegisterMessage(SearchJobsRequest.CustomRankingInfo) - -SearchJobsResponse = _reflection.GeneratedProtocolMessageType( - "SearchJobsResponse", - (_message.Message,), - { - "MatchingJob": _reflection.GeneratedProtocolMessageType( - "MatchingJob", - (_message.Message,), - { - "DESCRIPTOR": _SEARCHJOBSRESPONSE_MATCHINGJOB, - "__module__": "google.cloud.talent_v4beta1.proto.job_service_pb2", - "__doc__": """Job entry with metadata inside - [SearchJobsResponse][google.cloud.talent.v4beta1.SearchJobsResponse]. - - Attributes: - job: - Job resource that matches the specified [SearchJobsRequest][go - ogle.cloud.talent.v4beta1.SearchJobsRequest]. - job_summary: - A summary of the job with core information that’s displayed on - the search results listing page. - job_title_snippet: - Contains snippets of text from the - [Job.title][google.cloud.talent.v4beta1.Job.title] field most - closely matching a search query’s keywords, if available. The - matching query keywords are enclosed in HTML bold tags. - search_text_snippet: - Contains snippets of text from the - [Job.description][google.cloud.talent.v4beta1.Job.description] - and similar fields that most closely match a search query’s - keywords, if available. All HTML tags in the original fields - are stripped when returned in this field, and matching query - keywords are enclosed in HTML bold tags. - commute_info: - Commute information which is generated based on specified - [CommuteFilter][google.cloud.talent.v4beta1.CommuteFilter]. - """, - # @@protoc_insertion_point(class_scope:google.cloud.talent.v4beta1.SearchJobsResponse.MatchingJob) - }, - ), - "CommuteInfo": _reflection.GeneratedProtocolMessageType( - "CommuteInfo", - (_message.Message,), - { - "DESCRIPTOR": _SEARCHJOBSRESPONSE_COMMUTEINFO, - "__module__": "google.cloud.talent_v4beta1.proto.job_service_pb2", - "__doc__": """Commute details related to this job. - - Attributes: - job_location: - Location used as the destination in the commute calculation. - travel_duration: - The number of seconds required to travel to the job location - from the query location. A duration of 0 seconds indicates - that the job isn’t reachable within the requested duration, - but was returned as part of an expanded query. - """, - # @@protoc_insertion_point(class_scope:google.cloud.talent.v4beta1.SearchJobsResponse.CommuteInfo) - }, - ), - "DESCRIPTOR": _SEARCHJOBSRESPONSE, - "__module__": "google.cloud.talent_v4beta1.proto.job_service_pb2", - "__doc__": """Response for SearchJob method. - - Attributes: - matching_jobs: - The Job entities that match the specified [SearchJobsRequest][ - google.cloud.talent.v4beta1.SearchJobsRequest]. - histogram_query_results: - The histogram results that match with specified [SearchJobsReq - uest.histogram_queries][google.cloud.talent.v4beta1.SearchJobs - Request.histogram_queries]. - next_page_token: - The token that specifies the starting position of the next - page of results. This field is empty if there are no more - results. - location_filters: - The location filters that the service applied to the specified - query. If any filters are lat-lng based, the [Location.locatio - n_type][google.cloud.talent.v4beta1.Location.location_type] is - [Location.LocationType.LOCATION_TYPE_UNSPECIFIED][google.cloud - .talent.v4beta1.Location.LocationType.LOCATION_TYPE_UNSPECIFIE - D]. - estimated_total_size: - An estimation of the number of jobs that match the specified - query. This number isn’t guaranteed to be accurate. For - accurate results, see [SearchJobsRequest.require_precise_resul - t_size][google.cloud.talent.v4beta1.SearchJobsRequest.require\_ - precise_result_size]. - total_size: - The precise result count, which is available only if the - client set [SearchJobsRequest.require_precise_result_size][goo - gle.cloud.talent.v4beta1.SearchJobsRequest.require_precise_res - ult_size] to ``true``, or if the response is the last page of - results. Otherwise, the value is ``-1``. - metadata: - Additional information for the API invocation, such as the - request tracking id. - broadened_query_jobs_count: - If query broadening is enabled, we may append additional - results from the broadened query. This number indicates how - many of the jobs returned in the jobs field are from the - broadened query. These results are always at the end of the - jobs list. In particular, a value of 0, or if the field isn’t - set, all the jobs in the jobs list are from the original - (without broadening) query. If this field is non-zero, - subsequent requests with offset after this result set should - contain all broadened results. - spell_correction: - The spell checking result, and correction. - """, - # @@protoc_insertion_point(class_scope:google.cloud.talent.v4beta1.SearchJobsResponse) - }, -) -_sym_db.RegisterMessage(SearchJobsResponse) -_sym_db.RegisterMessage(SearchJobsResponse.MatchingJob) -_sym_db.RegisterMessage(SearchJobsResponse.CommuteInfo) - -BatchCreateJobsRequest = _reflection.GeneratedProtocolMessageType( - "BatchCreateJobsRequest", - (_message.Message,), - { - "DESCRIPTOR": _BATCHCREATEJOBSREQUEST, - "__module__": "google.cloud.talent_v4beta1.proto.job_service_pb2", - "__doc__": """Request to create a batch of jobs. - - Attributes: - parent: - Required. The resource name of the tenant under which the job - is created. The format is - “projects/{project_id}/tenants/{tenant_id}”. For example, - “projects/foo/tenant/bar”. If tenant id is unspecified, a - default tenant is created. For example, “projects/foo”. - jobs: - Required. The jobs to be created. - """, - # @@protoc_insertion_point(class_scope:google.cloud.talent.v4beta1.BatchCreateJobsRequest) - }, -) -_sym_db.RegisterMessage(BatchCreateJobsRequest) - -BatchUpdateJobsRequest = _reflection.GeneratedProtocolMessageType( - "BatchUpdateJobsRequest", - (_message.Message,), - { - "DESCRIPTOR": _BATCHUPDATEJOBSREQUEST, - "__module__": "google.cloud.talent_v4beta1.proto.job_service_pb2", - "__doc__": """Request to update a batch of jobs. - - Attributes: - parent: - Required. The resource name of the tenant under which the job - is created. The format is - “projects/{project_id}/tenants/{tenant_id}”. For example, - “projects/foo/tenant/bar”. If tenant id is unspecified, a - default tenant is created. For example, “projects/foo”. - jobs: - Required. The jobs to be updated. - update_mask: - Strongly recommended for the best service experience. Be aware - that it will also increase latency when checking the status of - a batch operation. If [update_mask][google.cloud.talent.v4bet - a1.BatchUpdateJobsRequest.update_mask] is provided, only the - specified fields in [Job][google.cloud.talent.v4beta1.Job] are - updated. Otherwise all the fields are updated. A field mask - to restrict the fields that are updated. Only top level fields - of [Job][google.cloud.talent.v4beta1.Job] are supported. If [ - update_mask][google.cloud.talent.v4beta1.BatchUpdateJobsReques - t.update_mask] is provided, The - [Job][google.cloud.talent.v4beta1.Job] inside [JobResult][goog - le.cloud.talent.v4beta1.JobOperationResult.JobResult] will - only contains fields that is updated, plus the Id of the Job. - Otherwise, [Job][google.cloud.talent.v4beta1.Job] will include - all fields, which can yield a very large response. - """, - # @@protoc_insertion_point(class_scope:google.cloud.talent.v4beta1.BatchUpdateJobsRequest) - }, -) -_sym_db.RegisterMessage(BatchUpdateJobsRequest) - -JobOperationResult = _reflection.GeneratedProtocolMessageType( - "JobOperationResult", - (_message.Message,), - { - "JobResult": _reflection.GeneratedProtocolMessageType( - "JobResult", - (_message.Message,), - { - "DESCRIPTOR": _JOBOPERATIONRESULT_JOBRESULT, - "__module__": "google.cloud.talent_v4beta1.proto.job_service_pb2", - "__doc__": """Mutation result of a job. - - Attributes: - job: - Here [Job][google.cloud.talent.v4beta1.Job] only contains - basic information including - [name][google.cloud.talent.v4beta1.Job.name], - [company][google.cloud.talent.v4beta1.Job.company], - [language_code][google.cloud.talent.v4beta1.Job.language_code] - and [requisition_id][google.cloud.talent.v4beta1.Job.requisiti - on_id], use getJob method to retrieve detailed information of - the created/updated job. - status: - The status of the job processed. This field is populated if - the processing of the [job][google.cloud.talent.v4beta1.JobOpe - rationResult.JobResult.job] fails. - """, - # @@protoc_insertion_point(class_scope:google.cloud.talent.v4beta1.JobOperationResult.JobResult) - }, - ), - "DESCRIPTOR": _JOBOPERATIONRESULT, - "__module__": "google.cloud.talent_v4beta1.proto.job_service_pb2", - "__doc__": """The result of [JobService.BatchCreateJobs][google.cloud.talent.v4beta1 - .JobService.BatchCreateJobs] or [JobService.BatchUpdateJobs][google.cl - oud.talent.v4beta1.JobService.BatchUpdateJobs] APIs. It’s used to - replace [google.longrunning.Operation.response][google.longrunning.Ope - ration.response] in case of success. - - Attributes: - job_results: - List of job mutation results from a batch mutate operation. It - can change until operation status is FINISHED, FAILED or - CANCELLED. - """, - # @@protoc_insertion_point(class_scope:google.cloud.talent.v4beta1.JobOperationResult) - }, -) -_sym_db.RegisterMessage(JobOperationResult) -_sym_db.RegisterMessage(JobOperationResult.JobResult) - - -DESCRIPTOR._options = None -_CREATEJOBREQUEST.fields_by_name["parent"]._options = None -_CREATEJOBREQUEST.fields_by_name["job"]._options = None -_GETJOBREQUEST.fields_by_name["name"]._options = None -_UPDATEJOBREQUEST.fields_by_name["job"]._options = None -_DELETEJOBREQUEST.fields_by_name["name"]._options = None -_BATCHDELETEJOBSREQUEST.fields_by_name["parent"]._options = None -_BATCHDELETEJOBSREQUEST.fields_by_name["filter"]._options = None -_LISTJOBSREQUEST.fields_by_name["parent"]._options = None -_LISTJOBSREQUEST.fields_by_name["filter"]._options = None -_SEARCHJOBSREQUEST_CUSTOMRANKINGINFO.fields_by_name["importance_level"]._options = None -_SEARCHJOBSREQUEST_CUSTOMRANKINGINFO.fields_by_name[ - "ranking_expression" -]._options = None -_SEARCHJOBSREQUEST.fields_by_name["parent"]._options = None -_SEARCHJOBSREQUEST.fields_by_name["request_metadata"]._options = None -_BATCHCREATEJOBSREQUEST.fields_by_name["parent"]._options = None -_BATCHCREATEJOBSREQUEST.fields_by_name["jobs"]._options = None -_BATCHUPDATEJOBSREQUEST.fields_by_name["parent"]._options = None -_BATCHUPDATEJOBSREQUEST.fields_by_name["jobs"]._options = None - -_JOBSERVICE = _descriptor.ServiceDescriptor( - name="JobService", - full_name="google.cloud.talent.v4beta1.JobService", - file=DESCRIPTOR, - index=0, - serialized_options=b"\312A\023jobs.googleapis.com\322AShttps://www.googleapis.com/auth/cloud-platform,https://www.googleapis.com/auth/jobs", - create_key=_descriptor._internal_create_key, - serialized_start=4108, - serialized_end=6490, - methods=[ - _descriptor.MethodDescriptor( - name="CreateJob", - full_name="google.cloud.talent.v4beta1.JobService.CreateJob", - index=0, - containing_service=None, - input_type=_CREATEJOBREQUEST, - output_type=google_dot_cloud_dot_talent__v4beta1_dot_proto_dot_job__pb2._JOB, - serialized_options=b'\202\323\344\223\002X"+/v4beta1/{parent=projects/*/tenants/*}/jobs:\001*Z&"!/v4beta1/{parent=projects/*}/jobs:\001*\332A\nparent,job', - create_key=_descriptor._internal_create_key, - ), - _descriptor.MethodDescriptor( - name="BatchCreateJobs", - full_name="google.cloud.talent.v4beta1.JobService.BatchCreateJobs", - index=1, - containing_service=None, - input_type=_BATCHCREATEJOBSREQUEST, - output_type=google_dot_longrunning_dot_operations__pb2._OPERATION, - serialized_options=b'\202\323\344\223\002p"7/v4beta1/{parent=projects/*/tenants/*}/jobs:batchCreate:\001*Z2"-/v4beta1/{parent=projects/*}/jobs:batchCreate:\001*\332A\013parent,jobs\312A,\n\022JobOperationResult\022\026BatchOperationMetadata', - create_key=_descriptor._internal_create_key, - ), - _descriptor.MethodDescriptor( - name="GetJob", - full_name="google.cloud.talent.v4beta1.JobService.GetJob", - index=2, - containing_service=None, - input_type=_GETJOBREQUEST, - output_type=google_dot_cloud_dot_talent__v4beta1_dot_proto_dot_job__pb2._JOB, - serialized_options=b"\202\323\344\223\002R\022+/v4beta1/{name=projects/*/tenants/*/jobs/*}Z#\022!/v4beta1/{name=projects/*/jobs/*}\332A\004name", - create_key=_descriptor._internal_create_key, - ), - _descriptor.MethodDescriptor( - name="UpdateJob", - full_name="google.cloud.talent.v4beta1.JobService.UpdateJob", - index=3, - containing_service=None, - input_type=_UPDATEJOBREQUEST, - output_type=google_dot_cloud_dot_talent__v4beta1_dot_proto_dot_job__pb2._JOB, - serialized_options=b"\202\323\344\223\002`2//v4beta1/{job.name=projects/*/tenants/*/jobs/*}:\001*Z*2%/v4beta1/{job.name=projects/*/jobs/*}:\001*\332A\003job", - create_key=_descriptor._internal_create_key, - ), - _descriptor.MethodDescriptor( - name="BatchUpdateJobs", - full_name="google.cloud.talent.v4beta1.JobService.BatchUpdateJobs", - index=4, - containing_service=None, - input_type=_BATCHUPDATEJOBSREQUEST, - output_type=google_dot_longrunning_dot_operations__pb2._OPERATION, - serialized_options=b'\202\323\344\223\002p"7/v4beta1/{parent=projects/*/tenants/*}/jobs:batchUpdate:\001*Z2"-/v4beta1/{parent=projects/*}/jobs:batchUpdate:\001*\332A\013parent,jobs\312A,\n\022JobOperationResult\022\026BatchOperationMetadata', - create_key=_descriptor._internal_create_key, - ), - _descriptor.MethodDescriptor( - name="DeleteJob", - full_name="google.cloud.talent.v4beta1.JobService.DeleteJob", - index=5, - containing_service=None, - input_type=_DELETEJOBREQUEST, - output_type=google_dot_protobuf_dot_empty__pb2._EMPTY, - serialized_options=b"\202\323\344\223\002R*+/v4beta1/{name=projects/*/tenants/*/jobs/*}Z#*!/v4beta1/{name=projects/*/jobs/*}\332A\004name", - create_key=_descriptor._internal_create_key, - ), - _descriptor.MethodDescriptor( - name="BatchDeleteJobs", - full_name="google.cloud.talent.v4beta1.JobService.BatchDeleteJobs", - index=6, - containing_service=None, - input_type=_BATCHDELETEJOBSREQUEST, - output_type=google_dot_protobuf_dot_empty__pb2._EMPTY, - serialized_options=b'\202\323\344\223\002m"7/v4beta1/{parent=projects/*/tenants/*}/jobs:batchDelete:\001*Z/"-/v4beta1/{parent=projects/*}/jobs:batchDelete\332A\rparent,filter', - create_key=_descriptor._internal_create_key, - ), - _descriptor.MethodDescriptor( - name="ListJobs", - full_name="google.cloud.talent.v4beta1.JobService.ListJobs", - index=7, - containing_service=None, - input_type=_LISTJOBSREQUEST, - output_type=_LISTJOBSRESPONSE, - serialized_options=b"\202\323\344\223\002R\022+/v4beta1/{parent=projects/*/tenants/*}/jobsZ#\022!/v4beta1/{parent=projects/*}/jobs\332A\rparent,filter", - create_key=_descriptor._internal_create_key, - ), - _descriptor.MethodDescriptor( - name="SearchJobs", - full_name="google.cloud.talent.v4beta1.JobService.SearchJobs", - index=8, - containing_service=None, - input_type=_SEARCHJOBSREQUEST, - output_type=_SEARCHJOBSRESPONSE, - serialized_options=b'\202\323\344\223\002f"2/v4beta1/{parent=projects/*/tenants/*}/jobs:search:\001*Z-"(/v4beta1/{parent=projects/*}/jobs:search:\001*', - create_key=_descriptor._internal_create_key, - ), - _descriptor.MethodDescriptor( - name="SearchJobsForAlert", - full_name="google.cloud.talent.v4beta1.JobService.SearchJobsForAlert", - index=9, - containing_service=None, - input_type=_SEARCHJOBSREQUEST, - output_type=_SEARCHJOBSRESPONSE, - serialized_options=b'\202\323\344\223\002v":/v4beta1/{parent=projects/*/tenants/*}/jobs:searchForAlert:\001*Z5"0/v4beta1/{parent=projects/*}/jobs:searchForAlert:\001*', - create_key=_descriptor._internal_create_key, - ), - ], -) -_sym_db.RegisterServiceDescriptor(_JOBSERVICE) - -DESCRIPTOR.services_by_name["JobService"] = _JOBSERVICE - -# @@protoc_insertion_point(module_scope) diff --git a/google/cloud/talent_v4beta1/proto/job_service_pb2_grpc.py b/google/cloud/talent_v4beta1/proto/job_service_pb2_grpc.py deleted file mode 100644 index 0f653c3f..00000000 --- a/google/cloud/talent_v4beta1/proto/job_service_pb2_grpc.py +++ /dev/null @@ -1,509 +0,0 @@ -# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT! -"""Client and server classes corresponding to protobuf-defined services.""" -import grpc - -from google.cloud.talent_v4beta1.proto import ( - job_pb2 as google_dot_cloud_dot_talent__v4beta1_dot_proto_dot_job__pb2, -) -from google.cloud.talent_v4beta1.proto import ( - job_service_pb2 as google_dot_cloud_dot_talent__v4beta1_dot_proto_dot_job__service__pb2, -) -from google.longrunning import ( - operations_pb2 as google_dot_longrunning_dot_operations__pb2, -) -from google.protobuf import empty_pb2 as google_dot_protobuf_dot_empty__pb2 - - -class JobServiceStub(object): - """A service handles job management, including job CRUD, enumeration and search. - """ - - def __init__(self, channel): - """Constructor. - - Args: - channel: A grpc.Channel. - """ - self.CreateJob = channel.unary_unary( - "/google.cloud.talent.v4beta1.JobService/CreateJob", - request_serializer=google_dot_cloud_dot_talent__v4beta1_dot_proto_dot_job__service__pb2.CreateJobRequest.SerializeToString, - response_deserializer=google_dot_cloud_dot_talent__v4beta1_dot_proto_dot_job__pb2.Job.FromString, - ) - self.BatchCreateJobs = channel.unary_unary( - "/google.cloud.talent.v4beta1.JobService/BatchCreateJobs", - request_serializer=google_dot_cloud_dot_talent__v4beta1_dot_proto_dot_job__service__pb2.BatchCreateJobsRequest.SerializeToString, - response_deserializer=google_dot_longrunning_dot_operations__pb2.Operation.FromString, - ) - self.GetJob = channel.unary_unary( - "/google.cloud.talent.v4beta1.JobService/GetJob", - request_serializer=google_dot_cloud_dot_talent__v4beta1_dot_proto_dot_job__service__pb2.GetJobRequest.SerializeToString, - response_deserializer=google_dot_cloud_dot_talent__v4beta1_dot_proto_dot_job__pb2.Job.FromString, - ) - self.UpdateJob = channel.unary_unary( - "/google.cloud.talent.v4beta1.JobService/UpdateJob", - request_serializer=google_dot_cloud_dot_talent__v4beta1_dot_proto_dot_job__service__pb2.UpdateJobRequest.SerializeToString, - response_deserializer=google_dot_cloud_dot_talent__v4beta1_dot_proto_dot_job__pb2.Job.FromString, - ) - self.BatchUpdateJobs = channel.unary_unary( - "/google.cloud.talent.v4beta1.JobService/BatchUpdateJobs", - request_serializer=google_dot_cloud_dot_talent__v4beta1_dot_proto_dot_job__service__pb2.BatchUpdateJobsRequest.SerializeToString, - response_deserializer=google_dot_longrunning_dot_operations__pb2.Operation.FromString, - ) - self.DeleteJob = channel.unary_unary( - "/google.cloud.talent.v4beta1.JobService/DeleteJob", - request_serializer=google_dot_cloud_dot_talent__v4beta1_dot_proto_dot_job__service__pb2.DeleteJobRequest.SerializeToString, - response_deserializer=google_dot_protobuf_dot_empty__pb2.Empty.FromString, - ) - self.BatchDeleteJobs = channel.unary_unary( - "/google.cloud.talent.v4beta1.JobService/BatchDeleteJobs", - request_serializer=google_dot_cloud_dot_talent__v4beta1_dot_proto_dot_job__service__pb2.BatchDeleteJobsRequest.SerializeToString, - response_deserializer=google_dot_protobuf_dot_empty__pb2.Empty.FromString, - ) - self.ListJobs = channel.unary_unary( - "/google.cloud.talent.v4beta1.JobService/ListJobs", - request_serializer=google_dot_cloud_dot_talent__v4beta1_dot_proto_dot_job__service__pb2.ListJobsRequest.SerializeToString, - response_deserializer=google_dot_cloud_dot_talent__v4beta1_dot_proto_dot_job__service__pb2.ListJobsResponse.FromString, - ) - self.SearchJobs = channel.unary_unary( - "/google.cloud.talent.v4beta1.JobService/SearchJobs", - request_serializer=google_dot_cloud_dot_talent__v4beta1_dot_proto_dot_job__service__pb2.SearchJobsRequest.SerializeToString, - response_deserializer=google_dot_cloud_dot_talent__v4beta1_dot_proto_dot_job__service__pb2.SearchJobsResponse.FromString, - ) - self.SearchJobsForAlert = channel.unary_unary( - "/google.cloud.talent.v4beta1.JobService/SearchJobsForAlert", - request_serializer=google_dot_cloud_dot_talent__v4beta1_dot_proto_dot_job__service__pb2.SearchJobsRequest.SerializeToString, - response_deserializer=google_dot_cloud_dot_talent__v4beta1_dot_proto_dot_job__service__pb2.SearchJobsResponse.FromString, - ) - - -class JobServiceServicer(object): - """A service handles job management, including job CRUD, enumeration and search. - """ - - def CreateJob(self, request, context): - """Creates a new job. - - Typically, the job becomes searchable within 10 seconds, but it may take - up to 5 minutes. - """ - context.set_code(grpc.StatusCode.UNIMPLEMENTED) - context.set_details("Method not implemented!") - raise NotImplementedError("Method not implemented!") - - def BatchCreateJobs(self, request, context): - """Begins executing a batch create jobs operation. - """ - context.set_code(grpc.StatusCode.UNIMPLEMENTED) - context.set_details("Method not implemented!") - raise NotImplementedError("Method not implemented!") - - def GetJob(self, request, context): - """Retrieves the specified job, whose status is OPEN or recently EXPIRED - within the last 90 days. - """ - context.set_code(grpc.StatusCode.UNIMPLEMENTED) - context.set_details("Method not implemented!") - raise NotImplementedError("Method not implemented!") - - def UpdateJob(self, request, context): - """Updates specified job. - - Typically, updated contents become visible in search results within 10 - seconds, but it may take up to 5 minutes. - """ - context.set_code(grpc.StatusCode.UNIMPLEMENTED) - context.set_details("Method not implemented!") - raise NotImplementedError("Method not implemented!") - - def BatchUpdateJobs(self, request, context): - """Begins executing a batch update jobs operation. - """ - context.set_code(grpc.StatusCode.UNIMPLEMENTED) - context.set_details("Method not implemented!") - raise NotImplementedError("Method not implemented!") - - def DeleteJob(self, request, context): - """Deletes the specified job. - - Typically, the job becomes unsearchable within 10 seconds, but it may take - up to 5 minutes. - """ - context.set_code(grpc.StatusCode.UNIMPLEMENTED) - context.set_details("Method not implemented!") - raise NotImplementedError("Method not implemented!") - - def BatchDeleteJobs(self, request, context): - """Deletes a list of [Job][google.cloud.talent.v4beta1.Job]s by filter. - """ - context.set_code(grpc.StatusCode.UNIMPLEMENTED) - context.set_details("Method not implemented!") - raise NotImplementedError("Method not implemented!") - - def ListJobs(self, request, context): - """Lists jobs by filter. - """ - context.set_code(grpc.StatusCode.UNIMPLEMENTED) - context.set_details("Method not implemented!") - raise NotImplementedError("Method not implemented!") - - def SearchJobs(self, request, context): - """Searches for jobs using the provided [SearchJobsRequest][google.cloud.talent.v4beta1.SearchJobsRequest]. - - This call constrains the [visibility][google.cloud.talent.v4beta1.Job.visibility] of jobs - present in the database, and only returns jobs that the caller has - permission to search against. - """ - context.set_code(grpc.StatusCode.UNIMPLEMENTED) - context.set_details("Method not implemented!") - raise NotImplementedError("Method not implemented!") - - def SearchJobsForAlert(self, request, context): - """Searches for jobs using the provided [SearchJobsRequest][google.cloud.talent.v4beta1.SearchJobsRequest]. - - This API call is intended for the use case of targeting passive job - seekers (for example, job seekers who have signed up to receive email - alerts about potential job opportunities), and has different algorithmic - adjustments that are targeted to passive job seekers. - - This call constrains the [visibility][google.cloud.talent.v4beta1.Job.visibility] of jobs - present in the database, and only returns jobs the caller has - permission to search against. - """ - context.set_code(grpc.StatusCode.UNIMPLEMENTED) - context.set_details("Method not implemented!") - raise NotImplementedError("Method not implemented!") - - -def add_JobServiceServicer_to_server(servicer, server): - rpc_method_handlers = { - "CreateJob": grpc.unary_unary_rpc_method_handler( - servicer.CreateJob, - request_deserializer=google_dot_cloud_dot_talent__v4beta1_dot_proto_dot_job__service__pb2.CreateJobRequest.FromString, - response_serializer=google_dot_cloud_dot_talent__v4beta1_dot_proto_dot_job__pb2.Job.SerializeToString, - ), - "BatchCreateJobs": grpc.unary_unary_rpc_method_handler( - servicer.BatchCreateJobs, - request_deserializer=google_dot_cloud_dot_talent__v4beta1_dot_proto_dot_job__service__pb2.BatchCreateJobsRequest.FromString, - response_serializer=google_dot_longrunning_dot_operations__pb2.Operation.SerializeToString, - ), - "GetJob": grpc.unary_unary_rpc_method_handler( - servicer.GetJob, - request_deserializer=google_dot_cloud_dot_talent__v4beta1_dot_proto_dot_job__service__pb2.GetJobRequest.FromString, - response_serializer=google_dot_cloud_dot_talent__v4beta1_dot_proto_dot_job__pb2.Job.SerializeToString, - ), - "UpdateJob": grpc.unary_unary_rpc_method_handler( - servicer.UpdateJob, - request_deserializer=google_dot_cloud_dot_talent__v4beta1_dot_proto_dot_job__service__pb2.UpdateJobRequest.FromString, - response_serializer=google_dot_cloud_dot_talent__v4beta1_dot_proto_dot_job__pb2.Job.SerializeToString, - ), - "BatchUpdateJobs": grpc.unary_unary_rpc_method_handler( - servicer.BatchUpdateJobs, - request_deserializer=google_dot_cloud_dot_talent__v4beta1_dot_proto_dot_job__service__pb2.BatchUpdateJobsRequest.FromString, - response_serializer=google_dot_longrunning_dot_operations__pb2.Operation.SerializeToString, - ), - "DeleteJob": grpc.unary_unary_rpc_method_handler( - servicer.DeleteJob, - request_deserializer=google_dot_cloud_dot_talent__v4beta1_dot_proto_dot_job__service__pb2.DeleteJobRequest.FromString, - response_serializer=google_dot_protobuf_dot_empty__pb2.Empty.SerializeToString, - ), - "BatchDeleteJobs": grpc.unary_unary_rpc_method_handler( - servicer.BatchDeleteJobs, - request_deserializer=google_dot_cloud_dot_talent__v4beta1_dot_proto_dot_job__service__pb2.BatchDeleteJobsRequest.FromString, - response_serializer=google_dot_protobuf_dot_empty__pb2.Empty.SerializeToString, - ), - "ListJobs": grpc.unary_unary_rpc_method_handler( - servicer.ListJobs, - request_deserializer=google_dot_cloud_dot_talent__v4beta1_dot_proto_dot_job__service__pb2.ListJobsRequest.FromString, - response_serializer=google_dot_cloud_dot_talent__v4beta1_dot_proto_dot_job__service__pb2.ListJobsResponse.SerializeToString, - ), - "SearchJobs": grpc.unary_unary_rpc_method_handler( - servicer.SearchJobs, - request_deserializer=google_dot_cloud_dot_talent__v4beta1_dot_proto_dot_job__service__pb2.SearchJobsRequest.FromString, - response_serializer=google_dot_cloud_dot_talent__v4beta1_dot_proto_dot_job__service__pb2.SearchJobsResponse.SerializeToString, - ), - "SearchJobsForAlert": grpc.unary_unary_rpc_method_handler( - servicer.SearchJobsForAlert, - request_deserializer=google_dot_cloud_dot_talent__v4beta1_dot_proto_dot_job__service__pb2.SearchJobsRequest.FromString, - response_serializer=google_dot_cloud_dot_talent__v4beta1_dot_proto_dot_job__service__pb2.SearchJobsResponse.SerializeToString, - ), - } - generic_handler = grpc.method_handlers_generic_handler( - "google.cloud.talent.v4beta1.JobService", rpc_method_handlers - ) - server.add_generic_rpc_handlers((generic_handler,)) - - -# This class is part of an EXPERIMENTAL API. -class JobService(object): - """A service handles job management, including job CRUD, enumeration and search. - """ - - @staticmethod - def CreateJob( - request, - target, - options=(), - channel_credentials=None, - call_credentials=None, - compression=None, - wait_for_ready=None, - timeout=None, - metadata=None, - ): - return grpc.experimental.unary_unary( - request, - target, - "/google.cloud.talent.v4beta1.JobService/CreateJob", - google_dot_cloud_dot_talent__v4beta1_dot_proto_dot_job__service__pb2.CreateJobRequest.SerializeToString, - google_dot_cloud_dot_talent__v4beta1_dot_proto_dot_job__pb2.Job.FromString, - options, - channel_credentials, - call_credentials, - compression, - wait_for_ready, - timeout, - metadata, - ) - - @staticmethod - def BatchCreateJobs( - request, - target, - options=(), - channel_credentials=None, - call_credentials=None, - compression=None, - wait_for_ready=None, - timeout=None, - metadata=None, - ): - return grpc.experimental.unary_unary( - request, - target, - "/google.cloud.talent.v4beta1.JobService/BatchCreateJobs", - google_dot_cloud_dot_talent__v4beta1_dot_proto_dot_job__service__pb2.BatchCreateJobsRequest.SerializeToString, - google_dot_longrunning_dot_operations__pb2.Operation.FromString, - options, - channel_credentials, - call_credentials, - compression, - wait_for_ready, - timeout, - metadata, - ) - - @staticmethod - def GetJob( - request, - target, - options=(), - channel_credentials=None, - call_credentials=None, - compression=None, - wait_for_ready=None, - timeout=None, - metadata=None, - ): - return grpc.experimental.unary_unary( - request, - target, - "/google.cloud.talent.v4beta1.JobService/GetJob", - google_dot_cloud_dot_talent__v4beta1_dot_proto_dot_job__service__pb2.GetJobRequest.SerializeToString, - google_dot_cloud_dot_talent__v4beta1_dot_proto_dot_job__pb2.Job.FromString, - options, - channel_credentials, - call_credentials, - compression, - wait_for_ready, - timeout, - metadata, - ) - - @staticmethod - def UpdateJob( - request, - target, - options=(), - channel_credentials=None, - call_credentials=None, - compression=None, - wait_for_ready=None, - timeout=None, - metadata=None, - ): - return grpc.experimental.unary_unary( - request, - target, - "/google.cloud.talent.v4beta1.JobService/UpdateJob", - google_dot_cloud_dot_talent__v4beta1_dot_proto_dot_job__service__pb2.UpdateJobRequest.SerializeToString, - google_dot_cloud_dot_talent__v4beta1_dot_proto_dot_job__pb2.Job.FromString, - options, - channel_credentials, - call_credentials, - compression, - wait_for_ready, - timeout, - metadata, - ) - - @staticmethod - def BatchUpdateJobs( - request, - target, - options=(), - channel_credentials=None, - call_credentials=None, - compression=None, - wait_for_ready=None, - timeout=None, - metadata=None, - ): - return grpc.experimental.unary_unary( - request, - target, - "/google.cloud.talent.v4beta1.JobService/BatchUpdateJobs", - google_dot_cloud_dot_talent__v4beta1_dot_proto_dot_job__service__pb2.BatchUpdateJobsRequest.SerializeToString, - google_dot_longrunning_dot_operations__pb2.Operation.FromString, - options, - channel_credentials, - call_credentials, - compression, - wait_for_ready, - timeout, - metadata, - ) - - @staticmethod - def DeleteJob( - request, - target, - options=(), - channel_credentials=None, - call_credentials=None, - compression=None, - wait_for_ready=None, - timeout=None, - metadata=None, - ): - return grpc.experimental.unary_unary( - request, - target, - "/google.cloud.talent.v4beta1.JobService/DeleteJob", - google_dot_cloud_dot_talent__v4beta1_dot_proto_dot_job__service__pb2.DeleteJobRequest.SerializeToString, - google_dot_protobuf_dot_empty__pb2.Empty.FromString, - options, - channel_credentials, - call_credentials, - compression, - wait_for_ready, - timeout, - metadata, - ) - - @staticmethod - def BatchDeleteJobs( - request, - target, - options=(), - channel_credentials=None, - call_credentials=None, - compression=None, - wait_for_ready=None, - timeout=None, - metadata=None, - ): - return grpc.experimental.unary_unary( - request, - target, - "/google.cloud.talent.v4beta1.JobService/BatchDeleteJobs", - google_dot_cloud_dot_talent__v4beta1_dot_proto_dot_job__service__pb2.BatchDeleteJobsRequest.SerializeToString, - google_dot_protobuf_dot_empty__pb2.Empty.FromString, - options, - channel_credentials, - call_credentials, - compression, - wait_for_ready, - timeout, - metadata, - ) - - @staticmethod - def ListJobs( - request, - target, - options=(), - channel_credentials=None, - call_credentials=None, - compression=None, - wait_for_ready=None, - timeout=None, - metadata=None, - ): - return grpc.experimental.unary_unary( - request, - target, - "/google.cloud.talent.v4beta1.JobService/ListJobs", - google_dot_cloud_dot_talent__v4beta1_dot_proto_dot_job__service__pb2.ListJobsRequest.SerializeToString, - google_dot_cloud_dot_talent__v4beta1_dot_proto_dot_job__service__pb2.ListJobsResponse.FromString, - options, - channel_credentials, - call_credentials, - compression, - wait_for_ready, - timeout, - metadata, - ) - - @staticmethod - def SearchJobs( - request, - target, - options=(), - channel_credentials=None, - call_credentials=None, - compression=None, - wait_for_ready=None, - timeout=None, - metadata=None, - ): - return grpc.experimental.unary_unary( - request, - target, - "/google.cloud.talent.v4beta1.JobService/SearchJobs", - google_dot_cloud_dot_talent__v4beta1_dot_proto_dot_job__service__pb2.SearchJobsRequest.SerializeToString, - google_dot_cloud_dot_talent__v4beta1_dot_proto_dot_job__service__pb2.SearchJobsResponse.FromString, - options, - channel_credentials, - call_credentials, - compression, - wait_for_ready, - timeout, - metadata, - ) - - @staticmethod - def SearchJobsForAlert( - request, - target, - options=(), - channel_credentials=None, - call_credentials=None, - compression=None, - wait_for_ready=None, - timeout=None, - metadata=None, - ): - return grpc.experimental.unary_unary( - request, - target, - "/google.cloud.talent.v4beta1.JobService/SearchJobsForAlert", - google_dot_cloud_dot_talent__v4beta1_dot_proto_dot_job__service__pb2.SearchJobsRequest.SerializeToString, - google_dot_cloud_dot_talent__v4beta1_dot_proto_dot_job__service__pb2.SearchJobsResponse.FromString, - options, - channel_credentials, - call_credentials, - compression, - wait_for_ready, - timeout, - metadata, - ) diff --git a/google/cloud/talent_v4beta1/proto/profile_pb2.py b/google/cloud/talent_v4beta1/proto/profile_pb2.py deleted file mode 100644 index f621c949..00000000 --- a/google/cloud/talent_v4beta1/proto/profile_pb2.py +++ /dev/null @@ -1,3747 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by the protocol buffer compiler. DO NOT EDIT! -# source: google/cloud/talent_v4beta1/proto/profile.proto -"""Generated protocol buffer code.""" -from google.protobuf import descriptor as _descriptor -from google.protobuf import message as _message -from google.protobuf import reflection as _reflection -from google.protobuf import symbol_database as _symbol_database - -# @@protoc_insertion_point(imports) - -_sym_db = _symbol_database.Default() - - -from google.api import field_behavior_pb2 as google_dot_api_dot_field__behavior__pb2 -from google.api import resource_pb2 as google_dot_api_dot_resource__pb2 -from google.cloud.talent_v4beta1.proto import ( - common_pb2 as google_dot_cloud_dot_talent__v4beta1_dot_proto_dot_common__pb2, -) -from google.protobuf import duration_pb2 as google_dot_protobuf_dot_duration__pb2 -from google.protobuf import timestamp_pb2 as google_dot_protobuf_dot_timestamp__pb2 -from google.protobuf import wrappers_pb2 as google_dot_protobuf_dot_wrappers__pb2 -from google.type import date_pb2 as google_dot_type_dot_date__pb2 -from google.type import postal_address_pb2 as google_dot_type_dot_postal__address__pb2 -from google.api import annotations_pb2 as google_dot_api_dot_annotations__pb2 - - -DESCRIPTOR = _descriptor.FileDescriptor( - name="google/cloud/talent_v4beta1/proto/profile.proto", - package="google.cloud.talent.v4beta1", - syntax="proto3", - serialized_options=b"\n\037com.google.cloud.talent.v4beta1B\024ProfileResourceProtoP\001ZAgoogle.golang.org/genproto/googleapis/cloud/talent/v4beta1;talent\242\002\003CTS", - create_key=_descriptor._internal_create_key, - serialized_pb=b'\n/google/cloud/talent_v4beta1/proto/profile.proto\x12\x1bgoogle.cloud.talent.v4beta1\x1a\x1fgoogle/api/field_behavior.proto\x1a\x19google/api/resource.proto\x1a.google/cloud/talent_v4beta1/proto/common.proto\x1a\x1egoogle/protobuf/duration.proto\x1a\x1fgoogle/protobuf/timestamp.proto\x1a\x1egoogle/protobuf/wrappers.proto\x1a\x16google/type/date.proto\x1a google/type/postal_address.proto\x1a\x1cgoogle/api/annotations.proto"\xf6\r\n\x07Profile\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\x13\n\x0b\x65xternal_id\x18\x02 \x01(\t\x12\x0e\n\x06source\x18\x03 \x01(\t\x12\x0b\n\x03uri\x18\x04 \x01(\t\x12\x10\n\x08group_id\x18\x05 \x01(\t\x12.\n\nis_hirable\x18\x06 \x01(\x0b\x32\x1a.google.protobuf.BoolValue\x12/\n\x0b\x63reate_time\x18\x07 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12/\n\x0bupdate_time\x18\x08 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12\x39\n\x15\x63\x61ndidate_update_time\x18\x43 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12\x36\n\x12resume_update_time\x18\x44 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12\x33\n\x06resume\x18\x35 \x01(\x0b\x32#.google.cloud.talent.v4beta1.Resume\x12=\n\x0cperson_names\x18\x0b \x03(\x0b\x32\'.google.cloud.talent.v4beta1.PersonName\x12\x37\n\taddresses\x18\x0c \x03(\x0b\x32$.google.cloud.talent.v4beta1.Address\x12;\n\x0f\x65mail_addresses\x18\r \x03(\x0b\x32".google.cloud.talent.v4beta1.Email\x12\x39\n\rphone_numbers\x18\x0e \x03(\x0b\x32".google.cloud.talent.v4beta1.Phone\x12?\n\rpersonal_uris\x18\x0f \x03(\x0b\x32(.google.cloud.talent.v4beta1.PersonalUri\x12S\n\x17\x61\x64\x64itional_contact_info\x18\x10 \x03(\x0b\x32\x32.google.cloud.talent.v4beta1.AdditionalContactInfo\x12I\n\x12\x65mployment_records\x18\x11 \x03(\x0b\x32-.google.cloud.talent.v4beta1.EmploymentRecord\x12G\n\x11\x65\x64ucation_records\x18\x12 \x03(\x0b\x32,.google.cloud.talent.v4beta1.EducationRecord\x12\x32\n\x06skills\x18\x13 \x03(\x0b\x32".google.cloud.talent.v4beta1.Skill\x12\x39\n\nactivities\x18\x14 \x03(\x0b\x32%.google.cloud.talent.v4beta1.Activity\x12>\n\x0cpublications\x18\x15 \x03(\x0b\x32(.google.cloud.talent.v4beta1.Publication\x12\x34\n\x07patents\x18\x16 \x03(\x0b\x32#.google.cloud.talent.v4beta1.Patent\x12\x42\n\x0e\x63\x65rtifications\x18\x17 \x03(\x0b\x32*.google.cloud.talent.v4beta1.Certification\x12\x19\n\x0c\x61pplications\x18/ \x03(\tB\x03\xe0\x41\x03\x12\x18\n\x0b\x61ssignments\x18\x30 \x03(\tB\x03\xe0\x41\x03\x12U\n\x11\x63ustom_attributes\x18\x1a \x03(\x0b\x32:.google.cloud.talent.v4beta1.Profile.CustomAttributesEntry\x12\x16\n\tprocessed\x18\x1b \x01(\x08\x42\x03\xe0\x41\x03\x12\x1c\n\x0fkeyword_snippet\x18\x1c \x01(\tB\x03\xe0\x41\x03\x12R\n\x14\x61vailability_signals\x18\x46 \x03(\x0b\x32/.google.cloud.talent.v4beta1.AvailabilitySignalB\x03\xe0\x41\x03\x12\x45\n\x11\x64\x65rived_addresses\x18@ \x03(\x0b\x32%.google.cloud.talent.v4beta1.LocationB\x03\xe0\x41\x03\x1a\x65\n\x15\x43ustomAttributesEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12;\n\x05value\x18\x02 \x01(\x0b\x32,.google.cloud.talent.v4beta1.CustomAttribute:\x02\x38\x01:X\xea\x41U\n\x1bjobs.googleapis.com/Profile\x12\x36projects/{project}/tenants/{tenant}/profiles/{profile}"\xc3\x01\n\x12\x41vailabilitySignal\x12\x41\n\x04type\x18\x01 \x01(\x0e\x32\x33.google.cloud.talent.v4beta1.AvailabilitySignalType\x12\x34\n\x10last_update_time\x18\x02 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12\x34\n\x10\x66ilter_satisfied\x18\x03 \x01(\x0b\x32\x1a.google.protobuf.BoolValue"\xb5\x01\n\x06Resume\x12\x19\n\x11structured_resume\x18\x01 \x01(\t\x12\x43\n\x0bresume_type\x18\x02 \x01(\x0e\x32..google.cloud.talent.v4beta1.Resume.ResumeType"K\n\nResumeType\x12\x1b\n\x17RESUME_TYPE_UNSPECIFIED\x10\x00\x12\t\n\x05HRXML\x10\x01\x12\x15\n\x11OTHER_RESUME_TYPE\x10\x02"\xbc\x02\n\nPersonName\x12\x18\n\x0e\x66ormatted_name\x18\x01 \x01(\tH\x00\x12W\n\x0fstructured_name\x18\x02 \x01(\x0b\x32<.google.cloud.talent.v4beta1.PersonName.PersonStructuredNameH\x00\x12\x16\n\x0epreferred_name\x18\x03 \x01(\t\x1a\x93\x01\n\x14PersonStructuredName\x12\x12\n\ngiven_name\x18\x01 \x01(\t\x12\x16\n\x0epreferred_name\x18\x06 \x01(\t\x12\x16\n\x0emiddle_initial\x18\x02 \x01(\t\x12\x13\n\x0b\x66\x61mily_name\x18\x03 \x01(\t\x12\x10\n\x08suffixes\x18\x04 \x03(\t\x12\x10\n\x08prefixes\x18\x05 \x03(\tB\r\n\x0bperson_name"\xd9\x01\n\x07\x41\x64\x64ress\x12<\n\x05usage\x18\x01 \x01(\x0e\x32-.google.cloud.talent.v4beta1.ContactInfoUsage\x12\x1e\n\x14unstructured_address\x18\x02 \x01(\tH\x00\x12\x38\n\x12structured_address\x18\x03 \x01(\x0b\x32\x1a.google.type.PostalAddressH\x00\x12+\n\x07\x63urrent\x18\x04 \x01(\x0b\x32\x1a.google.protobuf.BoolValueB\t\n\x07\x61\x64\x64ress"\\\n\x05\x45mail\x12<\n\x05usage\x18\x01 \x01(\x0e\x32-.google.cloud.talent.v4beta1.ContactInfoUsage\x12\x15\n\remail_address\x18\x02 \x01(\t"\xcf\x02\n\x05Phone\x12<\n\x05usage\x18\x01 \x01(\x0e\x32-.google.cloud.talent.v4beta1.ContactInfoUsage\x12:\n\x04type\x18\x02 \x01(\x0e\x32,.google.cloud.talent.v4beta1.Phone.PhoneType\x12\x0e\n\x06number\x18\x03 \x01(\t\x12\x16\n\x0ewhen_available\x18\x04 \x01(\t"\xa3\x01\n\tPhoneType\x12\x1a\n\x16PHONE_TYPE_UNSPECIFIED\x10\x00\x12\x0c\n\x08LANDLINE\x10\x01\x12\n\n\x06MOBILE\x10\x02\x12\x07\n\x03\x46\x41X\x10\x03\x12\t\n\x05PAGER\x10\x04\x12\x0e\n\nTTY_OR_TDD\x10\x05\x12\r\n\tVOICEMAIL\x10\x06\x12\x0b\n\x07VIRTUAL\x10\x07\x12\x08\n\x04VOIP\x10\x08\x12\x16\n\x12MOBILE_OR_LANDLINE\x10\t"\x1a\n\x0bPersonalUri\x12\x0b\n\x03uri\x18\x01 \x01(\t"w\n\x15\x41\x64\x64itionalContactInfo\x12<\n\x05usage\x18\x01 \x01(\x0e\x32-.google.cloud.talent.v4beta1.ContactInfoUsage\x12\x0c\n\x04name\x18\x02 \x01(\t\x12\x12\n\ncontact_id\x18\x03 \x01(\t"\xf2\x03\n\x10\x45mploymentRecord\x12%\n\nstart_date\x18\x01 \x01(\x0b\x32\x11.google.type.Date\x12#\n\x08\x65nd_date\x18\x02 \x01(\x0b\x32\x11.google.type.Date\x12\x15\n\remployer_name\x18\x03 \x01(\t\x12\x15\n\rdivision_name\x18\x04 \x01(\t\x12\x35\n\x07\x61\x64\x64ress\x18\x05 \x01(\x0b\x32$.google.cloud.talent.v4beta1.Address\x12\x11\n\tjob_title\x18\x06 \x01(\t\x12\x17\n\x0fjob_description\x18\x07 \x01(\t\x12\x31\n\ris_supervisor\x18\x08 \x01(\x0b\x32\x1a.google.protobuf.BoolValue\x12\x34\n\x10is_self_employed\x18\t \x01(\x0b\x32\x1a.google.protobuf.BoolValue\x12.\n\nis_current\x18\n \x01(\x0b\x32\x1a.google.protobuf.BoolValue\x12\x1e\n\x11job_title_snippet\x18\x0b \x01(\tB\x03\xe0\x41\x03\x12$\n\x17job_description_snippet\x18\x0c \x01(\tB\x03\xe0\x41\x03\x12"\n\x15\x65mployer_name_snippet\x18\r \x01(\tB\x03\xe0\x41\x03"\xcc\x03\n\x0f\x45\x64ucationRecord\x12%\n\nstart_date\x18\x01 \x01(\x0b\x32\x11.google.type.Date\x12#\n\x08\x65nd_date\x18\x02 \x01(\x0b\x32\x11.google.type.Date\x12\x33\n\x18\x65xpected_graduation_date\x18\x03 \x01(\x0b\x32\x11.google.type.Date\x12\x13\n\x0bschool_name\x18\x04 \x01(\t\x12\x35\n\x07\x61\x64\x64ress\x18\x05 \x01(\x0b\x32$.google.cloud.talent.v4beta1.Address\x12\x1c\n\x12\x64\x65gree_description\x18\x06 \x01(\tH\x00\x12@\n\x11structured_degree\x18\x07 \x01(\x0b\x32#.google.cloud.talent.v4beta1.DegreeH\x00\x12\x13\n\x0b\x64\x65scription\x18\x08 \x01(\t\x12.\n\nis_current\x18\t \x01(\x0b\x32\x1a.google.protobuf.BoolValue\x12 \n\x13school_name_snippet\x18\n \x01(\tB\x03\xe0\x41\x03\x12\x1b\n\x0e\x64\x65gree_snippet\x18\x0b \x01(\tB\x03\xe0\x41\x03\x42\x08\n\x06\x64\x65gree"t\n\x06\x44\x65gree\x12<\n\x0b\x64\x65gree_type\x18\x01 \x01(\x0e\x32\'.google.cloud.talent.v4beta1.DegreeType\x12\x13\n\x0b\x64\x65gree_name\x18\x02 \x01(\t\x12\x17\n\x0f\x66ields_of_study\x18\x03 \x03(\t"\xd2\x02\n\x08\x41\x63tivity\x12\x14\n\x0c\x64isplay_name\x18\x01 \x01(\t\x12\x13\n\x0b\x64\x65scription\x18\x02 \x01(\t\x12\x0b\n\x03uri\x18\x03 \x01(\t\x12&\n\x0b\x63reate_date\x18\x04 \x01(\x0b\x32\x11.google.type.Date\x12&\n\x0bupdate_date\x18\x05 \x01(\x0b\x32\x11.google.type.Date\x12\x14\n\x0cteam_members\x18\x06 \x03(\t\x12\x37\n\x0bskills_used\x18\x07 \x03(\x0b\x32".google.cloud.talent.v4beta1.Skill\x12"\n\x15\x61\x63tivity_name_snippet\x18\x08 \x01(\tB\x03\xe0\x41\x03\x12)\n\x1c\x61\x63tivity_description_snippet\x18\t \x01(\tB\x03\xe0\x41\x03\x12 \n\x13skills_used_snippet\x18\n \x03(\tB\x03\xe0\x41\x03"\xcb\x01\n\x0bPublication\x12\x0f\n\x07\x61uthors\x18\x01 \x03(\t\x12\r\n\x05title\x18\x02 \x01(\t\x12\x13\n\x0b\x64\x65scription\x18\x03 \x01(\t\x12\x0f\n\x07journal\x18\x04 \x01(\t\x12\x0e\n\x06volume\x18\x05 \x01(\t\x12\x11\n\tpublisher\x18\x06 \x01(\t\x12+\n\x10publication_date\x18\x07 \x01(\x0b\x32\x11.google.type.Date\x12\x18\n\x10publication_type\x18\x08 \x01(\t\x12\x0c\n\x04isbn\x18\t \x01(\t"\xa9\x02\n\x06Patent\x12\x14\n\x0c\x64isplay_name\x18\x01 \x01(\t\x12\x11\n\tinventors\x18\x02 \x03(\t\x12\x15\n\rpatent_status\x18\x03 \x01(\t\x12-\n\x12patent_status_date\x18\x04 \x01(\x0b\x32\x11.google.type.Date\x12-\n\x12patent_filing_date\x18\x05 \x01(\x0b\x32\x11.google.type.Date\x12\x15\n\rpatent_office\x18\x06 \x01(\t\x12\x15\n\rpatent_number\x18\x07 \x01(\t\x12\x1a\n\x12patent_description\x18\x08 \x01(\t\x12\x37\n\x0bskills_used\x18\t \x03(\x0b\x32".google.cloud.talent.v4beta1.SkillB\x82\x01\n\x1f\x63om.google.cloud.talent.v4beta1B\x14ProfileResourceProtoP\x01ZAgoogle.golang.org/genproto/googleapis/cloud/talent/v4beta1;talent\xa2\x02\x03\x43TSb\x06proto3', - dependencies=[ - google_dot_api_dot_field__behavior__pb2.DESCRIPTOR, - google_dot_api_dot_resource__pb2.DESCRIPTOR, - google_dot_cloud_dot_talent__v4beta1_dot_proto_dot_common__pb2.DESCRIPTOR, - google_dot_protobuf_dot_duration__pb2.DESCRIPTOR, - google_dot_protobuf_dot_timestamp__pb2.DESCRIPTOR, - google_dot_protobuf_dot_wrappers__pb2.DESCRIPTOR, - google_dot_type_dot_date__pb2.DESCRIPTOR, - google_dot_type_dot_postal__address__pb2.DESCRIPTOR, - google_dot_api_dot_annotations__pb2.DESCRIPTOR, - ], -) - - -_RESUME_RESUMETYPE = _descriptor.EnumDescriptor( - name="ResumeType", - full_name="google.cloud.talent.v4beta1.Resume.ResumeType", - filename=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - values=[ - _descriptor.EnumValueDescriptor( - name="RESUME_TYPE_UNSPECIFIED", - index=0, - number=0, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="HRXML", - index=1, - number=1, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="OTHER_RESUME_TYPE", - index=2, - number=2, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - ], - containing_type=None, - serialized_options=None, - serialized_start=2463, - serialized_end=2538, -) -_sym_db.RegisterEnumDescriptor(_RESUME_RESUMETYPE) - -_PHONE_PHONETYPE = _descriptor.EnumDescriptor( - name="PhoneType", - full_name="google.cloud.talent.v4beta1.Phone.PhoneType", - filename=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - values=[ - _descriptor.EnumValueDescriptor( - name="PHONE_TYPE_UNSPECIFIED", - index=0, - number=0, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="LANDLINE", - index=1, - number=1, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="MOBILE", - index=2, - number=2, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="FAX", - index=3, - number=3, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="PAGER", - index=4, - number=4, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="TTY_OR_TDD", - index=5, - number=5, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="VOICEMAIL", - index=6, - number=6, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="VIRTUAL", - index=7, - number=7, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="VOIP", - index=8, - number=8, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="MOBILE_OR_LANDLINE", - index=9, - number=9, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - ], - containing_type=None, - serialized_options=None, - serialized_start=3346, - serialized_end=3509, -) -_sym_db.RegisterEnumDescriptor(_PHONE_PHONETYPE) - - -_PROFILE_CUSTOMATTRIBUTESENTRY = _descriptor.Descriptor( - name="CustomAttributesEntry", - full_name="google.cloud.talent.v4beta1.Profile.CustomAttributesEntry", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="key", - full_name="google.cloud.talent.v4beta1.Profile.CustomAttributesEntry.key", - index=0, - number=1, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="value", - full_name="google.cloud.talent.v4beta1.Profile.CustomAttributesEntry.value", - index=1, - number=2, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=b"8\001", - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=1965, - serialized_end=2066, -) - -_PROFILE = _descriptor.Descriptor( - name="Profile", - full_name="google.cloud.talent.v4beta1.Profile", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="name", - full_name="google.cloud.talent.v4beta1.Profile.name", - index=0, - number=1, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="external_id", - full_name="google.cloud.talent.v4beta1.Profile.external_id", - index=1, - number=2, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="source", - full_name="google.cloud.talent.v4beta1.Profile.source", - index=2, - number=3, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="uri", - full_name="google.cloud.talent.v4beta1.Profile.uri", - index=3, - number=4, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="group_id", - full_name="google.cloud.talent.v4beta1.Profile.group_id", - index=4, - number=5, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="is_hirable", - full_name="google.cloud.talent.v4beta1.Profile.is_hirable", - index=5, - number=6, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="create_time", - full_name="google.cloud.talent.v4beta1.Profile.create_time", - index=6, - number=7, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="update_time", - full_name="google.cloud.talent.v4beta1.Profile.update_time", - index=7, - number=8, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="candidate_update_time", - full_name="google.cloud.talent.v4beta1.Profile.candidate_update_time", - index=8, - number=67, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="resume_update_time", - full_name="google.cloud.talent.v4beta1.Profile.resume_update_time", - index=9, - number=68, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="resume", - full_name="google.cloud.talent.v4beta1.Profile.resume", - index=10, - number=53, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="person_names", - full_name="google.cloud.talent.v4beta1.Profile.person_names", - index=11, - number=11, - type=11, - cpp_type=10, - label=3, - has_default_value=False, - default_value=[], - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="addresses", - full_name="google.cloud.talent.v4beta1.Profile.addresses", - index=12, - number=12, - type=11, - cpp_type=10, - label=3, - has_default_value=False, - default_value=[], - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="email_addresses", - full_name="google.cloud.talent.v4beta1.Profile.email_addresses", - index=13, - number=13, - type=11, - cpp_type=10, - label=3, - has_default_value=False, - default_value=[], - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="phone_numbers", - full_name="google.cloud.talent.v4beta1.Profile.phone_numbers", - index=14, - number=14, - type=11, - cpp_type=10, - label=3, - has_default_value=False, - default_value=[], - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="personal_uris", - full_name="google.cloud.talent.v4beta1.Profile.personal_uris", - index=15, - number=15, - type=11, - cpp_type=10, - label=3, - has_default_value=False, - default_value=[], - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="additional_contact_info", - full_name="google.cloud.talent.v4beta1.Profile.additional_contact_info", - index=16, - number=16, - type=11, - cpp_type=10, - label=3, - has_default_value=False, - default_value=[], - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="employment_records", - full_name="google.cloud.talent.v4beta1.Profile.employment_records", - index=17, - number=17, - type=11, - cpp_type=10, - label=3, - has_default_value=False, - default_value=[], - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="education_records", - full_name="google.cloud.talent.v4beta1.Profile.education_records", - index=18, - number=18, - type=11, - cpp_type=10, - label=3, - has_default_value=False, - default_value=[], - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="skills", - full_name="google.cloud.talent.v4beta1.Profile.skills", - index=19, - number=19, - type=11, - cpp_type=10, - label=3, - has_default_value=False, - default_value=[], - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="activities", - full_name="google.cloud.talent.v4beta1.Profile.activities", - index=20, - number=20, - type=11, - cpp_type=10, - label=3, - has_default_value=False, - default_value=[], - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="publications", - full_name="google.cloud.talent.v4beta1.Profile.publications", - index=21, - number=21, - type=11, - cpp_type=10, - label=3, - has_default_value=False, - default_value=[], - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="patents", - full_name="google.cloud.talent.v4beta1.Profile.patents", - index=22, - number=22, - type=11, - cpp_type=10, - label=3, - has_default_value=False, - default_value=[], - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="certifications", - full_name="google.cloud.talent.v4beta1.Profile.certifications", - index=23, - number=23, - type=11, - cpp_type=10, - label=3, - has_default_value=False, - default_value=[], - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="applications", - full_name="google.cloud.talent.v4beta1.Profile.applications", - index=24, - number=47, - type=9, - cpp_type=9, - label=3, - has_default_value=False, - default_value=[], - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\003", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="assignments", - full_name="google.cloud.talent.v4beta1.Profile.assignments", - index=25, - number=48, - type=9, - cpp_type=9, - label=3, - has_default_value=False, - default_value=[], - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\003", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="custom_attributes", - full_name="google.cloud.talent.v4beta1.Profile.custom_attributes", - index=26, - number=26, - type=11, - cpp_type=10, - label=3, - has_default_value=False, - default_value=[], - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="processed", - full_name="google.cloud.talent.v4beta1.Profile.processed", - index=27, - number=27, - type=8, - cpp_type=7, - label=1, - has_default_value=False, - default_value=False, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\003", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="keyword_snippet", - full_name="google.cloud.talent.v4beta1.Profile.keyword_snippet", - index=28, - number=28, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\003", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="availability_signals", - full_name="google.cloud.talent.v4beta1.Profile.availability_signals", - index=29, - number=70, - type=11, - cpp_type=10, - label=3, - has_default_value=False, - default_value=[], - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\003", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="derived_addresses", - full_name="google.cloud.talent.v4beta1.Profile.derived_addresses", - index=30, - number=64, - type=11, - cpp_type=10, - label=3, - has_default_value=False, - default_value=[], - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\003", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[_PROFILE_CUSTOMATTRIBUTESENTRY,], - enum_types=[], - serialized_options=b"\352AU\n\033jobs.googleapis.com/Profile\0226projects/{project}/tenants/{tenant}/profiles/{profile}", - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=374, - serialized_end=2156, -) - - -_AVAILABILITYSIGNAL = _descriptor.Descriptor( - name="AvailabilitySignal", - full_name="google.cloud.talent.v4beta1.AvailabilitySignal", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="type", - full_name="google.cloud.talent.v4beta1.AvailabilitySignal.type", - index=0, - number=1, - type=14, - cpp_type=8, - label=1, - has_default_value=False, - default_value=0, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="last_update_time", - full_name="google.cloud.talent.v4beta1.AvailabilitySignal.last_update_time", - index=1, - number=2, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="filter_satisfied", - full_name="google.cloud.talent.v4beta1.AvailabilitySignal.filter_satisfied", - index=2, - number=3, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=2159, - serialized_end=2354, -) - - -_RESUME = _descriptor.Descriptor( - name="Resume", - full_name="google.cloud.talent.v4beta1.Resume", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="structured_resume", - full_name="google.cloud.talent.v4beta1.Resume.structured_resume", - index=0, - number=1, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="resume_type", - full_name="google.cloud.talent.v4beta1.Resume.resume_type", - index=1, - number=2, - type=14, - cpp_type=8, - label=1, - has_default_value=False, - default_value=0, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[], - enum_types=[_RESUME_RESUMETYPE,], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=2357, - serialized_end=2538, -) - - -_PERSONNAME_PERSONSTRUCTUREDNAME = _descriptor.Descriptor( - name="PersonStructuredName", - full_name="google.cloud.talent.v4beta1.PersonName.PersonStructuredName", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="given_name", - full_name="google.cloud.talent.v4beta1.PersonName.PersonStructuredName.given_name", - index=0, - number=1, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="preferred_name", - full_name="google.cloud.talent.v4beta1.PersonName.PersonStructuredName.preferred_name", - index=1, - number=6, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="middle_initial", - full_name="google.cloud.talent.v4beta1.PersonName.PersonStructuredName.middle_initial", - index=2, - number=2, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="family_name", - full_name="google.cloud.talent.v4beta1.PersonName.PersonStructuredName.family_name", - index=3, - number=3, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="suffixes", - full_name="google.cloud.talent.v4beta1.PersonName.PersonStructuredName.suffixes", - index=4, - number=4, - type=9, - cpp_type=9, - label=3, - has_default_value=False, - default_value=[], - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="prefixes", - full_name="google.cloud.talent.v4beta1.PersonName.PersonStructuredName.prefixes", - index=5, - number=5, - type=9, - cpp_type=9, - label=3, - has_default_value=False, - default_value=[], - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=2695, - serialized_end=2842, -) - -_PERSONNAME = _descriptor.Descriptor( - name="PersonName", - full_name="google.cloud.talent.v4beta1.PersonName", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="formatted_name", - full_name="google.cloud.talent.v4beta1.PersonName.formatted_name", - index=0, - number=1, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="structured_name", - full_name="google.cloud.talent.v4beta1.PersonName.structured_name", - index=1, - number=2, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="preferred_name", - full_name="google.cloud.talent.v4beta1.PersonName.preferred_name", - index=2, - number=3, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[_PERSONNAME_PERSONSTRUCTUREDNAME,], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[ - _descriptor.OneofDescriptor( - name="person_name", - full_name="google.cloud.talent.v4beta1.PersonName.person_name", - index=0, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[], - ), - ], - serialized_start=2541, - serialized_end=2857, -) - - -_ADDRESS = _descriptor.Descriptor( - name="Address", - full_name="google.cloud.talent.v4beta1.Address", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="usage", - full_name="google.cloud.talent.v4beta1.Address.usage", - index=0, - number=1, - type=14, - cpp_type=8, - label=1, - has_default_value=False, - default_value=0, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="unstructured_address", - full_name="google.cloud.talent.v4beta1.Address.unstructured_address", - index=1, - number=2, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="structured_address", - full_name="google.cloud.talent.v4beta1.Address.structured_address", - index=2, - number=3, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="current", - full_name="google.cloud.talent.v4beta1.Address.current", - index=3, - number=4, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[ - _descriptor.OneofDescriptor( - name="address", - full_name="google.cloud.talent.v4beta1.Address.address", - index=0, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[], - ), - ], - serialized_start=2860, - serialized_end=3077, -) - - -_EMAIL = _descriptor.Descriptor( - name="Email", - full_name="google.cloud.talent.v4beta1.Email", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="usage", - full_name="google.cloud.talent.v4beta1.Email.usage", - index=0, - number=1, - type=14, - cpp_type=8, - label=1, - has_default_value=False, - default_value=0, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="email_address", - full_name="google.cloud.talent.v4beta1.Email.email_address", - index=1, - number=2, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=3079, - serialized_end=3171, -) - - -_PHONE = _descriptor.Descriptor( - name="Phone", - full_name="google.cloud.talent.v4beta1.Phone", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="usage", - full_name="google.cloud.talent.v4beta1.Phone.usage", - index=0, - number=1, - type=14, - cpp_type=8, - label=1, - has_default_value=False, - default_value=0, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="type", - full_name="google.cloud.talent.v4beta1.Phone.type", - index=1, - number=2, - type=14, - cpp_type=8, - label=1, - has_default_value=False, - default_value=0, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="number", - full_name="google.cloud.talent.v4beta1.Phone.number", - index=2, - number=3, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="when_available", - full_name="google.cloud.talent.v4beta1.Phone.when_available", - index=3, - number=4, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[], - enum_types=[_PHONE_PHONETYPE,], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=3174, - serialized_end=3509, -) - - -_PERSONALURI = _descriptor.Descriptor( - name="PersonalUri", - full_name="google.cloud.talent.v4beta1.PersonalUri", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="uri", - full_name="google.cloud.talent.v4beta1.PersonalUri.uri", - index=0, - number=1, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=3511, - serialized_end=3537, -) - - -_ADDITIONALCONTACTINFO = _descriptor.Descriptor( - name="AdditionalContactInfo", - full_name="google.cloud.talent.v4beta1.AdditionalContactInfo", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="usage", - full_name="google.cloud.talent.v4beta1.AdditionalContactInfo.usage", - index=0, - number=1, - type=14, - cpp_type=8, - label=1, - has_default_value=False, - default_value=0, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="name", - full_name="google.cloud.talent.v4beta1.AdditionalContactInfo.name", - index=1, - number=2, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="contact_id", - full_name="google.cloud.talent.v4beta1.AdditionalContactInfo.contact_id", - index=2, - number=3, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=3539, - serialized_end=3658, -) - - -_EMPLOYMENTRECORD = _descriptor.Descriptor( - name="EmploymentRecord", - full_name="google.cloud.talent.v4beta1.EmploymentRecord", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="start_date", - full_name="google.cloud.talent.v4beta1.EmploymentRecord.start_date", - index=0, - number=1, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="end_date", - full_name="google.cloud.talent.v4beta1.EmploymentRecord.end_date", - index=1, - number=2, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="employer_name", - full_name="google.cloud.talent.v4beta1.EmploymentRecord.employer_name", - index=2, - number=3, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="division_name", - full_name="google.cloud.talent.v4beta1.EmploymentRecord.division_name", - index=3, - number=4, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="address", - full_name="google.cloud.talent.v4beta1.EmploymentRecord.address", - index=4, - number=5, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="job_title", - full_name="google.cloud.talent.v4beta1.EmploymentRecord.job_title", - index=5, - number=6, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="job_description", - full_name="google.cloud.talent.v4beta1.EmploymentRecord.job_description", - index=6, - number=7, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="is_supervisor", - full_name="google.cloud.talent.v4beta1.EmploymentRecord.is_supervisor", - index=7, - number=8, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="is_self_employed", - full_name="google.cloud.talent.v4beta1.EmploymentRecord.is_self_employed", - index=8, - number=9, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="is_current", - full_name="google.cloud.talent.v4beta1.EmploymentRecord.is_current", - index=9, - number=10, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="job_title_snippet", - full_name="google.cloud.talent.v4beta1.EmploymentRecord.job_title_snippet", - index=10, - number=11, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\003", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="job_description_snippet", - full_name="google.cloud.talent.v4beta1.EmploymentRecord.job_description_snippet", - index=11, - number=12, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\003", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="employer_name_snippet", - full_name="google.cloud.talent.v4beta1.EmploymentRecord.employer_name_snippet", - index=12, - number=13, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\003", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=3661, - serialized_end=4159, -) - - -_EDUCATIONRECORD = _descriptor.Descriptor( - name="EducationRecord", - full_name="google.cloud.talent.v4beta1.EducationRecord", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="start_date", - full_name="google.cloud.talent.v4beta1.EducationRecord.start_date", - index=0, - number=1, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="end_date", - full_name="google.cloud.talent.v4beta1.EducationRecord.end_date", - index=1, - number=2, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="expected_graduation_date", - full_name="google.cloud.talent.v4beta1.EducationRecord.expected_graduation_date", - index=2, - number=3, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="school_name", - full_name="google.cloud.talent.v4beta1.EducationRecord.school_name", - index=3, - number=4, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="address", - full_name="google.cloud.talent.v4beta1.EducationRecord.address", - index=4, - number=5, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="degree_description", - full_name="google.cloud.talent.v4beta1.EducationRecord.degree_description", - index=5, - number=6, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="structured_degree", - full_name="google.cloud.talent.v4beta1.EducationRecord.structured_degree", - index=6, - number=7, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="description", - full_name="google.cloud.talent.v4beta1.EducationRecord.description", - index=7, - number=8, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="is_current", - full_name="google.cloud.talent.v4beta1.EducationRecord.is_current", - index=8, - number=9, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="school_name_snippet", - full_name="google.cloud.talent.v4beta1.EducationRecord.school_name_snippet", - index=9, - number=10, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\003", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="degree_snippet", - full_name="google.cloud.talent.v4beta1.EducationRecord.degree_snippet", - index=10, - number=11, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\003", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[ - _descriptor.OneofDescriptor( - name="degree", - full_name="google.cloud.talent.v4beta1.EducationRecord.degree", - index=0, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[], - ), - ], - serialized_start=4162, - serialized_end=4622, -) - - -_DEGREE = _descriptor.Descriptor( - name="Degree", - full_name="google.cloud.talent.v4beta1.Degree", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="degree_type", - full_name="google.cloud.talent.v4beta1.Degree.degree_type", - index=0, - number=1, - type=14, - cpp_type=8, - label=1, - has_default_value=False, - default_value=0, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="degree_name", - full_name="google.cloud.talent.v4beta1.Degree.degree_name", - index=1, - number=2, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="fields_of_study", - full_name="google.cloud.talent.v4beta1.Degree.fields_of_study", - index=2, - number=3, - type=9, - cpp_type=9, - label=3, - has_default_value=False, - default_value=[], - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=4624, - serialized_end=4740, -) - - -_ACTIVITY = _descriptor.Descriptor( - name="Activity", - full_name="google.cloud.talent.v4beta1.Activity", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="display_name", - full_name="google.cloud.talent.v4beta1.Activity.display_name", - index=0, - number=1, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="description", - full_name="google.cloud.talent.v4beta1.Activity.description", - index=1, - number=2, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="uri", - full_name="google.cloud.talent.v4beta1.Activity.uri", - index=2, - number=3, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="create_date", - full_name="google.cloud.talent.v4beta1.Activity.create_date", - index=3, - number=4, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="update_date", - full_name="google.cloud.talent.v4beta1.Activity.update_date", - index=4, - number=5, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="team_members", - full_name="google.cloud.talent.v4beta1.Activity.team_members", - index=5, - number=6, - type=9, - cpp_type=9, - label=3, - has_default_value=False, - default_value=[], - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="skills_used", - full_name="google.cloud.talent.v4beta1.Activity.skills_used", - index=6, - number=7, - type=11, - cpp_type=10, - label=3, - has_default_value=False, - default_value=[], - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="activity_name_snippet", - full_name="google.cloud.talent.v4beta1.Activity.activity_name_snippet", - index=7, - number=8, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\003", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="activity_description_snippet", - full_name="google.cloud.talent.v4beta1.Activity.activity_description_snippet", - index=8, - number=9, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\003", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="skills_used_snippet", - full_name="google.cloud.talent.v4beta1.Activity.skills_used_snippet", - index=9, - number=10, - type=9, - cpp_type=9, - label=3, - has_default_value=False, - default_value=[], - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\003", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=4743, - serialized_end=5081, -) - - -_PUBLICATION = _descriptor.Descriptor( - name="Publication", - full_name="google.cloud.talent.v4beta1.Publication", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="authors", - full_name="google.cloud.talent.v4beta1.Publication.authors", - index=0, - number=1, - type=9, - cpp_type=9, - label=3, - has_default_value=False, - default_value=[], - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="title", - full_name="google.cloud.talent.v4beta1.Publication.title", - index=1, - number=2, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="description", - full_name="google.cloud.talent.v4beta1.Publication.description", - index=2, - number=3, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="journal", - full_name="google.cloud.talent.v4beta1.Publication.journal", - index=3, - number=4, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="volume", - full_name="google.cloud.talent.v4beta1.Publication.volume", - index=4, - number=5, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="publisher", - full_name="google.cloud.talent.v4beta1.Publication.publisher", - index=5, - number=6, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="publication_date", - full_name="google.cloud.talent.v4beta1.Publication.publication_date", - index=6, - number=7, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="publication_type", - full_name="google.cloud.talent.v4beta1.Publication.publication_type", - index=7, - number=8, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="isbn", - full_name="google.cloud.talent.v4beta1.Publication.isbn", - index=8, - number=9, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=5084, - serialized_end=5287, -) - - -_PATENT = _descriptor.Descriptor( - name="Patent", - full_name="google.cloud.talent.v4beta1.Patent", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="display_name", - full_name="google.cloud.talent.v4beta1.Patent.display_name", - index=0, - number=1, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="inventors", - full_name="google.cloud.talent.v4beta1.Patent.inventors", - index=1, - number=2, - type=9, - cpp_type=9, - label=3, - has_default_value=False, - default_value=[], - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="patent_status", - full_name="google.cloud.talent.v4beta1.Patent.patent_status", - index=2, - number=3, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="patent_status_date", - full_name="google.cloud.talent.v4beta1.Patent.patent_status_date", - index=3, - number=4, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="patent_filing_date", - full_name="google.cloud.talent.v4beta1.Patent.patent_filing_date", - index=4, - number=5, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="patent_office", - full_name="google.cloud.talent.v4beta1.Patent.patent_office", - index=5, - number=6, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="patent_number", - full_name="google.cloud.talent.v4beta1.Patent.patent_number", - index=6, - number=7, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="patent_description", - full_name="google.cloud.talent.v4beta1.Patent.patent_description", - index=7, - number=8, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="skills_used", - full_name="google.cloud.talent.v4beta1.Patent.skills_used", - index=8, - number=9, - type=11, - cpp_type=10, - label=3, - has_default_value=False, - default_value=[], - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=5290, - serialized_end=5587, -) - -_PROFILE_CUSTOMATTRIBUTESENTRY.fields_by_name[ - "value" -].message_type = ( - google_dot_cloud_dot_talent__v4beta1_dot_proto_dot_common__pb2._CUSTOMATTRIBUTE -) -_PROFILE_CUSTOMATTRIBUTESENTRY.containing_type = _PROFILE -_PROFILE.fields_by_name[ - "is_hirable" -].message_type = google_dot_protobuf_dot_wrappers__pb2._BOOLVALUE -_PROFILE.fields_by_name[ - "create_time" -].message_type = google_dot_protobuf_dot_timestamp__pb2._TIMESTAMP -_PROFILE.fields_by_name[ - "update_time" -].message_type = google_dot_protobuf_dot_timestamp__pb2._TIMESTAMP -_PROFILE.fields_by_name[ - "candidate_update_time" -].message_type = google_dot_protobuf_dot_timestamp__pb2._TIMESTAMP -_PROFILE.fields_by_name[ - "resume_update_time" -].message_type = google_dot_protobuf_dot_timestamp__pb2._TIMESTAMP -_PROFILE.fields_by_name["resume"].message_type = _RESUME -_PROFILE.fields_by_name["person_names"].message_type = _PERSONNAME -_PROFILE.fields_by_name["addresses"].message_type = _ADDRESS -_PROFILE.fields_by_name["email_addresses"].message_type = _EMAIL -_PROFILE.fields_by_name["phone_numbers"].message_type = _PHONE -_PROFILE.fields_by_name["personal_uris"].message_type = _PERSONALURI -_PROFILE.fields_by_name["additional_contact_info"].message_type = _ADDITIONALCONTACTINFO -_PROFILE.fields_by_name["employment_records"].message_type = _EMPLOYMENTRECORD -_PROFILE.fields_by_name["education_records"].message_type = _EDUCATIONRECORD -_PROFILE.fields_by_name[ - "skills" -].message_type = google_dot_cloud_dot_talent__v4beta1_dot_proto_dot_common__pb2._SKILL -_PROFILE.fields_by_name["activities"].message_type = _ACTIVITY -_PROFILE.fields_by_name["publications"].message_type = _PUBLICATION -_PROFILE.fields_by_name["patents"].message_type = _PATENT -_PROFILE.fields_by_name[ - "certifications" -].message_type = ( - google_dot_cloud_dot_talent__v4beta1_dot_proto_dot_common__pb2._CERTIFICATION -) -_PROFILE.fields_by_name[ - "custom_attributes" -].message_type = _PROFILE_CUSTOMATTRIBUTESENTRY -_PROFILE.fields_by_name["availability_signals"].message_type = _AVAILABILITYSIGNAL -_PROFILE.fields_by_name[ - "derived_addresses" -].message_type = ( - google_dot_cloud_dot_talent__v4beta1_dot_proto_dot_common__pb2._LOCATION -) -_AVAILABILITYSIGNAL.fields_by_name[ - "type" -].enum_type = ( - google_dot_cloud_dot_talent__v4beta1_dot_proto_dot_common__pb2._AVAILABILITYSIGNALTYPE -) -_AVAILABILITYSIGNAL.fields_by_name[ - "last_update_time" -].message_type = google_dot_protobuf_dot_timestamp__pb2._TIMESTAMP -_AVAILABILITYSIGNAL.fields_by_name[ - "filter_satisfied" -].message_type = google_dot_protobuf_dot_wrappers__pb2._BOOLVALUE -_RESUME.fields_by_name["resume_type"].enum_type = _RESUME_RESUMETYPE -_RESUME_RESUMETYPE.containing_type = _RESUME -_PERSONNAME_PERSONSTRUCTUREDNAME.containing_type = _PERSONNAME -_PERSONNAME.fields_by_name[ - "structured_name" -].message_type = _PERSONNAME_PERSONSTRUCTUREDNAME -_PERSONNAME.oneofs_by_name["person_name"].fields.append( - _PERSONNAME.fields_by_name["formatted_name"] -) -_PERSONNAME.fields_by_name[ - "formatted_name" -].containing_oneof = _PERSONNAME.oneofs_by_name["person_name"] -_PERSONNAME.oneofs_by_name["person_name"].fields.append( - _PERSONNAME.fields_by_name["structured_name"] -) -_PERSONNAME.fields_by_name[ - "structured_name" -].containing_oneof = _PERSONNAME.oneofs_by_name["person_name"] -_ADDRESS.fields_by_name[ - "usage" -].enum_type = ( - google_dot_cloud_dot_talent__v4beta1_dot_proto_dot_common__pb2._CONTACTINFOUSAGE -) -_ADDRESS.fields_by_name[ - "structured_address" -].message_type = google_dot_type_dot_postal__address__pb2._POSTALADDRESS -_ADDRESS.fields_by_name[ - "current" -].message_type = google_dot_protobuf_dot_wrappers__pb2._BOOLVALUE -_ADDRESS.oneofs_by_name["address"].fields.append( - _ADDRESS.fields_by_name["unstructured_address"] -) -_ADDRESS.fields_by_name[ - "unstructured_address" -].containing_oneof = _ADDRESS.oneofs_by_name["address"] -_ADDRESS.oneofs_by_name["address"].fields.append( - _ADDRESS.fields_by_name["structured_address"] -) -_ADDRESS.fields_by_name[ - "structured_address" -].containing_oneof = _ADDRESS.oneofs_by_name["address"] -_EMAIL.fields_by_name[ - "usage" -].enum_type = ( - google_dot_cloud_dot_talent__v4beta1_dot_proto_dot_common__pb2._CONTACTINFOUSAGE -) -_PHONE.fields_by_name[ - "usage" -].enum_type = ( - google_dot_cloud_dot_talent__v4beta1_dot_proto_dot_common__pb2._CONTACTINFOUSAGE -) -_PHONE.fields_by_name["type"].enum_type = _PHONE_PHONETYPE -_PHONE_PHONETYPE.containing_type = _PHONE -_ADDITIONALCONTACTINFO.fields_by_name[ - "usage" -].enum_type = ( - google_dot_cloud_dot_talent__v4beta1_dot_proto_dot_common__pb2._CONTACTINFOUSAGE -) -_EMPLOYMENTRECORD.fields_by_name[ - "start_date" -].message_type = google_dot_type_dot_date__pb2._DATE -_EMPLOYMENTRECORD.fields_by_name[ - "end_date" -].message_type = google_dot_type_dot_date__pb2._DATE -_EMPLOYMENTRECORD.fields_by_name["address"].message_type = _ADDRESS -_EMPLOYMENTRECORD.fields_by_name[ - "is_supervisor" -].message_type = google_dot_protobuf_dot_wrappers__pb2._BOOLVALUE -_EMPLOYMENTRECORD.fields_by_name[ - "is_self_employed" -].message_type = google_dot_protobuf_dot_wrappers__pb2._BOOLVALUE -_EMPLOYMENTRECORD.fields_by_name[ - "is_current" -].message_type = google_dot_protobuf_dot_wrappers__pb2._BOOLVALUE -_EDUCATIONRECORD.fields_by_name[ - "start_date" -].message_type = google_dot_type_dot_date__pb2._DATE -_EDUCATIONRECORD.fields_by_name[ - "end_date" -].message_type = google_dot_type_dot_date__pb2._DATE -_EDUCATIONRECORD.fields_by_name[ - "expected_graduation_date" -].message_type = google_dot_type_dot_date__pb2._DATE -_EDUCATIONRECORD.fields_by_name["address"].message_type = _ADDRESS -_EDUCATIONRECORD.fields_by_name["structured_degree"].message_type = _DEGREE -_EDUCATIONRECORD.fields_by_name[ - "is_current" -].message_type = google_dot_protobuf_dot_wrappers__pb2._BOOLVALUE -_EDUCATIONRECORD.oneofs_by_name["degree"].fields.append( - _EDUCATIONRECORD.fields_by_name["degree_description"] -) -_EDUCATIONRECORD.fields_by_name[ - "degree_description" -].containing_oneof = _EDUCATIONRECORD.oneofs_by_name["degree"] -_EDUCATIONRECORD.oneofs_by_name["degree"].fields.append( - _EDUCATIONRECORD.fields_by_name["structured_degree"] -) -_EDUCATIONRECORD.fields_by_name[ - "structured_degree" -].containing_oneof = _EDUCATIONRECORD.oneofs_by_name["degree"] -_DEGREE.fields_by_name[ - "degree_type" -].enum_type = google_dot_cloud_dot_talent__v4beta1_dot_proto_dot_common__pb2._DEGREETYPE -_ACTIVITY.fields_by_name[ - "create_date" -].message_type = google_dot_type_dot_date__pb2._DATE -_ACTIVITY.fields_by_name[ - "update_date" -].message_type = google_dot_type_dot_date__pb2._DATE -_ACTIVITY.fields_by_name[ - "skills_used" -].message_type = google_dot_cloud_dot_talent__v4beta1_dot_proto_dot_common__pb2._SKILL -_PUBLICATION.fields_by_name[ - "publication_date" -].message_type = google_dot_type_dot_date__pb2._DATE -_PATENT.fields_by_name[ - "patent_status_date" -].message_type = google_dot_type_dot_date__pb2._DATE -_PATENT.fields_by_name[ - "patent_filing_date" -].message_type = google_dot_type_dot_date__pb2._DATE -_PATENT.fields_by_name[ - "skills_used" -].message_type = google_dot_cloud_dot_talent__v4beta1_dot_proto_dot_common__pb2._SKILL -DESCRIPTOR.message_types_by_name["Profile"] = _PROFILE -DESCRIPTOR.message_types_by_name["AvailabilitySignal"] = _AVAILABILITYSIGNAL -DESCRIPTOR.message_types_by_name["Resume"] = _RESUME -DESCRIPTOR.message_types_by_name["PersonName"] = _PERSONNAME -DESCRIPTOR.message_types_by_name["Address"] = _ADDRESS -DESCRIPTOR.message_types_by_name["Email"] = _EMAIL -DESCRIPTOR.message_types_by_name["Phone"] = _PHONE -DESCRIPTOR.message_types_by_name["PersonalUri"] = _PERSONALURI -DESCRIPTOR.message_types_by_name["AdditionalContactInfo"] = _ADDITIONALCONTACTINFO -DESCRIPTOR.message_types_by_name["EmploymentRecord"] = _EMPLOYMENTRECORD -DESCRIPTOR.message_types_by_name["EducationRecord"] = _EDUCATIONRECORD -DESCRIPTOR.message_types_by_name["Degree"] = _DEGREE -DESCRIPTOR.message_types_by_name["Activity"] = _ACTIVITY -DESCRIPTOR.message_types_by_name["Publication"] = _PUBLICATION -DESCRIPTOR.message_types_by_name["Patent"] = _PATENT -_sym_db.RegisterFileDescriptor(DESCRIPTOR) - -Profile = _reflection.GeneratedProtocolMessageType( - "Profile", - (_message.Message,), - { - "CustomAttributesEntry": _reflection.GeneratedProtocolMessageType( - "CustomAttributesEntry", - (_message.Message,), - { - "DESCRIPTOR": _PROFILE_CUSTOMATTRIBUTESENTRY, - "__module__": "google.cloud.talent_v4beta1.proto.profile_pb2" - # @@protoc_insertion_point(class_scope:google.cloud.talent.v4beta1.Profile.CustomAttributesEntry) - }, - ), - "DESCRIPTOR": _PROFILE, - "__module__": "google.cloud.talent_v4beta1.proto.profile_pb2", - "__doc__": """A resource that represents the profile for a job candidate (also - referred to as a “single-source profile”). - - Attributes: - name: - Required during profile update. Resource name assigned to a - profile by the API. The format is “projects/{project_id}/tena - nts/{tenant_id}/profiles/{profile_id}”, for example, - “projects/foo/tenants/bar/profiles/baz”. - external_id: - Profile’s id in client system, if available. This value is - unique for each profile inside a tenant. An error is thrown if - another profile with the same external_id is created. The - maximum number of bytes allowed is 100. - source: - The source description indicating where the profile is - acquired. For example, if a candidate profile is acquired - from a resume, the user can input “resume” here to indicate - the source. The maximum number of bytes allowed is 100. - uri: - The URI set by clients that links to this profile’s client- - side copy. The maximum number of bytes allowed is 4000. - group_id: - The cluster id of the profile to associate with other - profile(s) for the same candidate. This field should be - generated by the customer. If a value is not provided, a - random UUID is assigned to this field of the profile. This is - used to link multiple profiles to the same candidate. For - example, a client has a candidate with two profiles, where one - was created recently and the other one was created 5 years - ago. These two profiles may be very different. The clients can - create the first profile and get a generated - [group_id][google.cloud.talent.v4beta1.Profile.group_id], and - assign it when the second profile is created, indicating these - two profiles are referring to the same candidate. - is_hirable: - Indicates the hirable status of the candidate. - create_time: - The timestamp when the profile was first created at this - source. - update_time: - The timestamp when the profile was last updated at this - source. - candidate_update_time: - The timestamp when the profile was last updated as a result of - a direct or indirect action by a candidate. These actions - include: - Direct actions such as the candidate submitting a - new resume as part of a job application to the agency, - using a self-service tool such as a website to update their - profile, and so on. - Indirect actions by the candidate such - as uploading a resume to a job board that is collected by - the agency through a feed, providing a resume to a - recruiter who then uploads it into the ATS, and so on. - - Updates made to the candidate’s profile by the recruiter as a - result of interacting with the candidate (for example - adding a skill or work preference, and so on). Changes to - [recruiting_notes][google.cloud.talent.v4beta1.Profile.recruit - ing_notes] are specifically excluded from this action type. - Note: [candidate_update_time][google.cloud.talent.v4beta1.Prof - ile.candidate_update_time] must be greater than or equal to [r - esume_update_time][google.cloud.talent.v4beta1.Profile.resume\_ - update_time] or an error is thrown. - resume_update_time: - The timestamp when the candidate’s resume was added or updated - on the candidate’s profile. Whether that resume was directly - uploaded by a candidate, pulled from a 3rd party job board - feed, added by a recruiter, and so on. If this field is - updated, it’s expected that - [resume][google.cloud.talent.v4beta1.Profile.resume] is - provided in the create or update calls. - resume: - The resume representing this profile. - person_names: - The names of the candidate this profile references. Currently - only one person name is supported. - addresses: - The candidate’s postal addresses. It’s highly recommended to - input this information as accurately as possible to help - improve search quality. Here are some recommendations: - - Provide - [Address.usage][google.cloud.talent.v4beta1.Address.usage] if - possible, especially if the address is PERSONAL. During a - search only personal addresses are considered. If there is - no such address, all addresses with unspecified usage are - assumed to be personal. - Provide - [Address.current][google.cloud.talent.v4beta1.Address.current] - for the current address if possible. During a search, only - current addresses are considered. If there is no such - address, all addresses are assumed to be current. When - displaying a candidate’s addresses, it is sometimes desirable - to limit the number of addresses shown. In these cases we - recommend that you display the addresses in the following - order of priority: 1. - [Address.usage][google.cloud.talent.v4beta1.Address.usage] is - PERSONAL and - [Address.current][google.cloud.talent.v4beta1.Address.current] - is true. 2. - [Address.usage][google.cloud.talent.v4beta1.Address.usage] is - PERSONAL and - [Address.current][google.cloud.talent.v4beta1.Address.current] - is false or not set. 3. - [Address.usage][google.cloud.talent.v4beta1.Address.usage] is - CONTACT_INFO_USAGE_UNSPECIFIED and - [Address.current][google.cloud.talent.v4beta1.Address.current] - is true. 4. - [Address.usage][google.cloud.talent.v4beta1.Address.usage] is - CONTACT_INFO_USAGE_UNSPECIFIED and - [Address.current][google.cloud.talent.v4beta1.Address.current] - is false or not set. - email_addresses: - The candidate’s email addresses. - phone_numbers: - The candidate’s phone number(s). - personal_uris: - The candidate’s personal URIs. - additional_contact_info: - Available contact information besides - [addresses][google.cloud.talent.v4beta1.Profile.addresses], [e - mail_addresses][google.cloud.talent.v4beta1.Profile.email_addr - esses], [phone_numbers][google.cloud.talent.v4beta1.Profile.ph - one_numbers] and [personal_uris][google.cloud.talent.v4beta1.P - rofile.personal_uris]. For example, Hang-out, Skype. - employment_records: - The employment history records of the candidate. It’s highly - recommended to input this information as accurately as - possible to help improve search quality. Here are some - recommendations: - Specify the start and end dates of the - employment records. - List different employment types - separately, no matter how minor the change is. For example, - only job title is changed from “software engineer” to - “senior software engineer”. - Provide [EmploymentRecord.is - _current][google.cloud.talent.v4beta1.EmploymentRecord.is_curr - ent] for the current employment if possible. If not, it’s - inferred from user inputs. The limitation for max number - of employment records is 100. - education_records: - The education history record of the candidate. It’s highly - recommended to input this information as accurately as - possible to help improve search quality. Here are some - recommendations: - Specify the start and end dates of the - education records. - List each education type separately, no - matter how minor the change is. For example, the profile - contains the education experience from the same school but - different degrees. - Provide [EducationRecord.is_current][ - google.cloud.talent.v4beta1.EducationRecord.is_current] for - the current education if possible. If not, it’s inferred from - user inputs. The limitation for max number of education - records is 100. - skills: - The skill set of the candidate. It’s highly recommended to - provide as much information as possible to help improve the - search quality. The limitation for max number of skills is - 500. - activities: - The individual or collaborative activities which the candidate - has participated in, for example, open-source projects, class - assignments that aren’t listed in [employment_records][google. - cloud.talent.v4beta1.Profile.employment_records]. The - limitation for max number of activities is 50. - publications: - The publications published by the candidate. The limitation - for max number of publications is 50. - patents: - The patents acquired by the candidate. - certifications: - The certifications acquired by the candidate. - applications: - Output only. The resource names of the candidate’s - applications. - assignments: - Output only. The resource names of the candidate’s - assignments. - custom_attributes: - A map of fields to hold both filterable and non-filterable - custom profile attributes that aren’t covered by the provided - structured fields. See - [CustomAttribute][google.cloud.talent.v4beta1.CustomAttribute] - for more details. At most 100 filterable and at most 100 - unfilterable keys are supported. If limit is exceeded, an - error is thrown. Custom attributes are ``unfilterable`` by - default. These are filterable when the ``filterable`` flag is - set to ``true``. Numeric custom attributes: each key can only - map to one numeric value, otherwise an error is thrown. Client - can also filter on numeric custom attributes using ‘>’, ‘<’ or - ‘=’ operators. String custom attributes: each key can map up - to 50 string values. For filterable string value, each value - has a byte size of no more than 256B. For unfilterable string - values, the maximum byte size of a single key is 64B. An error - is thrown for any request exceeding the limit. The maximum - total byte size is 10KB. - processed: - Output only. Indicates if a summarized profile was created as - part of the profile creation API call. This flag does not - indicate whether a profile is searchable or not. - keyword_snippet: - Output only. Keyword snippet shows how the search result is - related to a search query. This is only returned in [SearchPro - filesResponse][google.cloud.talent.v4beta1.SearchProfilesRespo - nse]. - availability_signals: - Output only. Candidate’s availability signals. - derived_addresses: - Output only. Derived locations of the profile, resolved from [ - Profile.addresses][google.cloud.talent.v4beta1.Profile.address - es]. [derived_addresses][google.cloud.talent.v4beta1.Profile. - derived_addresses] are exactly matched to [Profile.addresses][ - google.cloud.talent.v4beta1.Profile.addresses] in the same - order. - """, - # @@protoc_insertion_point(class_scope:google.cloud.talent.v4beta1.Profile) - }, -) -_sym_db.RegisterMessage(Profile) -_sym_db.RegisterMessage(Profile.CustomAttributesEntry) - -AvailabilitySignal = _reflection.GeneratedProtocolMessageType( - "AvailabilitySignal", - (_message.Message,), - { - "DESCRIPTOR": _AVAILABILITYSIGNAL, - "__module__": "google.cloud.talent_v4beta1.proto.profile_pb2", - "__doc__": """Candidate availability signal. - - Attributes: - type: - Type of signal. - last_update_time: - Timestamp of when the given availability activity last - happened. - filter_satisfied: - Indicates if the [last_update_time][google.cloud.talent.v4beta - 1.AvailabilitySignal.last_update_time] is within [Availability - Filter.range][google.cloud.talent.v4beta1.AvailabilityFilter.r - ange]. Returned only in a search response when there is an [A - vailabilityFilter][google.cloud.talent.v4beta1.AvailabilityFil - ter] in [ProfileQuery.availability_filters][google.cloud.talen - t.v4beta1.ProfileQuery.availability_filters] where [signal_typ - e][google.cloud.talent.v4beta1.AvailabilityFilter.signal_type] - matches - [type][google.cloud.talent.v4beta1.AvailabilitySignal.type]. - """, - # @@protoc_insertion_point(class_scope:google.cloud.talent.v4beta1.AvailabilitySignal) - }, -) -_sym_db.RegisterMessage(AvailabilitySignal) - -Resume = _reflection.GeneratedProtocolMessageType( - "Resume", - (_message.Message,), - { - "DESCRIPTOR": _RESUME, - "__module__": "google.cloud.talent_v4beta1.proto.profile_pb2", - "__doc__": """Resource that represents a resume. - - Attributes: - structured_resume: - Users can create a profile with only this field field, if - [resume_type][google.cloud.talent.v4beta1.Resume.resume_type] - is - [HRXML][google.cloud.talent.v4beta1.Resume.ResumeType.HRXML]. - For example, the API parses this field and creates a profile - with all structured fields populated. [EmploymentRecord][googl - e.cloud.talent.v4beta1.EmploymentRecord], [EducationRecord][go - ogle.cloud.talent.v4beta1.EducationRecord], and so on. An - error is thrown if this field cannot be parsed. Note that the - use of the functionality offered by this field to extract data - from resumes is an Alpha feature and as such is not covered by - any SLA. - resume_type: - The format of [structured_resume][google.cloud.talent.v4beta1. - Resume.structured_resume]. - """, - # @@protoc_insertion_point(class_scope:google.cloud.talent.v4beta1.Resume) - }, -) -_sym_db.RegisterMessage(Resume) - -PersonName = _reflection.GeneratedProtocolMessageType( - "PersonName", - (_message.Message,), - { - "PersonStructuredName": _reflection.GeneratedProtocolMessageType( - "PersonStructuredName", - (_message.Message,), - { - "DESCRIPTOR": _PERSONNAME_PERSONSTRUCTUREDNAME, - "__module__": "google.cloud.talent_v4beta1.proto.profile_pb2", - "__doc__": """Resource that represents a person’s structured name. - - Attributes: - given_name: - Given/first name. It’s derived from [formatted_name][google.c - loud.talent.v4beta1.PersonName.formatted_name] if not - provided. Number of characters allowed is 100. - preferred_name: - Preferred given/first name or nickname. Number of characters - allowed is 100. - middle_initial: - Middle initial. It’s derived from [formatted_name][google.clo - ud.talent.v4beta1.PersonName.formatted_name] if not provided. - Number of characters allowed is 20. - family_name: - Family/last name. It’s derived from [formatted_name][google.c - loud.talent.v4beta1.PersonName.formatted_name] if not - provided. Number of characters allowed is 100. - suffixes: - Suffixes. Number of characters allowed is 20. - prefixes: - Prefixes. Number of characters allowed is 20. - """, - # @@protoc_insertion_point(class_scope:google.cloud.talent.v4beta1.PersonName.PersonStructuredName) - }, - ), - "DESCRIPTOR": _PERSONNAME, - "__module__": "google.cloud.talent_v4beta1.proto.profile_pb2", - "__doc__": """Resource that represents the name of a person. - - Attributes: - person_name: - The name of a person. It can be one of [formatted_name][google - .cloud.talent.v4beta1.PersonName.formatted_name] or [structure - d_name][google.cloud.talent.v4beta1.PersonName.structured_name - ]. - formatted_name: - A string represents a person’s full name. For example, - “Dr. John Smith”. Number of characters allowed is 100. - structured_name: - A person’s name in a structured way (last name, first name, - suffix, and so on.) - preferred_name: - Preferred name for the person. This field is ignored if [struc - tured_name][google.cloud.talent.v4beta1.PersonName.structured\_ - name] is provided. Number of characters allowed is 100. - """, - # @@protoc_insertion_point(class_scope:google.cloud.talent.v4beta1.PersonName) - }, -) -_sym_db.RegisterMessage(PersonName) -_sym_db.RegisterMessage(PersonName.PersonStructuredName) - -Address = _reflection.GeneratedProtocolMessageType( - "Address", - (_message.Message,), - { - "DESCRIPTOR": _ADDRESS, - "__module__": "google.cloud.talent_v4beta1.proto.profile_pb2", - "__doc__": """Resource that represents a address. - - Attributes: - usage: - The usage of the address. For example, SCHOOL, WORK, PERSONAL. - address: - The address of a person. It can be one of [unstructured_addres - s][google.cloud.talent.v4beta1.Address.unstructured_address] - or [structured_address][google.cloud.talent.v4beta1.Address.st - ructured_address]. - unstructured_address: - Unstructured address. For example, “1600 Amphitheatre Pkwy, - Mountain View, CA 94043”, “Sunnyvale, California”. Number of - characters allowed is 100. - structured_address: - Structured address that contains street address, city, state, - country, and so on. - current: - Indicates if it’s the person’s current address. - """, - # @@protoc_insertion_point(class_scope:google.cloud.talent.v4beta1.Address) - }, -) -_sym_db.RegisterMessage(Address) - -Email = _reflection.GeneratedProtocolMessageType( - "Email", - (_message.Message,), - { - "DESCRIPTOR": _EMAIL, - "__module__": "google.cloud.talent_v4beta1.proto.profile_pb2", - "__doc__": """Resource that represents a person’s email address. - - Attributes: - usage: - The usage of the email address. For example, SCHOOL, WORK, - PERSONAL. - email_address: - Email address. Number of characters allowed is 4,000. - """, - # @@protoc_insertion_point(class_scope:google.cloud.talent.v4beta1.Email) - }, -) -_sym_db.RegisterMessage(Email) - -Phone = _reflection.GeneratedProtocolMessageType( - "Phone", - (_message.Message,), - { - "DESCRIPTOR": _PHONE, - "__module__": "google.cloud.talent_v4beta1.proto.profile_pb2", - "__doc__": """Resource that represents a person’s telephone number. - - Attributes: - usage: - The usage of the phone. For example, SCHOOL, WORK, PERSONAL. - type: - The phone type. For example, LANDLINE, MOBILE, FAX. - number: - Phone number. Any phone formats are supported and only exact - matches are performed on searches. For example, if a phone - number in profile is provided in the format of “(xxx)xxx- - xxxx”, in profile searches the same phone format has to be - provided. Number of characters allowed is 20. - when_available: - When this number is available. Any descriptive string is - expected. Number of characters allowed is 100. - """, - # @@protoc_insertion_point(class_scope:google.cloud.talent.v4beta1.Phone) - }, -) -_sym_db.RegisterMessage(Phone) - -PersonalUri = _reflection.GeneratedProtocolMessageType( - "PersonalUri", - (_message.Message,), - { - "DESCRIPTOR": _PERSONALURI, - "__module__": "google.cloud.talent_v4beta1.proto.profile_pb2", - "__doc__": """Resource that represents a valid URI for a personal use. - - Attributes: - uri: - The personal URI. Number of characters allowed is 4,000. - """, - # @@protoc_insertion_point(class_scope:google.cloud.talent.v4beta1.PersonalUri) - }, -) -_sym_db.RegisterMessage(PersonalUri) - -AdditionalContactInfo = _reflection.GeneratedProtocolMessageType( - "AdditionalContactInfo", - (_message.Message,), - { - "DESCRIPTOR": _ADDITIONALCONTACTINFO, - "__module__": "google.cloud.talent_v4beta1.proto.profile_pb2", - "__doc__": """Resource that represents contact information other than phone, email, - URI and addresses. - - Attributes: - usage: - The usage of this contact method. For example, SCHOOL, WORK, - PERSONAL. - name: - The name of the contact method. For example, “hangout”, - “skype”. Number of characters allowed is 100. - contact_id: - The contact id. Number of characters allowed is 100. - """, - # @@protoc_insertion_point(class_scope:google.cloud.talent.v4beta1.AdditionalContactInfo) - }, -) -_sym_db.RegisterMessage(AdditionalContactInfo) - -EmploymentRecord = _reflection.GeneratedProtocolMessageType( - "EmploymentRecord", - (_message.Message,), - { - "DESCRIPTOR": _EMPLOYMENTRECORD, - "__module__": "google.cloud.talent_v4beta1.proto.profile_pb2", - "__doc__": """Resource that represents an employment record of a candidate. - - Attributes: - start_date: - Start date of the employment. - end_date: - End date of the employment. - employer_name: - The name of the employer company/organization. For example, - “Google”, “Alphabet”, and so on. Number of characters allowed - is 250. - division_name: - The division name of the employment. For example, division, - department, client, and so on. Number of characters allowed - is 100. - address: - The physical address of the employer. - job_title: - The job title of the employment. For example, “Software - Engineer”, “Data Scientist”, and so on. Number of characters - allowed is 250. - job_description: - The description of job content. Number of characters allowed - is 100,000. - is_supervisor: - If the jobs is a supervisor position. - is_self_employed: - If this employment is self-employed. - is_current: - If this employment is current. - job_title_snippet: - Output only. The job title snippet shows how the [job_title][g - oogle.cloud.talent.v4beta1.EmploymentRecord.job_title] is - related to a search query. It’s empty if the [job_title][googl - e.cloud.talent.v4beta1.EmploymentRecord.job_title] isn’t - related to the search query. - job_description_snippet: - Output only. The job description snippet shows how the [job_de - scription][google.cloud.talent.v4beta1.EmploymentRecord.job_de - scription] is related to a search query. It’s empty if the [jo - b_description][google.cloud.talent.v4beta1.EmploymentRecord.jo - b_description] isn’t related to the search query. - employer_name_snippet: - Output only. The employer name snippet shows how the [employer - _name][google.cloud.talent.v4beta1.EmploymentRecord.employer_n - ame] is related to a search query. It’s empty if the [employer - _name][google.cloud.talent.v4beta1.EmploymentRecord.employer_n - ame] isn’t related to the search query. - """, - # @@protoc_insertion_point(class_scope:google.cloud.talent.v4beta1.EmploymentRecord) - }, -) -_sym_db.RegisterMessage(EmploymentRecord) - -EducationRecord = _reflection.GeneratedProtocolMessageType( - "EducationRecord", - (_message.Message,), - { - "DESCRIPTOR": _EDUCATIONRECORD, - "__module__": "google.cloud.talent_v4beta1.proto.profile_pb2", - "__doc__": """Resource that represents an education record of a candidate. - - Attributes: - start_date: - The start date of the education. - end_date: - The end date of the education. - expected_graduation_date: - The expected graduation date if currently pursuing a degree. - school_name: - The name of the school or institution. For example, “Stanford - University”, “UC Berkeley”, and so on. Number of characters - allowed is 250. - address: - The physical address of the education institution. - degree: - The degree information. It can be one of [degree_description][ - google.cloud.talent.v4beta1.EducationRecord.degree_description - ] or [structured_degree][google.cloud.talent.v4beta1.Education - Record.structured_degree]. - degree_description: - The full description of the degree. For example, “Master of - Science in Computer Science”, “B.S in Math”. Number of - characters allowed is 100. - structured_degree: - The structured notation of the degree. - description: - The description of the education. Number of characters - allowed is 100,000. - is_current: - If this education is current. - school_name_snippet: - Output only. The school name snippet shows how the [school_nam - e][google.cloud.talent.v4beta1.EducationRecord.school_name] is - related to a search query in search result. It’s empty if the - [school_name][google.cloud.talent.v4beta1.EducationRecord.scho - ol_name] isn’t related to the search query. - degree_snippet: - Output only. The job description snippet shows how the - [Degree][google.cloud.talent.v4beta1.Degree] is related to a - search query in search result. It’s empty if the - [Degree][google.cloud.talent.v4beta1.Degree] isn’t related to - the search query. - """, - # @@protoc_insertion_point(class_scope:google.cloud.talent.v4beta1.EducationRecord) - }, -) -_sym_db.RegisterMessage(EducationRecord) - -Degree = _reflection.GeneratedProtocolMessageType( - "Degree", - (_message.Message,), - { - "DESCRIPTOR": _DEGREE, - "__module__": "google.cloud.talent_v4beta1.proto.profile_pb2", - "__doc__": """Resource that represents a degree pursuing or acquired by a candidate. - - Attributes: - degree_type: - ISCED degree type. - degree_name: - Full Degree name. For example, “B.S.”, “Master of Arts”, and - so on. Number of characters allowed is 100. - fields_of_study: - Fields of study for the degree. For example, “Computer - science”, “engineering”. Number of characters allowed is 100. - """, - # @@protoc_insertion_point(class_scope:google.cloud.talent.v4beta1.Degree) - }, -) -_sym_db.RegisterMessage(Degree) - -Activity = _reflection.GeneratedProtocolMessageType( - "Activity", - (_message.Message,), - { - "DESCRIPTOR": _ACTIVITY, - "__module__": "google.cloud.talent_v4beta1.proto.profile_pb2", - "__doc__": """Resource that represents an individual or collaborative activity - participated in by a candidate, for example, an open-source project, a - class assignment, and so on. - - Attributes: - display_name: - Activity display name. Number of characters allowed is 100. - description: - Activity description. Number of characters allowed is - 100,000. - uri: - Activity URI. Number of characters allowed is 4,000. - create_date: - The first creation date of the activity. - update_date: - The last update date of the activity. - team_members: - A list of team members involved in this activity. Number of - characters allowed is 100. The limitation for max number of - team members is 50. - skills_used: - A list of skills used in this activity. The limitation for - max number of skills used is 50. - activity_name_snippet: - Output only. Activity name snippet shows how the [display_name - ][google.cloud.talent.v4beta1.Activity.display_name] is - related to a search query. It’s empty if the [display_name][go - ogle.cloud.talent.v4beta1.Activity.display_name] isn’t related - to the search query. - activity_description_snippet: - Output only. Activity description snippet shows how the [descr - iption][google.cloud.talent.v4beta1.Activity.description] is - related to a search query. It’s empty if the [description][goo - gle.cloud.talent.v4beta1.Activity.description] isn’t related - to the search query. - skills_used_snippet: - Output only. Skill used snippet shows how the corresponding [s - kills_used][google.cloud.talent.v4beta1.Activity.skills_used] - are related to a search query. It’s empty if the corresponding - [skills_used][google.cloud.talent.v4beta1.Activity.skills_used - ] are not related to the search query. - """, - # @@protoc_insertion_point(class_scope:google.cloud.talent.v4beta1.Activity) - }, -) -_sym_db.RegisterMessage(Activity) - -Publication = _reflection.GeneratedProtocolMessageType( - "Publication", - (_message.Message,), - { - "DESCRIPTOR": _PUBLICATION, - "__module__": "google.cloud.talent_v4beta1.proto.profile_pb2", - "__doc__": """Resource that represents a publication resource of a candidate. - - Attributes: - authors: - A list of author names. Number of characters allowed is 100. - title: - The title of the publication. Number of characters allowed is - 100. - description: - The description of the publication. Number of characters - allowed is 100,000. - journal: - The journal name of the publication. Number of characters - allowed is 100. - volume: - Volume number. Number of characters allowed is 100. - publisher: - The publisher of the journal. Number of characters allowed is - 100. - publication_date: - The publication date. - publication_type: - The publication type. Number of characters allowed is 100. - isbn: - ISBN number. Number of characters allowed is 100. - """, - # @@protoc_insertion_point(class_scope:google.cloud.talent.v4beta1.Publication) - }, -) -_sym_db.RegisterMessage(Publication) - -Patent = _reflection.GeneratedProtocolMessageType( - "Patent", - (_message.Message,), - { - "DESCRIPTOR": _PATENT, - "__module__": "google.cloud.talent_v4beta1.proto.profile_pb2", - "__doc__": """Resource that represents the patent acquired by a candidate. - - Attributes: - display_name: - Name of the patent. Number of characters allowed is 100. - inventors: - A list of inventors’ names. Number of characters allowed for - each is 100. - patent_status: - The status of the patent. Number of characters allowed is - 100. - patent_status_date: - The date the last time the status of the patent was checked. - patent_filing_date: - The date that the patent was filed. - patent_office: - The name of the patent office. Number of characters allowed - is 100. - patent_number: - The number of the patent. Number of characters allowed is - 100. - patent_description: - The description of the patent. Number of characters allowed - is 100,000. - skills_used: - The skills used in this patent. - """, - # @@protoc_insertion_point(class_scope:google.cloud.talent.v4beta1.Patent) - }, -) -_sym_db.RegisterMessage(Patent) - - -DESCRIPTOR._options = None -_PROFILE_CUSTOMATTRIBUTESENTRY._options = None -_PROFILE.fields_by_name["applications"]._options = None -_PROFILE.fields_by_name["assignments"]._options = None -_PROFILE.fields_by_name["processed"]._options = None -_PROFILE.fields_by_name["keyword_snippet"]._options = None -_PROFILE.fields_by_name["availability_signals"]._options = None -_PROFILE.fields_by_name["derived_addresses"]._options = None -_PROFILE._options = None -_EMPLOYMENTRECORD.fields_by_name["job_title_snippet"]._options = None -_EMPLOYMENTRECORD.fields_by_name["job_description_snippet"]._options = None -_EMPLOYMENTRECORD.fields_by_name["employer_name_snippet"]._options = None -_EDUCATIONRECORD.fields_by_name["school_name_snippet"]._options = None -_EDUCATIONRECORD.fields_by_name["degree_snippet"]._options = None -_ACTIVITY.fields_by_name["activity_name_snippet"]._options = None -_ACTIVITY.fields_by_name["activity_description_snippet"]._options = None -_ACTIVITY.fields_by_name["skills_used_snippet"]._options = None -# @@protoc_insertion_point(module_scope) diff --git a/google/cloud/talent_v4beta1/proto/profile_pb2_grpc.py b/google/cloud/talent_v4beta1/proto/profile_pb2_grpc.py deleted file mode 100644 index 8a939394..00000000 --- a/google/cloud/talent_v4beta1/proto/profile_pb2_grpc.py +++ /dev/null @@ -1,3 +0,0 @@ -# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT! -"""Client and server classes corresponding to protobuf-defined services.""" -import grpc diff --git a/google/cloud/talent_v4beta1/proto/profile_service_pb2.py b/google/cloud/talent_v4beta1/proto/profile_service_pb2.py deleted file mode 100644 index 5bad5a26..00000000 --- a/google/cloud/talent_v4beta1/proto/profile_service_pb2.py +++ /dev/null @@ -1,1469 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by the protocol buffer compiler. DO NOT EDIT! -# source: google/cloud/talent_v4beta1/proto/profile_service.proto -"""Generated protocol buffer code.""" -from google.protobuf import descriptor as _descriptor -from google.protobuf import message as _message -from google.protobuf import reflection as _reflection -from google.protobuf import symbol_database as _symbol_database - -# @@protoc_insertion_point(imports) - -_sym_db = _symbol_database.Default() - - -from google.api import annotations_pb2 as google_dot_api_dot_annotations__pb2 -from google.api import client_pb2 as google_dot_api_dot_client__pb2 -from google.api import field_behavior_pb2 as google_dot_api_dot_field__behavior__pb2 -from google.api import resource_pb2 as google_dot_api_dot_resource__pb2 -from google.cloud.talent_v4beta1.proto import ( - common_pb2 as google_dot_cloud_dot_talent__v4beta1_dot_proto_dot_common__pb2, -) -from google.cloud.talent_v4beta1.proto import ( - filters_pb2 as google_dot_cloud_dot_talent__v4beta1_dot_proto_dot_filters__pb2, -) -from google.cloud.talent_v4beta1.proto import ( - histogram_pb2 as google_dot_cloud_dot_talent__v4beta1_dot_proto_dot_histogram__pb2, -) -from google.cloud.talent_v4beta1.proto import ( - profile_pb2 as google_dot_cloud_dot_talent__v4beta1_dot_proto_dot_profile__pb2, -) -from google.longrunning import ( - operations_pb2 as google_dot_longrunning_dot_operations__pb2, -) -from google.protobuf import any_pb2 as google_dot_protobuf_dot_any__pb2 -from google.protobuf import empty_pb2 as google_dot_protobuf_dot_empty__pb2 -from google.protobuf import field_mask_pb2 as google_dot_protobuf_dot_field__mask__pb2 -from google.rpc import status_pb2 as google_dot_rpc_dot_status__pb2 - - -DESCRIPTOR = _descriptor.FileDescriptor( - name="google/cloud/talent_v4beta1/proto/profile_service.proto", - package="google.cloud.talent.v4beta1", - syntax="proto3", - serialized_options=b"\n\037com.google.cloud.talent.v4beta1B\023ProfileServiceProtoP\001ZAgoogle.golang.org/genproto/googleapis/cloud/talent/v4beta1;talent\242\002\003CTS", - create_key=_descriptor._internal_create_key, - serialized_pb=b'\n7google/cloud/talent_v4beta1/proto/profile_service.proto\x12\x1bgoogle.cloud.talent.v4beta1\x1a\x1cgoogle/api/annotations.proto\x1a\x17google/api/client.proto\x1a\x1fgoogle/api/field_behavior.proto\x1a\x19google/api/resource.proto\x1a.google/cloud/talent_v4beta1/proto/common.proto\x1a/google/cloud/talent_v4beta1/proto/filters.proto\x1a\x31google/cloud/talent_v4beta1/proto/histogram.proto\x1a/google/cloud/talent_v4beta1/proto/profile.proto\x1a#google/longrunning/operations.proto\x1a\x19google/protobuf/any.proto\x1a\x1bgoogle/protobuf/empty.proto\x1a google/protobuf/field_mask.proto\x1a\x17google/rpc/status.proto"\xb0\x01\n\x13ListProfilesRequest\x12\x33\n\x06parent\x18\x01 \x01(\tB#\xe0\x41\x02\xfa\x41\x1d\x12\x1bjobs.googleapis.com/Profile\x12\x0e\n\x06\x66ilter\x18\x05 \x01(\t\x12\x12\n\npage_token\x18\x02 \x01(\t\x12\x11\n\tpage_size\x18\x03 \x01(\x05\x12-\n\tread_mask\x18\x04 \x01(\x0b\x32\x1a.google.protobuf.FieldMask"g\n\x14ListProfilesResponse\x12\x36\n\x08profiles\x18\x01 \x03(\x0b\x32$.google.cloud.talent.v4beta1.Profile\x12\x17\n\x0fnext_page_token\x18\x02 \x01(\t"\x86\x01\n\x14\x43reateProfileRequest\x12\x32\n\x06parent\x18\x01 \x01(\tB"\xe0\x41\x02\xfa\x41\x1c\n\x1ajobs.googleapis.com/Tenant\x12:\n\x07profile\x18\x02 \x01(\x0b\x32$.google.cloud.talent.v4beta1.ProfileB\x03\xe0\x41\x02"F\n\x11GetProfileRequest\x12\x31\n\x04name\x18\x01 \x01(\tB#\xe0\x41\x02\xfa\x41\x1d\n\x1bjobs.googleapis.com/Profile"\x83\x01\n\x14UpdateProfileRequest\x12:\n\x07profile\x18\x01 \x01(\x0b\x32$.google.cloud.talent.v4beta1.ProfileB\x03\xe0\x41\x02\x12/\n\x0bupdate_mask\x18\x02 \x01(\x0b\x32\x1a.google.protobuf.FieldMask"I\n\x14\x44\x65leteProfileRequest\x12\x31\n\x04name\x18\x01 \x01(\tB#\xe0\x41\x02\xfa\x41\x1d\n\x1bjobs.googleapis.com/Profile"\xdc\x03\n\x15SearchProfilesRequest\x12\x32\n\x06parent\x18\x01 \x01(\tB"\xe0\x41\x02\xfa\x41\x1c\n\x1ajobs.googleapis.com/Tenant\x12K\n\x10request_metadata\x18\x02 \x01(\x0b\x32,.google.cloud.talent.v4beta1.RequestMetadataB\x03\xe0\x41\x02\x12@\n\rprofile_query\x18\x03 \x01(\x0b\x32).google.cloud.talent.v4beta1.ProfileQuery\x12\x11\n\tpage_size\x18\x04 \x01(\x05\x12\x12\n\npage_token\x18\x05 \x01(\t\x12\x0e\n\x06offset\x18\x06 \x01(\x05\x12\x1b\n\x13\x64isable_spell_check\x18\x07 \x01(\x08\x12\x10\n\x08order_by\x18\x08 \x01(\t\x12\x1b\n\x13\x63\x61se_sensitive_sort\x18\t \x01(\x08\x12\x46\n\x11histogram_queries\x18\n \x03(\x0b\x32+.google.cloud.talent.v4beta1.HistogramQuery\x12\x15\n\rresult_set_id\x18\x0c \x01(\t\x12\x1e\n\x16strict_keywords_search\x18\r \x01(\x08"\x93\x03\n\x16SearchProfilesResponse\x12\x1c\n\x14\x65stimated_total_size\x18\x01 \x01(\x03\x12I\n\x10spell_correction\x18\x02 \x01(\x0b\x32/.google.cloud.talent.v4beta1.SpellingCorrection\x12?\n\x08metadata\x18\x03 \x01(\x0b\x32-.google.cloud.talent.v4beta1.ResponseMetadata\x12\x17\n\x0fnext_page_token\x18\x04 \x01(\t\x12R\n\x17histogram_query_results\x18\x05 \x03(\x0b\x32\x31.google.cloud.talent.v4beta1.HistogramQueryResult\x12K\n\x13summarized_profiles\x18\x06 \x03(\x0b\x32..google.cloud.talent.v4beta1.SummarizedProfile\x12\x15\n\rresult_set_id\x18\x07 \x01(\t"\x82\x01\n\x11SummarizedProfile\x12\x36\n\x08profiles\x18\x01 \x03(\x0b\x32$.google.cloud.talent.v4beta1.Profile\x12\x35\n\x07summary\x18\x02 \x01(\x0b\x32$.google.cloud.talent.v4beta1.Profile2\x9f\t\n\x0eProfileService\x12\xb5\x01\n\x0cListProfiles\x12\x30.google.cloud.talent.v4beta1.ListProfilesRequest\x1a\x31.google.cloud.talent.v4beta1.ListProfilesResponse"@\x82\xd3\xe4\x93\x02\x31\x12//v4beta1/{parent=projects/*/tenants/*}/profiles\xda\x41\x06parent\x12\xb5\x01\n\rCreateProfile\x12\x31.google.cloud.talent.v4beta1.CreateProfileRequest\x1a$.google.cloud.talent.v4beta1.Profile"K\x82\xd3\xe4\x93\x02\x34"//v4beta1/{parent=projects/*/tenants/*}/profiles:\x01*\xda\x41\x0eparent,profile\x12\xa2\x01\n\nGetProfile\x12..google.cloud.talent.v4beta1.GetProfileRequest\x1a$.google.cloud.talent.v4beta1.Profile">\x82\xd3\xe4\x93\x02\x31\x12//v4beta1/{name=projects/*/tenants/*/profiles/*}\xda\x41\x04name\x12\xb6\x01\n\rUpdateProfile\x12\x31.google.cloud.talent.v4beta1.UpdateProfileRequest\x1a$.google.cloud.talent.v4beta1.Profile"L\x82\xd3\xe4\x93\x02<27/v4beta1/{profile.name=projects/*/tenants/*/profiles/*}:\x01*\xda\x41\x07profile\x12\x9a\x01\n\rDeleteProfile\x12\x31.google.cloud.talent.v4beta1.DeleteProfileRequest\x1a\x16.google.protobuf.Empty">\x82\xd3\xe4\x93\x02\x31*//v4beta1/{name=projects/*/tenants/*/profiles/*}\xda\x41\x04name\x12\xb3\x01\n\x0eSearchProfiles\x12\x32.google.cloud.talent.v4beta1.SearchProfilesRequest\x1a\x33.google.cloud.talent.v4beta1.SearchProfilesResponse"8\x82\xd3\xe4\x93\x02\x32"-/v4beta1/{parent=projects/*/tenants/*}:search:\x01*\x1al\xca\x41\x13jobs.googleapis.com\xd2\x41Shttps://www.googleapis.com/auth/cloud-platform,https://www.googleapis.com/auth/jobsB\x81\x01\n\x1f\x63om.google.cloud.talent.v4beta1B\x13ProfileServiceProtoP\x01ZAgoogle.golang.org/genproto/googleapis/cloud/talent/v4beta1;talent\xa2\x02\x03\x43TSb\x06proto3', - dependencies=[ - google_dot_api_dot_annotations__pb2.DESCRIPTOR, - google_dot_api_dot_client__pb2.DESCRIPTOR, - google_dot_api_dot_field__behavior__pb2.DESCRIPTOR, - google_dot_api_dot_resource__pb2.DESCRIPTOR, - google_dot_cloud_dot_talent__v4beta1_dot_proto_dot_common__pb2.DESCRIPTOR, - google_dot_cloud_dot_talent__v4beta1_dot_proto_dot_filters__pb2.DESCRIPTOR, - google_dot_cloud_dot_talent__v4beta1_dot_proto_dot_histogram__pb2.DESCRIPTOR, - google_dot_cloud_dot_talent__v4beta1_dot_proto_dot_profile__pb2.DESCRIPTOR, - google_dot_longrunning_dot_operations__pb2.DESCRIPTOR, - google_dot_protobuf_dot_any__pb2.DESCRIPTOR, - google_dot_protobuf_dot_empty__pb2.DESCRIPTOR, - google_dot_protobuf_dot_field__mask__pb2.DESCRIPTOR, - google_dot_rpc_dot_status__pb2.DESCRIPTOR, - ], -) - - -_LISTPROFILESREQUEST = _descriptor.Descriptor( - name="ListProfilesRequest", - full_name="google.cloud.talent.v4beta1.ListProfilesRequest", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="parent", - full_name="google.cloud.talent.v4beta1.ListProfilesRequest.parent", - index=0, - number=1, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\002\372A\035\022\033jobs.googleapis.com/Profile", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="filter", - full_name="google.cloud.talent.v4beta1.ListProfilesRequest.filter", - index=1, - number=5, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="page_token", - full_name="google.cloud.talent.v4beta1.ListProfilesRequest.page_token", - index=2, - number=2, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="page_size", - full_name="google.cloud.talent.v4beta1.ListProfilesRequest.page_size", - index=3, - number=3, - type=5, - cpp_type=1, - label=1, - has_default_value=False, - default_value=0, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="read_mask", - full_name="google.cloud.talent.v4beta1.ListProfilesRequest.read_mask", - index=4, - number=4, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=553, - serialized_end=729, -) - - -_LISTPROFILESRESPONSE = _descriptor.Descriptor( - name="ListProfilesResponse", - full_name="google.cloud.talent.v4beta1.ListProfilesResponse", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="profiles", - full_name="google.cloud.talent.v4beta1.ListProfilesResponse.profiles", - index=0, - number=1, - type=11, - cpp_type=10, - label=3, - has_default_value=False, - default_value=[], - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="next_page_token", - full_name="google.cloud.talent.v4beta1.ListProfilesResponse.next_page_token", - index=1, - number=2, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=731, - serialized_end=834, -) - - -_CREATEPROFILEREQUEST = _descriptor.Descriptor( - name="CreateProfileRequest", - full_name="google.cloud.talent.v4beta1.CreateProfileRequest", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="parent", - full_name="google.cloud.talent.v4beta1.CreateProfileRequest.parent", - index=0, - number=1, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\002\372A\034\n\032jobs.googleapis.com/Tenant", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="profile", - full_name="google.cloud.talent.v4beta1.CreateProfileRequest.profile", - index=1, - number=2, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\002", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=837, - serialized_end=971, -) - - -_GETPROFILEREQUEST = _descriptor.Descriptor( - name="GetProfileRequest", - full_name="google.cloud.talent.v4beta1.GetProfileRequest", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="name", - full_name="google.cloud.talent.v4beta1.GetProfileRequest.name", - index=0, - number=1, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\002\372A\035\n\033jobs.googleapis.com/Profile", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=973, - serialized_end=1043, -) - - -_UPDATEPROFILEREQUEST = _descriptor.Descriptor( - name="UpdateProfileRequest", - full_name="google.cloud.talent.v4beta1.UpdateProfileRequest", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="profile", - full_name="google.cloud.talent.v4beta1.UpdateProfileRequest.profile", - index=0, - number=1, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\002", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="update_mask", - full_name="google.cloud.talent.v4beta1.UpdateProfileRequest.update_mask", - index=1, - number=2, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=1046, - serialized_end=1177, -) - - -_DELETEPROFILEREQUEST = _descriptor.Descriptor( - name="DeleteProfileRequest", - full_name="google.cloud.talent.v4beta1.DeleteProfileRequest", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="name", - full_name="google.cloud.talent.v4beta1.DeleteProfileRequest.name", - index=0, - number=1, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\002\372A\035\n\033jobs.googleapis.com/Profile", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=1179, - serialized_end=1252, -) - - -_SEARCHPROFILESREQUEST = _descriptor.Descriptor( - name="SearchProfilesRequest", - full_name="google.cloud.talent.v4beta1.SearchProfilesRequest", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="parent", - full_name="google.cloud.talent.v4beta1.SearchProfilesRequest.parent", - index=0, - number=1, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\002\372A\034\n\032jobs.googleapis.com/Tenant", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="request_metadata", - full_name="google.cloud.talent.v4beta1.SearchProfilesRequest.request_metadata", - index=1, - number=2, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\002", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="profile_query", - full_name="google.cloud.talent.v4beta1.SearchProfilesRequest.profile_query", - index=2, - number=3, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="page_size", - full_name="google.cloud.talent.v4beta1.SearchProfilesRequest.page_size", - index=3, - number=4, - type=5, - cpp_type=1, - label=1, - has_default_value=False, - default_value=0, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="page_token", - full_name="google.cloud.talent.v4beta1.SearchProfilesRequest.page_token", - index=4, - number=5, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="offset", - full_name="google.cloud.talent.v4beta1.SearchProfilesRequest.offset", - index=5, - number=6, - type=5, - cpp_type=1, - label=1, - has_default_value=False, - default_value=0, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="disable_spell_check", - full_name="google.cloud.talent.v4beta1.SearchProfilesRequest.disable_spell_check", - index=6, - number=7, - type=8, - cpp_type=7, - label=1, - has_default_value=False, - default_value=False, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="order_by", - full_name="google.cloud.talent.v4beta1.SearchProfilesRequest.order_by", - index=7, - number=8, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="case_sensitive_sort", - full_name="google.cloud.talent.v4beta1.SearchProfilesRequest.case_sensitive_sort", - index=8, - number=9, - type=8, - cpp_type=7, - label=1, - has_default_value=False, - default_value=False, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="histogram_queries", - full_name="google.cloud.talent.v4beta1.SearchProfilesRequest.histogram_queries", - index=9, - number=10, - type=11, - cpp_type=10, - label=3, - has_default_value=False, - default_value=[], - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="result_set_id", - full_name="google.cloud.talent.v4beta1.SearchProfilesRequest.result_set_id", - index=10, - number=12, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="strict_keywords_search", - full_name="google.cloud.talent.v4beta1.SearchProfilesRequest.strict_keywords_search", - index=11, - number=13, - type=8, - cpp_type=7, - label=1, - has_default_value=False, - default_value=False, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=1255, - serialized_end=1731, -) - - -_SEARCHPROFILESRESPONSE = _descriptor.Descriptor( - name="SearchProfilesResponse", - full_name="google.cloud.talent.v4beta1.SearchProfilesResponse", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="estimated_total_size", - full_name="google.cloud.talent.v4beta1.SearchProfilesResponse.estimated_total_size", - index=0, - number=1, - type=3, - cpp_type=2, - label=1, - has_default_value=False, - default_value=0, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="spell_correction", - full_name="google.cloud.talent.v4beta1.SearchProfilesResponse.spell_correction", - index=1, - number=2, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="metadata", - full_name="google.cloud.talent.v4beta1.SearchProfilesResponse.metadata", - index=2, - number=3, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="next_page_token", - full_name="google.cloud.talent.v4beta1.SearchProfilesResponse.next_page_token", - index=3, - number=4, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="histogram_query_results", - full_name="google.cloud.talent.v4beta1.SearchProfilesResponse.histogram_query_results", - index=4, - number=5, - type=11, - cpp_type=10, - label=3, - has_default_value=False, - default_value=[], - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="summarized_profiles", - full_name="google.cloud.talent.v4beta1.SearchProfilesResponse.summarized_profiles", - index=5, - number=6, - type=11, - cpp_type=10, - label=3, - has_default_value=False, - default_value=[], - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="result_set_id", - full_name="google.cloud.talent.v4beta1.SearchProfilesResponse.result_set_id", - index=6, - number=7, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=1734, - serialized_end=2137, -) - - -_SUMMARIZEDPROFILE = _descriptor.Descriptor( - name="SummarizedProfile", - full_name="google.cloud.talent.v4beta1.SummarizedProfile", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="profiles", - full_name="google.cloud.talent.v4beta1.SummarizedProfile.profiles", - index=0, - number=1, - type=11, - cpp_type=10, - label=3, - has_default_value=False, - default_value=[], - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="summary", - full_name="google.cloud.talent.v4beta1.SummarizedProfile.summary", - index=1, - number=2, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=2140, - serialized_end=2270, -) - -_LISTPROFILESREQUEST.fields_by_name[ - "read_mask" -].message_type = google_dot_protobuf_dot_field__mask__pb2._FIELDMASK -_LISTPROFILESRESPONSE.fields_by_name[ - "profiles" -].message_type = ( - google_dot_cloud_dot_talent__v4beta1_dot_proto_dot_profile__pb2._PROFILE -) -_CREATEPROFILEREQUEST.fields_by_name[ - "profile" -].message_type = ( - google_dot_cloud_dot_talent__v4beta1_dot_proto_dot_profile__pb2._PROFILE -) -_UPDATEPROFILEREQUEST.fields_by_name[ - "profile" -].message_type = ( - google_dot_cloud_dot_talent__v4beta1_dot_proto_dot_profile__pb2._PROFILE -) -_UPDATEPROFILEREQUEST.fields_by_name[ - "update_mask" -].message_type = google_dot_protobuf_dot_field__mask__pb2._FIELDMASK -_SEARCHPROFILESREQUEST.fields_by_name[ - "request_metadata" -].message_type = ( - google_dot_cloud_dot_talent__v4beta1_dot_proto_dot_common__pb2._REQUESTMETADATA -) -_SEARCHPROFILESREQUEST.fields_by_name[ - "profile_query" -].message_type = ( - google_dot_cloud_dot_talent__v4beta1_dot_proto_dot_filters__pb2._PROFILEQUERY -) -_SEARCHPROFILESREQUEST.fields_by_name[ - "histogram_queries" -].message_type = ( - google_dot_cloud_dot_talent__v4beta1_dot_proto_dot_histogram__pb2._HISTOGRAMQUERY -) -_SEARCHPROFILESRESPONSE.fields_by_name[ - "spell_correction" -].message_type = ( - google_dot_cloud_dot_talent__v4beta1_dot_proto_dot_common__pb2._SPELLINGCORRECTION -) -_SEARCHPROFILESRESPONSE.fields_by_name[ - "metadata" -].message_type = ( - google_dot_cloud_dot_talent__v4beta1_dot_proto_dot_common__pb2._RESPONSEMETADATA -) -_SEARCHPROFILESRESPONSE.fields_by_name[ - "histogram_query_results" -].message_type = ( - google_dot_cloud_dot_talent__v4beta1_dot_proto_dot_histogram__pb2._HISTOGRAMQUERYRESULT -) -_SEARCHPROFILESRESPONSE.fields_by_name[ - "summarized_profiles" -].message_type = _SUMMARIZEDPROFILE -_SUMMARIZEDPROFILE.fields_by_name[ - "profiles" -].message_type = ( - google_dot_cloud_dot_talent__v4beta1_dot_proto_dot_profile__pb2._PROFILE -) -_SUMMARIZEDPROFILE.fields_by_name[ - "summary" -].message_type = ( - google_dot_cloud_dot_talent__v4beta1_dot_proto_dot_profile__pb2._PROFILE -) -DESCRIPTOR.message_types_by_name["ListProfilesRequest"] = _LISTPROFILESREQUEST -DESCRIPTOR.message_types_by_name["ListProfilesResponse"] = _LISTPROFILESRESPONSE -DESCRIPTOR.message_types_by_name["CreateProfileRequest"] = _CREATEPROFILEREQUEST -DESCRIPTOR.message_types_by_name["GetProfileRequest"] = _GETPROFILEREQUEST -DESCRIPTOR.message_types_by_name["UpdateProfileRequest"] = _UPDATEPROFILEREQUEST -DESCRIPTOR.message_types_by_name["DeleteProfileRequest"] = _DELETEPROFILEREQUEST -DESCRIPTOR.message_types_by_name["SearchProfilesRequest"] = _SEARCHPROFILESREQUEST -DESCRIPTOR.message_types_by_name["SearchProfilesResponse"] = _SEARCHPROFILESRESPONSE -DESCRIPTOR.message_types_by_name["SummarizedProfile"] = _SUMMARIZEDPROFILE -_sym_db.RegisterFileDescriptor(DESCRIPTOR) - -ListProfilesRequest = _reflection.GeneratedProtocolMessageType( - "ListProfilesRequest", - (_message.Message,), - { - "DESCRIPTOR": _LISTPROFILESREQUEST, - "__module__": "google.cloud.talent_v4beta1.proto.profile_service_pb2", - "__doc__": """List profiles request. - - Attributes: - parent: - Required. The resource name of the tenant under which the - profile is created. The format is - “projects/{project_id}/tenants/{tenant_id}”. For example, - “projects/foo/tenants/bar”. - filter: - The filter string specifies the profiles to be enumerated. - Supported operator: =, AND The field(s) eligible for - filtering are: - ``externalId`` - ``groupId`` externalId - and groupId cannot be specified at the same time. If both - externalId and groupId are provided, the API will return a bad - request error. Sample Query: - externalId = “externalId-1” - - groupId = “groupId-1” - page_token: - The token that specifies the current offset (that is, starting - result). Please set the value to [ListProfilesResponse.next_p - age_token][google.cloud.talent.v4beta1.ListProfilesResponse.ne - xt_page_token] to continue the list. - page_size: - The maximum number of profiles to be returned, at most 100. - Default is 100 unless a positive number smaller than 100 is - specified. - read_mask: - A field mask to specify the profile fields to be listed in - response. All fields are listed if it is unset. Valid values - are: - name - """, - # @@protoc_insertion_point(class_scope:google.cloud.talent.v4beta1.ListProfilesRequest) - }, -) -_sym_db.RegisterMessage(ListProfilesRequest) - -ListProfilesResponse = _reflection.GeneratedProtocolMessageType( - "ListProfilesResponse", - (_message.Message,), - { - "DESCRIPTOR": _LISTPROFILESRESPONSE, - "__module__": "google.cloud.talent_v4beta1.proto.profile_service_pb2", - "__doc__": """The List profiles response object. - - Attributes: - profiles: - Profiles for the specific tenant. - next_page_token: - A token to retrieve the next page of results. This is empty if - there are no more results. - """, - # @@protoc_insertion_point(class_scope:google.cloud.talent.v4beta1.ListProfilesResponse) - }, -) -_sym_db.RegisterMessage(ListProfilesResponse) - -CreateProfileRequest = _reflection.GeneratedProtocolMessageType( - "CreateProfileRequest", - (_message.Message,), - { - "DESCRIPTOR": _CREATEPROFILEREQUEST, - "__module__": "google.cloud.talent_v4beta1.proto.profile_service_pb2", - "__doc__": """Create profile request. - - Attributes: - parent: - Required. The name of the tenant this profile belongs to. The - format is “projects/{project_id}/tenants/{tenant_id}”. For - example, “projects/foo/tenants/bar”. - profile: - Required. The profile to be created. - """, - # @@protoc_insertion_point(class_scope:google.cloud.talent.v4beta1.CreateProfileRequest) - }, -) -_sym_db.RegisterMessage(CreateProfileRequest) - -GetProfileRequest = _reflection.GeneratedProtocolMessageType( - "GetProfileRequest", - (_message.Message,), - { - "DESCRIPTOR": _GETPROFILEREQUEST, - "__module__": "google.cloud.talent_v4beta1.proto.profile_service_pb2", - "__doc__": """Get profile request. - - Attributes: - name: - Required. Resource name of the profile to get. The format is - “projects/{project_id}/tenants/{tenant_id}/profiles/{profile_i - d}”. For example, “projects/foo/tenants/bar/profiles/baz”. - """, - # @@protoc_insertion_point(class_scope:google.cloud.talent.v4beta1.GetProfileRequest) - }, -) -_sym_db.RegisterMessage(GetProfileRequest) - -UpdateProfileRequest = _reflection.GeneratedProtocolMessageType( - "UpdateProfileRequest", - (_message.Message,), - { - "DESCRIPTOR": _UPDATEPROFILEREQUEST, - "__module__": "google.cloud.talent_v4beta1.proto.profile_service_pb2", - "__doc__": """Update profile request - - Attributes: - profile: - Required. Profile to be updated. - update_mask: - A field mask to specify the profile fields to update. A full - update is performed if it is unset. - """, - # @@protoc_insertion_point(class_scope:google.cloud.talent.v4beta1.UpdateProfileRequest) - }, -) -_sym_db.RegisterMessage(UpdateProfileRequest) - -DeleteProfileRequest = _reflection.GeneratedProtocolMessageType( - "DeleteProfileRequest", - (_message.Message,), - { - "DESCRIPTOR": _DELETEPROFILEREQUEST, - "__module__": "google.cloud.talent_v4beta1.proto.profile_service_pb2", - "__doc__": """Delete profile request. - - Attributes: - name: - Required. Resource name of the profile to be deleted. The - format is “projects/{project_id}/tenants/{tenant_id}/profiles/ - {profile_id}”. For example, - “projects/foo/tenants/bar/profiles/baz”. - """, - # @@protoc_insertion_point(class_scope:google.cloud.talent.v4beta1.DeleteProfileRequest) - }, -) -_sym_db.RegisterMessage(DeleteProfileRequest) - -SearchProfilesRequest = _reflection.GeneratedProtocolMessageType( - "SearchProfilesRequest", - (_message.Message,), - { - "DESCRIPTOR": _SEARCHPROFILESREQUEST, - "__module__": "google.cloud.talent_v4beta1.proto.profile_service_pb2", - "__doc__": """The request body of the ``SearchProfiles`` call. - - Attributes: - parent: - Required. The resource name of the tenant to search within. - The format is “projects/{project_id}/tenants/{tenant_id}”. For - example, “projects/foo/tenants/bar”. - request_metadata: - Required. The meta information collected about the profile - search user. This is used to improve the search quality of the - service. These values are provided by users, and must be - precise and consistent. - profile_query: - Search query to execute. See - [ProfileQuery][google.cloud.talent.v4beta1.ProfileQuery] for - more details. - page_size: - A limit on the number of profiles returned in the search - results. A value above the default value 10 can increase - search response time. The maximum value allowed is 100. - Otherwise an error is thrown. - page_token: - The pageToken, similar to offset enables users of the API to - paginate through the search results. To retrieve the first - page of results, set the pageToken to empty. The search - response includes a [nextPageToken][google.cloud.talent.v4beta - 1.SearchProfilesResponse.next_page_token] field that can be - used to populate the pageToken field for the next page of - results. Using pageToken instead of offset increases the - performance of the API, especially compared to larger offset - values. - offset: - An integer that specifies the current offset (that is, - starting result) in search results. This field is only - considered if [page_token][google.cloud.talent.v4beta1.SearchP - rofilesRequest.page_token] is unset. The maximum allowed - value is 5000. Otherwise an error is thrown. For example, 0 - means to search from the first profile, and 10 means to search - from the 11th profile. This can be used for pagination, for - example pageSize = 10 and offset = 10 means to search from the - second page. - disable_spell_check: - This flag controls the spell-check feature. If ``false``, the - service attempts to correct a misspelled query. For example, - “enginee” is corrected to “engineer”. - order_by: - The criteria that determines how search results are sorted. - Defaults is “relevance desc” if no value is specified. - Supported options are: - “relevance desc”: By descending - relevance, as determined by the API algorithms. - - “update_date desc”: Sort by [Profile.update_time][google.cl - oud.talent.v4beta1.Profile.update_time] in descending order - (recently updated profiles first). - “create_date desc”: Sort - by [Profile.create_time][google.cloud.talent.v4beta1.Profil - e.create_time] in descending order (recently created - profiles first). - “first_name”: Sort by [PersonName.Perso - nStructuredName.given_name][google.cloud.talent.v4beta1.Person - Name.PersonStructuredName.given_name] in ascending order. - - “first_name desc”: Sort by [PersonName.PersonStructuredName - .given_name][google.cloud.talent.v4beta1.PersonName.PersonStru - cturedName.given_name] in descending order. - “last_name”: - Sort by [PersonName.PersonStructuredName.family_name][googl - e.cloud.talent.v4beta1.PersonName.PersonStructuredName.family\_ - name] in ascending order. - “last_name desc”: Sort by [ - PersonName.PersonStructuredName.family_name][google.cloud.tale - nt.v4beta1.PersonName.PersonStructuredName.family_name] in - ascending order. - case_sensitive_sort: - When sort by field is based on alphabetical order, sort values - case sensitively (based on ASCII) when the value is set to - true. Default value is case in-sensitive sort (false). - histogram_queries: - A list of expressions specifies histogram requests against - matching profiles for [SearchProfilesRequest][google.cloud.tal - ent.v4beta1.SearchProfilesRequest]. The expression syntax - looks like a function definition with parameters. Function - syntax: function_name(histogram_facet[, list of buckets]) - Data types: - Histogram facet: facet names with format - [a-zA-Z][a-zA-Z0-9\_]+. - String: string like “any string with - backslash escape for quote(").” - Number: whole number and - floating point number like 10, -1 and -0.01. - List: list of - elements with comma(,) separator surrounded by square - brackets. For example, [1, 2, 3] and [“one”, “two”, “three”]. - Built-in constants: - MIN (minimum number similar to java - Double.MIN_VALUE) - MAX (maximum number similar to java - Double.MAX_VALUE) Built-in functions: - bucket(start, end[, - label]) Bucket build-in function creates a bucket with - range of [start, end). Note that the end is exclusive. For - example, bucket(1, MAX, “positive number”) or bucket(1, 10). - Histogram Facets: - admin1: Admin1 is a global placeholder - for referring to state, province, or the particular term a - country uses to define the geographic structure below the - country level. Examples include states codes such as “CA”, - “IL”, “NY”, and provinces, such as “BC”. - locality: Locality - is a global placeholder for referring to city, town, or the - particular term a country uses to define the geographic - structure below the admin1 level. Examples include city names - such as “Mountain View” and “New York”. - - extended_locality: Extended locality is concatenated version - of admin1 and locality with comma separator. For example, - “Mountain View, CA” and “New York, NY”. - postal_code: - Postal code of profile which follows locale code. - country: - Country code (ISO-3166-1 alpha-2 code) of profile, such as - US, JP, GB. - job_title: Normalized job titles specified in - EmploymentHistory. - company_name: Normalized company name of - profiles to match on. - institution: The school name. For - example, “MIT”, “University of California, Berkeley” - - degree: Highest education degree in ISCED code. Each value in - degree covers a specific level of education, without any - expansion to upper nor lower levels of education degree. - - experience_in_months: experience in months. 0 means 0 month to - 1 month (exclusive). - application_date: The application - date specifies application start dates. See [Application - DateFilter][google.cloud.talent.v4beta1.ApplicationDateFilter] - for more details. - application_outcome_notes: The - application outcome reason specifies the reasons behind the - outcome of the job application. See [ApplicationOutcomeNote - sFilter][google.cloud.talent.v4beta1.ApplicationOutcomeNotesFi - lter] for more details. - application_job_title: The - application job title specifies the job applied for in the - application. See [ApplicationJobFilter][google.cloud.talent - .v4beta1.ApplicationJobFilter] for more details. - - hirable_status: Hirable status specifies the profile’s hirable - status. - string_custom_attribute: String custom attributes. - Values can be accessed via square bracket notation like - string_custom_attribute[“key1”]. - numeric_custom_attribute: - Numeric custom attributes. Values can be accessed via - square bracket notation like - numeric_custom_attribute[“key1”]. Example expressions: - - count(admin1) - count(experience_in_months, [bucket(0, 12, “1 - year”), bucket(12, 36, “1-3 years”), bucket(36, MAX, “3+ - years”)]) - - count(string_custom_attribute[“assigned_recruiter”]) - - count(numeric_custom_attribute[“favorite_number”], - [bucket(MIN, 0, “negative”), bucket(0, MAX, “non- - negative”)]) - result_set_id: - An id that uniquely identifies the result set of a [SearchProf - iles][google.cloud.talent.v4beta1.ProfileService.SearchProfile - s] call. The id should be retrieved from the [SearchProfilesRe - sponse][google.cloud.talent.v4beta1.SearchProfilesResponse] - message returned from a previous invocation of [SearchProfiles - ][google.cloud.talent.v4beta1.ProfileService.SearchProfiles]. - A result set is an ordered list of search results. If this - field is not set, a new result set is computed based on the [p - rofile_query][google.cloud.talent.v4beta1.SearchProfilesReques - t.profile_query]. A new [result_set_id][google.cloud.talent.v4 - beta1.SearchProfilesRequest.result_set_id] is returned as a - handle to access this result set. If this field is set, the - service will ignore the resource and [profile_query][google.cl - oud.talent.v4beta1.SearchProfilesRequest.profile_query] - values, and simply retrieve a page of results from the - corresponding result set. In this case, one and only one of [p - age_token][google.cloud.talent.v4beta1.SearchProfilesRequest.p - age_token] or [offset][google.cloud.talent.v4beta1.SearchProfi - lesRequest.offset] must be set. A typical use case is to - invoke [SearchProfilesRequest][google.cloud.talent.v4beta1.Sea - rchProfilesRequest] without this field, then use the resulting - [result_set_id][google.cloud.talent.v4beta1.SearchProfilesRequ - est.result_set_id] in [SearchProfilesResponse][google.cloud.ta - lent.v4beta1.SearchProfilesResponse] to page through the - results. - strict_keywords_search: - This flag is used to indicate whether the service will attempt - to understand synonyms and terms related to the search query - or treat the query “as is” when it generates a set of results. - By default this flag is set to false, thus allowing expanded - results to also be returned. For example a search for - “software engineer” might also return candidates who have - experience in jobs similar to software engineer positions. By - setting this flag to true, the service will only attempt to - deliver candidates has software engineer in his/her global - fields by treating “software engineer” as a keyword. It is - recommended to provide a feature in the UI (such as a - checkbox) to allow recruiters to set this flag to true if they - intend to search for longer boolean strings. - """, - # @@protoc_insertion_point(class_scope:google.cloud.talent.v4beta1.SearchProfilesRequest) - }, -) -_sym_db.RegisterMessage(SearchProfilesRequest) - -SearchProfilesResponse = _reflection.GeneratedProtocolMessageType( - "SearchProfilesResponse", - (_message.Message,), - { - "DESCRIPTOR": _SEARCHPROFILESRESPONSE, - "__module__": "google.cloud.talent_v4beta1.proto.profile_service_pb2", - "__doc__": """Response of SearchProfiles method. - - Attributes: - estimated_total_size: - An estimation of the number of profiles that match the - specified query. This number isn’t guaranteed to be accurate. - spell_correction: - The spell checking result, and correction. - metadata: - Additional information for the API invocation, such as the - request tracking id. - next_page_token: - A token to retrieve the next page of results. This is empty if - there are no more results. - histogram_query_results: - The histogram results that match with specified [SearchProfile - sRequest.histogram_queries][google.cloud.talent.v4beta1.Search - ProfilesRequest.histogram_queries]. - summarized_profiles: - The profile entities that match the specified [SearchProfilesR - equest][google.cloud.talent.v4beta1.SearchProfilesRequest]. - result_set_id: - An id that uniquely identifies the result set of a [SearchProf - iles][google.cloud.talent.v4beta1.ProfileService.SearchProfile - s] call for consistent results. - """, - # @@protoc_insertion_point(class_scope:google.cloud.talent.v4beta1.SearchProfilesResponse) - }, -) -_sym_db.RegisterMessage(SearchProfilesResponse) - -SummarizedProfile = _reflection.GeneratedProtocolMessageType( - "SummarizedProfile", - (_message.Message,), - { - "DESCRIPTOR": _SUMMARIZEDPROFILE, - "__module__": "google.cloud.talent_v4beta1.proto.profile_service_pb2", - "__doc__": """Profile entry with metadata inside [SearchProfilesResponse][google.clo - ud.talent.v4beta1.SearchProfilesResponse]. - - Attributes: - profiles: - A list of profiles that are linked by [Profile.group_id][googl - e.cloud.talent.v4beta1.Profile.group_id]. - summary: - A profile summary shows the profile summary and how the - profile matches the search query. In profile summary, the - profiles with the same [Profile.group_id][google.cloud.talent. - v4beta1.Profile.group_id] are merged together. Among profiles, - same education/employment records may be slightly different - but they are merged into one with best efforts. For example, - in one profile the school name is “UC Berkeley” and the field - study is “Computer Science” and in another one the school name - is “University of California at Berkeley” and the field study - is “CS”. The API merges these two inputs into one and selects - one value for each field. For example, the school name in - summary is set to “University of California at Berkeley” and - the field of study is set to “Computer Science”. - """, - # @@protoc_insertion_point(class_scope:google.cloud.talent.v4beta1.SummarizedProfile) - }, -) -_sym_db.RegisterMessage(SummarizedProfile) - - -DESCRIPTOR._options = None -_LISTPROFILESREQUEST.fields_by_name["parent"]._options = None -_CREATEPROFILEREQUEST.fields_by_name["parent"]._options = None -_CREATEPROFILEREQUEST.fields_by_name["profile"]._options = None -_GETPROFILEREQUEST.fields_by_name["name"]._options = None -_UPDATEPROFILEREQUEST.fields_by_name["profile"]._options = None -_DELETEPROFILEREQUEST.fields_by_name["name"]._options = None -_SEARCHPROFILESREQUEST.fields_by_name["parent"]._options = None -_SEARCHPROFILESREQUEST.fields_by_name["request_metadata"]._options = None - -_PROFILESERVICE = _descriptor.ServiceDescriptor( - name="ProfileService", - full_name="google.cloud.talent.v4beta1.ProfileService", - file=DESCRIPTOR, - index=0, - serialized_options=b"\312A\023jobs.googleapis.com\322AShttps://www.googleapis.com/auth/cloud-platform,https://www.googleapis.com/auth/jobs", - create_key=_descriptor._internal_create_key, - serialized_start=2273, - serialized_end=3456, - methods=[ - _descriptor.MethodDescriptor( - name="ListProfiles", - full_name="google.cloud.talent.v4beta1.ProfileService.ListProfiles", - index=0, - containing_service=None, - input_type=_LISTPROFILESREQUEST, - output_type=_LISTPROFILESRESPONSE, - serialized_options=b"\202\323\344\223\0021\022//v4beta1/{parent=projects/*/tenants/*}/profiles\332A\006parent", - create_key=_descriptor._internal_create_key, - ), - _descriptor.MethodDescriptor( - name="CreateProfile", - full_name="google.cloud.talent.v4beta1.ProfileService.CreateProfile", - index=1, - containing_service=None, - input_type=_CREATEPROFILEREQUEST, - output_type=google_dot_cloud_dot_talent__v4beta1_dot_proto_dot_profile__pb2._PROFILE, - serialized_options=b'\202\323\344\223\0024"//v4beta1/{parent=projects/*/tenants/*}/profiles:\001*\332A\016parent,profile', - create_key=_descriptor._internal_create_key, - ), - _descriptor.MethodDescriptor( - name="GetProfile", - full_name="google.cloud.talent.v4beta1.ProfileService.GetProfile", - index=2, - containing_service=None, - input_type=_GETPROFILEREQUEST, - output_type=google_dot_cloud_dot_talent__v4beta1_dot_proto_dot_profile__pb2._PROFILE, - serialized_options=b"\202\323\344\223\0021\022//v4beta1/{name=projects/*/tenants/*/profiles/*}\332A\004name", - create_key=_descriptor._internal_create_key, - ), - _descriptor.MethodDescriptor( - name="UpdateProfile", - full_name="google.cloud.talent.v4beta1.ProfileService.UpdateProfile", - index=3, - containing_service=None, - input_type=_UPDATEPROFILEREQUEST, - output_type=google_dot_cloud_dot_talent__v4beta1_dot_proto_dot_profile__pb2._PROFILE, - serialized_options=b"\202\323\344\223\002<27/v4beta1/{profile.name=projects/*/tenants/*/profiles/*}:\001*\332A\007profile", - create_key=_descriptor._internal_create_key, - ), - _descriptor.MethodDescriptor( - name="DeleteProfile", - full_name="google.cloud.talent.v4beta1.ProfileService.DeleteProfile", - index=4, - containing_service=None, - input_type=_DELETEPROFILEREQUEST, - output_type=google_dot_protobuf_dot_empty__pb2._EMPTY, - serialized_options=b"\202\323\344\223\0021*//v4beta1/{name=projects/*/tenants/*/profiles/*}\332A\004name", - create_key=_descriptor._internal_create_key, - ), - _descriptor.MethodDescriptor( - name="SearchProfiles", - full_name="google.cloud.talent.v4beta1.ProfileService.SearchProfiles", - index=5, - containing_service=None, - input_type=_SEARCHPROFILESREQUEST, - output_type=_SEARCHPROFILESRESPONSE, - serialized_options=b'\202\323\344\223\0022"-/v4beta1/{parent=projects/*/tenants/*}:search:\001*', - create_key=_descriptor._internal_create_key, - ), - ], -) -_sym_db.RegisterServiceDescriptor(_PROFILESERVICE) - -DESCRIPTOR.services_by_name["ProfileService"] = _PROFILESERVICE - -# @@protoc_insertion_point(module_scope) diff --git a/google/cloud/talent_v4beta1/proto/profile_service_pb2_grpc.py b/google/cloud/talent_v4beta1/proto/profile_service_pb2_grpc.py deleted file mode 100644 index cdf0919d..00000000 --- a/google/cloud/talent_v4beta1/proto/profile_service_pb2_grpc.py +++ /dev/null @@ -1,317 +0,0 @@ -# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT! -"""Client and server classes corresponding to protobuf-defined services.""" -import grpc - -from google.cloud.talent_v4beta1.proto import ( - profile_pb2 as google_dot_cloud_dot_talent__v4beta1_dot_proto_dot_profile__pb2, -) -from google.cloud.talent_v4beta1.proto import ( - profile_service_pb2 as google_dot_cloud_dot_talent__v4beta1_dot_proto_dot_profile__service__pb2, -) -from google.protobuf import empty_pb2 as google_dot_protobuf_dot_empty__pb2 - - -class ProfileServiceStub(object): - """A service that handles profile management, including profile CRUD, - enumeration and search. - """ - - def __init__(self, channel): - """Constructor. - - Args: - channel: A grpc.Channel. - """ - self.ListProfiles = channel.unary_unary( - "/google.cloud.talent.v4beta1.ProfileService/ListProfiles", - request_serializer=google_dot_cloud_dot_talent__v4beta1_dot_proto_dot_profile__service__pb2.ListProfilesRequest.SerializeToString, - response_deserializer=google_dot_cloud_dot_talent__v4beta1_dot_proto_dot_profile__service__pb2.ListProfilesResponse.FromString, - ) - self.CreateProfile = channel.unary_unary( - "/google.cloud.talent.v4beta1.ProfileService/CreateProfile", - request_serializer=google_dot_cloud_dot_talent__v4beta1_dot_proto_dot_profile__service__pb2.CreateProfileRequest.SerializeToString, - response_deserializer=google_dot_cloud_dot_talent__v4beta1_dot_proto_dot_profile__pb2.Profile.FromString, - ) - self.GetProfile = channel.unary_unary( - "/google.cloud.talent.v4beta1.ProfileService/GetProfile", - request_serializer=google_dot_cloud_dot_talent__v4beta1_dot_proto_dot_profile__service__pb2.GetProfileRequest.SerializeToString, - response_deserializer=google_dot_cloud_dot_talent__v4beta1_dot_proto_dot_profile__pb2.Profile.FromString, - ) - self.UpdateProfile = channel.unary_unary( - "/google.cloud.talent.v4beta1.ProfileService/UpdateProfile", - request_serializer=google_dot_cloud_dot_talent__v4beta1_dot_proto_dot_profile__service__pb2.UpdateProfileRequest.SerializeToString, - response_deserializer=google_dot_cloud_dot_talent__v4beta1_dot_proto_dot_profile__pb2.Profile.FromString, - ) - self.DeleteProfile = channel.unary_unary( - "/google.cloud.talent.v4beta1.ProfileService/DeleteProfile", - request_serializer=google_dot_cloud_dot_talent__v4beta1_dot_proto_dot_profile__service__pb2.DeleteProfileRequest.SerializeToString, - response_deserializer=google_dot_protobuf_dot_empty__pb2.Empty.FromString, - ) - self.SearchProfiles = channel.unary_unary( - "/google.cloud.talent.v4beta1.ProfileService/SearchProfiles", - request_serializer=google_dot_cloud_dot_talent__v4beta1_dot_proto_dot_profile__service__pb2.SearchProfilesRequest.SerializeToString, - response_deserializer=google_dot_cloud_dot_talent__v4beta1_dot_proto_dot_profile__service__pb2.SearchProfilesResponse.FromString, - ) - - -class ProfileServiceServicer(object): - """A service that handles profile management, including profile CRUD, - enumeration and search. - """ - - def ListProfiles(self, request, context): - """Lists profiles by filter. The order is unspecified. - """ - context.set_code(grpc.StatusCode.UNIMPLEMENTED) - context.set_details("Method not implemented!") - raise NotImplementedError("Method not implemented!") - - def CreateProfile(self, request, context): - """Creates and returns a new profile. - """ - context.set_code(grpc.StatusCode.UNIMPLEMENTED) - context.set_details("Method not implemented!") - raise NotImplementedError("Method not implemented!") - - def GetProfile(self, request, context): - """Gets the specified profile. - """ - context.set_code(grpc.StatusCode.UNIMPLEMENTED) - context.set_details("Method not implemented!") - raise NotImplementedError("Method not implemented!") - - def UpdateProfile(self, request, context): - """Updates the specified profile and returns the updated result. - """ - context.set_code(grpc.StatusCode.UNIMPLEMENTED) - context.set_details("Method not implemented!") - raise NotImplementedError("Method not implemented!") - - def DeleteProfile(self, request, context): - """Deletes the specified profile. - Prerequisite: The profile has no associated applications or assignments - associated. - """ - context.set_code(grpc.StatusCode.UNIMPLEMENTED) - context.set_details("Method not implemented!") - raise NotImplementedError("Method not implemented!") - - def SearchProfiles(self, request, context): - """Searches for profiles within a tenant. - - For example, search by raw queries "software engineer in Mountain View" or - search by structured filters (location filter, education filter, etc.). - - See [SearchProfilesRequest][google.cloud.talent.v4beta1.SearchProfilesRequest] for more information. - """ - context.set_code(grpc.StatusCode.UNIMPLEMENTED) - context.set_details("Method not implemented!") - raise NotImplementedError("Method not implemented!") - - -def add_ProfileServiceServicer_to_server(servicer, server): - rpc_method_handlers = { - "ListProfiles": grpc.unary_unary_rpc_method_handler( - servicer.ListProfiles, - request_deserializer=google_dot_cloud_dot_talent__v4beta1_dot_proto_dot_profile__service__pb2.ListProfilesRequest.FromString, - response_serializer=google_dot_cloud_dot_talent__v4beta1_dot_proto_dot_profile__service__pb2.ListProfilesResponse.SerializeToString, - ), - "CreateProfile": grpc.unary_unary_rpc_method_handler( - servicer.CreateProfile, - request_deserializer=google_dot_cloud_dot_talent__v4beta1_dot_proto_dot_profile__service__pb2.CreateProfileRequest.FromString, - response_serializer=google_dot_cloud_dot_talent__v4beta1_dot_proto_dot_profile__pb2.Profile.SerializeToString, - ), - "GetProfile": grpc.unary_unary_rpc_method_handler( - servicer.GetProfile, - request_deserializer=google_dot_cloud_dot_talent__v4beta1_dot_proto_dot_profile__service__pb2.GetProfileRequest.FromString, - response_serializer=google_dot_cloud_dot_talent__v4beta1_dot_proto_dot_profile__pb2.Profile.SerializeToString, - ), - "UpdateProfile": grpc.unary_unary_rpc_method_handler( - servicer.UpdateProfile, - request_deserializer=google_dot_cloud_dot_talent__v4beta1_dot_proto_dot_profile__service__pb2.UpdateProfileRequest.FromString, - response_serializer=google_dot_cloud_dot_talent__v4beta1_dot_proto_dot_profile__pb2.Profile.SerializeToString, - ), - "DeleteProfile": grpc.unary_unary_rpc_method_handler( - servicer.DeleteProfile, - request_deserializer=google_dot_cloud_dot_talent__v4beta1_dot_proto_dot_profile__service__pb2.DeleteProfileRequest.FromString, - response_serializer=google_dot_protobuf_dot_empty__pb2.Empty.SerializeToString, - ), - "SearchProfiles": grpc.unary_unary_rpc_method_handler( - servicer.SearchProfiles, - request_deserializer=google_dot_cloud_dot_talent__v4beta1_dot_proto_dot_profile__service__pb2.SearchProfilesRequest.FromString, - response_serializer=google_dot_cloud_dot_talent__v4beta1_dot_proto_dot_profile__service__pb2.SearchProfilesResponse.SerializeToString, - ), - } - generic_handler = grpc.method_handlers_generic_handler( - "google.cloud.talent.v4beta1.ProfileService", rpc_method_handlers - ) - server.add_generic_rpc_handlers((generic_handler,)) - - -# This class is part of an EXPERIMENTAL API. -class ProfileService(object): - """A service that handles profile management, including profile CRUD, - enumeration and search. - """ - - @staticmethod - def ListProfiles( - request, - target, - options=(), - channel_credentials=None, - call_credentials=None, - compression=None, - wait_for_ready=None, - timeout=None, - metadata=None, - ): - return grpc.experimental.unary_unary( - request, - target, - "/google.cloud.talent.v4beta1.ProfileService/ListProfiles", - google_dot_cloud_dot_talent__v4beta1_dot_proto_dot_profile__service__pb2.ListProfilesRequest.SerializeToString, - google_dot_cloud_dot_talent__v4beta1_dot_proto_dot_profile__service__pb2.ListProfilesResponse.FromString, - options, - channel_credentials, - call_credentials, - compression, - wait_for_ready, - timeout, - metadata, - ) - - @staticmethod - def CreateProfile( - request, - target, - options=(), - channel_credentials=None, - call_credentials=None, - compression=None, - wait_for_ready=None, - timeout=None, - metadata=None, - ): - return grpc.experimental.unary_unary( - request, - target, - "/google.cloud.talent.v4beta1.ProfileService/CreateProfile", - google_dot_cloud_dot_talent__v4beta1_dot_proto_dot_profile__service__pb2.CreateProfileRequest.SerializeToString, - google_dot_cloud_dot_talent__v4beta1_dot_proto_dot_profile__pb2.Profile.FromString, - options, - channel_credentials, - call_credentials, - compression, - wait_for_ready, - timeout, - metadata, - ) - - @staticmethod - def GetProfile( - request, - target, - options=(), - channel_credentials=None, - call_credentials=None, - compression=None, - wait_for_ready=None, - timeout=None, - metadata=None, - ): - return grpc.experimental.unary_unary( - request, - target, - "/google.cloud.talent.v4beta1.ProfileService/GetProfile", - google_dot_cloud_dot_talent__v4beta1_dot_proto_dot_profile__service__pb2.GetProfileRequest.SerializeToString, - google_dot_cloud_dot_talent__v4beta1_dot_proto_dot_profile__pb2.Profile.FromString, - options, - channel_credentials, - call_credentials, - compression, - wait_for_ready, - timeout, - metadata, - ) - - @staticmethod - def UpdateProfile( - request, - target, - options=(), - channel_credentials=None, - call_credentials=None, - compression=None, - wait_for_ready=None, - timeout=None, - metadata=None, - ): - return grpc.experimental.unary_unary( - request, - target, - "/google.cloud.talent.v4beta1.ProfileService/UpdateProfile", - google_dot_cloud_dot_talent__v4beta1_dot_proto_dot_profile__service__pb2.UpdateProfileRequest.SerializeToString, - google_dot_cloud_dot_talent__v4beta1_dot_proto_dot_profile__pb2.Profile.FromString, - options, - channel_credentials, - call_credentials, - compression, - wait_for_ready, - timeout, - metadata, - ) - - @staticmethod - def DeleteProfile( - request, - target, - options=(), - channel_credentials=None, - call_credentials=None, - compression=None, - wait_for_ready=None, - timeout=None, - metadata=None, - ): - return grpc.experimental.unary_unary( - request, - target, - "/google.cloud.talent.v4beta1.ProfileService/DeleteProfile", - google_dot_cloud_dot_talent__v4beta1_dot_proto_dot_profile__service__pb2.DeleteProfileRequest.SerializeToString, - google_dot_protobuf_dot_empty__pb2.Empty.FromString, - options, - channel_credentials, - call_credentials, - compression, - wait_for_ready, - timeout, - metadata, - ) - - @staticmethod - def SearchProfiles( - request, - target, - options=(), - channel_credentials=None, - call_credentials=None, - compression=None, - wait_for_ready=None, - timeout=None, - metadata=None, - ): - return grpc.experimental.unary_unary( - request, - target, - "/google.cloud.talent.v4beta1.ProfileService/SearchProfiles", - google_dot_cloud_dot_talent__v4beta1_dot_proto_dot_profile__service__pb2.SearchProfilesRequest.SerializeToString, - google_dot_cloud_dot_talent__v4beta1_dot_proto_dot_profile__service__pb2.SearchProfilesResponse.FromString, - options, - channel_credentials, - call_credentials, - compression, - wait_for_ready, - timeout, - metadata, - ) diff --git a/google/cloud/talent_v4beta1/proto/tenant_pb2.py b/google/cloud/talent_v4beta1/proto/tenant_pb2.py deleted file mode 100644 index 229e410a..00000000 --- a/google/cloud/talent_v4beta1/proto/tenant_pb2.py +++ /dev/null @@ -1,225 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by the protocol buffer compiler. DO NOT EDIT! -# source: google/cloud/talent_v4beta1/proto/tenant.proto -"""Generated protocol buffer code.""" -from google.protobuf import descriptor as _descriptor -from google.protobuf import message as _message -from google.protobuf import reflection as _reflection -from google.protobuf import symbol_database as _symbol_database - -# @@protoc_insertion_point(imports) - -_sym_db = _symbol_database.Default() - - -from google.api import field_behavior_pb2 as google_dot_api_dot_field__behavior__pb2 -from google.api import resource_pb2 as google_dot_api_dot_resource__pb2 -from google.protobuf import timestamp_pb2 as google_dot_protobuf_dot_timestamp__pb2 -from google.api import annotations_pb2 as google_dot_api_dot_annotations__pb2 - - -DESCRIPTOR = _descriptor.FileDescriptor( - name="google/cloud/talent_v4beta1/proto/tenant.proto", - package="google.cloud.talent.v4beta1", - syntax="proto3", - serialized_options=b"\n\037com.google.cloud.talent.v4beta1B\023TenantResourceProtoP\001ZAgoogle.golang.org/genproto/googleapis/cloud/talent/v4beta1;talent\242\002\003CTS", - create_key=_descriptor._internal_create_key, - serialized_pb=b'\n.google/cloud/talent_v4beta1/proto/tenant.proto\x12\x1bgoogle.cloud.talent.v4beta1\x1a\x1fgoogle/api/field_behavior.proto\x1a\x19google/api/resource.proto\x1a\x1fgoogle/protobuf/timestamp.proto\x1a\x1cgoogle/api/annotations.proto"\xc3\x02\n\x06Tenant\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\x18\n\x0b\x65xternal_id\x18\x02 \x01(\tB\x03\xe0\x41\x02\x12\x45\n\nusage_type\x18\x03 \x01(\x0e\x32\x31.google.cloud.talent.v4beta1.Tenant.DataUsageType\x12\x34\n,keyword_searchable_profile_custom_attributes\x18\x04 \x03(\t"N\n\rDataUsageType\x12\x1f\n\x1b\x44\x41TA_USAGE_TYPE_UNSPECIFIED\x10\x00\x12\x0e\n\nAGGREGATED\x10\x01\x12\x0c\n\x08ISOLATED\x10\x02:D\xea\x41\x41\n\x1ajobs.googleapis.com/Tenant\x12#projects/{project}/tenants/{tenant}B\x81\x01\n\x1f\x63om.google.cloud.talent.v4beta1B\x13TenantResourceProtoP\x01ZAgoogle.golang.org/genproto/googleapis/cloud/talent/v4beta1;talent\xa2\x02\x03\x43TSb\x06proto3', - dependencies=[ - google_dot_api_dot_field__behavior__pb2.DESCRIPTOR, - google_dot_api_dot_resource__pb2.DESCRIPTOR, - google_dot_protobuf_dot_timestamp__pb2.DESCRIPTOR, - google_dot_api_dot_annotations__pb2.DESCRIPTOR, - ], -) - - -_TENANT_DATAUSAGETYPE = _descriptor.EnumDescriptor( - name="DataUsageType", - full_name="google.cloud.talent.v4beta1.Tenant.DataUsageType", - filename=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - values=[ - _descriptor.EnumValueDescriptor( - name="DATA_USAGE_TYPE_UNSPECIFIED", - index=0, - number=0, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="AGGREGATED", - index=1, - number=1, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - _descriptor.EnumValueDescriptor( - name="ISOLATED", - index=2, - number=2, - serialized_options=None, - type=None, - create_key=_descriptor._internal_create_key, - ), - ], - containing_type=None, - serialized_options=None, - serialized_start=378, - serialized_end=456, -) -_sym_db.RegisterEnumDescriptor(_TENANT_DATAUSAGETYPE) - - -_TENANT = _descriptor.Descriptor( - name="Tenant", - full_name="google.cloud.talent.v4beta1.Tenant", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="name", - full_name="google.cloud.talent.v4beta1.Tenant.name", - index=0, - number=1, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="external_id", - full_name="google.cloud.talent.v4beta1.Tenant.external_id", - index=1, - number=2, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\002", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="usage_type", - full_name="google.cloud.talent.v4beta1.Tenant.usage_type", - index=2, - number=3, - type=14, - cpp_type=8, - label=1, - has_default_value=False, - default_value=0, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="keyword_searchable_profile_custom_attributes", - full_name="google.cloud.talent.v4beta1.Tenant.keyword_searchable_profile_custom_attributes", - index=3, - number=4, - type=9, - cpp_type=9, - label=3, - has_default_value=False, - default_value=[], - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[], - enum_types=[_TENANT_DATAUSAGETYPE,], - serialized_options=b"\352AA\n\032jobs.googleapis.com/Tenant\022#projects/{project}/tenants/{tenant}", - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=203, - serialized_end=526, -) - -_TENANT.fields_by_name["usage_type"].enum_type = _TENANT_DATAUSAGETYPE -_TENANT_DATAUSAGETYPE.containing_type = _TENANT -DESCRIPTOR.message_types_by_name["Tenant"] = _TENANT -_sym_db.RegisterFileDescriptor(DESCRIPTOR) - -Tenant = _reflection.GeneratedProtocolMessageType( - "Tenant", - (_message.Message,), - { - "DESCRIPTOR": _TENANT, - "__module__": "google.cloud.talent_v4beta1.proto.tenant_pb2", - "__doc__": """A Tenant resource represents a tenant in the service. A tenant is a - group or entity that shares common access with specific privileges for - resources like profiles. Customer may create multiple tenants to - provide data isolation for different groups. - - Attributes: - name: - Required during tenant update. The resource name for a - tenant. This is generated by the service when a tenant is - created. The format is - “projects/{project_id}/tenants/{tenant_id}”, for example, - “projects/foo/tenants/bar”. - external_id: - Required. Client side tenant identifier, used to uniquely - identify the tenant. The maximum number of allowed characters - is 255. - usage_type: - Indicates whether data owned by this tenant may be used to - provide product improvements across other tenants. Defaults - behavior is [DataUsageType.ISOLATED][google.cloud.talent.v4bet - a1.Tenant.DataUsageType.ISOLATED] if it’s unset. - keyword_searchable_profile_custom_attributes: - A list of keys of filterable [Profile.custom_attributes][googl - e.cloud.talent.v4beta1.Profile.custom_attributes], whose - corresponding ``string_values`` are used in keyword searches. - Profiles with ``string_values`` under these specified field - keys are returned if any of the values match the search - keyword. Custom field values with parenthesis, brackets and - special symbols are not searchable as-is, and must be - surrounded by quotes. - """, - # @@protoc_insertion_point(class_scope:google.cloud.talent.v4beta1.Tenant) - }, -) -_sym_db.RegisterMessage(Tenant) - - -DESCRIPTOR._options = None -_TENANT.fields_by_name["external_id"]._options = None -_TENANT._options = None -# @@protoc_insertion_point(module_scope) diff --git a/google/cloud/talent_v4beta1/proto/tenant_pb2_grpc.py b/google/cloud/talent_v4beta1/proto/tenant_pb2_grpc.py deleted file mode 100644 index 8a939394..00000000 --- a/google/cloud/talent_v4beta1/proto/tenant_pb2_grpc.py +++ /dev/null @@ -1,3 +0,0 @@ -# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT! -"""Client and server classes corresponding to protobuf-defined services.""" -import grpc diff --git a/google/cloud/talent_v4beta1/proto/tenant_service_pb2.py b/google/cloud/talent_v4beta1/proto/tenant_service_pb2.py deleted file mode 100644 index bb8b03fe..00000000 --- a/google/cloud/talent_v4beta1/proto/tenant_service_pb2.py +++ /dev/null @@ -1,640 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by the protocol buffer compiler. DO NOT EDIT! -# source: google/cloud/talent_v4beta1/proto/tenant_service.proto -"""Generated protocol buffer code.""" -from google.protobuf import descriptor as _descriptor -from google.protobuf import message as _message -from google.protobuf import reflection as _reflection -from google.protobuf import symbol_database as _symbol_database - -# @@protoc_insertion_point(imports) - -_sym_db = _symbol_database.Default() - - -from google.api import annotations_pb2 as google_dot_api_dot_annotations__pb2 -from google.api import client_pb2 as google_dot_api_dot_client__pb2 -from google.api import field_behavior_pb2 as google_dot_api_dot_field__behavior__pb2 -from google.api import resource_pb2 as google_dot_api_dot_resource__pb2 -from google.cloud.talent_v4beta1.proto import ( - common_pb2 as google_dot_cloud_dot_talent__v4beta1_dot_proto_dot_common__pb2, -) -from google.cloud.talent_v4beta1.proto import ( - tenant_pb2 as google_dot_cloud_dot_talent__v4beta1_dot_proto_dot_tenant__pb2, -) -from google.protobuf import empty_pb2 as google_dot_protobuf_dot_empty__pb2 -from google.protobuf import field_mask_pb2 as google_dot_protobuf_dot_field__mask__pb2 - - -DESCRIPTOR = _descriptor.FileDescriptor( - name="google/cloud/talent_v4beta1/proto/tenant_service.proto", - package="google.cloud.talent.v4beta1", - syntax="proto3", - serialized_options=b"\n\037com.google.cloud.talent.v4beta1B\022TenantServiceProtoP\001ZAgoogle.golang.org/genproto/googleapis/cloud/talent/v4beta1;talent\242\002\003CTS", - create_key=_descriptor._internal_create_key, - serialized_pb=b'\n6google/cloud/talent_v4beta1/proto/tenant_service.proto\x12\x1bgoogle.cloud.talent.v4beta1\x1a\x1cgoogle/api/annotations.proto\x1a\x17google/api/client.proto\x1a\x1fgoogle/api/field_behavior.proto\x1a\x19google/api/resource.proto\x1a.google/cloud/talent_v4beta1/proto/common.proto\x1a.google/cloud/talent_v4beta1/proto/tenant.proto\x1a\x1bgoogle/protobuf/empty.proto\x1a google/protobuf/field_mask.proto"\x94\x01\n\x13\x43reateTenantRequest\x12\x43\n\x06parent\x18\x01 \x01(\tB3\xe0\x41\x02\xfa\x41-\n+cloudresourcemanager.googleapis.com/Project\x12\x38\n\x06tenant\x18\x02 \x01(\x0b\x32#.google.cloud.talent.v4beta1.TenantB\x03\xe0\x41\x02"D\n\x10GetTenantRequest\x12\x30\n\x04name\x18\x01 \x01(\tB"\xe0\x41\x02\xfa\x41\x1c\n\x1ajobs.googleapis.com/Tenant"\x80\x01\n\x13UpdateTenantRequest\x12\x38\n\x06tenant\x18\x01 \x01(\x0b\x32#.google.cloud.talent.v4beta1.TenantB\x03\xe0\x41\x02\x12/\n\x0bupdate_mask\x18\x02 \x01(\x0b\x32\x1a.google.protobuf.FieldMask"G\n\x13\x44\x65leteTenantRequest\x12\x30\n\x04name\x18\x01 \x01(\tB"\xe0\x41\x02\xfa\x41\x1c\n\x1ajobs.googleapis.com/Tenant"\x80\x01\n\x12ListTenantsRequest\x12\x43\n\x06parent\x18\x01 \x01(\tB3\xe0\x41\x02\xfa\x41-\n+cloudresourcemanager.googleapis.com/Project\x12\x12\n\npage_token\x18\x02 \x01(\t\x12\x11\n\tpage_size\x18\x03 \x01(\x05"\xa5\x01\n\x13ListTenantsResponse\x12\x34\n\x07tenants\x18\x01 \x03(\x0b\x32#.google.cloud.talent.v4beta1.Tenant\x12\x17\n\x0fnext_page_token\x18\x02 \x01(\t\x12?\n\x08metadata\x18\x03 \x01(\x0b\x32-.google.cloud.talent.v4beta1.ResponseMetadata2\xa0\x07\n\rTenantService\x12\xa6\x01\n\x0c\x43reateTenant\x12\x30.google.cloud.talent.v4beta1.CreateTenantRequest\x1a#.google.cloud.talent.v4beta1.Tenant"?\x82\xd3\xe4\x93\x02)"$/v4beta1/{parent=projects/*}/tenants:\x01*\xda\x41\rparent,tenant\x12\x94\x01\n\tGetTenant\x12-.google.cloud.talent.v4beta1.GetTenantRequest\x1a#.google.cloud.talent.v4beta1.Tenant"3\x82\xd3\xe4\x93\x02&\x12$/v4beta1/{name=projects/*/tenants/*}\xda\x41\x04name\x12\xa6\x01\n\x0cUpdateTenant\x12\x30.google.cloud.talent.v4beta1.UpdateTenantRequest\x1a#.google.cloud.talent.v4beta1.Tenant"?\x82\xd3\xe4\x93\x02\x30\x32+/v4beta1/{tenant.name=projects/*/tenants/*}:\x01*\xda\x41\x06tenant\x12\x8d\x01\n\x0c\x44\x65leteTenant\x12\x30.google.cloud.talent.v4beta1.DeleteTenantRequest\x1a\x16.google.protobuf.Empty"3\x82\xd3\xe4\x93\x02&*$/v4beta1/{name=projects/*/tenants/*}\xda\x41\x04name\x12\xa7\x01\n\x0bListTenants\x12/.google.cloud.talent.v4beta1.ListTenantsRequest\x1a\x30.google.cloud.talent.v4beta1.ListTenantsResponse"5\x82\xd3\xe4\x93\x02&\x12$/v4beta1/{parent=projects/*}/tenants\xda\x41\x06parent\x1al\xca\x41\x13jobs.googleapis.com\xd2\x41Shttps://www.googleapis.com/auth/cloud-platform,https://www.googleapis.com/auth/jobsB\x80\x01\n\x1f\x63om.google.cloud.talent.v4beta1B\x12TenantServiceProtoP\x01ZAgoogle.golang.org/genproto/googleapis/cloud/talent/v4beta1;talent\xa2\x02\x03\x43TSb\x06proto3', - dependencies=[ - google_dot_api_dot_annotations__pb2.DESCRIPTOR, - google_dot_api_dot_client__pb2.DESCRIPTOR, - google_dot_api_dot_field__behavior__pb2.DESCRIPTOR, - google_dot_api_dot_resource__pb2.DESCRIPTOR, - google_dot_cloud_dot_talent__v4beta1_dot_proto_dot_common__pb2.DESCRIPTOR, - google_dot_cloud_dot_talent__v4beta1_dot_proto_dot_tenant__pb2.DESCRIPTOR, - google_dot_protobuf_dot_empty__pb2.DESCRIPTOR, - google_dot_protobuf_dot_field__mask__pb2.DESCRIPTOR, - ], -) - - -_CREATETENANTREQUEST = _descriptor.Descriptor( - name="CreateTenantRequest", - full_name="google.cloud.talent.v4beta1.CreateTenantRequest", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="parent", - full_name="google.cloud.talent.v4beta1.CreateTenantRequest.parent", - index=0, - number=1, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\002\372A-\n+cloudresourcemanager.googleapis.com/Project", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="tenant", - full_name="google.cloud.talent.v4beta1.CreateTenantRequest.tenant", - index=1, - number=2, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\002", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=362, - serialized_end=510, -) - - -_GETTENANTREQUEST = _descriptor.Descriptor( - name="GetTenantRequest", - full_name="google.cloud.talent.v4beta1.GetTenantRequest", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="name", - full_name="google.cloud.talent.v4beta1.GetTenantRequest.name", - index=0, - number=1, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\002\372A\034\n\032jobs.googleapis.com/Tenant", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=512, - serialized_end=580, -) - - -_UPDATETENANTREQUEST = _descriptor.Descriptor( - name="UpdateTenantRequest", - full_name="google.cloud.talent.v4beta1.UpdateTenantRequest", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="tenant", - full_name="google.cloud.talent.v4beta1.UpdateTenantRequest.tenant", - index=0, - number=1, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\002", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="update_mask", - full_name="google.cloud.talent.v4beta1.UpdateTenantRequest.update_mask", - index=1, - number=2, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=583, - serialized_end=711, -) - - -_DELETETENANTREQUEST = _descriptor.Descriptor( - name="DeleteTenantRequest", - full_name="google.cloud.talent.v4beta1.DeleteTenantRequest", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="name", - full_name="google.cloud.talent.v4beta1.DeleteTenantRequest.name", - index=0, - number=1, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\002\372A\034\n\032jobs.googleapis.com/Tenant", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=713, - serialized_end=784, -) - - -_LISTTENANTSREQUEST = _descriptor.Descriptor( - name="ListTenantsRequest", - full_name="google.cloud.talent.v4beta1.ListTenantsRequest", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="parent", - full_name="google.cloud.talent.v4beta1.ListTenantsRequest.parent", - index=0, - number=1, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=b"\340A\002\372A-\n+cloudresourcemanager.googleapis.com/Project", - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="page_token", - full_name="google.cloud.talent.v4beta1.ListTenantsRequest.page_token", - index=1, - number=2, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="page_size", - full_name="google.cloud.talent.v4beta1.ListTenantsRequest.page_size", - index=2, - number=3, - type=5, - cpp_type=1, - label=1, - has_default_value=False, - default_value=0, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=787, - serialized_end=915, -) - - -_LISTTENANTSRESPONSE = _descriptor.Descriptor( - name="ListTenantsResponse", - full_name="google.cloud.talent.v4beta1.ListTenantsResponse", - filename=None, - file=DESCRIPTOR, - containing_type=None, - create_key=_descriptor._internal_create_key, - fields=[ - _descriptor.FieldDescriptor( - name="tenants", - full_name="google.cloud.talent.v4beta1.ListTenantsResponse.tenants", - index=0, - number=1, - type=11, - cpp_type=10, - label=3, - has_default_value=False, - default_value=[], - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="next_page_token", - full_name="google.cloud.talent.v4beta1.ListTenantsResponse.next_page_token", - index=1, - number=2, - type=9, - cpp_type=9, - label=1, - has_default_value=False, - default_value=b"".decode("utf-8"), - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - _descriptor.FieldDescriptor( - name="metadata", - full_name="google.cloud.talent.v4beta1.ListTenantsResponse.metadata", - index=2, - number=3, - type=11, - cpp_type=10, - label=1, - has_default_value=False, - default_value=None, - message_type=None, - enum_type=None, - containing_type=None, - is_extension=False, - extension_scope=None, - serialized_options=None, - file=DESCRIPTOR, - create_key=_descriptor._internal_create_key, - ), - ], - extensions=[], - nested_types=[], - enum_types=[], - serialized_options=None, - is_extendable=False, - syntax="proto3", - extension_ranges=[], - oneofs=[], - serialized_start=918, - serialized_end=1083, -) - -_CREATETENANTREQUEST.fields_by_name[ - "tenant" -].message_type = google_dot_cloud_dot_talent__v4beta1_dot_proto_dot_tenant__pb2._TENANT -_UPDATETENANTREQUEST.fields_by_name[ - "tenant" -].message_type = google_dot_cloud_dot_talent__v4beta1_dot_proto_dot_tenant__pb2._TENANT -_UPDATETENANTREQUEST.fields_by_name[ - "update_mask" -].message_type = google_dot_protobuf_dot_field__mask__pb2._FIELDMASK -_LISTTENANTSRESPONSE.fields_by_name[ - "tenants" -].message_type = google_dot_cloud_dot_talent__v4beta1_dot_proto_dot_tenant__pb2._TENANT -_LISTTENANTSRESPONSE.fields_by_name[ - "metadata" -].message_type = ( - google_dot_cloud_dot_talent__v4beta1_dot_proto_dot_common__pb2._RESPONSEMETADATA -) -DESCRIPTOR.message_types_by_name["CreateTenantRequest"] = _CREATETENANTREQUEST -DESCRIPTOR.message_types_by_name["GetTenantRequest"] = _GETTENANTREQUEST -DESCRIPTOR.message_types_by_name["UpdateTenantRequest"] = _UPDATETENANTREQUEST -DESCRIPTOR.message_types_by_name["DeleteTenantRequest"] = _DELETETENANTREQUEST -DESCRIPTOR.message_types_by_name["ListTenantsRequest"] = _LISTTENANTSREQUEST -DESCRIPTOR.message_types_by_name["ListTenantsResponse"] = _LISTTENANTSRESPONSE -_sym_db.RegisterFileDescriptor(DESCRIPTOR) - -CreateTenantRequest = _reflection.GeneratedProtocolMessageType( - "CreateTenantRequest", - (_message.Message,), - { - "DESCRIPTOR": _CREATETENANTREQUEST, - "__module__": "google.cloud.talent_v4beta1.proto.tenant_service_pb2", - "__doc__": """The Request of the CreateTenant method. - - Attributes: - parent: - Required. Resource name of the project under which the tenant - is created. The format is “projects/{project_id}”, for - example, “projects/foo”. - tenant: - Required. The tenant to be created. - """, - # @@protoc_insertion_point(class_scope:google.cloud.talent.v4beta1.CreateTenantRequest) - }, -) -_sym_db.RegisterMessage(CreateTenantRequest) - -GetTenantRequest = _reflection.GeneratedProtocolMessageType( - "GetTenantRequest", - (_message.Message,), - { - "DESCRIPTOR": _GETTENANTREQUEST, - "__module__": "google.cloud.talent_v4beta1.proto.tenant_service_pb2", - "__doc__": """Request for getting a tenant by name. - - Attributes: - name: - Required. The resource name of the tenant to be retrieved. - The format is “projects/{project_id}/tenants/{tenant_id}”, for - example, “projects/foo/tenants/bar”. - """, - # @@protoc_insertion_point(class_scope:google.cloud.talent.v4beta1.GetTenantRequest) - }, -) -_sym_db.RegisterMessage(GetTenantRequest) - -UpdateTenantRequest = _reflection.GeneratedProtocolMessageType( - "UpdateTenantRequest", - (_message.Message,), - { - "DESCRIPTOR": _UPDATETENANTREQUEST, - "__module__": "google.cloud.talent_v4beta1.proto.tenant_service_pb2", - "__doc__": """Request for updating a specified tenant. - - Attributes: - tenant: - Required. The tenant resource to replace the current resource - in the system. - update_mask: - Strongly recommended for the best service experience. If [upd - ate_mask][google.cloud.talent.v4beta1.UpdateTenantRequest.upda - te_mask] is provided, only the specified fields in [tenant][go - ogle.cloud.talent.v4beta1.UpdateTenantRequest.tenant] are - updated. Otherwise all the fields are updated. A field mask - to specify the tenant fields to be updated. Only top level - fields of [Tenant][google.cloud.talent.v4beta1.Tenant] are - supported. - """, - # @@protoc_insertion_point(class_scope:google.cloud.talent.v4beta1.UpdateTenantRequest) - }, -) -_sym_db.RegisterMessage(UpdateTenantRequest) - -DeleteTenantRequest = _reflection.GeneratedProtocolMessageType( - "DeleteTenantRequest", - (_message.Message,), - { - "DESCRIPTOR": _DELETETENANTREQUEST, - "__module__": "google.cloud.talent_v4beta1.proto.tenant_service_pb2", - "__doc__": """Request to delete a tenant. - - Attributes: - name: - Required. The resource name of the tenant to be deleted. The - format is “projects/{project_id}/tenants/{tenant_id}”, for - example, “projects/foo/tenants/bar”. - """, - # @@protoc_insertion_point(class_scope:google.cloud.talent.v4beta1.DeleteTenantRequest) - }, -) -_sym_db.RegisterMessage(DeleteTenantRequest) - -ListTenantsRequest = _reflection.GeneratedProtocolMessageType( - "ListTenantsRequest", - (_message.Message,), - { - "DESCRIPTOR": _LISTTENANTSREQUEST, - "__module__": "google.cloud.talent_v4beta1.proto.tenant_service_pb2", - "__doc__": """List tenants for which the client has ACL visibility. - - Attributes: - parent: - Required. Resource name of the project under which the tenant - is created. The format is “projects/{project_id}”, for - example, “projects/foo”. - page_token: - The starting indicator from which to return results. - page_size: - The maximum number of tenants to be returned, at most 100. - Default is 100 if a non-positive number is provided. - """, - # @@protoc_insertion_point(class_scope:google.cloud.talent.v4beta1.ListTenantsRequest) - }, -) -_sym_db.RegisterMessage(ListTenantsRequest) - -ListTenantsResponse = _reflection.GeneratedProtocolMessageType( - "ListTenantsResponse", - (_message.Message,), - { - "DESCRIPTOR": _LISTTENANTSRESPONSE, - "__module__": "google.cloud.talent_v4beta1.proto.tenant_service_pb2", - "__doc__": """The List tenants response object. - - Attributes: - tenants: - Tenants for the current client. - next_page_token: - A token to retrieve the next page of results. - metadata: - Additional information for the API invocation, such as the - request tracking id. - """, - # @@protoc_insertion_point(class_scope:google.cloud.talent.v4beta1.ListTenantsResponse) - }, -) -_sym_db.RegisterMessage(ListTenantsResponse) - - -DESCRIPTOR._options = None -_CREATETENANTREQUEST.fields_by_name["parent"]._options = None -_CREATETENANTREQUEST.fields_by_name["tenant"]._options = None -_GETTENANTREQUEST.fields_by_name["name"]._options = None -_UPDATETENANTREQUEST.fields_by_name["tenant"]._options = None -_DELETETENANTREQUEST.fields_by_name["name"]._options = None -_LISTTENANTSREQUEST.fields_by_name["parent"]._options = None - -_TENANTSERVICE = _descriptor.ServiceDescriptor( - name="TenantService", - full_name="google.cloud.talent.v4beta1.TenantService", - file=DESCRIPTOR, - index=0, - serialized_options=b"\312A\023jobs.googleapis.com\322AShttps://www.googleapis.com/auth/cloud-platform,https://www.googleapis.com/auth/jobs", - create_key=_descriptor._internal_create_key, - serialized_start=1086, - serialized_end=2014, - methods=[ - _descriptor.MethodDescriptor( - name="CreateTenant", - full_name="google.cloud.talent.v4beta1.TenantService.CreateTenant", - index=0, - containing_service=None, - input_type=_CREATETENANTREQUEST, - output_type=google_dot_cloud_dot_talent__v4beta1_dot_proto_dot_tenant__pb2._TENANT, - serialized_options=b'\202\323\344\223\002)"$/v4beta1/{parent=projects/*}/tenants:\001*\332A\rparent,tenant', - create_key=_descriptor._internal_create_key, - ), - _descriptor.MethodDescriptor( - name="GetTenant", - full_name="google.cloud.talent.v4beta1.TenantService.GetTenant", - index=1, - containing_service=None, - input_type=_GETTENANTREQUEST, - output_type=google_dot_cloud_dot_talent__v4beta1_dot_proto_dot_tenant__pb2._TENANT, - serialized_options=b"\202\323\344\223\002&\022$/v4beta1/{name=projects/*/tenants/*}\332A\004name", - create_key=_descriptor._internal_create_key, - ), - _descriptor.MethodDescriptor( - name="UpdateTenant", - full_name="google.cloud.talent.v4beta1.TenantService.UpdateTenant", - index=2, - containing_service=None, - input_type=_UPDATETENANTREQUEST, - output_type=google_dot_cloud_dot_talent__v4beta1_dot_proto_dot_tenant__pb2._TENANT, - serialized_options=b"\202\323\344\223\00202+/v4beta1/{tenant.name=projects/*/tenants/*}:\001*\332A\006tenant", - create_key=_descriptor._internal_create_key, - ), - _descriptor.MethodDescriptor( - name="DeleteTenant", - full_name="google.cloud.talent.v4beta1.TenantService.DeleteTenant", - index=3, - containing_service=None, - input_type=_DELETETENANTREQUEST, - output_type=google_dot_protobuf_dot_empty__pb2._EMPTY, - serialized_options=b"\202\323\344\223\002&*$/v4beta1/{name=projects/*/tenants/*}\332A\004name", - create_key=_descriptor._internal_create_key, - ), - _descriptor.MethodDescriptor( - name="ListTenants", - full_name="google.cloud.talent.v4beta1.TenantService.ListTenants", - index=4, - containing_service=None, - input_type=_LISTTENANTSREQUEST, - output_type=_LISTTENANTSRESPONSE, - serialized_options=b"\202\323\344\223\002&\022$/v4beta1/{parent=projects/*}/tenants\332A\006parent", - create_key=_descriptor._internal_create_key, - ), - ], -) -_sym_db.RegisterServiceDescriptor(_TENANTSERVICE) - -DESCRIPTOR.services_by_name["TenantService"] = _TENANTSERVICE - -# @@protoc_insertion_point(module_scope) diff --git a/google/cloud/talent_v4beta1/proto/tenant_service_pb2_grpc.py b/google/cloud/talent_v4beta1/proto/tenant_service_pb2_grpc.py deleted file mode 100644 index ed0461f3..00000000 --- a/google/cloud/talent_v4beta1/proto/tenant_service_pb2_grpc.py +++ /dev/null @@ -1,263 +0,0 @@ -# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT! -"""Client and server classes corresponding to protobuf-defined services.""" -import grpc - -from google.cloud.talent_v4beta1.proto import ( - tenant_pb2 as google_dot_cloud_dot_talent__v4beta1_dot_proto_dot_tenant__pb2, -) -from google.cloud.talent_v4beta1.proto import ( - tenant_service_pb2 as google_dot_cloud_dot_talent__v4beta1_dot_proto_dot_tenant__service__pb2, -) -from google.protobuf import empty_pb2 as google_dot_protobuf_dot_empty__pb2 - - -class TenantServiceStub(object): - """A service that handles tenant management, including CRUD and enumeration. - """ - - def __init__(self, channel): - """Constructor. - - Args: - channel: A grpc.Channel. - """ - self.CreateTenant = channel.unary_unary( - "/google.cloud.talent.v4beta1.TenantService/CreateTenant", - request_serializer=google_dot_cloud_dot_talent__v4beta1_dot_proto_dot_tenant__service__pb2.CreateTenantRequest.SerializeToString, - response_deserializer=google_dot_cloud_dot_talent__v4beta1_dot_proto_dot_tenant__pb2.Tenant.FromString, - ) - self.GetTenant = channel.unary_unary( - "/google.cloud.talent.v4beta1.TenantService/GetTenant", - request_serializer=google_dot_cloud_dot_talent__v4beta1_dot_proto_dot_tenant__service__pb2.GetTenantRequest.SerializeToString, - response_deserializer=google_dot_cloud_dot_talent__v4beta1_dot_proto_dot_tenant__pb2.Tenant.FromString, - ) - self.UpdateTenant = channel.unary_unary( - "/google.cloud.talent.v4beta1.TenantService/UpdateTenant", - request_serializer=google_dot_cloud_dot_talent__v4beta1_dot_proto_dot_tenant__service__pb2.UpdateTenantRequest.SerializeToString, - response_deserializer=google_dot_cloud_dot_talent__v4beta1_dot_proto_dot_tenant__pb2.Tenant.FromString, - ) - self.DeleteTenant = channel.unary_unary( - "/google.cloud.talent.v4beta1.TenantService/DeleteTenant", - request_serializer=google_dot_cloud_dot_talent__v4beta1_dot_proto_dot_tenant__service__pb2.DeleteTenantRequest.SerializeToString, - response_deserializer=google_dot_protobuf_dot_empty__pb2.Empty.FromString, - ) - self.ListTenants = channel.unary_unary( - "/google.cloud.talent.v4beta1.TenantService/ListTenants", - request_serializer=google_dot_cloud_dot_talent__v4beta1_dot_proto_dot_tenant__service__pb2.ListTenantsRequest.SerializeToString, - response_deserializer=google_dot_cloud_dot_talent__v4beta1_dot_proto_dot_tenant__service__pb2.ListTenantsResponse.FromString, - ) - - -class TenantServiceServicer(object): - """A service that handles tenant management, including CRUD and enumeration. - """ - - def CreateTenant(self, request, context): - """Creates a new tenant entity. - """ - context.set_code(grpc.StatusCode.UNIMPLEMENTED) - context.set_details("Method not implemented!") - raise NotImplementedError("Method not implemented!") - - def GetTenant(self, request, context): - """Retrieves specified tenant. - """ - context.set_code(grpc.StatusCode.UNIMPLEMENTED) - context.set_details("Method not implemented!") - raise NotImplementedError("Method not implemented!") - - def UpdateTenant(self, request, context): - """Updates specified tenant. - """ - context.set_code(grpc.StatusCode.UNIMPLEMENTED) - context.set_details("Method not implemented!") - raise NotImplementedError("Method not implemented!") - - def DeleteTenant(self, request, context): - """Deletes specified tenant. - """ - context.set_code(grpc.StatusCode.UNIMPLEMENTED) - context.set_details("Method not implemented!") - raise NotImplementedError("Method not implemented!") - - def ListTenants(self, request, context): - """Lists all tenants associated with the project. - """ - context.set_code(grpc.StatusCode.UNIMPLEMENTED) - context.set_details("Method not implemented!") - raise NotImplementedError("Method not implemented!") - - -def add_TenantServiceServicer_to_server(servicer, server): - rpc_method_handlers = { - "CreateTenant": grpc.unary_unary_rpc_method_handler( - servicer.CreateTenant, - request_deserializer=google_dot_cloud_dot_talent__v4beta1_dot_proto_dot_tenant__service__pb2.CreateTenantRequest.FromString, - response_serializer=google_dot_cloud_dot_talent__v4beta1_dot_proto_dot_tenant__pb2.Tenant.SerializeToString, - ), - "GetTenant": grpc.unary_unary_rpc_method_handler( - servicer.GetTenant, - request_deserializer=google_dot_cloud_dot_talent__v4beta1_dot_proto_dot_tenant__service__pb2.GetTenantRequest.FromString, - response_serializer=google_dot_cloud_dot_talent__v4beta1_dot_proto_dot_tenant__pb2.Tenant.SerializeToString, - ), - "UpdateTenant": grpc.unary_unary_rpc_method_handler( - servicer.UpdateTenant, - request_deserializer=google_dot_cloud_dot_talent__v4beta1_dot_proto_dot_tenant__service__pb2.UpdateTenantRequest.FromString, - response_serializer=google_dot_cloud_dot_talent__v4beta1_dot_proto_dot_tenant__pb2.Tenant.SerializeToString, - ), - "DeleteTenant": grpc.unary_unary_rpc_method_handler( - servicer.DeleteTenant, - request_deserializer=google_dot_cloud_dot_talent__v4beta1_dot_proto_dot_tenant__service__pb2.DeleteTenantRequest.FromString, - response_serializer=google_dot_protobuf_dot_empty__pb2.Empty.SerializeToString, - ), - "ListTenants": grpc.unary_unary_rpc_method_handler( - servicer.ListTenants, - request_deserializer=google_dot_cloud_dot_talent__v4beta1_dot_proto_dot_tenant__service__pb2.ListTenantsRequest.FromString, - response_serializer=google_dot_cloud_dot_talent__v4beta1_dot_proto_dot_tenant__service__pb2.ListTenantsResponse.SerializeToString, - ), - } - generic_handler = grpc.method_handlers_generic_handler( - "google.cloud.talent.v4beta1.TenantService", rpc_method_handlers - ) - server.add_generic_rpc_handlers((generic_handler,)) - - -# This class is part of an EXPERIMENTAL API. -class TenantService(object): - """A service that handles tenant management, including CRUD and enumeration. - """ - - @staticmethod - def CreateTenant( - request, - target, - options=(), - channel_credentials=None, - call_credentials=None, - compression=None, - wait_for_ready=None, - timeout=None, - metadata=None, - ): - return grpc.experimental.unary_unary( - request, - target, - "/google.cloud.talent.v4beta1.TenantService/CreateTenant", - google_dot_cloud_dot_talent__v4beta1_dot_proto_dot_tenant__service__pb2.CreateTenantRequest.SerializeToString, - google_dot_cloud_dot_talent__v4beta1_dot_proto_dot_tenant__pb2.Tenant.FromString, - options, - channel_credentials, - call_credentials, - compression, - wait_for_ready, - timeout, - metadata, - ) - - @staticmethod - def GetTenant( - request, - target, - options=(), - channel_credentials=None, - call_credentials=None, - compression=None, - wait_for_ready=None, - timeout=None, - metadata=None, - ): - return grpc.experimental.unary_unary( - request, - target, - "/google.cloud.talent.v4beta1.TenantService/GetTenant", - google_dot_cloud_dot_talent__v4beta1_dot_proto_dot_tenant__service__pb2.GetTenantRequest.SerializeToString, - google_dot_cloud_dot_talent__v4beta1_dot_proto_dot_tenant__pb2.Tenant.FromString, - options, - channel_credentials, - call_credentials, - compression, - wait_for_ready, - timeout, - metadata, - ) - - @staticmethod - def UpdateTenant( - request, - target, - options=(), - channel_credentials=None, - call_credentials=None, - compression=None, - wait_for_ready=None, - timeout=None, - metadata=None, - ): - return grpc.experimental.unary_unary( - request, - target, - "/google.cloud.talent.v4beta1.TenantService/UpdateTenant", - google_dot_cloud_dot_talent__v4beta1_dot_proto_dot_tenant__service__pb2.UpdateTenantRequest.SerializeToString, - google_dot_cloud_dot_talent__v4beta1_dot_proto_dot_tenant__pb2.Tenant.FromString, - options, - channel_credentials, - call_credentials, - compression, - wait_for_ready, - timeout, - metadata, - ) - - @staticmethod - def DeleteTenant( - request, - target, - options=(), - channel_credentials=None, - call_credentials=None, - compression=None, - wait_for_ready=None, - timeout=None, - metadata=None, - ): - return grpc.experimental.unary_unary( - request, - target, - "/google.cloud.talent.v4beta1.TenantService/DeleteTenant", - google_dot_cloud_dot_talent__v4beta1_dot_proto_dot_tenant__service__pb2.DeleteTenantRequest.SerializeToString, - google_dot_protobuf_dot_empty__pb2.Empty.FromString, - options, - channel_credentials, - call_credentials, - compression, - wait_for_ready, - timeout, - metadata, - ) - - @staticmethod - def ListTenants( - request, - target, - options=(), - channel_credentials=None, - call_credentials=None, - compression=None, - wait_for_ready=None, - timeout=None, - metadata=None, - ): - return grpc.experimental.unary_unary( - request, - target, - "/google.cloud.talent.v4beta1.TenantService/ListTenants", - google_dot_cloud_dot_talent__v4beta1_dot_proto_dot_tenant__service__pb2.ListTenantsRequest.SerializeToString, - google_dot_cloud_dot_talent__v4beta1_dot_proto_dot_tenant__service__pb2.ListTenantsResponse.FromString, - options, - channel_credentials, - call_credentials, - compression, - wait_for_ready, - timeout, - metadata, - ) diff --git a/google/cloud/talent_v4beta1/py.typed b/google/cloud/talent_v4beta1/py.typed new file mode 100644 index 00000000..d9645927 --- /dev/null +++ b/google/cloud/talent_v4beta1/py.typed @@ -0,0 +1,2 @@ +# Marker file for PEP 561. +# The google-cloud-talent package uses inline types. diff --git a/google/cloud/talent_v4beta1/services/__init__.py b/google/cloud/talent_v4beta1/services/__init__.py new file mode 100644 index 00000000..42ffdf2b --- /dev/null +++ b/google/cloud/talent_v4beta1/services/__init__.py @@ -0,0 +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. +# diff --git a/google/cloud/talent_v4beta1/services/application_service/__init__.py b/google/cloud/talent_v4beta1/services/application_service/__init__.py new file mode 100644 index 00000000..66c21a02 --- /dev/null +++ b/google/cloud/talent_v4beta1/services/application_service/__init__.py @@ -0,0 +1,24 @@ +# -*- 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. +# + +from .client import ApplicationServiceClient +from .async_client import ApplicationServiceAsyncClient + +__all__ = ( + "ApplicationServiceClient", + "ApplicationServiceAsyncClient", +) diff --git a/google/cloud/talent_v4beta1/services/application_service/async_client.py b/google/cloud/talent_v4beta1/services/application_service/async_client.py new file mode 100644 index 00000000..f91a96d2 --- /dev/null +++ b/google/cloud/talent_v4beta1/services/application_service/async_client.py @@ -0,0 +1,525 @@ +# -*- 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. +# + +from collections import OrderedDict +import functools +import re +from typing import Dict, Sequence, Tuple, Type, Union +import pkg_resources + +import google.api_core.client_options as ClientOptions # type: ignore +from google.api_core import exceptions # type: ignore +from google.api_core import gapic_v1 # type: ignore +from google.api_core import retry as retries # type: ignore +from google.auth import credentials # type: ignore +from google.oauth2 import service_account # type: ignore + +from google.cloud.talent_v4beta1.services.application_service import pagers +from google.cloud.talent_v4beta1.types import application +from google.cloud.talent_v4beta1.types import application as gct_application +from google.cloud.talent_v4beta1.types import application_service +from google.cloud.talent_v4beta1.types import common +from google.protobuf import timestamp_pb2 as timestamp # type: ignore +from google.protobuf import wrappers_pb2 as wrappers # type: ignore +from google.type import date_pb2 as date # type: ignore + +from .transports.base import ApplicationServiceTransport +from .transports.grpc_asyncio import ApplicationServiceGrpcAsyncIOTransport +from .client import ApplicationServiceClient + + +class ApplicationServiceAsyncClient: + """A service that handles application management, including CRUD + and enumeration. + """ + + _client: ApplicationServiceClient + + DEFAULT_ENDPOINT = ApplicationServiceClient.DEFAULT_ENDPOINT + DEFAULT_MTLS_ENDPOINT = ApplicationServiceClient.DEFAULT_MTLS_ENDPOINT + + application_path = staticmethod(ApplicationServiceClient.application_path) + + from_service_account_file = ApplicationServiceClient.from_service_account_file + from_service_account_json = from_service_account_file + + get_transport_class = functools.partial( + type(ApplicationServiceClient).get_transport_class, + type(ApplicationServiceClient), + ) + + def __init__( + self, + *, + credentials: credentials.Credentials = None, + transport: Union[str, ApplicationServiceTransport] = "grpc_asyncio", + client_options: ClientOptions = None, + ) -> None: + """Instantiate the application service client. + + Args: + credentials (Optional[google.auth.credentials.Credentials]): The + authorization credentials to attach to requests. These + credentials identify the application to the service; if none + are specified, the client will attempt to ascertain the + credentials from the environment. + transport (Union[str, ~.ApplicationServiceTransport]): The + transport to use. If set to None, a transport is chosen + automatically. + client_options (ClientOptions): Custom options for the client. It + won't take effect if a ``transport`` instance is provided. + (1) The ``api_endpoint`` property can be used to override the + default endpoint provided by the client. GOOGLE_API_USE_MTLS + environment variable can also be used to override the endpoint: + "always" (always use the default mTLS endpoint), "never" (always + use the default regular endpoint, this is the default value for + the environment variable) and "auto" (auto switch to the default + mTLS endpoint if client SSL credentials is present). However, + the ``api_endpoint`` property takes precedence if provided. + (2) The ``client_cert_source`` property is used to provide client + SSL credentials for mutual TLS transport. If not provided, the + default SSL credentials will be used if present. + + Raises: + google.auth.exceptions.MutualTlsChannelError: If mutual TLS transport + creation failed for any reason. + """ + + self._client = ApplicationServiceClient( + credentials=credentials, transport=transport, client_options=client_options, + ) + + async def create_application( + self, + request: application_service.CreateApplicationRequest = None, + *, + parent: str = None, + application: gct_application.Application = None, + retry: retries.Retry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> gct_application.Application: + r"""Creates a new application entity. + + Args: + request (:class:`~.application_service.CreateApplicationRequest`): + The request object. The Request of the CreateApplication + method. + parent (:class:`str`): + Required. Resource name of the profile under which the + application is created. + + The format is + "projects/{project_id}/tenants/{tenant_id}/profiles/{profile_id}". + For example, "projects/foo/tenants/bar/profiles/baz". + This corresponds to the ``parent`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + application (:class:`~.gct_application.Application`): + Required. The application to be + created. + This corresponds to the ``application`` 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. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + ~.gct_application.Application: + Resource that represents a job + application record of a candidate. + + """ + # Create or coerce a protobuf request object. + # Sanity check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + if request is not None and any([parent, application]): + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + request = application_service.CreateApplicationRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + + if parent is not None: + request.parent = parent + if application is not None: + request.application = application + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.create_application, + default_timeout=30.0, + client_info=_client_info, + ) + + # 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),)), + ) + + # Send the request. + response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + + # Done; return the response. + return response + + async def get_application( + self, + request: application_service.GetApplicationRequest = None, + *, + name: str = None, + retry: retries.Retry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> application.Application: + r"""Retrieves specified application. + + Args: + request (:class:`~.application_service.GetApplicationRequest`): + The request object. Request for getting a application by + name. + name (:class:`str`): + Required. The resource name of the application to be + retrieved. + + The format is + "projects/{project_id}/tenants/{tenant_id}/profiles/{profile_id}/applications/{application_id}". + For example, + "projects/foo/tenants/bar/profiles/baz/applications/qux". + This corresponds to the ``name`` 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. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + ~.application.Application: + Resource that represents a job + application record of a candidate. + + """ + # Create or coerce a protobuf request object. + # Sanity check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + if request is not None and any([name]): + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + request = application_service.GetApplicationRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + + if name is not None: + request.name = name + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.get_application, + default_retry=retries.Retry( + initial=0.1, + maximum=60.0, + multiplier=1.3, + predicate=retries.if_exception_type( + exceptions.ServiceUnavailable, exceptions.DeadlineExceeded, + ), + ), + default_timeout=30.0, + client_info=_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 update_application( + self, + request: application_service.UpdateApplicationRequest = None, + *, + application: gct_application.Application = None, + retry: retries.Retry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> gct_application.Application: + r"""Updates specified application. + + Args: + request (:class:`~.application_service.UpdateApplicationRequest`): + The request object. Request for updating a specified + application. + application (:class:`~.gct_application.Application`): + Required. The application resource to + replace the current resource in the + system. + This corresponds to the ``application`` 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. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + ~.gct_application.Application: + Resource that represents a job + application record of a candidate. + + """ + # Create or coerce a protobuf request object. + # Sanity check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + if request is not None and any([application]): + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + request = application_service.UpdateApplicationRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + + if application is not None: + request.application = application + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.update_application, + default_timeout=30.0, + client_info=_client_info, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata( + (("application.name", request.application.name),) + ), + ) + + # Send the request. + response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + + # Done; return the response. + return response + + async def delete_application( + self, + request: application_service.DeleteApplicationRequest = None, + *, + name: str = None, + retry: retries.Retry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> None: + r"""Deletes specified application. + + Args: + request (:class:`~.application_service.DeleteApplicationRequest`): + The request object. Request to delete a application. + name (:class:`str`): + Required. The resource name of the application to be + deleted. + + The format is + "projects/{project_id}/tenants/{tenant_id}/profiles/{profile_id}/applications/{application_id}". + For example, + "projects/foo/tenants/bar/profiles/baz/applications/qux". + This corresponds to the ``name`` 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. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + """ + # Create or coerce a protobuf request object. + # Sanity check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + if request is not None and any([name]): + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + request = application_service.DeleteApplicationRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + + if name is not None: + request.name = name + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.delete_application, + default_retry=retries.Retry( + initial=0.1, + maximum=60.0, + multiplier=1.3, + predicate=retries.if_exception_type( + exceptions.ServiceUnavailable, exceptions.DeadlineExceeded, + ), + ), + default_timeout=30.0, + client_info=_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. + await rpc( + request, retry=retry, timeout=timeout, metadata=metadata, + ) + + async def list_applications( + self, + request: application_service.ListApplicationsRequest = None, + *, + parent: str = None, + retry: retries.Retry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> pagers.ListApplicationsAsyncPager: + r"""Lists all applications associated with the profile. + + Args: + request (:class:`~.application_service.ListApplicationsRequest`): + The request object. List applications for which the + client has ACL visibility. + parent (:class:`str`): + Required. Resource name of the profile under which the + application is created. + + The format is + "projects/{project_id}/tenants/{tenant_id}/profiles/{profile_id}", + for example, "projects/foo/tenants/bar/profiles/baz". + This corresponds to the ``parent`` 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. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + ~.pagers.ListApplicationsAsyncPager: + The List applications response + object. + Iterating over this object will yield + results and resolve additional pages + automatically. + + """ + # Create or coerce a protobuf request object. + # Sanity check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + if request is not None and any([parent]): + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + request = application_service.ListApplicationsRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + + if parent is not None: + request.parent = parent + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.list_applications, + default_retry=retries.Retry( + initial=0.1, + maximum=60.0, + multiplier=1.3, + predicate=retries.if_exception_type( + exceptions.ServiceUnavailable, exceptions.DeadlineExceeded, + ), + ), + default_timeout=30.0, + client_info=_client_info, + ) + + # 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),)), + ) + + # Send the request. + response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + + # This method is paged; wrap the response in a pager, which provides + # an `__aiter__` convenience method. + response = pagers.ListApplicationsAsyncPager( + method=rpc, request=request, response=response, metadata=metadata, + ) + + # Done; return the response. + return response + + +try: + _client_info = gapic_v1.client_info.ClientInfo( + gapic_version=pkg_resources.get_distribution("google-cloud-talent",).version, + ) +except pkg_resources.DistributionNotFound: + _client_info = gapic_v1.client_info.ClientInfo() + + +__all__ = ("ApplicationServiceAsyncClient",) diff --git a/google/cloud/talent_v4beta1/services/application_service/client.py b/google/cloud/talent_v4beta1/services/application_service/client.py new file mode 100644 index 00000000..8c5153f2 --- /dev/null +++ b/google/cloud/talent_v4beta1/services/application_service/client.py @@ -0,0 +1,654 @@ +# -*- 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. +# + +from collections import OrderedDict +import os +import re +from typing import Callable, Dict, Sequence, Tuple, Type, Union +import pkg_resources + +import google.api_core.client_options as ClientOptions # type: ignore +from google.api_core import exceptions # type: ignore +from google.api_core import gapic_v1 # type: ignore +from google.api_core import retry as retries # type: ignore +from google.auth import credentials # type: ignore +from google.auth.transport import mtls # type: ignore +from google.auth.exceptions import MutualTLSChannelError # type: ignore +from google.oauth2 import service_account # type: ignore + +from google.cloud.talent_v4beta1.services.application_service import pagers +from google.cloud.talent_v4beta1.types import application +from google.cloud.talent_v4beta1.types import application as gct_application +from google.cloud.talent_v4beta1.types import application_service +from google.cloud.talent_v4beta1.types import common +from google.protobuf import timestamp_pb2 as timestamp # type: ignore +from google.protobuf import wrappers_pb2 as wrappers # type: ignore +from google.type import date_pb2 as date # type: ignore + +from .transports.base import ApplicationServiceTransport +from .transports.grpc import ApplicationServiceGrpcTransport +from .transports.grpc_asyncio import ApplicationServiceGrpcAsyncIOTransport + + +class ApplicationServiceClientMeta(type): + """Metaclass for the ApplicationService client. + + This provides class-level methods for building and retrieving + support objects (e.g. transport) without polluting the client instance + objects. + """ + + _transport_registry = ( + OrderedDict() + ) # type: Dict[str, Type[ApplicationServiceTransport]] + _transport_registry["grpc"] = ApplicationServiceGrpcTransport + _transport_registry["grpc_asyncio"] = ApplicationServiceGrpcAsyncIOTransport + + def get_transport_class( + cls, label: str = None, + ) -> Type[ApplicationServiceTransport]: + """Return an appropriate transport class. + + Args: + label: The name of the desired transport. If none is + provided, then the first transport in the registry is used. + + Returns: + The transport class to use. + """ + # If a specific transport is requested, return that one. + if label: + return cls._transport_registry[label] + + # No transport is requested; return the default (that is, the first one + # in the dictionary). + return next(iter(cls._transport_registry.values())) + + +class ApplicationServiceClient(metaclass=ApplicationServiceClientMeta): + """A service that handles application management, including CRUD + and enumeration. + """ + + @staticmethod + def _get_default_mtls_endpoint(api_endpoint): + """Convert api endpoint to mTLS endpoint. + Convert "*.sandbox.googleapis.com" and "*.googleapis.com" to + "*.mtls.sandbox.googleapis.com" and "*.mtls.googleapis.com" respectively. + Args: + api_endpoint (Optional[str]): the api endpoint to convert. + Returns: + str: converted mTLS api endpoint. + """ + if not api_endpoint: + return api_endpoint + + mtls_endpoint_re = re.compile( + r"(?P[^.]+)(?P\.mtls)?(?P\.sandbox)?(?P\.googleapis\.com)?" + ) + + m = mtls_endpoint_re.match(api_endpoint) + name, mtls, sandbox, googledomain = m.groups() + if mtls or not googledomain: + return api_endpoint + + if sandbox: + return api_endpoint.replace( + "sandbox.googleapis.com", "mtls.sandbox.googleapis.com" + ) + + return api_endpoint.replace(".googleapis.com", ".mtls.googleapis.com") + + DEFAULT_ENDPOINT = "jobs.googleapis.com" + DEFAULT_MTLS_ENDPOINT = _get_default_mtls_endpoint.__func__( # type: ignore + DEFAULT_ENDPOINT + ) + + @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: + {@api.name}: The constructed client. + """ + credentials = service_account.Credentials.from_service_account_file(filename) + kwargs["credentials"] = credentials + return cls(*args, **kwargs) + + from_service_account_json = from_service_account_file + + @staticmethod + def application_path( + project: str, tenant: str, profile: str, application: str, + ) -> str: + """Return a fully-qualified application string.""" + return "projects/{project}/tenants/{tenant}/profiles/{profile}/applications/{application}".format( + project=project, tenant=tenant, profile=profile, application=application, + ) + + @staticmethod + def parse_application_path(path: str) -> Dict[str, str]: + """Parse a application path into its component segments.""" + m = re.match( + r"^projects/(?P.+?)/tenants/(?P.+?)/profiles/(?P.+?)/applications/(?P.+?)$", + path, + ) + return m.groupdict() if m else {} + + def __init__( + self, + *, + credentials: credentials.Credentials = None, + transport: Union[str, ApplicationServiceTransport] = None, + client_options: ClientOptions = None, + ) -> None: + """Instantiate the application service client. + + Args: + credentials (Optional[google.auth.credentials.Credentials]): The + authorization credentials to attach to requests. These + credentials identify the application to the service; if none + are specified, the client will attempt to ascertain the + credentials from the environment. + transport (Union[str, ~.ApplicationServiceTransport]): The + transport to use. If set to None, a transport is chosen + automatically. + client_options (ClientOptions): Custom options for the client. It + won't take effect if a ``transport`` instance is provided. + (1) The ``api_endpoint`` property can be used to override the + default endpoint provided by the client. GOOGLE_API_USE_MTLS + environment variable can also be used to override the endpoint: + "always" (always use the default mTLS endpoint), "never" (always + use the default regular endpoint, this is the default value for + the environment variable) and "auto" (auto switch to the default + mTLS endpoint if client SSL credentials is present). However, + the ``api_endpoint`` property takes precedence if provided. + (2) The ``client_cert_source`` property is used to provide client + SSL credentials for mutual TLS transport. If not provided, the + default SSL credentials will be used if present. + + Raises: + google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport + creation failed for any reason. + """ + if isinstance(client_options, dict): + client_options = ClientOptions.from_dict(client_options) + if client_options is None: + client_options = ClientOptions.ClientOptions() + + if client_options.api_endpoint is None: + use_mtls_env = os.getenv("GOOGLE_API_USE_MTLS", "never") + if use_mtls_env == "never": + client_options.api_endpoint = self.DEFAULT_ENDPOINT + elif use_mtls_env == "always": + client_options.api_endpoint = self.DEFAULT_MTLS_ENDPOINT + elif use_mtls_env == "auto": + has_client_cert_source = ( + client_options.client_cert_source is not None + or mtls.has_default_client_cert_source() + ) + client_options.api_endpoint = ( + self.DEFAULT_MTLS_ENDPOINT + if has_client_cert_source + else self.DEFAULT_ENDPOINT + ) + else: + raise MutualTLSChannelError( + "Unsupported GOOGLE_API_USE_MTLS value. Accepted values: never, auto, always" + ) + + # Save or instantiate the transport. + # Ordinarily, we provide the transport, but allowing a custom transport + # instance provides an extensibility point for unusual situations. + if isinstance(transport, ApplicationServiceTransport): + # transport is a ApplicationServiceTransport instance. + if credentials or client_options.credentials_file: + raise ValueError( + "When providing a transport instance, " + "provide its credentials directly." + ) + if client_options.scopes: + raise ValueError( + "When providing a transport instance, " + "provide its scopes directly." + ) + self._transport = transport + else: + Transport = type(self).get_transport_class(transport) + self._transport = Transport( + credentials=credentials, + credentials_file=client_options.credentials_file, + host=client_options.api_endpoint, + scopes=client_options.scopes, + api_mtls_endpoint=client_options.api_endpoint, + client_cert_source=client_options.client_cert_source, + quota_project_id=client_options.quota_project_id, + ) + + def create_application( + self, + request: application_service.CreateApplicationRequest = None, + *, + parent: str = None, + application: gct_application.Application = None, + retry: retries.Retry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> gct_application.Application: + r"""Creates a new application entity. + + Args: + request (:class:`~.application_service.CreateApplicationRequest`): + The request object. The Request of the CreateApplication + method. + parent (:class:`str`): + Required. Resource name of the profile under which the + application is created. + + The format is + "projects/{project_id}/tenants/{tenant_id}/profiles/{profile_id}". + For example, "projects/foo/tenants/bar/profiles/baz". + This corresponds to the ``parent`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + application (:class:`~.gct_application.Application`): + Required. The application to be + created. + This corresponds to the ``application`` 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. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + ~.gct_application.Application: + Resource that represents a job + application record of a candidate. + + """ + # Create or coerce a protobuf request object. + # Sanity check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([parent, application]) + if request is not None and has_flattened_params: + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + # Minor optimization to avoid making a copy if the user passes + # in a application_service.CreateApplicationRequest. + # There's no risk of modifying the input as we've already verified + # there are no flattened fields. + if not isinstance(request, application_service.CreateApplicationRequest): + request = application_service.CreateApplicationRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + + if parent is not None: + request.parent = parent + if application is not None: + request.application = application + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.create_application] + + # 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),)), + ) + + # Send the request. + response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + + # Done; return the response. + return response + + def get_application( + self, + request: application_service.GetApplicationRequest = None, + *, + name: str = None, + retry: retries.Retry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> application.Application: + r"""Retrieves specified application. + + Args: + request (:class:`~.application_service.GetApplicationRequest`): + The request object. Request for getting a application by + name. + name (:class:`str`): + Required. The resource name of the application to be + retrieved. + + The format is + "projects/{project_id}/tenants/{tenant_id}/profiles/{profile_id}/applications/{application_id}". + For example, + "projects/foo/tenants/bar/profiles/baz/applications/qux". + This corresponds to the ``name`` 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. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + ~.application.Application: + Resource that represents a job + application record of a candidate. + + """ + # Create or coerce a protobuf request object. + # Sanity check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([name]) + if request is not None and has_flattened_params: + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + # Minor optimization to avoid making a copy if the user passes + # in a application_service.GetApplicationRequest. + # There's no risk of modifying the input as we've already verified + # there are no flattened fields. + if not isinstance(request, application_service.GetApplicationRequest): + request = application_service.GetApplicationRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + + if name is not None: + request.name = name + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.get_application] + + # 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 + + def update_application( + self, + request: application_service.UpdateApplicationRequest = None, + *, + application: gct_application.Application = None, + retry: retries.Retry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> gct_application.Application: + r"""Updates specified application. + + Args: + request (:class:`~.application_service.UpdateApplicationRequest`): + The request object. Request for updating a specified + application. + application (:class:`~.gct_application.Application`): + Required. The application resource to + replace the current resource in the + system. + This corresponds to the ``application`` 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. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + ~.gct_application.Application: + Resource that represents a job + application record of a candidate. + + """ + # Create or coerce a protobuf request object. + # Sanity check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([application]) + if request is not None and has_flattened_params: + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + # Minor optimization to avoid making a copy if the user passes + # in a application_service.UpdateApplicationRequest. + # There's no risk of modifying the input as we've already verified + # there are no flattened fields. + if not isinstance(request, application_service.UpdateApplicationRequest): + request = application_service.UpdateApplicationRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + + if application is not None: + request.application = application + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.update_application] + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata( + (("application.name", request.application.name),) + ), + ) + + # Send the request. + response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + + # Done; return the response. + return response + + def delete_application( + self, + request: application_service.DeleteApplicationRequest = None, + *, + name: str = None, + retry: retries.Retry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> None: + r"""Deletes specified application. + + Args: + request (:class:`~.application_service.DeleteApplicationRequest`): + The request object. Request to delete a application. + name (:class:`str`): + Required. The resource name of the application to be + deleted. + + The format is + "projects/{project_id}/tenants/{tenant_id}/profiles/{profile_id}/applications/{application_id}". + For example, + "projects/foo/tenants/bar/profiles/baz/applications/qux". + This corresponds to the ``name`` 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. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + """ + # Create or coerce a protobuf request object. + # Sanity check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([name]) + if request is not None and has_flattened_params: + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + # Minor optimization to avoid making a copy if the user passes + # in a application_service.DeleteApplicationRequest. + # There's no risk of modifying the input as we've already verified + # there are no flattened fields. + if not isinstance(request, application_service.DeleteApplicationRequest): + request = application_service.DeleteApplicationRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + + if name is not None: + request.name = name + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.delete_application] + + # 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. + rpc( + request, retry=retry, timeout=timeout, metadata=metadata, + ) + + def list_applications( + self, + request: application_service.ListApplicationsRequest = None, + *, + parent: str = None, + retry: retries.Retry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> pagers.ListApplicationsPager: + r"""Lists all applications associated with the profile. + + Args: + request (:class:`~.application_service.ListApplicationsRequest`): + The request object. List applications for which the + client has ACL visibility. + parent (:class:`str`): + Required. Resource name of the profile under which the + application is created. + + The format is + "projects/{project_id}/tenants/{tenant_id}/profiles/{profile_id}", + for example, "projects/foo/tenants/bar/profiles/baz". + This corresponds to the ``parent`` 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. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + ~.pagers.ListApplicationsPager: + The List applications response + object. + Iterating over this object will yield + results and resolve additional pages + automatically. + + """ + # Create or coerce a protobuf request object. + # Sanity check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([parent]) + if request is not None and has_flattened_params: + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + # Minor optimization to avoid making a copy if the user passes + # in a application_service.ListApplicationsRequest. + # There's no risk of modifying the input as we've already verified + # there are no flattened fields. + if not isinstance(request, application_service.ListApplicationsRequest): + request = application_service.ListApplicationsRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + + if parent is not None: + request.parent = parent + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.list_applications] + + # 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),)), + ) + + # Send the request. + response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + + # This method is paged; wrap the response in a pager, which provides + # an `__iter__` convenience method. + response = pagers.ListApplicationsPager( + method=rpc, request=request, response=response, metadata=metadata, + ) + + # Done; return the response. + return response + + +try: + _client_info = gapic_v1.client_info.ClientInfo( + gapic_version=pkg_resources.get_distribution("google-cloud-talent",).version, + ) +except pkg_resources.DistributionNotFound: + _client_info = gapic_v1.client_info.ClientInfo() + + +__all__ = ("ApplicationServiceClient",) diff --git a/google/cloud/talent_v4beta1/services/application_service/pagers.py b/google/cloud/talent_v4beta1/services/application_service/pagers.py new file mode 100644 index 00000000..0525dae8 --- /dev/null +++ b/google/cloud/talent_v4beta1/services/application_service/pagers.py @@ -0,0 +1,151 @@ +# -*- 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. +# + +from typing import Any, AsyncIterable, Awaitable, Callable, Iterable, Sequence, Tuple + +from google.cloud.talent_v4beta1.types import application +from google.cloud.talent_v4beta1.types import application_service + + +class ListApplicationsPager: + """A pager for iterating through ``list_applications`` requests. + + This class thinly wraps an initial + :class:`~.application_service.ListApplicationsResponse` object, and + provides an ``__iter__`` method to iterate through its + ``applications`` field. + + If there are more pages, the ``__iter__`` method will make additional + ``ListApplications`` requests and continue to iterate + through the ``applications`` field on the + corresponding responses. + + All the usual :class:`~.application_service.ListApplicationsResponse` + attributes are available on the pager. If multiple requests are made, only + the most recent response is retained, and thus used for attribute lookup. + """ + + def __init__( + self, + method: Callable[..., application_service.ListApplicationsResponse], + request: application_service.ListApplicationsRequest, + response: application_service.ListApplicationsResponse, + *, + metadata: Sequence[Tuple[str, str]] = () + ): + """Instantiate the pager. + + Args: + method (Callable): The method that was originally called, and + which instantiated this pager. + request (:class:`~.application_service.ListApplicationsRequest`): + The initial request object. + response (:class:`~.application_service.ListApplicationsResponse`): + The initial response object. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + """ + self._method = method + self._request = application_service.ListApplicationsRequest(request) + self._response = response + self._metadata = metadata + + def __getattr__(self, name: str) -> Any: + return getattr(self._response, name) + + @property + def pages(self) -> Iterable[application_service.ListApplicationsResponse]: + 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) + yield self._response + + def __iter__(self) -> Iterable[application.Application]: + for page in self.pages: + yield from page.applications + + def __repr__(self) -> str: + return "{0}<{1!r}>".format(self.__class__.__name__, self._response) + + +class ListApplicationsAsyncPager: + """A pager for iterating through ``list_applications`` requests. + + This class thinly wraps an initial + :class:`~.application_service.ListApplicationsResponse` object, and + provides an ``__aiter__`` method to iterate through its + ``applications`` field. + + If there are more pages, the ``__aiter__`` method will make additional + ``ListApplications`` requests and continue to iterate + through the ``applications`` field on the + corresponding responses. + + All the usual :class:`~.application_service.ListApplicationsResponse` + attributes are available on the pager. If multiple requests are made, only + the most recent response is retained, and thus used for attribute lookup. + """ + + def __init__( + self, + method: Callable[..., Awaitable[application_service.ListApplicationsResponse]], + request: application_service.ListApplicationsRequest, + response: application_service.ListApplicationsResponse, + *, + metadata: Sequence[Tuple[str, str]] = () + ): + """Instantiate the pager. + + Args: + method (Callable): The method that was originally called, and + which instantiated this pager. + request (:class:`~.application_service.ListApplicationsRequest`): + The initial request object. + response (:class:`~.application_service.ListApplicationsResponse`): + The initial response object. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + """ + self._method = method + self._request = application_service.ListApplicationsRequest(request) + self._response = response + self._metadata = metadata + + def __getattr__(self, name: str) -> Any: + return getattr(self._response, name) + + @property + async def pages( + self, + ) -> AsyncIterable[application_service.ListApplicationsResponse]: + 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) + yield self._response + + def __aiter__(self) -> AsyncIterable[application.Application]: + async def async_generator(): + async for page in self.pages: + for response in page.applications: + yield response + + return async_generator() + + def __repr__(self) -> str: + return "{0}<{1!r}>".format(self.__class__.__name__, self._response) diff --git a/google/cloud/talent_v4beta1/services/application_service/transports/__init__.py b/google/cloud/talent_v4beta1/services/application_service/transports/__init__.py new file mode 100644 index 00000000..ef4ac910 --- /dev/null +++ b/google/cloud/talent_v4beta1/services/application_service/transports/__init__.py @@ -0,0 +1,38 @@ +# -*- 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. +# + +from collections import OrderedDict +from typing import Dict, Type + +from .base import ApplicationServiceTransport +from .grpc import ApplicationServiceGrpcTransport +from .grpc_asyncio import ApplicationServiceGrpcAsyncIOTransport + + +# Compile a registry of transports. +_transport_registry = ( + OrderedDict() +) # type: Dict[str, Type[ApplicationServiceTransport]] +_transport_registry["grpc"] = ApplicationServiceGrpcTransport +_transport_registry["grpc_asyncio"] = ApplicationServiceGrpcAsyncIOTransport + + +__all__ = ( + "ApplicationServiceTransport", + "ApplicationServiceGrpcTransport", + "ApplicationServiceGrpcAsyncIOTransport", +) diff --git a/google/cloud/talent_v4beta1/services/application_service/transports/base.py b/google/cloud/talent_v4beta1/services/application_service/transports/base.py new file mode 100644 index 00000000..5dbc0fd6 --- /dev/null +++ b/google/cloud/talent_v4beta1/services/application_service/transports/base.py @@ -0,0 +1,209 @@ +# -*- 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. +# + +import abc +import typing +import pkg_resources + +from google import auth +from google.api_core import exceptions # type: ignore +from google.api_core import gapic_v1 # type: ignore +from google.api_core import retry as retries # type: ignore +from google.auth import credentials # type: ignore + +from google.cloud.talent_v4beta1.types import application +from google.cloud.talent_v4beta1.types import application as gct_application +from google.cloud.talent_v4beta1.types import application_service +from google.protobuf import empty_pb2 as empty # type: ignore + + +try: + _client_info = gapic_v1.client_info.ClientInfo( + gapic_version=pkg_resources.get_distribution("google-cloud-talent",).version, + ) +except pkg_resources.DistributionNotFound: + _client_info = gapic_v1.client_info.ClientInfo() + + +class ApplicationServiceTransport(abc.ABC): + """Abstract transport class for ApplicationService.""" + + AUTH_SCOPES = ( + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/jobs", + ) + + def __init__( + self, + *, + host: str = "jobs.googleapis.com", + credentials: credentials.Credentials = None, + credentials_file: typing.Optional[str] = None, + scopes: typing.Optional[typing.Sequence[str]] = AUTH_SCOPES, + quota_project_id: typing.Optional[str] = None, + **kwargs, + ) -> None: + """Instantiate the transport. + + Args: + host (Optional[str]): The hostname to connect to. + credentials (Optional[google.auth.credentials.Credentials]): The + authorization credentials to attach to requests. These + credentials identify the application to the service; if none + are specified, the client will attempt to ascertain the + credentials from the environment. + credentials_file (Optional[str]): A file with credentials that can + be loaded with :func:`google.auth.load_credentials_from_file`. + This argument is mutually exclusive with credentials. + scope (Optional[Sequence[str]]): A list of scopes. + quota_project_id (Optional[str]): An optional project to use for billing + and quota. + """ + # Save the hostname. Default to port 443 (HTTPS) if none is specified. + if ":" not in host: + host += ":443" + self._host = host + + # If no credentials are provided, then determine the appropriate + # defaults. + if credentials and credentials_file: + raise exceptions.DuplicateCredentialArgs( + "'credentials_file' and 'credentials' are mutually exclusive" + ) + + if credentials_file is not None: + credentials, _ = auth.load_credentials_from_file( + credentials_file, scopes=scopes, quota_project_id=quota_project_id + ) + + elif credentials is None: + credentials, _ = auth.default( + scopes=scopes, quota_project_id=quota_project_id + ) + + # Save the credentials. + self._credentials = credentials + + # Lifted into its own function so it can be stubbed out during tests. + self._prep_wrapped_messages() + + def _prep_wrapped_messages(self): + # Precompute the wrapped methods. + self._wrapped_methods = { + self.create_application: gapic_v1.method.wrap_method( + self.create_application, default_timeout=30.0, client_info=_client_info, + ), + self.get_application: gapic_v1.method.wrap_method( + self.get_application, + default_retry=retries.Retry( + initial=0.1, + maximum=60.0, + multiplier=1.3, + predicate=retries.if_exception_type( + exceptions.ServiceUnavailable, exceptions.DeadlineExceeded, + ), + ), + default_timeout=30.0, + client_info=_client_info, + ), + self.update_application: gapic_v1.method.wrap_method( + self.update_application, default_timeout=30.0, client_info=_client_info, + ), + self.delete_application: gapic_v1.method.wrap_method( + self.delete_application, + default_retry=retries.Retry( + initial=0.1, + maximum=60.0, + multiplier=1.3, + predicate=retries.if_exception_type( + exceptions.ServiceUnavailable, exceptions.DeadlineExceeded, + ), + ), + default_timeout=30.0, + client_info=_client_info, + ), + self.list_applications: gapic_v1.method.wrap_method( + self.list_applications, + default_retry=retries.Retry( + initial=0.1, + maximum=60.0, + multiplier=1.3, + predicate=retries.if_exception_type( + exceptions.ServiceUnavailable, exceptions.DeadlineExceeded, + ), + ), + default_timeout=30.0, + client_info=_client_info, + ), + } + + @property + def create_application( + self, + ) -> typing.Callable[ + [application_service.CreateApplicationRequest], + typing.Union[ + gct_application.Application, typing.Awaitable[gct_application.Application] + ], + ]: + raise NotImplementedError() + + @property + def get_application( + self, + ) -> typing.Callable[ + [application_service.GetApplicationRequest], + typing.Union[ + application.Application, typing.Awaitable[application.Application] + ], + ]: + raise NotImplementedError() + + @property + def update_application( + self, + ) -> typing.Callable[ + [application_service.UpdateApplicationRequest], + typing.Union[ + gct_application.Application, typing.Awaitable[gct_application.Application] + ], + ]: + raise NotImplementedError() + + @property + def delete_application( + self, + ) -> typing.Callable[ + [application_service.DeleteApplicationRequest], + typing.Union[empty.Empty, typing.Awaitable[empty.Empty]], + ]: + raise NotImplementedError() + + @property + def list_applications( + self, + ) -> typing.Callable[ + [application_service.ListApplicationsRequest], + typing.Union[ + application_service.ListApplicationsResponse, + typing.Awaitable[application_service.ListApplicationsResponse], + ], + ]: + raise NotImplementedError() + + +__all__ = ("ApplicationServiceTransport",) diff --git a/google/cloud/talent_v4beta1/services/application_service/transports/grpc.py b/google/cloud/talent_v4beta1/services/application_service/transports/grpc.py new file mode 100644 index 00000000..2d6a96cb --- /dev/null +++ b/google/cloud/talent_v4beta1/services/application_service/transports/grpc.py @@ -0,0 +1,348 @@ +# -*- 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. +# + +from typing import Callable, Dict, Optional, Sequence, Tuple + +from google.api_core import grpc_helpers # type: ignore +from google import auth # type: ignore +from google.auth import credentials # type: ignore +from google.auth.transport.grpc import SslCredentials # type: ignore + + +import grpc # type: ignore + +from google.cloud.talent_v4beta1.types import application +from google.cloud.talent_v4beta1.types import application as gct_application +from google.cloud.talent_v4beta1.types import application_service +from google.protobuf import empty_pb2 as empty # type: ignore + +from .base import ApplicationServiceTransport + + +class ApplicationServiceGrpcTransport(ApplicationServiceTransport): + """gRPC backend transport for ApplicationService. + + A service that handles application management, including CRUD + and enumeration. + + This class defines the same methods as the primary client, so the + primary client can load the underlying transport implementation + and call it. + + It sends protocol buffers over the wire using gRPC (which is built on + top of HTTP/2); the ``grpcio`` package must be installed. + """ + + _stubs: Dict[str, Callable] + + def __init__( + self, + *, + host: str = "jobs.googleapis.com", + credentials: credentials.Credentials = None, + credentials_file: str = None, + scopes: Sequence[str] = None, + channel: grpc.Channel = None, + api_mtls_endpoint: str = None, + client_cert_source: Callable[[], Tuple[bytes, bytes]] = None, + quota_project_id: Optional[str] = None + ) -> None: + """Instantiate the transport. + + Args: + host (Optional[str]): The hostname to connect to. + credentials (Optional[google.auth.credentials.Credentials]): The + authorization credentials to attach to requests. These + credentials identify the application to the service; if none + are specified, the client will attempt to ascertain the + credentials from the environment. + This argument is ignored if ``channel`` is provided. + credentials_file (Optional[str]): A file with credentials that can + be loaded with :func:`google.auth.load_credentials_from_file`. + This argument is ignored if ``channel`` is provided. + scopes (Optional(Sequence[str])): A list of scopes. This argument is + ignored if ``channel`` is provided. + channel (Optional[grpc.Channel]): A ``Channel`` instance through + which to make calls. + api_mtls_endpoint (Optional[str]): The mutual TLS endpoint. If + provided, it overrides the ``host`` argument and tries to create + a mutual TLS channel with client SSL credentials from + ``client_cert_source`` or applicatin default SSL credentials. + client_cert_source (Optional[Callable[[], Tuple[bytes, bytes]]]): A + callback to provide client SSL certificate bytes and private key + bytes, both in PEM format. It is ignored if ``api_mtls_endpoint`` + is None. + quota_project_id (Optional[str]): An optional project to use for billing + and quota. + + Raises: + google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport + creation failed for any reason. + google.api_core.exceptions.DuplicateCredentialArgs: If both ``credentials`` + and ``credentials_file`` are passed. + """ + if channel: + # Sanity check: Ensure that channel and credentials are not both + # provided. + credentials = False + + # If a channel was explicitly provided, set it. + self._grpc_channel = channel + elif api_mtls_endpoint: + host = ( + api_mtls_endpoint + if ":" in api_mtls_endpoint + else api_mtls_endpoint + ":443" + ) + + if credentials is None: + credentials, _ = auth.default( + scopes=self.AUTH_SCOPES, quota_project_id=quota_project_id + ) + + # Create SSL credentials with client_cert_source or application + # default SSL credentials. + if client_cert_source: + cert, key = client_cert_source() + ssl_credentials = grpc.ssl_channel_credentials( + certificate_chain=cert, private_key=key + ) + else: + ssl_credentials = SslCredentials().ssl_credentials + + # create a new channel. The provided one is ignored. + self._grpc_channel = type(self).create_channel( + host, + credentials=credentials, + credentials_file=credentials_file, + ssl_credentials=ssl_credentials, + scopes=scopes or self.AUTH_SCOPES, + quota_project_id=quota_project_id, + ) + + self._stubs = {} # type: Dict[str, Callable] + + # Run the base constructor. + super().__init__( + host=host, + credentials=credentials, + credentials_file=credentials_file, + scopes=scopes or self.AUTH_SCOPES, + quota_project_id=quota_project_id, + ) + + @classmethod + def create_channel( + cls, + host: str = "jobs.googleapis.com", + credentials: credentials.Credentials = None, + credentials_file: str = None, + scopes: Optional[Sequence[str]] = None, + quota_project_id: Optional[str] = None, + **kwargs + ) -> grpc.Channel: + """Create and return a gRPC channel object. + Args: + address (Optionsl[str]): The host for the channel to use. + credentials (Optional[~.Credentials]): The + authorization credentials to attach to requests. These + credentials identify this application to the service. If + none are specified, the client will attempt to ascertain + the credentials from the environment. + credentials_file (Optional[str]): A file with credentials that can + be loaded with :func:`google.auth.load_credentials_from_file`. + This argument is mutually exclusive with credentials. + scopes (Optional[Sequence[str]]): A optional list of scopes needed for this + service. These are only used when credentials are not specified and + are passed to :func:`google.auth.default`. + quota_project_id (Optional[str]): An optional project to use for billing + and quota. + kwargs (Optional[dict]): Keyword arguments, which are passed to the + channel creation. + Returns: + grpc.Channel: A gRPC channel object. + + Raises: + google.api_core.exceptions.DuplicateCredentialArgs: If both ``credentials`` + and ``credentials_file`` are passed. + """ + scopes = scopes or cls.AUTH_SCOPES + return grpc_helpers.create_channel( + host, + credentials=credentials, + credentials_file=credentials_file, + scopes=scopes, + quota_project_id=quota_project_id, + **kwargs + ) + + @property + def grpc_channel(self) -> grpc.Channel: + """Create the channel designed to connect to this service. + + This property caches on the instance; repeated calls return + the same channel. + """ + # Sanity check: Only create a new channel if we do not already + # have one. + if not hasattr(self, "_grpc_channel"): + self._grpc_channel = self.create_channel( + self._host, credentials=self._credentials, + ) + + # Return the channel from cache. + return self._grpc_channel + + @property + def create_application( + self, + ) -> Callable[ + [application_service.CreateApplicationRequest], gct_application.Application + ]: + r"""Return a callable for the create application method over gRPC. + + Creates a new application entity. + + Returns: + Callable[[~.CreateApplicationRequest], + ~.Application]: + A function that, when called, will call the underlying RPC + on the server. + """ + # 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 "create_application" not in self._stubs: + self._stubs["create_application"] = self.grpc_channel.unary_unary( + "/google.cloud.talent.v4beta1.ApplicationService/CreateApplication", + request_serializer=application_service.CreateApplicationRequest.serialize, + response_deserializer=gct_application.Application.deserialize, + ) + return self._stubs["create_application"] + + @property + def get_application( + self, + ) -> Callable[[application_service.GetApplicationRequest], application.Application]: + r"""Return a callable for the get application method over gRPC. + + Retrieves specified application. + + Returns: + Callable[[~.GetApplicationRequest], + ~.Application]: + A function that, when called, will call the underlying RPC + on the server. + """ + # 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_application" not in self._stubs: + self._stubs["get_application"] = self.grpc_channel.unary_unary( + "/google.cloud.talent.v4beta1.ApplicationService/GetApplication", + request_serializer=application_service.GetApplicationRequest.serialize, + response_deserializer=application.Application.deserialize, + ) + return self._stubs["get_application"] + + @property + def update_application( + self, + ) -> Callable[ + [application_service.UpdateApplicationRequest], gct_application.Application + ]: + r"""Return a callable for the update application method over gRPC. + + Updates specified application. + + Returns: + Callable[[~.UpdateApplicationRequest], + ~.Application]: + A function that, when called, will call the underlying RPC + on the server. + """ + # 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 "update_application" not in self._stubs: + self._stubs["update_application"] = self.grpc_channel.unary_unary( + "/google.cloud.talent.v4beta1.ApplicationService/UpdateApplication", + request_serializer=application_service.UpdateApplicationRequest.serialize, + response_deserializer=gct_application.Application.deserialize, + ) + return self._stubs["update_application"] + + @property + def delete_application( + self, + ) -> Callable[[application_service.DeleteApplicationRequest], empty.Empty]: + r"""Return a callable for the delete application method over gRPC. + + Deletes specified application. + + Returns: + Callable[[~.DeleteApplicationRequest], + ~.Empty]: + A function that, when called, will call the underlying RPC + on the server. + """ + # 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 "delete_application" not in self._stubs: + self._stubs["delete_application"] = self.grpc_channel.unary_unary( + "/google.cloud.talent.v4beta1.ApplicationService/DeleteApplication", + request_serializer=application_service.DeleteApplicationRequest.serialize, + response_deserializer=empty.Empty.FromString, + ) + return self._stubs["delete_application"] + + @property + def list_applications( + self, + ) -> Callable[ + [application_service.ListApplicationsRequest], + application_service.ListApplicationsResponse, + ]: + r"""Return a callable for the list applications method over gRPC. + + Lists all applications associated with the profile. + + Returns: + Callable[[~.ListApplicationsRequest], + ~.ListApplicationsResponse]: + A function that, when called, will call the underlying RPC + on the server. + """ + # 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 "list_applications" not in self._stubs: + self._stubs["list_applications"] = self.grpc_channel.unary_unary( + "/google.cloud.talent.v4beta1.ApplicationService/ListApplications", + request_serializer=application_service.ListApplicationsRequest.serialize, + response_deserializer=application_service.ListApplicationsResponse.deserialize, + ) + return self._stubs["list_applications"] + + +__all__ = ("ApplicationServiceGrpcTransport",) diff --git a/google/cloud/talent_v4beta1/services/application_service/transports/grpc_asyncio.py b/google/cloud/talent_v4beta1/services/application_service/transports/grpc_asyncio.py new file mode 100644 index 00000000..d4cc0a9a --- /dev/null +++ b/google/cloud/talent_v4beta1/services/application_service/transports/grpc_asyncio.py @@ -0,0 +1,347 @@ +# -*- 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. +# + +from typing import Awaitable, Callable, Dict, Optional, Sequence, Tuple + +from google.api_core import grpc_helpers_async # type: ignore +from google.auth import credentials # type: ignore +from google.auth.transport.grpc import SslCredentials # type: ignore + +import grpc # type: ignore +from grpc.experimental import aio # type: ignore + +from google.cloud.talent_v4beta1.types import application +from google.cloud.talent_v4beta1.types import application as gct_application +from google.cloud.talent_v4beta1.types import application_service +from google.protobuf import empty_pb2 as empty # type: ignore + +from .base import ApplicationServiceTransport +from .grpc import ApplicationServiceGrpcTransport + + +class ApplicationServiceGrpcAsyncIOTransport(ApplicationServiceTransport): + """gRPC AsyncIO backend transport for ApplicationService. + + A service that handles application management, including CRUD + and enumeration. + + This class defines the same methods as the primary client, so the + primary client can load the underlying transport implementation + and call it. + + It sends protocol buffers over the wire using gRPC (which is built on + top of HTTP/2); the ``grpcio`` package must be installed. + """ + + _grpc_channel: aio.Channel + _stubs: Dict[str, Callable] = {} + + @classmethod + def create_channel( + cls, + host: str = "jobs.googleapis.com", + credentials: credentials.Credentials = None, + credentials_file: Optional[str] = None, + scopes: Optional[Sequence[str]] = None, + quota_project_id: Optional[str] = None, + **kwargs, + ) -> aio.Channel: + """Create and return a gRPC AsyncIO channel object. + Args: + address (Optional[str]): The host for the channel to use. + credentials (Optional[~.Credentials]): The + authorization credentials to attach to requests. These + credentials identify this application to the service. If + none are specified, the client will attempt to ascertain + the credentials from the environment. + credentials_file (Optional[str]): A file with credentials that can + be loaded with :func:`google.auth.load_credentials_from_file`. + This argument is ignored if ``channel`` is provided. + scopes (Optional[Sequence[str]]): A optional list of scopes needed for this + service. These are only used when credentials are not specified and + are passed to :func:`google.auth.default`. + quota_project_id (Optional[str]): An optional project to use for billing + and quota. + kwargs (Optional[dict]): Keyword arguments, which are passed to the + channel creation. + Returns: + aio.Channel: A gRPC AsyncIO channel object. + """ + scopes = scopes or cls.AUTH_SCOPES + return grpc_helpers_async.create_channel( + host, + credentials=credentials, + credentials_file=credentials_file, + scopes=scopes, + quota_project_id=quota_project_id, + **kwargs, + ) + + def __init__( + self, + *, + host: str = "jobs.googleapis.com", + credentials: credentials.Credentials = None, + credentials_file: Optional[str] = None, + scopes: Optional[Sequence[str]] = None, + channel: aio.Channel = None, + api_mtls_endpoint: str = None, + client_cert_source: Callable[[], Tuple[bytes, bytes]] = None, + quota_project_id=None, + ) -> None: + """Instantiate the transport. + + Args: + host (Optional[str]): The hostname to connect to. + credentials (Optional[google.auth.credentials.Credentials]): The + authorization credentials to attach to requests. These + credentials identify the application to the service; if none + are specified, the client will attempt to ascertain the + credentials from the environment. + This argument is ignored if ``channel`` is provided. + credentials_file (Optional[str]): A file with credentials that can + be loaded with :func:`google.auth.load_credentials_from_file`. + This argument is ignored if ``channel`` is provided. + scopes (Optional[Sequence[str]]): A optional list of scopes needed for this + service. These are only used when credentials are not specified and + are passed to :func:`google.auth.default`. + channel (Optional[aio.Channel]): A ``Channel`` instance through + which to make calls. + api_mtls_endpoint (Optional[str]): The mutual TLS endpoint. If + provided, it overrides the ``host`` argument and tries to create + a mutual TLS channel with client SSL credentials from + ``client_cert_source`` or applicatin default SSL credentials. + client_cert_source (Optional[Callable[[], Tuple[bytes, bytes]]]): A + callback to provide client SSL certificate bytes and private key + bytes, both in PEM format. It is ignored if ``api_mtls_endpoint`` + is None. + quota_project_id (Optional[str]): An optional project to use for billing + and quota. + + Raises: + google.auth.exceptions.MutualTlsChannelError: If mutual TLS transport + creation failed for any reason. + google.api_core.exceptions.DuplicateCredentialArgs: If both ``credentials`` + and ``credentials_file`` are passed. + """ + if channel: + # Sanity check: Ensure that channel and credentials are not both + # provided. + credentials = False + + # If a channel was explicitly provided, set it. + self._grpc_channel = channel + elif api_mtls_endpoint: + host = ( + api_mtls_endpoint + if ":" in api_mtls_endpoint + else api_mtls_endpoint + ":443" + ) + + # Create SSL credentials with client_cert_source or application + # default SSL credentials. + if client_cert_source: + cert, key = client_cert_source() + ssl_credentials = grpc.ssl_channel_credentials( + certificate_chain=cert, private_key=key + ) + else: + ssl_credentials = SslCredentials().ssl_credentials + + # create a new channel. The provided one is ignored. + self._grpc_channel = type(self).create_channel( + host, + credentials=credentials, + credentials_file=credentials_file, + ssl_credentials=ssl_credentials, + scopes=scopes or self.AUTH_SCOPES, + quota_project_id=quota_project_id, + ) + + # Run the base constructor. + super().__init__( + host=host, + credentials=credentials, + credentials_file=credentials_file, + scopes=scopes or self.AUTH_SCOPES, + quota_project_id=quota_project_id, + ) + + self._stubs = {} + + @property + def grpc_channel(self) -> aio.Channel: + """Create the channel designed to connect to this service. + + This property caches on the instance; repeated calls return + the same channel. + """ + # Sanity check: Only create a new channel if we do not already + # have one. + if not hasattr(self, "_grpc_channel"): + self._grpc_channel = self.create_channel( + self._host, credentials=self._credentials, + ) + + # Return the channel from cache. + return self._grpc_channel + + @property + def create_application( + self, + ) -> Callable[ + [application_service.CreateApplicationRequest], + Awaitable[gct_application.Application], + ]: + r"""Return a callable for the create application method over gRPC. + + Creates a new application entity. + + Returns: + Callable[[~.CreateApplicationRequest], + Awaitable[~.Application]]: + A function that, when called, will call the underlying RPC + on the server. + """ + # 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 "create_application" not in self._stubs: + self._stubs["create_application"] = self.grpc_channel.unary_unary( + "/google.cloud.talent.v4beta1.ApplicationService/CreateApplication", + request_serializer=application_service.CreateApplicationRequest.serialize, + response_deserializer=gct_application.Application.deserialize, + ) + return self._stubs["create_application"] + + @property + def get_application( + self, + ) -> Callable[ + [application_service.GetApplicationRequest], Awaitable[application.Application] + ]: + r"""Return a callable for the get application method over gRPC. + + Retrieves specified application. + + Returns: + Callable[[~.GetApplicationRequest], + Awaitable[~.Application]]: + A function that, when called, will call the underlying RPC + on the server. + """ + # 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_application" not in self._stubs: + self._stubs["get_application"] = self.grpc_channel.unary_unary( + "/google.cloud.talent.v4beta1.ApplicationService/GetApplication", + request_serializer=application_service.GetApplicationRequest.serialize, + response_deserializer=application.Application.deserialize, + ) + return self._stubs["get_application"] + + @property + def update_application( + self, + ) -> Callable[ + [application_service.UpdateApplicationRequest], + Awaitable[gct_application.Application], + ]: + r"""Return a callable for the update application method over gRPC. + + Updates specified application. + + Returns: + Callable[[~.UpdateApplicationRequest], + Awaitable[~.Application]]: + A function that, when called, will call the underlying RPC + on the server. + """ + # 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 "update_application" not in self._stubs: + self._stubs["update_application"] = self.grpc_channel.unary_unary( + "/google.cloud.talent.v4beta1.ApplicationService/UpdateApplication", + request_serializer=application_service.UpdateApplicationRequest.serialize, + response_deserializer=gct_application.Application.deserialize, + ) + return self._stubs["update_application"] + + @property + def delete_application( + self, + ) -> Callable[ + [application_service.DeleteApplicationRequest], Awaitable[empty.Empty] + ]: + r"""Return a callable for the delete application method over gRPC. + + Deletes specified application. + + Returns: + Callable[[~.DeleteApplicationRequest], + Awaitable[~.Empty]]: + A function that, when called, will call the underlying RPC + on the server. + """ + # 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 "delete_application" not in self._stubs: + self._stubs["delete_application"] = self.grpc_channel.unary_unary( + "/google.cloud.talent.v4beta1.ApplicationService/DeleteApplication", + request_serializer=application_service.DeleteApplicationRequest.serialize, + response_deserializer=empty.Empty.FromString, + ) + return self._stubs["delete_application"] + + @property + def list_applications( + self, + ) -> Callable[ + [application_service.ListApplicationsRequest], + Awaitable[application_service.ListApplicationsResponse], + ]: + r"""Return a callable for the list applications method over gRPC. + + Lists all applications associated with the profile. + + Returns: + Callable[[~.ListApplicationsRequest], + Awaitable[~.ListApplicationsResponse]]: + A function that, when called, will call the underlying RPC + on the server. + """ + # 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 "list_applications" not in self._stubs: + self._stubs["list_applications"] = self.grpc_channel.unary_unary( + "/google.cloud.talent.v4beta1.ApplicationService/ListApplications", + request_serializer=application_service.ListApplicationsRequest.serialize, + response_deserializer=application_service.ListApplicationsResponse.deserialize, + ) + return self._stubs["list_applications"] + + +__all__ = ("ApplicationServiceGrpcAsyncIOTransport",) diff --git a/google/__init__.py b/google/cloud/talent_v4beta1/services/company_service/__init__.py similarity index 71% rename from google/__init__.py rename to google/cloud/talent_v4beta1/services/company_service/__init__.py index 9a1b64a6..a7154172 100644 --- a/google/__init__.py +++ b/google/cloud/talent_v4beta1/services/company_service/__init__.py @@ -1,24 +1,24 @@ # -*- 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 # -# https://www.apache.org/licenses/LICENSE-2.0 +# 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. +# -try: - import pkg_resources - - pkg_resources.declare_namespace(__name__) -except ImportError: - import pkgutil +from .client import CompanyServiceClient +from .async_client import CompanyServiceAsyncClient - __path__ = pkgutil.extend_path(__path__, __name__) +__all__ = ( + "CompanyServiceClient", + "CompanyServiceAsyncClient", +) diff --git a/google/cloud/talent_v4beta1/services/company_service/async_client.py b/google/cloud/talent_v4beta1/services/company_service/async_client.py new file mode 100644 index 00000000..1fd21447 --- /dev/null +++ b/google/cloud/talent_v4beta1/services/company_service/async_client.py @@ -0,0 +1,543 @@ +# -*- 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. +# + +from collections import OrderedDict +import functools +import re +from typing import Dict, Sequence, Tuple, Type, Union +import pkg_resources + +import google.api_core.client_options as ClientOptions # type: ignore +from google.api_core import exceptions # type: ignore +from google.api_core import gapic_v1 # type: ignore +from google.api_core import retry as retries # type: ignore +from google.auth import credentials # type: ignore +from google.oauth2 import service_account # type: ignore + +from google.cloud.talent_v4beta1.services.company_service import pagers +from google.cloud.talent_v4beta1.types import common +from google.cloud.talent_v4beta1.types import company +from google.cloud.talent_v4beta1.types import company as gct_company +from google.cloud.talent_v4beta1.types import company_service + +from .transports.base import CompanyServiceTransport +from .transports.grpc_asyncio import CompanyServiceGrpcAsyncIOTransport +from .client import CompanyServiceClient + + +class CompanyServiceAsyncClient: + """A service that handles company management, including CRUD and + enumeration. + """ + + _client: CompanyServiceClient + + DEFAULT_ENDPOINT = CompanyServiceClient.DEFAULT_ENDPOINT + DEFAULT_MTLS_ENDPOINT = CompanyServiceClient.DEFAULT_MTLS_ENDPOINT + + company_path = staticmethod(CompanyServiceClient.company_path) + + from_service_account_file = CompanyServiceClient.from_service_account_file + from_service_account_json = from_service_account_file + + get_transport_class = functools.partial( + type(CompanyServiceClient).get_transport_class, type(CompanyServiceClient) + ) + + def __init__( + self, + *, + credentials: credentials.Credentials = None, + transport: Union[str, CompanyServiceTransport] = "grpc_asyncio", + client_options: ClientOptions = None, + ) -> None: + """Instantiate the company service client. + + Args: + credentials (Optional[google.auth.credentials.Credentials]): The + authorization credentials to attach to requests. These + credentials identify the application to the service; if none + are specified, the client will attempt to ascertain the + credentials from the environment. + transport (Union[str, ~.CompanyServiceTransport]): The + transport to use. If set to None, a transport is chosen + automatically. + client_options (ClientOptions): Custom options for the client. It + won't take effect if a ``transport`` instance is provided. + (1) The ``api_endpoint`` property can be used to override the + default endpoint provided by the client. GOOGLE_API_USE_MTLS + environment variable can also be used to override the endpoint: + "always" (always use the default mTLS endpoint), "never" (always + use the default regular endpoint, this is the default value for + the environment variable) and "auto" (auto switch to the default + mTLS endpoint if client SSL credentials is present). However, + the ``api_endpoint`` property takes precedence if provided. + (2) The ``client_cert_source`` property is used to provide client + SSL credentials for mutual TLS transport. If not provided, the + default SSL credentials will be used if present. + + Raises: + google.auth.exceptions.MutualTlsChannelError: If mutual TLS transport + creation failed for any reason. + """ + + self._client = CompanyServiceClient( + credentials=credentials, transport=transport, client_options=client_options, + ) + + async def create_company( + self, + request: company_service.CreateCompanyRequest = None, + *, + parent: str = None, + company: gct_company.Company = None, + retry: retries.Retry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> gct_company.Company: + r"""Creates a new company entity. + + Args: + request (:class:`~.company_service.CreateCompanyRequest`): + The request object. The Request of the CreateCompany + method. + parent (:class:`str`): + Required. Resource name of the tenant under which the + company is created. + + The format is + "projects/{project_id}/tenants/{tenant_id}", for + example, "projects/foo/tenant/bar". If tenant id is + unspecified, a default tenant is created, for example, + "projects/foo". + This corresponds to the ``parent`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + company (:class:`~.gct_company.Company`): + Required. The company to be created. + This corresponds to the ``company`` 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. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + ~.gct_company.Company: + A Company resource represents a + company in the service. A company is the + entity that owns job postings, that is, + the hiring entity responsible for + employing applicants for the job + position. + + """ + # Create or coerce a protobuf request object. + # Sanity check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + if request is not None and any([parent, company]): + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + request = company_service.CreateCompanyRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + + if parent is not None: + request.parent = parent + if company is not None: + request.company = company + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.create_company, + default_timeout=30.0, + client_info=_client_info, + ) + + # 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),)), + ) + + # Send the request. + response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + + # Done; return the response. + return response + + async def get_company( + self, + request: company_service.GetCompanyRequest = None, + *, + name: str = None, + retry: retries.Retry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> company.Company: + r"""Retrieves specified company. + + Args: + request (:class:`~.company_service.GetCompanyRequest`): + The request object. Request for getting a company by + name. + name (:class:`str`): + Required. The resource name of the company to be + retrieved. + + The format is + "projects/{project_id}/tenants/{tenant_id}/companies/{company_id}", + for example, + "projects/api-test-project/tenants/foo/companies/bar". + + If tenant id is unspecified, the default tenant is used, + for example, "projects/api-test-project/companies/bar". + This corresponds to the ``name`` 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. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + ~.company.Company: + A Company resource represents a + company in the service. A company is the + entity that owns job postings, that is, + the hiring entity responsible for + employing applicants for the job + position. + + """ + # Create or coerce a protobuf request object. + # Sanity check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + if request is not None and any([name]): + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + request = company_service.GetCompanyRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + + if name is not None: + request.name = name + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.get_company, + default_retry=retries.Retry( + initial=0.1, + maximum=60.0, + multiplier=1.3, + predicate=retries.if_exception_type( + exceptions.ServiceUnavailable, exceptions.DeadlineExceeded, + ), + ), + default_timeout=30.0, + client_info=_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 update_company( + self, + request: company_service.UpdateCompanyRequest = None, + *, + company: gct_company.Company = None, + retry: retries.Retry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> gct_company.Company: + r"""Updates specified company. + + Args: + request (:class:`~.company_service.UpdateCompanyRequest`): + The request object. Request for updating a specified + company. + company (:class:`~.gct_company.Company`): + Required. The company resource to + replace the current resource in the + system. + This corresponds to the ``company`` 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. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + ~.gct_company.Company: + A Company resource represents a + company in the service. A company is the + entity that owns job postings, that is, + the hiring entity responsible for + employing applicants for the job + position. + + """ + # Create or coerce a protobuf request object. + # Sanity check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + if request is not None and any([company]): + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + request = company_service.UpdateCompanyRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + + if company is not None: + request.company = company + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.update_company, + default_timeout=30.0, + client_info=_client_info, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata( + (("company.name", request.company.name),) + ), + ) + + # Send the request. + response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + + # Done; return the response. + return response + + async def delete_company( + self, + request: company_service.DeleteCompanyRequest = None, + *, + name: str = None, + retry: retries.Retry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> None: + r"""Deletes specified company. + Prerequisite: The company has no jobs associated with + it. + + Args: + request (:class:`~.company_service.DeleteCompanyRequest`): + The request object. Request to delete a company. + name (:class:`str`): + Required. The resource name of the company to be + deleted. + + The format is + "projects/{project_id}/tenants/{tenant_id}/companies/{company_id}", + for example, "projects/foo/tenants/bar/companies/baz". + + If tenant id is unspecified, the default tenant is used, + for example, "projects/foo/companies/bar". + This corresponds to the ``name`` 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. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + """ + # Create or coerce a protobuf request object. + # Sanity check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + if request is not None and any([name]): + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + request = company_service.DeleteCompanyRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + + if name is not None: + request.name = name + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.delete_company, + default_retry=retries.Retry( + initial=0.1, + maximum=60.0, + multiplier=1.3, + predicate=retries.if_exception_type( + exceptions.ServiceUnavailable, exceptions.DeadlineExceeded, + ), + ), + default_timeout=30.0, + client_info=_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. + await rpc( + request, retry=retry, timeout=timeout, metadata=metadata, + ) + + async def list_companies( + self, + request: company_service.ListCompaniesRequest = None, + *, + parent: str = None, + retry: retries.Retry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> pagers.ListCompaniesAsyncPager: + r"""Lists all companies associated with the project. + + Args: + request (:class:`~.company_service.ListCompaniesRequest`): + The request object. List companies for which the client + has ACL visibility. + parent (:class:`str`): + Required. Resource name of the tenant under which the + company is created. + + The format is + "projects/{project_id}/tenants/{tenant_id}", for + example, "projects/foo/tenant/bar". + + If tenant id is unspecified, the default tenant will be + used, for example, "projects/foo". + This corresponds to the ``parent`` 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. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + ~.pagers.ListCompaniesAsyncPager: + The List companies response object. + Iterating over this object will yield + results and resolve additional pages + automatically. + + """ + # Create or coerce a protobuf request object. + # Sanity check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + if request is not None and any([parent]): + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + request = company_service.ListCompaniesRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + + if parent is not None: + request.parent = parent + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.list_companies, + default_retry=retries.Retry( + initial=0.1, + maximum=60.0, + multiplier=1.3, + predicate=retries.if_exception_type( + exceptions.ServiceUnavailable, exceptions.DeadlineExceeded, + ), + ), + default_timeout=30.0, + client_info=_client_info, + ) + + # 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),)), + ) + + # Send the request. + response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + + # This method is paged; wrap the response in a pager, which provides + # an `__aiter__` convenience method. + response = pagers.ListCompaniesAsyncPager( + method=rpc, request=request, response=response, metadata=metadata, + ) + + # Done; return the response. + return response + + +try: + _client_info = gapic_v1.client_info.ClientInfo( + gapic_version=pkg_resources.get_distribution("google-cloud-talent",).version, + ) +except pkg_resources.DistributionNotFound: + _client_info = gapic_v1.client_info.ClientInfo() + + +__all__ = ("CompanyServiceAsyncClient",) diff --git a/google/cloud/talent_v4beta1/services/company_service/client.py b/google/cloud/talent_v4beta1/services/company_service/client.py new file mode 100644 index 00000000..0a323981 --- /dev/null +++ b/google/cloud/talent_v4beta1/services/company_service/client.py @@ -0,0 +1,669 @@ +# -*- 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. +# + +from collections import OrderedDict +import os +import re +from typing import Callable, Dict, Sequence, Tuple, Type, Union +import pkg_resources + +import google.api_core.client_options as ClientOptions # type: ignore +from google.api_core import exceptions # type: ignore +from google.api_core import gapic_v1 # type: ignore +from google.api_core import retry as retries # type: ignore +from google.auth import credentials # type: ignore +from google.auth.transport import mtls # type: ignore +from google.auth.exceptions import MutualTLSChannelError # type: ignore +from google.oauth2 import service_account # type: ignore + +from google.cloud.talent_v4beta1.services.company_service import pagers +from google.cloud.talent_v4beta1.types import common +from google.cloud.talent_v4beta1.types import company +from google.cloud.talent_v4beta1.types import company as gct_company +from google.cloud.talent_v4beta1.types import company_service + +from .transports.base import CompanyServiceTransport +from .transports.grpc import CompanyServiceGrpcTransport +from .transports.grpc_asyncio import CompanyServiceGrpcAsyncIOTransport + + +class CompanyServiceClientMeta(type): + """Metaclass for the CompanyService client. + + This provides class-level methods for building and retrieving + support objects (e.g. transport) without polluting the client instance + objects. + """ + + _transport_registry = ( + OrderedDict() + ) # type: Dict[str, Type[CompanyServiceTransport]] + _transport_registry["grpc"] = CompanyServiceGrpcTransport + _transport_registry["grpc_asyncio"] = CompanyServiceGrpcAsyncIOTransport + + def get_transport_class(cls, label: str = None,) -> Type[CompanyServiceTransport]: + """Return an appropriate transport class. + + Args: + label: The name of the desired transport. If none is + provided, then the first transport in the registry is used. + + Returns: + The transport class to use. + """ + # If a specific transport is requested, return that one. + if label: + return cls._transport_registry[label] + + # No transport is requested; return the default (that is, the first one + # in the dictionary). + return next(iter(cls._transport_registry.values())) + + +class CompanyServiceClient(metaclass=CompanyServiceClientMeta): + """A service that handles company management, including CRUD and + enumeration. + """ + + @staticmethod + def _get_default_mtls_endpoint(api_endpoint): + """Convert api endpoint to mTLS endpoint. + Convert "*.sandbox.googleapis.com" and "*.googleapis.com" to + "*.mtls.sandbox.googleapis.com" and "*.mtls.googleapis.com" respectively. + Args: + api_endpoint (Optional[str]): the api endpoint to convert. + Returns: + str: converted mTLS api endpoint. + """ + if not api_endpoint: + return api_endpoint + + mtls_endpoint_re = re.compile( + r"(?P[^.]+)(?P\.mtls)?(?P\.sandbox)?(?P\.googleapis\.com)?" + ) + + m = mtls_endpoint_re.match(api_endpoint) + name, mtls, sandbox, googledomain = m.groups() + if mtls or not googledomain: + return api_endpoint + + if sandbox: + return api_endpoint.replace( + "sandbox.googleapis.com", "mtls.sandbox.googleapis.com" + ) + + return api_endpoint.replace(".googleapis.com", ".mtls.googleapis.com") + + DEFAULT_ENDPOINT = "jobs.googleapis.com" + DEFAULT_MTLS_ENDPOINT = _get_default_mtls_endpoint.__func__( # type: ignore + DEFAULT_ENDPOINT + ) + + @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: + {@api.name}: The constructed client. + """ + credentials = service_account.Credentials.from_service_account_file(filename) + kwargs["credentials"] = credentials + return cls(*args, **kwargs) + + from_service_account_json = from_service_account_file + + @staticmethod + def company_path(project: str, tenant: str, company: str,) -> str: + """Return a fully-qualified company string.""" + return "projects/{project}/tenants/{tenant}/companies/{company}".format( + project=project, tenant=tenant, company=company, + ) + + @staticmethod + def parse_company_path(path: str) -> Dict[str, str]: + """Parse a company path into its component segments.""" + m = re.match( + r"^projects/(?P.+?)/tenants/(?P.+?)/companies/(?P.+?)$", + path, + ) + return m.groupdict() if m else {} + + def __init__( + self, + *, + credentials: credentials.Credentials = None, + transport: Union[str, CompanyServiceTransport] = None, + client_options: ClientOptions = None, + ) -> None: + """Instantiate the company service client. + + Args: + credentials (Optional[google.auth.credentials.Credentials]): The + authorization credentials to attach to requests. These + credentials identify the application to the service; if none + are specified, the client will attempt to ascertain the + credentials from the environment. + transport (Union[str, ~.CompanyServiceTransport]): The + transport to use. If set to None, a transport is chosen + automatically. + client_options (ClientOptions): Custom options for the client. It + won't take effect if a ``transport`` instance is provided. + (1) The ``api_endpoint`` property can be used to override the + default endpoint provided by the client. GOOGLE_API_USE_MTLS + environment variable can also be used to override the endpoint: + "always" (always use the default mTLS endpoint), "never" (always + use the default regular endpoint, this is the default value for + the environment variable) and "auto" (auto switch to the default + mTLS endpoint if client SSL credentials is present). However, + the ``api_endpoint`` property takes precedence if provided. + (2) The ``client_cert_source`` property is used to provide client + SSL credentials for mutual TLS transport. If not provided, the + default SSL credentials will be used if present. + + Raises: + google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport + creation failed for any reason. + """ + if isinstance(client_options, dict): + client_options = ClientOptions.from_dict(client_options) + if client_options is None: + client_options = ClientOptions.ClientOptions() + + if client_options.api_endpoint is None: + use_mtls_env = os.getenv("GOOGLE_API_USE_MTLS", "never") + if use_mtls_env == "never": + client_options.api_endpoint = self.DEFAULT_ENDPOINT + elif use_mtls_env == "always": + client_options.api_endpoint = self.DEFAULT_MTLS_ENDPOINT + elif use_mtls_env == "auto": + has_client_cert_source = ( + client_options.client_cert_source is not None + or mtls.has_default_client_cert_source() + ) + client_options.api_endpoint = ( + self.DEFAULT_MTLS_ENDPOINT + if has_client_cert_source + else self.DEFAULT_ENDPOINT + ) + else: + raise MutualTLSChannelError( + "Unsupported GOOGLE_API_USE_MTLS value. Accepted values: never, auto, always" + ) + + # Save or instantiate the transport. + # Ordinarily, we provide the transport, but allowing a custom transport + # instance provides an extensibility point for unusual situations. + if isinstance(transport, CompanyServiceTransport): + # transport is a CompanyServiceTransport instance. + if credentials or client_options.credentials_file: + raise ValueError( + "When providing a transport instance, " + "provide its credentials directly." + ) + if client_options.scopes: + raise ValueError( + "When providing a transport instance, " + "provide its scopes directly." + ) + self._transport = transport + else: + Transport = type(self).get_transport_class(transport) + self._transport = Transport( + credentials=credentials, + credentials_file=client_options.credentials_file, + host=client_options.api_endpoint, + scopes=client_options.scopes, + api_mtls_endpoint=client_options.api_endpoint, + client_cert_source=client_options.client_cert_source, + quota_project_id=client_options.quota_project_id, + ) + + def create_company( + self, + request: company_service.CreateCompanyRequest = None, + *, + parent: str = None, + company: gct_company.Company = None, + retry: retries.Retry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> gct_company.Company: + r"""Creates a new company entity. + + Args: + request (:class:`~.company_service.CreateCompanyRequest`): + The request object. The Request of the CreateCompany + method. + parent (:class:`str`): + Required. Resource name of the tenant under which the + company is created. + + The format is + "projects/{project_id}/tenants/{tenant_id}", for + example, "projects/foo/tenant/bar". If tenant id is + unspecified, a default tenant is created, for example, + "projects/foo". + This corresponds to the ``parent`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + company (:class:`~.gct_company.Company`): + Required. The company to be created. + This corresponds to the ``company`` 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. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + ~.gct_company.Company: + A Company resource represents a + company in the service. A company is the + entity that owns job postings, that is, + the hiring entity responsible for + employing applicants for the job + position. + + """ + # Create or coerce a protobuf request object. + # Sanity check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([parent, company]) + if request is not None and has_flattened_params: + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + # Minor optimization to avoid making a copy if the user passes + # in a company_service.CreateCompanyRequest. + # There's no risk of modifying the input as we've already verified + # there are no flattened fields. + if not isinstance(request, company_service.CreateCompanyRequest): + request = company_service.CreateCompanyRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + + if parent is not None: + request.parent = parent + if company is not None: + request.company = company + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.create_company] + + # 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),)), + ) + + # Send the request. + response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + + # Done; return the response. + return response + + def get_company( + self, + request: company_service.GetCompanyRequest = None, + *, + name: str = None, + retry: retries.Retry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> company.Company: + r"""Retrieves specified company. + + Args: + request (:class:`~.company_service.GetCompanyRequest`): + The request object. Request for getting a company by + name. + name (:class:`str`): + Required. The resource name of the company to be + retrieved. + + The format is + "projects/{project_id}/tenants/{tenant_id}/companies/{company_id}", + for example, + "projects/api-test-project/tenants/foo/companies/bar". + + If tenant id is unspecified, the default tenant is used, + for example, "projects/api-test-project/companies/bar". + This corresponds to the ``name`` 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. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + ~.company.Company: + A Company resource represents a + company in the service. A company is the + entity that owns job postings, that is, + the hiring entity responsible for + employing applicants for the job + position. + + """ + # Create or coerce a protobuf request object. + # Sanity check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([name]) + if request is not None and has_flattened_params: + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + # Minor optimization to avoid making a copy if the user passes + # in a company_service.GetCompanyRequest. + # There's no risk of modifying the input as we've already verified + # there are no flattened fields. + if not isinstance(request, company_service.GetCompanyRequest): + request = company_service.GetCompanyRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + + if name is not None: + request.name = name + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.get_company] + + # 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 + + def update_company( + self, + request: company_service.UpdateCompanyRequest = None, + *, + company: gct_company.Company = None, + retry: retries.Retry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> gct_company.Company: + r"""Updates specified company. + + Args: + request (:class:`~.company_service.UpdateCompanyRequest`): + The request object. Request for updating a specified + company. + company (:class:`~.gct_company.Company`): + Required. The company resource to + replace the current resource in the + system. + This corresponds to the ``company`` 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. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + ~.gct_company.Company: + A Company resource represents a + company in the service. A company is the + entity that owns job postings, that is, + the hiring entity responsible for + employing applicants for the job + position. + + """ + # Create or coerce a protobuf request object. + # Sanity check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([company]) + if request is not None and has_flattened_params: + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + # Minor optimization to avoid making a copy if the user passes + # in a company_service.UpdateCompanyRequest. + # There's no risk of modifying the input as we've already verified + # there are no flattened fields. + if not isinstance(request, company_service.UpdateCompanyRequest): + request = company_service.UpdateCompanyRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + + if company is not None: + request.company = company + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.update_company] + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata( + (("company.name", request.company.name),) + ), + ) + + # Send the request. + response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + + # Done; return the response. + return response + + def delete_company( + self, + request: company_service.DeleteCompanyRequest = None, + *, + name: str = None, + retry: retries.Retry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> None: + r"""Deletes specified company. + Prerequisite: The company has no jobs associated with + it. + + Args: + request (:class:`~.company_service.DeleteCompanyRequest`): + The request object. Request to delete a company. + name (:class:`str`): + Required. The resource name of the company to be + deleted. + + The format is + "projects/{project_id}/tenants/{tenant_id}/companies/{company_id}", + for example, "projects/foo/tenants/bar/companies/baz". + + If tenant id is unspecified, the default tenant is used, + for example, "projects/foo/companies/bar". + This corresponds to the ``name`` 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. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + """ + # Create or coerce a protobuf request object. + # Sanity check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([name]) + if request is not None and has_flattened_params: + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + # Minor optimization to avoid making a copy if the user passes + # in a company_service.DeleteCompanyRequest. + # There's no risk of modifying the input as we've already verified + # there are no flattened fields. + if not isinstance(request, company_service.DeleteCompanyRequest): + request = company_service.DeleteCompanyRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + + if name is not None: + request.name = name + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.delete_company] + + # 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. + rpc( + request, retry=retry, timeout=timeout, metadata=metadata, + ) + + def list_companies( + self, + request: company_service.ListCompaniesRequest = None, + *, + parent: str = None, + retry: retries.Retry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> pagers.ListCompaniesPager: + r"""Lists all companies associated with the project. + + Args: + request (:class:`~.company_service.ListCompaniesRequest`): + The request object. List companies for which the client + has ACL visibility. + parent (:class:`str`): + Required. Resource name of the tenant under which the + company is created. + + The format is + "projects/{project_id}/tenants/{tenant_id}", for + example, "projects/foo/tenant/bar". + + If tenant id is unspecified, the default tenant will be + used, for example, "projects/foo". + This corresponds to the ``parent`` 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. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + ~.pagers.ListCompaniesPager: + The List companies response object. + Iterating over this object will yield + results and resolve additional pages + automatically. + + """ + # Create or coerce a protobuf request object. + # Sanity check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([parent]) + if request is not None and has_flattened_params: + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + # Minor optimization to avoid making a copy if the user passes + # in a company_service.ListCompaniesRequest. + # There's no risk of modifying the input as we've already verified + # there are no flattened fields. + if not isinstance(request, company_service.ListCompaniesRequest): + request = company_service.ListCompaniesRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + + if parent is not None: + request.parent = parent + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.list_companies] + + # 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),)), + ) + + # Send the request. + response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + + # This method is paged; wrap the response in a pager, which provides + # an `__iter__` convenience method. + response = pagers.ListCompaniesPager( + method=rpc, request=request, response=response, metadata=metadata, + ) + + # Done; return the response. + return response + + +try: + _client_info = gapic_v1.client_info.ClientInfo( + gapic_version=pkg_resources.get_distribution("google-cloud-talent",).version, + ) +except pkg_resources.DistributionNotFound: + _client_info = gapic_v1.client_info.ClientInfo() + + +__all__ = ("CompanyServiceClient",) diff --git a/google/cloud/talent_v4beta1/services/company_service/pagers.py b/google/cloud/talent_v4beta1/services/company_service/pagers.py new file mode 100644 index 00000000..6b25c9a9 --- /dev/null +++ b/google/cloud/talent_v4beta1/services/company_service/pagers.py @@ -0,0 +1,149 @@ +# -*- 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. +# + +from typing import Any, AsyncIterable, Awaitable, Callable, Iterable, Sequence, Tuple + +from google.cloud.talent_v4beta1.types import company +from google.cloud.talent_v4beta1.types import company_service + + +class ListCompaniesPager: + """A pager for iterating through ``list_companies`` requests. + + This class thinly wraps an initial + :class:`~.company_service.ListCompaniesResponse` object, and + provides an ``__iter__`` method to iterate through its + ``companies`` field. + + If there are more pages, the ``__iter__`` method will make additional + ``ListCompanies`` requests and continue to iterate + through the ``companies`` field on the + corresponding responses. + + All the usual :class:`~.company_service.ListCompaniesResponse` + attributes are available on the pager. If multiple requests are made, only + the most recent response is retained, and thus used for attribute lookup. + """ + + def __init__( + self, + method: Callable[..., company_service.ListCompaniesResponse], + request: company_service.ListCompaniesRequest, + response: company_service.ListCompaniesResponse, + *, + metadata: Sequence[Tuple[str, str]] = () + ): + """Instantiate the pager. + + Args: + method (Callable): The method that was originally called, and + which instantiated this pager. + request (:class:`~.company_service.ListCompaniesRequest`): + The initial request object. + response (:class:`~.company_service.ListCompaniesResponse`): + The initial response object. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + """ + self._method = method + self._request = company_service.ListCompaniesRequest(request) + self._response = response + self._metadata = metadata + + def __getattr__(self, name: str) -> Any: + return getattr(self._response, name) + + @property + def pages(self) -> Iterable[company_service.ListCompaniesResponse]: + 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) + yield self._response + + def __iter__(self) -> Iterable[company.Company]: + for page in self.pages: + yield from page.companies + + def __repr__(self) -> str: + return "{0}<{1!r}>".format(self.__class__.__name__, self._response) + + +class ListCompaniesAsyncPager: + """A pager for iterating through ``list_companies`` requests. + + This class thinly wraps an initial + :class:`~.company_service.ListCompaniesResponse` object, and + provides an ``__aiter__`` method to iterate through its + ``companies`` field. + + If there are more pages, the ``__aiter__`` method will make additional + ``ListCompanies`` requests and continue to iterate + through the ``companies`` field on the + corresponding responses. + + All the usual :class:`~.company_service.ListCompaniesResponse` + attributes are available on the pager. If multiple requests are made, only + the most recent response is retained, and thus used for attribute lookup. + """ + + def __init__( + self, + method: Callable[..., Awaitable[company_service.ListCompaniesResponse]], + request: company_service.ListCompaniesRequest, + response: company_service.ListCompaniesResponse, + *, + metadata: Sequence[Tuple[str, str]] = () + ): + """Instantiate the pager. + + Args: + method (Callable): The method that was originally called, and + which instantiated this pager. + request (:class:`~.company_service.ListCompaniesRequest`): + The initial request object. + response (:class:`~.company_service.ListCompaniesResponse`): + The initial response object. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + """ + self._method = method + self._request = company_service.ListCompaniesRequest(request) + self._response = response + self._metadata = metadata + + def __getattr__(self, name: str) -> Any: + return getattr(self._response, name) + + @property + async def pages(self) -> AsyncIterable[company_service.ListCompaniesResponse]: + 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) + yield self._response + + def __aiter__(self) -> AsyncIterable[company.Company]: + async def async_generator(): + async for page in self.pages: + for response in page.companies: + yield response + + return async_generator() + + def __repr__(self) -> str: + return "{0}<{1!r}>".format(self.__class__.__name__, self._response) diff --git a/google/cloud/talent_v4beta1/services/company_service/transports/__init__.py b/google/cloud/talent_v4beta1/services/company_service/transports/__init__.py new file mode 100644 index 00000000..ad1eb728 --- /dev/null +++ b/google/cloud/talent_v4beta1/services/company_service/transports/__init__.py @@ -0,0 +1,36 @@ +# -*- 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. +# + +from collections import OrderedDict +from typing import Dict, Type + +from .base import CompanyServiceTransport +from .grpc import CompanyServiceGrpcTransport +from .grpc_asyncio import CompanyServiceGrpcAsyncIOTransport + + +# Compile a registry of transports. +_transport_registry = OrderedDict() # type: Dict[str, Type[CompanyServiceTransport]] +_transport_registry["grpc"] = CompanyServiceGrpcTransport +_transport_registry["grpc_asyncio"] = CompanyServiceGrpcAsyncIOTransport + + +__all__ = ( + "CompanyServiceTransport", + "CompanyServiceGrpcTransport", + "CompanyServiceGrpcAsyncIOTransport", +) diff --git a/google/cloud/talent_v4beta1/services/company_service/transports/base.py b/google/cloud/talent_v4beta1/services/company_service/transports/base.py new file mode 100644 index 00000000..8a1ec615 --- /dev/null +++ b/google/cloud/talent_v4beta1/services/company_service/transports/base.py @@ -0,0 +1,203 @@ +# -*- 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. +# + +import abc +import typing +import pkg_resources + +from google import auth +from google.api_core import exceptions # type: ignore +from google.api_core import gapic_v1 # type: ignore +from google.api_core import retry as retries # type: ignore +from google.auth import credentials # type: ignore + +from google.cloud.talent_v4beta1.types import company +from google.cloud.talent_v4beta1.types import company as gct_company +from google.cloud.talent_v4beta1.types import company_service +from google.protobuf import empty_pb2 as empty # type: ignore + + +try: + _client_info = gapic_v1.client_info.ClientInfo( + gapic_version=pkg_resources.get_distribution("google-cloud-talent",).version, + ) +except pkg_resources.DistributionNotFound: + _client_info = gapic_v1.client_info.ClientInfo() + + +class CompanyServiceTransport(abc.ABC): + """Abstract transport class for CompanyService.""" + + AUTH_SCOPES = ( + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/jobs", + ) + + def __init__( + self, + *, + host: str = "jobs.googleapis.com", + credentials: credentials.Credentials = None, + credentials_file: typing.Optional[str] = None, + scopes: typing.Optional[typing.Sequence[str]] = AUTH_SCOPES, + quota_project_id: typing.Optional[str] = None, + **kwargs, + ) -> None: + """Instantiate the transport. + + Args: + host (Optional[str]): The hostname to connect to. + credentials (Optional[google.auth.credentials.Credentials]): The + authorization credentials to attach to requests. These + credentials identify the application to the service; if none + are specified, the client will attempt to ascertain the + credentials from the environment. + credentials_file (Optional[str]): A file with credentials that can + be loaded with :func:`google.auth.load_credentials_from_file`. + This argument is mutually exclusive with credentials. + scope (Optional[Sequence[str]]): A list of scopes. + quota_project_id (Optional[str]): An optional project to use for billing + and quota. + """ + # Save the hostname. Default to port 443 (HTTPS) if none is specified. + if ":" not in host: + host += ":443" + self._host = host + + # If no credentials are provided, then determine the appropriate + # defaults. + if credentials and credentials_file: + raise exceptions.DuplicateCredentialArgs( + "'credentials_file' and 'credentials' are mutually exclusive" + ) + + if credentials_file is not None: + credentials, _ = auth.load_credentials_from_file( + credentials_file, scopes=scopes, quota_project_id=quota_project_id + ) + + elif credentials is None: + credentials, _ = auth.default( + scopes=scopes, quota_project_id=quota_project_id + ) + + # Save the credentials. + self._credentials = credentials + + # Lifted into its own function so it can be stubbed out during tests. + self._prep_wrapped_messages() + + def _prep_wrapped_messages(self): + # Precompute the wrapped methods. + self._wrapped_methods = { + self.create_company: gapic_v1.method.wrap_method( + self.create_company, default_timeout=30.0, client_info=_client_info, + ), + self.get_company: gapic_v1.method.wrap_method( + self.get_company, + default_retry=retries.Retry( + initial=0.1, + maximum=60.0, + multiplier=1.3, + predicate=retries.if_exception_type( + exceptions.ServiceUnavailable, exceptions.DeadlineExceeded, + ), + ), + default_timeout=30.0, + client_info=_client_info, + ), + self.update_company: gapic_v1.method.wrap_method( + self.update_company, default_timeout=30.0, client_info=_client_info, + ), + self.delete_company: gapic_v1.method.wrap_method( + self.delete_company, + default_retry=retries.Retry( + initial=0.1, + maximum=60.0, + multiplier=1.3, + predicate=retries.if_exception_type( + exceptions.ServiceUnavailable, exceptions.DeadlineExceeded, + ), + ), + default_timeout=30.0, + client_info=_client_info, + ), + self.list_companies: gapic_v1.method.wrap_method( + self.list_companies, + default_retry=retries.Retry( + initial=0.1, + maximum=60.0, + multiplier=1.3, + predicate=retries.if_exception_type( + exceptions.ServiceUnavailable, exceptions.DeadlineExceeded, + ), + ), + default_timeout=30.0, + client_info=_client_info, + ), + } + + @property + def create_company( + self, + ) -> typing.Callable[ + [company_service.CreateCompanyRequest], + typing.Union[gct_company.Company, typing.Awaitable[gct_company.Company]], + ]: + raise NotImplementedError() + + @property + def get_company( + self, + ) -> typing.Callable[ + [company_service.GetCompanyRequest], + typing.Union[company.Company, typing.Awaitable[company.Company]], + ]: + raise NotImplementedError() + + @property + def update_company( + self, + ) -> typing.Callable[ + [company_service.UpdateCompanyRequest], + typing.Union[gct_company.Company, typing.Awaitable[gct_company.Company]], + ]: + raise NotImplementedError() + + @property + def delete_company( + self, + ) -> typing.Callable[ + [company_service.DeleteCompanyRequest], + typing.Union[empty.Empty, typing.Awaitable[empty.Empty]], + ]: + raise NotImplementedError() + + @property + def list_companies( + self, + ) -> typing.Callable[ + [company_service.ListCompaniesRequest], + typing.Union[ + company_service.ListCompaniesResponse, + typing.Awaitable[company_service.ListCompaniesResponse], + ], + ]: + raise NotImplementedError() + + +__all__ = ("CompanyServiceTransport",) diff --git a/google/cloud/talent_v4beta1/services/company_service/transports/grpc.py b/google/cloud/talent_v4beta1/services/company_service/transports/grpc.py new file mode 100644 index 00000000..d1b583d6 --- /dev/null +++ b/google/cloud/talent_v4beta1/services/company_service/transports/grpc.py @@ -0,0 +1,345 @@ +# -*- 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. +# + +from typing import Callable, Dict, Optional, Sequence, Tuple + +from google.api_core import grpc_helpers # type: ignore +from google import auth # type: ignore +from google.auth import credentials # type: ignore +from google.auth.transport.grpc import SslCredentials # type: ignore + + +import grpc # type: ignore + +from google.cloud.talent_v4beta1.types import company +from google.cloud.talent_v4beta1.types import company as gct_company +from google.cloud.talent_v4beta1.types import company_service +from google.protobuf import empty_pb2 as empty # type: ignore + +from .base import CompanyServiceTransport + + +class CompanyServiceGrpcTransport(CompanyServiceTransport): + """gRPC backend transport for CompanyService. + + A service that handles company management, including CRUD and + enumeration. + + This class defines the same methods as the primary client, so the + primary client can load the underlying transport implementation + and call it. + + It sends protocol buffers over the wire using gRPC (which is built on + top of HTTP/2); the ``grpcio`` package must be installed. + """ + + _stubs: Dict[str, Callable] + + def __init__( + self, + *, + host: str = "jobs.googleapis.com", + credentials: credentials.Credentials = None, + credentials_file: str = None, + scopes: Sequence[str] = None, + channel: grpc.Channel = None, + api_mtls_endpoint: str = None, + client_cert_source: Callable[[], Tuple[bytes, bytes]] = None, + quota_project_id: Optional[str] = None + ) -> None: + """Instantiate the transport. + + Args: + host (Optional[str]): The hostname to connect to. + credentials (Optional[google.auth.credentials.Credentials]): The + authorization credentials to attach to requests. These + credentials identify the application to the service; if none + are specified, the client will attempt to ascertain the + credentials from the environment. + This argument is ignored if ``channel`` is provided. + credentials_file (Optional[str]): A file with credentials that can + be loaded with :func:`google.auth.load_credentials_from_file`. + This argument is ignored if ``channel`` is provided. + scopes (Optional(Sequence[str])): A list of scopes. This argument is + ignored if ``channel`` is provided. + channel (Optional[grpc.Channel]): A ``Channel`` instance through + which to make calls. + api_mtls_endpoint (Optional[str]): The mutual TLS endpoint. If + provided, it overrides the ``host`` argument and tries to create + a mutual TLS channel with client SSL credentials from + ``client_cert_source`` or applicatin default SSL credentials. + client_cert_source (Optional[Callable[[], Tuple[bytes, bytes]]]): A + callback to provide client SSL certificate bytes and private key + bytes, both in PEM format. It is ignored if ``api_mtls_endpoint`` + is None. + quota_project_id (Optional[str]): An optional project to use for billing + and quota. + + Raises: + google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport + creation failed for any reason. + google.api_core.exceptions.DuplicateCredentialArgs: If both ``credentials`` + and ``credentials_file`` are passed. + """ + if channel: + # Sanity check: Ensure that channel and credentials are not both + # provided. + credentials = False + + # If a channel was explicitly provided, set it. + self._grpc_channel = channel + elif api_mtls_endpoint: + host = ( + api_mtls_endpoint + if ":" in api_mtls_endpoint + else api_mtls_endpoint + ":443" + ) + + if credentials is None: + credentials, _ = auth.default( + scopes=self.AUTH_SCOPES, quota_project_id=quota_project_id + ) + + # Create SSL credentials with client_cert_source or application + # default SSL credentials. + if client_cert_source: + cert, key = client_cert_source() + ssl_credentials = grpc.ssl_channel_credentials( + certificate_chain=cert, private_key=key + ) + else: + ssl_credentials = SslCredentials().ssl_credentials + + # create a new channel. The provided one is ignored. + self._grpc_channel = type(self).create_channel( + host, + credentials=credentials, + credentials_file=credentials_file, + ssl_credentials=ssl_credentials, + scopes=scopes or self.AUTH_SCOPES, + quota_project_id=quota_project_id, + ) + + self._stubs = {} # type: Dict[str, Callable] + + # Run the base constructor. + super().__init__( + host=host, + credentials=credentials, + credentials_file=credentials_file, + scopes=scopes or self.AUTH_SCOPES, + quota_project_id=quota_project_id, + ) + + @classmethod + def create_channel( + cls, + host: str = "jobs.googleapis.com", + credentials: credentials.Credentials = None, + credentials_file: str = None, + scopes: Optional[Sequence[str]] = None, + quota_project_id: Optional[str] = None, + **kwargs + ) -> grpc.Channel: + """Create and return a gRPC channel object. + Args: + address (Optionsl[str]): The host for the channel to use. + credentials (Optional[~.Credentials]): The + authorization credentials to attach to requests. These + credentials identify this application to the service. If + none are specified, the client will attempt to ascertain + the credentials from the environment. + credentials_file (Optional[str]): A file with credentials that can + be loaded with :func:`google.auth.load_credentials_from_file`. + This argument is mutually exclusive with credentials. + scopes (Optional[Sequence[str]]): A optional list of scopes needed for this + service. These are only used when credentials are not specified and + are passed to :func:`google.auth.default`. + quota_project_id (Optional[str]): An optional project to use for billing + and quota. + kwargs (Optional[dict]): Keyword arguments, which are passed to the + channel creation. + Returns: + grpc.Channel: A gRPC channel object. + + Raises: + google.api_core.exceptions.DuplicateCredentialArgs: If both ``credentials`` + and ``credentials_file`` are passed. + """ + scopes = scopes or cls.AUTH_SCOPES + return grpc_helpers.create_channel( + host, + credentials=credentials, + credentials_file=credentials_file, + scopes=scopes, + quota_project_id=quota_project_id, + **kwargs + ) + + @property + def grpc_channel(self) -> grpc.Channel: + """Create the channel designed to connect to this service. + + This property caches on the instance; repeated calls return + the same channel. + """ + # Sanity check: Only create a new channel if we do not already + # have one. + if not hasattr(self, "_grpc_channel"): + self._grpc_channel = self.create_channel( + self._host, credentials=self._credentials, + ) + + # Return the channel from cache. + return self._grpc_channel + + @property + def create_company( + self, + ) -> Callable[[company_service.CreateCompanyRequest], gct_company.Company]: + r"""Return a callable for the create company method over gRPC. + + Creates a new company entity. + + Returns: + Callable[[~.CreateCompanyRequest], + ~.Company]: + A function that, when called, will call the underlying RPC + on the server. + """ + # 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 "create_company" not in self._stubs: + self._stubs["create_company"] = self.grpc_channel.unary_unary( + "/google.cloud.talent.v4beta1.CompanyService/CreateCompany", + request_serializer=company_service.CreateCompanyRequest.serialize, + response_deserializer=gct_company.Company.deserialize, + ) + return self._stubs["create_company"] + + @property + def get_company( + self, + ) -> Callable[[company_service.GetCompanyRequest], company.Company]: + r"""Return a callable for the get company method over gRPC. + + Retrieves specified company. + + Returns: + Callable[[~.GetCompanyRequest], + ~.Company]: + A function that, when called, will call the underlying RPC + on the server. + """ + # 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_company" not in self._stubs: + self._stubs["get_company"] = self.grpc_channel.unary_unary( + "/google.cloud.talent.v4beta1.CompanyService/GetCompany", + request_serializer=company_service.GetCompanyRequest.serialize, + response_deserializer=company.Company.deserialize, + ) + return self._stubs["get_company"] + + @property + def update_company( + self, + ) -> Callable[[company_service.UpdateCompanyRequest], gct_company.Company]: + r"""Return a callable for the update company method over gRPC. + + Updates specified company. + + Returns: + Callable[[~.UpdateCompanyRequest], + ~.Company]: + A function that, when called, will call the underlying RPC + on the server. + """ + # 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 "update_company" not in self._stubs: + self._stubs["update_company"] = self.grpc_channel.unary_unary( + "/google.cloud.talent.v4beta1.CompanyService/UpdateCompany", + request_serializer=company_service.UpdateCompanyRequest.serialize, + response_deserializer=gct_company.Company.deserialize, + ) + return self._stubs["update_company"] + + @property + def delete_company( + self, + ) -> Callable[[company_service.DeleteCompanyRequest], empty.Empty]: + r"""Return a callable for the delete company method over gRPC. + + Deletes specified company. + Prerequisite: The company has no jobs associated with + it. + + Returns: + Callable[[~.DeleteCompanyRequest], + ~.Empty]: + A function that, when called, will call the underlying RPC + on the server. + """ + # 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 "delete_company" not in self._stubs: + self._stubs["delete_company"] = self.grpc_channel.unary_unary( + "/google.cloud.talent.v4beta1.CompanyService/DeleteCompany", + request_serializer=company_service.DeleteCompanyRequest.serialize, + response_deserializer=empty.Empty.FromString, + ) + return self._stubs["delete_company"] + + @property + def list_companies( + self, + ) -> Callable[ + [company_service.ListCompaniesRequest], company_service.ListCompaniesResponse + ]: + r"""Return a callable for the list companies method over gRPC. + + Lists all companies associated with the project. + + Returns: + Callable[[~.ListCompaniesRequest], + ~.ListCompaniesResponse]: + A function that, when called, will call the underlying RPC + on the server. + """ + # 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 "list_companies" not in self._stubs: + self._stubs["list_companies"] = self.grpc_channel.unary_unary( + "/google.cloud.talent.v4beta1.CompanyService/ListCompanies", + request_serializer=company_service.ListCompaniesRequest.serialize, + response_deserializer=company_service.ListCompaniesResponse.deserialize, + ) + return self._stubs["list_companies"] + + +__all__ = ("CompanyServiceGrpcTransport",) diff --git a/google/cloud/talent_v4beta1/services/company_service/transports/grpc_asyncio.py b/google/cloud/talent_v4beta1/services/company_service/transports/grpc_asyncio.py new file mode 100644 index 00000000..c5a11616 --- /dev/null +++ b/google/cloud/talent_v4beta1/services/company_service/transports/grpc_asyncio.py @@ -0,0 +1,343 @@ +# -*- 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. +# + +from typing import Awaitable, Callable, Dict, Optional, Sequence, Tuple + +from google.api_core import grpc_helpers_async # type: ignore +from google.auth import credentials # type: ignore +from google.auth.transport.grpc import SslCredentials # type: ignore + +import grpc # type: ignore +from grpc.experimental import aio # type: ignore + +from google.cloud.talent_v4beta1.types import company +from google.cloud.talent_v4beta1.types import company as gct_company +from google.cloud.talent_v4beta1.types import company_service +from google.protobuf import empty_pb2 as empty # type: ignore + +from .base import CompanyServiceTransport +from .grpc import CompanyServiceGrpcTransport + + +class CompanyServiceGrpcAsyncIOTransport(CompanyServiceTransport): + """gRPC AsyncIO backend transport for CompanyService. + + A service that handles company management, including CRUD and + enumeration. + + This class defines the same methods as the primary client, so the + primary client can load the underlying transport implementation + and call it. + + It sends protocol buffers over the wire using gRPC (which is built on + top of HTTP/2); the ``grpcio`` package must be installed. + """ + + _grpc_channel: aio.Channel + _stubs: Dict[str, Callable] = {} + + @classmethod + def create_channel( + cls, + host: str = "jobs.googleapis.com", + credentials: credentials.Credentials = None, + credentials_file: Optional[str] = None, + scopes: Optional[Sequence[str]] = None, + quota_project_id: Optional[str] = None, + **kwargs, + ) -> aio.Channel: + """Create and return a gRPC AsyncIO channel object. + Args: + address (Optional[str]): The host for the channel to use. + credentials (Optional[~.Credentials]): The + authorization credentials to attach to requests. These + credentials identify this application to the service. If + none are specified, the client will attempt to ascertain + the credentials from the environment. + credentials_file (Optional[str]): A file with credentials that can + be loaded with :func:`google.auth.load_credentials_from_file`. + This argument is ignored if ``channel`` is provided. + scopes (Optional[Sequence[str]]): A optional list of scopes needed for this + service. These are only used when credentials are not specified and + are passed to :func:`google.auth.default`. + quota_project_id (Optional[str]): An optional project to use for billing + and quota. + kwargs (Optional[dict]): Keyword arguments, which are passed to the + channel creation. + Returns: + aio.Channel: A gRPC AsyncIO channel object. + """ + scopes = scopes or cls.AUTH_SCOPES + return grpc_helpers_async.create_channel( + host, + credentials=credentials, + credentials_file=credentials_file, + scopes=scopes, + quota_project_id=quota_project_id, + **kwargs, + ) + + def __init__( + self, + *, + host: str = "jobs.googleapis.com", + credentials: credentials.Credentials = None, + credentials_file: Optional[str] = None, + scopes: Optional[Sequence[str]] = None, + channel: aio.Channel = None, + api_mtls_endpoint: str = None, + client_cert_source: Callable[[], Tuple[bytes, bytes]] = None, + quota_project_id=None, + ) -> None: + """Instantiate the transport. + + Args: + host (Optional[str]): The hostname to connect to. + credentials (Optional[google.auth.credentials.Credentials]): The + authorization credentials to attach to requests. These + credentials identify the application to the service; if none + are specified, the client will attempt to ascertain the + credentials from the environment. + This argument is ignored if ``channel`` is provided. + credentials_file (Optional[str]): A file with credentials that can + be loaded with :func:`google.auth.load_credentials_from_file`. + This argument is ignored if ``channel`` is provided. + scopes (Optional[Sequence[str]]): A optional list of scopes needed for this + service. These are only used when credentials are not specified and + are passed to :func:`google.auth.default`. + channel (Optional[aio.Channel]): A ``Channel`` instance through + which to make calls. + api_mtls_endpoint (Optional[str]): The mutual TLS endpoint. If + provided, it overrides the ``host`` argument and tries to create + a mutual TLS channel with client SSL credentials from + ``client_cert_source`` or applicatin default SSL credentials. + client_cert_source (Optional[Callable[[], Tuple[bytes, bytes]]]): A + callback to provide client SSL certificate bytes and private key + bytes, both in PEM format. It is ignored if ``api_mtls_endpoint`` + is None. + quota_project_id (Optional[str]): An optional project to use for billing + and quota. + + Raises: + google.auth.exceptions.MutualTlsChannelError: If mutual TLS transport + creation failed for any reason. + google.api_core.exceptions.DuplicateCredentialArgs: If both ``credentials`` + and ``credentials_file`` are passed. + """ + if channel: + # Sanity check: Ensure that channel and credentials are not both + # provided. + credentials = False + + # If a channel was explicitly provided, set it. + self._grpc_channel = channel + elif api_mtls_endpoint: + host = ( + api_mtls_endpoint + if ":" in api_mtls_endpoint + else api_mtls_endpoint + ":443" + ) + + # Create SSL credentials with client_cert_source or application + # default SSL credentials. + if client_cert_source: + cert, key = client_cert_source() + ssl_credentials = grpc.ssl_channel_credentials( + certificate_chain=cert, private_key=key + ) + else: + ssl_credentials = SslCredentials().ssl_credentials + + # create a new channel. The provided one is ignored. + self._grpc_channel = type(self).create_channel( + host, + credentials=credentials, + credentials_file=credentials_file, + ssl_credentials=ssl_credentials, + scopes=scopes or self.AUTH_SCOPES, + quota_project_id=quota_project_id, + ) + + # Run the base constructor. + super().__init__( + host=host, + credentials=credentials, + credentials_file=credentials_file, + scopes=scopes or self.AUTH_SCOPES, + quota_project_id=quota_project_id, + ) + + self._stubs = {} + + @property + def grpc_channel(self) -> aio.Channel: + """Create the channel designed to connect to this service. + + This property caches on the instance; repeated calls return + the same channel. + """ + # Sanity check: Only create a new channel if we do not already + # have one. + if not hasattr(self, "_grpc_channel"): + self._grpc_channel = self.create_channel( + self._host, credentials=self._credentials, + ) + + # Return the channel from cache. + return self._grpc_channel + + @property + def create_company( + self, + ) -> Callable[ + [company_service.CreateCompanyRequest], Awaitable[gct_company.Company] + ]: + r"""Return a callable for the create company method over gRPC. + + Creates a new company entity. + + Returns: + Callable[[~.CreateCompanyRequest], + Awaitable[~.Company]]: + A function that, when called, will call the underlying RPC + on the server. + """ + # 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 "create_company" not in self._stubs: + self._stubs["create_company"] = self.grpc_channel.unary_unary( + "/google.cloud.talent.v4beta1.CompanyService/CreateCompany", + request_serializer=company_service.CreateCompanyRequest.serialize, + response_deserializer=gct_company.Company.deserialize, + ) + return self._stubs["create_company"] + + @property + def get_company( + self, + ) -> Callable[[company_service.GetCompanyRequest], Awaitable[company.Company]]: + r"""Return a callable for the get company method over gRPC. + + Retrieves specified company. + + Returns: + Callable[[~.GetCompanyRequest], + Awaitable[~.Company]]: + A function that, when called, will call the underlying RPC + on the server. + """ + # 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_company" not in self._stubs: + self._stubs["get_company"] = self.grpc_channel.unary_unary( + "/google.cloud.talent.v4beta1.CompanyService/GetCompany", + request_serializer=company_service.GetCompanyRequest.serialize, + response_deserializer=company.Company.deserialize, + ) + return self._stubs["get_company"] + + @property + def update_company( + self, + ) -> Callable[ + [company_service.UpdateCompanyRequest], Awaitable[gct_company.Company] + ]: + r"""Return a callable for the update company method over gRPC. + + Updates specified company. + + Returns: + Callable[[~.UpdateCompanyRequest], + Awaitable[~.Company]]: + A function that, when called, will call the underlying RPC + on the server. + """ + # 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 "update_company" not in self._stubs: + self._stubs["update_company"] = self.grpc_channel.unary_unary( + "/google.cloud.talent.v4beta1.CompanyService/UpdateCompany", + request_serializer=company_service.UpdateCompanyRequest.serialize, + response_deserializer=gct_company.Company.deserialize, + ) + return self._stubs["update_company"] + + @property + def delete_company( + self, + ) -> Callable[[company_service.DeleteCompanyRequest], Awaitable[empty.Empty]]: + r"""Return a callable for the delete company method over gRPC. + + Deletes specified company. + Prerequisite: The company has no jobs associated with + it. + + Returns: + Callable[[~.DeleteCompanyRequest], + Awaitable[~.Empty]]: + A function that, when called, will call the underlying RPC + on the server. + """ + # 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 "delete_company" not in self._stubs: + self._stubs["delete_company"] = self.grpc_channel.unary_unary( + "/google.cloud.talent.v4beta1.CompanyService/DeleteCompany", + request_serializer=company_service.DeleteCompanyRequest.serialize, + response_deserializer=empty.Empty.FromString, + ) + return self._stubs["delete_company"] + + @property + def list_companies( + self, + ) -> Callable[ + [company_service.ListCompaniesRequest], + Awaitable[company_service.ListCompaniesResponse], + ]: + r"""Return a callable for the list companies method over gRPC. + + Lists all companies associated with the project. + + Returns: + Callable[[~.ListCompaniesRequest], + Awaitable[~.ListCompaniesResponse]]: + A function that, when called, will call the underlying RPC + on the server. + """ + # 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 "list_companies" not in self._stubs: + self._stubs["list_companies"] = self.grpc_channel.unary_unary( + "/google.cloud.talent.v4beta1.CompanyService/ListCompanies", + request_serializer=company_service.ListCompaniesRequest.serialize, + response_deserializer=company_service.ListCompaniesResponse.deserialize, + ) + return self._stubs["list_companies"] + + +__all__ = ("CompanyServiceGrpcAsyncIOTransport",) diff --git a/google/cloud/__init__.py b/google/cloud/talent_v4beta1/services/completion/__init__.py similarity index 71% rename from google/cloud/__init__.py rename to google/cloud/talent_v4beta1/services/completion/__init__.py index 9a1b64a6..0c274210 100644 --- a/google/cloud/__init__.py +++ b/google/cloud/talent_v4beta1/services/completion/__init__.py @@ -1,24 +1,24 @@ # -*- 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 # -# https://www.apache.org/licenses/LICENSE-2.0 +# 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. +# -try: - import pkg_resources - - pkg_resources.declare_namespace(__name__) -except ImportError: - import pkgutil +from .client import CompletionClient +from .async_client import CompletionAsyncClient - __path__ = pkgutil.extend_path(__path__, __name__) +__all__ = ( + "CompletionClient", + "CompletionAsyncClient", +) diff --git a/google/cloud/talent_v4beta1/services/completion/async_client.py b/google/cloud/talent_v4beta1/services/completion/async_client.py new file mode 100644 index 00000000..268aabed --- /dev/null +++ b/google/cloud/talent_v4beta1/services/completion/async_client.py @@ -0,0 +1,162 @@ +# -*- 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. +# + +from collections import OrderedDict +import functools +import re +from typing import Dict, Sequence, Tuple, Type, Union +import pkg_resources + +import google.api_core.client_options as ClientOptions # type: ignore +from google.api_core import exceptions # type: ignore +from google.api_core import gapic_v1 # type: ignore +from google.api_core import retry as retries # type: ignore +from google.auth import credentials # type: ignore +from google.oauth2 import service_account # type: ignore + +from google.cloud.talent_v4beta1.types import common +from google.cloud.talent_v4beta1.types import completion_service + +from .transports.base import CompletionTransport +from .transports.grpc_asyncio import CompletionGrpcAsyncIOTransport +from .client import CompletionClient + + +class CompletionAsyncClient: + """A service handles auto completion.""" + + _client: CompletionClient + + DEFAULT_ENDPOINT = CompletionClient.DEFAULT_ENDPOINT + DEFAULT_MTLS_ENDPOINT = CompletionClient.DEFAULT_MTLS_ENDPOINT + + from_service_account_file = CompletionClient.from_service_account_file + from_service_account_json = from_service_account_file + + get_transport_class = functools.partial( + type(CompletionClient).get_transport_class, type(CompletionClient) + ) + + def __init__( + self, + *, + credentials: credentials.Credentials = None, + transport: Union[str, CompletionTransport] = "grpc_asyncio", + client_options: ClientOptions = None, + ) -> None: + """Instantiate the completion client. + + Args: + credentials (Optional[google.auth.credentials.Credentials]): The + authorization credentials to attach to requests. These + credentials identify the application to the service; if none + are specified, the client will attempt to ascertain the + credentials from the environment. + transport (Union[str, ~.CompletionTransport]): The + transport to use. If set to None, a transport is chosen + automatically. + client_options (ClientOptions): Custom options for the client. It + won't take effect if a ``transport`` instance is provided. + (1) The ``api_endpoint`` property can be used to override the + default endpoint provided by the client. GOOGLE_API_USE_MTLS + environment variable can also be used to override the endpoint: + "always" (always use the default mTLS endpoint), "never" (always + use the default regular endpoint, this is the default value for + the environment variable) and "auto" (auto switch to the default + mTLS endpoint if client SSL credentials is present). However, + the ``api_endpoint`` property takes precedence if provided. + (2) The ``client_cert_source`` property is used to provide client + SSL credentials for mutual TLS transport. If not provided, the + default SSL credentials will be used if present. + + Raises: + google.auth.exceptions.MutualTlsChannelError: If mutual TLS transport + creation failed for any reason. + """ + + self._client = CompletionClient( + credentials=credentials, transport=transport, client_options=client_options, + ) + + async def complete_query( + self, + request: completion_service.CompleteQueryRequest = None, + *, + retry: retries.Retry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> completion_service.CompleteQueryResponse: + r"""Completes the specified prefix with keyword + suggestions. Intended for use by a job search auto- + complete search box. + + Args: + request (:class:`~.completion_service.CompleteQueryRequest`): + The request object. Auto-complete parameters. + + 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: + ~.completion_service.CompleteQueryResponse: + Response of auto-complete query. + """ + # Create or coerce a protobuf request object. + + request = completion_service.CompleteQueryRequest(request) + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.complete_query, + default_retry=retries.Retry( + initial=0.1, + maximum=60.0, + multiplier=1.3, + predicate=retries.if_exception_type( + exceptions.ServiceUnavailable, exceptions.DeadlineExceeded, + ), + ), + default_timeout=30.0, + client_info=_client_info, + ) + + # 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),)), + ) + + # Send the request. + response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + + # Done; return the response. + return response + + +try: + _client_info = gapic_v1.client_info.ClientInfo( + gapic_version=pkg_resources.get_distribution("google-cloud-talent",).version, + ) +except pkg_resources.DistributionNotFound: + _client_info = gapic_v1.client_info.ClientInfo() + + +__all__ = ("CompletionAsyncClient",) diff --git a/google/cloud/talent_v4beta1/services/completion/client.py b/google/cloud/talent_v4beta1/services/completion/client.py new file mode 100644 index 00000000..9efe4cd5 --- /dev/null +++ b/google/cloud/talent_v4beta1/services/completion/client.py @@ -0,0 +1,279 @@ +# -*- 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. +# + +from collections import OrderedDict +import os +import re +from typing import Callable, Dict, Sequence, Tuple, Type, Union +import pkg_resources + +import google.api_core.client_options as ClientOptions # type: ignore +from google.api_core import exceptions # type: ignore +from google.api_core import gapic_v1 # type: ignore +from google.api_core import retry as retries # type: ignore +from google.auth import credentials # type: ignore +from google.auth.transport import mtls # type: ignore +from google.auth.exceptions import MutualTLSChannelError # type: ignore +from google.oauth2 import service_account # type: ignore + +from google.cloud.talent_v4beta1.types import common +from google.cloud.talent_v4beta1.types import completion_service + +from .transports.base import CompletionTransport +from .transports.grpc import CompletionGrpcTransport +from .transports.grpc_asyncio import CompletionGrpcAsyncIOTransport + + +class CompletionClientMeta(type): + """Metaclass for the Completion client. + + This provides class-level methods for building and retrieving + support objects (e.g. transport) without polluting the client instance + objects. + """ + + _transport_registry = OrderedDict() # type: Dict[str, Type[CompletionTransport]] + _transport_registry["grpc"] = CompletionGrpcTransport + _transport_registry["grpc_asyncio"] = CompletionGrpcAsyncIOTransport + + def get_transport_class(cls, label: str = None,) -> Type[CompletionTransport]: + """Return an appropriate transport class. + + Args: + label: The name of the desired transport. If none is + provided, then the first transport in the registry is used. + + Returns: + The transport class to use. + """ + # If a specific transport is requested, return that one. + if label: + return cls._transport_registry[label] + + # No transport is requested; return the default (that is, the first one + # in the dictionary). + return next(iter(cls._transport_registry.values())) + + +class CompletionClient(metaclass=CompletionClientMeta): + """A service handles auto completion.""" + + @staticmethod + def _get_default_mtls_endpoint(api_endpoint): + """Convert api endpoint to mTLS endpoint. + Convert "*.sandbox.googleapis.com" and "*.googleapis.com" to + "*.mtls.sandbox.googleapis.com" and "*.mtls.googleapis.com" respectively. + Args: + api_endpoint (Optional[str]): the api endpoint to convert. + Returns: + str: converted mTLS api endpoint. + """ + if not api_endpoint: + return api_endpoint + + mtls_endpoint_re = re.compile( + r"(?P[^.]+)(?P\.mtls)?(?P\.sandbox)?(?P\.googleapis\.com)?" + ) + + m = mtls_endpoint_re.match(api_endpoint) + name, mtls, sandbox, googledomain = m.groups() + if mtls or not googledomain: + return api_endpoint + + if sandbox: + return api_endpoint.replace( + "sandbox.googleapis.com", "mtls.sandbox.googleapis.com" + ) + + return api_endpoint.replace(".googleapis.com", ".mtls.googleapis.com") + + DEFAULT_ENDPOINT = "jobs.googleapis.com" + DEFAULT_MTLS_ENDPOINT = _get_default_mtls_endpoint.__func__( # type: ignore + DEFAULT_ENDPOINT + ) + + @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: + {@api.name}: The constructed client. + """ + credentials = service_account.Credentials.from_service_account_file(filename) + kwargs["credentials"] = credentials + return cls(*args, **kwargs) + + from_service_account_json = from_service_account_file + + def __init__( + self, + *, + credentials: credentials.Credentials = None, + transport: Union[str, CompletionTransport] = None, + client_options: ClientOptions = None, + ) -> None: + """Instantiate the completion client. + + Args: + credentials (Optional[google.auth.credentials.Credentials]): The + authorization credentials to attach to requests. These + credentials identify the application to the service; if none + are specified, the client will attempt to ascertain the + credentials from the environment. + transport (Union[str, ~.CompletionTransport]): The + transport to use. If set to None, a transport is chosen + automatically. + client_options (ClientOptions): Custom options for the client. It + won't take effect if a ``transport`` instance is provided. + (1) The ``api_endpoint`` property can be used to override the + default endpoint provided by the client. GOOGLE_API_USE_MTLS + environment variable can also be used to override the endpoint: + "always" (always use the default mTLS endpoint), "never" (always + use the default regular endpoint, this is the default value for + the environment variable) and "auto" (auto switch to the default + mTLS endpoint if client SSL credentials is present). However, + the ``api_endpoint`` property takes precedence if provided. + (2) The ``client_cert_source`` property is used to provide client + SSL credentials for mutual TLS transport. If not provided, the + default SSL credentials will be used if present. + + Raises: + google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport + creation failed for any reason. + """ + if isinstance(client_options, dict): + client_options = ClientOptions.from_dict(client_options) + if client_options is None: + client_options = ClientOptions.ClientOptions() + + if client_options.api_endpoint is None: + use_mtls_env = os.getenv("GOOGLE_API_USE_MTLS", "never") + if use_mtls_env == "never": + client_options.api_endpoint = self.DEFAULT_ENDPOINT + elif use_mtls_env == "always": + client_options.api_endpoint = self.DEFAULT_MTLS_ENDPOINT + elif use_mtls_env == "auto": + has_client_cert_source = ( + client_options.client_cert_source is not None + or mtls.has_default_client_cert_source() + ) + client_options.api_endpoint = ( + self.DEFAULT_MTLS_ENDPOINT + if has_client_cert_source + else self.DEFAULT_ENDPOINT + ) + else: + raise MutualTLSChannelError( + "Unsupported GOOGLE_API_USE_MTLS value. Accepted values: never, auto, always" + ) + + # Save or instantiate the transport. + # Ordinarily, we provide the transport, but allowing a custom transport + # instance provides an extensibility point for unusual situations. + if isinstance(transport, CompletionTransport): + # transport is a CompletionTransport instance. + if credentials or client_options.credentials_file: + raise ValueError( + "When providing a transport instance, " + "provide its credentials directly." + ) + if client_options.scopes: + raise ValueError( + "When providing a transport instance, " + "provide its scopes directly." + ) + self._transport = transport + else: + Transport = type(self).get_transport_class(transport) + self._transport = Transport( + credentials=credentials, + credentials_file=client_options.credentials_file, + host=client_options.api_endpoint, + scopes=client_options.scopes, + api_mtls_endpoint=client_options.api_endpoint, + client_cert_source=client_options.client_cert_source, + quota_project_id=client_options.quota_project_id, + ) + + def complete_query( + self, + request: completion_service.CompleteQueryRequest = None, + *, + retry: retries.Retry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> completion_service.CompleteQueryResponse: + r"""Completes the specified prefix with keyword + suggestions. Intended for use by a job search auto- + complete search box. + + Args: + request (:class:`~.completion_service.CompleteQueryRequest`): + The request object. Auto-complete parameters. + + 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: + ~.completion_service.CompleteQueryResponse: + Response of auto-complete query. + """ + # Create or coerce a protobuf request object. + + # Minor optimization to avoid making a copy if the user passes + # in a completion_service.CompleteQueryRequest. + # There's no risk of modifying the input as we've already verified + # there are no flattened fields. + if not isinstance(request, completion_service.CompleteQueryRequest): + request = completion_service.CompleteQueryRequest(request) + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.complete_query] + + # 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),)), + ) + + # Send the request. + response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + + # Done; return the response. + return response + + +try: + _client_info = gapic_v1.client_info.ClientInfo( + gapic_version=pkg_resources.get_distribution("google-cloud-talent",).version, + ) +except pkg_resources.DistributionNotFound: + _client_info = gapic_v1.client_info.ClientInfo() + + +__all__ = ("CompletionClient",) diff --git a/google/cloud/talent_v4beta1/services/completion/transports/__init__.py b/google/cloud/talent_v4beta1/services/completion/transports/__init__.py new file mode 100644 index 00000000..9256febd --- /dev/null +++ b/google/cloud/talent_v4beta1/services/completion/transports/__init__.py @@ -0,0 +1,36 @@ +# -*- 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. +# + +from collections import OrderedDict +from typing import Dict, Type + +from .base import CompletionTransport +from .grpc import CompletionGrpcTransport +from .grpc_asyncio import CompletionGrpcAsyncIOTransport + + +# Compile a registry of transports. +_transport_registry = OrderedDict() # type: Dict[str, Type[CompletionTransport]] +_transport_registry["grpc"] = CompletionGrpcTransport +_transport_registry["grpc_asyncio"] = CompletionGrpcAsyncIOTransport + + +__all__ = ( + "CompletionTransport", + "CompletionGrpcTransport", + "CompletionGrpcAsyncIOTransport", +) diff --git a/google/cloud/talent_v4beta1/services/completion/transports/base.py b/google/cloud/talent_v4beta1/services/completion/transports/base.py new file mode 100644 index 00000000..50688320 --- /dev/null +++ b/google/cloud/talent_v4beta1/services/completion/transports/base.py @@ -0,0 +1,132 @@ +# -*- 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. +# + +import abc +import typing +import pkg_resources + +from google import auth +from google.api_core import exceptions # type: ignore +from google.api_core import gapic_v1 # type: ignore +from google.api_core import retry as retries # type: ignore +from google.auth import credentials # type: ignore + +from google.cloud.talent_v4beta1.types import completion_service + + +try: + _client_info = gapic_v1.client_info.ClientInfo( + gapic_version=pkg_resources.get_distribution("google-cloud-talent",).version, + ) +except pkg_resources.DistributionNotFound: + _client_info = gapic_v1.client_info.ClientInfo() + + +class CompletionTransport(abc.ABC): + """Abstract transport class for Completion.""" + + AUTH_SCOPES = ( + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/jobs", + ) + + def __init__( + self, + *, + host: str = "jobs.googleapis.com", + credentials: credentials.Credentials = None, + credentials_file: typing.Optional[str] = None, + scopes: typing.Optional[typing.Sequence[str]] = AUTH_SCOPES, + quota_project_id: typing.Optional[str] = None, + **kwargs, + ) -> None: + """Instantiate the transport. + + Args: + host (Optional[str]): The hostname to connect to. + credentials (Optional[google.auth.credentials.Credentials]): The + authorization credentials to attach to requests. These + credentials identify the application to the service; if none + are specified, the client will attempt to ascertain the + credentials from the environment. + credentials_file (Optional[str]): A file with credentials that can + be loaded with :func:`google.auth.load_credentials_from_file`. + This argument is mutually exclusive with credentials. + scope (Optional[Sequence[str]]): A list of scopes. + quota_project_id (Optional[str]): An optional project to use for billing + and quota. + """ + # Save the hostname. Default to port 443 (HTTPS) if none is specified. + if ":" not in host: + host += ":443" + self._host = host + + # If no credentials are provided, then determine the appropriate + # defaults. + if credentials and credentials_file: + raise exceptions.DuplicateCredentialArgs( + "'credentials_file' and 'credentials' are mutually exclusive" + ) + + if credentials_file is not None: + credentials, _ = auth.load_credentials_from_file( + credentials_file, scopes=scopes, quota_project_id=quota_project_id + ) + + elif credentials is None: + credentials, _ = auth.default( + scopes=scopes, quota_project_id=quota_project_id + ) + + # Save the credentials. + self._credentials = credentials + + # Lifted into its own function so it can be stubbed out during tests. + self._prep_wrapped_messages() + + def _prep_wrapped_messages(self): + # Precompute the wrapped methods. + self._wrapped_methods = { + self.complete_query: gapic_v1.method.wrap_method( + self.complete_query, + default_retry=retries.Retry( + initial=0.1, + maximum=60.0, + multiplier=1.3, + predicate=retries.if_exception_type( + exceptions.ServiceUnavailable, exceptions.DeadlineExceeded, + ), + ), + default_timeout=30.0, + client_info=_client_info, + ), + } + + @property + def complete_query( + self, + ) -> typing.Callable[ + [completion_service.CompleteQueryRequest], + typing.Union[ + completion_service.CompleteQueryResponse, + typing.Awaitable[completion_service.CompleteQueryResponse], + ], + ]: + raise NotImplementedError() + + +__all__ = ("CompletionTransport",) diff --git a/google/cloud/talent_v4beta1/services/completion/transports/grpc.py b/google/cloud/talent_v4beta1/services/completion/transports/grpc.py new file mode 100644 index 00000000..24e2add7 --- /dev/null +++ b/google/cloud/talent_v4beta1/services/completion/transports/grpc.py @@ -0,0 +1,238 @@ +# -*- 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. +# + +from typing import Callable, Dict, Optional, Sequence, Tuple + +from google.api_core import grpc_helpers # type: ignore +from google import auth # type: ignore +from google.auth import credentials # type: ignore +from google.auth.transport.grpc import SslCredentials # type: ignore + + +import grpc # type: ignore + +from google.cloud.talent_v4beta1.types import completion_service + +from .base import CompletionTransport + + +class CompletionGrpcTransport(CompletionTransport): + """gRPC backend transport for Completion. + + A service handles auto completion. + + This class defines the same methods as the primary client, so the + primary client can load the underlying transport implementation + and call it. + + It sends protocol buffers over the wire using gRPC (which is built on + top of HTTP/2); the ``grpcio`` package must be installed. + """ + + _stubs: Dict[str, Callable] + + def __init__( + self, + *, + host: str = "jobs.googleapis.com", + credentials: credentials.Credentials = None, + credentials_file: str = None, + scopes: Sequence[str] = None, + channel: grpc.Channel = None, + api_mtls_endpoint: str = None, + client_cert_source: Callable[[], Tuple[bytes, bytes]] = None, + quota_project_id: Optional[str] = None + ) -> None: + """Instantiate the transport. + + Args: + host (Optional[str]): The hostname to connect to. + credentials (Optional[google.auth.credentials.Credentials]): The + authorization credentials to attach to requests. These + credentials identify the application to the service; if none + are specified, the client will attempt to ascertain the + credentials from the environment. + This argument is ignored if ``channel`` is provided. + credentials_file (Optional[str]): A file with credentials that can + be loaded with :func:`google.auth.load_credentials_from_file`. + This argument is ignored if ``channel`` is provided. + scopes (Optional(Sequence[str])): A list of scopes. This argument is + ignored if ``channel`` is provided. + channel (Optional[grpc.Channel]): A ``Channel`` instance through + which to make calls. + api_mtls_endpoint (Optional[str]): The mutual TLS endpoint. If + provided, it overrides the ``host`` argument and tries to create + a mutual TLS channel with client SSL credentials from + ``client_cert_source`` or applicatin default SSL credentials. + client_cert_source (Optional[Callable[[], Tuple[bytes, bytes]]]): A + callback to provide client SSL certificate bytes and private key + bytes, both in PEM format. It is ignored if ``api_mtls_endpoint`` + is None. + quota_project_id (Optional[str]): An optional project to use for billing + and quota. + + Raises: + google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport + creation failed for any reason. + google.api_core.exceptions.DuplicateCredentialArgs: If both ``credentials`` + and ``credentials_file`` are passed. + """ + if channel: + # Sanity check: Ensure that channel and credentials are not both + # provided. + credentials = False + + # If a channel was explicitly provided, set it. + self._grpc_channel = channel + elif api_mtls_endpoint: + host = ( + api_mtls_endpoint + if ":" in api_mtls_endpoint + else api_mtls_endpoint + ":443" + ) + + if credentials is None: + credentials, _ = auth.default( + scopes=self.AUTH_SCOPES, quota_project_id=quota_project_id + ) + + # Create SSL credentials with client_cert_source or application + # default SSL credentials. + if client_cert_source: + cert, key = client_cert_source() + ssl_credentials = grpc.ssl_channel_credentials( + certificate_chain=cert, private_key=key + ) + else: + ssl_credentials = SslCredentials().ssl_credentials + + # create a new channel. The provided one is ignored. + self._grpc_channel = type(self).create_channel( + host, + credentials=credentials, + credentials_file=credentials_file, + ssl_credentials=ssl_credentials, + scopes=scopes or self.AUTH_SCOPES, + quota_project_id=quota_project_id, + ) + + self._stubs = {} # type: Dict[str, Callable] + + # Run the base constructor. + super().__init__( + host=host, + credentials=credentials, + credentials_file=credentials_file, + scopes=scopes or self.AUTH_SCOPES, + quota_project_id=quota_project_id, + ) + + @classmethod + def create_channel( + cls, + host: str = "jobs.googleapis.com", + credentials: credentials.Credentials = None, + credentials_file: str = None, + scopes: Optional[Sequence[str]] = None, + quota_project_id: Optional[str] = None, + **kwargs + ) -> grpc.Channel: + """Create and return a gRPC channel object. + Args: + address (Optionsl[str]): The host for the channel to use. + credentials (Optional[~.Credentials]): The + authorization credentials to attach to requests. These + credentials identify this application to the service. If + none are specified, the client will attempt to ascertain + the credentials from the environment. + credentials_file (Optional[str]): A file with credentials that can + be loaded with :func:`google.auth.load_credentials_from_file`. + This argument is mutually exclusive with credentials. + scopes (Optional[Sequence[str]]): A optional list of scopes needed for this + service. These are only used when credentials are not specified and + are passed to :func:`google.auth.default`. + quota_project_id (Optional[str]): An optional project to use for billing + and quota. + kwargs (Optional[dict]): Keyword arguments, which are passed to the + channel creation. + Returns: + grpc.Channel: A gRPC channel object. + + Raises: + google.api_core.exceptions.DuplicateCredentialArgs: If both ``credentials`` + and ``credentials_file`` are passed. + """ + scopes = scopes or cls.AUTH_SCOPES + return grpc_helpers.create_channel( + host, + credentials=credentials, + credentials_file=credentials_file, + scopes=scopes, + quota_project_id=quota_project_id, + **kwargs + ) + + @property + def grpc_channel(self) -> grpc.Channel: + """Create the channel designed to connect to this service. + + This property caches on the instance; repeated calls return + the same channel. + """ + # Sanity check: Only create a new channel if we do not already + # have one. + if not hasattr(self, "_grpc_channel"): + self._grpc_channel = self.create_channel( + self._host, credentials=self._credentials, + ) + + # Return the channel from cache. + return self._grpc_channel + + @property + def complete_query( + self, + ) -> Callable[ + [completion_service.CompleteQueryRequest], + completion_service.CompleteQueryResponse, + ]: + r"""Return a callable for the complete query method over gRPC. + + Completes the specified prefix with keyword + suggestions. Intended for use by a job search auto- + complete search box. + + Returns: + Callable[[~.CompleteQueryRequest], + ~.CompleteQueryResponse]: + A function that, when called, will call the underlying RPC + on the server. + """ + # 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 "complete_query" not in self._stubs: + self._stubs["complete_query"] = self.grpc_channel.unary_unary( + "/google.cloud.talent.v4beta1.Completion/CompleteQuery", + request_serializer=completion_service.CompleteQueryRequest.serialize, + response_deserializer=completion_service.CompleteQueryResponse.deserialize, + ) + return self._stubs["complete_query"] + + +__all__ = ("CompletionGrpcTransport",) diff --git a/google/cloud/talent_v4beta1/services/completion/transports/grpc_asyncio.py b/google/cloud/talent_v4beta1/services/completion/transports/grpc_asyncio.py new file mode 100644 index 00000000..5e153a28 --- /dev/null +++ b/google/cloud/talent_v4beta1/services/completion/transports/grpc_asyncio.py @@ -0,0 +1,231 @@ +# -*- 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. +# + +from typing import Awaitable, Callable, Dict, Optional, Sequence, Tuple + +from google.api_core import grpc_helpers_async # type: ignore +from google.auth import credentials # type: ignore +from google.auth.transport.grpc import SslCredentials # type: ignore + +import grpc # type: ignore +from grpc.experimental import aio # type: ignore + +from google.cloud.talent_v4beta1.types import completion_service + +from .base import CompletionTransport +from .grpc import CompletionGrpcTransport + + +class CompletionGrpcAsyncIOTransport(CompletionTransport): + """gRPC AsyncIO backend transport for Completion. + + A service handles auto completion. + + This class defines the same methods as the primary client, so the + primary client can load the underlying transport implementation + and call it. + + It sends protocol buffers over the wire using gRPC (which is built on + top of HTTP/2); the ``grpcio`` package must be installed. + """ + + _grpc_channel: aio.Channel + _stubs: Dict[str, Callable] = {} + + @classmethod + def create_channel( + cls, + host: str = "jobs.googleapis.com", + credentials: credentials.Credentials = None, + credentials_file: Optional[str] = None, + scopes: Optional[Sequence[str]] = None, + quota_project_id: Optional[str] = None, + **kwargs, + ) -> aio.Channel: + """Create and return a gRPC AsyncIO channel object. + Args: + address (Optional[str]): The host for the channel to use. + credentials (Optional[~.Credentials]): The + authorization credentials to attach to requests. These + credentials identify this application to the service. If + none are specified, the client will attempt to ascertain + the credentials from the environment. + credentials_file (Optional[str]): A file with credentials that can + be loaded with :func:`google.auth.load_credentials_from_file`. + This argument is ignored if ``channel`` is provided. + scopes (Optional[Sequence[str]]): A optional list of scopes needed for this + service. These are only used when credentials are not specified and + are passed to :func:`google.auth.default`. + quota_project_id (Optional[str]): An optional project to use for billing + and quota. + kwargs (Optional[dict]): Keyword arguments, which are passed to the + channel creation. + Returns: + aio.Channel: A gRPC AsyncIO channel object. + """ + scopes = scopes or cls.AUTH_SCOPES + return grpc_helpers_async.create_channel( + host, + credentials=credentials, + credentials_file=credentials_file, + scopes=scopes, + quota_project_id=quota_project_id, + **kwargs, + ) + + def __init__( + self, + *, + host: str = "jobs.googleapis.com", + credentials: credentials.Credentials = None, + credentials_file: Optional[str] = None, + scopes: Optional[Sequence[str]] = None, + channel: aio.Channel = None, + api_mtls_endpoint: str = None, + client_cert_source: Callable[[], Tuple[bytes, bytes]] = None, + quota_project_id=None, + ) -> None: + """Instantiate the transport. + + Args: + host (Optional[str]): The hostname to connect to. + credentials (Optional[google.auth.credentials.Credentials]): The + authorization credentials to attach to requests. These + credentials identify the application to the service; if none + are specified, the client will attempt to ascertain the + credentials from the environment. + This argument is ignored if ``channel`` is provided. + credentials_file (Optional[str]): A file with credentials that can + be loaded with :func:`google.auth.load_credentials_from_file`. + This argument is ignored if ``channel`` is provided. + scopes (Optional[Sequence[str]]): A optional list of scopes needed for this + service. These are only used when credentials are not specified and + are passed to :func:`google.auth.default`. + channel (Optional[aio.Channel]): A ``Channel`` instance through + which to make calls. + api_mtls_endpoint (Optional[str]): The mutual TLS endpoint. If + provided, it overrides the ``host`` argument and tries to create + a mutual TLS channel with client SSL credentials from + ``client_cert_source`` or applicatin default SSL credentials. + client_cert_source (Optional[Callable[[], Tuple[bytes, bytes]]]): A + callback to provide client SSL certificate bytes and private key + bytes, both in PEM format. It is ignored if ``api_mtls_endpoint`` + is None. + quota_project_id (Optional[str]): An optional project to use for billing + and quota. + + Raises: + google.auth.exceptions.MutualTlsChannelError: If mutual TLS transport + creation failed for any reason. + google.api_core.exceptions.DuplicateCredentialArgs: If both ``credentials`` + and ``credentials_file`` are passed. + """ + if channel: + # Sanity check: Ensure that channel and credentials are not both + # provided. + credentials = False + + # If a channel was explicitly provided, set it. + self._grpc_channel = channel + elif api_mtls_endpoint: + host = ( + api_mtls_endpoint + if ":" in api_mtls_endpoint + else api_mtls_endpoint + ":443" + ) + + # Create SSL credentials with client_cert_source or application + # default SSL credentials. + if client_cert_source: + cert, key = client_cert_source() + ssl_credentials = grpc.ssl_channel_credentials( + certificate_chain=cert, private_key=key + ) + else: + ssl_credentials = SslCredentials().ssl_credentials + + # create a new channel. The provided one is ignored. + self._grpc_channel = type(self).create_channel( + host, + credentials=credentials, + credentials_file=credentials_file, + ssl_credentials=ssl_credentials, + scopes=scopes or self.AUTH_SCOPES, + quota_project_id=quota_project_id, + ) + + # Run the base constructor. + super().__init__( + host=host, + credentials=credentials, + credentials_file=credentials_file, + scopes=scopes or self.AUTH_SCOPES, + quota_project_id=quota_project_id, + ) + + self._stubs = {} + + @property + def grpc_channel(self) -> aio.Channel: + """Create the channel designed to connect to this service. + + This property caches on the instance; repeated calls return + the same channel. + """ + # Sanity check: Only create a new channel if we do not already + # have one. + if not hasattr(self, "_grpc_channel"): + self._grpc_channel = self.create_channel( + self._host, credentials=self._credentials, + ) + + # Return the channel from cache. + return self._grpc_channel + + @property + def complete_query( + self, + ) -> Callable[ + [completion_service.CompleteQueryRequest], + Awaitable[completion_service.CompleteQueryResponse], + ]: + r"""Return a callable for the complete query method over gRPC. + + Completes the specified prefix with keyword + suggestions. Intended for use by a job search auto- + complete search box. + + Returns: + Callable[[~.CompleteQueryRequest], + Awaitable[~.CompleteQueryResponse]]: + A function that, when called, will call the underlying RPC + on the server. + """ + # 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 "complete_query" not in self._stubs: + self._stubs["complete_query"] = self.grpc_channel.unary_unary( + "/google.cloud.talent.v4beta1.Completion/CompleteQuery", + request_serializer=completion_service.CompleteQueryRequest.serialize, + response_deserializer=completion_service.CompleteQueryResponse.deserialize, + ) + return self._stubs["complete_query"] + + +__all__ = ("CompletionGrpcAsyncIOTransport",) diff --git a/google/cloud/talent_v4beta1/services/event_service/__init__.py b/google/cloud/talent_v4beta1/services/event_service/__init__.py new file mode 100644 index 00000000..f321845c --- /dev/null +++ b/google/cloud/talent_v4beta1/services/event_service/__init__.py @@ -0,0 +1,24 @@ +# -*- 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. +# + +from .client import EventServiceClient +from .async_client import EventServiceAsyncClient + +__all__ = ( + "EventServiceClient", + "EventServiceAsyncClient", +) diff --git a/google/cloud/talent_v4beta1/services/event_service/async_client.py b/google/cloud/talent_v4beta1/services/event_service/async_client.py new file mode 100644 index 00000000..668407fb --- /dev/null +++ b/google/cloud/talent_v4beta1/services/event_service/async_client.py @@ -0,0 +1,205 @@ +# -*- 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. +# + +from collections import OrderedDict +import functools +import re +from typing import Dict, Sequence, Tuple, Type, Union +import pkg_resources + +import google.api_core.client_options as ClientOptions # type: ignore +from google.api_core import exceptions # type: ignore +from google.api_core import gapic_v1 # type: ignore +from google.api_core import retry as retries # type: ignore +from google.auth import credentials # type: ignore +from google.oauth2 import service_account # type: ignore + +from google.cloud.talent_v4beta1.types import event +from google.cloud.talent_v4beta1.types import event_service +from google.protobuf import timestamp_pb2 as timestamp # type: ignore + +from .transports.base import EventServiceTransport +from .transports.grpc_asyncio import EventServiceGrpcAsyncIOTransport +from .client import EventServiceClient + + +class EventServiceAsyncClient: + """A service handles client event report.""" + + _client: EventServiceClient + + DEFAULT_ENDPOINT = EventServiceClient.DEFAULT_ENDPOINT + DEFAULT_MTLS_ENDPOINT = EventServiceClient.DEFAULT_MTLS_ENDPOINT + + from_service_account_file = EventServiceClient.from_service_account_file + from_service_account_json = from_service_account_file + + get_transport_class = functools.partial( + type(EventServiceClient).get_transport_class, type(EventServiceClient) + ) + + def __init__( + self, + *, + credentials: credentials.Credentials = None, + transport: Union[str, EventServiceTransport] = "grpc_asyncio", + client_options: ClientOptions = None, + ) -> None: + """Instantiate the event service client. + + Args: + credentials (Optional[google.auth.credentials.Credentials]): The + authorization credentials to attach to requests. These + credentials identify the application to the service; if none + are specified, the client will attempt to ascertain the + credentials from the environment. + transport (Union[str, ~.EventServiceTransport]): The + transport to use. If set to None, a transport is chosen + automatically. + client_options (ClientOptions): Custom options for the client. It + won't take effect if a ``transport`` instance is provided. + (1) The ``api_endpoint`` property can be used to override the + default endpoint provided by the client. GOOGLE_API_USE_MTLS + environment variable can also be used to override the endpoint: + "always" (always use the default mTLS endpoint), "never" (always + use the default regular endpoint, this is the default value for + the environment variable) and "auto" (auto switch to the default + mTLS endpoint if client SSL credentials is present). However, + the ``api_endpoint`` property takes precedence if provided. + (2) The ``client_cert_source`` property is used to provide client + SSL credentials for mutual TLS transport. If not provided, the + default SSL credentials will be used if present. + + Raises: + google.auth.exceptions.MutualTlsChannelError: If mutual TLS transport + creation failed for any reason. + """ + + self._client = EventServiceClient( + credentials=credentials, transport=transport, client_options=client_options, + ) + + async def create_client_event( + self, + request: event_service.CreateClientEventRequest = None, + *, + parent: str = None, + client_event: event.ClientEvent = None, + retry: retries.Retry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> event.ClientEvent: + r"""Report events issued when end user interacts with customer's + application that uses Cloud Talent Solution. You may inspect the + created events in `self service + tools `__. + `Learn + more `__ + about self service tools. + + Args: + request (:class:`~.event_service.CreateClientEventRequest`): + The request object. The report event request. + parent (:class:`str`): + Required. Resource name of the tenant under which the + event is created. + + The format is + "projects/{project_id}/tenants/{tenant_id}", for + example, "projects/foo/tenant/bar". If tenant id is + unspecified, a default tenant is created, for example, + "projects/foo". + This corresponds to the ``parent`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + client_event (:class:`~.event.ClientEvent`): + Required. Events issued when end user + interacts with customer's application + that uses Cloud Talent Solution. + This corresponds to the ``client_event`` 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. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + ~.event.ClientEvent: + An event issued when an end user + interacts with the application that + implements Cloud Talent Solution. + Providing this information improves the + quality of results for the API clients, + enabling the service to perform + optimally. The number of events sent + must be consistent with other calls, + such as job searches, issued to the + service by the client. + + """ + # Create or coerce a protobuf request object. + # Sanity check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + if request is not None and any([parent, client_event]): + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + request = event_service.CreateClientEventRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + + if parent is not None: + request.parent = parent + if client_event is not None: + request.client_event = client_event + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.create_client_event, + default_timeout=30.0, + client_info=_client_info, + ) + + # 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),)), + ) + + # Send the request. + response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + + # Done; return the response. + return response + + +try: + _client_info = gapic_v1.client_info.ClientInfo( + gapic_version=pkg_resources.get_distribution("google-cloud-talent",).version, + ) +except pkg_resources.DistributionNotFound: + _client_info = gapic_v1.client_info.ClientInfo() + + +__all__ = ("EventServiceAsyncClient",) diff --git a/google/cloud/talent_v4beta1/services/event_service/client.py b/google/cloud/talent_v4beta1/services/event_service/client.py new file mode 100644 index 00000000..b24e2173 --- /dev/null +++ b/google/cloud/talent_v4beta1/services/event_service/client.py @@ -0,0 +1,331 @@ +# -*- 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. +# + +from collections import OrderedDict +import os +import re +from typing import Callable, Dict, Sequence, Tuple, Type, Union +import pkg_resources + +import google.api_core.client_options as ClientOptions # type: ignore +from google.api_core import exceptions # type: ignore +from google.api_core import gapic_v1 # type: ignore +from google.api_core import retry as retries # type: ignore +from google.auth import credentials # type: ignore +from google.auth.transport import mtls # type: ignore +from google.auth.exceptions import MutualTLSChannelError # type: ignore +from google.oauth2 import service_account # type: ignore + +from google.cloud.talent_v4beta1.types import event +from google.cloud.talent_v4beta1.types import event_service +from google.protobuf import timestamp_pb2 as timestamp # type: ignore + +from .transports.base import EventServiceTransport +from .transports.grpc import EventServiceGrpcTransport +from .transports.grpc_asyncio import EventServiceGrpcAsyncIOTransport + + +class EventServiceClientMeta(type): + """Metaclass for the EventService client. + + This provides class-level methods for building and retrieving + support objects (e.g. transport) without polluting the client instance + objects. + """ + + _transport_registry = OrderedDict() # type: Dict[str, Type[EventServiceTransport]] + _transport_registry["grpc"] = EventServiceGrpcTransport + _transport_registry["grpc_asyncio"] = EventServiceGrpcAsyncIOTransport + + def get_transport_class(cls, label: str = None,) -> Type[EventServiceTransport]: + """Return an appropriate transport class. + + Args: + label: The name of the desired transport. If none is + provided, then the first transport in the registry is used. + + Returns: + The transport class to use. + """ + # If a specific transport is requested, return that one. + if label: + return cls._transport_registry[label] + + # No transport is requested; return the default (that is, the first one + # in the dictionary). + return next(iter(cls._transport_registry.values())) + + +class EventServiceClient(metaclass=EventServiceClientMeta): + """A service handles client event report.""" + + @staticmethod + def _get_default_mtls_endpoint(api_endpoint): + """Convert api endpoint to mTLS endpoint. + Convert "*.sandbox.googleapis.com" and "*.googleapis.com" to + "*.mtls.sandbox.googleapis.com" and "*.mtls.googleapis.com" respectively. + Args: + api_endpoint (Optional[str]): the api endpoint to convert. + Returns: + str: converted mTLS api endpoint. + """ + if not api_endpoint: + return api_endpoint + + mtls_endpoint_re = re.compile( + r"(?P[^.]+)(?P\.mtls)?(?P\.sandbox)?(?P\.googleapis\.com)?" + ) + + m = mtls_endpoint_re.match(api_endpoint) + name, mtls, sandbox, googledomain = m.groups() + if mtls or not googledomain: + return api_endpoint + + if sandbox: + return api_endpoint.replace( + "sandbox.googleapis.com", "mtls.sandbox.googleapis.com" + ) + + return api_endpoint.replace(".googleapis.com", ".mtls.googleapis.com") + + DEFAULT_ENDPOINT = "jobs.googleapis.com" + DEFAULT_MTLS_ENDPOINT = _get_default_mtls_endpoint.__func__( # type: ignore + DEFAULT_ENDPOINT + ) + + @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: + {@api.name}: The constructed client. + """ + credentials = service_account.Credentials.from_service_account_file(filename) + kwargs["credentials"] = credentials + return cls(*args, **kwargs) + + from_service_account_json = from_service_account_file + + def __init__( + self, + *, + credentials: credentials.Credentials = None, + transport: Union[str, EventServiceTransport] = None, + client_options: ClientOptions = None, + ) -> None: + """Instantiate the event service client. + + Args: + credentials (Optional[google.auth.credentials.Credentials]): The + authorization credentials to attach to requests. These + credentials identify the application to the service; if none + are specified, the client will attempt to ascertain the + credentials from the environment. + transport (Union[str, ~.EventServiceTransport]): The + transport to use. If set to None, a transport is chosen + automatically. + client_options (ClientOptions): Custom options for the client. It + won't take effect if a ``transport`` instance is provided. + (1) The ``api_endpoint`` property can be used to override the + default endpoint provided by the client. GOOGLE_API_USE_MTLS + environment variable can also be used to override the endpoint: + "always" (always use the default mTLS endpoint), "never" (always + use the default regular endpoint, this is the default value for + the environment variable) and "auto" (auto switch to the default + mTLS endpoint if client SSL credentials is present). However, + the ``api_endpoint`` property takes precedence if provided. + (2) The ``client_cert_source`` property is used to provide client + SSL credentials for mutual TLS transport. If not provided, the + default SSL credentials will be used if present. + + Raises: + google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport + creation failed for any reason. + """ + if isinstance(client_options, dict): + client_options = ClientOptions.from_dict(client_options) + if client_options is None: + client_options = ClientOptions.ClientOptions() + + if client_options.api_endpoint is None: + use_mtls_env = os.getenv("GOOGLE_API_USE_MTLS", "never") + if use_mtls_env == "never": + client_options.api_endpoint = self.DEFAULT_ENDPOINT + elif use_mtls_env == "always": + client_options.api_endpoint = self.DEFAULT_MTLS_ENDPOINT + elif use_mtls_env == "auto": + has_client_cert_source = ( + client_options.client_cert_source is not None + or mtls.has_default_client_cert_source() + ) + client_options.api_endpoint = ( + self.DEFAULT_MTLS_ENDPOINT + if has_client_cert_source + else self.DEFAULT_ENDPOINT + ) + else: + raise MutualTLSChannelError( + "Unsupported GOOGLE_API_USE_MTLS value. Accepted values: never, auto, always" + ) + + # Save or instantiate the transport. + # Ordinarily, we provide the transport, but allowing a custom transport + # instance provides an extensibility point for unusual situations. + if isinstance(transport, EventServiceTransport): + # transport is a EventServiceTransport instance. + if credentials or client_options.credentials_file: + raise ValueError( + "When providing a transport instance, " + "provide its credentials directly." + ) + if client_options.scopes: + raise ValueError( + "When providing a transport instance, " + "provide its scopes directly." + ) + self._transport = transport + else: + Transport = type(self).get_transport_class(transport) + self._transport = Transport( + credentials=credentials, + credentials_file=client_options.credentials_file, + host=client_options.api_endpoint, + scopes=client_options.scopes, + api_mtls_endpoint=client_options.api_endpoint, + client_cert_source=client_options.client_cert_source, + quota_project_id=client_options.quota_project_id, + ) + + def create_client_event( + self, + request: event_service.CreateClientEventRequest = None, + *, + parent: str = None, + client_event: event.ClientEvent = None, + retry: retries.Retry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> event.ClientEvent: + r"""Report events issued when end user interacts with customer's + application that uses Cloud Talent Solution. You may inspect the + created events in `self service + tools `__. + `Learn + more `__ + about self service tools. + + Args: + request (:class:`~.event_service.CreateClientEventRequest`): + The request object. The report event request. + parent (:class:`str`): + Required. Resource name of the tenant under which the + event is created. + + The format is + "projects/{project_id}/tenants/{tenant_id}", for + example, "projects/foo/tenant/bar". If tenant id is + unspecified, a default tenant is created, for example, + "projects/foo". + This corresponds to the ``parent`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + client_event (:class:`~.event.ClientEvent`): + Required. Events issued when end user + interacts with customer's application + that uses Cloud Talent Solution. + This corresponds to the ``client_event`` 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. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + ~.event.ClientEvent: + An event issued when an end user + interacts with the application that + implements Cloud Talent Solution. + Providing this information improves the + quality of results for the API clients, + enabling the service to perform + optimally. The number of events sent + must be consistent with other calls, + such as job searches, issued to the + service by the client. + + """ + # Create or coerce a protobuf request object. + # Sanity check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([parent, client_event]) + if request is not None and has_flattened_params: + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + # Minor optimization to avoid making a copy if the user passes + # in a event_service.CreateClientEventRequest. + # There's no risk of modifying the input as we've already verified + # there are no flattened fields. + if not isinstance(request, event_service.CreateClientEventRequest): + request = event_service.CreateClientEventRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + + if parent is not None: + request.parent = parent + if client_event is not None: + request.client_event = client_event + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.create_client_event] + + # 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),)), + ) + + # Send the request. + response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + + # Done; return the response. + return response + + +try: + _client_info = gapic_v1.client_info.ClientInfo( + gapic_version=pkg_resources.get_distribution("google-cloud-talent",).version, + ) +except pkg_resources.DistributionNotFound: + _client_info = gapic_v1.client_info.ClientInfo() + + +__all__ = ("EventServiceClient",) diff --git a/google/cloud/talent_v4beta1/services/event_service/transports/__init__.py b/google/cloud/talent_v4beta1/services/event_service/transports/__init__.py new file mode 100644 index 00000000..18ca2a9d --- /dev/null +++ b/google/cloud/talent_v4beta1/services/event_service/transports/__init__.py @@ -0,0 +1,36 @@ +# -*- 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. +# + +from collections import OrderedDict +from typing import Dict, Type + +from .base import EventServiceTransport +from .grpc import EventServiceGrpcTransport +from .grpc_asyncio import EventServiceGrpcAsyncIOTransport + + +# Compile a registry of transports. +_transport_registry = OrderedDict() # type: Dict[str, Type[EventServiceTransport]] +_transport_registry["grpc"] = EventServiceGrpcTransport +_transport_registry["grpc_asyncio"] = EventServiceGrpcAsyncIOTransport + + +__all__ = ( + "EventServiceTransport", + "EventServiceGrpcTransport", + "EventServiceGrpcAsyncIOTransport", +) diff --git a/google/cloud/talent_v4beta1/services/event_service/transports/base.py b/google/cloud/talent_v4beta1/services/event_service/transports/base.py new file mode 100644 index 00000000..2394cfd0 --- /dev/null +++ b/google/cloud/talent_v4beta1/services/event_service/transports/base.py @@ -0,0 +1,122 @@ +# -*- 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. +# + +import abc +import typing +import pkg_resources + +from google import auth +from google.api_core import exceptions # type: ignore +from google.api_core import gapic_v1 # type: ignore +from google.api_core import retry as retries # type: ignore +from google.auth import credentials # type: ignore + +from google.cloud.talent_v4beta1.types import event +from google.cloud.talent_v4beta1.types import event_service + + +try: + _client_info = gapic_v1.client_info.ClientInfo( + gapic_version=pkg_resources.get_distribution("google-cloud-talent",).version, + ) +except pkg_resources.DistributionNotFound: + _client_info = gapic_v1.client_info.ClientInfo() + + +class EventServiceTransport(abc.ABC): + """Abstract transport class for EventService.""" + + AUTH_SCOPES = ( + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/jobs", + ) + + def __init__( + self, + *, + host: str = "jobs.googleapis.com", + credentials: credentials.Credentials = None, + credentials_file: typing.Optional[str] = None, + scopes: typing.Optional[typing.Sequence[str]] = AUTH_SCOPES, + quota_project_id: typing.Optional[str] = None, + **kwargs, + ) -> None: + """Instantiate the transport. + + Args: + host (Optional[str]): The hostname to connect to. + credentials (Optional[google.auth.credentials.Credentials]): The + authorization credentials to attach to requests. These + credentials identify the application to the service; if none + are specified, the client will attempt to ascertain the + credentials from the environment. + credentials_file (Optional[str]): A file with credentials that can + be loaded with :func:`google.auth.load_credentials_from_file`. + This argument is mutually exclusive with credentials. + scope (Optional[Sequence[str]]): A list of scopes. + quota_project_id (Optional[str]): An optional project to use for billing + and quota. + """ + # Save the hostname. Default to port 443 (HTTPS) if none is specified. + if ":" not in host: + host += ":443" + self._host = host + + # If no credentials are provided, then determine the appropriate + # defaults. + if credentials and credentials_file: + raise exceptions.DuplicateCredentialArgs( + "'credentials_file' and 'credentials' are mutually exclusive" + ) + + if credentials_file is not None: + credentials, _ = auth.load_credentials_from_file( + credentials_file, scopes=scopes, quota_project_id=quota_project_id + ) + + elif credentials is None: + credentials, _ = auth.default( + scopes=scopes, quota_project_id=quota_project_id + ) + + # Save the credentials. + self._credentials = credentials + + # Lifted into its own function so it can be stubbed out during tests. + self._prep_wrapped_messages() + + def _prep_wrapped_messages(self): + # Precompute the wrapped methods. + self._wrapped_methods = { + self.create_client_event: gapic_v1.method.wrap_method( + self.create_client_event, + default_timeout=30.0, + client_info=_client_info, + ), + } + + @property + def create_client_event( + self, + ) -> typing.Callable[ + [event_service.CreateClientEventRequest], + typing.Union[event.ClientEvent, typing.Awaitable[event.ClientEvent]], + ]: + raise NotImplementedError() + + +__all__ = ("EventServiceTransport",) diff --git a/google/cloud/talent_v4beta1/services/event_service/transports/grpc.py b/google/cloud/talent_v4beta1/services/event_service/transports/grpc.py new file mode 100644 index 00000000..50109487 --- /dev/null +++ b/google/cloud/talent_v4beta1/services/event_service/transports/grpc.py @@ -0,0 +1,240 @@ +# -*- 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. +# + +from typing import Callable, Dict, Optional, Sequence, Tuple + +from google.api_core import grpc_helpers # type: ignore +from google import auth # type: ignore +from google.auth import credentials # type: ignore +from google.auth.transport.grpc import SslCredentials # type: ignore + + +import grpc # type: ignore + +from google.cloud.talent_v4beta1.types import event +from google.cloud.talent_v4beta1.types import event_service + +from .base import EventServiceTransport + + +class EventServiceGrpcTransport(EventServiceTransport): + """gRPC backend transport for EventService. + + A service handles client event report. + + This class defines the same methods as the primary client, so the + primary client can load the underlying transport implementation + and call it. + + It sends protocol buffers over the wire using gRPC (which is built on + top of HTTP/2); the ``grpcio`` package must be installed. + """ + + _stubs: Dict[str, Callable] + + def __init__( + self, + *, + host: str = "jobs.googleapis.com", + credentials: credentials.Credentials = None, + credentials_file: str = None, + scopes: Sequence[str] = None, + channel: grpc.Channel = None, + api_mtls_endpoint: str = None, + client_cert_source: Callable[[], Tuple[bytes, bytes]] = None, + quota_project_id: Optional[str] = None + ) -> None: + """Instantiate the transport. + + Args: + host (Optional[str]): The hostname to connect to. + credentials (Optional[google.auth.credentials.Credentials]): The + authorization credentials to attach to requests. These + credentials identify the application to the service; if none + are specified, the client will attempt to ascertain the + credentials from the environment. + This argument is ignored if ``channel`` is provided. + credentials_file (Optional[str]): A file with credentials that can + be loaded with :func:`google.auth.load_credentials_from_file`. + This argument is ignored if ``channel`` is provided. + scopes (Optional(Sequence[str])): A list of scopes. This argument is + ignored if ``channel`` is provided. + channel (Optional[grpc.Channel]): A ``Channel`` instance through + which to make calls. + api_mtls_endpoint (Optional[str]): The mutual TLS endpoint. If + provided, it overrides the ``host`` argument and tries to create + a mutual TLS channel with client SSL credentials from + ``client_cert_source`` or applicatin default SSL credentials. + client_cert_source (Optional[Callable[[], Tuple[bytes, bytes]]]): A + callback to provide client SSL certificate bytes and private key + bytes, both in PEM format. It is ignored if ``api_mtls_endpoint`` + is None. + quota_project_id (Optional[str]): An optional project to use for billing + and quota. + + Raises: + google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport + creation failed for any reason. + google.api_core.exceptions.DuplicateCredentialArgs: If both ``credentials`` + and ``credentials_file`` are passed. + """ + if channel: + # Sanity check: Ensure that channel and credentials are not both + # provided. + credentials = False + + # If a channel was explicitly provided, set it. + self._grpc_channel = channel + elif api_mtls_endpoint: + host = ( + api_mtls_endpoint + if ":" in api_mtls_endpoint + else api_mtls_endpoint + ":443" + ) + + if credentials is None: + credentials, _ = auth.default( + scopes=self.AUTH_SCOPES, quota_project_id=quota_project_id + ) + + # Create SSL credentials with client_cert_source or application + # default SSL credentials. + if client_cert_source: + cert, key = client_cert_source() + ssl_credentials = grpc.ssl_channel_credentials( + certificate_chain=cert, private_key=key + ) + else: + ssl_credentials = SslCredentials().ssl_credentials + + # create a new channel. The provided one is ignored. + self._grpc_channel = type(self).create_channel( + host, + credentials=credentials, + credentials_file=credentials_file, + ssl_credentials=ssl_credentials, + scopes=scopes or self.AUTH_SCOPES, + quota_project_id=quota_project_id, + ) + + self._stubs = {} # type: Dict[str, Callable] + + # Run the base constructor. + super().__init__( + host=host, + credentials=credentials, + credentials_file=credentials_file, + scopes=scopes or self.AUTH_SCOPES, + quota_project_id=quota_project_id, + ) + + @classmethod + def create_channel( + cls, + host: str = "jobs.googleapis.com", + credentials: credentials.Credentials = None, + credentials_file: str = None, + scopes: Optional[Sequence[str]] = None, + quota_project_id: Optional[str] = None, + **kwargs + ) -> grpc.Channel: + """Create and return a gRPC channel object. + Args: + address (Optionsl[str]): The host for the channel to use. + credentials (Optional[~.Credentials]): The + authorization credentials to attach to requests. These + credentials identify this application to the service. If + none are specified, the client will attempt to ascertain + the credentials from the environment. + credentials_file (Optional[str]): A file with credentials that can + be loaded with :func:`google.auth.load_credentials_from_file`. + This argument is mutually exclusive with credentials. + scopes (Optional[Sequence[str]]): A optional list of scopes needed for this + service. These are only used when credentials are not specified and + are passed to :func:`google.auth.default`. + quota_project_id (Optional[str]): An optional project to use for billing + and quota. + kwargs (Optional[dict]): Keyword arguments, which are passed to the + channel creation. + Returns: + grpc.Channel: A gRPC channel object. + + Raises: + google.api_core.exceptions.DuplicateCredentialArgs: If both ``credentials`` + and ``credentials_file`` are passed. + """ + scopes = scopes or cls.AUTH_SCOPES + return grpc_helpers.create_channel( + host, + credentials=credentials, + credentials_file=credentials_file, + scopes=scopes, + quota_project_id=quota_project_id, + **kwargs + ) + + @property + def grpc_channel(self) -> grpc.Channel: + """Create the channel designed to connect to this service. + + This property caches on the instance; repeated calls return + the same channel. + """ + # Sanity check: Only create a new channel if we do not already + # have one. + if not hasattr(self, "_grpc_channel"): + self._grpc_channel = self.create_channel( + self._host, credentials=self._credentials, + ) + + # Return the channel from cache. + return self._grpc_channel + + @property + def create_client_event( + self, + ) -> Callable[[event_service.CreateClientEventRequest], event.ClientEvent]: + r"""Return a callable for the create client event method over gRPC. + + Report events issued when end user interacts with customer's + application that uses Cloud Talent Solution. You may inspect the + created events in `self service + tools `__. + `Learn + more `__ + about self service tools. + + Returns: + Callable[[~.CreateClientEventRequest], + ~.ClientEvent]: + A function that, when called, will call the underlying RPC + on the server. + """ + # 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 "create_client_event" not in self._stubs: + self._stubs["create_client_event"] = self.grpc_channel.unary_unary( + "/google.cloud.talent.v4beta1.EventService/CreateClientEvent", + request_serializer=event_service.CreateClientEventRequest.serialize, + response_deserializer=event.ClientEvent.deserialize, + ) + return self._stubs["create_client_event"] + + +__all__ = ("EventServiceGrpcTransport",) diff --git a/google/cloud/talent_v4beta1/services/event_service/transports/grpc_asyncio.py b/google/cloud/talent_v4beta1/services/event_service/transports/grpc_asyncio.py new file mode 100644 index 00000000..1d1235da --- /dev/null +++ b/google/cloud/talent_v4beta1/services/event_service/transports/grpc_asyncio.py @@ -0,0 +1,235 @@ +# -*- 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. +# + +from typing import Awaitable, Callable, Dict, Optional, Sequence, Tuple + +from google.api_core import grpc_helpers_async # type: ignore +from google.auth import credentials # type: ignore +from google.auth.transport.grpc import SslCredentials # type: ignore + +import grpc # type: ignore +from grpc.experimental import aio # type: ignore + +from google.cloud.talent_v4beta1.types import event +from google.cloud.talent_v4beta1.types import event_service + +from .base import EventServiceTransport +from .grpc import EventServiceGrpcTransport + + +class EventServiceGrpcAsyncIOTransport(EventServiceTransport): + """gRPC AsyncIO backend transport for EventService. + + A service handles client event report. + + This class defines the same methods as the primary client, so the + primary client can load the underlying transport implementation + and call it. + + It sends protocol buffers over the wire using gRPC (which is built on + top of HTTP/2); the ``grpcio`` package must be installed. + """ + + _grpc_channel: aio.Channel + _stubs: Dict[str, Callable] = {} + + @classmethod + def create_channel( + cls, + host: str = "jobs.googleapis.com", + credentials: credentials.Credentials = None, + credentials_file: Optional[str] = None, + scopes: Optional[Sequence[str]] = None, + quota_project_id: Optional[str] = None, + **kwargs, + ) -> aio.Channel: + """Create and return a gRPC AsyncIO channel object. + Args: + address (Optional[str]): The host for the channel to use. + credentials (Optional[~.Credentials]): The + authorization credentials to attach to requests. These + credentials identify this application to the service. If + none are specified, the client will attempt to ascertain + the credentials from the environment. + credentials_file (Optional[str]): A file with credentials that can + be loaded with :func:`google.auth.load_credentials_from_file`. + This argument is ignored if ``channel`` is provided. + scopes (Optional[Sequence[str]]): A optional list of scopes needed for this + service. These are only used when credentials are not specified and + are passed to :func:`google.auth.default`. + quota_project_id (Optional[str]): An optional project to use for billing + and quota. + kwargs (Optional[dict]): Keyword arguments, which are passed to the + channel creation. + Returns: + aio.Channel: A gRPC AsyncIO channel object. + """ + scopes = scopes or cls.AUTH_SCOPES + return grpc_helpers_async.create_channel( + host, + credentials=credentials, + credentials_file=credentials_file, + scopes=scopes, + quota_project_id=quota_project_id, + **kwargs, + ) + + def __init__( + self, + *, + host: str = "jobs.googleapis.com", + credentials: credentials.Credentials = None, + credentials_file: Optional[str] = None, + scopes: Optional[Sequence[str]] = None, + channel: aio.Channel = None, + api_mtls_endpoint: str = None, + client_cert_source: Callable[[], Tuple[bytes, bytes]] = None, + quota_project_id=None, + ) -> None: + """Instantiate the transport. + + Args: + host (Optional[str]): The hostname to connect to. + credentials (Optional[google.auth.credentials.Credentials]): The + authorization credentials to attach to requests. These + credentials identify the application to the service; if none + are specified, the client will attempt to ascertain the + credentials from the environment. + This argument is ignored if ``channel`` is provided. + credentials_file (Optional[str]): A file with credentials that can + be loaded with :func:`google.auth.load_credentials_from_file`. + This argument is ignored if ``channel`` is provided. + scopes (Optional[Sequence[str]]): A optional list of scopes needed for this + service. These are only used when credentials are not specified and + are passed to :func:`google.auth.default`. + channel (Optional[aio.Channel]): A ``Channel`` instance through + which to make calls. + api_mtls_endpoint (Optional[str]): The mutual TLS endpoint. If + provided, it overrides the ``host`` argument and tries to create + a mutual TLS channel with client SSL credentials from + ``client_cert_source`` or applicatin default SSL credentials. + client_cert_source (Optional[Callable[[], Tuple[bytes, bytes]]]): A + callback to provide client SSL certificate bytes and private key + bytes, both in PEM format. It is ignored if ``api_mtls_endpoint`` + is None. + quota_project_id (Optional[str]): An optional project to use for billing + and quota. + + Raises: + google.auth.exceptions.MutualTlsChannelError: If mutual TLS transport + creation failed for any reason. + google.api_core.exceptions.DuplicateCredentialArgs: If both ``credentials`` + and ``credentials_file`` are passed. + """ + if channel: + # Sanity check: Ensure that channel and credentials are not both + # provided. + credentials = False + + # If a channel was explicitly provided, set it. + self._grpc_channel = channel + elif api_mtls_endpoint: + host = ( + api_mtls_endpoint + if ":" in api_mtls_endpoint + else api_mtls_endpoint + ":443" + ) + + # Create SSL credentials with client_cert_source or application + # default SSL credentials. + if client_cert_source: + cert, key = client_cert_source() + ssl_credentials = grpc.ssl_channel_credentials( + certificate_chain=cert, private_key=key + ) + else: + ssl_credentials = SslCredentials().ssl_credentials + + # create a new channel. The provided one is ignored. + self._grpc_channel = type(self).create_channel( + host, + credentials=credentials, + credentials_file=credentials_file, + ssl_credentials=ssl_credentials, + scopes=scopes or self.AUTH_SCOPES, + quota_project_id=quota_project_id, + ) + + # Run the base constructor. + super().__init__( + host=host, + credentials=credentials, + credentials_file=credentials_file, + scopes=scopes or self.AUTH_SCOPES, + quota_project_id=quota_project_id, + ) + + self._stubs = {} + + @property + def grpc_channel(self) -> aio.Channel: + """Create the channel designed to connect to this service. + + This property caches on the instance; repeated calls return + the same channel. + """ + # Sanity check: Only create a new channel if we do not already + # have one. + if not hasattr(self, "_grpc_channel"): + self._grpc_channel = self.create_channel( + self._host, credentials=self._credentials, + ) + + # Return the channel from cache. + return self._grpc_channel + + @property + def create_client_event( + self, + ) -> Callable[ + [event_service.CreateClientEventRequest], Awaitable[event.ClientEvent] + ]: + r"""Return a callable for the create client event method over gRPC. + + Report events issued when end user interacts with customer's + application that uses Cloud Talent Solution. You may inspect the + created events in `self service + tools `__. + `Learn + more `__ + about self service tools. + + Returns: + Callable[[~.CreateClientEventRequest], + Awaitable[~.ClientEvent]]: + A function that, when called, will call the underlying RPC + on the server. + """ + # 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 "create_client_event" not in self._stubs: + self._stubs["create_client_event"] = self.grpc_channel.unary_unary( + "/google.cloud.talent.v4beta1.EventService/CreateClientEvent", + request_serializer=event_service.CreateClientEventRequest.serialize, + response_deserializer=event.ClientEvent.deserialize, + ) + return self._stubs["create_client_event"] + + +__all__ = ("EventServiceGrpcAsyncIOTransport",) diff --git a/google/cloud/talent_v4beta1/services/job_service/__init__.py b/google/cloud/talent_v4beta1/services/job_service/__init__.py new file mode 100644 index 00000000..5f157047 --- /dev/null +++ b/google/cloud/talent_v4beta1/services/job_service/__init__.py @@ -0,0 +1,24 @@ +# -*- 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. +# + +from .client import JobServiceClient +from .async_client import JobServiceAsyncClient + +__all__ = ( + "JobServiceClient", + "JobServiceAsyncClient", +) diff --git a/google/cloud/talent_v4beta1/services/job_service/async_client.py b/google/cloud/talent_v4beta1/services/job_service/async_client.py new file mode 100644 index 00000000..876d3477 --- /dev/null +++ b/google/cloud/talent_v4beta1/services/job_service/async_client.py @@ -0,0 +1,993 @@ +# -*- 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. +# + +from collections import OrderedDict +import functools +import re +from typing import Dict, Sequence, Tuple, Type, Union +import pkg_resources + +import google.api_core.client_options as ClientOptions # type: ignore +from google.api_core import exceptions # type: ignore +from google.api_core import gapic_v1 # type: ignore +from google.api_core import retry as retries # type: ignore +from google.auth import credentials # type: ignore +from google.oauth2 import service_account # type: ignore + +from google.api_core import operation +from google.api_core import operation_async +from google.cloud.talent_v4beta1.services.job_service import pagers +from google.cloud.talent_v4beta1.types import common +from google.cloud.talent_v4beta1.types import job +from google.cloud.talent_v4beta1.types import job as gct_job +from google.cloud.talent_v4beta1.types import job_service +from google.protobuf import timestamp_pb2 as timestamp # type: ignore + +from .transports.base import JobServiceTransport +from .transports.grpc_asyncio import JobServiceGrpcAsyncIOTransport +from .client import JobServiceClient + + +class JobServiceAsyncClient: + """A service handles job management, including job CRUD, + enumeration and search. + """ + + _client: JobServiceClient + + DEFAULT_ENDPOINT = JobServiceClient.DEFAULT_ENDPOINT + DEFAULT_MTLS_ENDPOINT = JobServiceClient.DEFAULT_MTLS_ENDPOINT + + job_path = staticmethod(JobServiceClient.job_path) + + from_service_account_file = JobServiceClient.from_service_account_file + from_service_account_json = from_service_account_file + + get_transport_class = functools.partial( + type(JobServiceClient).get_transport_class, type(JobServiceClient) + ) + + def __init__( + self, + *, + credentials: credentials.Credentials = None, + transport: Union[str, JobServiceTransport] = "grpc_asyncio", + client_options: ClientOptions = None, + ) -> None: + """Instantiate the job service client. + + Args: + credentials (Optional[google.auth.credentials.Credentials]): The + authorization credentials to attach to requests. These + credentials identify the application to the service; if none + are specified, the client will attempt to ascertain the + credentials from the environment. + transport (Union[str, ~.JobServiceTransport]): The + transport to use. If set to None, a transport is chosen + automatically. + client_options (ClientOptions): Custom options for the client. It + won't take effect if a ``transport`` instance is provided. + (1) The ``api_endpoint`` property can be used to override the + default endpoint provided by the client. GOOGLE_API_USE_MTLS + environment variable can also be used to override the endpoint: + "always" (always use the default mTLS endpoint), "never" (always + use the default regular endpoint, this is the default value for + the environment variable) and "auto" (auto switch to the default + mTLS endpoint if client SSL credentials is present). However, + the ``api_endpoint`` property takes precedence if provided. + (2) The ``client_cert_source`` property is used to provide client + SSL credentials for mutual TLS transport. If not provided, the + default SSL credentials will be used if present. + + Raises: + google.auth.exceptions.MutualTlsChannelError: If mutual TLS transport + creation failed for any reason. + """ + + self._client = JobServiceClient( + credentials=credentials, transport=transport, client_options=client_options, + ) + + async def create_job( + self, + request: job_service.CreateJobRequest = None, + *, + parent: str = None, + job: gct_job.Job = None, + retry: retries.Retry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> gct_job.Job: + r"""Creates a new job. + Typically, the job becomes searchable within 10 seconds, + but it may take up to 5 minutes. + + Args: + request (:class:`~.job_service.CreateJobRequest`): + The request object. Create job request. + parent (:class:`str`): + Required. The resource name of the tenant under which + the job is created. + + The format is + "projects/{project_id}/tenants/{tenant_id}". For + example, "projects/foo/tenant/bar". If tenant id is + unspecified a default tenant is created. For example, + "projects/foo". + This corresponds to the ``parent`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + job (:class:`~.gct_job.Job`): + Required. The Job to be created. + This corresponds to the ``job`` 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. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + ~.gct_job.Job: + A Job resource represents a job posting (also referred + to as a "job listing" or "job requisition"). A job + belongs to a + [Company][google.cloud.talent.v4beta1.Company], which is + the hiring entity responsible for the job. + + """ + # Create or coerce a protobuf request object. + # Sanity check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + if request is not None and any([parent, job]): + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + request = job_service.CreateJobRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + + if parent is not None: + request.parent = parent + if job is not None: + request.job = job + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.create_job, + default_timeout=30.0, + client_info=_client_info, + ) + + # 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),)), + ) + + # Send the request. + response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + + # Done; return the response. + return response + + async def batch_create_jobs( + self, + request: job_service.BatchCreateJobsRequest = None, + *, + parent: str = None, + jobs: Sequence[job.Job] = None, + retry: retries.Retry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> operation_async.AsyncOperation: + r"""Begins executing a batch create jobs operation. + + Args: + request (:class:`~.job_service.BatchCreateJobsRequest`): + The request object. Request to create a batch of jobs. + parent (:class:`str`): + Required. The resource name of the tenant under which + the job is created. + + The format is + "projects/{project_id}/tenants/{tenant_id}". For + example, "projects/foo/tenant/bar". If tenant id is + unspecified, a default tenant is created. For example, + "projects/foo". + This corresponds to the ``parent`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + jobs (:class:`Sequence[~.job.Job]`): + Required. The jobs to be created. + This corresponds to the ``jobs`` 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. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + ~.operation_async.AsyncOperation: + An object representing a long-running operation. + + The result type for the operation will be + :class:``~.job_service.JobOperationResult``: The result + of + [JobService.BatchCreateJobs][google.cloud.talent.v4beta1.JobService.BatchCreateJobs] + or + [JobService.BatchUpdateJobs][google.cloud.talent.v4beta1.JobService.BatchUpdateJobs] + APIs. It's used to replace + [google.longrunning.Operation.response][google.longrunning.Operation.response] + in case of success. + + """ + # Create or coerce a protobuf request object. + # Sanity check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + if request is not None and any([parent, jobs]): + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + request = job_service.BatchCreateJobsRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + + if parent is not None: + request.parent = parent + if jobs is not None: + request.jobs = jobs + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.batch_create_jobs, + default_timeout=30.0, + client_info=_client_info, + ) + + # 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),)), + ) + + # Send the request. + response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + + # Wrap the response in an operation future. + response = operation_async.from_gapic( + response, + self._client._transport.operations_client, + job_service.JobOperationResult, + metadata_type=common.BatchOperationMetadata, + ) + + # Done; return the response. + return response + + async def get_job( + self, + request: job_service.GetJobRequest = None, + *, + name: str = None, + retry: retries.Retry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> job.Job: + r"""Retrieves the specified job, whose status is OPEN or + recently EXPIRED within the last 90 days. + + Args: + request (:class:`~.job_service.GetJobRequest`): + The request object. Get job request. + name (:class:`str`): + Required. The resource name of the job to retrieve. + + The format is + "projects/{project_id}/tenants/{tenant_id}/jobs/{job_id}". + For example, "projects/foo/tenants/bar/jobs/baz". + + If tenant id is unspecified, the default tenant is used. + For example, "projects/foo/jobs/bar". + This corresponds to the ``name`` 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. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + ~.job.Job: + A Job resource represents a job posting (also referred + to as a "job listing" or "job requisition"). A job + belongs to a + [Company][google.cloud.talent.v4beta1.Company], which is + the hiring entity responsible for the job. + + """ + # Create or coerce a protobuf request object. + # Sanity check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + if request is not None and any([name]): + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + request = job_service.GetJobRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + + if name is not None: + request.name = name + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.get_job, + default_retry=retries.Retry( + initial=0.1, + maximum=60.0, + multiplier=1.3, + predicate=retries.if_exception_type( + exceptions.ServiceUnavailable, exceptions.DeadlineExceeded, + ), + ), + default_timeout=30.0, + client_info=_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 update_job( + self, + request: job_service.UpdateJobRequest = None, + *, + job: gct_job.Job = None, + retry: retries.Retry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> gct_job.Job: + r"""Updates specified job. + Typically, updated contents become visible in search + results within 10 seconds, but it may take up to 5 + minutes. + + Args: + request (:class:`~.job_service.UpdateJobRequest`): + The request object. Update job request. + job (:class:`~.gct_job.Job`): + Required. The Job to be updated. + This corresponds to the ``job`` 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. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + ~.gct_job.Job: + A Job resource represents a job posting (also referred + to as a "job listing" or "job requisition"). A job + belongs to a + [Company][google.cloud.talent.v4beta1.Company], which is + the hiring entity responsible for the job. + + """ + # Create or coerce a protobuf request object. + # Sanity check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + if request is not None and any([job]): + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + request = job_service.UpdateJobRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + + if job is not None: + request.job = job + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.update_job, + default_timeout=30.0, + client_info=_client_info, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata((("job.name", request.job.name),)), + ) + + # Send the request. + response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + + # Done; return the response. + return response + + async def batch_update_jobs( + self, + request: job_service.BatchUpdateJobsRequest = None, + *, + parent: str = None, + jobs: Sequence[job.Job] = None, + retry: retries.Retry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> operation_async.AsyncOperation: + r"""Begins executing a batch update jobs operation. + + Args: + request (:class:`~.job_service.BatchUpdateJobsRequest`): + The request object. Request to update a batch of jobs. + parent (:class:`str`): + Required. The resource name of the tenant under which + the job is created. + + The format is + "projects/{project_id}/tenants/{tenant_id}". For + example, "projects/foo/tenant/bar". If tenant id is + unspecified, a default tenant is created. For example, + "projects/foo". + This corresponds to the ``parent`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + jobs (:class:`Sequence[~.job.Job]`): + Required. The jobs to be updated. + This corresponds to the ``jobs`` 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. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + ~.operation_async.AsyncOperation: + An object representing a long-running operation. + + The result type for the operation will be + :class:``~.job_service.JobOperationResult``: The result + of + [JobService.BatchCreateJobs][google.cloud.talent.v4beta1.JobService.BatchCreateJobs] + or + [JobService.BatchUpdateJobs][google.cloud.talent.v4beta1.JobService.BatchUpdateJobs] + APIs. It's used to replace + [google.longrunning.Operation.response][google.longrunning.Operation.response] + in case of success. + + """ + # Create or coerce a protobuf request object. + # Sanity check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + if request is not None and any([parent, jobs]): + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + request = job_service.BatchUpdateJobsRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + + if parent is not None: + request.parent = parent + if jobs is not None: + request.jobs = jobs + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.batch_update_jobs, + default_timeout=30.0, + client_info=_client_info, + ) + + # 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),)), + ) + + # Send the request. + response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + + # Wrap the response in an operation future. + response = operation_async.from_gapic( + response, + self._client._transport.operations_client, + job_service.JobOperationResult, + metadata_type=common.BatchOperationMetadata, + ) + + # Done; return the response. + return response + + async def delete_job( + self, + request: job_service.DeleteJobRequest = None, + *, + name: str = None, + retry: retries.Retry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> None: + r"""Deletes the specified job. + Typically, the job becomes unsearchable within 10 + seconds, but it may take up to 5 minutes. + + Args: + request (:class:`~.job_service.DeleteJobRequest`): + The request object. Delete job request. + name (:class:`str`): + Required. The resource name of the job to be deleted. + + The format is + "projects/{project_id}/tenants/{tenant_id}/jobs/{job_id}". + For example, "projects/foo/tenants/bar/jobs/baz". + + If tenant id is unspecified, the default tenant is used. + For example, "projects/foo/jobs/bar". + This corresponds to the ``name`` 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. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + """ + # Create or coerce a protobuf request object. + # Sanity check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + if request is not None and any([name]): + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + request = job_service.DeleteJobRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + + if name is not None: + request.name = name + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.delete_job, + default_retry=retries.Retry( + initial=0.1, + maximum=60.0, + multiplier=1.3, + predicate=retries.if_exception_type( + exceptions.ServiceUnavailable, exceptions.DeadlineExceeded, + ), + ), + default_timeout=30.0, + client_info=_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. + await rpc( + request, retry=retry, timeout=timeout, metadata=metadata, + ) + + async def batch_delete_jobs( + self, + request: job_service.BatchDeleteJobsRequest = None, + *, + parent: str = None, + filter: str = None, + retry: retries.Retry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> None: + r"""Deletes a list of [Job][google.cloud.talent.v4beta1.Job]s by + filter. + + Args: + request (:class:`~.job_service.BatchDeleteJobsRequest`): + The request object. Batch delete jobs request. + parent (:class:`str`): + Required. The resource name of the tenant under which + the job is created. + + The format is + "projects/{project_id}/tenants/{tenant_id}". For + example, "projects/foo/tenant/bar". If tenant id is + unspecified, a default tenant is created. For example, + "projects/foo". + This corresponds to the ``parent`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + filter (:class:`str`): + Required. The filter string specifies the jobs to be + deleted. + + Supported operator: =, AND + + The fields eligible for filtering are: + + - ``companyName`` (Required) + - ``requisitionId`` (Required) + + Sample Query: companyName = "projects/foo/companies/bar" + AND requisitionId = "req-1". + This corresponds to the ``filter`` 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. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + """ + # Create or coerce a protobuf request object. + # Sanity check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + if request is not None and any([parent, filter]): + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + request = job_service.BatchDeleteJobsRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + + if parent is not None: + request.parent = parent + if filter is not None: + request.filter = filter + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.batch_delete_jobs, + default_timeout=30.0, + client_info=_client_info, + ) + + # 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),)), + ) + + # Send the request. + await rpc( + request, retry=retry, timeout=timeout, metadata=metadata, + ) + + async def list_jobs( + self, + request: job_service.ListJobsRequest = None, + *, + parent: str = None, + filter: str = None, + retry: retries.Retry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> pagers.ListJobsAsyncPager: + r"""Lists jobs by filter. + + Args: + request (:class:`~.job_service.ListJobsRequest`): + The request object. List jobs request. + parent (:class:`str`): + Required. The resource name of the tenant under which + the job is created. + + The format is + "projects/{project_id}/tenants/{tenant_id}". For + example, "projects/foo/tenant/bar". If tenant id is + unspecified, a default tenant is created. For example, + "projects/foo". + This corresponds to the ``parent`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + filter (:class:`str`): + Required. The filter string specifies the jobs to be + enumerated. + + Supported operator: =, AND + + The fields eligible for filtering are: + + - ``companyName`` (Required) + - ``requisitionId`` + - ``status`` Available values: OPEN, EXPIRED, ALL. + Defaults to OPEN if no value is specified. + + Sample Query: + + - companyName = + "projects/foo/tenants/bar/companies/baz" + - companyName = + "projects/foo/tenants/bar/companies/baz" AND + requisitionId = "req-1" + - companyName = + "projects/foo/tenants/bar/companies/baz" AND status = + "EXPIRED". + This corresponds to the ``filter`` 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. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + ~.pagers.ListJobsAsyncPager: + List jobs response. + Iterating over this object will yield + results and resolve additional pages + automatically. + + """ + # Create or coerce a protobuf request object. + # Sanity check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + if request is not None and any([parent, filter]): + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + request = job_service.ListJobsRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + + if parent is not None: + request.parent = parent + if filter is not None: + request.filter = filter + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.list_jobs, + default_retry=retries.Retry( + initial=0.1, + maximum=60.0, + multiplier=1.3, + predicate=retries.if_exception_type( + exceptions.ServiceUnavailable, exceptions.DeadlineExceeded, + ), + ), + default_timeout=30.0, + client_info=_client_info, + ) + + # 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),)), + ) + + # Send the request. + response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + + # This method is paged; wrap the response in a pager, which provides + # an `__aiter__` convenience method. + response = pagers.ListJobsAsyncPager( + method=rpc, request=request, response=response, metadata=metadata, + ) + + # Done; return the response. + return response + + async def search_jobs( + self, + request: job_service.SearchJobsRequest = None, + *, + retry: retries.Retry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> pagers.SearchJobsAsyncPager: + r"""Searches for jobs using the provided + [SearchJobsRequest][google.cloud.talent.v4beta1.SearchJobsRequest]. + + This call constrains the + [visibility][google.cloud.talent.v4beta1.Job.visibility] of jobs + present in the database, and only returns jobs that the caller + has permission to search against. + + Args: + request (:class:`~.job_service.SearchJobsRequest`): + The request object. The Request body of the `SearchJobs` + call. + + 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: + ~.pagers.SearchJobsAsyncPager: + Response for SearchJob method. + Iterating over this object will yield + results and resolve additional pages + automatically. + + """ + # Create or coerce a protobuf request object. + + request = job_service.SearchJobsRequest(request) + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.search_jobs, + default_timeout=30.0, + client_info=_client_info, + ) + + # 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),)), + ) + + # Send the request. + response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + + # This method is paged; wrap the response in a pager, which provides + # an `__aiter__` convenience method. + response = pagers.SearchJobsAsyncPager( + method=rpc, request=request, response=response, metadata=metadata, + ) + + # Done; return the response. + return response + + async def search_jobs_for_alert( + self, + request: job_service.SearchJobsRequest = None, + *, + retry: retries.Retry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> pagers.SearchJobsForAlertAsyncPager: + r"""Searches for jobs using the provided + [SearchJobsRequest][google.cloud.talent.v4beta1.SearchJobsRequest]. + + This API call is intended for the use case of targeting passive + job seekers (for example, job seekers who have signed up to + receive email alerts about potential job opportunities), and has + different algorithmic adjustments that are targeted to passive + job seekers. + + This call constrains the + [visibility][google.cloud.talent.v4beta1.Job.visibility] of jobs + present in the database, and only returns jobs the caller has + permission to search against. + + Args: + request (:class:`~.job_service.SearchJobsRequest`): + The request object. The Request body of the `SearchJobs` + call. + + 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: + ~.pagers.SearchJobsForAlertAsyncPager: + Response for SearchJob method. + Iterating over this object will yield + results and resolve additional pages + automatically. + + """ + # Create or coerce a protobuf request object. + + request = job_service.SearchJobsRequest(request) + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.search_jobs_for_alert, + default_timeout=30.0, + client_info=_client_info, + ) + + # 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),)), + ) + + # Send the request. + response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + + # This method is paged; wrap the response in a pager, which provides + # an `__aiter__` convenience method. + response = pagers.SearchJobsForAlertAsyncPager( + method=rpc, request=request, response=response, metadata=metadata, + ) + + # Done; return the response. + return response + + +try: + _client_info = gapic_v1.client_info.ClientInfo( + gapic_version=pkg_resources.get_distribution("google-cloud-talent",).version, + ) +except pkg_resources.DistributionNotFound: + _client_info = gapic_v1.client_info.ClientInfo() + + +__all__ = ("JobServiceAsyncClient",) diff --git a/google/cloud/talent_v4beta1/services/job_service/client.py b/google/cloud/talent_v4beta1/services/job_service/client.py new file mode 100644 index 00000000..79149b6a --- /dev/null +++ b/google/cloud/talent_v4beta1/services/job_service/client.py @@ -0,0 +1,1125 @@ +# -*- 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. +# + +from collections import OrderedDict +import os +import re +from typing import Callable, Dict, Sequence, Tuple, Type, Union +import pkg_resources + +import google.api_core.client_options as ClientOptions # type: ignore +from google.api_core import exceptions # type: ignore +from google.api_core import gapic_v1 # type: ignore +from google.api_core import retry as retries # type: ignore +from google.auth import credentials # type: ignore +from google.auth.transport import mtls # type: ignore +from google.auth.exceptions import MutualTLSChannelError # type: ignore +from google.oauth2 import service_account # type: ignore + +from google.api_core import operation +from google.api_core import operation_async +from google.cloud.talent_v4beta1.services.job_service import pagers +from google.cloud.talent_v4beta1.types import common +from google.cloud.talent_v4beta1.types import job +from google.cloud.talent_v4beta1.types import job as gct_job +from google.cloud.talent_v4beta1.types import job_service +from google.protobuf import timestamp_pb2 as timestamp # type: ignore + +from .transports.base import JobServiceTransport +from .transports.grpc import JobServiceGrpcTransport +from .transports.grpc_asyncio import JobServiceGrpcAsyncIOTransport + + +class JobServiceClientMeta(type): + """Metaclass for the JobService client. + + This provides class-level methods for building and retrieving + support objects (e.g. transport) without polluting the client instance + objects. + """ + + _transport_registry = OrderedDict() # type: Dict[str, Type[JobServiceTransport]] + _transport_registry["grpc"] = JobServiceGrpcTransport + _transport_registry["grpc_asyncio"] = JobServiceGrpcAsyncIOTransport + + def get_transport_class(cls, label: str = None,) -> Type[JobServiceTransport]: + """Return an appropriate transport class. + + Args: + label: The name of the desired transport. If none is + provided, then the first transport in the registry is used. + + Returns: + The transport class to use. + """ + # If a specific transport is requested, return that one. + if label: + return cls._transport_registry[label] + + # No transport is requested; return the default (that is, the first one + # in the dictionary). + return next(iter(cls._transport_registry.values())) + + +class JobServiceClient(metaclass=JobServiceClientMeta): + """A service handles job management, including job CRUD, + enumeration and search. + """ + + @staticmethod + def _get_default_mtls_endpoint(api_endpoint): + """Convert api endpoint to mTLS endpoint. + Convert "*.sandbox.googleapis.com" and "*.googleapis.com" to + "*.mtls.sandbox.googleapis.com" and "*.mtls.googleapis.com" respectively. + Args: + api_endpoint (Optional[str]): the api endpoint to convert. + Returns: + str: converted mTLS api endpoint. + """ + if not api_endpoint: + return api_endpoint + + mtls_endpoint_re = re.compile( + r"(?P[^.]+)(?P\.mtls)?(?P\.sandbox)?(?P\.googleapis\.com)?" + ) + + m = mtls_endpoint_re.match(api_endpoint) + name, mtls, sandbox, googledomain = m.groups() + if mtls or not googledomain: + return api_endpoint + + if sandbox: + return api_endpoint.replace( + "sandbox.googleapis.com", "mtls.sandbox.googleapis.com" + ) + + return api_endpoint.replace(".googleapis.com", ".mtls.googleapis.com") + + DEFAULT_ENDPOINT = "jobs.googleapis.com" + DEFAULT_MTLS_ENDPOINT = _get_default_mtls_endpoint.__func__( # type: ignore + DEFAULT_ENDPOINT + ) + + @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: + {@api.name}: The constructed client. + """ + credentials = service_account.Credentials.from_service_account_file(filename) + kwargs["credentials"] = credentials + return cls(*args, **kwargs) + + from_service_account_json = from_service_account_file + + @staticmethod + def job_path(project: str, tenant: str, job: str,) -> str: + """Return a fully-qualified job string.""" + return "projects/{project}/tenants/{tenant}/jobs/{job}".format( + project=project, tenant=tenant, job=job, + ) + + @staticmethod + def parse_job_path(path: str) -> Dict[str, str]: + """Parse a job path into its component segments.""" + m = re.match( + r"^projects/(?P.+?)/tenants/(?P.+?)/jobs/(?P.+?)$", + path, + ) + return m.groupdict() if m else {} + + def __init__( + self, + *, + credentials: credentials.Credentials = None, + transport: Union[str, JobServiceTransport] = None, + client_options: ClientOptions = None, + ) -> None: + """Instantiate the job service client. + + Args: + credentials (Optional[google.auth.credentials.Credentials]): The + authorization credentials to attach to requests. These + credentials identify the application to the service; if none + are specified, the client will attempt to ascertain the + credentials from the environment. + transport (Union[str, ~.JobServiceTransport]): The + transport to use. If set to None, a transport is chosen + automatically. + client_options (ClientOptions): Custom options for the client. It + won't take effect if a ``transport`` instance is provided. + (1) The ``api_endpoint`` property can be used to override the + default endpoint provided by the client. GOOGLE_API_USE_MTLS + environment variable can also be used to override the endpoint: + "always" (always use the default mTLS endpoint), "never" (always + use the default regular endpoint, this is the default value for + the environment variable) and "auto" (auto switch to the default + mTLS endpoint if client SSL credentials is present). However, + the ``api_endpoint`` property takes precedence if provided. + (2) The ``client_cert_source`` property is used to provide client + SSL credentials for mutual TLS transport. If not provided, the + default SSL credentials will be used if present. + + Raises: + google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport + creation failed for any reason. + """ + if isinstance(client_options, dict): + client_options = ClientOptions.from_dict(client_options) + if client_options is None: + client_options = ClientOptions.ClientOptions() + + if client_options.api_endpoint is None: + use_mtls_env = os.getenv("GOOGLE_API_USE_MTLS", "never") + if use_mtls_env == "never": + client_options.api_endpoint = self.DEFAULT_ENDPOINT + elif use_mtls_env == "always": + client_options.api_endpoint = self.DEFAULT_MTLS_ENDPOINT + elif use_mtls_env == "auto": + has_client_cert_source = ( + client_options.client_cert_source is not None + or mtls.has_default_client_cert_source() + ) + client_options.api_endpoint = ( + self.DEFAULT_MTLS_ENDPOINT + if has_client_cert_source + else self.DEFAULT_ENDPOINT + ) + else: + raise MutualTLSChannelError( + "Unsupported GOOGLE_API_USE_MTLS value. Accepted values: never, auto, always" + ) + + # Save or instantiate the transport. + # Ordinarily, we provide the transport, but allowing a custom transport + # instance provides an extensibility point for unusual situations. + if isinstance(transport, JobServiceTransport): + # transport is a JobServiceTransport instance. + if credentials or client_options.credentials_file: + raise ValueError( + "When providing a transport instance, " + "provide its credentials directly." + ) + if client_options.scopes: + raise ValueError( + "When providing a transport instance, " + "provide its scopes directly." + ) + self._transport = transport + else: + Transport = type(self).get_transport_class(transport) + self._transport = Transport( + credentials=credentials, + credentials_file=client_options.credentials_file, + host=client_options.api_endpoint, + scopes=client_options.scopes, + api_mtls_endpoint=client_options.api_endpoint, + client_cert_source=client_options.client_cert_source, + quota_project_id=client_options.quota_project_id, + ) + + def create_job( + self, + request: job_service.CreateJobRequest = None, + *, + parent: str = None, + job: gct_job.Job = None, + retry: retries.Retry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> gct_job.Job: + r"""Creates a new job. + Typically, the job becomes searchable within 10 seconds, + but it may take up to 5 minutes. + + Args: + request (:class:`~.job_service.CreateJobRequest`): + The request object. Create job request. + parent (:class:`str`): + Required. The resource name of the tenant under which + the job is created. + + The format is + "projects/{project_id}/tenants/{tenant_id}". For + example, "projects/foo/tenant/bar". If tenant id is + unspecified a default tenant is created. For example, + "projects/foo". + This corresponds to the ``parent`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + job (:class:`~.gct_job.Job`): + Required. The Job to be created. + This corresponds to the ``job`` 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. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + ~.gct_job.Job: + A Job resource represents a job posting (also referred + to as a "job listing" or "job requisition"). A job + belongs to a + [Company][google.cloud.talent.v4beta1.Company], which is + the hiring entity responsible for the job. + + """ + # Create or coerce a protobuf request object. + # Sanity check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([parent, job]) + if request is not None and has_flattened_params: + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + # Minor optimization to avoid making a copy if the user passes + # in a job_service.CreateJobRequest. + # There's no risk of modifying the input as we've already verified + # there are no flattened fields. + if not isinstance(request, job_service.CreateJobRequest): + request = job_service.CreateJobRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + + if parent is not None: + request.parent = parent + if job is not None: + request.job = job + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.create_job] + + # 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),)), + ) + + # Send the request. + response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + + # Done; return the response. + return response + + def batch_create_jobs( + self, + request: job_service.BatchCreateJobsRequest = None, + *, + parent: str = None, + jobs: Sequence[job.Job] = None, + retry: retries.Retry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> operation.Operation: + r"""Begins executing a batch create jobs operation. + + Args: + request (:class:`~.job_service.BatchCreateJobsRequest`): + The request object. Request to create a batch of jobs. + parent (:class:`str`): + Required. The resource name of the tenant under which + the job is created. + + The format is + "projects/{project_id}/tenants/{tenant_id}". For + example, "projects/foo/tenant/bar". If tenant id is + unspecified, a default tenant is created. For example, + "projects/foo". + This corresponds to the ``parent`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + jobs (:class:`Sequence[~.job.Job]`): + Required. The jobs to be created. + This corresponds to the ``jobs`` 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. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + ~.operation.Operation: + An object representing a long-running operation. + + The result type for the operation will be + :class:``~.job_service.JobOperationResult``: The result + of + [JobService.BatchCreateJobs][google.cloud.talent.v4beta1.JobService.BatchCreateJobs] + or + [JobService.BatchUpdateJobs][google.cloud.talent.v4beta1.JobService.BatchUpdateJobs] + APIs. It's used to replace + [google.longrunning.Operation.response][google.longrunning.Operation.response] + in case of success. + + """ + # Create or coerce a protobuf request object. + # Sanity check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([parent, jobs]) + if request is not None and has_flattened_params: + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + # Minor optimization to avoid making a copy if the user passes + # in a job_service.BatchCreateJobsRequest. + # There's no risk of modifying the input as we've already verified + # there are no flattened fields. + if not isinstance(request, job_service.BatchCreateJobsRequest): + request = job_service.BatchCreateJobsRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + + if parent is not None: + request.parent = parent + if jobs is not None: + request.jobs = jobs + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.batch_create_jobs] + + # 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),)), + ) + + # Send the request. + response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + + # Wrap the response in an operation future. + response = operation.from_gapic( + response, + self._transport.operations_client, + job_service.JobOperationResult, + metadata_type=common.BatchOperationMetadata, + ) + + # Done; return the response. + return response + + def get_job( + self, + request: job_service.GetJobRequest = None, + *, + name: str = None, + retry: retries.Retry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> job.Job: + r"""Retrieves the specified job, whose status is OPEN or + recently EXPIRED within the last 90 days. + + Args: + request (:class:`~.job_service.GetJobRequest`): + The request object. Get job request. + name (:class:`str`): + Required. The resource name of the job to retrieve. + + The format is + "projects/{project_id}/tenants/{tenant_id}/jobs/{job_id}". + For example, "projects/foo/tenants/bar/jobs/baz". + + If tenant id is unspecified, the default tenant is used. + For example, "projects/foo/jobs/bar". + This corresponds to the ``name`` 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. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + ~.job.Job: + A Job resource represents a job posting (also referred + to as a "job listing" or "job requisition"). A job + belongs to a + [Company][google.cloud.talent.v4beta1.Company], which is + the hiring entity responsible for the job. + + """ + # Create or coerce a protobuf request object. + # Sanity check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([name]) + if request is not None and has_flattened_params: + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + # Minor optimization to avoid making a copy if the user passes + # in a job_service.GetJobRequest. + # There's no risk of modifying the input as we've already verified + # there are no flattened fields. + if not isinstance(request, job_service.GetJobRequest): + request = job_service.GetJobRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + + if name is not None: + request.name = name + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.get_job] + + # 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 + + def update_job( + self, + request: job_service.UpdateJobRequest = None, + *, + job: gct_job.Job = None, + retry: retries.Retry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> gct_job.Job: + r"""Updates specified job. + Typically, updated contents become visible in search + results within 10 seconds, but it may take up to 5 + minutes. + + Args: + request (:class:`~.job_service.UpdateJobRequest`): + The request object. Update job request. + job (:class:`~.gct_job.Job`): + Required. The Job to be updated. + This corresponds to the ``job`` 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. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + ~.gct_job.Job: + A Job resource represents a job posting (also referred + to as a "job listing" or "job requisition"). A job + belongs to a + [Company][google.cloud.talent.v4beta1.Company], which is + the hiring entity responsible for the job. + + """ + # Create or coerce a protobuf request object. + # Sanity check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([job]) + if request is not None and has_flattened_params: + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + # Minor optimization to avoid making a copy if the user passes + # in a job_service.UpdateJobRequest. + # There's no risk of modifying the input as we've already verified + # there are no flattened fields. + if not isinstance(request, job_service.UpdateJobRequest): + request = job_service.UpdateJobRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + + if job is not None: + request.job = job + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.update_job] + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata((("job.name", request.job.name),)), + ) + + # Send the request. + response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + + # Done; return the response. + return response + + def batch_update_jobs( + self, + request: job_service.BatchUpdateJobsRequest = None, + *, + parent: str = None, + jobs: Sequence[job.Job] = None, + retry: retries.Retry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> operation.Operation: + r"""Begins executing a batch update jobs operation. + + Args: + request (:class:`~.job_service.BatchUpdateJobsRequest`): + The request object. Request to update a batch of jobs. + parent (:class:`str`): + Required. The resource name of the tenant under which + the job is created. + + The format is + "projects/{project_id}/tenants/{tenant_id}". For + example, "projects/foo/tenant/bar". If tenant id is + unspecified, a default tenant is created. For example, + "projects/foo". + This corresponds to the ``parent`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + jobs (:class:`Sequence[~.job.Job]`): + Required. The jobs to be updated. + This corresponds to the ``jobs`` 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. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + ~.operation.Operation: + An object representing a long-running operation. + + The result type for the operation will be + :class:``~.job_service.JobOperationResult``: The result + of + [JobService.BatchCreateJobs][google.cloud.talent.v4beta1.JobService.BatchCreateJobs] + or + [JobService.BatchUpdateJobs][google.cloud.talent.v4beta1.JobService.BatchUpdateJobs] + APIs. It's used to replace + [google.longrunning.Operation.response][google.longrunning.Operation.response] + in case of success. + + """ + # Create or coerce a protobuf request object. + # Sanity check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([parent, jobs]) + if request is not None and has_flattened_params: + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + # Minor optimization to avoid making a copy if the user passes + # in a job_service.BatchUpdateJobsRequest. + # There's no risk of modifying the input as we've already verified + # there are no flattened fields. + if not isinstance(request, job_service.BatchUpdateJobsRequest): + request = job_service.BatchUpdateJobsRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + + if parent is not None: + request.parent = parent + if jobs is not None: + request.jobs = jobs + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.batch_update_jobs] + + # 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),)), + ) + + # Send the request. + response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + + # Wrap the response in an operation future. + response = operation.from_gapic( + response, + self._transport.operations_client, + job_service.JobOperationResult, + metadata_type=common.BatchOperationMetadata, + ) + + # Done; return the response. + return response + + def delete_job( + self, + request: job_service.DeleteJobRequest = None, + *, + name: str = None, + retry: retries.Retry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> None: + r"""Deletes the specified job. + Typically, the job becomes unsearchable within 10 + seconds, but it may take up to 5 minutes. + + Args: + request (:class:`~.job_service.DeleteJobRequest`): + The request object. Delete job request. + name (:class:`str`): + Required. The resource name of the job to be deleted. + + The format is + "projects/{project_id}/tenants/{tenant_id}/jobs/{job_id}". + For example, "projects/foo/tenants/bar/jobs/baz". + + If tenant id is unspecified, the default tenant is used. + For example, "projects/foo/jobs/bar". + This corresponds to the ``name`` 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. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + """ + # Create or coerce a protobuf request object. + # Sanity check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([name]) + if request is not None and has_flattened_params: + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + # Minor optimization to avoid making a copy if the user passes + # in a job_service.DeleteJobRequest. + # There's no risk of modifying the input as we've already verified + # there are no flattened fields. + if not isinstance(request, job_service.DeleteJobRequest): + request = job_service.DeleteJobRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + + if name is not None: + request.name = name + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.delete_job] + + # 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. + rpc( + request, retry=retry, timeout=timeout, metadata=metadata, + ) + + def batch_delete_jobs( + self, + request: job_service.BatchDeleteJobsRequest = None, + *, + parent: str = None, + filter: str = None, + retry: retries.Retry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> None: + r"""Deletes a list of [Job][google.cloud.talent.v4beta1.Job]s by + filter. + + Args: + request (:class:`~.job_service.BatchDeleteJobsRequest`): + The request object. Batch delete jobs request. + parent (:class:`str`): + Required. The resource name of the tenant under which + the job is created. + + The format is + "projects/{project_id}/tenants/{tenant_id}". For + example, "projects/foo/tenant/bar". If tenant id is + unspecified, a default tenant is created. For example, + "projects/foo". + This corresponds to the ``parent`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + filter (:class:`str`): + Required. The filter string specifies the jobs to be + deleted. + + Supported operator: =, AND + + The fields eligible for filtering are: + + - ``companyName`` (Required) + - ``requisitionId`` (Required) + + Sample Query: companyName = "projects/foo/companies/bar" + AND requisitionId = "req-1". + This corresponds to the ``filter`` 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. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + """ + # Create or coerce a protobuf request object. + # Sanity check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([parent, filter]) + if request is not None and has_flattened_params: + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + # Minor optimization to avoid making a copy if the user passes + # in a job_service.BatchDeleteJobsRequest. + # There's no risk of modifying the input as we've already verified + # there are no flattened fields. + if not isinstance(request, job_service.BatchDeleteJobsRequest): + request = job_service.BatchDeleteJobsRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + + if parent is not None: + request.parent = parent + if filter is not None: + request.filter = filter + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.batch_delete_jobs] + + # 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),)), + ) + + # Send the request. + rpc( + request, retry=retry, timeout=timeout, metadata=metadata, + ) + + def list_jobs( + self, + request: job_service.ListJobsRequest = None, + *, + parent: str = None, + filter: str = None, + retry: retries.Retry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> pagers.ListJobsPager: + r"""Lists jobs by filter. + + Args: + request (:class:`~.job_service.ListJobsRequest`): + The request object. List jobs request. + parent (:class:`str`): + Required. The resource name of the tenant under which + the job is created. + + The format is + "projects/{project_id}/tenants/{tenant_id}". For + example, "projects/foo/tenant/bar". If tenant id is + unspecified, a default tenant is created. For example, + "projects/foo". + This corresponds to the ``parent`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + filter (:class:`str`): + Required. The filter string specifies the jobs to be + enumerated. + + Supported operator: =, AND + + The fields eligible for filtering are: + + - ``companyName`` (Required) + - ``requisitionId`` + - ``status`` Available values: OPEN, EXPIRED, ALL. + Defaults to OPEN if no value is specified. + + Sample Query: + + - companyName = + "projects/foo/tenants/bar/companies/baz" + - companyName = + "projects/foo/tenants/bar/companies/baz" AND + requisitionId = "req-1" + - companyName = + "projects/foo/tenants/bar/companies/baz" AND status = + "EXPIRED". + This corresponds to the ``filter`` 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. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + ~.pagers.ListJobsPager: + List jobs response. + Iterating over this object will yield + results and resolve additional pages + automatically. + + """ + # Create or coerce a protobuf request object. + # Sanity check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([parent, filter]) + if request is not None and has_flattened_params: + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + # Minor optimization to avoid making a copy if the user passes + # in a job_service.ListJobsRequest. + # There's no risk of modifying the input as we've already verified + # there are no flattened fields. + if not isinstance(request, job_service.ListJobsRequest): + request = job_service.ListJobsRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + + if parent is not None: + request.parent = parent + if filter is not None: + request.filter = filter + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.list_jobs] + + # 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),)), + ) + + # Send the request. + response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + + # This method is paged; wrap the response in a pager, which provides + # an `__iter__` convenience method. + response = pagers.ListJobsPager( + method=rpc, request=request, response=response, metadata=metadata, + ) + + # Done; return the response. + return response + + def search_jobs( + self, + request: job_service.SearchJobsRequest = None, + *, + retry: retries.Retry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> pagers.SearchJobsPager: + r"""Searches for jobs using the provided + [SearchJobsRequest][google.cloud.talent.v4beta1.SearchJobsRequest]. + + This call constrains the + [visibility][google.cloud.talent.v4beta1.Job.visibility] of jobs + present in the database, and only returns jobs that the caller + has permission to search against. + + Args: + request (:class:`~.job_service.SearchJobsRequest`): + The request object. The Request body of the `SearchJobs` + call. + + 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: + ~.pagers.SearchJobsPager: + Response for SearchJob method. + Iterating over this object will yield + results and resolve additional pages + automatically. + + """ + # Create or coerce a protobuf request object. + + # Minor optimization to avoid making a copy if the user passes + # in a job_service.SearchJobsRequest. + # There's no risk of modifying the input as we've already verified + # there are no flattened fields. + if not isinstance(request, job_service.SearchJobsRequest): + request = job_service.SearchJobsRequest(request) + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.search_jobs] + + # 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),)), + ) + + # Send the request. + response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + + # This method is paged; wrap the response in a pager, which provides + # an `__iter__` convenience method. + response = pagers.SearchJobsPager( + method=rpc, request=request, response=response, metadata=metadata, + ) + + # Done; return the response. + return response + + def search_jobs_for_alert( + self, + request: job_service.SearchJobsRequest = None, + *, + retry: retries.Retry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> pagers.SearchJobsForAlertPager: + r"""Searches for jobs using the provided + [SearchJobsRequest][google.cloud.talent.v4beta1.SearchJobsRequest]. + + This API call is intended for the use case of targeting passive + job seekers (for example, job seekers who have signed up to + receive email alerts about potential job opportunities), and has + different algorithmic adjustments that are targeted to passive + job seekers. + + This call constrains the + [visibility][google.cloud.talent.v4beta1.Job.visibility] of jobs + present in the database, and only returns jobs the caller has + permission to search against. + + Args: + request (:class:`~.job_service.SearchJobsRequest`): + The request object. The Request body of the `SearchJobs` + call. + + 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: + ~.pagers.SearchJobsForAlertPager: + Response for SearchJob method. + Iterating over this object will yield + results and resolve additional pages + automatically. + + """ + # Create or coerce a protobuf request object. + + # Minor optimization to avoid making a copy if the user passes + # in a job_service.SearchJobsRequest. + # There's no risk of modifying the input as we've already verified + # there are no flattened fields. + if not isinstance(request, job_service.SearchJobsRequest): + request = job_service.SearchJobsRequest(request) + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.search_jobs_for_alert] + + # 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),)), + ) + + # Send the request. + response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + + # This method is paged; wrap the response in a pager, which provides + # an `__iter__` convenience method. + response = pagers.SearchJobsForAlertPager( + method=rpc, request=request, response=response, metadata=metadata, + ) + + # Done; return the response. + return response + + +try: + _client_info = gapic_v1.client_info.ClientInfo( + gapic_version=pkg_resources.get_distribution("google-cloud-talent",).version, + ) +except pkg_resources.DistributionNotFound: + _client_info = gapic_v1.client_info.ClientInfo() + + +__all__ = ("JobServiceClient",) diff --git a/google/cloud/talent_v4beta1/services/job_service/pagers.py b/google/cloud/talent_v4beta1/services/job_service/pagers.py new file mode 100644 index 00000000..fcefff46 --- /dev/null +++ b/google/cloud/talent_v4beta1/services/job_service/pagers.py @@ -0,0 +1,405 @@ +# -*- 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. +# + +from typing import Any, AsyncIterable, Awaitable, Callable, Iterable, Sequence, Tuple + +from google.cloud.talent_v4beta1.types import job +from google.cloud.talent_v4beta1.types import job_service + + +class ListJobsPager: + """A pager for iterating through ``list_jobs`` requests. + + This class thinly wraps an initial + :class:`~.job_service.ListJobsResponse` object, and + provides an ``__iter__`` method to iterate through its + ``jobs`` field. + + If there are more pages, the ``__iter__`` method will make additional + ``ListJobs`` requests and continue to iterate + through the ``jobs`` field on the + corresponding responses. + + All the usual :class:`~.job_service.ListJobsResponse` + attributes are available on the pager. If multiple requests are made, only + the most recent response is retained, and thus used for attribute lookup. + """ + + def __init__( + self, + method: Callable[..., job_service.ListJobsResponse], + request: job_service.ListJobsRequest, + response: job_service.ListJobsResponse, + *, + metadata: Sequence[Tuple[str, str]] = () + ): + """Instantiate the pager. + + Args: + method (Callable): The method that was originally called, and + which instantiated this pager. + request (:class:`~.job_service.ListJobsRequest`): + The initial request object. + response (:class:`~.job_service.ListJobsResponse`): + The initial response object. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + """ + self._method = method + self._request = job_service.ListJobsRequest(request) + self._response = response + self._metadata = metadata + + def __getattr__(self, name: str) -> Any: + return getattr(self._response, name) + + @property + def pages(self) -> Iterable[job_service.ListJobsResponse]: + 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) + yield self._response + + def __iter__(self) -> Iterable[job.Job]: + for page in self.pages: + yield from page.jobs + + def __repr__(self) -> str: + return "{0}<{1!r}>".format(self.__class__.__name__, self._response) + + +class ListJobsAsyncPager: + """A pager for iterating through ``list_jobs`` requests. + + This class thinly wraps an initial + :class:`~.job_service.ListJobsResponse` object, and + provides an ``__aiter__`` method to iterate through its + ``jobs`` field. + + If there are more pages, the ``__aiter__`` method will make additional + ``ListJobs`` requests and continue to iterate + through the ``jobs`` field on the + corresponding responses. + + All the usual :class:`~.job_service.ListJobsResponse` + attributes are available on the pager. If multiple requests are made, only + the most recent response is retained, and thus used for attribute lookup. + """ + + def __init__( + self, + method: Callable[..., Awaitable[job_service.ListJobsResponse]], + request: job_service.ListJobsRequest, + response: job_service.ListJobsResponse, + *, + metadata: Sequence[Tuple[str, str]] = () + ): + """Instantiate the pager. + + Args: + method (Callable): The method that was originally called, and + which instantiated this pager. + request (:class:`~.job_service.ListJobsRequest`): + The initial request object. + response (:class:`~.job_service.ListJobsResponse`): + The initial response object. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + """ + self._method = method + self._request = job_service.ListJobsRequest(request) + self._response = response + self._metadata = metadata + + def __getattr__(self, name: str) -> Any: + return getattr(self._response, name) + + @property + async def pages(self) -> AsyncIterable[job_service.ListJobsResponse]: + 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) + yield self._response + + def __aiter__(self) -> AsyncIterable[job.Job]: + async def async_generator(): + async for page in self.pages: + for response in page.jobs: + yield response + + return async_generator() + + def __repr__(self) -> str: + return "{0}<{1!r}>".format(self.__class__.__name__, self._response) + + +class SearchJobsPager: + """A pager for iterating through ``search_jobs`` requests. + + This class thinly wraps an initial + :class:`~.job_service.SearchJobsResponse` object, and + provides an ``__iter__`` method to iterate through its + ``matching_jobs`` field. + + If there are more pages, the ``__iter__`` method will make additional + ``SearchJobs`` requests and continue to iterate + through the ``matching_jobs`` field on the + corresponding responses. + + All the usual :class:`~.job_service.SearchJobsResponse` + attributes are available on the pager. If multiple requests are made, only + the most recent response is retained, and thus used for attribute lookup. + """ + + def __init__( + self, + method: Callable[..., job_service.SearchJobsResponse], + request: job_service.SearchJobsRequest, + response: job_service.SearchJobsResponse, + *, + metadata: Sequence[Tuple[str, str]] = () + ): + """Instantiate the pager. + + Args: + method (Callable): The method that was originally called, and + which instantiated this pager. + request (:class:`~.job_service.SearchJobsRequest`): + The initial request object. + response (:class:`~.job_service.SearchJobsResponse`): + The initial response object. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + """ + self._method = method + self._request = job_service.SearchJobsRequest(request) + self._response = response + self._metadata = metadata + + def __getattr__(self, name: str) -> Any: + return getattr(self._response, name) + + @property + def pages(self) -> Iterable[job_service.SearchJobsResponse]: + 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) + yield self._response + + def __iter__(self) -> Iterable[job_service.SearchJobsResponse.MatchingJob]: + for page in self.pages: + yield from page.matching_jobs + + def __repr__(self) -> str: + return "{0}<{1!r}>".format(self.__class__.__name__, self._response) + + +class SearchJobsAsyncPager: + """A pager for iterating through ``search_jobs`` requests. + + This class thinly wraps an initial + :class:`~.job_service.SearchJobsResponse` object, and + provides an ``__aiter__`` method to iterate through its + ``matching_jobs`` field. + + If there are more pages, the ``__aiter__`` method will make additional + ``SearchJobs`` requests and continue to iterate + through the ``matching_jobs`` field on the + corresponding responses. + + All the usual :class:`~.job_service.SearchJobsResponse` + attributes are available on the pager. If multiple requests are made, only + the most recent response is retained, and thus used for attribute lookup. + """ + + def __init__( + self, + method: Callable[..., Awaitable[job_service.SearchJobsResponse]], + request: job_service.SearchJobsRequest, + response: job_service.SearchJobsResponse, + *, + metadata: Sequence[Tuple[str, str]] = () + ): + """Instantiate the pager. + + Args: + method (Callable): The method that was originally called, and + which instantiated this pager. + request (:class:`~.job_service.SearchJobsRequest`): + The initial request object. + response (:class:`~.job_service.SearchJobsResponse`): + The initial response object. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + """ + self._method = method + self._request = job_service.SearchJobsRequest(request) + self._response = response + self._metadata = metadata + + def __getattr__(self, name: str) -> Any: + return getattr(self._response, name) + + @property + async def pages(self) -> AsyncIterable[job_service.SearchJobsResponse]: + 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) + yield self._response + + def __aiter__(self) -> AsyncIterable[job_service.SearchJobsResponse.MatchingJob]: + async def async_generator(): + async for page in self.pages: + for response in page.matching_jobs: + yield response + + return async_generator() + + def __repr__(self) -> str: + return "{0}<{1!r}>".format(self.__class__.__name__, self._response) + + +class SearchJobsForAlertPager: + """A pager for iterating through ``search_jobs_for_alert`` requests. + + This class thinly wraps an initial + :class:`~.job_service.SearchJobsResponse` object, and + provides an ``__iter__`` method to iterate through its + ``matching_jobs`` field. + + If there are more pages, the ``__iter__`` method will make additional + ``SearchJobsForAlert`` requests and continue to iterate + through the ``matching_jobs`` field on the + corresponding responses. + + All the usual :class:`~.job_service.SearchJobsResponse` + attributes are available on the pager. If multiple requests are made, only + the most recent response is retained, and thus used for attribute lookup. + """ + + def __init__( + self, + method: Callable[..., job_service.SearchJobsResponse], + request: job_service.SearchJobsRequest, + response: job_service.SearchJobsResponse, + *, + metadata: Sequence[Tuple[str, str]] = () + ): + """Instantiate the pager. + + Args: + method (Callable): The method that was originally called, and + which instantiated this pager. + request (:class:`~.job_service.SearchJobsRequest`): + The initial request object. + response (:class:`~.job_service.SearchJobsResponse`): + The initial response object. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + """ + self._method = method + self._request = job_service.SearchJobsRequest(request) + self._response = response + self._metadata = metadata + + def __getattr__(self, name: str) -> Any: + return getattr(self._response, name) + + @property + def pages(self) -> Iterable[job_service.SearchJobsResponse]: + 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) + yield self._response + + def __iter__(self) -> Iterable[job_service.SearchJobsResponse.MatchingJob]: + for page in self.pages: + yield from page.matching_jobs + + def __repr__(self) -> str: + return "{0}<{1!r}>".format(self.__class__.__name__, self._response) + + +class SearchJobsForAlertAsyncPager: + """A pager for iterating through ``search_jobs_for_alert`` requests. + + This class thinly wraps an initial + :class:`~.job_service.SearchJobsResponse` object, and + provides an ``__aiter__`` method to iterate through its + ``matching_jobs`` field. + + If there are more pages, the ``__aiter__`` method will make additional + ``SearchJobsForAlert`` requests and continue to iterate + through the ``matching_jobs`` field on the + corresponding responses. + + All the usual :class:`~.job_service.SearchJobsResponse` + attributes are available on the pager. If multiple requests are made, only + the most recent response is retained, and thus used for attribute lookup. + """ + + def __init__( + self, + method: Callable[..., Awaitable[job_service.SearchJobsResponse]], + request: job_service.SearchJobsRequest, + response: job_service.SearchJobsResponse, + *, + metadata: Sequence[Tuple[str, str]] = () + ): + """Instantiate the pager. + + Args: + method (Callable): The method that was originally called, and + which instantiated this pager. + request (:class:`~.job_service.SearchJobsRequest`): + The initial request object. + response (:class:`~.job_service.SearchJobsResponse`): + The initial response object. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + """ + self._method = method + self._request = job_service.SearchJobsRequest(request) + self._response = response + self._metadata = metadata + + def __getattr__(self, name: str) -> Any: + return getattr(self._response, name) + + @property + async def pages(self) -> AsyncIterable[job_service.SearchJobsResponse]: + 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) + yield self._response + + def __aiter__(self) -> AsyncIterable[job_service.SearchJobsResponse.MatchingJob]: + async def async_generator(): + async for page in self.pages: + for response in page.matching_jobs: + yield response + + return async_generator() + + def __repr__(self) -> str: + return "{0}<{1!r}>".format(self.__class__.__name__, self._response) diff --git a/google/cloud/talent_v4beta1/services/job_service/transports/__init__.py b/google/cloud/talent_v4beta1/services/job_service/transports/__init__.py new file mode 100644 index 00000000..ca4d929c --- /dev/null +++ b/google/cloud/talent_v4beta1/services/job_service/transports/__init__.py @@ -0,0 +1,36 @@ +# -*- 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. +# + +from collections import OrderedDict +from typing import Dict, Type + +from .base import JobServiceTransport +from .grpc import JobServiceGrpcTransport +from .grpc_asyncio import JobServiceGrpcAsyncIOTransport + + +# Compile a registry of transports. +_transport_registry = OrderedDict() # type: Dict[str, Type[JobServiceTransport]] +_transport_registry["grpc"] = JobServiceGrpcTransport +_transport_registry["grpc_asyncio"] = JobServiceGrpcAsyncIOTransport + + +__all__ = ( + "JobServiceTransport", + "JobServiceGrpcTransport", + "JobServiceGrpcAsyncIOTransport", +) diff --git a/google/cloud/talent_v4beta1/services/job_service/transports/base.py b/google/cloud/talent_v4beta1/services/job_service/transports/base.py new file mode 100644 index 00000000..7214b944 --- /dev/null +++ b/google/cloud/talent_v4beta1/services/job_service/transports/base.py @@ -0,0 +1,276 @@ +# -*- 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. +# + +import abc +import typing +import pkg_resources + +from google import auth +from google.api_core import exceptions # type: ignore +from google.api_core import gapic_v1 # type: ignore +from google.api_core import retry as retries # type: ignore +from google.api_core import operations_v1 # type: ignore +from google.auth import credentials # type: ignore + +from google.cloud.talent_v4beta1.types import job +from google.cloud.talent_v4beta1.types import job as gct_job +from google.cloud.talent_v4beta1.types import job_service +from google.longrunning import operations_pb2 as operations # type: ignore +from google.protobuf import empty_pb2 as empty # type: ignore + + +try: + _client_info = gapic_v1.client_info.ClientInfo( + gapic_version=pkg_resources.get_distribution("google-cloud-talent",).version, + ) +except pkg_resources.DistributionNotFound: + _client_info = gapic_v1.client_info.ClientInfo() + + +class JobServiceTransport(abc.ABC): + """Abstract transport class for JobService.""" + + AUTH_SCOPES = ( + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/jobs", + ) + + def __init__( + self, + *, + host: str = "jobs.googleapis.com", + credentials: credentials.Credentials = None, + credentials_file: typing.Optional[str] = None, + scopes: typing.Optional[typing.Sequence[str]] = AUTH_SCOPES, + quota_project_id: typing.Optional[str] = None, + **kwargs, + ) -> None: + """Instantiate the transport. + + Args: + host (Optional[str]): The hostname to connect to. + credentials (Optional[google.auth.credentials.Credentials]): The + authorization credentials to attach to requests. These + credentials identify the application to the service; if none + are specified, the client will attempt to ascertain the + credentials from the environment. + credentials_file (Optional[str]): A file with credentials that can + be loaded with :func:`google.auth.load_credentials_from_file`. + This argument is mutually exclusive with credentials. + scope (Optional[Sequence[str]]): A list of scopes. + quota_project_id (Optional[str]): An optional project to use for billing + and quota. + """ + # Save the hostname. Default to port 443 (HTTPS) if none is specified. + if ":" not in host: + host += ":443" + self._host = host + + # If no credentials are provided, then determine the appropriate + # defaults. + if credentials and credentials_file: + raise exceptions.DuplicateCredentialArgs( + "'credentials_file' and 'credentials' are mutually exclusive" + ) + + if credentials_file is not None: + credentials, _ = auth.load_credentials_from_file( + credentials_file, scopes=scopes, quota_project_id=quota_project_id + ) + + elif credentials is None: + credentials, _ = auth.default( + scopes=scopes, quota_project_id=quota_project_id + ) + + # Save the credentials. + self._credentials = credentials + + # Lifted into its own function so it can be stubbed out during tests. + self._prep_wrapped_messages() + + def _prep_wrapped_messages(self): + # Precompute the wrapped methods. + self._wrapped_methods = { + self.create_job: gapic_v1.method.wrap_method( + self.create_job, default_timeout=30.0, client_info=_client_info, + ), + self.batch_create_jobs: gapic_v1.method.wrap_method( + self.batch_create_jobs, default_timeout=30.0, client_info=_client_info, + ), + self.get_job: gapic_v1.method.wrap_method( + self.get_job, + default_retry=retries.Retry( + initial=0.1, + maximum=60.0, + multiplier=1.3, + predicate=retries.if_exception_type( + exceptions.ServiceUnavailable, exceptions.DeadlineExceeded, + ), + ), + default_timeout=30.0, + client_info=_client_info, + ), + self.update_job: gapic_v1.method.wrap_method( + self.update_job, default_timeout=30.0, client_info=_client_info, + ), + self.batch_update_jobs: gapic_v1.method.wrap_method( + self.batch_update_jobs, default_timeout=30.0, client_info=_client_info, + ), + self.delete_job: gapic_v1.method.wrap_method( + self.delete_job, + default_retry=retries.Retry( + initial=0.1, + maximum=60.0, + multiplier=1.3, + predicate=retries.if_exception_type( + exceptions.ServiceUnavailable, exceptions.DeadlineExceeded, + ), + ), + default_timeout=30.0, + client_info=_client_info, + ), + self.batch_delete_jobs: gapic_v1.method.wrap_method( + self.batch_delete_jobs, default_timeout=30.0, client_info=_client_info, + ), + self.list_jobs: gapic_v1.method.wrap_method( + self.list_jobs, + default_retry=retries.Retry( + initial=0.1, + maximum=60.0, + multiplier=1.3, + predicate=retries.if_exception_type( + exceptions.ServiceUnavailable, exceptions.DeadlineExceeded, + ), + ), + default_timeout=30.0, + client_info=_client_info, + ), + self.search_jobs: gapic_v1.method.wrap_method( + self.search_jobs, default_timeout=30.0, client_info=_client_info, + ), + self.search_jobs_for_alert: gapic_v1.method.wrap_method( + self.search_jobs_for_alert, + default_timeout=30.0, + client_info=_client_info, + ), + } + + @property + def operations_client(self) -> operations_v1.OperationsClient: + """Return the client designed to process long-running operations.""" + raise NotImplementedError() + + @property + def create_job( + self, + ) -> typing.Callable[ + [job_service.CreateJobRequest], + typing.Union[gct_job.Job, typing.Awaitable[gct_job.Job]], + ]: + raise NotImplementedError() + + @property + def batch_create_jobs( + self, + ) -> typing.Callable[ + [job_service.BatchCreateJobsRequest], + typing.Union[operations.Operation, typing.Awaitable[operations.Operation]], + ]: + raise NotImplementedError() + + @property + def get_job( + self, + ) -> typing.Callable[ + [job_service.GetJobRequest], typing.Union[job.Job, typing.Awaitable[job.Job]] + ]: + raise NotImplementedError() + + @property + def update_job( + self, + ) -> typing.Callable[ + [job_service.UpdateJobRequest], + typing.Union[gct_job.Job, typing.Awaitable[gct_job.Job]], + ]: + raise NotImplementedError() + + @property + def batch_update_jobs( + self, + ) -> typing.Callable[ + [job_service.BatchUpdateJobsRequest], + typing.Union[operations.Operation, typing.Awaitable[operations.Operation]], + ]: + raise NotImplementedError() + + @property + def delete_job( + self, + ) -> typing.Callable[ + [job_service.DeleteJobRequest], + typing.Union[empty.Empty, typing.Awaitable[empty.Empty]], + ]: + raise NotImplementedError() + + @property + def batch_delete_jobs( + self, + ) -> typing.Callable[ + [job_service.BatchDeleteJobsRequest], + typing.Union[empty.Empty, typing.Awaitable[empty.Empty]], + ]: + raise NotImplementedError() + + @property + def list_jobs( + self, + ) -> typing.Callable[ + [job_service.ListJobsRequest], + typing.Union[ + job_service.ListJobsResponse, typing.Awaitable[job_service.ListJobsResponse] + ], + ]: + raise NotImplementedError() + + @property + def search_jobs( + self, + ) -> typing.Callable[ + [job_service.SearchJobsRequest], + typing.Union[ + job_service.SearchJobsResponse, + typing.Awaitable[job_service.SearchJobsResponse], + ], + ]: + raise NotImplementedError() + + @property + def search_jobs_for_alert( + self, + ) -> typing.Callable[ + [job_service.SearchJobsRequest], + typing.Union[ + job_service.SearchJobsResponse, + typing.Awaitable[job_service.SearchJobsResponse], + ], + ]: + raise NotImplementedError() + + +__all__ = ("JobServiceTransport",) diff --git a/google/cloud/talent_v4beta1/services/job_service/transports/grpc.py b/google/cloud/talent_v4beta1/services/job_service/transports/grpc.py new file mode 100644 index 00000000..85549fe7 --- /dev/null +++ b/google/cloud/talent_v4beta1/services/job_service/transports/grpc.py @@ -0,0 +1,508 @@ +# -*- 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. +# + +from typing import Callable, Dict, Optional, Sequence, Tuple + +from google.api_core import grpc_helpers # type: ignore +from google.api_core import operations_v1 # type: ignore +from google import auth # type: ignore +from google.auth import credentials # type: ignore +from google.auth.transport.grpc import SslCredentials # type: ignore + + +import grpc # type: ignore + +from google.cloud.talent_v4beta1.types import job +from google.cloud.talent_v4beta1.types import job as gct_job +from google.cloud.talent_v4beta1.types import job_service +from google.longrunning import operations_pb2 as operations # type: ignore +from google.protobuf import empty_pb2 as empty # type: ignore + +from .base import JobServiceTransport + + +class JobServiceGrpcTransport(JobServiceTransport): + """gRPC backend transport for JobService. + + A service handles job management, including job CRUD, + enumeration and search. + + This class defines the same methods as the primary client, so the + primary client can load the underlying transport implementation + and call it. + + It sends protocol buffers over the wire using gRPC (which is built on + top of HTTP/2); the ``grpcio`` package must be installed. + """ + + _stubs: Dict[str, Callable] + + def __init__( + self, + *, + host: str = "jobs.googleapis.com", + credentials: credentials.Credentials = None, + credentials_file: str = None, + scopes: Sequence[str] = None, + channel: grpc.Channel = None, + api_mtls_endpoint: str = None, + client_cert_source: Callable[[], Tuple[bytes, bytes]] = None, + quota_project_id: Optional[str] = None + ) -> None: + """Instantiate the transport. + + Args: + host (Optional[str]): The hostname to connect to. + credentials (Optional[google.auth.credentials.Credentials]): The + authorization credentials to attach to requests. These + credentials identify the application to the service; if none + are specified, the client will attempt to ascertain the + credentials from the environment. + This argument is ignored if ``channel`` is provided. + credentials_file (Optional[str]): A file with credentials that can + be loaded with :func:`google.auth.load_credentials_from_file`. + This argument is ignored if ``channel`` is provided. + scopes (Optional(Sequence[str])): A list of scopes. This argument is + ignored if ``channel`` is provided. + channel (Optional[grpc.Channel]): A ``Channel`` instance through + which to make calls. + api_mtls_endpoint (Optional[str]): The mutual TLS endpoint. If + provided, it overrides the ``host`` argument and tries to create + a mutual TLS channel with client SSL credentials from + ``client_cert_source`` or applicatin default SSL credentials. + client_cert_source (Optional[Callable[[], Tuple[bytes, bytes]]]): A + callback to provide client SSL certificate bytes and private key + bytes, both in PEM format. It is ignored if ``api_mtls_endpoint`` + is None. + quota_project_id (Optional[str]): An optional project to use for billing + and quota. + + Raises: + google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport + creation failed for any reason. + google.api_core.exceptions.DuplicateCredentialArgs: If both ``credentials`` + and ``credentials_file`` are passed. + """ + if channel: + # Sanity check: Ensure that channel and credentials are not both + # provided. + credentials = False + + # If a channel was explicitly provided, set it. + self._grpc_channel = channel + elif api_mtls_endpoint: + host = ( + api_mtls_endpoint + if ":" in api_mtls_endpoint + else api_mtls_endpoint + ":443" + ) + + if credentials is None: + credentials, _ = auth.default( + scopes=self.AUTH_SCOPES, quota_project_id=quota_project_id + ) + + # Create SSL credentials with client_cert_source or application + # default SSL credentials. + if client_cert_source: + cert, key = client_cert_source() + ssl_credentials = grpc.ssl_channel_credentials( + certificate_chain=cert, private_key=key + ) + else: + ssl_credentials = SslCredentials().ssl_credentials + + # create a new channel. The provided one is ignored. + self._grpc_channel = type(self).create_channel( + host, + credentials=credentials, + credentials_file=credentials_file, + ssl_credentials=ssl_credentials, + scopes=scopes or self.AUTH_SCOPES, + quota_project_id=quota_project_id, + ) + + self._stubs = {} # type: Dict[str, Callable] + + # Run the base constructor. + super().__init__( + host=host, + credentials=credentials, + credentials_file=credentials_file, + scopes=scopes or self.AUTH_SCOPES, + quota_project_id=quota_project_id, + ) + + @classmethod + def create_channel( + cls, + host: str = "jobs.googleapis.com", + credentials: credentials.Credentials = None, + credentials_file: str = None, + scopes: Optional[Sequence[str]] = None, + quota_project_id: Optional[str] = None, + **kwargs + ) -> grpc.Channel: + """Create and return a gRPC channel object. + Args: + address (Optionsl[str]): The host for the channel to use. + credentials (Optional[~.Credentials]): The + authorization credentials to attach to requests. These + credentials identify this application to the service. If + none are specified, the client will attempt to ascertain + the credentials from the environment. + credentials_file (Optional[str]): A file with credentials that can + be loaded with :func:`google.auth.load_credentials_from_file`. + This argument is mutually exclusive with credentials. + scopes (Optional[Sequence[str]]): A optional list of scopes needed for this + service. These are only used when credentials are not specified and + are passed to :func:`google.auth.default`. + quota_project_id (Optional[str]): An optional project to use for billing + and quota. + kwargs (Optional[dict]): Keyword arguments, which are passed to the + channel creation. + Returns: + grpc.Channel: A gRPC channel object. + + Raises: + google.api_core.exceptions.DuplicateCredentialArgs: If both ``credentials`` + and ``credentials_file`` are passed. + """ + scopes = scopes or cls.AUTH_SCOPES + return grpc_helpers.create_channel( + host, + credentials=credentials, + credentials_file=credentials_file, + scopes=scopes, + quota_project_id=quota_project_id, + **kwargs + ) + + @property + def grpc_channel(self) -> grpc.Channel: + """Create the channel designed to connect to this service. + + This property caches on the instance; repeated calls return + the same channel. + """ + # Sanity check: Only create a new channel if we do not already + # have one. + if not hasattr(self, "_grpc_channel"): + self._grpc_channel = self.create_channel( + self._host, credentials=self._credentials, + ) + + # Return the channel from cache. + return self._grpc_channel + + @property + def operations_client(self) -> operations_v1.OperationsClient: + """Create the client designed to process long-running operations. + + This property caches on the instance; repeated calls return the same + client. + """ + # Sanity check: Only create a new client if we do not already have one. + if "operations_client" not in self.__dict__: + self.__dict__["operations_client"] = operations_v1.OperationsClient( + self.grpc_channel + ) + + # Return the client from cache. + return self.__dict__["operations_client"] + + @property + def create_job(self) -> Callable[[job_service.CreateJobRequest], gct_job.Job]: + r"""Return a callable for the create job method over gRPC. + + Creates a new job. + Typically, the job becomes searchable within 10 seconds, + but it may take up to 5 minutes. + + Returns: + Callable[[~.CreateJobRequest], + ~.Job]: + A function that, when called, will call the underlying RPC + on the server. + """ + # 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 "create_job" not in self._stubs: + self._stubs["create_job"] = self.grpc_channel.unary_unary( + "/google.cloud.talent.v4beta1.JobService/CreateJob", + request_serializer=job_service.CreateJobRequest.serialize, + response_deserializer=gct_job.Job.deserialize, + ) + return self._stubs["create_job"] + + @property + def batch_create_jobs( + self, + ) -> Callable[[job_service.BatchCreateJobsRequest], operations.Operation]: + r"""Return a callable for the batch create jobs method over gRPC. + + Begins executing a batch create jobs operation. + + Returns: + Callable[[~.BatchCreateJobsRequest], + ~.Operation]: + A function that, when called, will call the underlying RPC + on the server. + """ + # 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 "batch_create_jobs" not in self._stubs: + self._stubs["batch_create_jobs"] = self.grpc_channel.unary_unary( + "/google.cloud.talent.v4beta1.JobService/BatchCreateJobs", + request_serializer=job_service.BatchCreateJobsRequest.serialize, + response_deserializer=operations.Operation.FromString, + ) + return self._stubs["batch_create_jobs"] + + @property + def get_job(self) -> Callable[[job_service.GetJobRequest], job.Job]: + r"""Return a callable for the get job method over gRPC. + + Retrieves the specified job, whose status is OPEN or + recently EXPIRED within the last 90 days. + + Returns: + Callable[[~.GetJobRequest], + ~.Job]: + A function that, when called, will call the underlying RPC + on the server. + """ + # 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_job" not in self._stubs: + self._stubs["get_job"] = self.grpc_channel.unary_unary( + "/google.cloud.talent.v4beta1.JobService/GetJob", + request_serializer=job_service.GetJobRequest.serialize, + response_deserializer=job.Job.deserialize, + ) + return self._stubs["get_job"] + + @property + def update_job(self) -> Callable[[job_service.UpdateJobRequest], gct_job.Job]: + r"""Return a callable for the update job method over gRPC. + + Updates specified job. + Typically, updated contents become visible in search + results within 10 seconds, but it may take up to 5 + minutes. + + Returns: + Callable[[~.UpdateJobRequest], + ~.Job]: + A function that, when called, will call the underlying RPC + on the server. + """ + # 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 "update_job" not in self._stubs: + self._stubs["update_job"] = self.grpc_channel.unary_unary( + "/google.cloud.talent.v4beta1.JobService/UpdateJob", + request_serializer=job_service.UpdateJobRequest.serialize, + response_deserializer=gct_job.Job.deserialize, + ) + return self._stubs["update_job"] + + @property + def batch_update_jobs( + self, + ) -> Callable[[job_service.BatchUpdateJobsRequest], operations.Operation]: + r"""Return a callable for the batch update jobs method over gRPC. + + Begins executing a batch update jobs operation. + + Returns: + Callable[[~.BatchUpdateJobsRequest], + ~.Operation]: + A function that, when called, will call the underlying RPC + on the server. + """ + # 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 "batch_update_jobs" not in self._stubs: + self._stubs["batch_update_jobs"] = self.grpc_channel.unary_unary( + "/google.cloud.talent.v4beta1.JobService/BatchUpdateJobs", + request_serializer=job_service.BatchUpdateJobsRequest.serialize, + response_deserializer=operations.Operation.FromString, + ) + return self._stubs["batch_update_jobs"] + + @property + def delete_job(self) -> Callable[[job_service.DeleteJobRequest], empty.Empty]: + r"""Return a callable for the delete job method over gRPC. + + Deletes the specified job. + Typically, the job becomes unsearchable within 10 + seconds, but it may take up to 5 minutes. + + Returns: + Callable[[~.DeleteJobRequest], + ~.Empty]: + A function that, when called, will call the underlying RPC + on the server. + """ + # 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 "delete_job" not in self._stubs: + self._stubs["delete_job"] = self.grpc_channel.unary_unary( + "/google.cloud.talent.v4beta1.JobService/DeleteJob", + request_serializer=job_service.DeleteJobRequest.serialize, + response_deserializer=empty.Empty.FromString, + ) + return self._stubs["delete_job"] + + @property + def batch_delete_jobs( + self, + ) -> Callable[[job_service.BatchDeleteJobsRequest], empty.Empty]: + r"""Return a callable for the batch delete jobs method over gRPC. + + Deletes a list of [Job][google.cloud.talent.v4beta1.Job]s by + filter. + + Returns: + Callable[[~.BatchDeleteJobsRequest], + ~.Empty]: + A function that, when called, will call the underlying RPC + on the server. + """ + # 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 "batch_delete_jobs" not in self._stubs: + self._stubs["batch_delete_jobs"] = self.grpc_channel.unary_unary( + "/google.cloud.talent.v4beta1.JobService/BatchDeleteJobs", + request_serializer=job_service.BatchDeleteJobsRequest.serialize, + response_deserializer=empty.Empty.FromString, + ) + return self._stubs["batch_delete_jobs"] + + @property + def list_jobs( + self, + ) -> Callable[[job_service.ListJobsRequest], job_service.ListJobsResponse]: + r"""Return a callable for the list jobs method over gRPC. + + Lists jobs by filter. + + Returns: + Callable[[~.ListJobsRequest], + ~.ListJobsResponse]: + A function that, when called, will call the underlying RPC + on the server. + """ + # 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 "list_jobs" not in self._stubs: + self._stubs["list_jobs"] = self.grpc_channel.unary_unary( + "/google.cloud.talent.v4beta1.JobService/ListJobs", + request_serializer=job_service.ListJobsRequest.serialize, + response_deserializer=job_service.ListJobsResponse.deserialize, + ) + return self._stubs["list_jobs"] + + @property + def search_jobs( + self, + ) -> Callable[[job_service.SearchJobsRequest], job_service.SearchJobsResponse]: + r"""Return a callable for the search jobs method over gRPC. + + Searches for jobs using the provided + [SearchJobsRequest][google.cloud.talent.v4beta1.SearchJobsRequest]. + + This call constrains the + [visibility][google.cloud.talent.v4beta1.Job.visibility] of jobs + present in the database, and only returns jobs that the caller + has permission to search against. + + Returns: + Callable[[~.SearchJobsRequest], + ~.SearchJobsResponse]: + A function that, when called, will call the underlying RPC + on the server. + """ + # 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 "search_jobs" not in self._stubs: + self._stubs["search_jobs"] = self.grpc_channel.unary_unary( + "/google.cloud.talent.v4beta1.JobService/SearchJobs", + request_serializer=job_service.SearchJobsRequest.serialize, + response_deserializer=job_service.SearchJobsResponse.deserialize, + ) + return self._stubs["search_jobs"] + + @property + def search_jobs_for_alert( + self, + ) -> Callable[[job_service.SearchJobsRequest], job_service.SearchJobsResponse]: + r"""Return a callable for the search jobs for alert method over gRPC. + + Searches for jobs using the provided + [SearchJobsRequest][google.cloud.talent.v4beta1.SearchJobsRequest]. + + This API call is intended for the use case of targeting passive + job seekers (for example, job seekers who have signed up to + receive email alerts about potential job opportunities), and has + different algorithmic adjustments that are targeted to passive + job seekers. + + This call constrains the + [visibility][google.cloud.talent.v4beta1.Job.visibility] of jobs + present in the database, and only returns jobs the caller has + permission to search against. + + Returns: + Callable[[~.SearchJobsRequest], + ~.SearchJobsResponse]: + A function that, when called, will call the underlying RPC + on the server. + """ + # 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 "search_jobs_for_alert" not in self._stubs: + self._stubs["search_jobs_for_alert"] = self.grpc_channel.unary_unary( + "/google.cloud.talent.v4beta1.JobService/SearchJobsForAlert", + request_serializer=job_service.SearchJobsRequest.serialize, + response_deserializer=job_service.SearchJobsResponse.deserialize, + ) + return self._stubs["search_jobs_for_alert"] + + +__all__ = ("JobServiceGrpcTransport",) diff --git a/google/cloud/talent_v4beta1/services/job_service/transports/grpc_asyncio.py b/google/cloud/talent_v4beta1/services/job_service/transports/grpc_asyncio.py new file mode 100644 index 00000000..b350d32d --- /dev/null +++ b/google/cloud/talent_v4beta1/services/job_service/transports/grpc_asyncio.py @@ -0,0 +1,517 @@ +# -*- 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. +# + +from typing import Awaitable, Callable, Dict, Optional, Sequence, Tuple + +from google.api_core import grpc_helpers_async # type: ignore +from google.api_core import operations_v1 # type: ignore +from google.auth import credentials # type: ignore +from google.auth.transport.grpc import SslCredentials # type: ignore + +import grpc # type: ignore +from grpc.experimental import aio # type: ignore + +from google.cloud.talent_v4beta1.types import job +from google.cloud.talent_v4beta1.types import job as gct_job +from google.cloud.talent_v4beta1.types import job_service +from google.longrunning import operations_pb2 as operations # type: ignore +from google.protobuf import empty_pb2 as empty # type: ignore + +from .base import JobServiceTransport +from .grpc import JobServiceGrpcTransport + + +class JobServiceGrpcAsyncIOTransport(JobServiceTransport): + """gRPC AsyncIO backend transport for JobService. + + A service handles job management, including job CRUD, + enumeration and search. + + This class defines the same methods as the primary client, so the + primary client can load the underlying transport implementation + and call it. + + It sends protocol buffers over the wire using gRPC (which is built on + top of HTTP/2); the ``grpcio`` package must be installed. + """ + + _grpc_channel: aio.Channel + _stubs: Dict[str, Callable] = {} + + @classmethod + def create_channel( + cls, + host: str = "jobs.googleapis.com", + credentials: credentials.Credentials = None, + credentials_file: Optional[str] = None, + scopes: Optional[Sequence[str]] = None, + quota_project_id: Optional[str] = None, + **kwargs, + ) -> aio.Channel: + """Create and return a gRPC AsyncIO channel object. + Args: + address (Optional[str]): The host for the channel to use. + credentials (Optional[~.Credentials]): The + authorization credentials to attach to requests. These + credentials identify this application to the service. If + none are specified, the client will attempt to ascertain + the credentials from the environment. + credentials_file (Optional[str]): A file with credentials that can + be loaded with :func:`google.auth.load_credentials_from_file`. + This argument is ignored if ``channel`` is provided. + scopes (Optional[Sequence[str]]): A optional list of scopes needed for this + service. These are only used when credentials are not specified and + are passed to :func:`google.auth.default`. + quota_project_id (Optional[str]): An optional project to use for billing + and quota. + kwargs (Optional[dict]): Keyword arguments, which are passed to the + channel creation. + Returns: + aio.Channel: A gRPC AsyncIO channel object. + """ + scopes = scopes or cls.AUTH_SCOPES + return grpc_helpers_async.create_channel( + host, + credentials=credentials, + credentials_file=credentials_file, + scopes=scopes, + quota_project_id=quota_project_id, + **kwargs, + ) + + def __init__( + self, + *, + host: str = "jobs.googleapis.com", + credentials: credentials.Credentials = None, + credentials_file: Optional[str] = None, + scopes: Optional[Sequence[str]] = None, + channel: aio.Channel = None, + api_mtls_endpoint: str = None, + client_cert_source: Callable[[], Tuple[bytes, bytes]] = None, + quota_project_id=None, + ) -> None: + """Instantiate the transport. + + Args: + host (Optional[str]): The hostname to connect to. + credentials (Optional[google.auth.credentials.Credentials]): The + authorization credentials to attach to requests. These + credentials identify the application to the service; if none + are specified, the client will attempt to ascertain the + credentials from the environment. + This argument is ignored if ``channel`` is provided. + credentials_file (Optional[str]): A file with credentials that can + be loaded with :func:`google.auth.load_credentials_from_file`. + This argument is ignored if ``channel`` is provided. + scopes (Optional[Sequence[str]]): A optional list of scopes needed for this + service. These are only used when credentials are not specified and + are passed to :func:`google.auth.default`. + channel (Optional[aio.Channel]): A ``Channel`` instance through + which to make calls. + api_mtls_endpoint (Optional[str]): The mutual TLS endpoint. If + provided, it overrides the ``host`` argument and tries to create + a mutual TLS channel with client SSL credentials from + ``client_cert_source`` or applicatin default SSL credentials. + client_cert_source (Optional[Callable[[], Tuple[bytes, bytes]]]): A + callback to provide client SSL certificate bytes and private key + bytes, both in PEM format. It is ignored if ``api_mtls_endpoint`` + is None. + quota_project_id (Optional[str]): An optional project to use for billing + and quota. + + Raises: + google.auth.exceptions.MutualTlsChannelError: If mutual TLS transport + creation failed for any reason. + google.api_core.exceptions.DuplicateCredentialArgs: If both ``credentials`` + and ``credentials_file`` are passed. + """ + if channel: + # Sanity check: Ensure that channel and credentials are not both + # provided. + credentials = False + + # If a channel was explicitly provided, set it. + self._grpc_channel = channel + elif api_mtls_endpoint: + host = ( + api_mtls_endpoint + if ":" in api_mtls_endpoint + else api_mtls_endpoint + ":443" + ) + + # Create SSL credentials with client_cert_source or application + # default SSL credentials. + if client_cert_source: + cert, key = client_cert_source() + ssl_credentials = grpc.ssl_channel_credentials( + certificate_chain=cert, private_key=key + ) + else: + ssl_credentials = SslCredentials().ssl_credentials + + # create a new channel. The provided one is ignored. + self._grpc_channel = type(self).create_channel( + host, + credentials=credentials, + credentials_file=credentials_file, + ssl_credentials=ssl_credentials, + scopes=scopes or self.AUTH_SCOPES, + quota_project_id=quota_project_id, + ) + + # Run the base constructor. + super().__init__( + host=host, + credentials=credentials, + credentials_file=credentials_file, + scopes=scopes or self.AUTH_SCOPES, + quota_project_id=quota_project_id, + ) + + self._stubs = {} + + @property + def grpc_channel(self) -> aio.Channel: + """Create the channel designed to connect to this service. + + This property caches on the instance; repeated calls return + the same channel. + """ + # Sanity check: Only create a new channel if we do not already + # have one. + if not hasattr(self, "_grpc_channel"): + self._grpc_channel = self.create_channel( + self._host, credentials=self._credentials, + ) + + # Return the channel from cache. + return self._grpc_channel + + @property + def operations_client(self) -> operations_v1.OperationsAsyncClient: + """Create the client designed to process long-running operations. + + This property caches on the instance; repeated calls return the same + client. + """ + # Sanity check: Only create a new client if we do not already have one. + if "operations_client" not in self.__dict__: + self.__dict__["operations_client"] = operations_v1.OperationsAsyncClient( + self.grpc_channel + ) + + # Return the client from cache. + return self.__dict__["operations_client"] + + @property + def create_job( + self, + ) -> Callable[[job_service.CreateJobRequest], Awaitable[gct_job.Job]]: + r"""Return a callable for the create job method over gRPC. + + Creates a new job. + Typically, the job becomes searchable within 10 seconds, + but it may take up to 5 minutes. + + Returns: + Callable[[~.CreateJobRequest], + Awaitable[~.Job]]: + A function that, when called, will call the underlying RPC + on the server. + """ + # 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 "create_job" not in self._stubs: + self._stubs["create_job"] = self.grpc_channel.unary_unary( + "/google.cloud.talent.v4beta1.JobService/CreateJob", + request_serializer=job_service.CreateJobRequest.serialize, + response_deserializer=gct_job.Job.deserialize, + ) + return self._stubs["create_job"] + + @property + def batch_create_jobs( + self, + ) -> Callable[ + [job_service.BatchCreateJobsRequest], Awaitable[operations.Operation] + ]: + r"""Return a callable for the batch create jobs method over gRPC. + + Begins executing a batch create jobs operation. + + Returns: + Callable[[~.BatchCreateJobsRequest], + Awaitable[~.Operation]]: + A function that, when called, will call the underlying RPC + on the server. + """ + # 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 "batch_create_jobs" not in self._stubs: + self._stubs["batch_create_jobs"] = self.grpc_channel.unary_unary( + "/google.cloud.talent.v4beta1.JobService/BatchCreateJobs", + request_serializer=job_service.BatchCreateJobsRequest.serialize, + response_deserializer=operations.Operation.FromString, + ) + return self._stubs["batch_create_jobs"] + + @property + def get_job(self) -> Callable[[job_service.GetJobRequest], Awaitable[job.Job]]: + r"""Return a callable for the get job method over gRPC. + + Retrieves the specified job, whose status is OPEN or + recently EXPIRED within the last 90 days. + + Returns: + Callable[[~.GetJobRequest], + Awaitable[~.Job]]: + A function that, when called, will call the underlying RPC + on the server. + """ + # 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_job" not in self._stubs: + self._stubs["get_job"] = self.grpc_channel.unary_unary( + "/google.cloud.talent.v4beta1.JobService/GetJob", + request_serializer=job_service.GetJobRequest.serialize, + response_deserializer=job.Job.deserialize, + ) + return self._stubs["get_job"] + + @property + def update_job( + self, + ) -> Callable[[job_service.UpdateJobRequest], Awaitable[gct_job.Job]]: + r"""Return a callable for the update job method over gRPC. + + Updates specified job. + Typically, updated contents become visible in search + results within 10 seconds, but it may take up to 5 + minutes. + + Returns: + Callable[[~.UpdateJobRequest], + Awaitable[~.Job]]: + A function that, when called, will call the underlying RPC + on the server. + """ + # 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 "update_job" not in self._stubs: + self._stubs["update_job"] = self.grpc_channel.unary_unary( + "/google.cloud.talent.v4beta1.JobService/UpdateJob", + request_serializer=job_service.UpdateJobRequest.serialize, + response_deserializer=gct_job.Job.deserialize, + ) + return self._stubs["update_job"] + + @property + def batch_update_jobs( + self, + ) -> Callable[ + [job_service.BatchUpdateJobsRequest], Awaitable[operations.Operation] + ]: + r"""Return a callable for the batch update jobs method over gRPC. + + Begins executing a batch update jobs operation. + + Returns: + Callable[[~.BatchUpdateJobsRequest], + Awaitable[~.Operation]]: + A function that, when called, will call the underlying RPC + on the server. + """ + # 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 "batch_update_jobs" not in self._stubs: + self._stubs["batch_update_jobs"] = self.grpc_channel.unary_unary( + "/google.cloud.talent.v4beta1.JobService/BatchUpdateJobs", + request_serializer=job_service.BatchUpdateJobsRequest.serialize, + response_deserializer=operations.Operation.FromString, + ) + return self._stubs["batch_update_jobs"] + + @property + def delete_job( + self, + ) -> Callable[[job_service.DeleteJobRequest], Awaitable[empty.Empty]]: + r"""Return a callable for the delete job method over gRPC. + + Deletes the specified job. + Typically, the job becomes unsearchable within 10 + seconds, but it may take up to 5 minutes. + + Returns: + Callable[[~.DeleteJobRequest], + Awaitable[~.Empty]]: + A function that, when called, will call the underlying RPC + on the server. + """ + # 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 "delete_job" not in self._stubs: + self._stubs["delete_job"] = self.grpc_channel.unary_unary( + "/google.cloud.talent.v4beta1.JobService/DeleteJob", + request_serializer=job_service.DeleteJobRequest.serialize, + response_deserializer=empty.Empty.FromString, + ) + return self._stubs["delete_job"] + + @property + def batch_delete_jobs( + self, + ) -> Callable[[job_service.BatchDeleteJobsRequest], Awaitable[empty.Empty]]: + r"""Return a callable for the batch delete jobs method over gRPC. + + Deletes a list of [Job][google.cloud.talent.v4beta1.Job]s by + filter. + + Returns: + Callable[[~.BatchDeleteJobsRequest], + Awaitable[~.Empty]]: + A function that, when called, will call the underlying RPC + on the server. + """ + # 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 "batch_delete_jobs" not in self._stubs: + self._stubs["batch_delete_jobs"] = self.grpc_channel.unary_unary( + "/google.cloud.talent.v4beta1.JobService/BatchDeleteJobs", + request_serializer=job_service.BatchDeleteJobsRequest.serialize, + response_deserializer=empty.Empty.FromString, + ) + return self._stubs["batch_delete_jobs"] + + @property + def list_jobs( + self, + ) -> Callable[ + [job_service.ListJobsRequest], Awaitable[job_service.ListJobsResponse] + ]: + r"""Return a callable for the list jobs method over gRPC. + + Lists jobs by filter. + + Returns: + Callable[[~.ListJobsRequest], + Awaitable[~.ListJobsResponse]]: + A function that, when called, will call the underlying RPC + on the server. + """ + # 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 "list_jobs" not in self._stubs: + self._stubs["list_jobs"] = self.grpc_channel.unary_unary( + "/google.cloud.talent.v4beta1.JobService/ListJobs", + request_serializer=job_service.ListJobsRequest.serialize, + response_deserializer=job_service.ListJobsResponse.deserialize, + ) + return self._stubs["list_jobs"] + + @property + def search_jobs( + self, + ) -> Callable[ + [job_service.SearchJobsRequest], Awaitable[job_service.SearchJobsResponse] + ]: + r"""Return a callable for the search jobs method over gRPC. + + Searches for jobs using the provided + [SearchJobsRequest][google.cloud.talent.v4beta1.SearchJobsRequest]. + + This call constrains the + [visibility][google.cloud.talent.v4beta1.Job.visibility] of jobs + present in the database, and only returns jobs that the caller + has permission to search against. + + Returns: + Callable[[~.SearchJobsRequest], + Awaitable[~.SearchJobsResponse]]: + A function that, when called, will call the underlying RPC + on the server. + """ + # 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 "search_jobs" not in self._stubs: + self._stubs["search_jobs"] = self.grpc_channel.unary_unary( + "/google.cloud.talent.v4beta1.JobService/SearchJobs", + request_serializer=job_service.SearchJobsRequest.serialize, + response_deserializer=job_service.SearchJobsResponse.deserialize, + ) + return self._stubs["search_jobs"] + + @property + def search_jobs_for_alert( + self, + ) -> Callable[ + [job_service.SearchJobsRequest], Awaitable[job_service.SearchJobsResponse] + ]: + r"""Return a callable for the search jobs for alert method over gRPC. + + Searches for jobs using the provided + [SearchJobsRequest][google.cloud.talent.v4beta1.SearchJobsRequest]. + + This API call is intended for the use case of targeting passive + job seekers (for example, job seekers who have signed up to + receive email alerts about potential job opportunities), and has + different algorithmic adjustments that are targeted to passive + job seekers. + + This call constrains the + [visibility][google.cloud.talent.v4beta1.Job.visibility] of jobs + present in the database, and only returns jobs the caller has + permission to search against. + + Returns: + Callable[[~.SearchJobsRequest], + Awaitable[~.SearchJobsResponse]]: + A function that, when called, will call the underlying RPC + on the server. + """ + # 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 "search_jobs_for_alert" not in self._stubs: + self._stubs["search_jobs_for_alert"] = self.grpc_channel.unary_unary( + "/google.cloud.talent.v4beta1.JobService/SearchJobsForAlert", + request_serializer=job_service.SearchJobsRequest.serialize, + response_deserializer=job_service.SearchJobsResponse.deserialize, + ) + return self._stubs["search_jobs_for_alert"] + + +__all__ = ("JobServiceGrpcAsyncIOTransport",) diff --git a/google/cloud/talent_v4beta1/services/profile_service/__init__.py b/google/cloud/talent_v4beta1/services/profile_service/__init__.py new file mode 100644 index 00000000..bace920e --- /dev/null +++ b/google/cloud/talent_v4beta1/services/profile_service/__init__.py @@ -0,0 +1,24 @@ +# -*- 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. +# + +from .client import ProfileServiceClient +from .async_client import ProfileServiceAsyncClient + +__all__ = ( + "ProfileServiceClient", + "ProfileServiceAsyncClient", +) diff --git a/google/cloud/talent_v4beta1/services/profile_service/async_client.py b/google/cloud/talent_v4beta1/services/profile_service/async_client.py new file mode 100644 index 00000000..786f1760 --- /dev/null +++ b/google/cloud/talent_v4beta1/services/profile_service/async_client.py @@ -0,0 +1,588 @@ +# -*- 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. +# + +from collections import OrderedDict +import functools +import re +from typing import Dict, Sequence, Tuple, Type, Union +import pkg_resources + +import google.api_core.client_options as ClientOptions # type: ignore +from google.api_core import exceptions # type: ignore +from google.api_core import gapic_v1 # type: ignore +from google.api_core import retry as retries # type: ignore +from google.auth import credentials # type: ignore +from google.oauth2 import service_account # type: ignore + +from google.cloud.talent_v4beta1.services.profile_service import pagers +from google.cloud.talent_v4beta1.types import common +from google.cloud.talent_v4beta1.types import histogram +from google.cloud.talent_v4beta1.types import profile +from google.cloud.talent_v4beta1.types import profile as gct_profile +from google.cloud.talent_v4beta1.types import profile_service +from google.protobuf import timestamp_pb2 as timestamp # type: ignore +from google.protobuf import wrappers_pb2 as wrappers # type: ignore + +from .transports.base import ProfileServiceTransport +from .transports.grpc_asyncio import ProfileServiceGrpcAsyncIOTransport +from .client import ProfileServiceClient + + +class ProfileServiceAsyncClient: + """A service that handles profile management, including profile + CRUD, enumeration and search. + """ + + _client: ProfileServiceClient + + DEFAULT_ENDPOINT = ProfileServiceClient.DEFAULT_ENDPOINT + DEFAULT_MTLS_ENDPOINT = ProfileServiceClient.DEFAULT_MTLS_ENDPOINT + + profile_path = staticmethod(ProfileServiceClient.profile_path) + + from_service_account_file = ProfileServiceClient.from_service_account_file + from_service_account_json = from_service_account_file + + get_transport_class = functools.partial( + type(ProfileServiceClient).get_transport_class, type(ProfileServiceClient) + ) + + def __init__( + self, + *, + credentials: credentials.Credentials = None, + transport: Union[str, ProfileServiceTransport] = "grpc_asyncio", + client_options: ClientOptions = None, + ) -> None: + """Instantiate the profile service client. + + Args: + credentials (Optional[google.auth.credentials.Credentials]): The + authorization credentials to attach to requests. These + credentials identify the application to the service; if none + are specified, the client will attempt to ascertain the + credentials from the environment. + transport (Union[str, ~.ProfileServiceTransport]): The + transport to use. If set to None, a transport is chosen + automatically. + client_options (ClientOptions): Custom options for the client. It + won't take effect if a ``transport`` instance is provided. + (1) The ``api_endpoint`` property can be used to override the + default endpoint provided by the client. GOOGLE_API_USE_MTLS + environment variable can also be used to override the endpoint: + "always" (always use the default mTLS endpoint), "never" (always + use the default regular endpoint, this is the default value for + the environment variable) and "auto" (auto switch to the default + mTLS endpoint if client SSL credentials is present). However, + the ``api_endpoint`` property takes precedence if provided. + (2) The ``client_cert_source`` property is used to provide client + SSL credentials for mutual TLS transport. If not provided, the + default SSL credentials will be used if present. + + Raises: + google.auth.exceptions.MutualTlsChannelError: If mutual TLS transport + creation failed for any reason. + """ + + self._client = ProfileServiceClient( + credentials=credentials, transport=transport, client_options=client_options, + ) + + async def list_profiles( + self, + request: profile_service.ListProfilesRequest = None, + *, + parent: str = None, + retry: retries.Retry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> pagers.ListProfilesAsyncPager: + r"""Lists profiles by filter. The order is unspecified. + + Args: + request (:class:`~.profile_service.ListProfilesRequest`): + The request object. List profiles request. + parent (:class:`str`): + Required. The resource name of the tenant under which + the profile is created. + + The format is + "projects/{project_id}/tenants/{tenant_id}". For + example, "projects/foo/tenants/bar". + This corresponds to the ``parent`` 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. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + ~.pagers.ListProfilesAsyncPager: + The List profiles response object. + Iterating over this object will yield + results and resolve additional pages + automatically. + + """ + # Create or coerce a protobuf request object. + # Sanity check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + if request is not None and any([parent]): + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + request = profile_service.ListProfilesRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + + if parent is not None: + request.parent = parent + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.list_profiles, + default_retry=retries.Retry( + initial=0.1, + maximum=60.0, + multiplier=1.3, + predicate=retries.if_exception_type( + exceptions.ServiceUnavailable, exceptions.DeadlineExceeded, + ), + ), + default_timeout=30.0, + client_info=_client_info, + ) + + # 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),)), + ) + + # Send the request. + response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + + # This method is paged; wrap the response in a pager, which provides + # an `__aiter__` convenience method. + response = pagers.ListProfilesAsyncPager( + method=rpc, request=request, response=response, metadata=metadata, + ) + + # Done; return the response. + return response + + async def create_profile( + self, + request: profile_service.CreateProfileRequest = None, + *, + parent: str = None, + profile: gct_profile.Profile = None, + retry: retries.Retry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> gct_profile.Profile: + r"""Creates and returns a new profile. + + Args: + request (:class:`~.profile_service.CreateProfileRequest`): + The request object. Create profile request. + parent (:class:`str`): + Required. The name of the tenant this profile belongs + to. + + The format is + "projects/{project_id}/tenants/{tenant_id}". For + example, "projects/foo/tenants/bar". + This corresponds to the ``parent`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + profile (:class:`~.gct_profile.Profile`): + Required. The profile to be created. + This corresponds to the ``profile`` 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. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + ~.gct_profile.Profile: + A resource that represents the + profile for a job candidate (also + referred to as a "single-source + profile"). + + """ + # Create or coerce a protobuf request object. + # Sanity check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + if request is not None and any([parent, profile]): + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + request = profile_service.CreateProfileRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + + if parent is not None: + request.parent = parent + if profile is not None: + request.profile = profile + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.create_profile, + default_timeout=30.0, + client_info=_client_info, + ) + + # 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),)), + ) + + # Send the request. + response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + + # Done; return the response. + return response + + async def get_profile( + self, + request: profile_service.GetProfileRequest = None, + *, + name: str = None, + retry: retries.Retry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> profile.Profile: + r"""Gets the specified profile. + + Args: + request (:class:`~.profile_service.GetProfileRequest`): + The request object. Get profile request. + name (:class:`str`): + Required. Resource name of the profile to get. + + The format is + "projects/{project_id}/tenants/{tenant_id}/profiles/{profile_id}". + For example, "projects/foo/tenants/bar/profiles/baz". + This corresponds to the ``name`` 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. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + ~.profile.Profile: + A resource that represents the + profile for a job candidate (also + referred to as a "single-source + profile"). + + """ + # Create or coerce a protobuf request object. + # Sanity check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + if request is not None and any([name]): + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + request = profile_service.GetProfileRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + + if name is not None: + request.name = name + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.get_profile, + default_retry=retries.Retry( + initial=0.1, + maximum=60.0, + multiplier=1.3, + predicate=retries.if_exception_type( + exceptions.ServiceUnavailable, exceptions.DeadlineExceeded, + ), + ), + default_timeout=30.0, + client_info=_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 update_profile( + self, + request: profile_service.UpdateProfileRequest = None, + *, + profile: gct_profile.Profile = None, + retry: retries.Retry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> gct_profile.Profile: + r"""Updates the specified profile and returns the updated + result. + + Args: + request (:class:`~.profile_service.UpdateProfileRequest`): + The request object. Update profile request + profile (:class:`~.gct_profile.Profile`): + Required. Profile to be updated. + This corresponds to the ``profile`` 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. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + ~.gct_profile.Profile: + A resource that represents the + profile for a job candidate (also + referred to as a "single-source + profile"). + + """ + # Create or coerce a protobuf request object. + # Sanity check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + if request is not None and any([profile]): + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + request = profile_service.UpdateProfileRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + + if profile is not None: + request.profile = profile + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.update_profile, + default_timeout=30.0, + client_info=_client_info, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata( + (("profile.name", request.profile.name),) + ), + ) + + # Send the request. + response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + + # Done; return the response. + return response + + async def delete_profile( + self, + request: profile_service.DeleteProfileRequest = None, + *, + name: str = None, + retry: retries.Retry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> None: + r"""Deletes the specified profile. + Prerequisite: The profile has no associated applications + or assignments associated. + + Args: + request (:class:`~.profile_service.DeleteProfileRequest`): + The request object. Delete profile request. + name (:class:`str`): + Required. Resource name of the profile to be deleted. + + The format is + "projects/{project_id}/tenants/{tenant_id}/profiles/{profile_id}". + For example, "projects/foo/tenants/bar/profiles/baz". + This corresponds to the ``name`` 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. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + """ + # Create or coerce a protobuf request object. + # Sanity check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + if request is not None and any([name]): + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + request = profile_service.DeleteProfileRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + + if name is not None: + request.name = name + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.delete_profile, + default_retry=retries.Retry( + initial=0.1, + maximum=60.0, + multiplier=1.3, + predicate=retries.if_exception_type( + exceptions.ServiceUnavailable, exceptions.DeadlineExceeded, + ), + ), + default_timeout=30.0, + client_info=_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. + await rpc( + request, retry=retry, timeout=timeout, metadata=metadata, + ) + + async def search_profiles( + self, + request: profile_service.SearchProfilesRequest = None, + *, + retry: retries.Retry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> pagers.SearchProfilesAsyncPager: + r"""Searches for profiles within a tenant. + + For example, search by raw queries "software engineer in + Mountain View" or search by structured filters (location filter, + education filter, etc.). + + See + [SearchProfilesRequest][google.cloud.talent.v4beta1.SearchProfilesRequest] + for more information. + + Args: + request (:class:`~.profile_service.SearchProfilesRequest`): + The request object. The request body of the + `SearchProfiles` call. + + 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: + ~.pagers.SearchProfilesAsyncPager: + Response of SearchProfiles method. + Iterating over this object will yield + results and resolve additional pages + automatically. + + """ + # Create or coerce a protobuf request object. + + request = profile_service.SearchProfilesRequest(request) + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.search_profiles, + default_timeout=30.0, + client_info=_client_info, + ) + + # 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),)), + ) + + # Send the request. + response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + + # This method is paged; wrap the response in a pager, which provides + # an `__aiter__` convenience method. + response = pagers.SearchProfilesAsyncPager( + method=rpc, request=request, response=response, metadata=metadata, + ) + + # Done; return the response. + return response + + +try: + _client_info = gapic_v1.client_info.ClientInfo( + gapic_version=pkg_resources.get_distribution("google-cloud-talent",).version, + ) +except pkg_resources.DistributionNotFound: + _client_info = gapic_v1.client_info.ClientInfo() + + +__all__ = ("ProfileServiceAsyncClient",) diff --git a/google/cloud/talent_v4beta1/services/profile_service/client.py b/google/cloud/talent_v4beta1/services/profile_service/client.py new file mode 100644 index 00000000..627735f6 --- /dev/null +++ b/google/cloud/talent_v4beta1/services/profile_service/client.py @@ -0,0 +1,715 @@ +# -*- 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. +# + +from collections import OrderedDict +import os +import re +from typing import Callable, Dict, Sequence, Tuple, Type, Union +import pkg_resources + +import google.api_core.client_options as ClientOptions # type: ignore +from google.api_core import exceptions # type: ignore +from google.api_core import gapic_v1 # type: ignore +from google.api_core import retry as retries # type: ignore +from google.auth import credentials # type: ignore +from google.auth.transport import mtls # type: ignore +from google.auth.exceptions import MutualTLSChannelError # type: ignore +from google.oauth2 import service_account # type: ignore + +from google.cloud.talent_v4beta1.services.profile_service import pagers +from google.cloud.talent_v4beta1.types import common +from google.cloud.talent_v4beta1.types import histogram +from google.cloud.talent_v4beta1.types import profile +from google.cloud.talent_v4beta1.types import profile as gct_profile +from google.cloud.talent_v4beta1.types import profile_service +from google.protobuf import timestamp_pb2 as timestamp # type: ignore +from google.protobuf import wrappers_pb2 as wrappers # type: ignore + +from .transports.base import ProfileServiceTransport +from .transports.grpc import ProfileServiceGrpcTransport +from .transports.grpc_asyncio import ProfileServiceGrpcAsyncIOTransport + + +class ProfileServiceClientMeta(type): + """Metaclass for the ProfileService client. + + This provides class-level methods for building and retrieving + support objects (e.g. transport) without polluting the client instance + objects. + """ + + _transport_registry = ( + OrderedDict() + ) # type: Dict[str, Type[ProfileServiceTransport]] + _transport_registry["grpc"] = ProfileServiceGrpcTransport + _transport_registry["grpc_asyncio"] = ProfileServiceGrpcAsyncIOTransport + + def get_transport_class(cls, label: str = None,) -> Type[ProfileServiceTransport]: + """Return an appropriate transport class. + + Args: + label: The name of the desired transport. If none is + provided, then the first transport in the registry is used. + + Returns: + The transport class to use. + """ + # If a specific transport is requested, return that one. + if label: + return cls._transport_registry[label] + + # No transport is requested; return the default (that is, the first one + # in the dictionary). + return next(iter(cls._transport_registry.values())) + + +class ProfileServiceClient(metaclass=ProfileServiceClientMeta): + """A service that handles profile management, including profile + CRUD, enumeration and search. + """ + + @staticmethod + def _get_default_mtls_endpoint(api_endpoint): + """Convert api endpoint to mTLS endpoint. + Convert "*.sandbox.googleapis.com" and "*.googleapis.com" to + "*.mtls.sandbox.googleapis.com" and "*.mtls.googleapis.com" respectively. + Args: + api_endpoint (Optional[str]): the api endpoint to convert. + Returns: + str: converted mTLS api endpoint. + """ + if not api_endpoint: + return api_endpoint + + mtls_endpoint_re = re.compile( + r"(?P[^.]+)(?P\.mtls)?(?P\.sandbox)?(?P\.googleapis\.com)?" + ) + + m = mtls_endpoint_re.match(api_endpoint) + name, mtls, sandbox, googledomain = m.groups() + if mtls or not googledomain: + return api_endpoint + + if sandbox: + return api_endpoint.replace( + "sandbox.googleapis.com", "mtls.sandbox.googleapis.com" + ) + + return api_endpoint.replace(".googleapis.com", ".mtls.googleapis.com") + + DEFAULT_ENDPOINT = "jobs.googleapis.com" + DEFAULT_MTLS_ENDPOINT = _get_default_mtls_endpoint.__func__( # type: ignore + DEFAULT_ENDPOINT + ) + + @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: + {@api.name}: The constructed client. + """ + credentials = service_account.Credentials.from_service_account_file(filename) + kwargs["credentials"] = credentials + return cls(*args, **kwargs) + + from_service_account_json = from_service_account_file + + @staticmethod + def profile_path(project: str, tenant: str, profile: str,) -> str: + """Return a fully-qualified profile string.""" + return "projects/{project}/tenants/{tenant}/profiles/{profile}".format( + project=project, tenant=tenant, profile=profile, + ) + + @staticmethod + def parse_profile_path(path: str) -> Dict[str, str]: + """Parse a profile path into its component segments.""" + m = re.match( + r"^projects/(?P.+?)/tenants/(?P.+?)/profiles/(?P.+?)$", + path, + ) + return m.groupdict() if m else {} + + def __init__( + self, + *, + credentials: credentials.Credentials = None, + transport: Union[str, ProfileServiceTransport] = None, + client_options: ClientOptions = None, + ) -> None: + """Instantiate the profile service client. + + Args: + credentials (Optional[google.auth.credentials.Credentials]): The + authorization credentials to attach to requests. These + credentials identify the application to the service; if none + are specified, the client will attempt to ascertain the + credentials from the environment. + transport (Union[str, ~.ProfileServiceTransport]): The + transport to use. If set to None, a transport is chosen + automatically. + client_options (ClientOptions): Custom options for the client. It + won't take effect if a ``transport`` instance is provided. + (1) The ``api_endpoint`` property can be used to override the + default endpoint provided by the client. GOOGLE_API_USE_MTLS + environment variable can also be used to override the endpoint: + "always" (always use the default mTLS endpoint), "never" (always + use the default regular endpoint, this is the default value for + the environment variable) and "auto" (auto switch to the default + mTLS endpoint if client SSL credentials is present). However, + the ``api_endpoint`` property takes precedence if provided. + (2) The ``client_cert_source`` property is used to provide client + SSL credentials for mutual TLS transport. If not provided, the + default SSL credentials will be used if present. + + Raises: + google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport + creation failed for any reason. + """ + if isinstance(client_options, dict): + client_options = ClientOptions.from_dict(client_options) + if client_options is None: + client_options = ClientOptions.ClientOptions() + + if client_options.api_endpoint is None: + use_mtls_env = os.getenv("GOOGLE_API_USE_MTLS", "never") + if use_mtls_env == "never": + client_options.api_endpoint = self.DEFAULT_ENDPOINT + elif use_mtls_env == "always": + client_options.api_endpoint = self.DEFAULT_MTLS_ENDPOINT + elif use_mtls_env == "auto": + has_client_cert_source = ( + client_options.client_cert_source is not None + or mtls.has_default_client_cert_source() + ) + client_options.api_endpoint = ( + self.DEFAULT_MTLS_ENDPOINT + if has_client_cert_source + else self.DEFAULT_ENDPOINT + ) + else: + raise MutualTLSChannelError( + "Unsupported GOOGLE_API_USE_MTLS value. Accepted values: never, auto, always" + ) + + # Save or instantiate the transport. + # Ordinarily, we provide the transport, but allowing a custom transport + # instance provides an extensibility point for unusual situations. + if isinstance(transport, ProfileServiceTransport): + # transport is a ProfileServiceTransport instance. + if credentials or client_options.credentials_file: + raise ValueError( + "When providing a transport instance, " + "provide its credentials directly." + ) + if client_options.scopes: + raise ValueError( + "When providing a transport instance, " + "provide its scopes directly." + ) + self._transport = transport + else: + Transport = type(self).get_transport_class(transport) + self._transport = Transport( + credentials=credentials, + credentials_file=client_options.credentials_file, + host=client_options.api_endpoint, + scopes=client_options.scopes, + api_mtls_endpoint=client_options.api_endpoint, + client_cert_source=client_options.client_cert_source, + quota_project_id=client_options.quota_project_id, + ) + + def list_profiles( + self, + request: profile_service.ListProfilesRequest = None, + *, + parent: str = None, + retry: retries.Retry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> pagers.ListProfilesPager: + r"""Lists profiles by filter. The order is unspecified. + + Args: + request (:class:`~.profile_service.ListProfilesRequest`): + The request object. List profiles request. + parent (:class:`str`): + Required. The resource name of the tenant under which + the profile is created. + + The format is + "projects/{project_id}/tenants/{tenant_id}". For + example, "projects/foo/tenants/bar". + This corresponds to the ``parent`` 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. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + ~.pagers.ListProfilesPager: + The List profiles response object. + Iterating over this object will yield + results and resolve additional pages + automatically. + + """ + # Create or coerce a protobuf request object. + # Sanity check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([parent]) + if request is not None and has_flattened_params: + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + # Minor optimization to avoid making a copy if the user passes + # in a profile_service.ListProfilesRequest. + # There's no risk of modifying the input as we've already verified + # there are no flattened fields. + if not isinstance(request, profile_service.ListProfilesRequest): + request = profile_service.ListProfilesRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + + if parent is not None: + request.parent = parent + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.list_profiles] + + # 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),)), + ) + + # Send the request. + response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + + # This method is paged; wrap the response in a pager, which provides + # an `__iter__` convenience method. + response = pagers.ListProfilesPager( + method=rpc, request=request, response=response, metadata=metadata, + ) + + # Done; return the response. + return response + + def create_profile( + self, + request: profile_service.CreateProfileRequest = None, + *, + parent: str = None, + profile: gct_profile.Profile = None, + retry: retries.Retry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> gct_profile.Profile: + r"""Creates and returns a new profile. + + Args: + request (:class:`~.profile_service.CreateProfileRequest`): + The request object. Create profile request. + parent (:class:`str`): + Required. The name of the tenant this profile belongs + to. + + The format is + "projects/{project_id}/tenants/{tenant_id}". For + example, "projects/foo/tenants/bar". + This corresponds to the ``parent`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + profile (:class:`~.gct_profile.Profile`): + Required. The profile to be created. + This corresponds to the ``profile`` 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. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + ~.gct_profile.Profile: + A resource that represents the + profile for a job candidate (also + referred to as a "single-source + profile"). + + """ + # Create or coerce a protobuf request object. + # Sanity check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([parent, profile]) + if request is not None and has_flattened_params: + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + # Minor optimization to avoid making a copy if the user passes + # in a profile_service.CreateProfileRequest. + # There's no risk of modifying the input as we've already verified + # there are no flattened fields. + if not isinstance(request, profile_service.CreateProfileRequest): + request = profile_service.CreateProfileRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + + if parent is not None: + request.parent = parent + if profile is not None: + request.profile = profile + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.create_profile] + + # 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),)), + ) + + # Send the request. + response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + + # Done; return the response. + return response + + def get_profile( + self, + request: profile_service.GetProfileRequest = None, + *, + name: str = None, + retry: retries.Retry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> profile.Profile: + r"""Gets the specified profile. + + Args: + request (:class:`~.profile_service.GetProfileRequest`): + The request object. Get profile request. + name (:class:`str`): + Required. Resource name of the profile to get. + + The format is + "projects/{project_id}/tenants/{tenant_id}/profiles/{profile_id}". + For example, "projects/foo/tenants/bar/profiles/baz". + This corresponds to the ``name`` 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. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + ~.profile.Profile: + A resource that represents the + profile for a job candidate (also + referred to as a "single-source + profile"). + + """ + # Create or coerce a protobuf request object. + # Sanity check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([name]) + if request is not None and has_flattened_params: + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + # Minor optimization to avoid making a copy if the user passes + # in a profile_service.GetProfileRequest. + # There's no risk of modifying the input as we've already verified + # there are no flattened fields. + if not isinstance(request, profile_service.GetProfileRequest): + request = profile_service.GetProfileRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + + if name is not None: + request.name = name + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.get_profile] + + # 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 + + def update_profile( + self, + request: profile_service.UpdateProfileRequest = None, + *, + profile: gct_profile.Profile = None, + retry: retries.Retry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> gct_profile.Profile: + r"""Updates the specified profile and returns the updated + result. + + Args: + request (:class:`~.profile_service.UpdateProfileRequest`): + The request object. Update profile request + profile (:class:`~.gct_profile.Profile`): + Required. Profile to be updated. + This corresponds to the ``profile`` 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. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + ~.gct_profile.Profile: + A resource that represents the + profile for a job candidate (also + referred to as a "single-source + profile"). + + """ + # Create or coerce a protobuf request object. + # Sanity check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([profile]) + if request is not None and has_flattened_params: + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + # Minor optimization to avoid making a copy if the user passes + # in a profile_service.UpdateProfileRequest. + # There's no risk of modifying the input as we've already verified + # there are no flattened fields. + if not isinstance(request, profile_service.UpdateProfileRequest): + request = profile_service.UpdateProfileRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + + if profile is not None: + request.profile = profile + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.update_profile] + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata( + (("profile.name", request.profile.name),) + ), + ) + + # Send the request. + response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + + # Done; return the response. + return response + + def delete_profile( + self, + request: profile_service.DeleteProfileRequest = None, + *, + name: str = None, + retry: retries.Retry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> None: + r"""Deletes the specified profile. + Prerequisite: The profile has no associated applications + or assignments associated. + + Args: + request (:class:`~.profile_service.DeleteProfileRequest`): + The request object. Delete profile request. + name (:class:`str`): + Required. Resource name of the profile to be deleted. + + The format is + "projects/{project_id}/tenants/{tenant_id}/profiles/{profile_id}". + For example, "projects/foo/tenants/bar/profiles/baz". + This corresponds to the ``name`` 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. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + """ + # Create or coerce a protobuf request object. + # Sanity check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([name]) + if request is not None and has_flattened_params: + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + # Minor optimization to avoid making a copy if the user passes + # in a profile_service.DeleteProfileRequest. + # There's no risk of modifying the input as we've already verified + # there are no flattened fields. + if not isinstance(request, profile_service.DeleteProfileRequest): + request = profile_service.DeleteProfileRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + + if name is not None: + request.name = name + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.delete_profile] + + # 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. + rpc( + request, retry=retry, timeout=timeout, metadata=metadata, + ) + + def search_profiles( + self, + request: profile_service.SearchProfilesRequest = None, + *, + retry: retries.Retry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> pagers.SearchProfilesPager: + r"""Searches for profiles within a tenant. + + For example, search by raw queries "software engineer in + Mountain View" or search by structured filters (location filter, + education filter, etc.). + + See + [SearchProfilesRequest][google.cloud.talent.v4beta1.SearchProfilesRequest] + for more information. + + Args: + request (:class:`~.profile_service.SearchProfilesRequest`): + The request object. The request body of the + `SearchProfiles` call. + + 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: + ~.pagers.SearchProfilesPager: + Response of SearchProfiles method. + Iterating over this object will yield + results and resolve additional pages + automatically. + + """ + # Create or coerce a protobuf request object. + + # Minor optimization to avoid making a copy if the user passes + # in a profile_service.SearchProfilesRequest. + # There's no risk of modifying the input as we've already verified + # there are no flattened fields. + if not isinstance(request, profile_service.SearchProfilesRequest): + request = profile_service.SearchProfilesRequest(request) + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.search_profiles] + + # 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),)), + ) + + # Send the request. + response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + + # This method is paged; wrap the response in a pager, which provides + # an `__iter__` convenience method. + response = pagers.SearchProfilesPager( + method=rpc, request=request, response=response, metadata=metadata, + ) + + # Done; return the response. + return response + + +try: + _client_info = gapic_v1.client_info.ClientInfo( + gapic_version=pkg_resources.get_distribution("google-cloud-talent",).version, + ) +except pkg_resources.DistributionNotFound: + _client_info = gapic_v1.client_info.ClientInfo() + + +__all__ = ("ProfileServiceClient",) diff --git a/google/cloud/talent_v4beta1/services/profile_service/pagers.py b/google/cloud/talent_v4beta1/services/profile_service/pagers.py new file mode 100644 index 00000000..c2f71326 --- /dev/null +++ b/google/cloud/talent_v4beta1/services/profile_service/pagers.py @@ -0,0 +1,278 @@ +# -*- 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. +# + +from typing import Any, AsyncIterable, Awaitable, Callable, Iterable, Sequence, Tuple + +from google.cloud.talent_v4beta1.types import histogram +from google.cloud.talent_v4beta1.types import profile +from google.cloud.talent_v4beta1.types import profile_service + + +class ListProfilesPager: + """A pager for iterating through ``list_profiles`` requests. + + This class thinly wraps an initial + :class:`~.profile_service.ListProfilesResponse` object, and + provides an ``__iter__`` method to iterate through its + ``profiles`` field. + + If there are more pages, the ``__iter__`` method will make additional + ``ListProfiles`` requests and continue to iterate + through the ``profiles`` field on the + corresponding responses. + + All the usual :class:`~.profile_service.ListProfilesResponse` + attributes are available on the pager. If multiple requests are made, only + the most recent response is retained, and thus used for attribute lookup. + """ + + def __init__( + self, + method: Callable[..., profile_service.ListProfilesResponse], + request: profile_service.ListProfilesRequest, + response: profile_service.ListProfilesResponse, + *, + metadata: Sequence[Tuple[str, str]] = () + ): + """Instantiate the pager. + + Args: + method (Callable): The method that was originally called, and + which instantiated this pager. + request (:class:`~.profile_service.ListProfilesRequest`): + The initial request object. + response (:class:`~.profile_service.ListProfilesResponse`): + The initial response object. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + """ + self._method = method + self._request = profile_service.ListProfilesRequest(request) + self._response = response + self._metadata = metadata + + def __getattr__(self, name: str) -> Any: + return getattr(self._response, name) + + @property + def pages(self) -> Iterable[profile_service.ListProfilesResponse]: + 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) + yield self._response + + def __iter__(self) -> Iterable[profile.Profile]: + for page in self.pages: + yield from page.profiles + + def __repr__(self) -> str: + return "{0}<{1!r}>".format(self.__class__.__name__, self._response) + + +class ListProfilesAsyncPager: + """A pager for iterating through ``list_profiles`` requests. + + This class thinly wraps an initial + :class:`~.profile_service.ListProfilesResponse` object, and + provides an ``__aiter__`` method to iterate through its + ``profiles`` field. + + If there are more pages, the ``__aiter__`` method will make additional + ``ListProfiles`` requests and continue to iterate + through the ``profiles`` field on the + corresponding responses. + + All the usual :class:`~.profile_service.ListProfilesResponse` + attributes are available on the pager. If multiple requests are made, only + the most recent response is retained, and thus used for attribute lookup. + """ + + def __init__( + self, + method: Callable[..., Awaitable[profile_service.ListProfilesResponse]], + request: profile_service.ListProfilesRequest, + response: profile_service.ListProfilesResponse, + *, + metadata: Sequence[Tuple[str, str]] = () + ): + """Instantiate the pager. + + Args: + method (Callable): The method that was originally called, and + which instantiated this pager. + request (:class:`~.profile_service.ListProfilesRequest`): + The initial request object. + response (:class:`~.profile_service.ListProfilesResponse`): + The initial response object. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + """ + self._method = method + self._request = profile_service.ListProfilesRequest(request) + self._response = response + self._metadata = metadata + + def __getattr__(self, name: str) -> Any: + return getattr(self._response, name) + + @property + async def pages(self) -> AsyncIterable[profile_service.ListProfilesResponse]: + 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) + yield self._response + + def __aiter__(self) -> AsyncIterable[profile.Profile]: + async def async_generator(): + async for page in self.pages: + for response in page.profiles: + yield response + + return async_generator() + + def __repr__(self) -> str: + return "{0}<{1!r}>".format(self.__class__.__name__, self._response) + + +class SearchProfilesPager: + """A pager for iterating through ``search_profiles`` requests. + + This class thinly wraps an initial + :class:`~.profile_service.SearchProfilesResponse` object, and + provides an ``__iter__`` method to iterate through its + ``histogram_query_results`` field. + + If there are more pages, the ``__iter__`` method will make additional + ``SearchProfiles`` requests and continue to iterate + through the ``histogram_query_results`` field on the + corresponding responses. + + All the usual :class:`~.profile_service.SearchProfilesResponse` + attributes are available on the pager. If multiple requests are made, only + the most recent response is retained, and thus used for attribute lookup. + """ + + def __init__( + self, + method: Callable[..., profile_service.SearchProfilesResponse], + request: profile_service.SearchProfilesRequest, + response: profile_service.SearchProfilesResponse, + *, + metadata: Sequence[Tuple[str, str]] = () + ): + """Instantiate the pager. + + Args: + method (Callable): The method that was originally called, and + which instantiated this pager. + request (:class:`~.profile_service.SearchProfilesRequest`): + The initial request object. + response (:class:`~.profile_service.SearchProfilesResponse`): + The initial response object. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + """ + self._method = method + self._request = profile_service.SearchProfilesRequest(request) + self._response = response + self._metadata = metadata + + def __getattr__(self, name: str) -> Any: + return getattr(self._response, name) + + @property + def pages(self) -> Iterable[profile_service.SearchProfilesResponse]: + 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) + yield self._response + + def __iter__(self) -> Iterable[histogram.HistogramQueryResult]: + for page in self.pages: + yield from page.histogram_query_results + + def __repr__(self) -> str: + return "{0}<{1!r}>".format(self.__class__.__name__, self._response) + + +class SearchProfilesAsyncPager: + """A pager for iterating through ``search_profiles`` requests. + + This class thinly wraps an initial + :class:`~.profile_service.SearchProfilesResponse` object, and + provides an ``__aiter__`` method to iterate through its + ``histogram_query_results`` field. + + If there are more pages, the ``__aiter__`` method will make additional + ``SearchProfiles`` requests and continue to iterate + through the ``histogram_query_results`` field on the + corresponding responses. + + All the usual :class:`~.profile_service.SearchProfilesResponse` + attributes are available on the pager. If multiple requests are made, only + the most recent response is retained, and thus used for attribute lookup. + """ + + def __init__( + self, + method: Callable[..., Awaitable[profile_service.SearchProfilesResponse]], + request: profile_service.SearchProfilesRequest, + response: profile_service.SearchProfilesResponse, + *, + metadata: Sequence[Tuple[str, str]] = () + ): + """Instantiate the pager. + + Args: + method (Callable): The method that was originally called, and + which instantiated this pager. + request (:class:`~.profile_service.SearchProfilesRequest`): + The initial request object. + response (:class:`~.profile_service.SearchProfilesResponse`): + The initial response object. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + """ + self._method = method + self._request = profile_service.SearchProfilesRequest(request) + self._response = response + self._metadata = metadata + + def __getattr__(self, name: str) -> Any: + return getattr(self._response, name) + + @property + async def pages(self) -> AsyncIterable[profile_service.SearchProfilesResponse]: + 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) + yield self._response + + def __aiter__(self) -> AsyncIterable[histogram.HistogramQueryResult]: + async def async_generator(): + async for page in self.pages: + for response in page.histogram_query_results: + yield response + + return async_generator() + + def __repr__(self) -> str: + return "{0}<{1!r}>".format(self.__class__.__name__, self._response) diff --git a/google/cloud/talent_v4beta1/services/profile_service/transports/__init__.py b/google/cloud/talent_v4beta1/services/profile_service/transports/__init__.py new file mode 100644 index 00000000..940a2165 --- /dev/null +++ b/google/cloud/talent_v4beta1/services/profile_service/transports/__init__.py @@ -0,0 +1,36 @@ +# -*- 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. +# + +from collections import OrderedDict +from typing import Dict, Type + +from .base import ProfileServiceTransport +from .grpc import ProfileServiceGrpcTransport +from .grpc_asyncio import ProfileServiceGrpcAsyncIOTransport + + +# Compile a registry of transports. +_transport_registry = OrderedDict() # type: Dict[str, Type[ProfileServiceTransport]] +_transport_registry["grpc"] = ProfileServiceGrpcTransport +_transport_registry["grpc_asyncio"] = ProfileServiceGrpcAsyncIOTransport + + +__all__ = ( + "ProfileServiceTransport", + "ProfileServiceGrpcTransport", + "ProfileServiceGrpcAsyncIOTransport", +) diff --git a/google/cloud/talent_v4beta1/services/profile_service/transports/base.py b/google/cloud/talent_v4beta1/services/profile_service/transports/base.py new file mode 100644 index 00000000..707cc262 --- /dev/null +++ b/google/cloud/talent_v4beta1/services/profile_service/transports/base.py @@ -0,0 +1,218 @@ +# -*- 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. +# + +import abc +import typing +import pkg_resources + +from google import auth +from google.api_core import exceptions # type: ignore +from google.api_core import gapic_v1 # type: ignore +from google.api_core import retry as retries # type: ignore +from google.auth import credentials # type: ignore + +from google.cloud.talent_v4beta1.types import profile +from google.cloud.talent_v4beta1.types import profile as gct_profile +from google.cloud.talent_v4beta1.types import profile_service +from google.protobuf import empty_pb2 as empty # type: ignore + + +try: + _client_info = gapic_v1.client_info.ClientInfo( + gapic_version=pkg_resources.get_distribution("google-cloud-talent",).version, + ) +except pkg_resources.DistributionNotFound: + _client_info = gapic_v1.client_info.ClientInfo() + + +class ProfileServiceTransport(abc.ABC): + """Abstract transport class for ProfileService.""" + + AUTH_SCOPES = ( + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/jobs", + ) + + def __init__( + self, + *, + host: str = "jobs.googleapis.com", + credentials: credentials.Credentials = None, + credentials_file: typing.Optional[str] = None, + scopes: typing.Optional[typing.Sequence[str]] = AUTH_SCOPES, + quota_project_id: typing.Optional[str] = None, + **kwargs, + ) -> None: + """Instantiate the transport. + + Args: + host (Optional[str]): The hostname to connect to. + credentials (Optional[google.auth.credentials.Credentials]): The + authorization credentials to attach to requests. These + credentials identify the application to the service; if none + are specified, the client will attempt to ascertain the + credentials from the environment. + credentials_file (Optional[str]): A file with credentials that can + be loaded with :func:`google.auth.load_credentials_from_file`. + This argument is mutually exclusive with credentials. + scope (Optional[Sequence[str]]): A list of scopes. + quota_project_id (Optional[str]): An optional project to use for billing + and quota. + """ + # Save the hostname. Default to port 443 (HTTPS) if none is specified. + if ":" not in host: + host += ":443" + self._host = host + + # If no credentials are provided, then determine the appropriate + # defaults. + if credentials and credentials_file: + raise exceptions.DuplicateCredentialArgs( + "'credentials_file' and 'credentials' are mutually exclusive" + ) + + if credentials_file is not None: + credentials, _ = auth.load_credentials_from_file( + credentials_file, scopes=scopes, quota_project_id=quota_project_id + ) + + elif credentials is None: + credentials, _ = auth.default( + scopes=scopes, quota_project_id=quota_project_id + ) + + # Save the credentials. + self._credentials = credentials + + # Lifted into its own function so it can be stubbed out during tests. + self._prep_wrapped_messages() + + def _prep_wrapped_messages(self): + # Precompute the wrapped methods. + self._wrapped_methods = { + self.list_profiles: gapic_v1.method.wrap_method( + self.list_profiles, + default_retry=retries.Retry( + initial=0.1, + maximum=60.0, + multiplier=1.3, + predicate=retries.if_exception_type( + exceptions.ServiceUnavailable, exceptions.DeadlineExceeded, + ), + ), + default_timeout=30.0, + client_info=_client_info, + ), + self.create_profile: gapic_v1.method.wrap_method( + self.create_profile, default_timeout=30.0, client_info=_client_info, + ), + self.get_profile: gapic_v1.method.wrap_method( + self.get_profile, + default_retry=retries.Retry( + initial=0.1, + maximum=60.0, + multiplier=1.3, + predicate=retries.if_exception_type( + exceptions.ServiceUnavailable, exceptions.DeadlineExceeded, + ), + ), + default_timeout=30.0, + client_info=_client_info, + ), + self.update_profile: gapic_v1.method.wrap_method( + self.update_profile, default_timeout=30.0, client_info=_client_info, + ), + self.delete_profile: gapic_v1.method.wrap_method( + self.delete_profile, + default_retry=retries.Retry( + initial=0.1, + maximum=60.0, + multiplier=1.3, + predicate=retries.if_exception_type( + exceptions.ServiceUnavailable, exceptions.DeadlineExceeded, + ), + ), + default_timeout=30.0, + client_info=_client_info, + ), + self.search_profiles: gapic_v1.method.wrap_method( + self.search_profiles, default_timeout=30.0, client_info=_client_info, + ), + } + + @property + def list_profiles( + self, + ) -> typing.Callable[ + [profile_service.ListProfilesRequest], + typing.Union[ + profile_service.ListProfilesResponse, + typing.Awaitable[profile_service.ListProfilesResponse], + ], + ]: + raise NotImplementedError() + + @property + def create_profile( + self, + ) -> typing.Callable[ + [profile_service.CreateProfileRequest], + typing.Union[gct_profile.Profile, typing.Awaitable[gct_profile.Profile]], + ]: + raise NotImplementedError() + + @property + def get_profile( + self, + ) -> typing.Callable[ + [profile_service.GetProfileRequest], + typing.Union[profile.Profile, typing.Awaitable[profile.Profile]], + ]: + raise NotImplementedError() + + @property + def update_profile( + self, + ) -> typing.Callable[ + [profile_service.UpdateProfileRequest], + typing.Union[gct_profile.Profile, typing.Awaitable[gct_profile.Profile]], + ]: + raise NotImplementedError() + + @property + def delete_profile( + self, + ) -> typing.Callable[ + [profile_service.DeleteProfileRequest], + typing.Union[empty.Empty, typing.Awaitable[empty.Empty]], + ]: + raise NotImplementedError() + + @property + def search_profiles( + self, + ) -> typing.Callable[ + [profile_service.SearchProfilesRequest], + typing.Union[ + profile_service.SearchProfilesResponse, + typing.Awaitable[profile_service.SearchProfilesResponse], + ], + ]: + raise NotImplementedError() + + +__all__ = ("ProfileServiceTransport",) diff --git a/google/cloud/talent_v4beta1/services/profile_service/transports/grpc.py b/google/cloud/talent_v4beta1/services/profile_service/transports/grpc.py new file mode 100644 index 00000000..0970a782 --- /dev/null +++ b/google/cloud/talent_v4beta1/services/profile_service/transports/grpc.py @@ -0,0 +1,382 @@ +# -*- 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. +# + +from typing import Callable, Dict, Optional, Sequence, Tuple + +from google.api_core import grpc_helpers # type: ignore +from google import auth # type: ignore +from google.auth import credentials # type: ignore +from google.auth.transport.grpc import SslCredentials # type: ignore + + +import grpc # type: ignore + +from google.cloud.talent_v4beta1.types import profile +from google.cloud.talent_v4beta1.types import profile as gct_profile +from google.cloud.talent_v4beta1.types import profile_service +from google.protobuf import empty_pb2 as empty # type: ignore + +from .base import ProfileServiceTransport + + +class ProfileServiceGrpcTransport(ProfileServiceTransport): + """gRPC backend transport for ProfileService. + + A service that handles profile management, including profile + CRUD, enumeration and search. + + This class defines the same methods as the primary client, so the + primary client can load the underlying transport implementation + and call it. + + It sends protocol buffers over the wire using gRPC (which is built on + top of HTTP/2); the ``grpcio`` package must be installed. + """ + + _stubs: Dict[str, Callable] + + def __init__( + self, + *, + host: str = "jobs.googleapis.com", + credentials: credentials.Credentials = None, + credentials_file: str = None, + scopes: Sequence[str] = None, + channel: grpc.Channel = None, + api_mtls_endpoint: str = None, + client_cert_source: Callable[[], Tuple[bytes, bytes]] = None, + quota_project_id: Optional[str] = None + ) -> None: + """Instantiate the transport. + + Args: + host (Optional[str]): The hostname to connect to. + credentials (Optional[google.auth.credentials.Credentials]): The + authorization credentials to attach to requests. These + credentials identify the application to the service; if none + are specified, the client will attempt to ascertain the + credentials from the environment. + This argument is ignored if ``channel`` is provided. + credentials_file (Optional[str]): A file with credentials that can + be loaded with :func:`google.auth.load_credentials_from_file`. + This argument is ignored if ``channel`` is provided. + scopes (Optional(Sequence[str])): A list of scopes. This argument is + ignored if ``channel`` is provided. + channel (Optional[grpc.Channel]): A ``Channel`` instance through + which to make calls. + api_mtls_endpoint (Optional[str]): The mutual TLS endpoint. If + provided, it overrides the ``host`` argument and tries to create + a mutual TLS channel with client SSL credentials from + ``client_cert_source`` or applicatin default SSL credentials. + client_cert_source (Optional[Callable[[], Tuple[bytes, bytes]]]): A + callback to provide client SSL certificate bytes and private key + bytes, both in PEM format. It is ignored if ``api_mtls_endpoint`` + is None. + quota_project_id (Optional[str]): An optional project to use for billing + and quota. + + Raises: + google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport + creation failed for any reason. + google.api_core.exceptions.DuplicateCredentialArgs: If both ``credentials`` + and ``credentials_file`` are passed. + """ + if channel: + # Sanity check: Ensure that channel and credentials are not both + # provided. + credentials = False + + # If a channel was explicitly provided, set it. + self._grpc_channel = channel + elif api_mtls_endpoint: + host = ( + api_mtls_endpoint + if ":" in api_mtls_endpoint + else api_mtls_endpoint + ":443" + ) + + if credentials is None: + credentials, _ = auth.default( + scopes=self.AUTH_SCOPES, quota_project_id=quota_project_id + ) + + # Create SSL credentials with client_cert_source or application + # default SSL credentials. + if client_cert_source: + cert, key = client_cert_source() + ssl_credentials = grpc.ssl_channel_credentials( + certificate_chain=cert, private_key=key + ) + else: + ssl_credentials = SslCredentials().ssl_credentials + + # create a new channel. The provided one is ignored. + self._grpc_channel = type(self).create_channel( + host, + credentials=credentials, + credentials_file=credentials_file, + ssl_credentials=ssl_credentials, + scopes=scopes or self.AUTH_SCOPES, + quota_project_id=quota_project_id, + ) + + self._stubs = {} # type: Dict[str, Callable] + + # Run the base constructor. + super().__init__( + host=host, + credentials=credentials, + credentials_file=credentials_file, + scopes=scopes or self.AUTH_SCOPES, + quota_project_id=quota_project_id, + ) + + @classmethod + def create_channel( + cls, + host: str = "jobs.googleapis.com", + credentials: credentials.Credentials = None, + credentials_file: str = None, + scopes: Optional[Sequence[str]] = None, + quota_project_id: Optional[str] = None, + **kwargs + ) -> grpc.Channel: + """Create and return a gRPC channel object. + Args: + address (Optionsl[str]): The host for the channel to use. + credentials (Optional[~.Credentials]): The + authorization credentials to attach to requests. These + credentials identify this application to the service. If + none are specified, the client will attempt to ascertain + the credentials from the environment. + credentials_file (Optional[str]): A file with credentials that can + be loaded with :func:`google.auth.load_credentials_from_file`. + This argument is mutually exclusive with credentials. + scopes (Optional[Sequence[str]]): A optional list of scopes needed for this + service. These are only used when credentials are not specified and + are passed to :func:`google.auth.default`. + quota_project_id (Optional[str]): An optional project to use for billing + and quota. + kwargs (Optional[dict]): Keyword arguments, which are passed to the + channel creation. + Returns: + grpc.Channel: A gRPC channel object. + + Raises: + google.api_core.exceptions.DuplicateCredentialArgs: If both ``credentials`` + and ``credentials_file`` are passed. + """ + scopes = scopes or cls.AUTH_SCOPES + return grpc_helpers.create_channel( + host, + credentials=credentials, + credentials_file=credentials_file, + scopes=scopes, + quota_project_id=quota_project_id, + **kwargs + ) + + @property + def grpc_channel(self) -> grpc.Channel: + """Create the channel designed to connect to this service. + + This property caches on the instance; repeated calls return + the same channel. + """ + # Sanity check: Only create a new channel if we do not already + # have one. + if not hasattr(self, "_grpc_channel"): + self._grpc_channel = self.create_channel( + self._host, credentials=self._credentials, + ) + + # Return the channel from cache. + return self._grpc_channel + + @property + def list_profiles( + self, + ) -> Callable[ + [profile_service.ListProfilesRequest], profile_service.ListProfilesResponse + ]: + r"""Return a callable for the list profiles method over gRPC. + + Lists profiles by filter. The order is unspecified. + + Returns: + Callable[[~.ListProfilesRequest], + ~.ListProfilesResponse]: + A function that, when called, will call the underlying RPC + on the server. + """ + # 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 "list_profiles" not in self._stubs: + self._stubs["list_profiles"] = self.grpc_channel.unary_unary( + "/google.cloud.talent.v4beta1.ProfileService/ListProfiles", + request_serializer=profile_service.ListProfilesRequest.serialize, + response_deserializer=profile_service.ListProfilesResponse.deserialize, + ) + return self._stubs["list_profiles"] + + @property + def create_profile( + self, + ) -> Callable[[profile_service.CreateProfileRequest], gct_profile.Profile]: + r"""Return a callable for the create profile method over gRPC. + + Creates and returns a new profile. + + Returns: + Callable[[~.CreateProfileRequest], + ~.Profile]: + A function that, when called, will call the underlying RPC + on the server. + """ + # 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 "create_profile" not in self._stubs: + self._stubs["create_profile"] = self.grpc_channel.unary_unary( + "/google.cloud.talent.v4beta1.ProfileService/CreateProfile", + request_serializer=profile_service.CreateProfileRequest.serialize, + response_deserializer=gct_profile.Profile.deserialize, + ) + return self._stubs["create_profile"] + + @property + def get_profile( + self, + ) -> Callable[[profile_service.GetProfileRequest], profile.Profile]: + r"""Return a callable for the get profile method over gRPC. + + Gets the specified profile. + + Returns: + Callable[[~.GetProfileRequest], + ~.Profile]: + A function that, when called, will call the underlying RPC + on the server. + """ + # 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_profile" not in self._stubs: + self._stubs["get_profile"] = self.grpc_channel.unary_unary( + "/google.cloud.talent.v4beta1.ProfileService/GetProfile", + request_serializer=profile_service.GetProfileRequest.serialize, + response_deserializer=profile.Profile.deserialize, + ) + return self._stubs["get_profile"] + + @property + def update_profile( + self, + ) -> Callable[[profile_service.UpdateProfileRequest], gct_profile.Profile]: + r"""Return a callable for the update profile method over gRPC. + + Updates the specified profile and returns the updated + result. + + Returns: + Callable[[~.UpdateProfileRequest], + ~.Profile]: + A function that, when called, will call the underlying RPC + on the server. + """ + # 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 "update_profile" not in self._stubs: + self._stubs["update_profile"] = self.grpc_channel.unary_unary( + "/google.cloud.talent.v4beta1.ProfileService/UpdateProfile", + request_serializer=profile_service.UpdateProfileRequest.serialize, + response_deserializer=gct_profile.Profile.deserialize, + ) + return self._stubs["update_profile"] + + @property + def delete_profile( + self, + ) -> Callable[[profile_service.DeleteProfileRequest], empty.Empty]: + r"""Return a callable for the delete profile method over gRPC. + + Deletes the specified profile. + Prerequisite: The profile has no associated applications + or assignments associated. + + Returns: + Callable[[~.DeleteProfileRequest], + ~.Empty]: + A function that, when called, will call the underlying RPC + on the server. + """ + # 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 "delete_profile" not in self._stubs: + self._stubs["delete_profile"] = self.grpc_channel.unary_unary( + "/google.cloud.talent.v4beta1.ProfileService/DeleteProfile", + request_serializer=profile_service.DeleteProfileRequest.serialize, + response_deserializer=empty.Empty.FromString, + ) + return self._stubs["delete_profile"] + + @property + def search_profiles( + self, + ) -> Callable[ + [profile_service.SearchProfilesRequest], profile_service.SearchProfilesResponse + ]: + r"""Return a callable for the search profiles method over gRPC. + + Searches for profiles within a tenant. + + For example, search by raw queries "software engineer in + Mountain View" or search by structured filters (location filter, + education filter, etc.). + + See + [SearchProfilesRequest][google.cloud.talent.v4beta1.SearchProfilesRequest] + for more information. + + Returns: + Callable[[~.SearchProfilesRequest], + ~.SearchProfilesResponse]: + A function that, when called, will call the underlying RPC + on the server. + """ + # 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 "search_profiles" not in self._stubs: + self._stubs["search_profiles"] = self.grpc_channel.unary_unary( + "/google.cloud.talent.v4beta1.ProfileService/SearchProfiles", + request_serializer=profile_service.SearchProfilesRequest.serialize, + response_deserializer=profile_service.SearchProfilesResponse.deserialize, + ) + return self._stubs["search_profiles"] + + +__all__ = ("ProfileServiceGrpcTransport",) diff --git a/google/cloud/talent_v4beta1/services/profile_service/transports/grpc_asyncio.py b/google/cloud/talent_v4beta1/services/profile_service/transports/grpc_asyncio.py new file mode 100644 index 00000000..c8ce2e0f --- /dev/null +++ b/google/cloud/talent_v4beta1/services/profile_service/transports/grpc_asyncio.py @@ -0,0 +1,381 @@ +# -*- 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. +# + +from typing import Awaitable, Callable, Dict, Optional, Sequence, Tuple + +from google.api_core import grpc_helpers_async # type: ignore +from google.auth import credentials # type: ignore +from google.auth.transport.grpc import SslCredentials # type: ignore + +import grpc # type: ignore +from grpc.experimental import aio # type: ignore + +from google.cloud.talent_v4beta1.types import profile +from google.cloud.talent_v4beta1.types import profile as gct_profile +from google.cloud.talent_v4beta1.types import profile_service +from google.protobuf import empty_pb2 as empty # type: ignore + +from .base import ProfileServiceTransport +from .grpc import ProfileServiceGrpcTransport + + +class ProfileServiceGrpcAsyncIOTransport(ProfileServiceTransport): + """gRPC AsyncIO backend transport for ProfileService. + + A service that handles profile management, including profile + CRUD, enumeration and search. + + This class defines the same methods as the primary client, so the + primary client can load the underlying transport implementation + and call it. + + It sends protocol buffers over the wire using gRPC (which is built on + top of HTTP/2); the ``grpcio`` package must be installed. + """ + + _grpc_channel: aio.Channel + _stubs: Dict[str, Callable] = {} + + @classmethod + def create_channel( + cls, + host: str = "jobs.googleapis.com", + credentials: credentials.Credentials = None, + credentials_file: Optional[str] = None, + scopes: Optional[Sequence[str]] = None, + quota_project_id: Optional[str] = None, + **kwargs, + ) -> aio.Channel: + """Create and return a gRPC AsyncIO channel object. + Args: + address (Optional[str]): The host for the channel to use. + credentials (Optional[~.Credentials]): The + authorization credentials to attach to requests. These + credentials identify this application to the service. If + none are specified, the client will attempt to ascertain + the credentials from the environment. + credentials_file (Optional[str]): A file with credentials that can + be loaded with :func:`google.auth.load_credentials_from_file`. + This argument is ignored if ``channel`` is provided. + scopes (Optional[Sequence[str]]): A optional list of scopes needed for this + service. These are only used when credentials are not specified and + are passed to :func:`google.auth.default`. + quota_project_id (Optional[str]): An optional project to use for billing + and quota. + kwargs (Optional[dict]): Keyword arguments, which are passed to the + channel creation. + Returns: + aio.Channel: A gRPC AsyncIO channel object. + """ + scopes = scopes or cls.AUTH_SCOPES + return grpc_helpers_async.create_channel( + host, + credentials=credentials, + credentials_file=credentials_file, + scopes=scopes, + quota_project_id=quota_project_id, + **kwargs, + ) + + def __init__( + self, + *, + host: str = "jobs.googleapis.com", + credentials: credentials.Credentials = None, + credentials_file: Optional[str] = None, + scopes: Optional[Sequence[str]] = None, + channel: aio.Channel = None, + api_mtls_endpoint: str = None, + client_cert_source: Callable[[], Tuple[bytes, bytes]] = None, + quota_project_id=None, + ) -> None: + """Instantiate the transport. + + Args: + host (Optional[str]): The hostname to connect to. + credentials (Optional[google.auth.credentials.Credentials]): The + authorization credentials to attach to requests. These + credentials identify the application to the service; if none + are specified, the client will attempt to ascertain the + credentials from the environment. + This argument is ignored if ``channel`` is provided. + credentials_file (Optional[str]): A file with credentials that can + be loaded with :func:`google.auth.load_credentials_from_file`. + This argument is ignored if ``channel`` is provided. + scopes (Optional[Sequence[str]]): A optional list of scopes needed for this + service. These are only used when credentials are not specified and + are passed to :func:`google.auth.default`. + channel (Optional[aio.Channel]): A ``Channel`` instance through + which to make calls. + api_mtls_endpoint (Optional[str]): The mutual TLS endpoint. If + provided, it overrides the ``host`` argument and tries to create + a mutual TLS channel with client SSL credentials from + ``client_cert_source`` or applicatin default SSL credentials. + client_cert_source (Optional[Callable[[], Tuple[bytes, bytes]]]): A + callback to provide client SSL certificate bytes and private key + bytes, both in PEM format. It is ignored if ``api_mtls_endpoint`` + is None. + quota_project_id (Optional[str]): An optional project to use for billing + and quota. + + Raises: + google.auth.exceptions.MutualTlsChannelError: If mutual TLS transport + creation failed for any reason. + google.api_core.exceptions.DuplicateCredentialArgs: If both ``credentials`` + and ``credentials_file`` are passed. + """ + if channel: + # Sanity check: Ensure that channel and credentials are not both + # provided. + credentials = False + + # If a channel was explicitly provided, set it. + self._grpc_channel = channel + elif api_mtls_endpoint: + host = ( + api_mtls_endpoint + if ":" in api_mtls_endpoint + else api_mtls_endpoint + ":443" + ) + + # Create SSL credentials with client_cert_source or application + # default SSL credentials. + if client_cert_source: + cert, key = client_cert_source() + ssl_credentials = grpc.ssl_channel_credentials( + certificate_chain=cert, private_key=key + ) + else: + ssl_credentials = SslCredentials().ssl_credentials + + # create a new channel. The provided one is ignored. + self._grpc_channel = type(self).create_channel( + host, + credentials=credentials, + credentials_file=credentials_file, + ssl_credentials=ssl_credentials, + scopes=scopes or self.AUTH_SCOPES, + quota_project_id=quota_project_id, + ) + + # Run the base constructor. + super().__init__( + host=host, + credentials=credentials, + credentials_file=credentials_file, + scopes=scopes or self.AUTH_SCOPES, + quota_project_id=quota_project_id, + ) + + self._stubs = {} + + @property + def grpc_channel(self) -> aio.Channel: + """Create the channel designed to connect to this service. + + This property caches on the instance; repeated calls return + the same channel. + """ + # Sanity check: Only create a new channel if we do not already + # have one. + if not hasattr(self, "_grpc_channel"): + self._grpc_channel = self.create_channel( + self._host, credentials=self._credentials, + ) + + # Return the channel from cache. + return self._grpc_channel + + @property + def list_profiles( + self, + ) -> Callable[ + [profile_service.ListProfilesRequest], + Awaitable[profile_service.ListProfilesResponse], + ]: + r"""Return a callable for the list profiles method over gRPC. + + Lists profiles by filter. The order is unspecified. + + Returns: + Callable[[~.ListProfilesRequest], + Awaitable[~.ListProfilesResponse]]: + A function that, when called, will call the underlying RPC + on the server. + """ + # 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 "list_profiles" not in self._stubs: + self._stubs["list_profiles"] = self.grpc_channel.unary_unary( + "/google.cloud.talent.v4beta1.ProfileService/ListProfiles", + request_serializer=profile_service.ListProfilesRequest.serialize, + response_deserializer=profile_service.ListProfilesResponse.deserialize, + ) + return self._stubs["list_profiles"] + + @property + def create_profile( + self, + ) -> Callable[ + [profile_service.CreateProfileRequest], Awaitable[gct_profile.Profile] + ]: + r"""Return a callable for the create profile method over gRPC. + + Creates and returns a new profile. + + Returns: + Callable[[~.CreateProfileRequest], + Awaitable[~.Profile]]: + A function that, when called, will call the underlying RPC + on the server. + """ + # 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 "create_profile" not in self._stubs: + self._stubs["create_profile"] = self.grpc_channel.unary_unary( + "/google.cloud.talent.v4beta1.ProfileService/CreateProfile", + request_serializer=profile_service.CreateProfileRequest.serialize, + response_deserializer=gct_profile.Profile.deserialize, + ) + return self._stubs["create_profile"] + + @property + def get_profile( + self, + ) -> Callable[[profile_service.GetProfileRequest], Awaitable[profile.Profile]]: + r"""Return a callable for the get profile method over gRPC. + + Gets the specified profile. + + Returns: + Callable[[~.GetProfileRequest], + Awaitable[~.Profile]]: + A function that, when called, will call the underlying RPC + on the server. + """ + # 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_profile" not in self._stubs: + self._stubs["get_profile"] = self.grpc_channel.unary_unary( + "/google.cloud.talent.v4beta1.ProfileService/GetProfile", + request_serializer=profile_service.GetProfileRequest.serialize, + response_deserializer=profile.Profile.deserialize, + ) + return self._stubs["get_profile"] + + @property + def update_profile( + self, + ) -> Callable[ + [profile_service.UpdateProfileRequest], Awaitable[gct_profile.Profile] + ]: + r"""Return a callable for the update profile method over gRPC. + + Updates the specified profile and returns the updated + result. + + Returns: + Callable[[~.UpdateProfileRequest], + Awaitable[~.Profile]]: + A function that, when called, will call the underlying RPC + on the server. + """ + # 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 "update_profile" not in self._stubs: + self._stubs["update_profile"] = self.grpc_channel.unary_unary( + "/google.cloud.talent.v4beta1.ProfileService/UpdateProfile", + request_serializer=profile_service.UpdateProfileRequest.serialize, + response_deserializer=gct_profile.Profile.deserialize, + ) + return self._stubs["update_profile"] + + @property + def delete_profile( + self, + ) -> Callable[[profile_service.DeleteProfileRequest], Awaitable[empty.Empty]]: + r"""Return a callable for the delete profile method over gRPC. + + Deletes the specified profile. + Prerequisite: The profile has no associated applications + or assignments associated. + + Returns: + Callable[[~.DeleteProfileRequest], + Awaitable[~.Empty]]: + A function that, when called, will call the underlying RPC + on the server. + """ + # 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 "delete_profile" not in self._stubs: + self._stubs["delete_profile"] = self.grpc_channel.unary_unary( + "/google.cloud.talent.v4beta1.ProfileService/DeleteProfile", + request_serializer=profile_service.DeleteProfileRequest.serialize, + response_deserializer=empty.Empty.FromString, + ) + return self._stubs["delete_profile"] + + @property + def search_profiles( + self, + ) -> Callable[ + [profile_service.SearchProfilesRequest], + Awaitable[profile_service.SearchProfilesResponse], + ]: + r"""Return a callable for the search profiles method over gRPC. + + Searches for profiles within a tenant. + + For example, search by raw queries "software engineer in + Mountain View" or search by structured filters (location filter, + education filter, etc.). + + See + [SearchProfilesRequest][google.cloud.talent.v4beta1.SearchProfilesRequest] + for more information. + + Returns: + Callable[[~.SearchProfilesRequest], + Awaitable[~.SearchProfilesResponse]]: + A function that, when called, will call the underlying RPC + on the server. + """ + # 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 "search_profiles" not in self._stubs: + self._stubs["search_profiles"] = self.grpc_channel.unary_unary( + "/google.cloud.talent.v4beta1.ProfileService/SearchProfiles", + request_serializer=profile_service.SearchProfilesRequest.serialize, + response_deserializer=profile_service.SearchProfilesResponse.deserialize, + ) + return self._stubs["search_profiles"] + + +__all__ = ("ProfileServiceGrpcAsyncIOTransport",) diff --git a/google/cloud/talent_v4beta1/services/tenant_service/__init__.py b/google/cloud/talent_v4beta1/services/tenant_service/__init__.py new file mode 100644 index 00000000..c3e2ad3b --- /dev/null +++ b/google/cloud/talent_v4beta1/services/tenant_service/__init__.py @@ -0,0 +1,24 @@ +# -*- 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. +# + +from .client import TenantServiceClient +from .async_client import TenantServiceAsyncClient + +__all__ = ( + "TenantServiceClient", + "TenantServiceAsyncClient", +) diff --git a/google/cloud/talent_v4beta1/services/tenant_service/async_client.py b/google/cloud/talent_v4beta1/services/tenant_service/async_client.py new file mode 100644 index 00000000..1c5a5bce --- /dev/null +++ b/google/cloud/talent_v4beta1/services/tenant_service/async_client.py @@ -0,0 +1,528 @@ +# -*- 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. +# + +from collections import OrderedDict +import functools +import re +from typing import Dict, Sequence, Tuple, Type, Union +import pkg_resources + +import google.api_core.client_options as ClientOptions # type: ignore +from google.api_core import exceptions # type: ignore +from google.api_core import gapic_v1 # type: ignore +from google.api_core import retry as retries # type: ignore +from google.auth import credentials # type: ignore +from google.oauth2 import service_account # type: ignore + +from google.cloud.talent_v4beta1.services.tenant_service import pagers +from google.cloud.talent_v4beta1.types import tenant +from google.cloud.talent_v4beta1.types import tenant as gct_tenant +from google.cloud.talent_v4beta1.types import tenant_service + +from .transports.base import TenantServiceTransport +from .transports.grpc_asyncio import TenantServiceGrpcAsyncIOTransport +from .client import TenantServiceClient + + +class TenantServiceAsyncClient: + """A service that handles tenant management, including CRUD and + enumeration. + """ + + _client: TenantServiceClient + + DEFAULT_ENDPOINT = TenantServiceClient.DEFAULT_ENDPOINT + DEFAULT_MTLS_ENDPOINT = TenantServiceClient.DEFAULT_MTLS_ENDPOINT + + tenant_path = staticmethod(TenantServiceClient.tenant_path) + + from_service_account_file = TenantServiceClient.from_service_account_file + from_service_account_json = from_service_account_file + + get_transport_class = functools.partial( + type(TenantServiceClient).get_transport_class, type(TenantServiceClient) + ) + + def __init__( + self, + *, + credentials: credentials.Credentials = None, + transport: Union[str, TenantServiceTransport] = "grpc_asyncio", + client_options: ClientOptions = None, + ) -> None: + """Instantiate the tenant service client. + + Args: + credentials (Optional[google.auth.credentials.Credentials]): The + authorization credentials to attach to requests. These + credentials identify the application to the service; if none + are specified, the client will attempt to ascertain the + credentials from the environment. + transport (Union[str, ~.TenantServiceTransport]): The + transport to use. If set to None, a transport is chosen + automatically. + client_options (ClientOptions): Custom options for the client. It + won't take effect if a ``transport`` instance is provided. + (1) The ``api_endpoint`` property can be used to override the + default endpoint provided by the client. GOOGLE_API_USE_MTLS + environment variable can also be used to override the endpoint: + "always" (always use the default mTLS endpoint), "never" (always + use the default regular endpoint, this is the default value for + the environment variable) and "auto" (auto switch to the default + mTLS endpoint if client SSL credentials is present). However, + the ``api_endpoint`` property takes precedence if provided. + (2) The ``client_cert_source`` property is used to provide client + SSL credentials for mutual TLS transport. If not provided, the + default SSL credentials will be used if present. + + Raises: + google.auth.exceptions.MutualTlsChannelError: If mutual TLS transport + creation failed for any reason. + """ + + self._client = TenantServiceClient( + credentials=credentials, transport=transport, client_options=client_options, + ) + + async def create_tenant( + self, + request: tenant_service.CreateTenantRequest = None, + *, + parent: str = None, + tenant: gct_tenant.Tenant = None, + retry: retries.Retry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> gct_tenant.Tenant: + r"""Creates a new tenant entity. + + Args: + request (:class:`~.tenant_service.CreateTenantRequest`): + The request object. The Request of the CreateTenant + method. + parent (:class:`str`): + Required. Resource name of the project under which the + tenant is created. + + The format is "projects/{project_id}", for example, + "projects/foo". + This corresponds to the ``parent`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + tenant (:class:`~.gct_tenant.Tenant`): + Required. The tenant to be created. + This corresponds to the ``tenant`` 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. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + ~.gct_tenant.Tenant: + A Tenant resource represents a tenant + in the service. A tenant is a group or + entity that shares common access with + specific privileges for resources like + profiles. Customer may create multiple + tenants to provide data isolation for + different groups. + + """ + # Create or coerce a protobuf request object. + # Sanity check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + if request is not None and any([parent, tenant]): + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + request = tenant_service.CreateTenantRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + + if parent is not None: + request.parent = parent + if tenant is not None: + request.tenant = tenant + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.create_tenant, + default_timeout=30.0, + client_info=_client_info, + ) + + # 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),)), + ) + + # Send the request. + response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + + # Done; return the response. + return response + + async def get_tenant( + self, + request: tenant_service.GetTenantRequest = None, + *, + name: str = None, + retry: retries.Retry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> tenant.Tenant: + r"""Retrieves specified tenant. + + Args: + request (:class:`~.tenant_service.GetTenantRequest`): + The request object. Request for getting a tenant by + name. + name (:class:`str`): + Required. The resource name of the tenant to be + retrieved. + + The format is + "projects/{project_id}/tenants/{tenant_id}", for + example, "projects/foo/tenants/bar". + This corresponds to the ``name`` 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. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + ~.tenant.Tenant: + A Tenant resource represents a tenant + in the service. A tenant is a group or + entity that shares common access with + specific privileges for resources like + profiles. Customer may create multiple + tenants to provide data isolation for + different groups. + + """ + # Create or coerce a protobuf request object. + # Sanity check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + if request is not None and any([name]): + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + request = tenant_service.GetTenantRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + + if name is not None: + request.name = name + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.get_tenant, + default_retry=retries.Retry( + initial=0.1, + maximum=60.0, + multiplier=1.3, + predicate=retries.if_exception_type( + exceptions.ServiceUnavailable, exceptions.DeadlineExceeded, + ), + ), + default_timeout=30.0, + client_info=_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 update_tenant( + self, + request: tenant_service.UpdateTenantRequest = None, + *, + tenant: gct_tenant.Tenant = None, + retry: retries.Retry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> gct_tenant.Tenant: + r"""Updates specified tenant. + + Args: + request (:class:`~.tenant_service.UpdateTenantRequest`): + The request object. Request for updating a specified + tenant. + tenant (:class:`~.gct_tenant.Tenant`): + Required. The tenant resource to + replace the current resource in the + system. + This corresponds to the ``tenant`` 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. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + ~.gct_tenant.Tenant: + A Tenant resource represents a tenant + in the service. A tenant is a group or + entity that shares common access with + specific privileges for resources like + profiles. Customer may create multiple + tenants to provide data isolation for + different groups. + + """ + # Create or coerce a protobuf request object. + # Sanity check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + if request is not None and any([tenant]): + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + request = tenant_service.UpdateTenantRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + + if tenant is not None: + request.tenant = tenant + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.update_tenant, + default_timeout=30.0, + client_info=_client_info, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata( + (("tenant.name", request.tenant.name),) + ), + ) + + # Send the request. + response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + + # Done; return the response. + return response + + async def delete_tenant( + self, + request: tenant_service.DeleteTenantRequest = None, + *, + name: str = None, + retry: retries.Retry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> None: + r"""Deletes specified tenant. + + Args: + request (:class:`~.tenant_service.DeleteTenantRequest`): + The request object. Request to delete a tenant. + name (:class:`str`): + Required. The resource name of the tenant to be deleted. + + The format is + "projects/{project_id}/tenants/{tenant_id}", for + example, "projects/foo/tenants/bar". + This corresponds to the ``name`` 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. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + """ + # Create or coerce a protobuf request object. + # Sanity check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + if request is not None and any([name]): + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + request = tenant_service.DeleteTenantRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + + if name is not None: + request.name = name + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.delete_tenant, + default_retry=retries.Retry( + initial=0.1, + maximum=60.0, + multiplier=1.3, + predicate=retries.if_exception_type( + exceptions.ServiceUnavailable, exceptions.DeadlineExceeded, + ), + ), + default_timeout=30.0, + client_info=_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. + await rpc( + request, retry=retry, timeout=timeout, metadata=metadata, + ) + + async def list_tenants( + self, + request: tenant_service.ListTenantsRequest = None, + *, + parent: str = None, + retry: retries.Retry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> pagers.ListTenantsAsyncPager: + r"""Lists all tenants associated with the project. + + Args: + request (:class:`~.tenant_service.ListTenantsRequest`): + The request object. List tenants for which the client + has ACL visibility. + parent (:class:`str`): + Required. Resource name of the project under which the + tenant is created. + + The format is "projects/{project_id}", for example, + "projects/foo". + This corresponds to the ``parent`` 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. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + ~.pagers.ListTenantsAsyncPager: + The List tenants response object. + Iterating over this object will yield + results and resolve additional pages + automatically. + + """ + # Create or coerce a protobuf request object. + # Sanity check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + if request is not None and any([parent]): + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + request = tenant_service.ListTenantsRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + + if parent is not None: + request.parent = parent + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.list_tenants, + default_retry=retries.Retry( + initial=0.1, + maximum=60.0, + multiplier=1.3, + predicate=retries.if_exception_type( + exceptions.ServiceUnavailable, exceptions.DeadlineExceeded, + ), + ), + default_timeout=30.0, + client_info=_client_info, + ) + + # 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),)), + ) + + # Send the request. + response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + + # This method is paged; wrap the response in a pager, which provides + # an `__aiter__` convenience method. + response = pagers.ListTenantsAsyncPager( + method=rpc, request=request, response=response, metadata=metadata, + ) + + # Done; return the response. + return response + + +try: + _client_info = gapic_v1.client_info.ClientInfo( + gapic_version=pkg_resources.get_distribution("google-cloud-talent",).version, + ) +except pkg_resources.DistributionNotFound: + _client_info = gapic_v1.client_info.ClientInfo() + + +__all__ = ("TenantServiceAsyncClient",) diff --git a/google/cloud/talent_v4beta1/services/tenant_service/client.py b/google/cloud/talent_v4beta1/services/tenant_service/client.py new file mode 100644 index 00000000..c896e9a6 --- /dev/null +++ b/google/cloud/talent_v4beta1/services/tenant_service/client.py @@ -0,0 +1,649 @@ +# -*- 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. +# + +from collections import OrderedDict +import os +import re +from typing import Callable, Dict, Sequence, Tuple, Type, Union +import pkg_resources + +import google.api_core.client_options as ClientOptions # type: ignore +from google.api_core import exceptions # type: ignore +from google.api_core import gapic_v1 # type: ignore +from google.api_core import retry as retries # type: ignore +from google.auth import credentials # type: ignore +from google.auth.transport import mtls # type: ignore +from google.auth.exceptions import MutualTLSChannelError # type: ignore +from google.oauth2 import service_account # type: ignore + +from google.cloud.talent_v4beta1.services.tenant_service import pagers +from google.cloud.talent_v4beta1.types import tenant +from google.cloud.talent_v4beta1.types import tenant as gct_tenant +from google.cloud.talent_v4beta1.types import tenant_service + +from .transports.base import TenantServiceTransport +from .transports.grpc import TenantServiceGrpcTransport +from .transports.grpc_asyncio import TenantServiceGrpcAsyncIOTransport + + +class TenantServiceClientMeta(type): + """Metaclass for the TenantService client. + + This provides class-level methods for building and retrieving + support objects (e.g. transport) without polluting the client instance + objects. + """ + + _transport_registry = OrderedDict() # type: Dict[str, Type[TenantServiceTransport]] + _transport_registry["grpc"] = TenantServiceGrpcTransport + _transport_registry["grpc_asyncio"] = TenantServiceGrpcAsyncIOTransport + + def get_transport_class(cls, label: str = None,) -> Type[TenantServiceTransport]: + """Return an appropriate transport class. + + Args: + label: The name of the desired transport. If none is + provided, then the first transport in the registry is used. + + Returns: + The transport class to use. + """ + # If a specific transport is requested, return that one. + if label: + return cls._transport_registry[label] + + # No transport is requested; return the default (that is, the first one + # in the dictionary). + return next(iter(cls._transport_registry.values())) + + +class TenantServiceClient(metaclass=TenantServiceClientMeta): + """A service that handles tenant management, including CRUD and + enumeration. + """ + + @staticmethod + def _get_default_mtls_endpoint(api_endpoint): + """Convert api endpoint to mTLS endpoint. + Convert "*.sandbox.googleapis.com" and "*.googleapis.com" to + "*.mtls.sandbox.googleapis.com" and "*.mtls.googleapis.com" respectively. + Args: + api_endpoint (Optional[str]): the api endpoint to convert. + Returns: + str: converted mTLS api endpoint. + """ + if not api_endpoint: + return api_endpoint + + mtls_endpoint_re = re.compile( + r"(?P[^.]+)(?P\.mtls)?(?P\.sandbox)?(?P\.googleapis\.com)?" + ) + + m = mtls_endpoint_re.match(api_endpoint) + name, mtls, sandbox, googledomain = m.groups() + if mtls or not googledomain: + return api_endpoint + + if sandbox: + return api_endpoint.replace( + "sandbox.googleapis.com", "mtls.sandbox.googleapis.com" + ) + + return api_endpoint.replace(".googleapis.com", ".mtls.googleapis.com") + + DEFAULT_ENDPOINT = "jobs.googleapis.com" + DEFAULT_MTLS_ENDPOINT = _get_default_mtls_endpoint.__func__( # type: ignore + DEFAULT_ENDPOINT + ) + + @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: + {@api.name}: The constructed client. + """ + credentials = service_account.Credentials.from_service_account_file(filename) + kwargs["credentials"] = credentials + return cls(*args, **kwargs) + + from_service_account_json = from_service_account_file + + @staticmethod + def tenant_path(project: str, tenant: str,) -> str: + """Return a fully-qualified tenant string.""" + return "projects/{project}/tenants/{tenant}".format( + project=project, tenant=tenant, + ) + + @staticmethod + def parse_tenant_path(path: str) -> Dict[str, str]: + """Parse a tenant path into its component segments.""" + m = re.match(r"^projects/(?P.+?)/tenants/(?P.+?)$", path) + return m.groupdict() if m else {} + + def __init__( + self, + *, + credentials: credentials.Credentials = None, + transport: Union[str, TenantServiceTransport] = None, + client_options: ClientOptions = None, + ) -> None: + """Instantiate the tenant service client. + + Args: + credentials (Optional[google.auth.credentials.Credentials]): The + authorization credentials to attach to requests. These + credentials identify the application to the service; if none + are specified, the client will attempt to ascertain the + credentials from the environment. + transport (Union[str, ~.TenantServiceTransport]): The + transport to use. If set to None, a transport is chosen + automatically. + client_options (ClientOptions): Custom options for the client. It + won't take effect if a ``transport`` instance is provided. + (1) The ``api_endpoint`` property can be used to override the + default endpoint provided by the client. GOOGLE_API_USE_MTLS + environment variable can also be used to override the endpoint: + "always" (always use the default mTLS endpoint), "never" (always + use the default regular endpoint, this is the default value for + the environment variable) and "auto" (auto switch to the default + mTLS endpoint if client SSL credentials is present). However, + the ``api_endpoint`` property takes precedence if provided. + (2) The ``client_cert_source`` property is used to provide client + SSL credentials for mutual TLS transport. If not provided, the + default SSL credentials will be used if present. + + Raises: + google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport + creation failed for any reason. + """ + if isinstance(client_options, dict): + client_options = ClientOptions.from_dict(client_options) + if client_options is None: + client_options = ClientOptions.ClientOptions() + + if client_options.api_endpoint is None: + use_mtls_env = os.getenv("GOOGLE_API_USE_MTLS", "never") + if use_mtls_env == "never": + client_options.api_endpoint = self.DEFAULT_ENDPOINT + elif use_mtls_env == "always": + client_options.api_endpoint = self.DEFAULT_MTLS_ENDPOINT + elif use_mtls_env == "auto": + has_client_cert_source = ( + client_options.client_cert_source is not None + or mtls.has_default_client_cert_source() + ) + client_options.api_endpoint = ( + self.DEFAULT_MTLS_ENDPOINT + if has_client_cert_source + else self.DEFAULT_ENDPOINT + ) + else: + raise MutualTLSChannelError( + "Unsupported GOOGLE_API_USE_MTLS value. Accepted values: never, auto, always" + ) + + # Save or instantiate the transport. + # Ordinarily, we provide the transport, but allowing a custom transport + # instance provides an extensibility point for unusual situations. + if isinstance(transport, TenantServiceTransport): + # transport is a TenantServiceTransport instance. + if credentials or client_options.credentials_file: + raise ValueError( + "When providing a transport instance, " + "provide its credentials directly." + ) + if client_options.scopes: + raise ValueError( + "When providing a transport instance, " + "provide its scopes directly." + ) + self._transport = transport + else: + Transport = type(self).get_transport_class(transport) + self._transport = Transport( + credentials=credentials, + credentials_file=client_options.credentials_file, + host=client_options.api_endpoint, + scopes=client_options.scopes, + api_mtls_endpoint=client_options.api_endpoint, + client_cert_source=client_options.client_cert_source, + quota_project_id=client_options.quota_project_id, + ) + + def create_tenant( + self, + request: tenant_service.CreateTenantRequest = None, + *, + parent: str = None, + tenant: gct_tenant.Tenant = None, + retry: retries.Retry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> gct_tenant.Tenant: + r"""Creates a new tenant entity. + + Args: + request (:class:`~.tenant_service.CreateTenantRequest`): + The request object. The Request of the CreateTenant + method. + parent (:class:`str`): + Required. Resource name of the project under which the + tenant is created. + + The format is "projects/{project_id}", for example, + "projects/foo". + This corresponds to the ``parent`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + tenant (:class:`~.gct_tenant.Tenant`): + Required. The tenant to be created. + This corresponds to the ``tenant`` 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. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + ~.gct_tenant.Tenant: + A Tenant resource represents a tenant + in the service. A tenant is a group or + entity that shares common access with + specific privileges for resources like + profiles. Customer may create multiple + tenants to provide data isolation for + different groups. + + """ + # Create or coerce a protobuf request object. + # Sanity check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([parent, tenant]) + if request is not None and has_flattened_params: + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + # Minor optimization to avoid making a copy if the user passes + # in a tenant_service.CreateTenantRequest. + # There's no risk of modifying the input as we've already verified + # there are no flattened fields. + if not isinstance(request, tenant_service.CreateTenantRequest): + request = tenant_service.CreateTenantRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + + if parent is not None: + request.parent = parent + if tenant is not None: + request.tenant = tenant + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.create_tenant] + + # 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),)), + ) + + # Send the request. + response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + + # Done; return the response. + return response + + def get_tenant( + self, + request: tenant_service.GetTenantRequest = None, + *, + name: str = None, + retry: retries.Retry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> tenant.Tenant: + r"""Retrieves specified tenant. + + Args: + request (:class:`~.tenant_service.GetTenantRequest`): + The request object. Request for getting a tenant by + name. + name (:class:`str`): + Required. The resource name of the tenant to be + retrieved. + + The format is + "projects/{project_id}/tenants/{tenant_id}", for + example, "projects/foo/tenants/bar". + This corresponds to the ``name`` 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. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + ~.tenant.Tenant: + A Tenant resource represents a tenant + in the service. A tenant is a group or + entity that shares common access with + specific privileges for resources like + profiles. Customer may create multiple + tenants to provide data isolation for + different groups. + + """ + # Create or coerce a protobuf request object. + # Sanity check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([name]) + if request is not None and has_flattened_params: + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + # Minor optimization to avoid making a copy if the user passes + # in a tenant_service.GetTenantRequest. + # There's no risk of modifying the input as we've already verified + # there are no flattened fields. + if not isinstance(request, tenant_service.GetTenantRequest): + request = tenant_service.GetTenantRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + + if name is not None: + request.name = name + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.get_tenant] + + # 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 + + def update_tenant( + self, + request: tenant_service.UpdateTenantRequest = None, + *, + tenant: gct_tenant.Tenant = None, + retry: retries.Retry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> gct_tenant.Tenant: + r"""Updates specified tenant. + + Args: + request (:class:`~.tenant_service.UpdateTenantRequest`): + The request object. Request for updating a specified + tenant. + tenant (:class:`~.gct_tenant.Tenant`): + Required. The tenant resource to + replace the current resource in the + system. + This corresponds to the ``tenant`` 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. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + ~.gct_tenant.Tenant: + A Tenant resource represents a tenant + in the service. A tenant is a group or + entity that shares common access with + specific privileges for resources like + profiles. Customer may create multiple + tenants to provide data isolation for + different groups. + + """ + # Create or coerce a protobuf request object. + # Sanity check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([tenant]) + if request is not None and has_flattened_params: + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + # Minor optimization to avoid making a copy if the user passes + # in a tenant_service.UpdateTenantRequest. + # There's no risk of modifying the input as we've already verified + # there are no flattened fields. + if not isinstance(request, tenant_service.UpdateTenantRequest): + request = tenant_service.UpdateTenantRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + + if tenant is not None: + request.tenant = tenant + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.update_tenant] + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata( + (("tenant.name", request.tenant.name),) + ), + ) + + # Send the request. + response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + + # Done; return the response. + return response + + def delete_tenant( + self, + request: tenant_service.DeleteTenantRequest = None, + *, + name: str = None, + retry: retries.Retry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> None: + r"""Deletes specified tenant. + + Args: + request (:class:`~.tenant_service.DeleteTenantRequest`): + The request object. Request to delete a tenant. + name (:class:`str`): + Required. The resource name of the tenant to be deleted. + + The format is + "projects/{project_id}/tenants/{tenant_id}", for + example, "projects/foo/tenants/bar". + This corresponds to the ``name`` 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. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + """ + # Create or coerce a protobuf request object. + # Sanity check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([name]) + if request is not None and has_flattened_params: + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + # Minor optimization to avoid making a copy if the user passes + # in a tenant_service.DeleteTenantRequest. + # There's no risk of modifying the input as we've already verified + # there are no flattened fields. + if not isinstance(request, tenant_service.DeleteTenantRequest): + request = tenant_service.DeleteTenantRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + + if name is not None: + request.name = name + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.delete_tenant] + + # 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. + rpc( + request, retry=retry, timeout=timeout, metadata=metadata, + ) + + def list_tenants( + self, + request: tenant_service.ListTenantsRequest = None, + *, + parent: str = None, + retry: retries.Retry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> pagers.ListTenantsPager: + r"""Lists all tenants associated with the project. + + Args: + request (:class:`~.tenant_service.ListTenantsRequest`): + The request object. List tenants for which the client + has ACL visibility. + parent (:class:`str`): + Required. Resource name of the project under which the + tenant is created. + + The format is "projects/{project_id}", for example, + "projects/foo". + This corresponds to the ``parent`` 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. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + ~.pagers.ListTenantsPager: + The List tenants response object. + Iterating over this object will yield + results and resolve additional pages + automatically. + + """ + # Create or coerce a protobuf request object. + # Sanity check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([parent]) + if request is not None and has_flattened_params: + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + # Minor optimization to avoid making a copy if the user passes + # in a tenant_service.ListTenantsRequest. + # There's no risk of modifying the input as we've already verified + # there are no flattened fields. + if not isinstance(request, tenant_service.ListTenantsRequest): + request = tenant_service.ListTenantsRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + + if parent is not None: + request.parent = parent + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.list_tenants] + + # 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),)), + ) + + # Send the request. + response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + + # This method is paged; wrap the response in a pager, which provides + # an `__iter__` convenience method. + response = pagers.ListTenantsPager( + method=rpc, request=request, response=response, metadata=metadata, + ) + + # Done; return the response. + return response + + +try: + _client_info = gapic_v1.client_info.ClientInfo( + gapic_version=pkg_resources.get_distribution("google-cloud-talent",).version, + ) +except pkg_resources.DistributionNotFound: + _client_info = gapic_v1.client_info.ClientInfo() + + +__all__ = ("TenantServiceClient",) diff --git a/google/cloud/talent_v4beta1/services/tenant_service/pagers.py b/google/cloud/talent_v4beta1/services/tenant_service/pagers.py new file mode 100644 index 00000000..99dfee65 --- /dev/null +++ b/google/cloud/talent_v4beta1/services/tenant_service/pagers.py @@ -0,0 +1,149 @@ +# -*- 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. +# + +from typing import Any, AsyncIterable, Awaitable, Callable, Iterable, Sequence, Tuple + +from google.cloud.talent_v4beta1.types import tenant +from google.cloud.talent_v4beta1.types import tenant_service + + +class ListTenantsPager: + """A pager for iterating through ``list_tenants`` requests. + + This class thinly wraps an initial + :class:`~.tenant_service.ListTenantsResponse` object, and + provides an ``__iter__`` method to iterate through its + ``tenants`` field. + + If there are more pages, the ``__iter__`` method will make additional + ``ListTenants`` requests and continue to iterate + through the ``tenants`` field on the + corresponding responses. + + All the usual :class:`~.tenant_service.ListTenantsResponse` + attributes are available on the pager. If multiple requests are made, only + the most recent response is retained, and thus used for attribute lookup. + """ + + def __init__( + self, + method: Callable[..., tenant_service.ListTenantsResponse], + request: tenant_service.ListTenantsRequest, + response: tenant_service.ListTenantsResponse, + *, + metadata: Sequence[Tuple[str, str]] = () + ): + """Instantiate the pager. + + Args: + method (Callable): The method that was originally called, and + which instantiated this pager. + request (:class:`~.tenant_service.ListTenantsRequest`): + The initial request object. + response (:class:`~.tenant_service.ListTenantsResponse`): + The initial response object. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + """ + self._method = method + self._request = tenant_service.ListTenantsRequest(request) + self._response = response + self._metadata = metadata + + def __getattr__(self, name: str) -> Any: + return getattr(self._response, name) + + @property + def pages(self) -> Iterable[tenant_service.ListTenantsResponse]: + 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) + yield self._response + + def __iter__(self) -> Iterable[tenant.Tenant]: + for page in self.pages: + yield from page.tenants + + def __repr__(self) -> str: + return "{0}<{1!r}>".format(self.__class__.__name__, self._response) + + +class ListTenantsAsyncPager: + """A pager for iterating through ``list_tenants`` requests. + + This class thinly wraps an initial + :class:`~.tenant_service.ListTenantsResponse` object, and + provides an ``__aiter__`` method to iterate through its + ``tenants`` field. + + If there are more pages, the ``__aiter__`` method will make additional + ``ListTenants`` requests and continue to iterate + through the ``tenants`` field on the + corresponding responses. + + All the usual :class:`~.tenant_service.ListTenantsResponse` + attributes are available on the pager. If multiple requests are made, only + the most recent response is retained, and thus used for attribute lookup. + """ + + def __init__( + self, + method: Callable[..., Awaitable[tenant_service.ListTenantsResponse]], + request: tenant_service.ListTenantsRequest, + response: tenant_service.ListTenantsResponse, + *, + metadata: Sequence[Tuple[str, str]] = () + ): + """Instantiate the pager. + + Args: + method (Callable): The method that was originally called, and + which instantiated this pager. + request (:class:`~.tenant_service.ListTenantsRequest`): + The initial request object. + response (:class:`~.tenant_service.ListTenantsResponse`): + The initial response object. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + """ + self._method = method + self._request = tenant_service.ListTenantsRequest(request) + self._response = response + self._metadata = metadata + + def __getattr__(self, name: str) -> Any: + return getattr(self._response, name) + + @property + async def pages(self) -> AsyncIterable[tenant_service.ListTenantsResponse]: + 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) + yield self._response + + def __aiter__(self) -> AsyncIterable[tenant.Tenant]: + async def async_generator(): + async for page in self.pages: + for response in page.tenants: + yield response + + return async_generator() + + def __repr__(self) -> str: + return "{0}<{1!r}>".format(self.__class__.__name__, self._response) diff --git a/google/cloud/talent_v4beta1/services/tenant_service/transports/__init__.py b/google/cloud/talent_v4beta1/services/tenant_service/transports/__init__.py new file mode 100644 index 00000000..49abfaa7 --- /dev/null +++ b/google/cloud/talent_v4beta1/services/tenant_service/transports/__init__.py @@ -0,0 +1,36 @@ +# -*- 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. +# + +from collections import OrderedDict +from typing import Dict, Type + +from .base import TenantServiceTransport +from .grpc import TenantServiceGrpcTransport +from .grpc_asyncio import TenantServiceGrpcAsyncIOTransport + + +# Compile a registry of transports. +_transport_registry = OrderedDict() # type: Dict[str, Type[TenantServiceTransport]] +_transport_registry["grpc"] = TenantServiceGrpcTransport +_transport_registry["grpc_asyncio"] = TenantServiceGrpcAsyncIOTransport + + +__all__ = ( + "TenantServiceTransport", + "TenantServiceGrpcTransport", + "TenantServiceGrpcAsyncIOTransport", +) diff --git a/google/cloud/talent_v4beta1/services/tenant_service/transports/base.py b/google/cloud/talent_v4beta1/services/tenant_service/transports/base.py new file mode 100644 index 00000000..1146ef46 --- /dev/null +++ b/google/cloud/talent_v4beta1/services/tenant_service/transports/base.py @@ -0,0 +1,203 @@ +# -*- 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. +# + +import abc +import typing +import pkg_resources + +from google import auth +from google.api_core import exceptions # type: ignore +from google.api_core import gapic_v1 # type: ignore +from google.api_core import retry as retries # type: ignore +from google.auth import credentials # type: ignore + +from google.cloud.talent_v4beta1.types import tenant +from google.cloud.talent_v4beta1.types import tenant as gct_tenant +from google.cloud.talent_v4beta1.types import tenant_service +from google.protobuf import empty_pb2 as empty # type: ignore + + +try: + _client_info = gapic_v1.client_info.ClientInfo( + gapic_version=pkg_resources.get_distribution("google-cloud-talent",).version, + ) +except pkg_resources.DistributionNotFound: + _client_info = gapic_v1.client_info.ClientInfo() + + +class TenantServiceTransport(abc.ABC): + """Abstract transport class for TenantService.""" + + AUTH_SCOPES = ( + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/jobs", + ) + + def __init__( + self, + *, + host: str = "jobs.googleapis.com", + credentials: credentials.Credentials = None, + credentials_file: typing.Optional[str] = None, + scopes: typing.Optional[typing.Sequence[str]] = AUTH_SCOPES, + quota_project_id: typing.Optional[str] = None, + **kwargs, + ) -> None: + """Instantiate the transport. + + Args: + host (Optional[str]): The hostname to connect to. + credentials (Optional[google.auth.credentials.Credentials]): The + authorization credentials to attach to requests. These + credentials identify the application to the service; if none + are specified, the client will attempt to ascertain the + credentials from the environment. + credentials_file (Optional[str]): A file with credentials that can + be loaded with :func:`google.auth.load_credentials_from_file`. + This argument is mutually exclusive with credentials. + scope (Optional[Sequence[str]]): A list of scopes. + quota_project_id (Optional[str]): An optional project to use for billing + and quota. + """ + # Save the hostname. Default to port 443 (HTTPS) if none is specified. + if ":" not in host: + host += ":443" + self._host = host + + # If no credentials are provided, then determine the appropriate + # defaults. + if credentials and credentials_file: + raise exceptions.DuplicateCredentialArgs( + "'credentials_file' and 'credentials' are mutually exclusive" + ) + + if credentials_file is not None: + credentials, _ = auth.load_credentials_from_file( + credentials_file, scopes=scopes, quota_project_id=quota_project_id + ) + + elif credentials is None: + credentials, _ = auth.default( + scopes=scopes, quota_project_id=quota_project_id + ) + + # Save the credentials. + self._credentials = credentials + + # Lifted into its own function so it can be stubbed out during tests. + self._prep_wrapped_messages() + + def _prep_wrapped_messages(self): + # Precompute the wrapped methods. + self._wrapped_methods = { + self.create_tenant: gapic_v1.method.wrap_method( + self.create_tenant, default_timeout=30.0, client_info=_client_info, + ), + self.get_tenant: gapic_v1.method.wrap_method( + self.get_tenant, + default_retry=retries.Retry( + initial=0.1, + maximum=60.0, + multiplier=1.3, + predicate=retries.if_exception_type( + exceptions.ServiceUnavailable, exceptions.DeadlineExceeded, + ), + ), + default_timeout=30.0, + client_info=_client_info, + ), + self.update_tenant: gapic_v1.method.wrap_method( + self.update_tenant, default_timeout=30.0, client_info=_client_info, + ), + self.delete_tenant: gapic_v1.method.wrap_method( + self.delete_tenant, + default_retry=retries.Retry( + initial=0.1, + maximum=60.0, + multiplier=1.3, + predicate=retries.if_exception_type( + exceptions.ServiceUnavailable, exceptions.DeadlineExceeded, + ), + ), + default_timeout=30.0, + client_info=_client_info, + ), + self.list_tenants: gapic_v1.method.wrap_method( + self.list_tenants, + default_retry=retries.Retry( + initial=0.1, + maximum=60.0, + multiplier=1.3, + predicate=retries.if_exception_type( + exceptions.ServiceUnavailable, exceptions.DeadlineExceeded, + ), + ), + default_timeout=30.0, + client_info=_client_info, + ), + } + + @property + def create_tenant( + self, + ) -> typing.Callable[ + [tenant_service.CreateTenantRequest], + typing.Union[gct_tenant.Tenant, typing.Awaitable[gct_tenant.Tenant]], + ]: + raise NotImplementedError() + + @property + def get_tenant( + self, + ) -> typing.Callable[ + [tenant_service.GetTenantRequest], + typing.Union[tenant.Tenant, typing.Awaitable[tenant.Tenant]], + ]: + raise NotImplementedError() + + @property + def update_tenant( + self, + ) -> typing.Callable[ + [tenant_service.UpdateTenantRequest], + typing.Union[gct_tenant.Tenant, typing.Awaitable[gct_tenant.Tenant]], + ]: + raise NotImplementedError() + + @property + def delete_tenant( + self, + ) -> typing.Callable[ + [tenant_service.DeleteTenantRequest], + typing.Union[empty.Empty, typing.Awaitable[empty.Empty]], + ]: + raise NotImplementedError() + + @property + def list_tenants( + self, + ) -> typing.Callable[ + [tenant_service.ListTenantsRequest], + typing.Union[ + tenant_service.ListTenantsResponse, + typing.Awaitable[tenant_service.ListTenantsResponse], + ], + ]: + raise NotImplementedError() + + +__all__ = ("TenantServiceTransport",) diff --git a/google/cloud/talent_v4beta1/services/tenant_service/transports/grpc.py b/google/cloud/talent_v4beta1/services/tenant_service/transports/grpc.py new file mode 100644 index 00000000..267845be --- /dev/null +++ b/google/cloud/talent_v4beta1/services/tenant_service/transports/grpc.py @@ -0,0 +1,341 @@ +# -*- 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. +# + +from typing import Callable, Dict, Optional, Sequence, Tuple + +from google.api_core import grpc_helpers # type: ignore +from google import auth # type: ignore +from google.auth import credentials # type: ignore +from google.auth.transport.grpc import SslCredentials # type: ignore + + +import grpc # type: ignore + +from google.cloud.talent_v4beta1.types import tenant +from google.cloud.talent_v4beta1.types import tenant as gct_tenant +from google.cloud.talent_v4beta1.types import tenant_service +from google.protobuf import empty_pb2 as empty # type: ignore + +from .base import TenantServiceTransport + + +class TenantServiceGrpcTransport(TenantServiceTransport): + """gRPC backend transport for TenantService. + + A service that handles tenant management, including CRUD and + enumeration. + + This class defines the same methods as the primary client, so the + primary client can load the underlying transport implementation + and call it. + + It sends protocol buffers over the wire using gRPC (which is built on + top of HTTP/2); the ``grpcio`` package must be installed. + """ + + _stubs: Dict[str, Callable] + + def __init__( + self, + *, + host: str = "jobs.googleapis.com", + credentials: credentials.Credentials = None, + credentials_file: str = None, + scopes: Sequence[str] = None, + channel: grpc.Channel = None, + api_mtls_endpoint: str = None, + client_cert_source: Callable[[], Tuple[bytes, bytes]] = None, + quota_project_id: Optional[str] = None + ) -> None: + """Instantiate the transport. + + Args: + host (Optional[str]): The hostname to connect to. + credentials (Optional[google.auth.credentials.Credentials]): The + authorization credentials to attach to requests. These + credentials identify the application to the service; if none + are specified, the client will attempt to ascertain the + credentials from the environment. + This argument is ignored if ``channel`` is provided. + credentials_file (Optional[str]): A file with credentials that can + be loaded with :func:`google.auth.load_credentials_from_file`. + This argument is ignored if ``channel`` is provided. + scopes (Optional(Sequence[str])): A list of scopes. This argument is + ignored if ``channel`` is provided. + channel (Optional[grpc.Channel]): A ``Channel`` instance through + which to make calls. + api_mtls_endpoint (Optional[str]): The mutual TLS endpoint. If + provided, it overrides the ``host`` argument and tries to create + a mutual TLS channel with client SSL credentials from + ``client_cert_source`` or applicatin default SSL credentials. + client_cert_source (Optional[Callable[[], Tuple[bytes, bytes]]]): A + callback to provide client SSL certificate bytes and private key + bytes, both in PEM format. It is ignored if ``api_mtls_endpoint`` + is None. + quota_project_id (Optional[str]): An optional project to use for billing + and quota. + + Raises: + google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport + creation failed for any reason. + google.api_core.exceptions.DuplicateCredentialArgs: If both ``credentials`` + and ``credentials_file`` are passed. + """ + if channel: + # Sanity check: Ensure that channel and credentials are not both + # provided. + credentials = False + + # If a channel was explicitly provided, set it. + self._grpc_channel = channel + elif api_mtls_endpoint: + host = ( + api_mtls_endpoint + if ":" in api_mtls_endpoint + else api_mtls_endpoint + ":443" + ) + + if credentials is None: + credentials, _ = auth.default( + scopes=self.AUTH_SCOPES, quota_project_id=quota_project_id + ) + + # Create SSL credentials with client_cert_source or application + # default SSL credentials. + if client_cert_source: + cert, key = client_cert_source() + ssl_credentials = grpc.ssl_channel_credentials( + certificate_chain=cert, private_key=key + ) + else: + ssl_credentials = SslCredentials().ssl_credentials + + # create a new channel. The provided one is ignored. + self._grpc_channel = type(self).create_channel( + host, + credentials=credentials, + credentials_file=credentials_file, + ssl_credentials=ssl_credentials, + scopes=scopes or self.AUTH_SCOPES, + quota_project_id=quota_project_id, + ) + + self._stubs = {} # type: Dict[str, Callable] + + # Run the base constructor. + super().__init__( + host=host, + credentials=credentials, + credentials_file=credentials_file, + scopes=scopes or self.AUTH_SCOPES, + quota_project_id=quota_project_id, + ) + + @classmethod + def create_channel( + cls, + host: str = "jobs.googleapis.com", + credentials: credentials.Credentials = None, + credentials_file: str = None, + scopes: Optional[Sequence[str]] = None, + quota_project_id: Optional[str] = None, + **kwargs + ) -> grpc.Channel: + """Create and return a gRPC channel object. + Args: + address (Optionsl[str]): The host for the channel to use. + credentials (Optional[~.Credentials]): The + authorization credentials to attach to requests. These + credentials identify this application to the service. If + none are specified, the client will attempt to ascertain + the credentials from the environment. + credentials_file (Optional[str]): A file with credentials that can + be loaded with :func:`google.auth.load_credentials_from_file`. + This argument is mutually exclusive with credentials. + scopes (Optional[Sequence[str]]): A optional list of scopes needed for this + service. These are only used when credentials are not specified and + are passed to :func:`google.auth.default`. + quota_project_id (Optional[str]): An optional project to use for billing + and quota. + kwargs (Optional[dict]): Keyword arguments, which are passed to the + channel creation. + Returns: + grpc.Channel: A gRPC channel object. + + Raises: + google.api_core.exceptions.DuplicateCredentialArgs: If both ``credentials`` + and ``credentials_file`` are passed. + """ + scopes = scopes or cls.AUTH_SCOPES + return grpc_helpers.create_channel( + host, + credentials=credentials, + credentials_file=credentials_file, + scopes=scopes, + quota_project_id=quota_project_id, + **kwargs + ) + + @property + def grpc_channel(self) -> grpc.Channel: + """Create the channel designed to connect to this service. + + This property caches on the instance; repeated calls return + the same channel. + """ + # Sanity check: Only create a new channel if we do not already + # have one. + if not hasattr(self, "_grpc_channel"): + self._grpc_channel = self.create_channel( + self._host, credentials=self._credentials, + ) + + # Return the channel from cache. + return self._grpc_channel + + @property + def create_tenant( + self, + ) -> Callable[[tenant_service.CreateTenantRequest], gct_tenant.Tenant]: + r"""Return a callable for the create tenant method over gRPC. + + Creates a new tenant entity. + + Returns: + Callable[[~.CreateTenantRequest], + ~.Tenant]: + A function that, when called, will call the underlying RPC + on the server. + """ + # 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 "create_tenant" not in self._stubs: + self._stubs["create_tenant"] = self.grpc_channel.unary_unary( + "/google.cloud.talent.v4beta1.TenantService/CreateTenant", + request_serializer=tenant_service.CreateTenantRequest.serialize, + response_deserializer=gct_tenant.Tenant.deserialize, + ) + return self._stubs["create_tenant"] + + @property + def get_tenant(self) -> Callable[[tenant_service.GetTenantRequest], tenant.Tenant]: + r"""Return a callable for the get tenant method over gRPC. + + Retrieves specified tenant. + + Returns: + Callable[[~.GetTenantRequest], + ~.Tenant]: + A function that, when called, will call the underlying RPC + on the server. + """ + # 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_tenant" not in self._stubs: + self._stubs["get_tenant"] = self.grpc_channel.unary_unary( + "/google.cloud.talent.v4beta1.TenantService/GetTenant", + request_serializer=tenant_service.GetTenantRequest.serialize, + response_deserializer=tenant.Tenant.deserialize, + ) + return self._stubs["get_tenant"] + + @property + def update_tenant( + self, + ) -> Callable[[tenant_service.UpdateTenantRequest], gct_tenant.Tenant]: + r"""Return a callable for the update tenant method over gRPC. + + Updates specified tenant. + + Returns: + Callable[[~.UpdateTenantRequest], + ~.Tenant]: + A function that, when called, will call the underlying RPC + on the server. + """ + # 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 "update_tenant" not in self._stubs: + self._stubs["update_tenant"] = self.grpc_channel.unary_unary( + "/google.cloud.talent.v4beta1.TenantService/UpdateTenant", + request_serializer=tenant_service.UpdateTenantRequest.serialize, + response_deserializer=gct_tenant.Tenant.deserialize, + ) + return self._stubs["update_tenant"] + + @property + def delete_tenant( + self, + ) -> Callable[[tenant_service.DeleteTenantRequest], empty.Empty]: + r"""Return a callable for the delete tenant method over gRPC. + + Deletes specified tenant. + + Returns: + Callable[[~.DeleteTenantRequest], + ~.Empty]: + A function that, when called, will call the underlying RPC + on the server. + """ + # 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 "delete_tenant" not in self._stubs: + self._stubs["delete_tenant"] = self.grpc_channel.unary_unary( + "/google.cloud.talent.v4beta1.TenantService/DeleteTenant", + request_serializer=tenant_service.DeleteTenantRequest.serialize, + response_deserializer=empty.Empty.FromString, + ) + return self._stubs["delete_tenant"] + + @property + def list_tenants( + self, + ) -> Callable[ + [tenant_service.ListTenantsRequest], tenant_service.ListTenantsResponse + ]: + r"""Return a callable for the list tenants method over gRPC. + + Lists all tenants associated with the project. + + Returns: + Callable[[~.ListTenantsRequest], + ~.ListTenantsResponse]: + A function that, when called, will call the underlying RPC + on the server. + """ + # 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 "list_tenants" not in self._stubs: + self._stubs["list_tenants"] = self.grpc_channel.unary_unary( + "/google.cloud.talent.v4beta1.TenantService/ListTenants", + request_serializer=tenant_service.ListTenantsRequest.serialize, + response_deserializer=tenant_service.ListTenantsResponse.deserialize, + ) + return self._stubs["list_tenants"] + + +__all__ = ("TenantServiceGrpcTransport",) diff --git a/google/cloud/talent_v4beta1/services/tenant_service/transports/grpc_asyncio.py b/google/cloud/talent_v4beta1/services/tenant_service/transports/grpc_asyncio.py new file mode 100644 index 00000000..95e6ddbc --- /dev/null +++ b/google/cloud/talent_v4beta1/services/tenant_service/transports/grpc_asyncio.py @@ -0,0 +1,337 @@ +# -*- 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. +# + +from typing import Awaitable, Callable, Dict, Optional, Sequence, Tuple + +from google.api_core import grpc_helpers_async # type: ignore +from google.auth import credentials # type: ignore +from google.auth.transport.grpc import SslCredentials # type: ignore + +import grpc # type: ignore +from grpc.experimental import aio # type: ignore + +from google.cloud.talent_v4beta1.types import tenant +from google.cloud.talent_v4beta1.types import tenant as gct_tenant +from google.cloud.talent_v4beta1.types import tenant_service +from google.protobuf import empty_pb2 as empty # type: ignore + +from .base import TenantServiceTransport +from .grpc import TenantServiceGrpcTransport + + +class TenantServiceGrpcAsyncIOTransport(TenantServiceTransport): + """gRPC AsyncIO backend transport for TenantService. + + A service that handles tenant management, including CRUD and + enumeration. + + This class defines the same methods as the primary client, so the + primary client can load the underlying transport implementation + and call it. + + It sends protocol buffers over the wire using gRPC (which is built on + top of HTTP/2); the ``grpcio`` package must be installed. + """ + + _grpc_channel: aio.Channel + _stubs: Dict[str, Callable] = {} + + @classmethod + def create_channel( + cls, + host: str = "jobs.googleapis.com", + credentials: credentials.Credentials = None, + credentials_file: Optional[str] = None, + scopes: Optional[Sequence[str]] = None, + quota_project_id: Optional[str] = None, + **kwargs, + ) -> aio.Channel: + """Create and return a gRPC AsyncIO channel object. + Args: + address (Optional[str]): The host for the channel to use. + credentials (Optional[~.Credentials]): The + authorization credentials to attach to requests. These + credentials identify this application to the service. If + none are specified, the client will attempt to ascertain + the credentials from the environment. + credentials_file (Optional[str]): A file with credentials that can + be loaded with :func:`google.auth.load_credentials_from_file`. + This argument is ignored if ``channel`` is provided. + scopes (Optional[Sequence[str]]): A optional list of scopes needed for this + service. These are only used when credentials are not specified and + are passed to :func:`google.auth.default`. + quota_project_id (Optional[str]): An optional project to use for billing + and quota. + kwargs (Optional[dict]): Keyword arguments, which are passed to the + channel creation. + Returns: + aio.Channel: A gRPC AsyncIO channel object. + """ + scopes = scopes or cls.AUTH_SCOPES + return grpc_helpers_async.create_channel( + host, + credentials=credentials, + credentials_file=credentials_file, + scopes=scopes, + quota_project_id=quota_project_id, + **kwargs, + ) + + def __init__( + self, + *, + host: str = "jobs.googleapis.com", + credentials: credentials.Credentials = None, + credentials_file: Optional[str] = None, + scopes: Optional[Sequence[str]] = None, + channel: aio.Channel = None, + api_mtls_endpoint: str = None, + client_cert_source: Callable[[], Tuple[bytes, bytes]] = None, + quota_project_id=None, + ) -> None: + """Instantiate the transport. + + Args: + host (Optional[str]): The hostname to connect to. + credentials (Optional[google.auth.credentials.Credentials]): The + authorization credentials to attach to requests. These + credentials identify the application to the service; if none + are specified, the client will attempt to ascertain the + credentials from the environment. + This argument is ignored if ``channel`` is provided. + credentials_file (Optional[str]): A file with credentials that can + be loaded with :func:`google.auth.load_credentials_from_file`. + This argument is ignored if ``channel`` is provided. + scopes (Optional[Sequence[str]]): A optional list of scopes needed for this + service. These are only used when credentials are not specified and + are passed to :func:`google.auth.default`. + channel (Optional[aio.Channel]): A ``Channel`` instance through + which to make calls. + api_mtls_endpoint (Optional[str]): The mutual TLS endpoint. If + provided, it overrides the ``host`` argument and tries to create + a mutual TLS channel with client SSL credentials from + ``client_cert_source`` or applicatin default SSL credentials. + client_cert_source (Optional[Callable[[], Tuple[bytes, bytes]]]): A + callback to provide client SSL certificate bytes and private key + bytes, both in PEM format. It is ignored if ``api_mtls_endpoint`` + is None. + quota_project_id (Optional[str]): An optional project to use for billing + and quota. + + Raises: + google.auth.exceptions.MutualTlsChannelError: If mutual TLS transport + creation failed for any reason. + google.api_core.exceptions.DuplicateCredentialArgs: If both ``credentials`` + and ``credentials_file`` are passed. + """ + if channel: + # Sanity check: Ensure that channel and credentials are not both + # provided. + credentials = False + + # If a channel was explicitly provided, set it. + self._grpc_channel = channel + elif api_mtls_endpoint: + host = ( + api_mtls_endpoint + if ":" in api_mtls_endpoint + else api_mtls_endpoint + ":443" + ) + + # Create SSL credentials with client_cert_source or application + # default SSL credentials. + if client_cert_source: + cert, key = client_cert_source() + ssl_credentials = grpc.ssl_channel_credentials( + certificate_chain=cert, private_key=key + ) + else: + ssl_credentials = SslCredentials().ssl_credentials + + # create a new channel. The provided one is ignored. + self._grpc_channel = type(self).create_channel( + host, + credentials=credentials, + credentials_file=credentials_file, + ssl_credentials=ssl_credentials, + scopes=scopes or self.AUTH_SCOPES, + quota_project_id=quota_project_id, + ) + + # Run the base constructor. + super().__init__( + host=host, + credentials=credentials, + credentials_file=credentials_file, + scopes=scopes or self.AUTH_SCOPES, + quota_project_id=quota_project_id, + ) + + self._stubs = {} + + @property + def grpc_channel(self) -> aio.Channel: + """Create the channel designed to connect to this service. + + This property caches on the instance; repeated calls return + the same channel. + """ + # Sanity check: Only create a new channel if we do not already + # have one. + if not hasattr(self, "_grpc_channel"): + self._grpc_channel = self.create_channel( + self._host, credentials=self._credentials, + ) + + # Return the channel from cache. + return self._grpc_channel + + @property + def create_tenant( + self, + ) -> Callable[[tenant_service.CreateTenantRequest], Awaitable[gct_tenant.Tenant]]: + r"""Return a callable for the create tenant method over gRPC. + + Creates a new tenant entity. + + Returns: + Callable[[~.CreateTenantRequest], + Awaitable[~.Tenant]]: + A function that, when called, will call the underlying RPC + on the server. + """ + # 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 "create_tenant" not in self._stubs: + self._stubs["create_tenant"] = self.grpc_channel.unary_unary( + "/google.cloud.talent.v4beta1.TenantService/CreateTenant", + request_serializer=tenant_service.CreateTenantRequest.serialize, + response_deserializer=gct_tenant.Tenant.deserialize, + ) + return self._stubs["create_tenant"] + + @property + def get_tenant( + self, + ) -> Callable[[tenant_service.GetTenantRequest], Awaitable[tenant.Tenant]]: + r"""Return a callable for the get tenant method over gRPC. + + Retrieves specified tenant. + + Returns: + Callable[[~.GetTenantRequest], + Awaitable[~.Tenant]]: + A function that, when called, will call the underlying RPC + on the server. + """ + # 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_tenant" not in self._stubs: + self._stubs["get_tenant"] = self.grpc_channel.unary_unary( + "/google.cloud.talent.v4beta1.TenantService/GetTenant", + request_serializer=tenant_service.GetTenantRequest.serialize, + response_deserializer=tenant.Tenant.deserialize, + ) + return self._stubs["get_tenant"] + + @property + def update_tenant( + self, + ) -> Callable[[tenant_service.UpdateTenantRequest], Awaitable[gct_tenant.Tenant]]: + r"""Return a callable for the update tenant method over gRPC. + + Updates specified tenant. + + Returns: + Callable[[~.UpdateTenantRequest], + Awaitable[~.Tenant]]: + A function that, when called, will call the underlying RPC + on the server. + """ + # 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 "update_tenant" not in self._stubs: + self._stubs["update_tenant"] = self.grpc_channel.unary_unary( + "/google.cloud.talent.v4beta1.TenantService/UpdateTenant", + request_serializer=tenant_service.UpdateTenantRequest.serialize, + response_deserializer=gct_tenant.Tenant.deserialize, + ) + return self._stubs["update_tenant"] + + @property + def delete_tenant( + self, + ) -> Callable[[tenant_service.DeleteTenantRequest], Awaitable[empty.Empty]]: + r"""Return a callable for the delete tenant method over gRPC. + + Deletes specified tenant. + + Returns: + Callable[[~.DeleteTenantRequest], + Awaitable[~.Empty]]: + A function that, when called, will call the underlying RPC + on the server. + """ + # 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 "delete_tenant" not in self._stubs: + self._stubs["delete_tenant"] = self.grpc_channel.unary_unary( + "/google.cloud.talent.v4beta1.TenantService/DeleteTenant", + request_serializer=tenant_service.DeleteTenantRequest.serialize, + response_deserializer=empty.Empty.FromString, + ) + return self._stubs["delete_tenant"] + + @property + def list_tenants( + self, + ) -> Callable[ + [tenant_service.ListTenantsRequest], + Awaitable[tenant_service.ListTenantsResponse], + ]: + r"""Return a callable for the list tenants method over gRPC. + + Lists all tenants associated with the project. + + Returns: + Callable[[~.ListTenantsRequest], + Awaitable[~.ListTenantsResponse]]: + A function that, when called, will call the underlying RPC + on the server. + """ + # 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 "list_tenants" not in self._stubs: + self._stubs["list_tenants"] = self.grpc_channel.unary_unary( + "/google.cloud.talent.v4beta1.TenantService/ListTenants", + request_serializer=tenant_service.ListTenantsRequest.serialize, + response_deserializer=tenant_service.ListTenantsResponse.deserialize, + ) + return self._stubs["list_tenants"] + + +__all__ = ("TenantServiceGrpcAsyncIOTransport",) diff --git a/google/cloud/talent_v4beta1/types.py b/google/cloud/talent_v4beta1/types.py deleted file mode 100644 index 359bce8a..00000000 --- a/google/cloud/talent_v4beta1/types.py +++ /dev/null @@ -1,102 +0,0 @@ -# -*- 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 -# -# https://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. - - -from __future__ import absolute_import -import sys - -from google.api_core.protobuf_helpers import get_messages - -from google.cloud.talent_v4beta1.proto import application_pb2 -from google.cloud.talent_v4beta1.proto import application_service_pb2 -from google.cloud.talent_v4beta1.proto import common_pb2 -from google.cloud.talent_v4beta1.proto import company_pb2 -from google.cloud.talent_v4beta1.proto import company_service_pb2 -from google.cloud.talent_v4beta1.proto import completion_service_pb2 -from google.cloud.talent_v4beta1.proto import event_pb2 -from google.cloud.talent_v4beta1.proto import event_service_pb2 -from google.cloud.talent_v4beta1.proto import filters_pb2 -from google.cloud.talent_v4beta1.proto import histogram_pb2 -from google.cloud.talent_v4beta1.proto import job_pb2 -from google.cloud.talent_v4beta1.proto import job_service_pb2 -from google.cloud.talent_v4beta1.proto import profile_pb2 -from google.cloud.talent_v4beta1.proto import profile_service_pb2 -from google.cloud.talent_v4beta1.proto import tenant_pb2 -from google.cloud.talent_v4beta1.proto import tenant_service_pb2 -from google.longrunning import operations_pb2 -from google.protobuf import any_pb2 -from google.protobuf import duration_pb2 -from google.protobuf import empty_pb2 -from google.protobuf import field_mask_pb2 -from google.protobuf import timestamp_pb2 -from google.protobuf import wrappers_pb2 -from google.rpc import status_pb2 -from google.type import date_pb2 -from google.type import latlng_pb2 -from google.type import money_pb2 -from google.type import postal_address_pb2 -from google.type import timeofday_pb2 - - -_shared_modules = [ - operations_pb2, - any_pb2, - duration_pb2, - empty_pb2, - field_mask_pb2, - timestamp_pb2, - wrappers_pb2, - status_pb2, - date_pb2, - latlng_pb2, - money_pb2, - postal_address_pb2, - timeofday_pb2, -] - -_local_modules = [ - application_pb2, - application_service_pb2, - common_pb2, - company_pb2, - company_service_pb2, - completion_service_pb2, - event_pb2, - event_service_pb2, - filters_pb2, - histogram_pb2, - job_pb2, - job_service_pb2, - profile_pb2, - profile_service_pb2, - tenant_pb2, - tenant_service_pb2, -] - -names = [] - -for module in _shared_modules: # pragma: NO COVER - for name, message in get_messages(module).items(): - setattr(sys.modules[__name__], name, message) - names.append(name) -for module in _local_modules: - for name, message in get_messages(module).items(): - message.__module__ = "google.cloud.talent_v4beta1.types" - setattr(sys.modules[__name__], name, message) - names.append(name) - - -__all__ = tuple(sorted(names)) diff --git a/google/cloud/talent_v4beta1/types/__init__.py b/google/cloud/talent_v4beta1/types/__init__.py new file mode 100644 index 00000000..34762e83 --- /dev/null +++ b/google/cloud/talent_v4beta1/types/__init__.py @@ -0,0 +1,235 @@ +# -*- 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. +# + +from .common import ( + TimestampRange, + Location, + RequestMetadata, + ResponseMetadata, + DeviceInfo, + CustomAttribute, + SpellingCorrection, + CompensationInfo, + Certification, + Skill, + Interview, + Rating, + BatchOperationMetadata, +) +from .application import Application +from .application_service import ( + CreateApplicationRequest, + GetApplicationRequest, + UpdateApplicationRequest, + DeleteApplicationRequest, + ListApplicationsRequest, + ListApplicationsResponse, +) +from .company import Company +from .company_service import ( + CreateCompanyRequest, + GetCompanyRequest, + UpdateCompanyRequest, + DeleteCompanyRequest, + ListCompaniesRequest, + ListCompaniesResponse, +) +from .completion_service import ( + CompleteQueryRequest, + CompleteQueryResponse, +) +from .event import ( + ClientEvent, + JobEvent, + ProfileEvent, +) +from .event_service import CreateClientEventRequest +from .filters import ( + JobQuery, + ProfileQuery, + LocationFilter, + CompensationFilter, + CommuteFilter, + JobTitleFilter, + SkillFilter, + EmployerFilter, + EducationFilter, + WorkExperienceFilter, + ApplicationDateFilter, + ApplicationOutcomeNotesFilter, + ApplicationJobFilter, + TimeFilter, + CandidateAvailabilityFilter, + AvailabilityFilter, + PersonNameFilter, +) +from .histogram import ( + HistogramQuery, + HistogramQueryResult, +) +from .job import Job +from .job_service import ( + CreateJobRequest, + GetJobRequest, + UpdateJobRequest, + DeleteJobRequest, + BatchDeleteJobsRequest, + ListJobsRequest, + ListJobsResponse, + SearchJobsRequest, + SearchJobsResponse, + BatchCreateJobsRequest, + BatchUpdateJobsRequest, + JobOperationResult, +) +from .profile import ( + Profile, + AvailabilitySignal, + Resume, + PersonName, + Address, + Email, + Phone, + PersonalUri, + AdditionalContactInfo, + EmploymentRecord, + EducationRecord, + Degree, + Activity, + Publication, + Patent, +) +from .profile_service import ( + ListProfilesRequest, + ListProfilesResponse, + CreateProfileRequest, + GetProfileRequest, + UpdateProfileRequest, + DeleteProfileRequest, + SearchProfilesRequest, + SearchProfilesResponse, + SummarizedProfile, +) +from .tenant import Tenant +from .tenant_service import ( + CreateTenantRequest, + GetTenantRequest, + UpdateTenantRequest, + DeleteTenantRequest, + ListTenantsRequest, + ListTenantsResponse, +) + + +__all__ = ( + "TimestampRange", + "Location", + "RequestMetadata", + "ResponseMetadata", + "DeviceInfo", + "CustomAttribute", + "SpellingCorrection", + "CompensationInfo", + "Certification", + "Skill", + "Interview", + "Rating", + "BatchOperationMetadata", + "Application", + "CreateApplicationRequest", + "GetApplicationRequest", + "UpdateApplicationRequest", + "DeleteApplicationRequest", + "ListApplicationsRequest", + "ListApplicationsResponse", + "Company", + "CreateCompanyRequest", + "GetCompanyRequest", + "UpdateCompanyRequest", + "DeleteCompanyRequest", + "ListCompaniesRequest", + "ListCompaniesResponse", + "CompleteQueryRequest", + "CompleteQueryResponse", + "ClientEvent", + "JobEvent", + "ProfileEvent", + "CreateClientEventRequest", + "JobQuery", + "ProfileQuery", + "LocationFilter", + "CompensationFilter", + "CommuteFilter", + "JobTitleFilter", + "SkillFilter", + "EmployerFilter", + "EducationFilter", + "WorkExperienceFilter", + "ApplicationDateFilter", + "ApplicationOutcomeNotesFilter", + "ApplicationJobFilter", + "TimeFilter", + "CandidateAvailabilityFilter", + "AvailabilityFilter", + "PersonNameFilter", + "HistogramQuery", + "HistogramQueryResult", + "Job", + "CreateJobRequest", + "GetJobRequest", + "UpdateJobRequest", + "DeleteJobRequest", + "BatchDeleteJobsRequest", + "ListJobsRequest", + "ListJobsResponse", + "SearchJobsRequest", + "SearchJobsResponse", + "BatchCreateJobsRequest", + "BatchUpdateJobsRequest", + "JobOperationResult", + "Profile", + "AvailabilitySignal", + "Resume", + "PersonName", + "Address", + "Email", + "Phone", + "PersonalUri", + "AdditionalContactInfo", + "EmploymentRecord", + "EducationRecord", + "Degree", + "Activity", + "Publication", + "Patent", + "ListProfilesRequest", + "ListProfilesResponse", + "CreateProfileRequest", + "GetProfileRequest", + "UpdateProfileRequest", + "DeleteProfileRequest", + "SearchProfilesRequest", + "SearchProfilesResponse", + "SummarizedProfile", + "Tenant", + "CreateTenantRequest", + "GetTenantRequest", + "UpdateTenantRequest", + "DeleteTenantRequest", + "ListTenantsRequest", + "ListTenantsResponse", +) diff --git a/google/cloud/talent_v4beta1/types/application.py b/google/cloud/talent_v4beta1/types/application.py new file mode 100644 index 00000000..c407b4bc --- /dev/null +++ b/google/cloud/talent_v4beta1/types/application.py @@ -0,0 +1,172 @@ +# -*- 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. +# + +import proto # type: ignore + + +from google.cloud.talent_v4beta1.types import common +from google.protobuf import timestamp_pb2 as timestamp # type: ignore +from google.protobuf import wrappers_pb2 as wrappers # type: ignore +from google.type import date_pb2 as date # type: ignore + + +__protobuf__ = proto.module( + package="google.cloud.talent.v4beta1", manifest={"Application",}, +) + + +class Application(proto.Message): + r"""Resource that represents a job application record of a + candidate. + + Attributes: + name (str): + Required during application update. + + Resource name assigned to an application by the API. + + The format is + "projects/{project_id}/tenants/{tenant_id}/profiles/{profile_id}/applications/{application_id}". + For example, + "projects/foo/tenants/bar/profiles/baz/applications/qux". + external_id (str): + Required. Client side application identifier, + used to uniquely identify the application. + + The maximum number of allowed characters is 255. + profile (str): + Output only. Resource name of the candidate of this + application. + + The format is + "projects/{project_id}/tenants/{tenant_id}/profiles/{profile_id}". + For example, "projects/foo/tenants/bar/profiles/baz". + job (str): + Required. Resource name of the job which the candidate + applied for. + + The format is + "projects/{project_id}/tenants/{tenant_id}/jobs/{job_id}". + For example, "projects/foo/tenants/bar/jobs/baz". + company (str): + Resource name of the company which the candidate applied + for. + + The format is + "projects/{project_id}/tenants/{tenant_id}/companies/{company_id}". + For example, "projects/foo/tenants/bar/companies/baz". + application_date (~.date.Date): + The application date. + stage (~.application.Application.ApplicationStage): + Required. What is the most recent stage of + the application (that is, new, screen, send cv, + hired, finished work)? This field is + intentionally not comprehensive of every + possible status, but instead, represents + statuses that would be used to indicate to the + ML models good / bad matches. + state (~.application.Application.ApplicationState): + The application state. + interviews (Sequence[~.common.Interview]): + All interviews (screen, onsite, and so on) + conducted as part of this application (includes + details such as user conducting the interview, + timestamp, feedback, and so on). + referral (~.wrappers.BoolValue): + If the candidate is referred by a employee. + create_time (~.timestamp.Timestamp): + Required. Reflects the time that the + application was created. + update_time (~.timestamp.Timestamp): + The last update timestamp. + outcome_notes (str): + Free text reason behind the recruitement + outcome (for example, reason for withdraw / + reject, reason for an unsuccessful finish, and + so on). + Number of characters allowed is 100. + outcome (~.common.Outcome): + Outcome positiveness shows how positive the + outcome is. + is_match (~.wrappers.BoolValue): + Output only. Indicates whether this job + application is a match to application related + filters. This value is only applicable in + profile search response. + job_title_snippet (str): + Output only. Job title snippet shows how the + job title is related to a search query. It's + empty if the job title isn't related to the + search query. + """ + + class ApplicationState(proto.Enum): + r"""Enum that represents the application status.""" + APPLICATION_STATE_UNSPECIFIED = 0 + IN_PROGRESS = 1 + CANDIDATE_WITHDREW = 2 + EMPLOYER_WITHDREW = 3 + COMPLETED = 4 + CLOSED = 5 + + class ApplicationStage(proto.Enum): + r"""The stage of the application.""" + APPLICATION_STAGE_UNSPECIFIED = 0 + NEW = 1 + SCREEN = 2 + HIRING_MANAGER_REVIEW = 3 + INTERVIEW = 4 + OFFER_EXTENDED = 5 + OFFER_ACCEPTED = 6 + STARTED = 7 + + name = proto.Field(proto.STRING, number=1) + + external_id = proto.Field(proto.STRING, number=31) + + profile = proto.Field(proto.STRING, number=2) + + job = proto.Field(proto.STRING, number=4) + + company = proto.Field(proto.STRING, number=5) + + application_date = proto.Field(proto.MESSAGE, number=7, message=date.Date,) + + stage = proto.Field(proto.ENUM, number=11, enum=ApplicationStage,) + + state = proto.Field(proto.ENUM, number=13, enum=ApplicationState,) + + interviews = proto.RepeatedField( + proto.MESSAGE, number=16, message=common.Interview, + ) + + referral = proto.Field(proto.MESSAGE, number=18, message=wrappers.BoolValue,) + + create_time = proto.Field(proto.MESSAGE, number=19, message=timestamp.Timestamp,) + + update_time = proto.Field(proto.MESSAGE, number=20, message=timestamp.Timestamp,) + + outcome_notes = proto.Field(proto.STRING, number=21) + + outcome = proto.Field(proto.ENUM, number=22, enum=common.Outcome,) + + is_match = proto.Field(proto.MESSAGE, number=28, message=wrappers.BoolValue,) + + job_title_snippet = proto.Field(proto.STRING, number=29) + + +__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/cloud/talent_v4beta1/types/application_service.py b/google/cloud/talent_v4beta1/types/application_service.py new file mode 100644 index 00000000..8c906e91 --- /dev/null +++ b/google/cloud/talent_v4beta1/types/application_service.py @@ -0,0 +1,177 @@ +# -*- 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. +# + +import proto # type: ignore + + +from google.cloud.talent_v4beta1.types import application as gct_application +from google.cloud.talent_v4beta1.types import common +from google.protobuf import field_mask_pb2 as field_mask # type: ignore + + +__protobuf__ = proto.module( + package="google.cloud.talent.v4beta1", + manifest={ + "CreateApplicationRequest", + "GetApplicationRequest", + "UpdateApplicationRequest", + "DeleteApplicationRequest", + "ListApplicationsRequest", + "ListApplicationsResponse", + }, +) + + +class CreateApplicationRequest(proto.Message): + r"""The Request of the CreateApplication method. + + Attributes: + parent (str): + Required. Resource name of the profile under which the + application is created. + + The format is + "projects/{project_id}/tenants/{tenant_id}/profiles/{profile_id}". + For example, "projects/foo/tenants/bar/profiles/baz". + application (~.gct_application.Application): + Required. The application to be created. + """ + + parent = proto.Field(proto.STRING, number=1) + + application = proto.Field( + proto.MESSAGE, number=2, message=gct_application.Application, + ) + + +class GetApplicationRequest(proto.Message): + r"""Request for getting a application by name. + + Attributes: + name (str): + Required. The resource name of the application to be + retrieved. + + The format is + "projects/{project_id}/tenants/{tenant_id}/profiles/{profile_id}/applications/{application_id}". + For example, + "projects/foo/tenants/bar/profiles/baz/applications/qux". + """ + + name = proto.Field(proto.STRING, number=1) + + +class UpdateApplicationRequest(proto.Message): + r"""Request for updating a specified application. + + Attributes: + application (~.gct_application.Application): + Required. The application resource to replace + the current resource in the system. + update_mask (~.field_mask.FieldMask): + Strongly recommended for the best service experience. + + If + [update_mask][google.cloud.talent.v4beta1.UpdateApplicationRequest.update_mask] + is provided, only the specified fields in + [application][google.cloud.talent.v4beta1.UpdateApplicationRequest.application] + are updated. Otherwise all the fields are updated. + + A field mask to specify the application fields to be + updated. Only top level fields of + [Application][google.cloud.talent.v4beta1.Application] are + supported. + """ + + application = proto.Field( + proto.MESSAGE, number=1, message=gct_application.Application, + ) + + update_mask = proto.Field(proto.MESSAGE, number=2, message=field_mask.FieldMask,) + + +class DeleteApplicationRequest(proto.Message): + r"""Request to delete a application. + + Attributes: + name (str): + Required. The resource name of the application to be + deleted. + + The format is + "projects/{project_id}/tenants/{tenant_id}/profiles/{profile_id}/applications/{application_id}". + For example, + "projects/foo/tenants/bar/profiles/baz/applications/qux". + """ + + name = proto.Field(proto.STRING, number=1) + + +class ListApplicationsRequest(proto.Message): + r"""List applications for which the client has ACL visibility. + + Attributes: + parent (str): + Required. Resource name of the profile under which the + application is created. + + The format is + "projects/{project_id}/tenants/{tenant_id}/profiles/{profile_id}", + for example, "projects/foo/tenants/bar/profiles/baz". + page_token (str): + The starting indicator from which to return + results. + page_size (int): + The maximum number of applications to be + returned, at most 100. Default is 100 if a non- + positive number is provided. + """ + + parent = proto.Field(proto.STRING, number=1) + + page_token = proto.Field(proto.STRING, number=2) + + page_size = proto.Field(proto.INT32, number=3) + + +class ListApplicationsResponse(proto.Message): + r"""The List applications response object. + + Attributes: + applications (Sequence[~.gct_application.Application]): + Applications for the current client. + next_page_token (str): + A token to retrieve the next page of results. + metadata (~.common.ResponseMetadata): + Additional information for the API + invocation, such as the request tracking id. + """ + + @property + def raw_page(self): + return self + + applications = proto.RepeatedField( + proto.MESSAGE, number=1, message=gct_application.Application, + ) + + next_page_token = proto.Field(proto.STRING, number=2) + + metadata = proto.Field(proto.MESSAGE, number=3, message=common.ResponseMetadata,) + + +__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/cloud/talent_v4beta1/types/batch.py b/google/cloud/talent_v4beta1/types/batch.py new file mode 100644 index 00000000..fdbff5f8 --- /dev/null +++ b/google/cloud/talent_v4beta1/types/batch.py @@ -0,0 +1,22 @@ +# -*- 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. +# + + +__protobuf__ = proto.module(package="google.cloud.talent.v4beta1", manifest={},) + + +__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/cloud/talent_v4beta1/types/common.py b/google/cloud/talent_v4beta1/types/common.py new file mode 100644 index 00000000..6b7b74c7 --- /dev/null +++ b/google/cloud/talent_v4beta1/types/common.py @@ -0,0 +1,890 @@ +# -*- 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. +# + +import proto # type: ignore + + +from google.protobuf import timestamp_pb2 as timestamp # type: ignore +from google.protobuf import wrappers_pb2 as wrappers # type: ignore +from google.type import date_pb2 as date # type: ignore +from google.type import latlng_pb2 as latlng # type: ignore +from google.type import money_pb2 as money # type: ignore +from google.type import postal_address_pb2 as gt_postal_address # type: ignore + + +__protobuf__ = proto.module( + package="google.cloud.talent.v4beta1", + manifest={ + "CompanySize", + "JobBenefit", + "DegreeType", + "EmploymentType", + "JobLevel", + "JobCategory", + "PostingRegion", + "Visibility", + "ContactInfoUsage", + "HtmlSanitization", + "CommuteMethod", + "SkillProficiencyLevel", + "Outcome", + "AvailabilitySignalType", + "TimestampRange", + "Location", + "RequestMetadata", + "ResponseMetadata", + "DeviceInfo", + "CustomAttribute", + "SpellingCorrection", + "CompensationInfo", + "Certification", + "Skill", + "Interview", + "Rating", + "BatchOperationMetadata", + }, +) + + +class CompanySize(proto.Enum): + r"""An enum that represents the size of the company.""" + COMPANY_SIZE_UNSPECIFIED = 0 + MINI = 1 + SMALL = 2 + SMEDIUM = 3 + MEDIUM = 4 + BIG = 5 + BIGGER = 6 + GIANT = 7 + + +class JobBenefit(proto.Enum): + r"""An enum that represents employee benefits included with the + job. + """ + JOB_BENEFIT_UNSPECIFIED = 0 + CHILD_CARE = 1 + DENTAL = 2 + DOMESTIC_PARTNER = 3 + FLEXIBLE_HOURS = 4 + MEDICAL = 5 + LIFE_INSURANCE = 6 + PARENTAL_LEAVE = 7 + RETIREMENT_PLAN = 8 + SICK_DAYS = 9 + VACATION = 10 + VISION = 11 + + +class DegreeType(proto.Enum): + r"""Educational degree level defined in International Standard + Classification of Education (ISCED). + """ + DEGREE_TYPE_UNSPECIFIED = 0 + PRIMARY_EDUCATION = 1 + LOWER_SECONDARY_EDUCATION = 2 + UPPER_SECONDARY_EDUCATION = 3 + ADULT_REMEDIAL_EDUCATION = 4 + ASSOCIATES_OR_EQUIVALENT = 5 + BACHELORS_OR_EQUIVALENT = 6 + MASTERS_OR_EQUIVALENT = 7 + DOCTORAL_OR_EQUIVALENT = 8 + + +class EmploymentType(proto.Enum): + r"""An enum that represents the employment type of a job.""" + EMPLOYMENT_TYPE_UNSPECIFIED = 0 + FULL_TIME = 1 + PART_TIME = 2 + CONTRACTOR = 3 + CONTRACT_TO_HIRE = 4 + TEMPORARY = 5 + INTERN = 6 + VOLUNTEER = 7 + PER_DIEM = 8 + FLY_IN_FLY_OUT = 9 + OTHER_EMPLOYMENT_TYPE = 10 + + +class JobLevel(proto.Enum): + r"""An enum that represents the required experience level + required for the job. + """ + JOB_LEVEL_UNSPECIFIED = 0 + ENTRY_LEVEL = 1 + EXPERIENCED = 2 + MANAGER = 3 + DIRECTOR = 4 + EXECUTIVE = 5 + + +class JobCategory(proto.Enum): + r"""An enum that represents the categorization or primary focus + of specific role. This value is different than the "industry" + associated with a role, which is related to the categorization + of the company listing the job. + """ + JOB_CATEGORY_UNSPECIFIED = 0 + ACCOUNTING_AND_FINANCE = 1 + ADMINISTRATIVE_AND_OFFICE = 2 + ADVERTISING_AND_MARKETING = 3 + ANIMAL_CARE = 4 + ART_FASHION_AND_DESIGN = 5 + BUSINESS_OPERATIONS = 6 + CLEANING_AND_FACILITIES = 7 + COMPUTER_AND_IT = 8 + CONSTRUCTION = 9 + CUSTOMER_SERVICE = 10 + EDUCATION = 11 + ENTERTAINMENT_AND_TRAVEL = 12 + FARMING_AND_OUTDOORS = 13 + HEALTHCARE = 14 + HUMAN_RESOURCES = 15 + INSTALLATION_MAINTENANCE_AND_REPAIR = 16 + LEGAL = 17 + MANAGEMENT = 18 + MANUFACTURING_AND_WAREHOUSE = 19 + MEDIA_COMMUNICATIONS_AND_WRITING = 20 + OIL_GAS_AND_MINING = 21 + PERSONAL_CARE_AND_SERVICES = 22 + PROTECTIVE_SERVICES = 23 + REAL_ESTATE = 24 + RESTAURANT_AND_HOSPITALITY = 25 + SALES_AND_RETAIL = 26 + SCIENCE_AND_ENGINEERING = 27 + SOCIAL_SERVICES_AND_NON_PROFIT = 28 + SPORTS_FITNESS_AND_RECREATION = 29 + TRANSPORTATION_AND_LOGISTICS = 30 + + +class PostingRegion(proto.Enum): + r"""An enum that represents the job posting region. In most + cases, job postings don't need to specify a region. If a region + is given, jobs are eligible for searches in the specified + region. + """ + POSTING_REGION_UNSPECIFIED = 0 + ADMINISTRATIVE_AREA = 1 + NATION = 2 + TELECOMMUTE = 3 + + +class Visibility(proto.Enum): + r"""Deprecated. All resources are only visible to the owner. + An enum that represents who has view access to the resource. + """ + VISIBILITY_UNSPECIFIED = 0 + ACCOUNT_ONLY = 1 + SHARED_WITH_GOOGLE = 2 + SHARED_WITH_PUBLIC = 3 + + +class ContactInfoUsage(proto.Enum): + r"""Enum that represents the usage of the contact information.""" + CONTACT_INFO_USAGE_UNSPECIFIED = 0 + PERSONAL = 1 + WORK = 2 + SCHOOL = 3 + + +class HtmlSanitization(proto.Enum): + r"""Option for HTML content sanitization on user input fields, + for example, job description. By setting this option, user can + determine whether and how sanitization is performed on these + fields. + """ + HTML_SANITIZATION_UNSPECIFIED = 0 + HTML_SANITIZATION_DISABLED = 1 + SIMPLE_FORMATTING_ONLY = 2 + + +class CommuteMethod(proto.Enum): + r"""Method for commute.""" + COMMUTE_METHOD_UNSPECIFIED = 0 + DRIVING = 1 + TRANSIT = 2 + WALKING = 3 + CYCLING = 4 + + +class SkillProficiencyLevel(proto.Enum): + r"""Enum that represents the skill proficiency level.""" + SKILL_PROFICIENCY_LEVEL_UNSPECIFIED = 0 + UNSKILLED = 6 + FUNDAMENTAL_AWARENESS = 1 + NOVICE = 2 + INTERMEDIATE = 3 + ADVANCED = 4 + EXPERT = 5 + + +class Outcome(proto.Enum): + r"""The overall outcome /decision / result indicator.""" + OUTCOME_UNSPECIFIED = 0 + POSITIVE = 1 + NEUTRAL = 2 + NEGATIVE = 3 + OUTCOME_NOT_AVAILABLE = 4 + + +class AvailabilitySignalType(proto.Enum): + r"""The type of candidate availability signal.""" + AVAILABILITY_SIGNAL_TYPE_UNSPECIFIED = 0 + JOB_APPLICATION = 1 + RESUME_UPDATE = 2 + CANDIDATE_UPDATE = 3 + CLIENT_SUBMISSION = 4 + + +class TimestampRange(proto.Message): + r"""Message representing a period of time between two timestamps. + + Attributes: + start_time (~.timestamp.Timestamp): + Begin of the period (inclusive). + end_time (~.timestamp.Timestamp): + End of the period (exclusive). + """ + + start_time = proto.Field(proto.MESSAGE, number=1, message=timestamp.Timestamp,) + + end_time = proto.Field(proto.MESSAGE, number=2, message=timestamp.Timestamp,) + + +class Location(proto.Message): + r"""A resource that represents a location with full geographic + information. + + Attributes: + location_type (~.common.Location.LocationType): + The type of a location, which corresponds to the address + lines field of + [google.type.PostalAddress][google.type.PostalAddress]. For + example, "Downtown, Atlanta, GA, USA" has a type of + [LocationType.NEIGHBORHOOD][google.cloud.talent.v4beta1.Location.LocationType.NEIGHBORHOOD], + and "Kansas City, KS, USA" has a type of + [LocationType.LOCALITY][google.cloud.talent.v4beta1.Location.LocationType.LOCALITY]. + postal_address (~.gt_postal_address.PostalAddress): + Postal address of the location that includes + human readable information, such as postal + delivery and payments addresses. Given a postal + address, a postal service can deliver items to a + premises, P.O. Box, or other delivery location. + lat_lng (~.latlng.LatLng): + An object representing a latitude/longitude + pair. + radius_miles (float): + Radius in miles of the job location. This value is derived + from the location bounding box in which a circle with the + specified radius centered from + [google.type.LatLng][google.type.LatLng] covers the area + associated with the job location. For example, currently, + "Mountain View, CA, USA" has a radius of 6.17 miles. + """ + + class LocationType(proto.Enum): + r"""An enum which represents the type of a location.""" + LOCATION_TYPE_UNSPECIFIED = 0 + COUNTRY = 1 + ADMINISTRATIVE_AREA = 2 + SUB_ADMINISTRATIVE_AREA = 3 + LOCALITY = 4 + POSTAL_CODE = 5 + SUB_LOCALITY = 6 + SUB_LOCALITY_1 = 7 + SUB_LOCALITY_2 = 8 + NEIGHBORHOOD = 9 + STREET_ADDRESS = 10 + + location_type = proto.Field(proto.ENUM, number=1, enum=LocationType,) + + postal_address = proto.Field( + proto.MESSAGE, number=2, message=gt_postal_address.PostalAddress, + ) + + lat_lng = proto.Field(proto.MESSAGE, number=3, message=latlng.LatLng,) + + radius_miles = proto.Field(proto.DOUBLE, number=4) + + +class RequestMetadata(proto.Message): + r"""Meta information related to the job searcher or entity + conducting the job search. This information is used to improve + the performance of the service. + + Attributes: + domain (str): + Required if + [allow_missing_ids][google.cloud.talent.v4beta1.RequestMetadata.allow_missing_ids] + is unset or ``false``. + + The client-defined scope or source of the service call, + which typically is the domain on which the service has been + implemented and is currently being run. + + For example, if the service is being run by client Foo, + Inc., on job board www.foo.com and career site www.bar.com, + then this field is set to "foo.com" for use on the job + board, and "bar.com" for use on the career site. + + Note that any improvements to the model for a particular + tenant site rely on this field being set correctly to a + unique domain. + + The maximum number of allowed characters is 255. + session_id (str): + Required if + [allow_missing_ids][google.cloud.talent.v4beta1.RequestMetadata.allow_missing_ids] + is unset or ``false``. + + A unique session identification string. A session is defined + as the duration of an end user's interaction with the + service over a certain period. Obfuscate this field for + privacy concerns before providing it to the service. + + Note that any improvements to the model for a particular + tenant site rely on this field being set correctly to a + unique session ID. + + The maximum number of allowed characters is 255. + user_id (str): + Required if + [allow_missing_ids][google.cloud.talent.v4beta1.RequestMetadata.allow_missing_ids] + is unset or ``false``. + + A unique user identification string, as determined by the + client. To have the strongest positive impact on search + quality make sure the client-level is unique. Obfuscate this + field for privacy concerns before providing it to the + service. + + Note that any improvements to the model for a particular + tenant site rely on this field being set correctly to a + unique user ID. + + The maximum number of allowed characters is 255. + allow_missing_ids (bool): + Only set when any of + [domain][google.cloud.talent.v4beta1.RequestMetadata.domain], + [session_id][google.cloud.talent.v4beta1.RequestMetadata.session_id] + and + [user_id][google.cloud.talent.v4beta1.RequestMetadata.user_id] + isn't available for some reason. It is highly recommended + not to set this field and provide accurate + [domain][google.cloud.talent.v4beta1.RequestMetadata.domain], + [session_id][google.cloud.talent.v4beta1.RequestMetadata.session_id] + and + [user_id][google.cloud.talent.v4beta1.RequestMetadata.user_id] + for the best service experience. + device_info (~.common.DeviceInfo): + The type of device used by the job seeker at + the time of the call to the service. + """ + + domain = proto.Field(proto.STRING, number=1) + + session_id = proto.Field(proto.STRING, number=2) + + user_id = proto.Field(proto.STRING, number=3) + + allow_missing_ids = proto.Field(proto.BOOL, number=4) + + device_info = proto.Field(proto.MESSAGE, number=5, message="DeviceInfo",) + + +class ResponseMetadata(proto.Message): + r"""Additional information returned to client, such as debugging + information. + + Attributes: + request_id (str): + A unique id associated with this call. + This id is logged for tracking purposes. + """ + + request_id = proto.Field(proto.STRING, number=1) + + +class DeviceInfo(proto.Message): + r"""Device information collected from the job seeker, candidate, + or other entity conducting the job search. Providing this + information improves the quality of the search results across + devices. + + Attributes: + device_type (~.common.DeviceInfo.DeviceType): + Type of the device. + id (str): + A device-specific ID. The ID must be a unique + identifier that distinguishes the device from + other devices. + """ + + class DeviceType(proto.Enum): + r"""An enumeration describing an API access portal and exposure + mechanism. + """ + DEVICE_TYPE_UNSPECIFIED = 0 + WEB = 1 + MOBILE_WEB = 2 + ANDROID = 3 + IOS = 4 + BOT = 5 + OTHER = 6 + + device_type = proto.Field(proto.ENUM, number=1, enum=DeviceType,) + + id = proto.Field(proto.STRING, number=2) + + +class CustomAttribute(proto.Message): + r"""Custom attribute values that are either filterable or non- + ilterable. + + Attributes: + string_values (Sequence[str]): + Exactly one of + [string_values][google.cloud.talent.v4beta1.CustomAttribute.string_values] + or + [long_values][google.cloud.talent.v4beta1.CustomAttribute.long_values] + must be specified. + + This field is used to perform a string match + (``CASE_SENSITIVE_MATCH`` or ``CASE_INSENSITIVE_MATCH``) + search. For filterable ``string_value``\ s, a maximum total + number of 200 values is allowed, with each ``string_value`` + has a byte size of no more than 500B. For unfilterable + ``string_values``, the maximum total byte size of + unfilterable ``string_values`` is 50KB. + + Empty string isn't allowed. + long_values (Sequence[int]): + Exactly one of + [string_values][google.cloud.talent.v4beta1.CustomAttribute.string_values] + or + [long_values][google.cloud.talent.v4beta1.CustomAttribute.long_values] + must be specified. + + This field is used to perform number range search. (``EQ``, + ``GT``, ``GE``, ``LE``, ``LT``) over filterable + ``long_value``. + + Currently at most 1 + [long_values][google.cloud.talent.v4beta1.CustomAttribute.long_values] + is supported. + filterable (bool): + If the ``filterable`` flag is true, custom field values are + searchable. If false, values are not searchable. + + Default is false. + """ + + string_values = proto.RepeatedField(proto.STRING, number=1) + + long_values = proto.RepeatedField(proto.INT64, number=2) + + filterable = proto.Field(proto.BOOL, number=3) + + +class SpellingCorrection(proto.Message): + r"""Spell check result. + + Attributes: + corrected (bool): + Indicates if the query was corrected by the + spell checker. + corrected_text (str): + Correction output consisting of the corrected + keyword string. + corrected_html (str): + Corrected output with html tags to highlight + the corrected words. Corrected words are called + out with the "..." html tags. + For example, the user input query is "software + enginear", where the second word, "enginear," is + incorrect. It should be "engineer". When + spelling correction is enabled, this value is + "software engineer". + """ + + corrected = proto.Field(proto.BOOL, number=1) + + corrected_text = proto.Field(proto.STRING, number=2) + + corrected_html = proto.Field(proto.STRING, number=3) + + +class CompensationInfo(proto.Message): + r"""Job compensation details. + + Attributes: + entries (Sequence[~.common.CompensationInfo.CompensationEntry]): + Job compensation information. + + At most one entry can be of type + [CompensationInfo.CompensationType.BASE][google.cloud.talent.v4beta1.CompensationInfo.CompensationType.BASE], + which is referred as **base compensation entry** for the + job. + annualized_base_compensation_range (~.common.CompensationInfo.CompensationRange): + Output only. Annualized base compensation range. Computed as + base compensation entry's + [CompensationEntry.amount][google.cloud.talent.v4beta1.CompensationInfo.CompensationEntry.amount] + times + [CompensationEntry.expected_units_per_year][google.cloud.talent.v4beta1.CompensationInfo.CompensationEntry.expected_units_per_year]. + + See + [CompensationEntry][google.cloud.talent.v4beta1.CompensationInfo.CompensationEntry] + for explanation on compensation annualization. + annualized_total_compensation_range (~.common.CompensationInfo.CompensationRange): + Output only. Annualized total compensation range. Computed + as all compensation entries' + [CompensationEntry.amount][google.cloud.talent.v4beta1.CompensationInfo.CompensationEntry.amount] + times + [CompensationEntry.expected_units_per_year][google.cloud.talent.v4beta1.CompensationInfo.CompensationEntry.expected_units_per_year]. + + See + [CompensationEntry][google.cloud.talent.v4beta1.CompensationInfo.CompensationEntry] + for explanation on compensation annualization. + """ + + class CompensationType(proto.Enum): + r"""The type of compensation. + + For compensation amounts specified in non-monetary amounts, describe + the compensation scheme in the + [CompensationEntry.description][google.cloud.talent.v4beta1.CompensationInfo.CompensationEntry.description]. + + For example, tipping format is described in + [CompensationEntry.description][google.cloud.talent.v4beta1.CompensationInfo.CompensationEntry.description] + (for example, "expect 15-20% tips based on customer bill.") and an + estimate of the tips provided in + [CompensationEntry.amount][google.cloud.talent.v4beta1.CompensationInfo.CompensationEntry.amount] + or + [CompensationEntry.range][google.cloud.talent.v4beta1.CompensationInfo.CompensationEntry.range] + ($10 per hour). + + For example, equity is described in + [CompensationEntry.description][google.cloud.talent.v4beta1.CompensationInfo.CompensationEntry.description] + (for example, "1% - 2% equity vesting over 4 years, 1 year cliff") + and value estimated in + [CompensationEntry.amount][google.cloud.talent.v4beta1.CompensationInfo.CompensationEntry.amount] + or + [CompensationEntry.range][google.cloud.talent.v4beta1.CompensationInfo.CompensationEntry.range]. + If no value estimate is possible, units are + [CompensationUnit.COMPENSATION_UNIT_UNSPECIFIED][google.cloud.talent.v4beta1.CompensationInfo.CompensationUnit.COMPENSATION_UNIT_UNSPECIFIED] + and then further clarified in + [CompensationEntry.description][google.cloud.talent.v4beta1.CompensationInfo.CompensationEntry.description] + field. + """ + COMPENSATION_TYPE_UNSPECIFIED = 0 + BASE = 1 + BONUS = 2 + SIGNING_BONUS = 3 + EQUITY = 4 + PROFIT_SHARING = 5 + COMMISSIONS = 6 + TIPS = 7 + OTHER_COMPENSATION_TYPE = 8 + + class CompensationUnit(proto.Enum): + r"""Pay frequency.""" + COMPENSATION_UNIT_UNSPECIFIED = 0 + HOURLY = 1 + DAILY = 2 + WEEKLY = 3 + MONTHLY = 4 + YEARLY = 5 + ONE_TIME = 6 + OTHER_COMPENSATION_UNIT = 7 + + class CompensationEntry(proto.Message): + r"""A compensation entry that represents one component of compensation, + such as base pay, bonus, or other compensation type. + + Annualization: One compensation entry can be annualized if + + - it contains valid + [amount][google.cloud.talent.v4beta1.CompensationInfo.CompensationEntry.amount] + or + [range][google.cloud.talent.v4beta1.CompensationInfo.CompensationEntry.range]. + - and its + [expected_units_per_year][google.cloud.talent.v4beta1.CompensationInfo.CompensationEntry.expected_units_per_year] + is set or can be derived. Its annualized range is determined as + ([amount][google.cloud.talent.v4beta1.CompensationInfo.CompensationEntry.amount] + or + [range][google.cloud.talent.v4beta1.CompensationInfo.CompensationEntry.range]) + times + [expected_units_per_year][google.cloud.talent.v4beta1.CompensationInfo.CompensationEntry.expected_units_per_year]. + + Attributes: + type (~.common.CompensationInfo.CompensationType): + Compensation type. + + Default is + [CompensationType.COMPENSATION_TYPE_UNSPECIFIED][google.cloud.talent.v4beta1.CompensationInfo.CompensationType.COMPENSATION_TYPE_UNSPECIFIED]. + unit (~.common.CompensationInfo.CompensationUnit): + Frequency of the specified amount. + + Default is + [CompensationUnit.COMPENSATION_UNIT_UNSPECIFIED][google.cloud.talent.v4beta1.CompensationInfo.CompensationUnit.COMPENSATION_UNIT_UNSPECIFIED]. + amount (~.money.Money): + Compensation amount. + range (~.common.CompensationInfo.CompensationRange): + Compensation range. + description (str): + Compensation description. For example, could + indicate equity terms or provide additional + context to an estimated bonus. + expected_units_per_year (~.wrappers.DoubleValue): + Expected number of units paid each year. If not specified, + when + [Job.employment_types][google.cloud.talent.v4beta1.Job.employment_types] + is FULLTIME, a default value is inferred based on + [unit][google.cloud.talent.v4beta1.CompensationInfo.CompensationEntry.unit]. + Default values: + + - HOURLY: 2080 + - DAILY: 260 + - WEEKLY: 52 + - MONTHLY: 12 + - ANNUAL: 1 + """ + + type = proto.Field( + proto.ENUM, number=1, enum="CompensationInfo.CompensationType", + ) + + unit = proto.Field( + proto.ENUM, number=2, enum="CompensationInfo.CompensationUnit", + ) + + amount = proto.Field( + proto.MESSAGE, number=3, oneof="compensation_amount", message=money.Money, + ) + + range = proto.Field( + proto.MESSAGE, + number=4, + oneof="compensation_amount", + message="CompensationInfo.CompensationRange", + ) + + description = proto.Field(proto.STRING, number=5) + + expected_units_per_year = proto.Field( + proto.MESSAGE, number=6, message=wrappers.DoubleValue, + ) + + class CompensationRange(proto.Message): + r"""Compensation range. + + Attributes: + max_compensation (~.money.Money): + The maximum amount of compensation. If left empty, the value + is set to a maximal compensation value and the currency code + is set to match the [currency + code][google.type.Money.currency_code] of min_compensation. + min_compensation (~.money.Money): + The minimum amount of compensation. If left empty, the value + is set to zero and the currency code is set to match the + [currency code][google.type.Money.currency_code] of + max_compensation. + """ + + max_compensation = proto.Field(proto.MESSAGE, number=2, message=money.Money,) + + min_compensation = proto.Field(proto.MESSAGE, number=1, message=money.Money,) + + entries = proto.RepeatedField(proto.MESSAGE, number=1, message=CompensationEntry,) + + annualized_base_compensation_range = proto.Field( + proto.MESSAGE, number=2, message=CompensationRange, + ) + + annualized_total_compensation_range = proto.Field( + proto.MESSAGE, number=3, message=CompensationRange, + ) + + +class Certification(proto.Message): + r"""Resource that represents a license or certification. + + Attributes: + display_name (str): + Name of license or certification. + Number of characters allowed is 100. + acquire_date (~.date.Date): + Acquisition date or effective date of license + or certification. + expire_date (~.date.Date): + Expiration date of license of certification. + authority (str): + Authority of license, such as government. + Number of characters allowed is 100. + description (str): + Description of license or certification. + Number of characters allowed is 100,000. + """ + + display_name = proto.Field(proto.STRING, number=1) + + acquire_date = proto.Field(proto.MESSAGE, number=2, message=date.Date,) + + expire_date = proto.Field(proto.MESSAGE, number=3, message=date.Date,) + + authority = proto.Field(proto.STRING, number=4) + + description = proto.Field(proto.STRING, number=5) + + +class Skill(proto.Message): + r"""Resource that represents a skill of a candidate. + + Attributes: + display_name (str): + Skill display name. + For example, "Java", "Python". + + Number of characters allowed is 100. + last_used_date (~.date.Date): + The last time this skill was used. + level (~.common.SkillProficiencyLevel): + Skill proficiency level which indicates how + proficient the candidate is at this skill. + context (str): + A paragraph describes context of this skill. + Number of characters allowed is 100,000. + skill_name_snippet (str): + Output only. Skill name snippet shows how the + [display_name][google.cloud.talent.v4beta1.Skill.display_name] + is related to a search query. It's empty if the + [display_name][google.cloud.talent.v4beta1.Skill.display_name] + isn't related to the search query. + """ + + display_name = proto.Field(proto.STRING, number=1) + + last_used_date = proto.Field(proto.MESSAGE, number=2, message=date.Date,) + + level = proto.Field(proto.ENUM, number=3, enum="SkillProficiencyLevel",) + + context = proto.Field(proto.STRING, number=4) + + skill_name_snippet = proto.Field(proto.STRING, number=5) + + +class Interview(proto.Message): + r"""Details of an interview. + + Attributes: + rating (~.common.Rating): + The rating on this interview. + outcome (~.common.Outcome): + Required. The overall decision resulting from + this interview (positive, negative, nuetral). + """ + + rating = proto.Field(proto.MESSAGE, number=6, message="Rating",) + + outcome = proto.Field(proto.ENUM, number=7, enum="Outcome",) + + +class Rating(proto.Message): + r"""The details of the score received for an assessment or + interview. + + Attributes: + overall (float): + Overall score. + min (float): + The minimum value for the score. + max (float): + The maximum value for the score. + interval (float): + The steps within the score (for example, + interval = 1 max = 5 min = 1 indicates that the + score can be 1, 2, 3, 4, or 5) + """ + + overall = proto.Field(proto.DOUBLE, number=1) + + min = proto.Field(proto.DOUBLE, number=2) + + max = proto.Field(proto.DOUBLE, number=3) + + interval = proto.Field(proto.DOUBLE, number=4) + + +class BatchOperationMetadata(proto.Message): + r"""Metadata used for long running operations returned by CTS batch + APIs. It's used to replace + [google.longrunning.Operation.metadata][google.longrunning.Operation.metadata]. + + Attributes: + state (~.common.BatchOperationMetadata.State): + The state of a long running operation. + state_description (str): + More detailed information about operation + state. + success_count (int): + Count of successful item(s) inside an + operation. + failure_count (int): + Count of failed item(s) inside an operation. + total_count (int): + Count of total item(s) inside an operation. + create_time (~.timestamp.Timestamp): + The time when the batch operation is created. + update_time (~.timestamp.Timestamp): + The time when the batch operation status is updated. The + metadata and the + [update_time][google.cloud.talent.v4beta1.BatchOperationMetadata.update_time] + is refreshed every minute otherwise cached data is returned. + end_time (~.timestamp.Timestamp): + The time when the batch operation is finished and + [google.longrunning.Operation.done][google.longrunning.Operation.done] + is set to ``true``. + """ + + class State(proto.Enum): + r"""""" + STATE_UNSPECIFIED = 0 + INITIALIZING = 1 + PROCESSING = 2 + SUCCEEDED = 3 + FAILED = 4 + CANCELLING = 5 + CANCELLED = 6 + + state = proto.Field(proto.ENUM, number=1, enum=State,) + + state_description = proto.Field(proto.STRING, number=2) + + success_count = proto.Field(proto.INT32, number=3) + + failure_count = proto.Field(proto.INT32, number=4) + + total_count = proto.Field(proto.INT32, number=5) + + create_time = proto.Field(proto.MESSAGE, number=6, message=timestamp.Timestamp,) + + update_time = proto.Field(proto.MESSAGE, number=7, message=timestamp.Timestamp,) + + end_time = proto.Field(proto.MESSAGE, number=8, message=timestamp.Timestamp,) + + +__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/cloud/talent_v4beta1/types/company.py b/google/cloud/talent_v4beta1/types/company.py new file mode 100644 index 00000000..ac333e29 --- /dev/null +++ b/google/cloud/talent_v4beta1/types/company.py @@ -0,0 +1,149 @@ +# -*- 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. +# + +import proto # type: ignore + + +from google.cloud.talent_v4beta1.types import common + + +__protobuf__ = proto.module( + package="google.cloud.talent.v4beta1", manifest={"Company",}, +) + + +class Company(proto.Message): + r"""A Company resource represents a company in the service. A + company is the entity that owns job postings, that is, the + hiring entity responsible for employing applicants for the job + position. + + Attributes: + name (str): + Required during company update. + + The resource name for a company. This is generated by the + service when a company is created. + + The format is + "projects/{project_id}/tenants/{tenant_id}/companies/{company_id}", + for example, "projects/foo/tenants/bar/companies/baz". + + If tenant id is unspecified, the default tenant is used. For + example, "projects/foo/companies/bar". + display_name (str): + Required. The display name of the company, + for example, "Google LLC". + external_id (str): + Required. Client side company identifier, + used to uniquely identify the company. + + The maximum number of allowed characters is 255. + size (~.common.CompanySize): + The employer's company size. + headquarters_address (str): + The street address of the company's main headquarters, which + may be different from the job location. The service attempts + to geolocate the provided address, and populates a more + specific location wherever possible in + [DerivedInfo.headquarters_location][google.cloud.talent.v4beta1.Company.DerivedInfo.headquarters_location]. + hiring_agency (bool): + Set to true if it is the hiring agency that + post jobs for other employers. + + Defaults to false if not provided. + eeo_text (str): + Equal Employment Opportunity legal disclaimer + text to be associated with all jobs, and + typically to be displayed in all roles. + + The maximum number of allowed characters is 500. + website_uri (str): + The URI representing the company's primary + web site or home page, for example, + "https://www.google.com". + The maximum number of allowed characters is 255. + career_site_uri (str): + The URI to employer's career site or careers + page on the employer's web site, for example, + "https://careers.google.com". + image_uri (str): + A URI that hosts the employer's company logo. + keyword_searchable_job_custom_attributes (Sequence[str]): + A list of keys of filterable + [Job.custom_attributes][google.cloud.talent.v4beta1.Job.custom_attributes], + whose corresponding ``string_values`` are used in keyword + searches. Jobs with ``string_values`` under these specified + field keys are returned if any of the values match the + search keyword. Custom field values with parenthesis, + brackets and special symbols are not searchable as-is, and + those keyword queries must be surrounded by quotes. + derived_info (~.company.Company.DerivedInfo): + Output only. Derived details about the + company. + suspended (bool): + Output only. Indicates whether a company is + flagged to be suspended from public availability + by the service when job content appears + suspicious, abusive, or spammy. + """ + + class DerivedInfo(proto.Message): + r"""Derived details about the company. + + Attributes: + headquarters_location (~.common.Location): + A structured headquarters location of the company, resolved + from + [Company.headquarters_address][google.cloud.talent.v4beta1.Company.headquarters_address] + if provided. + """ + + headquarters_location = proto.Field( + proto.MESSAGE, number=1, message=common.Location, + ) + + name = proto.Field(proto.STRING, number=1) + + display_name = proto.Field(proto.STRING, number=2) + + external_id = proto.Field(proto.STRING, number=3) + + size = proto.Field(proto.ENUM, number=4, enum=common.CompanySize,) + + headquarters_address = proto.Field(proto.STRING, number=5) + + hiring_agency = proto.Field(proto.BOOL, number=6) + + eeo_text = proto.Field(proto.STRING, number=7) + + website_uri = proto.Field(proto.STRING, number=8) + + career_site_uri = proto.Field(proto.STRING, number=9) + + image_uri = proto.Field(proto.STRING, number=10) + + keyword_searchable_job_custom_attributes = proto.RepeatedField( + proto.STRING, number=11 + ) + + derived_info = proto.Field(proto.MESSAGE, number=12, message=DerivedInfo,) + + suspended = proto.Field(proto.BOOL, number=13) + + +__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/cloud/talent_v4beta1/types/company_service.py b/google/cloud/talent_v4beta1/types/company_service.py new file mode 100644 index 00000000..960ab39c --- /dev/null +++ b/google/cloud/talent_v4beta1/types/company_service.py @@ -0,0 +1,190 @@ +# -*- 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. +# + +import proto # type: ignore + + +from google.cloud.talent_v4beta1.types import common +from google.cloud.talent_v4beta1.types import company as gct_company +from google.protobuf import field_mask_pb2 as field_mask # type: ignore + + +__protobuf__ = proto.module( + package="google.cloud.talent.v4beta1", + manifest={ + "CreateCompanyRequest", + "GetCompanyRequest", + "UpdateCompanyRequest", + "DeleteCompanyRequest", + "ListCompaniesRequest", + "ListCompaniesResponse", + }, +) + + +class CreateCompanyRequest(proto.Message): + r"""The Request of the CreateCompany method. + + Attributes: + parent (str): + Required. Resource name of the tenant under which the + company is created. + + The format is "projects/{project_id}/tenants/{tenant_id}", + for example, "projects/foo/tenant/bar". If tenant id is + unspecified, a default tenant is created, for example, + "projects/foo". + company (~.gct_company.Company): + Required. The company to be created. + """ + + parent = proto.Field(proto.STRING, number=1) + + company = proto.Field(proto.MESSAGE, number=2, message=gct_company.Company,) + + +class GetCompanyRequest(proto.Message): + r"""Request for getting a company by name. + + Attributes: + name (str): + Required. The resource name of the company to be retrieved. + + The format is + "projects/{project_id}/tenants/{tenant_id}/companies/{company_id}", + for example, + "projects/api-test-project/tenants/foo/companies/bar". + + If tenant id is unspecified, the default tenant is used, for + example, "projects/api-test-project/companies/bar". + """ + + name = proto.Field(proto.STRING, number=1) + + +class UpdateCompanyRequest(proto.Message): + r"""Request for updating a specified company. + + Attributes: + company (~.gct_company.Company): + Required. The company resource to replace the + current resource in the system. + update_mask (~.field_mask.FieldMask): + Strongly recommended for the best service experience. + + If + [update_mask][google.cloud.talent.v4beta1.UpdateCompanyRequest.update_mask] + is provided, only the specified fields in + [company][google.cloud.talent.v4beta1.UpdateCompanyRequest.company] + are updated. Otherwise all the fields are updated. + + A field mask to specify the company fields to be updated. + Only top level fields of + [Company][google.cloud.talent.v4beta1.Company] are + supported. + """ + + company = proto.Field(proto.MESSAGE, number=1, message=gct_company.Company,) + + update_mask = proto.Field(proto.MESSAGE, number=2, message=field_mask.FieldMask,) + + +class DeleteCompanyRequest(proto.Message): + r"""Request to delete a company. + + Attributes: + name (str): + Required. The resource name of the company to be deleted. + + The format is + "projects/{project_id}/tenants/{tenant_id}/companies/{company_id}", + for example, "projects/foo/tenants/bar/companies/baz". + + If tenant id is unspecified, the default tenant is used, for + example, "projects/foo/companies/bar". + """ + + name = proto.Field(proto.STRING, number=1) + + +class ListCompaniesRequest(proto.Message): + r"""List companies for which the client has ACL visibility. + + Attributes: + parent (str): + Required. Resource name of the tenant under which the + company is created. + + The format is "projects/{project_id}/tenants/{tenant_id}", + for example, "projects/foo/tenant/bar". + + If tenant id is unspecified, the default tenant will be + used, for example, "projects/foo". + page_token (str): + The starting indicator from which to return + results. + page_size (int): + The maximum number of companies to be + returned, at most 100. Default is 100 if a non- + positive number is provided. + require_open_jobs (bool): + Set to true if the companies requested must have open jobs. + + Defaults to false. + + If true, at most + [page_size][google.cloud.talent.v4beta1.ListCompaniesRequest.page_size] + of companies are fetched, among which only those with open + jobs are returned. + """ + + parent = proto.Field(proto.STRING, number=1) + + page_token = proto.Field(proto.STRING, number=2) + + page_size = proto.Field(proto.INT32, number=3) + + require_open_jobs = proto.Field(proto.BOOL, number=4) + + +class ListCompaniesResponse(proto.Message): + r"""The List companies response object. + + Attributes: + companies (Sequence[~.gct_company.Company]): + Companies for the current client. + next_page_token (str): + A token to retrieve the next page of results. + metadata (~.common.ResponseMetadata): + Additional information for the API + invocation, such as the request tracking id. + """ + + @property + def raw_page(self): + return self + + companies = proto.RepeatedField( + proto.MESSAGE, number=1, message=gct_company.Company, + ) + + next_page_token = proto.Field(proto.STRING, number=2) + + metadata = proto.Field(proto.MESSAGE, number=3, message=common.ResponseMetadata,) + + +__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/cloud/talent_v4beta1/types/completion_service.py b/google/cloud/talent_v4beta1/types/completion_service.py new file mode 100644 index 00000000..353336e3 --- /dev/null +++ b/google/cloud/talent_v4beta1/types/completion_service.py @@ -0,0 +1,142 @@ +# -*- 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. +# + +import proto # type: ignore + + +from google.cloud.talent_v4beta1.types import common + + +__protobuf__ = proto.module( + package="google.cloud.talent.v4beta1", + manifest={"CompleteQueryRequest", "CompleteQueryResponse",}, +) + + +class CompleteQueryRequest(proto.Message): + r"""Auto-complete parameters. + + Attributes: + parent (str): + Required. Resource name of tenant the completion is + performed within. + + The format is "projects/{project_id}/tenants/{tenant_id}", + for example, "projects/foo/tenant/bar". + + If tenant id is unspecified, the default tenant is used, for + example, "projects/foo". + query (str): + Required. The query used to generate + suggestions. + The maximum number of allowed characters is 255. + language_codes (Sequence[str]): + The list of languages of the query. This is the BCP-47 + language code, such as "en-US" or "sr-Latn". For more + information, see `Tags for Identifying + Languages `__. + + The maximum number of allowed characters is 255. + page_size (int): + Required. Completion result count. + The maximum allowed page size is 10. + company (str): + If provided, restricts completion to specified company. + + The format is + "projects/{project_id}/tenants/{tenant_id}/companies/{company_id}", + for example, "projects/foo/tenants/bar/companies/baz". + + If tenant id is unspecified, the default tenant is used, for + example, "projects/foo". + scope (~.completion_service.CompleteQueryRequest.CompletionScope): + The scope of the completion. The defaults is + [CompletionScope.PUBLIC][google.cloud.talent.v4beta1.CompleteQueryRequest.CompletionScope.PUBLIC]. + type (~.completion_service.CompleteQueryRequest.CompletionType): + The completion topic. The default is + [CompletionType.COMBINED][google.cloud.talent.v4beta1.CompleteQueryRequest.CompletionType.COMBINED]. + """ + + class CompletionScope(proto.Enum): + r"""Enum to specify the scope of completion.""" + COMPLETION_SCOPE_UNSPECIFIED = 0 + TENANT = 1 + PUBLIC = 2 + + class CompletionType(proto.Enum): + r"""Enum to specify auto-completion topics.""" + COMPLETION_TYPE_UNSPECIFIED = 0 + JOB_TITLE = 1 + COMPANY_NAME = 2 + COMBINED = 3 + + parent = proto.Field(proto.STRING, number=1) + + query = proto.Field(proto.STRING, number=2) + + language_codes = proto.RepeatedField(proto.STRING, number=3) + + page_size = proto.Field(proto.INT32, number=4) + + company = proto.Field(proto.STRING, number=5) + + scope = proto.Field(proto.ENUM, number=6, enum=CompletionScope,) + + type = proto.Field(proto.ENUM, number=7, enum=CompletionType,) + + +class CompleteQueryResponse(proto.Message): + r"""Response of auto-complete query. + + Attributes: + completion_results (Sequence[~.completion_service.CompleteQueryResponse.CompletionResult]): + Results of the matching job/company + candidates. + metadata (~.common.ResponseMetadata): + Additional information for the API + invocation, such as the request tracking id. + """ + + class CompletionResult(proto.Message): + r"""Resource that represents completion results. + + Attributes: + suggestion (str): + The suggestion for the query. + type (~.completion_service.CompleteQueryRequest.CompletionType): + The completion topic. + image_uri (str): + The URI of the company image for + [COMPANY_NAME][google.cloud.talent.v4beta1.CompleteQueryRequest.CompletionType.COMPANY_NAME]. + """ + + suggestion = proto.Field(proto.STRING, number=1) + + type = proto.Field( + proto.ENUM, number=2, enum=CompleteQueryRequest.CompletionType, + ) + + image_uri = proto.Field(proto.STRING, number=3) + + completion_results = proto.RepeatedField( + proto.MESSAGE, number=1, message=CompletionResult, + ) + + metadata = proto.Field(proto.MESSAGE, number=2, message=common.ResponseMetadata,) + + +__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/cloud/talent_v4beta1/types/event.py b/google/cloud/talent_v4beta1/types/event.py new file mode 100644 index 00000000..e1726ebd --- /dev/null +++ b/google/cloud/talent_v4beta1/types/event.py @@ -0,0 +1,178 @@ +# -*- 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. +# + +import proto # type: ignore + + +from google.protobuf import timestamp_pb2 as timestamp # type: ignore + + +__protobuf__ = proto.module( + package="google.cloud.talent.v4beta1", + manifest={"ClientEvent", "JobEvent", "ProfileEvent",}, +) + + +class ClientEvent(proto.Message): + r"""An event issued when an end user interacts with the + application that implements Cloud Talent Solution. Providing + this information improves the quality of results for the API + clients, enabling the service to perform optimally. The number + of events sent must be consistent with other calls, such as job + searches, issued to the service by the client. + + Attributes: + request_id (str): + Strongly recommended for the best service experience. + + A unique ID generated in the API responses. It can be found + in + [ResponseMetadata.request_id][google.cloud.talent.v4beta1.ResponseMetadata.request_id]. + event_id (str): + Required. A unique identifier, generated by + the client application. + create_time (~.timestamp.Timestamp): + Required. The timestamp of the event. + job_event (~.event.JobEvent): + An event issued when a job seeker interacts + with the application that implements Cloud + Talent Solution. + profile_event (~.event.ProfileEvent): + An event issued when a profile searcher + interacts with the application that implements + Cloud Talent Solution. + event_notes (str): + Notes about the event provided by recruiters + or other users, for example, feedback on why a + profile was bookmarked. + """ + + request_id = proto.Field(proto.STRING, number=1) + + event_id = proto.Field(proto.STRING, number=2) + + create_time = proto.Field(proto.MESSAGE, number=4, message=timestamp.Timestamp,) + + job_event = proto.Field(proto.MESSAGE, number=5, oneof="event", message="JobEvent",) + + profile_event = proto.Field( + proto.MESSAGE, number=6, oneof="event", message="ProfileEvent", + ) + + event_notes = proto.Field(proto.STRING, number=9) + + +class JobEvent(proto.Message): + r"""An event issued when a job seeker interacts with the + application that implements Cloud Talent Solution. + + Attributes: + type (~.event.JobEvent.JobEventType): + Required. The type of the event (see + [JobEventType][google.cloud.talent.v4beta1.JobEvent.JobEventType]). + jobs (Sequence[str]): + Required. The [job + name(s)][google.cloud.talent.v4beta1.Job.name] associated + with this event. For example, if this is an + [impression][google.cloud.talent.v4beta1.JobEvent.JobEventType.IMPRESSION] + event, this field contains the identifiers of all jobs shown + to the job seeker. If this was a + [view][google.cloud.talent.v4beta1.JobEvent.JobEventType.VIEW] + event, this field contains the identifier of the viewed job. + + The format is + "projects/{project_id}/tenants/{tenant_id}/jobs/{job_id}", + for example, "projects/foo/tenants/bar/jobs/baz". + profile (str): + The [profile name][google.cloud.talent.v4beta1.Profile.name] + associated with this client event. + + The format is + "projects/{project_id}/tenants/{tenant_id}/profiles/{profile_id}", + for example, "projects/foo/tenants/bar/profiles/baz". + """ + + class JobEventType(proto.Enum): + r"""An enumeration of an event attributed to the behavior of the + end user, such as a job seeker. + """ + JOB_EVENT_TYPE_UNSPECIFIED = 0 + IMPRESSION = 1 + VIEW = 2 + VIEW_REDIRECT = 3 + APPLICATION_START = 4 + APPLICATION_FINISH = 5 + APPLICATION_QUICK_SUBMISSION = 6 + APPLICATION_REDIRECT = 7 + APPLICATION_START_FROM_SEARCH = 8 + APPLICATION_REDIRECT_FROM_SEARCH = 9 + APPLICATION_COMPANY_SUBMIT = 10 + BOOKMARK = 11 + NOTIFICATION = 12 + HIRED = 13 + SENT_CV = 14 + INTERVIEW_GRANTED = 15 + + type = proto.Field(proto.ENUM, number=1, enum=JobEventType,) + + jobs = proto.RepeatedField(proto.STRING, number=2) + + profile = proto.Field(proto.STRING, number=3) + + +class ProfileEvent(proto.Message): + r"""An event issued when a profile searcher interacts with the + application that implements Cloud Talent Solution. + + Attributes: + type (~.event.ProfileEvent.ProfileEventType): + Required. Type of event. + profiles (Sequence[str]): + Required. The [profile + name(s)][google.cloud.talent.v4beta1.Profile.name] + associated with this client event. + + The format is + "projects/{project_id}/tenants/{tenant_id}/profiles/{profile_id}", + for example, "projects/foo/tenants/bar/profiles/baz". + jobs (Sequence[str]): + The [job name(s)][google.cloud.talent.v4beta1.Job.name] + associated with this client event. Leave it empty if the + event isn't associated with a job. + + The format is + "projects/{project_id}/tenants/{tenant_id}/jobs/{job_id}", + for example, "projects/foo/tenants/bar/jobs/baz". + """ + + class ProfileEventType(proto.Enum): + r"""The enum represents types of client events for a candidate + profile. + """ + PROFILE_EVENT_TYPE_UNSPECIFIED = 0 + IMPRESSION = 1 + VIEW = 2 + BOOKMARK = 3 + + type = proto.Field(proto.ENUM, number=1, enum=ProfileEventType,) + + profiles = proto.RepeatedField(proto.STRING, number=2) + + jobs = proto.RepeatedField(proto.STRING, number=6) + + +__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/cloud/talent_v4beta1/types/event_service.py b/google/cloud/talent_v4beta1/types/event_service.py new file mode 100644 index 00000000..dad4a639 --- /dev/null +++ b/google/cloud/talent_v4beta1/types/event_service.py @@ -0,0 +1,52 @@ +# -*- 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. +# + +import proto # type: ignore + + +from google.cloud.talent_v4beta1.types import event + + +__protobuf__ = proto.module( + package="google.cloud.talent.v4beta1", manifest={"CreateClientEventRequest",}, +) + + +class CreateClientEventRequest(proto.Message): + r"""The report event request. + + Attributes: + parent (str): + Required. Resource name of the tenant under which the event + is created. + + The format is "projects/{project_id}/tenants/{tenant_id}", + for example, "projects/foo/tenant/bar". If tenant id is + unspecified, a default tenant is created, for example, + "projects/foo". + client_event (~.event.ClientEvent): + Required. Events issued when end user + interacts with customer's application that uses + Cloud Talent Solution. + """ + + parent = proto.Field(proto.STRING, number=1) + + client_event = proto.Field(proto.MESSAGE, number=2, message=event.ClientEvent,) + + +__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/cloud/talent_v4beta1/types/filters.py b/google/cloud/talent_v4beta1/types/filters.py new file mode 100644 index 00000000..c30a4e26 --- /dev/null +++ b/google/cloud/talent_v4beta1/types/filters.py @@ -0,0 +1,1085 @@ +# -*- 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. +# + +import proto # type: ignore + + +from google.cloud.talent_v4beta1.types import common +from google.protobuf import duration_pb2 as duration # type: ignore +from google.protobuf import timestamp_pb2 as timestamp # type: ignore +from google.protobuf import wrappers_pb2 as wrappers # type: ignore +from google.type import date_pb2 as date # type: ignore +from google.type import latlng_pb2 as latlng # type: ignore +from google.type import timeofday_pb2 as timeofday # type: ignore + + +__protobuf__ = proto.module( + package="google.cloud.talent.v4beta1", + manifest={ + "JobQuery", + "ProfileQuery", + "LocationFilter", + "CompensationFilter", + "CommuteFilter", + "JobTitleFilter", + "SkillFilter", + "EmployerFilter", + "EducationFilter", + "WorkExperienceFilter", + "ApplicationDateFilter", + "ApplicationOutcomeNotesFilter", + "ApplicationJobFilter", + "TimeFilter", + "CandidateAvailabilityFilter", + "AvailabilityFilter", + "PersonNameFilter", + }, +) + + +class JobQuery(proto.Message): + r"""The query required to perform a search query. + + Attributes: + query (str): + The query string that matches against the job + title, description, and location fields. + + The maximum number of allowed characters is 255. + query_language_code (str): + The language code of + [query][google.cloud.talent.v4beta1.JobQuery.query]. For + example, "en-US". This field helps to better interpret the + query. + + If a value isn't specified, the query language code is + automatically detected, which may not be accurate. + + Language code should be in BCP-47 format, such as "en-US" or + "sr-Latn". For more information, see `Tags for Identifying + Languages `__. + companies (Sequence[str]): + This filter specifies the company entities to search + against. + + If a value isn't specified, jobs are searched for against + all companies. + + If multiple values are specified, jobs are searched against + the companies specified. + + The format is + "projects/{project_id}/tenants/{tenant_id}/companies/{company_id}". + For example, "projects/foo/tenants/bar/companies/baz". + + If tenant id is unspecified, the default tenant is used. For + example, "projects/foo/companies/bar". + + At most 20 company filters are allowed. + location_filters (Sequence[~.filters.LocationFilter]): + The location filter specifies geo-regions containing the + jobs to search against. See + [LocationFilter][google.cloud.talent.v4beta1.LocationFilter] + for more information. + + If a location value isn't specified, jobs fitting the other + search criteria are retrieved regardless of where they're + located. + + If multiple values are specified, jobs are retrieved from + any of the specified locations. If different values are + specified for the + [LocationFilter.distance_in_miles][google.cloud.talent.v4beta1.LocationFilter.distance_in_miles] + parameter, the maximum provided distance is used for all + locations. + + At most 5 location filters are allowed. + job_categories (Sequence[~.common.JobCategory]): + The category filter specifies the categories of jobs to + search against. See + [JobCategory][google.cloud.talent.v4beta1.JobCategory] for + more information. + + If a value isn't specified, jobs from any category are + searched against. + + If multiple values are specified, jobs from any of the + specified categories are searched against. + commute_filter (~.filters.CommuteFilter): + Allows filtering jobs by commute time with different travel + methods (for example, driving or public transit). + + Note: This only works when you specify a + [CommuteMethod][google.cloud.talent.v4beta1.CommuteMethod]. + In this case, + [location_filters][google.cloud.talent.v4beta1.JobQuery.location_filters] + is ignored. + + Currently we don't support sorting by commute time. + company_display_names (Sequence[str]): + This filter specifies the exact company + [Company.display_name][google.cloud.talent.v4beta1.Company.display_name] + of the jobs to search against. + + If a value isn't specified, jobs within the search results + are associated with any company. + + If multiple values are specified, jobs within the search + results may be associated with any of the specified + companies. + + At most 20 company display name filters are allowed. + compensation_filter (~.filters.CompensationFilter): + This search filter is applied only to + [Job.compensation_info][google.cloud.talent.v4beta1.Job.compensation_info]. + For example, if the filter is specified as "Hourly job with + per-hour compensation > $15", only jobs meeting these + criteria are searched. If a filter isn't defined, all open + jobs are searched. + custom_attribute_filter (str): + This filter specifies a structured syntax to match against + the + [Job.custom_attributes][google.cloud.talent.v4beta1.Job.custom_attributes] + marked as ``filterable``. + + The syntax for this expression is a subset of SQL syntax. + + Supported operators are: ``=``, ``!=``, ``<``, ``<=``, + ``>``, and ``>=`` where the left of the operator is a custom + field key and the right of the operator is a number or a + quoted string. You must escape backslash (\) and quote (") + characters. + + Supported functions are ``LOWER([field_name])`` to perform a + case insensitive match and ``EMPTY([field_name])`` to filter + on the existence of a key. + + Boolean expressions (AND/OR/NOT) are supported up to 3 + levels of nesting (for example, "((A AND B AND C) OR NOT D) + AND E"), a maximum of 100 comparisons or functions are + allowed in the expression. The expression must be < 6000 + bytes in length. + + Sample Query: + ``(LOWER(driving_license)="class \"a\"" OR EMPTY(driving_license)) AND driving_years > 10`` + disable_spell_check (bool): + This flag controls the spell-check feature. + If false, the service attempts to correct a + misspelled query, for example, "enginee" is + corrected to "engineer". + Defaults to false: a spell check is performed. + employment_types (Sequence[~.common.EmploymentType]): + The employment type filter specifies the employment type of + jobs to search against, such as + [EmploymentType.FULL_TIME][google.cloud.talent.v4beta1.EmploymentType.FULL_TIME]. + + If a value isn't specified, jobs in the search results + includes any employment type. + + If multiple values are specified, jobs in the search results + include any of the specified employment types. + language_codes (Sequence[str]): + This filter specifies the locale of jobs to search against, + for example, "en-US". + + If a value isn't specified, the search results can contain + jobs in any locale. + + Language codes should be in BCP-47 format, such as "en-US" + or "sr-Latn". For more information, see `Tags for + Identifying + Languages `__. + + At most 10 language code filters are allowed. + publish_time_range (~.common.TimestampRange): + Jobs published within a range specified by + this filter are searched against. + excluded_jobs (Sequence[str]): + This filter specifies a list of job names to + be excluded during search. + At most 400 excluded job names are allowed. + """ + + query = proto.Field(proto.STRING, number=1) + + query_language_code = proto.Field(proto.STRING, number=14) + + companies = proto.RepeatedField(proto.STRING, number=2) + + location_filters = proto.RepeatedField( + proto.MESSAGE, number=3, message="LocationFilter", + ) + + job_categories = proto.RepeatedField(proto.ENUM, number=4, enum=common.JobCategory,) + + commute_filter = proto.Field(proto.MESSAGE, number=5, message="CommuteFilter",) + + company_display_names = proto.RepeatedField(proto.STRING, number=6) + + compensation_filter = proto.Field( + proto.MESSAGE, number=7, message="CompensationFilter", + ) + + custom_attribute_filter = proto.Field(proto.STRING, number=8) + + disable_spell_check = proto.Field(proto.BOOL, number=9) + + employment_types = proto.RepeatedField( + proto.ENUM, number=10, enum=common.EmploymentType, + ) + + language_codes = proto.RepeatedField(proto.STRING, number=11) + + publish_time_range = proto.Field( + proto.MESSAGE, number=12, message=common.TimestampRange, + ) + + excluded_jobs = proto.RepeatedField(proto.STRING, number=13) + + +class ProfileQuery(proto.Message): + r"""Filters to apply when performing the search query. + + Attributes: + query (str): + Keywords to match any text fields of + profiles. + For example, "software engineer in Palo Alto". + location_filters (Sequence[~.filters.LocationFilter]): + The location filter specifies geo-regions containing the + profiles to search against. + + One of + [LocationFilter.address][google.cloud.talent.v4beta1.LocationFilter.address] + or + [LocationFilter.lat_lng][google.cloud.talent.v4beta1.LocationFilter.lat_lng] + must be provided or an error is thrown. If both + [LocationFilter.address][google.cloud.talent.v4beta1.LocationFilter.address] + and + [LocationFilter.lat_lng][google.cloud.talent.v4beta1.LocationFilter.lat_lng] + are provided, an error is thrown. + + The following logic is used to determine which locations in + the profile to filter against: + + 1. All of the profile's geocoded + [Profile.addresses][google.cloud.talent.v4beta1.Profile.addresses] + where + [Address.usage][google.cloud.talent.v4beta1.Address.usage] + is PERSONAL and + [Address.current][google.cloud.talent.v4beta1.Address.current] + is true. + + 2. If the above set of locations is empty, all of the + profile's geocoded + [Profile.addresses][google.cloud.talent.v4beta1.Profile.addresses] + where + [Address.usage][google.cloud.talent.v4beta1.Address.usage] + is CONTACT_INFO_USAGE_UNSPECIFIED and + [Address.current][google.cloud.talent.v4beta1.Address.current] + is true. + + 3. If the above set of locations is empty, all of the + profile's geocoded + [Profile.addresses][google.cloud.talent.v4beta1.Profile.addresses] + where + [Address.usage][google.cloud.talent.v4beta1.Address.usage] + is PERSONAL or CONTACT_INFO_USAGE_UNSPECIFIED and + [Address.current][google.cloud.talent.v4beta1.Address.current] + is not set. + + This means that any profiles without any + [Profile.addresses][google.cloud.talent.v4beta1.Profile.addresses] + that match any of the above criteria will not be included in + a search with location filter. Furthermore, any + [Profile.addresses][google.cloud.talent.v4beta1.Profile.addresses] + where + [Address.usage][google.cloud.talent.v4beta1.Address.usage] + is WORK or SCHOOL or where + [Address.current][google.cloud.talent.v4beta1.Address.current] + is false are not considered for location filter. + + If a location filter isn't specified, profiles fitting the + other search criteria are retrieved regardless of where + they're located. + + If + [LocationFilter.negated][google.cloud.talent.v4beta1.LocationFilter.negated] + is specified, the result doesn't contain profiles from that + location. + + If + [LocationFilter.address][google.cloud.talent.v4beta1.LocationFilter.address] + is provided, the + [LocationType][google.cloud.talent.v4beta1.Location.LocationType], + center point (latitude and longitude), and radius are + automatically detected by the Google Maps Geocoding API and + included as well. If + [LocationFilter.address][google.cloud.talent.v4beta1.LocationFilter.address] + cannot be geocoded, the filter falls back to keyword search. + + If the detected + [LocationType][google.cloud.talent.v4beta1.Location.LocationType] + is + [LocationType.SUB_ADMINISTRATIVE_AREA][google.cloud.talent.v4beta1.Location.LocationType.SUB_ADMINISTRATIVE_AREA], + [LocationType.ADMINISTRATIVE_AREA][google.cloud.talent.v4beta1.Location.LocationType.ADMINISTRATIVE_AREA], + or + [LocationType.COUNTRY][google.cloud.talent.v4beta1.Location.LocationType.COUNTRY], + the filter is performed against the detected location name + (using exact text matching). Otherwise, the filter is + performed against the detected center point and a radius of + detected location radius + + [LocationFilter.distance_in_miles][google.cloud.talent.v4beta1.LocationFilter.distance_in_miles]. + + If + [LocationFilter.address][google.cloud.talent.v4beta1.LocationFilter.address] + is provided, + [LocationFilter.distance_in_miles][google.cloud.talent.v4beta1.LocationFilter.distance_in_miles] + is the additional radius on top of the radius of the + location geocoded from + [LocationFilter.address][google.cloud.talent.v4beta1.LocationFilter.address]. + If + [LocationFilter.lat_lng][google.cloud.talent.v4beta1.LocationFilter.lat_lng] + is provided, + [LocationFilter.distance_in_miles][google.cloud.talent.v4beta1.LocationFilter.distance_in_miles] + is the only radius that is used. + + [LocationFilter.distance_in_miles][google.cloud.talent.v4beta1.LocationFilter.distance_in_miles] + is 10 by default. Note that the value of + [LocationFilter.distance_in_miles][google.cloud.talent.v4beta1.LocationFilter.distance_in_miles] + is 0 if it is unset, so the server does not differentiate + [LocationFilter.distance_in_miles][google.cloud.talent.v4beta1.LocationFilter.distance_in_miles] + that is explicitly set to 0 and + [LocationFilter.distance_in_miles][google.cloud.talent.v4beta1.LocationFilter.distance_in_miles] + that is not set. Which means that if + [LocationFilter.distance_in_miles][google.cloud.talent.v4beta1.LocationFilter.distance_in_miles] + is explicitly set to 0, the server will use the default + value of + [LocationFilter.distance_in_miles][google.cloud.talent.v4beta1.LocationFilter.distance_in_miles] + which is 10. To work around this and effectively set + [LocationFilter.distance_in_miles][google.cloud.talent.v4beta1.LocationFilter.distance_in_miles] + to 0, we recommend setting + [LocationFilter.distance_in_miles][google.cloud.talent.v4beta1.LocationFilter.distance_in_miles] + to a very small decimal number (such as 0.00001). + + If + [LocationFilter.distance_in_miles][google.cloud.talent.v4beta1.LocationFilter.distance_in_miles] + is negative, an error is thrown. + job_title_filters (Sequence[~.filters.JobTitleFilter]): + Job title filter specifies job titles of profiles to match + on. + + If a job title isn't specified, profiles with any titles are + retrieved. + + If multiple values are specified, profiles are retrieved + with any of the specified job titles. + + If + [JobTitleFilter.negated][google.cloud.talent.v4beta1.JobTitleFilter.negated] + is specified, the result won't contain profiles with the job + titles. + + For example, search for profiles with a job title "Product + Manager". + employer_filters (Sequence[~.filters.EmployerFilter]): + Employer filter specifies employers of profiles to match on. + + If an employer filter isn't specified, profiles with any + employers are retrieved. + + If multiple employer filters are specified, profiles with + any matching employers are retrieved. + + If + [EmployerFilter.negated][google.cloud.talent.v4beta1.EmployerFilter.negated] + is specified, the result won't contain profiles that match + the employers. + + For example, search for profiles that have working + experience at "Google LLC". + education_filters (Sequence[~.filters.EducationFilter]): + Education filter specifies education of profiles to match + on. + + If an education filter isn't specified, profiles with any + education are retrieved. + + If multiple education filters are specified, profiles that + match any education filters are retrieved. + + If + [EducationFilter.negated][google.cloud.talent.v4beta1.EducationFilter.negated] + is specified, the result won't contain profiles that match + the educations. + + For example, search for profiles with a master degree. + skill_filters (Sequence[~.filters.SkillFilter]): + Skill filter specifies skill of profiles to match on. + + If a skill filter isn't specified, profiles with any skills + are retrieved. + + If multiple skill filters are specified, profiles that match + any skill filters are retrieved. + + If + [SkillFilter.negated][google.cloud.talent.v4beta1.SkillFilter.negated] + is specified, the result won't contain profiles that match + the skills. + + For example, search for profiles that have "Java" and + "Python" in skill list. + work_experience_filter (Sequence[~.filters.WorkExperienceFilter]): + Work experience filter specifies the total + working experience of profiles to match on. + + If a work experience filter isn't specified, + profiles with any professional experience are + retrieved. + + If multiple work experience filters are + specified, profiles that match any work + experience filters are retrieved. + + For example, search for profiles with 10 years + of work experience. + time_filters (Sequence[~.filters.TimeFilter]): + Time filter specifies the create/update + timestamp of the profiles to match on. + + For example, search for profiles created since + "2018-1-1". + hirable_filter (~.wrappers.BoolValue): + The hirable filter specifies the profile's + hirable status to match on. + application_date_filters (Sequence[~.filters.ApplicationDateFilter]): + The application date filters specify + application date ranges to match on. + application_outcome_notes_filters (Sequence[~.filters.ApplicationOutcomeNotesFilter]): + The application outcome notes filters specify + the notes for the outcome of the job + application. + application_job_filters (Sequence[~.filters.ApplicationJobFilter]): + The application job filters specify the job + applied for in the application. + custom_attribute_filter (str): + This filter specifies a structured syntax to match against + the + [Profile.custom_attributes][google.cloud.talent.v4beta1.Profile.custom_attributes] + that are marked as ``filterable``. + + The syntax for this expression is a subset of Google SQL + syntax. + + String custom attributes: supported operators are =, != + where the left of the operator is a custom field key and the + right of the operator is a string (surrounded by quotes) + value. + + Numeric custom attributes: Supported operators are '>', '<' + or '=' operators where the left of the operator is a custom + field key and the right of the operator is a numeric value. + + Supported functions are LOWER() to perform case + insensitive match and EMPTY() to filter on the + existence of a key. + + Boolean expressions (AND/OR/NOT) are supported up to 3 + levels of nesting (for example "((A AND B AND C) OR NOT D) + AND E"), and there can be a maximum of 50 + comparisons/functions in the expression. The expression must + be < 2000 characters in length. + + Sample Query: (key1 = "TEST" OR LOWER(key1)="test" OR NOT + EMPTY(key1)) + candidate_availability_filter (~.filters.CandidateAvailabilityFilter): + Deprecated. Use availability_filters instead. + + The candidate availability filter which filters based on + availability signals. + + Signal 1: Number of days since most recent job application. + See + [Availability.JobApplicationAvailabilitySignal][google.cloud.talent.v4beta1.Availability.JobApplicationAvailabilitySignal] + for the details of this signal. + + Signal 2: Number of days since last profile update. See + [Availability.ProfileUpdateAvailabilitySignal][google.cloud.talent.v4beta1.Availability.ProfileUpdateAvailabilitySignal] + for the details of this signal. + + The candidate availability filter helps a recruiter + understand if a specific candidate is likely to be actively + seeking new job opportunities based on an aggregated set of + signals. Specifically, the intent is NOT to indicate the + candidate's potential qualification / interest / close + ability for a specific job. + availability_filters (Sequence[~.filters.AvailabilityFilter]): + The availability filter which filters based on + [Profile.availability_signals][google.cloud.talent.v4beta1.Profile.availability_signals]. + + The availability filter helps a recruiter understand if a + specific candidate is likely to be actively seeking new job + opportunities based on an aggregated set of signals. + Specifically, the intent is NOT to indicate the candidate's + potential qualification / interest / close ability for a + specific job. + + There can be at most one + [AvailabilityFilter][google.cloud.talent.v4beta1.AvailabilityFilter] + per + [signal_type][google.cloud.talent.v4beta1.AvailabilityFilter.signal_type]. + If there are multiple + [AvailabilityFilter][google.cloud.talent.v4beta1.AvailabilityFilter] + for a + [signal_type][google.cloud.talent.v4beta1.AvailabilityFilter.signal_type], + an error is thrown. + person_name_filters (Sequence[~.filters.PersonNameFilter]): + Person name filter specifies person name of + profiles to match on. + If multiple person name filters are specified, + profiles that match any person name filters are + retrieved. + + For example, search for profiles of candidates + with name "John Smith". + """ + + query = proto.Field(proto.STRING, number=1) + + location_filters = proto.RepeatedField( + proto.MESSAGE, number=2, message="LocationFilter", + ) + + job_title_filters = proto.RepeatedField( + proto.MESSAGE, number=3, message="JobTitleFilter", + ) + + employer_filters = proto.RepeatedField( + proto.MESSAGE, number=4, message="EmployerFilter", + ) + + education_filters = proto.RepeatedField( + proto.MESSAGE, number=5, message="EducationFilter", + ) + + skill_filters = proto.RepeatedField(proto.MESSAGE, number=6, message="SkillFilter",) + + work_experience_filter = proto.RepeatedField( + proto.MESSAGE, number=7, message="WorkExperienceFilter", + ) + + time_filters = proto.RepeatedField(proto.MESSAGE, number=8, message="TimeFilter",) + + hirable_filter = proto.Field(proto.MESSAGE, number=9, message=wrappers.BoolValue,) + + application_date_filters = proto.RepeatedField( + proto.MESSAGE, number=10, message="ApplicationDateFilter", + ) + + application_outcome_notes_filters = proto.RepeatedField( + proto.MESSAGE, number=11, message="ApplicationOutcomeNotesFilter", + ) + + application_job_filters = proto.RepeatedField( + proto.MESSAGE, number=13, message="ApplicationJobFilter", + ) + + custom_attribute_filter = proto.Field(proto.STRING, number=15) + + candidate_availability_filter = proto.Field( + proto.MESSAGE, number=16, message="CandidateAvailabilityFilter", + ) + + availability_filters = proto.RepeatedField( + proto.MESSAGE, number=18, message="AvailabilityFilter", + ) + + person_name_filters = proto.RepeatedField( + proto.MESSAGE, number=17, message="PersonNameFilter", + ) + + +class LocationFilter(proto.Message): + r"""Geographic region of the search. + + Attributes: + address (str): + The address name, such as "Mountain View" or + "Bay Area". + region_code (str): + CLDR region code of the country/region of the address. This + is used to address ambiguity of the user-input location, for + example, "Liverpool" against "Liverpool, NY, US" or + "Liverpool, UK". + + Set this field to bias location resolution toward a specific + country or territory. If this field is not set, application + behavior is biased toward the United States by default. + + See + https://www.unicode.org/cldr/charts/30/supplemental/territory_information.html + for details. Example: "CH" for Switzerland. Note that this + filter is not applicable for Profile Search related queries. + lat_lng (~.latlng.LatLng): + The latitude and longitude of the geographic center to + search from. This field is ignored if ``address`` is + provided. + distance_in_miles (float): + The distance_in_miles is applied when the location being + searched for is identified as a city or smaller. This field + is ignored if the location being searched for is a state or + larger. + telecommute_preference (~.filters.LocationFilter.TelecommutePreference): + Allows the client to return jobs without a set location, + specifically, telecommuting jobs (telecommuting is + considered by the service as a special location. + [Job.posting_region][google.cloud.talent.v4beta1.Job.posting_region] + indicates if a job permits telecommuting. If this field is + set to + [TelecommutePreference.TELECOMMUTE_ALLOWED][google.cloud.talent.v4beta1.LocationFilter.TelecommutePreference.TELECOMMUTE_ALLOWED], + telecommuting jobs are searched, and + [address][google.cloud.talent.v4beta1.LocationFilter.address] + and + [lat_lng][google.cloud.talent.v4beta1.LocationFilter.lat_lng] + are ignored. If not set or set to + [TelecommutePreference.TELECOMMUTE_EXCLUDED][google.cloud.talent.v4beta1.LocationFilter.TelecommutePreference.TELECOMMUTE_EXCLUDED], + telecommute job are not searched. + + This filter can be used by itself to search exclusively for + telecommuting jobs, or it can be combined with another + location filter to search for a combination of job + locations, such as "Mountain View" or "telecommuting" jobs. + However, when used in combination with other location + filters, telecommuting jobs can be treated as less relevant + than other jobs in the search response. + + This field is only used for job search requests. + negated (bool): + Whether to apply negation to the filter so + profiles matching the filter are excluded. + + Currently only supported in profile search. + """ + + class TelecommutePreference(proto.Enum): + r"""Specify whether to include telecommute jobs.""" + TELECOMMUTE_PREFERENCE_UNSPECIFIED = 0 + TELECOMMUTE_EXCLUDED = 1 + TELECOMMUTE_ALLOWED = 2 + + address = proto.Field(proto.STRING, number=1) + + region_code = proto.Field(proto.STRING, number=2) + + lat_lng = proto.Field(proto.MESSAGE, number=3, message=latlng.LatLng,) + + distance_in_miles = proto.Field(proto.DOUBLE, number=4) + + telecommute_preference = proto.Field( + proto.ENUM, number=5, enum=TelecommutePreference, + ) + + negated = proto.Field(proto.BOOL, number=6) + + +class CompensationFilter(proto.Message): + r"""Filter on job compensation type and amount. + + Attributes: + type (~.filters.CompensationFilter.FilterType): + Required. Type of filter. + units (Sequence[~.common.CompensationInfo.CompensationUnit]): + Required. Specify desired ``base compensation entry's`` + [CompensationInfo.CompensationUnit][google.cloud.talent.v4beta1.CompensationInfo.CompensationUnit]. + range (~.common.CompensationInfo.CompensationRange): + Compensation range. + include_jobs_with_unspecified_compensation_range (bool): + If set to true, jobs with unspecified + compensation range fields are included. + """ + + class FilterType(proto.Enum): + r"""Specify the type of filtering.""" + FILTER_TYPE_UNSPECIFIED = 0 + UNIT_ONLY = 1 + UNIT_AND_AMOUNT = 2 + ANNUALIZED_BASE_AMOUNT = 3 + ANNUALIZED_TOTAL_AMOUNT = 4 + + type = proto.Field(proto.ENUM, number=1, enum=FilterType,) + + units = proto.RepeatedField( + proto.ENUM, number=2, enum=common.CompensationInfo.CompensationUnit, + ) + + range = proto.Field( + proto.MESSAGE, number=3, message=common.CompensationInfo.CompensationRange, + ) + + include_jobs_with_unspecified_compensation_range = proto.Field(proto.BOOL, number=4) + + +class CommuteFilter(proto.Message): + r"""Parameters needed for commute search. + + Attributes: + commute_method (~.common.CommuteMethod): + Required. The method of transportation to + calculate the commute time for. + start_coordinates (~.latlng.LatLng): + Required. The latitude and longitude of the + location to calculate the commute time from. + travel_duration (~.duration.Duration): + Required. The maximum travel time in seconds. The maximum + allowed value is ``3600s`` (one hour). Format is ``123s``. + allow_imprecise_addresses (bool): + If ``true``, jobs without street level addresses may also be + returned. For city level addresses, the city center is used. + For state and coarser level addresses, text matching is + used. If this field is set to ``false`` or isn't specified, + only jobs that include street level addresses will be + returned by commute search. + road_traffic (~.filters.CommuteFilter.RoadTraffic): + Specifies the traffic density to use when + calculating commute time. + departure_time (~.timeofday.TimeOfDay): + The departure time used to calculate traffic impact, + represented as + [google.type.TimeOfDay][google.type.TimeOfDay] in local time + zone. + + Currently traffic model is restricted to hour level + resolution. + """ + + class RoadTraffic(proto.Enum): + r"""The traffic density to use when calculating commute time.""" + ROAD_TRAFFIC_UNSPECIFIED = 0 + TRAFFIC_FREE = 1 + BUSY_HOUR = 2 + + commute_method = proto.Field(proto.ENUM, number=1, enum=common.CommuteMethod,) + + start_coordinates = proto.Field(proto.MESSAGE, number=2, message=latlng.LatLng,) + + travel_duration = proto.Field(proto.MESSAGE, number=3, message=duration.Duration,) + + allow_imprecise_addresses = proto.Field(proto.BOOL, number=4) + + road_traffic = proto.Field( + proto.ENUM, number=5, oneof="traffic_option", enum=RoadTraffic, + ) + + departure_time = proto.Field( + proto.MESSAGE, number=6, oneof="traffic_option", message=timeofday.TimeOfDay, + ) + + +class JobTitleFilter(proto.Message): + r"""Job title of the search. + + Attributes: + job_title (str): + Required. The job title. For example, + "Software engineer", or "Product manager". + negated (bool): + Whether to apply negation to the filter so + profiles matching the filter are excluded. + """ + + job_title = proto.Field(proto.STRING, number=1) + + negated = proto.Field(proto.BOOL, number=2) + + +class SkillFilter(proto.Message): + r"""Skill filter of the search. + + Attributes: + skill (str): + Required. The skill name. For example, + "java", "j2ee", and so on. + negated (bool): + Whether to apply negation to the filter so + profiles matching the filter are excluded. + """ + + skill = proto.Field(proto.STRING, number=1) + + negated = proto.Field(proto.BOOL, number=2) + + +class EmployerFilter(proto.Message): + r"""Employer filter of the search. + + Attributes: + employer (str): + Required. The name of the employer, for + example "Google", "Alphabet". + mode (~.filters.EmployerFilter.EmployerFilterMode): + Define set of + [EmploymentRecord][google.cloud.talent.v4beta1.EmploymentRecord]s + to search against. + + Defaults to + [EmployerFilterMode.ALL_EMPLOYMENT_RECORDS][google.cloud.talent.v4beta1.EmployerFilter.EmployerFilterMode.ALL_EMPLOYMENT_RECORDS]. + negated (bool): + Whether to apply negation to the filter so + profiles matching the filter is excluded. + """ + + class EmployerFilterMode(proto.Enum): + r"""Enum indicating which set of + [Profile.employment_records][google.cloud.talent.v4beta1.Profile.employment_records] + to search against. + """ + EMPLOYER_FILTER_MODE_UNSPECIFIED = 0 + ALL_EMPLOYMENT_RECORDS = 1 + CURRENT_EMPLOYMENT_RECORDS_ONLY = 2 + PAST_EMPLOYMENT_RECORDS_ONLY = 3 + + employer = proto.Field(proto.STRING, number=1) + + mode = proto.Field(proto.ENUM, number=2, enum=EmployerFilterMode,) + + negated = proto.Field(proto.BOOL, number=3) + + +class EducationFilter(proto.Message): + r"""Education filter of the search. + + Attributes: + school (str): + The school name. For example "MIT", + "University of California, Berkeley". + field_of_study (str): + The field of study. This is to search against value provided + in + [Degree.fields_of_study][google.cloud.talent.v4beta1.Degree.fields_of_study]. + For example "Computer Science", "Mathematics". + degree_type (~.common.DegreeType): + Education degree in ISCED code. Each value in + degree covers a specific level of education, + without any expansion to upper nor lower levels + of education degree. + negated (bool): + Whether to apply negation to the filter so + profiles matching the filter is excluded. + """ + + school = proto.Field(proto.STRING, number=1) + + field_of_study = proto.Field(proto.STRING, number=2) + + degree_type = proto.Field(proto.ENUM, number=3, enum=common.DegreeType,) + + negated = proto.Field(proto.BOOL, number=6) + + +class WorkExperienceFilter(proto.Message): + r"""Work experience filter. + + This filter is used to search for profiles with working experience + length between + [min_experience][google.cloud.talent.v4beta1.WorkExperienceFilter.min_experience] + and + [max_experience][google.cloud.talent.v4beta1.WorkExperienceFilter.max_experience]. + + Attributes: + min_experience (~.duration.Duration): + The minimum duration of the work experience + (inclusive). + max_experience (~.duration.Duration): + The maximum duration of the work experience + (exclusive). + """ + + min_experience = proto.Field(proto.MESSAGE, number=1, message=duration.Duration,) + + max_experience = proto.Field(proto.MESSAGE, number=2, message=duration.Duration,) + + +class ApplicationDateFilter(proto.Message): + r"""Application Date Range Filter. + + The API matches profiles with + [Application.application_date][google.cloud.talent.v4beta1.Application.application_date] + between start date and end date (both boundaries are inclusive). The + filter is ignored if both + [start_date][google.cloud.talent.v4beta1.ApplicationDateFilter.start_date] + and + [end_date][google.cloud.talent.v4beta1.ApplicationDateFilter.end_date] + are missing. + + Attributes: + start_date (~.date.Date): + Start date. If it's missing, The API matches + profiles with application date not after the end + date. + end_date (~.date.Date): + End date. If it's missing, The API matches + profiles with application date not before the + start date. + """ + + start_date = proto.Field(proto.MESSAGE, number=1, message=date.Date,) + + end_date = proto.Field(proto.MESSAGE, number=2, message=date.Date,) + + +class ApplicationOutcomeNotesFilter(proto.Message): + r"""Outcome Notes Filter. + + Attributes: + outcome_notes (str): + Required. User entered or selected outcome reason. The API + does an exact match on the + [Application.outcome_notes][google.cloud.talent.v4beta1.Application.outcome_notes] + in profiles. + negated (bool): + If true, The API excludes all candidates with any + [Application.outcome_notes][google.cloud.talent.v4beta1.Application.outcome_notes] + matching the outcome reason specified in the filter. + """ + + outcome_notes = proto.Field(proto.STRING, number=1) + + negated = proto.Field(proto.BOOL, number=2) + + +class ApplicationJobFilter(proto.Message): + r"""Filter on the job information of Application. + + Attributes: + job_requisition_id (str): + The job requisition id in the application. The API does an + exact match on the + [Job.requisition_id][google.cloud.talent.v4beta1.Job.requisition_id] + of + [Application.job][google.cloud.talent.v4beta1.Application.job] + in profiles. + job_title (str): + The job title in the application. The API does an exact + match on the + [Job.title][google.cloud.talent.v4beta1.Job.title] of + [Application.job][google.cloud.talent.v4beta1.Application.job] + in profiles. + negated (bool): + If true, the API excludes all profiles with any + [Application.job][google.cloud.talent.v4beta1.Application.job] + matching the filters. + """ + + job_requisition_id = proto.Field(proto.STRING, number=2) + + job_title = proto.Field(proto.STRING, number=3) + + negated = proto.Field(proto.BOOL, number=4) + + +class TimeFilter(proto.Message): + r"""Filter on create timestamp or update timestamp of profiles. + + Attributes: + start_time (~.timestamp.Timestamp): + Start timestamp, matching profiles with the + start time. If this field missing, The API + matches profiles with create / update timestamp + before the end timestamp. + end_time (~.timestamp.Timestamp): + End timestamp, matching profiles with the end + time. If this field missing, The API matches + profiles with create / update timestamp after + the start timestamp. + time_field (~.filters.TimeFilter.TimeField): + Specifies which time field to filter profiles. + + Defaults to + [TimeField.CREATE_TIME][google.cloud.talent.v4beta1.TimeFilter.TimeField.CREATE_TIME]. + """ + + class TimeField(proto.Enum): + r"""Time fields can be used in TimeFilter.""" + TIME_FIELD_UNSPECIFIED = 0 + CREATE_TIME = 1 + UPDATE_TIME = 2 + + start_time = proto.Field(proto.MESSAGE, number=1, message=timestamp.Timestamp,) + + end_time = proto.Field(proto.MESSAGE, number=2, message=timestamp.Timestamp,) + + time_field = proto.Field(proto.ENUM, number=3, enum=TimeField,) + + +class CandidateAvailabilityFilter(proto.Message): + r"""Deprecated. Use AvailabilityFilter instead. + Filter on availability signals. + + Attributes: + negated (bool): + It is false by default. If true, API excludes + all the potential available profiles. + """ + + negated = proto.Field(proto.BOOL, number=1) + + +class AvailabilityFilter(proto.Message): + r"""Filter on availability signals. + + Attributes: + signal_type (~.common.AvailabilitySignalType): + Required. Type of signal to apply filter on. + range (~.common.TimestampRange): + Required. Range of times to filter candidate + signals by. + required (bool): + If multiple + [AvailabilityFilter][google.cloud.talent.v4beta1.AvailabilityFilter] + are provided, the default behavior is to OR all filters, but + if this field is set to true, this particular + [AvailabilityFilter][google.cloud.talent.v4beta1.AvailabilityFilter] + will be AND'ed against other + [AvailabilityFilter][google.cloud.talent.v4beta1.AvailabilityFilter]. + """ + + signal_type = proto.Field(proto.ENUM, number=1, enum=common.AvailabilitySignalType,) + + range = proto.Field(proto.MESSAGE, number=2, message=common.TimestampRange,) + + required = proto.Field(proto.BOOL, number=3) + + +class PersonNameFilter(proto.Message): + r"""Filter on person name. + + Attributes: + person_name (str): + Required. The person name. For example, "John Smith". + + Can be any combination of + [PersonName.structured_name.given_name][], + [PersonName.structured_name.middle_initial][], + [PersonName.structured_name.family_name][], and + [PersonName.formatted_name][google.cloud.talent.v4beta1.PersonName.formatted_name]. + """ + + person_name = proto.Field(proto.STRING, number=1) + + +__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/cloud/talent_v4beta1/types/histogram.py b/google/cloud/talent_v4beta1/types/histogram.py new file mode 100644 index 00000000..6c72e53e --- /dev/null +++ b/google/cloud/talent_v4beta1/types/histogram.py @@ -0,0 +1,74 @@ +# -*- 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. +# + +import proto # type: ignore + + +__protobuf__ = proto.module( + package="google.cloud.talent.v4beta1", + manifest={"HistogramQuery", "HistogramQueryResult",}, +) + + +class HistogramQuery(proto.Message): + r"""The histogram request. + + Attributes: + histogram_query (str): + An expression specifies a histogram request against matching + resources (for example, jobs, profiles) for searches. + + See + [SearchJobsRequest.histogram_queries][google.cloud.talent.v4beta1.SearchJobsRequest.histogram_queries] + and + [SearchProfilesRequest.histogram_queries][google.cloud.talent.v4beta1.SearchProfilesRequest.histogram_queries] + for details about syntax. + """ + + histogram_query = proto.Field(proto.STRING, number=1) + + +class HistogramQueryResult(proto.Message): + r"""Histogram result that matches + [HistogramQuery][google.cloud.talent.v4beta1.HistogramQuery] + specified in searches. + + Attributes: + histogram_query (str): + Requested histogram expression. + histogram (Sequence[~.gct_histogram.HistogramQueryResult.HistogramEntry]): + A map from the values of the facet associated with distinct + values to the number of matching entries with corresponding + value. + + The key format is: + + - (for string histogram) string values stored in the field. + - (for named numeric bucket) name specified in ``bucket()`` + function, like for ``bucket(0, MAX, "non-negative")``, + the key will be ``non-negative``. + - (for anonymous numeric bucket) range formatted as + ``-``, for example, ``0-1000``, ``MIN-0``, and + ``0-MAX``. + """ + + histogram_query = proto.Field(proto.STRING, number=1) + + histogram = proto.MapField(proto.STRING, proto.INT64, number=2) + + +__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/cloud/talent_v4beta1/types/job.py b/google/cloud/talent_v4beta1/types/job.py new file mode 100644 index 00000000..147fbe55 --- /dev/null +++ b/google/cloud/talent_v4beta1/types/job.py @@ -0,0 +1,488 @@ +# -*- 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. +# + +import proto # type: ignore + + +from google.cloud.talent_v4beta1.types import common +from google.protobuf import timestamp_pb2 as timestamp # type: ignore + + +__protobuf__ = proto.module(package="google.cloud.talent.v4beta1", manifest={"Job",},) + + +class Job(proto.Message): + r"""A Job resource represents a job posting (also referred to as a "job + listing" or "job requisition"). A job belongs to a + [Company][google.cloud.talent.v4beta1.Company], which is the hiring + entity responsible for the job. + + Attributes: + name (str): + Required during job update. + + The resource name for the job. This is generated by the + service when a job is created. + + The format is + "projects/{project_id}/tenants/{tenant_id}/jobs/{job_id}". + For example, "projects/foo/tenants/bar/jobs/baz". + + If tenant id is unspecified, the default tenant is used. For + example, "projects/foo/jobs/bar". + + Use of this field in job queries and API calls is preferred + over the use of + [requisition_id][google.cloud.talent.v4beta1.Job.requisition_id] + since this value is unique. + company (str): + Required. The resource name of the company listing the job. + + The format is + "projects/{project_id}/tenants/{tenant_id}/companies/{company_id}". + For example, "projects/foo/tenants/bar/companies/baz". + + If tenant id is unspecified, the default tenant is used. For + example, "projects/foo/companies/bar". + requisition_id (str): + Required. The requisition ID, also referred to as the + posting ID, is assigned by the client to identify a job. + This field is intended to be used by clients for client + identification and tracking of postings. A job isn't allowed + to be created if there is another job with the same + [company][google.cloud.talent.v4beta1.Job.name], + [language_code][google.cloud.talent.v4beta1.Job.language_code] + and + [requisition_id][google.cloud.talent.v4beta1.Job.requisition_id]. + + The maximum number of allowed characters is 255. + title (str): + Required. The title of the job, such as + "Software Engineer" + The maximum number of allowed characters is 500. + description (str): + Required. The description of the job, which typically + includes a multi-paragraph description of the company and + related information. Separate fields are provided on the job + object for + [responsibilities][google.cloud.talent.v4beta1.Job.responsibilities], + [qualifications][google.cloud.talent.v4beta1.Job.qualifications], + and other job characteristics. Use of these separate job + fields is recommended. + + This field accepts and sanitizes HTML input, and also + accepts bold, italic, ordered list, and unordered list + markup tags. + + The maximum number of allowed characters is 100,000. + addresses (Sequence[str]): + Strongly recommended for the best service experience. + + Location(s) where the employer is looking to hire for this + job posting. + + Specifying the full street address(es) of the hiring + location enables better API results, especially job searches + by commute time. + + At most 50 locations are allowed for best search + performance. If a job has more locations, it is suggested to + split it into multiple jobs with unique + [requisition_id][google.cloud.talent.v4beta1.Job.requisition_id]s + (e.g. 'ReqA' becomes 'ReqA-1', 'ReqA-2', and so on.) as + multiple jobs with the same + [company][google.cloud.talent.v4beta1.Job.company], + [language_code][google.cloud.talent.v4beta1.Job.language_code] + and + [requisition_id][google.cloud.talent.v4beta1.Job.requisition_id] + are not allowed. If the original + [requisition_id][google.cloud.talent.v4beta1.Job.requisition_id] + must be preserved, a custom field should be used for + storage. It is also suggested to group the locations that + close to each other in the same job for better search + experience. + + The maximum number of allowed characters is 500. + application_info (~.job.Job.ApplicationInfo): + Job application information. + job_benefits (Sequence[~.common.JobBenefit]): + The benefits included with the job. + compensation_info (~.common.CompensationInfo): + Job compensation information (a.k.a. "pay + rate") i.e., the compensation that will paid to + the employee. + custom_attributes (Sequence[~.job.Job.CustomAttributesEntry]): + A map of fields to hold both filterable and non-filterable + custom job attributes that are not covered by the provided + structured fields. + + The keys of the map are strings up to 64 bytes and must + match the pattern: [a-zA-Z][a-zA-Z0-9\_]*. For example, + key0LikeThis or KEY_1_LIKE_THIS. + + At most 100 filterable and at most 100 unfilterable keys are + supported. For filterable ``string_values``, across all keys + at most 200 values are allowed, with each string no more + than 255 characters. For unfilterable ``string_values``, the + maximum total size of ``string_values`` across all keys is + 50KB. + degree_types (Sequence[~.common.DegreeType]): + The desired education degrees for the job, + such as Bachelors, Masters. + department (str): + The department or functional area within the + company with the open position. + + The maximum number of allowed characters is 255. + employment_types (Sequence[~.common.EmploymentType]): + The employment type(s) of a job, for example, [full + time][google.cloud.talent.v4beta1.EmploymentType.FULL_TIME] + or [part + time][google.cloud.talent.v4beta1.EmploymentType.PART_TIME]. + incentives (str): + A description of bonus, commission, and other + compensation incentives associated with the job + not including salary or pay. + The maximum number of allowed characters is + 10,000. + language_code (str): + The language of the posting. This field is distinct from any + requirements for fluency that are associated with the job. + + Language codes must be in BCP-47 format, such as "en-US" or + "sr-Latn". For more information, see `Tags for Identifying + Languages `__\ {: + class="external" target="_blank" }. + + If this field is unspecified and + [Job.description][google.cloud.talent.v4beta1.Job.description] + is present, detected language code based on + [Job.description][google.cloud.talent.v4beta1.Job.description] + is assigned, otherwise defaults to 'en_US'. + job_level (~.common.JobLevel): + The experience level associated with the job, + such as "Entry Level". + promotion_value (int): + A promotion value of the job, as determined by the client. + The value determines the sort order of the jobs returned + when searching for jobs using the featured jobs search call, + with higher promotional values being returned first and ties + being resolved by relevance sort. Only the jobs with a + promotionValue >0 are returned in a FEATURED_JOB_SEARCH. + + Default value is 0, and negative values are treated as 0. + qualifications (str): + A description of the qualifications required to perform the + job. The use of this field is recommended as an alternative + to using the more general + [description][google.cloud.talent.v4beta1.Job.description] + field. + + This field accepts and sanitizes HTML input, and also + accepts bold, italic, ordered list, and unordered list + markup tags. + + The maximum number of allowed characters is 10,000. + responsibilities (str): + A description of job responsibilities. The use of this field + is recommended as an alternative to using the more general + [description][google.cloud.talent.v4beta1.Job.description] + field. + + This field accepts and sanitizes HTML input, and also + accepts bold, italic, ordered list, and unordered list + markup tags. + + The maximum number of allowed characters is 10,000. + posting_region (~.common.PostingRegion): + The job + [PostingRegion][google.cloud.talent.v4beta1.PostingRegion] + (for example, state, country) throughout which the job is + available. If this field is set, a + [LocationFilter][google.cloud.talent.v4beta1.LocationFilter] + in a search query within the job region finds this job + posting if an exact location match isn't specified. If this + field is set to + [PostingRegion.NATION][google.cloud.talent.v4beta1.PostingRegion.NATION] + or + [PostingRegion.ADMINISTRATIVE_AREA][google.cloud.talent.v4beta1.PostingRegion.ADMINISTRATIVE_AREA], + setting job + [Job.addresses][google.cloud.talent.v4beta1.Job.addresses] + to the same location level as this field is strongly + recommended. + visibility (~.common.Visibility): + Deprecated. The job is only visible to the owner. + + The visibility of the job. + + Defaults to + [Visibility.ACCOUNT_ONLY][google.cloud.talent.v4beta1.Visibility.ACCOUNT_ONLY] + if not specified. + job_start_time (~.timestamp.Timestamp): + The start timestamp of the job in UTC time + zone. Typically this field is used for + contracting engagements. Invalid timestamps are + ignored. + job_end_time (~.timestamp.Timestamp): + The end timestamp of the job. Typically this + field is used for contracting engagements. + Invalid timestamps are ignored. + posting_publish_time (~.timestamp.Timestamp): + The timestamp this job posting was most + recently published. The default value is the + time the request arrives at the server. Invalid + timestamps are ignored. + posting_expire_time (~.timestamp.Timestamp): + Strongly recommended for the best service experience. + + The expiration timestamp of the job. After this timestamp, + the job is marked as expired, and it no longer appears in + search results. The expired job can't be listed by the + [ListJobs][google.cloud.talent.v4beta1.JobService.ListJobs] + API, but it can be retrieved with the + [GetJob][google.cloud.talent.v4beta1.JobService.GetJob] API + or updated with the + [UpdateJob][google.cloud.talent.v4beta1.JobService.UpdateJob] + API or deleted with the + [DeleteJob][google.cloud.talent.v4beta1.JobService.DeleteJob] + API. An expired job can be updated and opened again by using + a future expiration timestamp. Updating an expired job fails + if there is another existing open job with same + [company][google.cloud.talent.v4beta1.Job.company], + [language_code][google.cloud.talent.v4beta1.Job.language_code] + and + [requisition_id][google.cloud.talent.v4beta1.Job.requisition_id]. + + The expired jobs are retained in our system for 90 days. + However, the overall expired job count cannot exceed 3 times + the maximum number of open jobs over previous 7 days. If + this threshold is exceeded, expired jobs are cleaned out in + order of earliest expire time. Expired jobs are no longer + accessible after they are cleaned out. + + Invalid timestamps are ignored, and treated as expire time + not provided. + + If the timestamp is before the instant request is made, the + job is treated as expired immediately on creation. This kind + of job can not be updated. And when creating a job with past + timestamp, the + [posting_publish_time][google.cloud.talent.v4beta1.Job.posting_publish_time] + must be set before + [posting_expire_time][google.cloud.talent.v4beta1.Job.posting_expire_time]. + The purpose of this feature is to allow other objects, such + as [Application][google.cloud.talent.v4beta1.Application], + to refer a job that didn't exist in the system prior to + becoming expired. If you want to modify a job that was + expired on creation, delete it and create a new one. + + If this value isn't provided at the time of job creation or + is invalid, the job posting expires after 30 days from the + job's creation time. For example, if the job was created on + 2017/01/01 13:00AM UTC with an unspecified expiration date, + the job expires after 2017/01/31 13:00AM UTC. + + If this value isn't provided on job update, it depends on + the field masks set by + [UpdateJobRequest.update_mask][google.cloud.talent.v4beta1.UpdateJobRequest.update_mask]. + If the field masks include + [job_end_time][google.cloud.talent.v4beta1.Job.job_end_time], + or the masks are empty meaning that every field is updated, + the job posting expires after 30 days from the job's last + update time. Otherwise the expiration date isn't updated. + posting_create_time (~.timestamp.Timestamp): + Output only. The timestamp when this job + posting was created. + posting_update_time (~.timestamp.Timestamp): + Output only. The timestamp when this job + posting was last updated. + company_display_name (str): + Output only. Display name of the company + listing the job. + derived_info (~.job.Job.DerivedInfo): + Output only. Derived details about the job + posting. + processing_options (~.job.Job.ProcessingOptions): + Options for job processing. + """ + + class ApplicationInfo(proto.Message): + r"""Application related details of a job posting. + + Attributes: + emails (Sequence[str]): + Use this field to specify email address(es) + to which resumes or applications can be sent. + The maximum number of allowed characters for + each entry is 255. + instruction (str): + Use this field to provide instructions, such + as "Mail your application to ...", that a + candidate can follow to apply for the job. + This field accepts and sanitizes HTML input, and + also accepts bold, italic, ordered list, and + unordered list markup tags. + The maximum number of allowed characters is + 3,000. + uris (Sequence[str]): + Use this URI field to direct an applicant to + a website, for example to link to an online + application form. + The maximum number of allowed characters for + each entry is 2,000. + """ + + emails = proto.RepeatedField(proto.STRING, number=1) + + instruction = proto.Field(proto.STRING, number=2) + + uris = proto.RepeatedField(proto.STRING, number=3) + + class DerivedInfo(proto.Message): + r"""Derived details about the job posting. + + Attributes: + locations (Sequence[~.common.Location]): + Structured locations of the job, resolved from + [Job.addresses][google.cloud.talent.v4beta1.Job.addresses]. + + [locations][google.cloud.talent.v4beta1.Job.DerivedInfo.locations] + are exactly matched to + [Job.addresses][google.cloud.talent.v4beta1.Job.addresses] + in the same order. + job_categories (Sequence[~.common.JobCategory]): + Job categories derived from + [Job.title][google.cloud.talent.v4beta1.Job.title] and + [Job.description][google.cloud.talent.v4beta1.Job.description]. + """ + + locations = proto.RepeatedField( + proto.MESSAGE, number=1, message=common.Location, + ) + + job_categories = proto.RepeatedField( + proto.ENUM, number=3, enum=common.JobCategory, + ) + + class ProcessingOptions(proto.Message): + r"""Options for job processing. + + Attributes: + disable_street_address_resolution (bool): + If set to ``true``, the service does not attempt to resolve + a more precise address for the job. + html_sanitization (~.common.HtmlSanitization): + Option for job HTML content sanitization. Applied fields + are: + + - description + - applicationInfo.instruction + - incentives + - qualifications + - responsibilities + + HTML tags in these fields may be stripped if sanitiazation + isn't disabled. + + Defaults to + [HtmlSanitization.SIMPLE_FORMATTING_ONLY][google.cloud.talent.v4beta1.HtmlSanitization.SIMPLE_FORMATTING_ONLY]. + """ + + disable_street_address_resolution = proto.Field(proto.BOOL, number=1) + + html_sanitization = proto.Field( + proto.ENUM, number=2, enum=common.HtmlSanitization, + ) + + name = proto.Field(proto.STRING, number=1) + + company = proto.Field(proto.STRING, number=2) + + requisition_id = proto.Field(proto.STRING, number=3) + + title = proto.Field(proto.STRING, number=4) + + description = proto.Field(proto.STRING, number=5) + + addresses = proto.RepeatedField(proto.STRING, number=6) + + application_info = proto.Field(proto.MESSAGE, number=7, message=ApplicationInfo,) + + job_benefits = proto.RepeatedField(proto.ENUM, number=8, enum=common.JobBenefit,) + + compensation_info = proto.Field( + proto.MESSAGE, number=9, message=common.CompensationInfo, + ) + + custom_attributes = proto.MapField( + proto.STRING, proto.MESSAGE, number=10, message=common.CustomAttribute, + ) + + degree_types = proto.RepeatedField(proto.ENUM, number=11, enum=common.DegreeType,) + + department = proto.Field(proto.STRING, number=12) + + employment_types = proto.RepeatedField( + proto.ENUM, number=13, enum=common.EmploymentType, + ) + + incentives = proto.Field(proto.STRING, number=14) + + language_code = proto.Field(proto.STRING, number=15) + + job_level = proto.Field(proto.ENUM, number=16, enum=common.JobLevel,) + + promotion_value = proto.Field(proto.INT32, number=17) + + qualifications = proto.Field(proto.STRING, number=18) + + responsibilities = proto.Field(proto.STRING, number=19) + + posting_region = proto.Field(proto.ENUM, number=20, enum=common.PostingRegion,) + + visibility = proto.Field(proto.ENUM, number=21, enum=common.Visibility,) + + job_start_time = proto.Field(proto.MESSAGE, number=22, message=timestamp.Timestamp,) + + job_end_time = proto.Field(proto.MESSAGE, number=23, message=timestamp.Timestamp,) + + posting_publish_time = proto.Field( + proto.MESSAGE, number=24, message=timestamp.Timestamp, + ) + + posting_expire_time = proto.Field( + proto.MESSAGE, number=25, message=timestamp.Timestamp, + ) + + posting_create_time = proto.Field( + proto.MESSAGE, number=26, message=timestamp.Timestamp, + ) + + posting_update_time = proto.Field( + proto.MESSAGE, number=27, message=timestamp.Timestamp, + ) + + company_display_name = proto.Field(proto.STRING, number=28) + + derived_info = proto.Field(proto.MESSAGE, number=29, message=DerivedInfo,) + + processing_options = proto.Field( + proto.MESSAGE, number=30, message=ProcessingOptions, + ) + + +__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/cloud/talent_v4beta1/types/job_service.py b/google/cloud/talent_v4beta1/types/job_service.py new file mode 100644 index 00000000..5cad2836 --- /dev/null +++ b/google/cloud/talent_v4beta1/types/job_service.py @@ -0,0 +1,934 @@ +# -*- 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. +# + +import proto # type: ignore + + +from google.cloud.talent_v4beta1.types import common +from google.cloud.talent_v4beta1.types import filters +from google.cloud.talent_v4beta1.types import histogram +from google.cloud.talent_v4beta1.types import job as gct_job +from google.protobuf import duration_pb2 as duration # type: ignore +from google.protobuf import field_mask_pb2 as field_mask # type: ignore +from google.rpc import status_pb2 as gr_status # type: ignore + + +__protobuf__ = proto.module( + package="google.cloud.talent.v4beta1", + manifest={ + "JobView", + "CreateJobRequest", + "GetJobRequest", + "UpdateJobRequest", + "DeleteJobRequest", + "BatchDeleteJobsRequest", + "ListJobsRequest", + "ListJobsResponse", + "SearchJobsRequest", + "SearchJobsResponse", + "BatchCreateJobsRequest", + "BatchUpdateJobsRequest", + "JobOperationResult", + }, +) + + +class JobView(proto.Enum): + r"""An enum that specifies the job attributes that are returned in the + [MatchingJob.job][google.cloud.talent.v4beta1.SearchJobsResponse.MatchingJob.job] + or + [ListJobsResponse.jobs][google.cloud.talent.v4beta1.ListJobsResponse.jobs] + fields. + """ + JOB_VIEW_UNSPECIFIED = 0 + JOB_VIEW_ID_ONLY = 1 + JOB_VIEW_MINIMAL = 2 + JOB_VIEW_SMALL = 3 + JOB_VIEW_FULL = 4 + + +class CreateJobRequest(proto.Message): + r"""Create job request. + + Attributes: + parent (str): + Required. The resource name of the tenant under which the + job is created. + + The format is "projects/{project_id}/tenants/{tenant_id}". + For example, "projects/foo/tenant/bar". If tenant id is + unspecified a default tenant is created. For example, + "projects/foo". + job (~.gct_job.Job): + Required. The Job to be created. + """ + + parent = proto.Field(proto.STRING, number=1) + + job = proto.Field(proto.MESSAGE, number=2, message=gct_job.Job,) + + +class GetJobRequest(proto.Message): + r"""Get job request. + + Attributes: + name (str): + Required. The resource name of the job to retrieve. + + The format is + "projects/{project_id}/tenants/{tenant_id}/jobs/{job_id}". + For example, "projects/foo/tenants/bar/jobs/baz". + + If tenant id is unspecified, the default tenant is used. For + example, "projects/foo/jobs/bar". + """ + + name = proto.Field(proto.STRING, number=1) + + +class UpdateJobRequest(proto.Message): + r"""Update job request. + + Attributes: + job (~.gct_job.Job): + Required. The Job to be updated. + update_mask (~.field_mask.FieldMask): + Strongly recommended for the best service experience. + + If + [update_mask][google.cloud.talent.v4beta1.UpdateJobRequest.update_mask] + is provided, only the specified fields in + [job][google.cloud.talent.v4beta1.UpdateJobRequest.job] are + updated. Otherwise all the fields are updated. + + A field mask to restrict the fields that are updated. Only + top level fields of [Job][google.cloud.talent.v4beta1.Job] + are supported. + """ + + job = proto.Field(proto.MESSAGE, number=1, message=gct_job.Job,) + + update_mask = proto.Field(proto.MESSAGE, number=2, message=field_mask.FieldMask,) + + +class DeleteJobRequest(proto.Message): + r"""Delete job request. + + Attributes: + name (str): + Required. The resource name of the job to be deleted. + + The format is + "projects/{project_id}/tenants/{tenant_id}/jobs/{job_id}". + For example, "projects/foo/tenants/bar/jobs/baz". + + If tenant id is unspecified, the default tenant is used. For + example, "projects/foo/jobs/bar". + """ + + name = proto.Field(proto.STRING, number=1) + + +class BatchDeleteJobsRequest(proto.Message): + r"""Batch delete jobs request. + + Attributes: + parent (str): + Required. The resource name of the tenant under which the + job is created. + + The format is "projects/{project_id}/tenants/{tenant_id}". + For example, "projects/foo/tenant/bar". If tenant id is + unspecified, a default tenant is created. For example, + "projects/foo". + filter (str): + Required. The filter string specifies the jobs to be + deleted. + + Supported operator: =, AND + + The fields eligible for filtering are: + + - ``companyName`` (Required) + - ``requisitionId`` (Required) + + Sample Query: companyName = "projects/foo/companies/bar" AND + requisitionId = "req-1". + """ + + parent = proto.Field(proto.STRING, number=1) + + filter = proto.Field(proto.STRING, number=2) + + +class ListJobsRequest(proto.Message): + r"""List jobs request. + + Attributes: + parent (str): + Required. The resource name of the tenant under which the + job is created. + + The format is "projects/{project_id}/tenants/{tenant_id}". + For example, "projects/foo/tenant/bar". If tenant id is + unspecified, a default tenant is created. For example, + "projects/foo". + filter (str): + Required. The filter string specifies the jobs to be + enumerated. + + Supported operator: =, AND + + The fields eligible for filtering are: + + - ``companyName`` (Required) + - ``requisitionId`` + - ``status`` Available values: OPEN, EXPIRED, ALL. Defaults + to OPEN if no value is specified. + + Sample Query: + + - companyName = "projects/foo/tenants/bar/companies/baz" + - companyName = "projects/foo/tenants/bar/companies/baz" + AND requisitionId = "req-1" + - companyName = "projects/foo/tenants/bar/companies/baz" + AND status = "EXPIRED". + page_token (str): + The starting point of a query result. + page_size (int): + The maximum number of jobs to be returned per page of + results. + + If + [job_view][google.cloud.talent.v4beta1.ListJobsRequest.job_view] + is set to + [JobView.JOB_VIEW_ID_ONLY][google.cloud.talent.v4beta1.JobView.JOB_VIEW_ID_ONLY], + the maximum allowed page size is 1000. Otherwise, the + maximum allowed page size is 100. + + Default is 100 if empty or a number < 1 is specified. + job_view (~.job_service.JobView): + The desired job attributes returned for jobs in the search + response. Defaults to + [JobView.JOB_VIEW_FULL][google.cloud.talent.v4beta1.JobView.JOB_VIEW_FULL] + if no value is specified. + """ + + parent = proto.Field(proto.STRING, number=1) + + filter = proto.Field(proto.STRING, number=2) + + page_token = proto.Field(proto.STRING, number=3) + + page_size = proto.Field(proto.INT32, number=4) + + job_view = proto.Field(proto.ENUM, number=5, enum="JobView",) + + +class ListJobsResponse(proto.Message): + r"""List jobs response. + + Attributes: + jobs (Sequence[~.gct_job.Job]): + The Jobs for a given company. + The maximum number of items returned is based on + the limit field provided in the request. + next_page_token (str): + A token to retrieve the next page of results. + metadata (~.common.ResponseMetadata): + Additional information for the API + invocation, such as the request tracking id. + """ + + @property + def raw_page(self): + return self + + jobs = proto.RepeatedField(proto.MESSAGE, number=1, message=gct_job.Job,) + + next_page_token = proto.Field(proto.STRING, number=2) + + metadata = proto.Field(proto.MESSAGE, number=3, message=common.ResponseMetadata,) + + +class SearchJobsRequest(proto.Message): + r"""The Request body of the ``SearchJobs`` call. + + Attributes: + parent (str): + Required. The resource name of the tenant to search within. + + The format is "projects/{project_id}/tenants/{tenant_id}". + For example, "projects/foo/tenant/bar". If tenant id is + unspecified, a default tenant is created. For example, + "projects/foo". + search_mode (~.job_service.SearchJobsRequest.SearchMode): + Mode of a search. + + Defaults to + [SearchMode.JOB_SEARCH][google.cloud.talent.v4beta1.SearchJobsRequest.SearchMode.JOB_SEARCH]. + request_metadata (~.common.RequestMetadata): + Required. The meta information collected about the job + searcher, used to improve the search quality of the service. + The identifiers (such as ``user_id``) are provided by users, + and must be unique and consistent. + job_query (~.filters.JobQuery): + Query used to search against jobs, such as + keyword, location filters, etc. + enable_broadening (bool): + Controls whether to broaden the search when + it produces sparse results. Broadened queries + append results to the end of the matching + results list. + + Defaults to false. + require_precise_result_size (bool): + Controls if the search job request requires the return of a + precise count of the first 300 results. Setting this to + ``true`` ensures consistency in the number of results per + page. Best practice is to set this value to true if a client + allows users to jump directly to a non-sequential search + results page. + + Enabling this flag may adversely impact performance. + + Defaults to false. + histogram_queries (Sequence[~.histogram.HistogramQuery]): + An expression specifies a histogram request against matching + jobs. + + Expression syntax is an aggregation function call with + histogram facets and other options. + + Available aggregation function calls are: + + - ``count(string_histogram_facet)``: Count the number of + matching entities, for each distinct attribute value. + - ``count(numeric_histogram_facet, list of buckets)``: + Count the number of matching entities within each bucket. + + Data types: + + - Histogram facet: facet names with format + [a-zA-Z][a-zA-Z0-9\_]+. + - String: string like "any string with backslash escape for + quote(")." + - Number: whole number and floating point number like 10, + -1 and -0.01. + - List: list of elements with comma(,) separator surrounded + by square brackets, for example, [1, 2, 3] and ["one", + "two", "three"]. + + Built-in constants: + + - MIN (minimum number similar to java Double.MIN_VALUE) + - MAX (maximum number similar to java Double.MAX_VALUE) + + Built-in functions: + + - bucket(start, end[, label]): bucket built-in function + creates a bucket with range of [start, end). Note that + the end is exclusive, for example, bucket(1, MAX, + "positive number") or bucket(1, 10). + + Job histogram facets: + + - company_display_name: histogram by + [Job.company_display_name][google.cloud.talent.v4beta1.Job.company_display_name]. + - employment_type: histogram by + [Job.employment_types][google.cloud.talent.v4beta1.Job.employment_types], + for example, "FULL_TIME", "PART_TIME". + - company_size: histogram by + [CompanySize][google.cloud.talent.v4beta1.CompanySize], + for example, "SMALL", "MEDIUM", "BIG". + - publish_time_in_month: histogram by the + [Job.posting_publish_time][google.cloud.talent.v4beta1.Job.posting_publish_time] + in months. Must specify list of numeric buckets in spec. + - publish_time_in_year: histogram by the + [Job.posting_publish_time][google.cloud.talent.v4beta1.Job.posting_publish_time] + in years. Must specify list of numeric buckets in spec. + - degree_types: histogram by the + [Job.degree_types][google.cloud.talent.v4beta1.Job.degree_types], + for example, "Bachelors", "Masters". + - job_level: histogram by the + [Job.job_level][google.cloud.talent.v4beta1.Job.job_level], + for example, "Entry Level". + - country: histogram by the country code of jobs, for + example, "US", "FR". + - admin1: histogram by the admin1 code of jobs, which is a + global placeholder referring to the state, province, or + the particular term a country uses to define the + geographic structure below the country level, for + example, "CA", "IL". + - city: histogram by a combination of the "city name, + admin1 code". For example, "Mountain View, CA", "New + York, NY". + - admin1_country: histogram by a combination of the "admin1 + code, country", for example, "CA, US", "IL, US". + - city_coordinate: histogram by the city center's GPS + coordinates (latitude and longitude), for example, + 37.4038522,-122.0987765. Since the coordinates of a city + center can change, customers may need to refresh them + periodically. + - locale: histogram by the + [Job.language_code][google.cloud.talent.v4beta1.Job.language_code], + for example, "en-US", "fr-FR". + - language: histogram by the language subtag of the + [Job.language_code][google.cloud.talent.v4beta1.Job.language_code], + for example, "en", "fr". + - category: histogram by the + [JobCategory][google.cloud.talent.v4beta1.JobCategory], + for example, "COMPUTER_AND_IT", "HEALTHCARE". + - base_compensation_unit: histogram by the + [CompensationInfo.CompensationUnit][google.cloud.talent.v4beta1.CompensationInfo.CompensationUnit] + of base salary, for example, "WEEKLY", "MONTHLY". + - base_compensation: histogram by the base salary. Must + specify list of numeric buckets to group results by. + - annualized_base_compensation: histogram by the base + annualized salary. Must specify list of numeric buckets + to group results by. + - annualized_total_compensation: histogram by the total + annualized salary. Must specify list of numeric buckets + to group results by. + - string_custom_attribute: histogram by string + [Job.custom_attributes][google.cloud.talent.v4beta1.Job.custom_attributes]. + Values can be accessed via square bracket notations like + string_custom_attribute["key1"]. + - numeric_custom_attribute: histogram by numeric + [Job.custom_attributes][google.cloud.talent.v4beta1.Job.custom_attributes]. + Values can be accessed via square bracket notations like + numeric_custom_attribute["key1"]. Must specify list of + numeric buckets to group results by. + + Example expressions: + + - ``count(admin1)`` + - ``count(base_compensation, [bucket(1000, 10000), bucket(10000, 100000), bucket(100000, MAX)])`` + - ``count(string_custom_attribute["some-string-custom-attribute"])`` + - ``count(numeric_custom_attribute["some-numeric-custom-attribute"], [bucket(MIN, 0, "negative"), bucket(0, MAX, "non-negative"])`` + job_view (~.job_service.JobView): + The desired job attributes returned for jobs in the search + response. Defaults to + [JobView.JOB_VIEW_SMALL][google.cloud.talent.v4beta1.JobView.JOB_VIEW_SMALL] + if no value is specified. + offset (int): + An integer that specifies the current offset (that is, + starting result location, amongst the jobs deemed by the API + as relevant) in search results. This field is only + considered if + [page_token][google.cloud.talent.v4beta1.SearchJobsRequest.page_token] + is unset. + + The maximum allowed value is 5000. Otherwise an error is + thrown. + + For example, 0 means to return results starting from the + first matching job, and 10 means to return from the 11th + job. This can be used for pagination, (for example, pageSize + = 10 and offset = 10 means to return from the second page). + page_size (int): + A limit on the number of jobs returned in the + search results. Increasing this value above the + default value of 10 can increase search response + time. The value can be between 1 and 100. + page_token (str): + The token specifying the current offset within search + results. See + [SearchJobsResponse.next_page_token][google.cloud.talent.v4beta1.SearchJobsResponse.next_page_token] + for an explanation of how to obtain the next set of query + results. + order_by (str): + The criteria determining how search results are sorted. + Default is ``"relevance desc"``. + + Supported options are: + + - ``"relevance desc"``: By relevance descending, as + determined by the API algorithms. Relevance thresholding + of query results is only available with this ordering. + - ``"posting_publish_time desc"``: By + [Job.posting_publish_time][google.cloud.talent.v4beta1.Job.posting_publish_time] + descending. + - ``"posting_update_time desc"``: By + [Job.posting_update_time][google.cloud.talent.v4beta1.Job.posting_update_time] + descending. + - ``"title"``: By + [Job.title][google.cloud.talent.v4beta1.Job.title] + ascending. + - ``"title desc"``: By + [Job.title][google.cloud.talent.v4beta1.Job.title] + descending. + - ``"annualized_base_compensation"``: By job's + [CompensationInfo.annualized_base_compensation_range][google.cloud.talent.v4beta1.CompensationInfo.annualized_base_compensation_range] + ascending. Jobs whose annualized base compensation is + unspecified are put at the end of search results. + - ``"annualized_base_compensation desc"``: By job's + [CompensationInfo.annualized_base_compensation_range][google.cloud.talent.v4beta1.CompensationInfo.annualized_base_compensation_range] + descending. Jobs whose annualized base compensation is + unspecified are put at the end of search results. + - ``"annualized_total_compensation"``: By job's + [CompensationInfo.annualized_total_compensation_range][google.cloud.talent.v4beta1.CompensationInfo.annualized_total_compensation_range] + ascending. Jobs whose annualized base compensation is + unspecified are put at the end of search results. + - ``"annualized_total_compensation desc"``: By job's + [CompensationInfo.annualized_total_compensation_range][google.cloud.talent.v4beta1.CompensationInfo.annualized_total_compensation_range] + descending. Jobs whose annualized base compensation is + unspecified are put at the end of search results. + - ``"custom_ranking desc"``: By the relevance score + adjusted to the + [SearchJobsRequest.CustomRankingInfo.ranking_expression][google.cloud.talent.v4beta1.SearchJobsRequest.CustomRankingInfo.ranking_expression] + with weight factor assigned by + [SearchJobsRequest.CustomRankingInfo.importance_level][google.cloud.talent.v4beta1.SearchJobsRequest.CustomRankingInfo.importance_level] + in descending order. + - Location sorting: Use the special syntax to order jobs by + distance: ``"distance_from('Hawaii')"``: Order by + distance from Hawaii. ``"distance_from(19.89, 155.5)"``: + Order by distance from a coordinate. + ``"distance_from('Hawaii'), distance_from('Puerto Rico')"``: + Order by multiple locations. See details below. + ``"distance_from('Hawaii'), distance_from(19.89, 155.5)"``: + Order by multiple locations. See details below. The + string can have a maximum of 256 characters. When + multiple distance centers are provided, a job that is + close to any of the distance centers would have a high + rank. When a job has multiple locations, the job location + closest to one of the distance centers will be used. Jobs + that don't have locations will be ranked at the bottom. + Distance is calculated with a precision of 11.3 meters + (37.4 feet). Diversification strategy is still applied + unless explicitly disabled in + [diversification_level][google.cloud.talent.v4beta1.SearchJobsRequest.diversification_level]. + diversification_level (~.job_service.SearchJobsRequest.DiversificationLevel): + Controls whether highly similar jobs are returned next to + each other in the search results. Jobs are identified as + highly similar based on their titles, job categories, and + locations. Highly similar results are clustered so that only + one representative job of the cluster is displayed to the + job seeker higher up in the results, with the other jobs + being displayed lower down in the results. + + Defaults to + [DiversificationLevel.SIMPLE][google.cloud.talent.v4beta1.SearchJobsRequest.DiversificationLevel.SIMPLE] + if no value is specified. + custom_ranking_info (~.job_service.SearchJobsRequest.CustomRankingInfo): + Controls over how job documents get ranked on + top of existing relevance score (determined by + API algorithm). + disable_keyword_match (bool): + Controls whether to disable exact keyword match on + [Job.title][google.cloud.talent.v4beta1.Job.title], + [Job.description][google.cloud.talent.v4beta1.Job.description], + [Job.company_display_name][google.cloud.talent.v4beta1.Job.company_display_name], + [Job.addresses][google.cloud.talent.v4beta1.Job.addresses], + [Job.qualifications][google.cloud.talent.v4beta1.Job.qualifications]. + When disable keyword match is turned off, a keyword match + returns jobs that do not match given category filters when + there are matching keywords. For example, for the query + "program manager," a result is returned even if the job + posting has the title "software developer," which doesn't + fall into "program manager" ontology, but does have "program + manager" appearing in its description. + + For queries like "cloud" that don't contain title or + location specific ontology, jobs with "cloud" keyword + matches are returned regardless of this flag's value. + + Use + [Company.keyword_searchable_job_custom_attributes][google.cloud.talent.v4beta1.Company.keyword_searchable_job_custom_attributes] + if company-specific globally matched custom field/attribute + string values are needed. Enabling keyword match improves + recall of subsequent search requests. + + Defaults to false. + """ + + class SearchMode(proto.Enum): + r"""A string-represented enumeration of the job search mode. The + service operate differently for different modes of service. + """ + SEARCH_MODE_UNSPECIFIED = 0 + JOB_SEARCH = 1 + FEATURED_JOB_SEARCH = 2 + + class DiversificationLevel(proto.Enum): + r"""Controls whether highly similar jobs are returned next to + each other in the search results. Jobs are identified as highly + similar based on their titles, job categories, and locations. + Highly similar results are clustered so that only one + representative job of the cluster is displayed to the job seeker + higher up in the results, with the other jobs being displayed + lower down in the results. + """ + DIVERSIFICATION_LEVEL_UNSPECIFIED = 0 + DISABLED = 1 + SIMPLE = 2 + + class CustomRankingInfo(proto.Message): + r"""Custom ranking information for + [SearchJobsRequest][google.cloud.talent.v4beta1.SearchJobsRequest]. + + Attributes: + importance_level (~.job_service.SearchJobsRequest.CustomRankingInfo.ImportanceLevel): + Required. Controls over how important the score of + [CustomRankingInfo.ranking_expression][google.cloud.talent.v4beta1.SearchJobsRequest.CustomRankingInfo.ranking_expression] + gets applied to job's final ranking position. + + An error is thrown if not specified. + ranking_expression (str): + Required. Controls over how job documents get ranked on top + of existing relevance score (determined by API algorithm). A + combination of the ranking expression and relevance score is + used to determine job's final ranking position. + + The syntax for this expression is a subset of Google SQL + syntax. + + Supported operators are: +, -, \*, /, where the left and + right side of the operator is either a numeric + [Job.custom_attributes][google.cloud.talent.v4beta1.Job.custom_attributes] + key, integer/double value or an expression that can be + evaluated to a number. + + Parenthesis are supported to adjust calculation precedence. + The expression must be < 100 characters in length. + + The expression is considered invalid for a job if the + expression references custom attributes that are not + populated on the job or if the expression results in a + divide by zero. If an expression is invalid for a job, that + job is demoted to the end of the results. + + Sample ranking expression (year + 25) \* 0.25 - (freshness / + 0.5) + """ + + class ImportanceLevel(proto.Enum): + r"""The importance level for + [CustomRankingInfo.ranking_expression][google.cloud.talent.v4beta1.SearchJobsRequest.CustomRankingInfo.ranking_expression]. + """ + IMPORTANCE_LEVEL_UNSPECIFIED = 0 + NONE = 1 + LOW = 2 + MILD = 3 + MEDIUM = 4 + HIGH = 5 + EXTREME = 6 + + importance_level = proto.Field( + proto.ENUM, + number=1, + enum="SearchJobsRequest.CustomRankingInfo.ImportanceLevel", + ) + + ranking_expression = proto.Field(proto.STRING, number=2) + + parent = proto.Field(proto.STRING, number=1) + + search_mode = proto.Field(proto.ENUM, number=2, enum=SearchMode,) + + request_metadata = proto.Field( + proto.MESSAGE, number=3, message=common.RequestMetadata, + ) + + job_query = proto.Field(proto.MESSAGE, number=4, message=filters.JobQuery,) + + enable_broadening = proto.Field(proto.BOOL, number=5) + + require_precise_result_size = proto.Field(proto.BOOL, number=6) + + histogram_queries = proto.RepeatedField( + proto.MESSAGE, number=7, message=histogram.HistogramQuery, + ) + + job_view = proto.Field(proto.ENUM, number=8, enum="JobView",) + + offset = proto.Field(proto.INT32, number=9) + + page_size = proto.Field(proto.INT32, number=10) + + page_token = proto.Field(proto.STRING, number=11) + + order_by = proto.Field(proto.STRING, number=12) + + diversification_level = proto.Field( + proto.ENUM, number=13, enum=DiversificationLevel, + ) + + custom_ranking_info = proto.Field( + proto.MESSAGE, number=14, message=CustomRankingInfo, + ) + + disable_keyword_match = proto.Field(proto.BOOL, number=16) + + +class SearchJobsResponse(proto.Message): + r"""Response for SearchJob method. + + Attributes: + matching_jobs (Sequence[~.job_service.SearchJobsResponse.MatchingJob]): + The Job entities that match the specified + [SearchJobsRequest][google.cloud.talent.v4beta1.SearchJobsRequest]. + histogram_query_results (Sequence[~.histogram.HistogramQueryResult]): + The histogram results that match with specified + [SearchJobsRequest.histogram_queries][google.cloud.talent.v4beta1.SearchJobsRequest.histogram_queries]. + next_page_token (str): + The token that specifies the starting + position of the next page of results. This field + is empty if there are no more results. + location_filters (Sequence[~.common.Location]): + The location filters that the service applied to the + specified query. If any filters are lat-lng based, the + [Location.location_type][google.cloud.talent.v4beta1.Location.location_type] + is + [Location.LocationType.LOCATION_TYPE_UNSPECIFIED][google.cloud.talent.v4beta1.Location.LocationType.LOCATION_TYPE_UNSPECIFIED]. + estimated_total_size (int): + An estimation of the number of jobs that match the specified + query. + + This number isn't guaranteed to be accurate. For accurate + results, see + [SearchJobsRequest.require_precise_result_size][google.cloud.talent.v4beta1.SearchJobsRequest.require_precise_result_size]. + total_size (int): + The precise result count, which is available only if the + client set + [SearchJobsRequest.require_precise_result_size][google.cloud.talent.v4beta1.SearchJobsRequest.require_precise_result_size] + to ``true``, or if the response is the last page of results. + Otherwise, the value is ``-1``. + metadata (~.common.ResponseMetadata): + Additional information for the API + invocation, such as the request tracking id. + broadened_query_jobs_count (int): + If query broadening is enabled, we may append + additional results from the broadened query. + This number indicates how many of the jobs + returned in the jobs field are from the + broadened query. These results are always at the + end of the jobs list. In particular, a value of + 0, or if the field isn't set, all the jobs in + the jobs list are from the original (without + broadening) query. If this field is non-zero, + subsequent requests with offset after this + result set should contain all broadened results. + spell_correction (~.common.SpellingCorrection): + The spell checking result, and correction. + """ + + class MatchingJob(proto.Message): + r"""Job entry with metadata inside + [SearchJobsResponse][google.cloud.talent.v4beta1.SearchJobsResponse]. + + Attributes: + job (~.gct_job.Job): + Job resource that matches the specified + [SearchJobsRequest][google.cloud.talent.v4beta1.SearchJobsRequest]. + job_summary (str): + A summary of the job with core information + that's displayed on the search results listing + page. + job_title_snippet (str): + Contains snippets of text from the + [Job.title][google.cloud.talent.v4beta1.Job.title] field + most closely matching a search query's keywords, if + available. The matching query keywords are enclosed in HTML + bold tags. + search_text_snippet (str): + Contains snippets of text from the + [Job.description][google.cloud.talent.v4beta1.Job.description] + and similar fields that most closely match a search query's + keywords, if available. All HTML tags in the original fields + are stripped when returned in this field, and matching query + keywords are enclosed in HTML bold tags. + commute_info (~.job_service.SearchJobsResponse.CommuteInfo): + Commute information which is generated based on specified + [CommuteFilter][google.cloud.talent.v4beta1.CommuteFilter]. + """ + + job = proto.Field(proto.MESSAGE, number=1, message=gct_job.Job,) + + job_summary = proto.Field(proto.STRING, number=2) + + job_title_snippet = proto.Field(proto.STRING, number=3) + + search_text_snippet = proto.Field(proto.STRING, number=4) + + commute_info = proto.Field( + proto.MESSAGE, number=5, message="SearchJobsResponse.CommuteInfo", + ) + + class CommuteInfo(proto.Message): + r"""Commute details related to this job. + + Attributes: + job_location (~.common.Location): + Location used as the destination in the + commute calculation. + travel_duration (~.duration.Duration): + The number of seconds required to travel to + the job location from the query location. A + duration of 0 seconds indicates that the job + isn't reachable within the requested duration, + but was returned as part of an expanded query. + """ + + job_location = proto.Field(proto.MESSAGE, number=1, message=common.Location,) + + travel_duration = proto.Field( + proto.MESSAGE, number=2, message=duration.Duration, + ) + + @property + def raw_page(self): + return self + + matching_jobs = proto.RepeatedField(proto.MESSAGE, number=1, message=MatchingJob,) + + histogram_query_results = proto.RepeatedField( + proto.MESSAGE, number=2, message=histogram.HistogramQueryResult, + ) + + next_page_token = proto.Field(proto.STRING, number=3) + + location_filters = proto.RepeatedField( + proto.MESSAGE, number=4, message=common.Location, + ) + + estimated_total_size = proto.Field(proto.INT32, number=5) + + total_size = proto.Field(proto.INT32, number=6) + + metadata = proto.Field(proto.MESSAGE, number=7, message=common.ResponseMetadata,) + + broadened_query_jobs_count = proto.Field(proto.INT32, number=8) + + spell_correction = proto.Field( + proto.MESSAGE, number=9, message=common.SpellingCorrection, + ) + + +class BatchCreateJobsRequest(proto.Message): + r"""Request to create a batch of jobs. + + Attributes: + parent (str): + Required. The resource name of the tenant under which the + job is created. + + The format is "projects/{project_id}/tenants/{tenant_id}". + For example, "projects/foo/tenant/bar". If tenant id is + unspecified, a default tenant is created. For example, + "projects/foo". + jobs (Sequence[~.gct_job.Job]): + Required. The jobs to be created. + """ + + parent = proto.Field(proto.STRING, number=1) + + jobs = proto.RepeatedField(proto.MESSAGE, number=2, message=gct_job.Job,) + + +class BatchUpdateJobsRequest(proto.Message): + r"""Request to update a batch of jobs. + + Attributes: + parent (str): + Required. The resource name of the tenant under which the + job is created. + + The format is "projects/{project_id}/tenants/{tenant_id}". + For example, "projects/foo/tenant/bar". If tenant id is + unspecified, a default tenant is created. For example, + "projects/foo". + jobs (Sequence[~.gct_job.Job]): + Required. The jobs to be updated. + update_mask (~.field_mask.FieldMask): + Strongly recommended for the best service experience. Be + aware that it will also increase latency when checking the + status of a batch operation. + + If + [update_mask][google.cloud.talent.v4beta1.BatchUpdateJobsRequest.update_mask] + is provided, only the specified fields in + [Job][google.cloud.talent.v4beta1.Job] are updated. + Otherwise all the fields are updated. + + A field mask to restrict the fields that are updated. Only + top level fields of [Job][google.cloud.talent.v4beta1.Job] + are supported. + + If + [update_mask][google.cloud.talent.v4beta1.BatchUpdateJobsRequest.update_mask] + is provided, The [Job][google.cloud.talent.v4beta1.Job] + inside + [JobResult][google.cloud.talent.v4beta1.JobOperationResult.JobResult] + will only contains fields that is updated, plus the Id of + the Job. Otherwise, [Job][google.cloud.talent.v4beta1.Job] + will include all fields, which can yield a very large + response. + """ + + parent = proto.Field(proto.STRING, number=1) + + jobs = proto.RepeatedField(proto.MESSAGE, number=2, message=gct_job.Job,) + + update_mask = proto.Field(proto.MESSAGE, number=3, message=field_mask.FieldMask,) + + +class JobOperationResult(proto.Message): + r"""The result of + [JobService.BatchCreateJobs][google.cloud.talent.v4beta1.JobService.BatchCreateJobs] + or + [JobService.BatchUpdateJobs][google.cloud.talent.v4beta1.JobService.BatchUpdateJobs] + APIs. It's used to replace + [google.longrunning.Operation.response][google.longrunning.Operation.response] + in case of success. + + Attributes: + job_results (Sequence[~.job_service.JobOperationResult.JobResult]): + List of job mutation results from a batch + mutate operation. It can change until operation + status is FINISHED, FAILED or CANCELLED. + """ + + class JobResult(proto.Message): + r"""Mutation result of a job. + + Attributes: + job (~.gct_job.Job): + Here [Job][google.cloud.talent.v4beta1.Job] only contains + basic information including + [name][google.cloud.talent.v4beta1.Job.name], + [company][google.cloud.talent.v4beta1.Job.company], + [language_code][google.cloud.talent.v4beta1.Job.language_code] + and + [requisition_id][google.cloud.talent.v4beta1.Job.requisition_id], + use getJob method to retrieve detailed information of the + created/updated job. + status (~.gr_status.Status): + The status of the job processed. This field is populated if + the processing of the + [job][google.cloud.talent.v4beta1.JobOperationResult.JobResult.job] + fails. + """ + + job = proto.Field(proto.MESSAGE, number=1, message=gct_job.Job,) + + status = proto.Field(proto.MESSAGE, number=2, message=gr_status.Status,) + + job_results = proto.RepeatedField(proto.MESSAGE, number=1, message=JobResult,) + + +__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/cloud/talent_v4beta1/types/profile.py b/google/cloud/talent_v4beta1/types/profile.py new file mode 100644 index 00000000..ceba029a --- /dev/null +++ b/google/cloud/talent_v4beta1/types/profile.py @@ -0,0 +1,1021 @@ +# -*- 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. +# + +import proto # type: ignore + + +from google.cloud.talent_v4beta1.types import common +from google.protobuf import timestamp_pb2 as timestamp # type: ignore +from google.protobuf import wrappers_pb2 as wrappers # type: ignore +from google.type import date_pb2 as date # type: ignore +from google.type import postal_address_pb2 as postal_address # type: ignore + + +__protobuf__ = proto.module( + package="google.cloud.talent.v4beta1", + manifest={ + "Profile", + "AvailabilitySignal", + "Resume", + "PersonName", + "Address", + "Email", + "Phone", + "PersonalUri", + "AdditionalContactInfo", + "EmploymentRecord", + "EducationRecord", + "Degree", + "Activity", + "Publication", + "Patent", + }, +) + + +class Profile(proto.Message): + r"""A resource that represents the profile for a job candidate + (also referred to as a "single-source profile"). + + Attributes: + name (str): + Required during profile update. + + Resource name assigned to a profile by the API. + + The format is + "projects/{project_id}/tenants/{tenant_id}/profiles/{profile_id}", + for example, "projects/foo/tenants/bar/profiles/baz". + external_id (str): + Profile's id in client system, if available. This value is + unique for each profile inside a tenant. An error is thrown + if another profile with the same external_id is created. + + The maximum number of bytes allowed is 100. + source (str): + The source description indicating where the + profile is acquired. + For example, if a candidate profile is acquired + from a resume, the user can input "resume" here + to indicate the source. + + The maximum number of bytes allowed is 100. + uri (str): + The URI set by clients that links to this + profile's client-side copy. + The maximum number of bytes allowed is 4000. + group_id (str): + The cluster id of the profile to associate with other + profile(s) for the same candidate. + + This field should be generated by the customer. If a value + is not provided, a random UUID is assigned to this field of + the profile. + + This is used to link multiple profiles to the same + candidate. For example, a client has a candidate with two + profiles, where one was created recently and the other one + was created 5 years ago. These two profiles may be very + different. The clients can create the first profile and get + a generated + [group_id][google.cloud.talent.v4beta1.Profile.group_id], + and assign it when the second profile is created, indicating + these two profiles are referring to the same candidate. + is_hirable (~.wrappers.BoolValue): + Indicates the hirable status of the + candidate. + create_time (~.timestamp.Timestamp): + The timestamp when the profile was first + created at this source. + update_time (~.timestamp.Timestamp): + The timestamp when the profile was last + updated at this source. + candidate_update_time (~.timestamp.Timestamp): + The timestamp when the profile was last updated as a result + of a direct or indirect action by a candidate. + + These actions include: + + - Direct actions such as the candidate submitting a new + resume as part of a job application to the agency, using + a self-service tool such as a website to update their + profile, and so on. + - Indirect actions by the candidate such as uploading a + resume to a job board that is collected by the agency + through a feed, providing a resume to a recruiter who + then uploads it into the ATS, and so on. + - Updates made to the candidate's profile by the recruiter + as a result of interacting with the candidate (for + example adding a skill or work preference, and so on). + Changes to + [recruiting_notes][google.cloud.talent.v4beta1.Profile.recruiting_notes] + are specifically excluded from this action type. + + Note: + [candidate_update_time][google.cloud.talent.v4beta1.Profile.candidate_update_time] + must be greater than or equal to + [resume_update_time][google.cloud.talent.v4beta1.Profile.resume_update_time] + or an error is thrown. + resume_update_time (~.timestamp.Timestamp): + The timestamp when the candidate's resume was added or + updated on the candidate's profile. Whether that resume was + directly uploaded by a candidate, pulled from a 3rd party + job board feed, added by a recruiter, and so on. + + If this field is updated, it's expected that + [resume][google.cloud.talent.v4beta1.Profile.resume] is + provided in the create or update calls. + resume (~.profile.Resume): + The resume representing this profile. + person_names (Sequence[~.profile.PersonName]): + The names of the candidate this profile + references. + Currently only one person name is supported. + addresses (Sequence[~.profile.Address]): + The candidate's postal addresses. It's highly recommended to + input this information as accurately as possible to help + improve search quality. Here are some recommendations: + + - Provide + [Address.usage][google.cloud.talent.v4beta1.Address.usage] + if possible, especially if the address is PERSONAL. + During a search only personal addresses are considered. + If there is no such address, all addresses with + unspecified usage are assumed to be personal. + - Provide + [Address.current][google.cloud.talent.v4beta1.Address.current] + for the current address if possible. During a search, + only current addresses are considered. If there is no + such address, all addresses are assumed to be current. + + When displaying a candidate's addresses, it is sometimes + desirable to limit the number of addresses shown. In these + cases we recommend that you display the addresses in the + following order of priority: + + 1. [Address.usage][google.cloud.talent.v4beta1.Address.usage] + is PERSONAL and + [Address.current][google.cloud.talent.v4beta1.Address.current] + is true. + 2. [Address.usage][google.cloud.talent.v4beta1.Address.usage] + is PERSONAL and + [Address.current][google.cloud.talent.v4beta1.Address.current] + is false or not set. + 3. [Address.usage][google.cloud.talent.v4beta1.Address.usage] + is CONTACT_INFO_USAGE_UNSPECIFIED and + [Address.current][google.cloud.talent.v4beta1.Address.current] + is true. + 4. [Address.usage][google.cloud.talent.v4beta1.Address.usage] + is CONTACT_INFO_USAGE_UNSPECIFIED and + [Address.current][google.cloud.talent.v4beta1.Address.current] + is false or not set. + email_addresses (Sequence[~.profile.Email]): + The candidate's email addresses. + phone_numbers (Sequence[~.profile.Phone]): + The candidate's phone number(s). + personal_uris (Sequence[~.profile.PersonalUri]): + The candidate's personal URIs. + additional_contact_info (Sequence[~.profile.AdditionalContactInfo]): + Available contact information besides + [addresses][google.cloud.talent.v4beta1.Profile.addresses], + [email_addresses][google.cloud.talent.v4beta1.Profile.email_addresses], + [phone_numbers][google.cloud.talent.v4beta1.Profile.phone_numbers] + and + [personal_uris][google.cloud.talent.v4beta1.Profile.personal_uris]. + For example, Hang-out, Skype. + employment_records (Sequence[~.profile.EmploymentRecord]): + The employment history records of the candidate. It's highly + recommended to input this information as accurately as + possible to help improve search quality. Here are some + recommendations: + + - Specify the start and end dates of the employment + records. + - List different employment types separately, no matter how + minor the change is. For example, only job title is + changed from "software engineer" to "senior software + engineer". + - Provide + [EmploymentRecord.is_current][google.cloud.talent.v4beta1.EmploymentRecord.is_current] + for the current employment if possible. If not, it's + inferred from user inputs. + + The limitation for max number of employment records is 100. + education_records (Sequence[~.profile.EducationRecord]): + The education history record of the candidate. It's highly + recommended to input this information as accurately as + possible to help improve search quality. Here are some + recommendations: + + - Specify the start and end dates of the education records. + - List each education type separately, no matter how minor + the change is. For example, the profile contains the + education experience from the same school but different + degrees. + - Provide + [EducationRecord.is_current][google.cloud.talent.v4beta1.EducationRecord.is_current] + for the current education if possible. If not, it's + inferred from user inputs. + + The limitation for max number of education records is 100. + skills (Sequence[~.common.Skill]): + The skill set of the candidate. It's highly + recommended to provide as much information as + possible to help improve the search quality. + The limitation for max number of skills is 500. + activities (Sequence[~.profile.Activity]): + The individual or collaborative activities which the + candidate has participated in, for example, open-source + projects, class assignments that aren't listed in + [employment_records][google.cloud.talent.v4beta1.Profile.employment_records]. + + The limitation for max number of activities is 50. + publications (Sequence[~.profile.Publication]): + The publications published by the candidate. + The limitation for max number of publications is + 50. + patents (Sequence[~.profile.Patent]): + The patents acquired by the candidate. + certifications (Sequence[~.common.Certification]): + The certifications acquired by the candidate. + applications (Sequence[str]): + Output only. The resource names of the + candidate's applications. + assignments (Sequence[str]): + Output only. The resource names of the + candidate's assignments. + custom_attributes (Sequence[~.profile.Profile.CustomAttributesEntry]): + A map of fields to hold both filterable and non-filterable + custom profile attributes that aren't covered by the + provided structured fields. See + [CustomAttribute][google.cloud.talent.v4beta1.CustomAttribute] + for more details. + + At most 100 filterable and at most 100 unfilterable keys are + supported. If limit is exceeded, an error is thrown. Custom + attributes are ``unfilterable`` by default. These are + filterable when the ``filterable`` flag is set to ``true``. + + Numeric custom attributes: each key can only map to one + numeric value, otherwise an error is thrown. Client can also + filter on numeric custom attributes using '>', '<' or '=' + operators. + + String custom attributes: each key can map up to 50 string + values. For filterable string value, each value has a byte + size of no more than 256B. For unfilterable string values, + the maximum byte size of a single key is 64B. An error is + thrown for any request exceeding the limit. The maximum + total byte size is 10KB. + processed (bool): + Output only. Indicates if a summarized + profile was created as part of the profile + creation API call. This flag does not indicate + whether a profile is searchable or not. + keyword_snippet (str): + Output only. Keyword snippet shows how the search result is + related to a search query. This is only returned in + [SearchProfilesResponse][google.cloud.talent.v4beta1.SearchProfilesResponse]. + availability_signals (Sequence[~.profile.AvailabilitySignal]): + Output only. Candidate's availability + signals. + derived_addresses (Sequence[~.common.Location]): + Output only. Derived locations of the profile, resolved from + [Profile.addresses][google.cloud.talent.v4beta1.Profile.addresses]. + + [derived_addresses][google.cloud.talent.v4beta1.Profile.derived_addresses] + are exactly matched to + [Profile.addresses][google.cloud.talent.v4beta1.Profile.addresses] + in the same order. + """ + + name = proto.Field(proto.STRING, number=1) + + external_id = proto.Field(proto.STRING, number=2) + + source = proto.Field(proto.STRING, number=3) + + uri = proto.Field(proto.STRING, number=4) + + group_id = proto.Field(proto.STRING, number=5) + + is_hirable = proto.Field(proto.MESSAGE, number=6, message=wrappers.BoolValue,) + + create_time = proto.Field(proto.MESSAGE, number=7, message=timestamp.Timestamp,) + + update_time = proto.Field(proto.MESSAGE, number=8, message=timestamp.Timestamp,) + + candidate_update_time = proto.Field( + proto.MESSAGE, number=67, message=timestamp.Timestamp, + ) + + resume_update_time = proto.Field( + proto.MESSAGE, number=68, message=timestamp.Timestamp, + ) + + resume = proto.Field(proto.MESSAGE, number=53, message="Resume",) + + person_names = proto.RepeatedField(proto.MESSAGE, number=11, message="PersonName",) + + addresses = proto.RepeatedField(proto.MESSAGE, number=12, message="Address",) + + email_addresses = proto.RepeatedField(proto.MESSAGE, number=13, message="Email",) + + phone_numbers = proto.RepeatedField(proto.MESSAGE, number=14, message="Phone",) + + personal_uris = proto.RepeatedField( + proto.MESSAGE, number=15, message="PersonalUri", + ) + + additional_contact_info = proto.RepeatedField( + proto.MESSAGE, number=16, message="AdditionalContactInfo", + ) + + employment_records = proto.RepeatedField( + proto.MESSAGE, number=17, message="EmploymentRecord", + ) + + education_records = proto.RepeatedField( + proto.MESSAGE, number=18, message="EducationRecord", + ) + + skills = proto.RepeatedField(proto.MESSAGE, number=19, message=common.Skill,) + + activities = proto.RepeatedField(proto.MESSAGE, number=20, message="Activity",) + + publications = proto.RepeatedField(proto.MESSAGE, number=21, message="Publication",) + + patents = proto.RepeatedField(proto.MESSAGE, number=22, message="Patent",) + + certifications = proto.RepeatedField( + proto.MESSAGE, number=23, message=common.Certification, + ) + + applications = proto.RepeatedField(proto.STRING, number=47) + + assignments = proto.RepeatedField(proto.STRING, number=48) + + custom_attributes = proto.MapField( + proto.STRING, proto.MESSAGE, number=26, message=common.CustomAttribute, + ) + + processed = proto.Field(proto.BOOL, number=27) + + keyword_snippet = proto.Field(proto.STRING, number=28) + + availability_signals = proto.RepeatedField( + proto.MESSAGE, number=70, message="AvailabilitySignal", + ) + + derived_addresses = proto.RepeatedField( + proto.MESSAGE, number=64, message=common.Location, + ) + + +class AvailabilitySignal(proto.Message): + r"""Candidate availability signal. + + Attributes: + type (~.common.AvailabilitySignalType): + Type of signal. + last_update_time (~.timestamp.Timestamp): + Timestamp of when the given availability + activity last happened. + filter_satisfied (~.wrappers.BoolValue): + Indicates if the + [last_update_time][google.cloud.talent.v4beta1.AvailabilitySignal.last_update_time] + is within + [AvailabilityFilter.range][google.cloud.talent.v4beta1.AvailabilityFilter.range]. + + Returned only in a search response when there is an + [AvailabilityFilter][google.cloud.talent.v4beta1.AvailabilityFilter] + in + [ProfileQuery.availability_filters][google.cloud.talent.v4beta1.ProfileQuery.availability_filters] + where + [signal_type][google.cloud.talent.v4beta1.AvailabilityFilter.signal_type] + matches + [type][google.cloud.talent.v4beta1.AvailabilitySignal.type]. + """ + + type = proto.Field(proto.ENUM, number=1, enum=common.AvailabilitySignalType,) + + last_update_time = proto.Field( + proto.MESSAGE, number=2, message=timestamp.Timestamp, + ) + + filter_satisfied = proto.Field(proto.MESSAGE, number=3, message=wrappers.BoolValue,) + + +class Resume(proto.Message): + r"""Resource that represents a resume. + + Attributes: + structured_resume (str): + Users can create a profile with only this field field, if + [resume_type][google.cloud.talent.v4beta1.Resume.resume_type] + is + [HRXML][google.cloud.talent.v4beta1.Resume.ResumeType.HRXML]. + For example, the API parses this field and creates a profile + with all structured fields populated. + [EmploymentRecord][google.cloud.talent.v4beta1.EmploymentRecord], + [EducationRecord][google.cloud.talent.v4beta1.EducationRecord], + and so on. An error is thrown if this field cannot be + parsed. + + Note that the use of the functionality offered by this field + to extract data from resumes is an Alpha feature and as such + is not covered by any SLA. + resume_type (~.profile.Resume.ResumeType): + The format of + [structured_resume][google.cloud.talent.v4beta1.Resume.structured_resume]. + """ + + class ResumeType(proto.Enum): + r"""The format of a structured resume.""" + RESUME_TYPE_UNSPECIFIED = 0 + HRXML = 1 + OTHER_RESUME_TYPE = 2 + + structured_resume = proto.Field(proto.STRING, number=1) + + resume_type = proto.Field(proto.ENUM, number=2, enum=ResumeType,) + + +class PersonName(proto.Message): + r"""Resource that represents the name of a person. + + Attributes: + formatted_name (str): + A string represents a person's full name. For + example, "Dr. John Smith". + Number of characters allowed is 100. + structured_name (~.profile.PersonName.PersonStructuredName): + A person's name in a structured way (last + name, first name, suffix, and so on.) + preferred_name (str): + Preferred name for the person. This field is ignored if + [structured_name][google.cloud.talent.v4beta1.PersonName.structured_name] + is provided. + + Number of characters allowed is 100. + """ + + class PersonStructuredName(proto.Message): + r"""Resource that represents a person's structured name. + + Attributes: + given_name (str): + Given/first name. + + It's derived from + [formatted_name][google.cloud.talent.v4beta1.PersonName.formatted_name] + if not provided. + + Number of characters allowed is 100. + preferred_name (str): + Preferred given/first name or nickname. + Number of characters allowed is 100. + middle_initial (str): + Middle initial. + + It's derived from + [formatted_name][google.cloud.talent.v4beta1.PersonName.formatted_name] + if not provided. + + Number of characters allowed is 20. + family_name (str): + Family/last name. + + It's derived from + [formatted_name][google.cloud.talent.v4beta1.PersonName.formatted_name] + if not provided. + + Number of characters allowed is 100. + suffixes (Sequence[str]): + Suffixes. + Number of characters allowed is 20. + prefixes (Sequence[str]): + Prefixes. + Number of characters allowed is 20. + """ + + given_name = proto.Field(proto.STRING, number=1) + + preferred_name = proto.Field(proto.STRING, number=6) + + middle_initial = proto.Field(proto.STRING, number=2) + + family_name = proto.Field(proto.STRING, number=3) + + suffixes = proto.RepeatedField(proto.STRING, number=4) + + prefixes = proto.RepeatedField(proto.STRING, number=5) + + formatted_name = proto.Field(proto.STRING, number=1, oneof="person_name") + + structured_name = proto.Field( + proto.MESSAGE, number=2, oneof="person_name", message=PersonStructuredName, + ) + + preferred_name = proto.Field(proto.STRING, number=3) + + +class Address(proto.Message): + r"""Resource that represents a address. + + Attributes: + usage (~.common.ContactInfoUsage): + The usage of the address. For example, + SCHOOL, WORK, PERSONAL. + unstructured_address (str): + Unstructured address. + For example, "1600 Amphitheatre Pkwy, Mountain + View, CA 94043", "Sunnyvale, California". + + Number of characters allowed is 100. + structured_address (~.postal_address.PostalAddress): + Structured address that contains street + address, city, state, country, and so on. + current (~.wrappers.BoolValue): + Indicates if it's the person's current + address. + """ + + usage = proto.Field(proto.ENUM, number=1, enum=common.ContactInfoUsage,) + + unstructured_address = proto.Field(proto.STRING, number=2, oneof="address") + + structured_address = proto.Field( + proto.MESSAGE, number=3, oneof="address", message=postal_address.PostalAddress, + ) + + current = proto.Field(proto.MESSAGE, number=4, message=wrappers.BoolValue,) + + +class Email(proto.Message): + r"""Resource that represents a person's email address. + + Attributes: + usage (~.common.ContactInfoUsage): + The usage of the email address. For example, + SCHOOL, WORK, PERSONAL. + email_address (str): + Email address. + Number of characters allowed is 4,000. + """ + + usage = proto.Field(proto.ENUM, number=1, enum=common.ContactInfoUsage,) + + email_address = proto.Field(proto.STRING, number=2) + + +class Phone(proto.Message): + r"""Resource that represents a person's telephone number. + + Attributes: + usage (~.common.ContactInfoUsage): + The usage of the phone. For example, SCHOOL, + WORK, PERSONAL. + type (~.profile.Phone.PhoneType): + The phone type. For example, LANDLINE, + MOBILE, FAX. + number (str): + Phone number. + Any phone formats are supported and only exact + matches are performed on searches. For example, + if a phone number in profile is provided in the + format of "(xxx)xxx-xxxx", in profile searches + the same phone format has to be provided. + + Number of characters allowed is 20. + when_available (str): + When this number is available. Any + descriptive string is expected. + Number of characters allowed is 100. + """ + + class PhoneType(proto.Enum): + r"""Enum that represents the type of the telephone.""" + PHONE_TYPE_UNSPECIFIED = 0 + LANDLINE = 1 + MOBILE = 2 + FAX = 3 + PAGER = 4 + TTY_OR_TDD = 5 + VOICEMAIL = 6 + VIRTUAL = 7 + VOIP = 8 + MOBILE_OR_LANDLINE = 9 + + usage = proto.Field(proto.ENUM, number=1, enum=common.ContactInfoUsage,) + + type = proto.Field(proto.ENUM, number=2, enum=PhoneType,) + + number = proto.Field(proto.STRING, number=3) + + when_available = proto.Field(proto.STRING, number=4) + + +class PersonalUri(proto.Message): + r"""Resource that represents a valid URI for a personal use. + + Attributes: + uri (str): + The personal URI. + Number of characters allowed is 4,000. + """ + + uri = proto.Field(proto.STRING, number=1) + + +class AdditionalContactInfo(proto.Message): + r"""Resource that represents contact information other than + phone, email, URI and addresses. + + Attributes: + usage (~.common.ContactInfoUsage): + The usage of this contact method. For + example, SCHOOL, WORK, PERSONAL. + name (str): + The name of the contact method. + For example, "hangout", "skype". + + Number of characters allowed is 100. + contact_id (str): + The contact id. + Number of characters allowed is 100. + """ + + usage = proto.Field(proto.ENUM, number=1, enum=common.ContactInfoUsage,) + + name = proto.Field(proto.STRING, number=2) + + contact_id = proto.Field(proto.STRING, number=3) + + +class EmploymentRecord(proto.Message): + r"""Resource that represents an employment record of a candidate. + + Attributes: + start_date (~.date.Date): + Start date of the employment. + end_date (~.date.Date): + End date of the employment. + employer_name (str): + The name of the employer + company/organization. + For example, "Google", "Alphabet", and so on. + Number of characters allowed is 250. + division_name (str): + The division name of the employment. + For example, division, department, client, and + so on. + Number of characters allowed is 100. + address (~.profile.Address): + The physical address of the employer. + job_title (str): + The job title of the employment. + For example, "Software Engineer", "Data + Scientist", and so on. + Number of characters allowed is 250. + job_description (str): + The description of job content. + Number of characters allowed is 100,000. + is_supervisor (~.wrappers.BoolValue): + If the jobs is a supervisor position. + is_self_employed (~.wrappers.BoolValue): + If this employment is self-employed. + is_current (~.wrappers.BoolValue): + If this employment is current. + job_title_snippet (str): + Output only. The job title snippet shows how the + [job_title][google.cloud.talent.v4beta1.EmploymentRecord.job_title] + is related to a search query. It's empty if the + [job_title][google.cloud.talent.v4beta1.EmploymentRecord.job_title] + isn't related to the search query. + job_description_snippet (str): + Output only. The job description snippet shows how the + [job_description][google.cloud.talent.v4beta1.EmploymentRecord.job_description] + is related to a search query. It's empty if the + [job_description][google.cloud.talent.v4beta1.EmploymentRecord.job_description] + isn't related to the search query. + employer_name_snippet (str): + Output only. The employer name snippet shows how the + [employer_name][google.cloud.talent.v4beta1.EmploymentRecord.employer_name] + is related to a search query. It's empty if the + [employer_name][google.cloud.talent.v4beta1.EmploymentRecord.employer_name] + isn't related to the search query. + """ + + start_date = proto.Field(proto.MESSAGE, number=1, message=date.Date,) + + end_date = proto.Field(proto.MESSAGE, number=2, message=date.Date,) + + employer_name = proto.Field(proto.STRING, number=3) + + division_name = proto.Field(proto.STRING, number=4) + + address = proto.Field(proto.MESSAGE, number=5, message=Address,) + + job_title = proto.Field(proto.STRING, number=6) + + job_description = proto.Field(proto.STRING, number=7) + + is_supervisor = proto.Field(proto.MESSAGE, number=8, message=wrappers.BoolValue,) + + is_self_employed = proto.Field(proto.MESSAGE, number=9, message=wrappers.BoolValue,) + + is_current = proto.Field(proto.MESSAGE, number=10, message=wrappers.BoolValue,) + + job_title_snippet = proto.Field(proto.STRING, number=11) + + job_description_snippet = proto.Field(proto.STRING, number=12) + + employer_name_snippet = proto.Field(proto.STRING, number=13) + + +class EducationRecord(proto.Message): + r"""Resource that represents an education record of a candidate. + + Attributes: + start_date (~.date.Date): + The start date of the education. + end_date (~.date.Date): + The end date of the education. + expected_graduation_date (~.date.Date): + The expected graduation date if currently + pursuing a degree. + school_name (str): + The name of the school or institution. + For example, "Stanford University", "UC + Berkeley", and so on. + Number of characters allowed is 250. + address (~.profile.Address): + The physical address of the education + institution. + degree_description (str): + The full description of the degree. + For example, "Master of Science in Computer + Science", "B.S in Math". + Number of characters allowed is 100. + structured_degree (~.profile.Degree): + The structured notation of the degree. + description (str): + The description of the education. + Number of characters allowed is 100,000. + is_current (~.wrappers.BoolValue): + If this education is current. + school_name_snippet (str): + Output only. The school name snippet shows how the + [school_name][google.cloud.talent.v4beta1.EducationRecord.school_name] + is related to a search query in search result. It's empty if + the + [school_name][google.cloud.talent.v4beta1.EducationRecord.school_name] + isn't related to the search query. + degree_snippet (str): + Output only. The job description snippet shows how the + [Degree][google.cloud.talent.v4beta1.Degree] is related to a + search query in search result. It's empty if the + [Degree][google.cloud.talent.v4beta1.Degree] isn't related + to the search query. + """ + + start_date = proto.Field(proto.MESSAGE, number=1, message=date.Date,) + + end_date = proto.Field(proto.MESSAGE, number=2, message=date.Date,) + + expected_graduation_date = proto.Field(proto.MESSAGE, number=3, message=date.Date,) + + school_name = proto.Field(proto.STRING, number=4) + + address = proto.Field(proto.MESSAGE, number=5, message=Address,) + + degree_description = proto.Field(proto.STRING, number=6, oneof="degree") + + structured_degree = proto.Field( + proto.MESSAGE, number=7, oneof="degree", message="Degree", + ) + + description = proto.Field(proto.STRING, number=8) + + is_current = proto.Field(proto.MESSAGE, number=9, message=wrappers.BoolValue,) + + school_name_snippet = proto.Field(proto.STRING, number=10) + + degree_snippet = proto.Field(proto.STRING, number=11) + + +class Degree(proto.Message): + r"""Resource that represents a degree pursuing or acquired by a + candidate. + + Attributes: + degree_type (~.common.DegreeType): + ISCED degree type. + degree_name (str): + Full Degree name. + For example, "B.S.", "Master of Arts", and so + on. + Number of characters allowed is 100. + fields_of_study (Sequence[str]): + Fields of study for the degree. + For example, "Computer science", "engineering". + Number of characters allowed is 100. + """ + + degree_type = proto.Field(proto.ENUM, number=1, enum=common.DegreeType,) + + degree_name = proto.Field(proto.STRING, number=2) + + fields_of_study = proto.RepeatedField(proto.STRING, number=3) + + +class Activity(proto.Message): + r"""Resource that represents an individual or collaborative + activity participated in by a candidate, for example, an open- + source project, a class assignment, and so on. + + Attributes: + display_name (str): + Activity display name. + Number of characters allowed is 100. + description (str): + Activity description. + Number of characters allowed is 100,000. + uri (str): + Activity URI. + Number of characters allowed is 4,000. + create_date (~.date.Date): + The first creation date of the activity. + update_date (~.date.Date): + The last update date of the activity. + team_members (Sequence[str]): + A list of team members involved in this + activity. + Number of characters allowed is 100. + + The limitation for max number of team members is + 50. + skills_used (Sequence[~.common.Skill]): + A list of skills used in this activity. + The limitation for max number of skills used is + 50. + activity_name_snippet (str): + Output only. Activity name snippet shows how the + [display_name][google.cloud.talent.v4beta1.Activity.display_name] + is related to a search query. It's empty if the + [display_name][google.cloud.talent.v4beta1.Activity.display_name] + isn't related to the search query. + activity_description_snippet (str): + Output only. Activity description snippet shows how the + [description][google.cloud.talent.v4beta1.Activity.description] + is related to a search query. It's empty if the + [description][google.cloud.talent.v4beta1.Activity.description] + isn't related to the search query. + skills_used_snippet (Sequence[str]): + Output only. Skill used snippet shows how the corresponding + [skills_used][google.cloud.talent.v4beta1.Activity.skills_used] + are related to a search query. It's empty if the + corresponding + [skills_used][google.cloud.talent.v4beta1.Activity.skills_used] + are not related to the search query. + """ + + display_name = proto.Field(proto.STRING, number=1) + + description = proto.Field(proto.STRING, number=2) + + uri = proto.Field(proto.STRING, number=3) + + create_date = proto.Field(proto.MESSAGE, number=4, message=date.Date,) + + update_date = proto.Field(proto.MESSAGE, number=5, message=date.Date,) + + team_members = proto.RepeatedField(proto.STRING, number=6) + + skills_used = proto.RepeatedField(proto.MESSAGE, number=7, message=common.Skill,) + + activity_name_snippet = proto.Field(proto.STRING, number=8) + + activity_description_snippet = proto.Field(proto.STRING, number=9) + + skills_used_snippet = proto.RepeatedField(proto.STRING, number=10) + + +class Publication(proto.Message): + r"""Resource that represents a publication resource of a + candidate. + + Attributes: + authors (Sequence[str]): + A list of author names. + Number of characters allowed is 100. + title (str): + The title of the publication. + Number of characters allowed is 100. + description (str): + The description of the publication. + Number of characters allowed is 100,000. + journal (str): + The journal name of the publication. + Number of characters allowed is 100. + volume (str): + Volume number. + Number of characters allowed is 100. + publisher (str): + The publisher of the journal. + Number of characters allowed is 100. + publication_date (~.date.Date): + The publication date. + publication_type (str): + The publication type. + Number of characters allowed is 100. + isbn (str): + ISBN number. + Number of characters allowed is 100. + """ + + authors = proto.RepeatedField(proto.STRING, number=1) + + title = proto.Field(proto.STRING, number=2) + + description = proto.Field(proto.STRING, number=3) + + journal = proto.Field(proto.STRING, number=4) + + volume = proto.Field(proto.STRING, number=5) + + publisher = proto.Field(proto.STRING, number=6) + + publication_date = proto.Field(proto.MESSAGE, number=7, message=date.Date,) + + publication_type = proto.Field(proto.STRING, number=8) + + isbn = proto.Field(proto.STRING, number=9) + + +class Patent(proto.Message): + r"""Resource that represents the patent acquired by a candidate. + + Attributes: + display_name (str): + Name of the patent. + Number of characters allowed is 100. + inventors (Sequence[str]): + A list of inventors' names. + Number of characters allowed for each is 100. + patent_status (str): + The status of the patent. + Number of characters allowed is 100. + patent_status_date (~.date.Date): + The date the last time the status of the + patent was checked. + patent_filing_date (~.date.Date): + The date that the patent was filed. + patent_office (str): + The name of the patent office. + Number of characters allowed is 100. + patent_number (str): + The number of the patent. + Number of characters allowed is 100. + patent_description (str): + The description of the patent. + Number of characters allowed is 100,000. + skills_used (Sequence[~.common.Skill]): + The skills used in this patent. + """ + + display_name = proto.Field(proto.STRING, number=1) + + inventors = proto.RepeatedField(proto.STRING, number=2) + + patent_status = proto.Field(proto.STRING, number=3) + + patent_status_date = proto.Field(proto.MESSAGE, number=4, message=date.Date,) + + patent_filing_date = proto.Field(proto.MESSAGE, number=5, message=date.Date,) + + patent_office = proto.Field(proto.STRING, number=6) + + patent_number = proto.Field(proto.STRING, number=7) + + patent_description = proto.Field(proto.STRING, number=8) + + skills_used = proto.RepeatedField(proto.MESSAGE, number=9, message=common.Skill,) + + +__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/cloud/talent_v4beta1/types/profile_service.py b/google/cloud/talent_v4beta1/types/profile_service.py new file mode 100644 index 00000000..1214e0ab --- /dev/null +++ b/google/cloud/talent_v4beta1/types/profile_service.py @@ -0,0 +1,546 @@ +# -*- 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. +# + +import proto # type: ignore + + +from google.cloud.talent_v4beta1.types import common +from google.cloud.talent_v4beta1.types import filters +from google.cloud.talent_v4beta1.types import histogram +from google.cloud.talent_v4beta1.types import profile as gct_profile +from google.protobuf import field_mask_pb2 as field_mask # type: ignore + + +__protobuf__ = proto.module( + package="google.cloud.talent.v4beta1", + manifest={ + "ListProfilesRequest", + "ListProfilesResponse", + "CreateProfileRequest", + "GetProfileRequest", + "UpdateProfileRequest", + "DeleteProfileRequest", + "SearchProfilesRequest", + "SearchProfilesResponse", + "SummarizedProfile", + }, +) + + +class ListProfilesRequest(proto.Message): + r"""List profiles request. + + Attributes: + parent (str): + Required. The resource name of the tenant under which the + profile is created. + + The format is "projects/{project_id}/tenants/{tenant_id}". + For example, "projects/foo/tenants/bar". + filter (str): + The filter string specifies the profiles to be enumerated. + + Supported operator: =, AND + + The field(s) eligible for filtering are: + + - ``externalId`` + - ``groupId`` + + externalId and groupId cannot be specified at the same time. + If both externalId and groupId are provided, the API will + return a bad request error. + + Sample Query: + + - externalId = "externalId-1" + - groupId = "groupId-1". + page_token (str): + The token that specifies the current offset (that is, + starting result). + + Please set the value to + [ListProfilesResponse.next_page_token][google.cloud.talent.v4beta1.ListProfilesResponse.next_page_token] + to continue the list. + page_size (int): + The maximum number of profiles to be + returned, at most 100. + Default is 100 unless a positive number smaller + than 100 is specified. + read_mask (~.field_mask.FieldMask): + A field mask to specify the profile fields to be listed in + response. All fields are listed if it is unset. + + Valid values are: + + - name + """ + + parent = proto.Field(proto.STRING, number=1) + + filter = proto.Field(proto.STRING, number=5) + + page_token = proto.Field(proto.STRING, number=2) + + page_size = proto.Field(proto.INT32, number=3) + + read_mask = proto.Field(proto.MESSAGE, number=4, message=field_mask.FieldMask,) + + +class ListProfilesResponse(proto.Message): + r"""The List profiles response object. + + Attributes: + profiles (Sequence[~.gct_profile.Profile]): + Profiles for the specific tenant. + next_page_token (str): + A token to retrieve the next page of results. + This is empty if there are no more results. + """ + + @property + def raw_page(self): + return self + + profiles = proto.RepeatedField( + proto.MESSAGE, number=1, message=gct_profile.Profile, + ) + + next_page_token = proto.Field(proto.STRING, number=2) + + +class CreateProfileRequest(proto.Message): + r"""Create profile request. + + Attributes: + parent (str): + Required. The name of the tenant this profile belongs to. + + The format is "projects/{project_id}/tenants/{tenant_id}". + For example, "projects/foo/tenants/bar". + profile (~.gct_profile.Profile): + Required. The profile to be created. + """ + + parent = proto.Field(proto.STRING, number=1) + + profile = proto.Field(proto.MESSAGE, number=2, message=gct_profile.Profile,) + + +class GetProfileRequest(proto.Message): + r"""Get profile request. + + Attributes: + name (str): + Required. Resource name of the profile to get. + + The format is + "projects/{project_id}/tenants/{tenant_id}/profiles/{profile_id}". + For example, "projects/foo/tenants/bar/profiles/baz". + """ + + name = proto.Field(proto.STRING, number=1) + + +class UpdateProfileRequest(proto.Message): + r"""Update profile request + + Attributes: + profile (~.gct_profile.Profile): + Required. Profile to be updated. + update_mask (~.field_mask.FieldMask): + A field mask to specify the profile fields to + update. + A full update is performed if it is unset. + """ + + profile = proto.Field(proto.MESSAGE, number=1, message=gct_profile.Profile,) + + update_mask = proto.Field(proto.MESSAGE, number=2, message=field_mask.FieldMask,) + + +class DeleteProfileRequest(proto.Message): + r"""Delete profile request. + + Attributes: + name (str): + Required. Resource name of the profile to be deleted. + + The format is + "projects/{project_id}/tenants/{tenant_id}/profiles/{profile_id}". + For example, "projects/foo/tenants/bar/profiles/baz". + """ + + name = proto.Field(proto.STRING, number=1) + + +class SearchProfilesRequest(proto.Message): + r"""The request body of the ``SearchProfiles`` call. + + Attributes: + parent (str): + Required. The resource name of the tenant to search within. + + The format is "projects/{project_id}/tenants/{tenant_id}". + For example, "projects/foo/tenants/bar". + request_metadata (~.common.RequestMetadata): + Required. The meta information collected + about the profile search user. This is used to + improve the search quality of the service. These + values are provided by users, and must be + precise and consistent. + profile_query (~.filters.ProfileQuery): + Search query to execute. See + [ProfileQuery][google.cloud.talent.v4beta1.ProfileQuery] for + more details. + page_size (int): + A limit on the number of profiles returned in + the search results. A value above the default + value 10 can increase search response time. + The maximum value allowed is 100. Otherwise an + error is thrown. + page_token (str): + The pageToken, similar to offset enables users of the API to + paginate through the search results. To retrieve the first + page of results, set the pageToken to empty. The search + response includes a + [nextPageToken][google.cloud.talent.v4beta1.SearchProfilesResponse.next_page_token] + field that can be used to populate the pageToken field for + the next page of results. Using pageToken instead of offset + increases the performance of the API, especially compared to + larger offset values. + offset (int): + An integer that specifies the current offset (that is, + starting result) in search results. This field is only + considered if + [page_token][google.cloud.talent.v4beta1.SearchProfilesRequest.page_token] + is unset. + + The maximum allowed value is 5000. Otherwise an error is + thrown. + + For example, 0 means to search from the first profile, and + 10 means to search from the 11th profile. This can be used + for pagination, for example pageSize = 10 and offset = 10 + means to search from the second page. + disable_spell_check (bool): + This flag controls the spell-check feature. If ``false``, + the service attempts to correct a misspelled query. + + For example, "enginee" is corrected to "engineer". + order_by (str): + The criteria that determines how search results are sorted. + Defaults is "relevance desc" if no value is specified. + + Supported options are: + + - "relevance desc": By descending relevance, as determined + by the API algorithms. + - "update_date desc": Sort by + [Profile.update_time][google.cloud.talent.v4beta1.Profile.update_time] + in descending order (recently updated profiles first). + - "create_date desc": Sort by + [Profile.create_time][google.cloud.talent.v4beta1.Profile.create_time] + in descending order (recently created profiles first). + - "first_name": Sort by + [PersonName.PersonStructuredName.given_name][google.cloud.talent.v4beta1.PersonName.PersonStructuredName.given_name] + in ascending order. + - "first_name desc": Sort by + [PersonName.PersonStructuredName.given_name][google.cloud.talent.v4beta1.PersonName.PersonStructuredName.given_name] + in descending order. + - "last_name": Sort by + [PersonName.PersonStructuredName.family_name][google.cloud.talent.v4beta1.PersonName.PersonStructuredName.family_name] + in ascending order. + - "last_name desc": Sort by + [PersonName.PersonStructuredName.family_name][google.cloud.talent.v4beta1.PersonName.PersonStructuredName.family_name] + in ascending order. + case_sensitive_sort (bool): + When sort by field is based on alphabetical + order, sort values case sensitively (based on + ASCII) when the value is set to true. Default + value is case in-sensitive sort (false). + histogram_queries (Sequence[~.histogram.HistogramQuery]): + A list of expressions specifies histogram requests against + matching profiles for + [SearchProfilesRequest][google.cloud.talent.v4beta1.SearchProfilesRequest]. + + The expression syntax looks like a function definition with + parameters. + + Function syntax: function_name(histogram_facet[, list of + buckets]) + + Data types: + + - Histogram facet: facet names with format + [a-zA-Z][a-zA-Z0-9\_]+. + - String: string like "any string with backslash escape for + quote(")." + - Number: whole number and floating point number like 10, + -1 and -0.01. + - List: list of elements with comma(,) separator surrounded + by square brackets. For example, [1, 2, 3] and ["one", + "two", "three"]. + + Built-in constants: + + - MIN (minimum number similar to java Double.MIN_VALUE) + - MAX (maximum number similar to java Double.MAX_VALUE) + + Built-in functions: + + - bucket(start, end[, label]) Bucket build-in function + creates a bucket with range of [start, end). Note that + the end is exclusive. For example, bucket(1, MAX, + "positive number") or bucket(1, 10). + + Histogram Facets: + + - admin1: Admin1 is a global placeholder for referring to + state, province, or the particular term a country uses to + define the geographic structure below the country level. + Examples include states codes such as "CA", "IL", "NY", + and provinces, such as "BC". + - locality: Locality is a global placeholder for referring + to city, town, or the particular term a country uses to + define the geographic structure below the admin1 level. + Examples include city names such as "Mountain View" and + "New York". + - extended_locality: Extended locality is concatenated + version of admin1 and locality with comma separator. For + example, "Mountain View, CA" and "New York, NY". + - postal_code: Postal code of profile which follows locale + code. + - country: Country code (ISO-3166-1 alpha-2 code) of + profile, such as US, JP, GB. + - job_title: Normalized job titles specified in + EmploymentHistory. + - company_name: Normalized company name of profiles to + match on. + - institution: The school name. For example, "MIT", + "University of California, Berkeley" + - degree: Highest education degree in ISCED code. Each + value in degree covers a specific level of education, + without any expansion to upper nor lower levels of + education degree. + - experience_in_months: experience in months. 0 means 0 + month to 1 month (exclusive). + - application_date: The application date specifies + application start dates. See + [ApplicationDateFilter][google.cloud.talent.v4beta1.ApplicationDateFilter] + for more details. + - application_outcome_notes: The application outcome reason + specifies the reasons behind the outcome of the job + application. See + [ApplicationOutcomeNotesFilter][google.cloud.talent.v4beta1.ApplicationOutcomeNotesFilter] + for more details. + - application_job_title: The application job title + specifies the job applied for in the application. See + [ApplicationJobFilter][google.cloud.talent.v4beta1.ApplicationJobFilter] + for more details. + - hirable_status: Hirable status specifies the profile's + hirable status. + - string_custom_attribute: String custom attributes. Values + can be accessed via square bracket notation like + string_custom_attribute["key1"]. + - numeric_custom_attribute: Numeric custom attributes. + Values can be accessed via square bracket notation like + numeric_custom_attribute["key1"]. + + Example expressions: + + - count(admin1) + - count(experience_in_months, [bucket(0, 12, "1 year"), + bucket(12, 36, "1-3 years"), bucket(36, MAX, "3+ + years")]) + - count(string_custom_attribute["assigned_recruiter"]) + - count(numeric_custom_attribute["favorite_number"], + [bucket(MIN, 0, "negative"), bucket(0, MAX, + "non-negative")]) + result_set_id (str): + An id that uniquely identifies the result set of a + [SearchProfiles][google.cloud.talent.v4beta1.ProfileService.SearchProfiles] + call. The id should be retrieved from the + [SearchProfilesResponse][google.cloud.talent.v4beta1.SearchProfilesResponse] + message returned from a previous invocation of + [SearchProfiles][google.cloud.talent.v4beta1.ProfileService.SearchProfiles]. + + A result set is an ordered list of search results. + + If this field is not set, a new result set is computed based + on the + [profile_query][google.cloud.talent.v4beta1.SearchProfilesRequest.profile_query]. + A new + [result_set_id][google.cloud.talent.v4beta1.SearchProfilesRequest.result_set_id] + is returned as a handle to access this result set. + + If this field is set, the service will ignore the resource + and + [profile_query][google.cloud.talent.v4beta1.SearchProfilesRequest.profile_query] + values, and simply retrieve a page of results from the + corresponding result set. In this case, one and only one of + [page_token][google.cloud.talent.v4beta1.SearchProfilesRequest.page_token] + or + [offset][google.cloud.talent.v4beta1.SearchProfilesRequest.offset] + must be set. + + A typical use case is to invoke + [SearchProfilesRequest][google.cloud.talent.v4beta1.SearchProfilesRequest] + without this field, then use the resulting + [result_set_id][google.cloud.talent.v4beta1.SearchProfilesRequest.result_set_id] + in + [SearchProfilesResponse][google.cloud.talent.v4beta1.SearchProfilesResponse] + to page through the results. + strict_keywords_search (bool): + This flag is used to indicate whether the + service will attempt to understand synonyms and + terms related to the search query or treat the + query "as is" when it generates a set of + results. By default this flag is set to false, + thus allowing expanded results to also be + returned. For example a search for "software + engineer" might also return candidates who have + experience in jobs similar to software engineer + positions. By setting this flag to true, the + service will only attempt to deliver candidates + has software engineer in his/her global fields + by treating "software engineer" as a keyword. + + It is recommended to provide a feature in the UI + (such as a checkbox) to allow recruiters to set + this flag to true if they intend to search for + longer boolean strings. + """ + + parent = proto.Field(proto.STRING, number=1) + + request_metadata = proto.Field( + proto.MESSAGE, number=2, message=common.RequestMetadata, + ) + + profile_query = proto.Field(proto.MESSAGE, number=3, message=filters.ProfileQuery,) + + page_size = proto.Field(proto.INT32, number=4) + + page_token = proto.Field(proto.STRING, number=5) + + offset = proto.Field(proto.INT32, number=6) + + disable_spell_check = proto.Field(proto.BOOL, number=7) + + order_by = proto.Field(proto.STRING, number=8) + + case_sensitive_sort = proto.Field(proto.BOOL, number=9) + + histogram_queries = proto.RepeatedField( + proto.MESSAGE, number=10, message=histogram.HistogramQuery, + ) + + result_set_id = proto.Field(proto.STRING, number=12) + + strict_keywords_search = proto.Field(proto.BOOL, number=13) + + +class SearchProfilesResponse(proto.Message): + r"""Response of SearchProfiles method. + + Attributes: + estimated_total_size (int): + An estimation of the number of profiles that + match the specified query. + This number isn't guaranteed to be accurate. + spell_correction (~.common.SpellingCorrection): + The spell checking result, and correction. + metadata (~.common.ResponseMetadata): + Additional information for the API + invocation, such as the request tracking id. + next_page_token (str): + A token to retrieve the next page of results. + This is empty if there are no more results. + histogram_query_results (Sequence[~.histogram.HistogramQueryResult]): + The histogram results that match with specified + [SearchProfilesRequest.histogram_queries][google.cloud.talent.v4beta1.SearchProfilesRequest.histogram_queries]. + summarized_profiles (Sequence[~.profile_service.SummarizedProfile]): + The profile entities that match the specified + [SearchProfilesRequest][google.cloud.talent.v4beta1.SearchProfilesRequest]. + result_set_id (str): + An id that uniquely identifies the result set of a + [SearchProfiles][google.cloud.talent.v4beta1.ProfileService.SearchProfiles] + call for consistent results. + """ + + @property + def raw_page(self): + return self + + estimated_total_size = proto.Field(proto.INT64, number=1) + + spell_correction = proto.Field( + proto.MESSAGE, number=2, message=common.SpellingCorrection, + ) + + metadata = proto.Field(proto.MESSAGE, number=3, message=common.ResponseMetadata,) + + next_page_token = proto.Field(proto.STRING, number=4) + + histogram_query_results = proto.RepeatedField( + proto.MESSAGE, number=5, message=histogram.HistogramQueryResult, + ) + + summarized_profiles = proto.RepeatedField( + proto.MESSAGE, number=6, message="SummarizedProfile", + ) + + result_set_id = proto.Field(proto.STRING, number=7) + + +class SummarizedProfile(proto.Message): + r"""Profile entry with metadata inside + [SearchProfilesResponse][google.cloud.talent.v4beta1.SearchProfilesResponse]. + + Attributes: + profiles (Sequence[~.gct_profile.Profile]): + A list of profiles that are linked by + [Profile.group_id][google.cloud.talent.v4beta1.Profile.group_id]. + summary (~.gct_profile.Profile): + A profile summary shows the profile summary and how the + profile matches the search query. + + In profile summary, the profiles with the same + [Profile.group_id][google.cloud.talent.v4beta1.Profile.group_id] + are merged together. Among profiles, same + education/employment records may be slightly different but + they are merged into one with best efforts. + + For example, in one profile the school name is "UC Berkeley" + and the field study is "Computer Science" and in another one + the school name is "University of California at Berkeley" + and the field study is "CS". The API merges these two inputs + into one and selects one value for each field. For example, + the school name in summary is set to "University of + California at Berkeley" and the field of study is set to + "Computer Science". + """ + + profiles = proto.RepeatedField( + proto.MESSAGE, number=1, message=gct_profile.Profile, + ) + + summary = proto.Field(proto.MESSAGE, number=2, message=gct_profile.Profile,) + + +__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/cloud/talent_v4beta1/types/tenant.py b/google/cloud/talent_v4beta1/types/tenant.py new file mode 100644 index 00000000..c7d1974d --- /dev/null +++ b/google/cloud/talent_v4beta1/types/tenant.py @@ -0,0 +1,83 @@ +# -*- 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. +# + +import proto # type: ignore + + +__protobuf__ = proto.module( + package="google.cloud.talent.v4beta1", manifest={"Tenant",}, +) + + +class Tenant(proto.Message): + r"""A Tenant resource represents a tenant in the service. A + tenant is a group or entity that shares common access with + specific privileges for resources like profiles. Customer may + create multiple tenants to provide data isolation for different + groups. + + Attributes: + name (str): + Required during tenant update. + + The resource name for a tenant. This is generated by the + service when a tenant is created. + + The format is "projects/{project_id}/tenants/{tenant_id}", + for example, "projects/foo/tenants/bar". + external_id (str): + Required. Client side tenant identifier, used + to uniquely identify the tenant. + The maximum number of allowed characters is 255. + usage_type (~.tenant.Tenant.DataUsageType): + Indicates whether data owned by this tenant may be used to + provide product improvements across other tenants. + + Defaults behavior is + [DataUsageType.ISOLATED][google.cloud.talent.v4beta1.Tenant.DataUsageType.ISOLATED] + if it's unset. + keyword_searchable_profile_custom_attributes (Sequence[str]): + A list of keys of filterable + [Profile.custom_attributes][google.cloud.talent.v4beta1.Profile.custom_attributes], + whose corresponding ``string_values`` are used in keyword + searches. Profiles with ``string_values`` under these + specified field keys are returned if any of the values match + the search keyword. Custom field values with parenthesis, + brackets and special symbols are not searchable as-is, and + must be surrounded by quotes. + """ + + class DataUsageType(proto.Enum): + r"""Enum that represents how user data owned by the tenant is + used. + """ + DATA_USAGE_TYPE_UNSPECIFIED = 0 + AGGREGATED = 1 + ISOLATED = 2 + + name = proto.Field(proto.STRING, number=1) + + external_id = proto.Field(proto.STRING, number=2) + + usage_type = proto.Field(proto.ENUM, number=3, enum=DataUsageType,) + + keyword_searchable_profile_custom_attributes = proto.RepeatedField( + proto.STRING, number=4 + ) + + +__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/cloud/talent_v4beta1/types/tenant_service.py b/google/cloud/talent_v4beta1/types/tenant_service.py new file mode 100644 index 00000000..505da6f7 --- /dev/null +++ b/google/cloud/talent_v4beta1/types/tenant_service.py @@ -0,0 +1,162 @@ +# -*- 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. +# + +import proto # type: ignore + + +from google.cloud.talent_v4beta1.types import common +from google.cloud.talent_v4beta1.types import tenant as gct_tenant +from google.protobuf import field_mask_pb2 as field_mask # type: ignore + + +__protobuf__ = proto.module( + package="google.cloud.talent.v4beta1", + manifest={ + "CreateTenantRequest", + "GetTenantRequest", + "UpdateTenantRequest", + "DeleteTenantRequest", + "ListTenantsRequest", + "ListTenantsResponse", + }, +) + + +class CreateTenantRequest(proto.Message): + r"""The Request of the CreateTenant method. + + Attributes: + parent (str): + Required. Resource name of the project under which the + tenant is created. + + The format is "projects/{project_id}", for example, + "projects/foo". + tenant (~.gct_tenant.Tenant): + Required. The tenant to be created. + """ + + parent = proto.Field(proto.STRING, number=1) + + tenant = proto.Field(proto.MESSAGE, number=2, message=gct_tenant.Tenant,) + + +class GetTenantRequest(proto.Message): + r"""Request for getting a tenant by name. + + Attributes: + name (str): + Required. The resource name of the tenant to be retrieved. + + The format is "projects/{project_id}/tenants/{tenant_id}", + for example, "projects/foo/tenants/bar". + """ + + name = proto.Field(proto.STRING, number=1) + + +class UpdateTenantRequest(proto.Message): + r"""Request for updating a specified tenant. + + Attributes: + tenant (~.gct_tenant.Tenant): + Required. The tenant resource to replace the + current resource in the system. + update_mask (~.field_mask.FieldMask): + Strongly recommended for the best service experience. + + If + [update_mask][google.cloud.talent.v4beta1.UpdateTenantRequest.update_mask] + is provided, only the specified fields in + [tenant][google.cloud.talent.v4beta1.UpdateTenantRequest.tenant] + are updated. Otherwise all the fields are updated. + + A field mask to specify the tenant fields to be updated. + Only top level fields of + [Tenant][google.cloud.talent.v4beta1.Tenant] are supported. + """ + + tenant = proto.Field(proto.MESSAGE, number=1, message=gct_tenant.Tenant,) + + update_mask = proto.Field(proto.MESSAGE, number=2, message=field_mask.FieldMask,) + + +class DeleteTenantRequest(proto.Message): + r"""Request to delete a tenant. + + Attributes: + name (str): + Required. The resource name of the tenant to be deleted. + + The format is "projects/{project_id}/tenants/{tenant_id}", + for example, "projects/foo/tenants/bar". + """ + + name = proto.Field(proto.STRING, number=1) + + +class ListTenantsRequest(proto.Message): + r"""List tenants for which the client has ACL visibility. + + Attributes: + parent (str): + Required. Resource name of the project under which the + tenant is created. + + The format is "projects/{project_id}", for example, + "projects/foo". + page_token (str): + The starting indicator from which to return + results. + page_size (int): + The maximum number of tenants to be returned, + at most 100. Default is 100 if a non-positive + number is provided. + """ + + parent = proto.Field(proto.STRING, number=1) + + page_token = proto.Field(proto.STRING, number=2) + + page_size = proto.Field(proto.INT32, number=3) + + +class ListTenantsResponse(proto.Message): + r"""The List tenants response object. + + Attributes: + tenants (Sequence[~.gct_tenant.Tenant]): + Tenants for the current client. + next_page_token (str): + A token to retrieve the next page of results. + metadata (~.common.ResponseMetadata): + Additional information for the API + invocation, such as the request tracking id. + """ + + @property + def raw_page(self): + return self + + tenants = proto.RepeatedField(proto.MESSAGE, number=1, message=gct_tenant.Tenant,) + + next_page_token = proto.Field(proto.STRING, number=2) + + metadata = proto.Field(proto.MESSAGE, number=3, message=common.ResponseMetadata,) + + +__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/mypy.ini b/mypy.ini new file mode 100644 index 00000000..4505b485 --- /dev/null +++ b/mypy.ini @@ -0,0 +1,3 @@ +[mypy] +python_version = 3.6 +namespace_packages = True diff --git a/noxfile.py b/noxfile.py index c6512ac3..a30ba11a 100644 --- a/noxfile.py +++ b/noxfile.py @@ -27,8 +27,8 @@ BLACK_PATHS = ["docs", "google", "tests", "noxfile.py", "setup.py"] DEFAULT_PYTHON_VERSION = "3.8" -SYSTEM_TEST_PYTHON_VERSIONS = ["2.7", "3.8"] -UNIT_TEST_PYTHON_VERSIONS = ["2.7", "3.5", "3.6", "3.7", "3.8"] +SYSTEM_TEST_PYTHON_VERSIONS = ["3.8"] +UNIT_TEST_PYTHON_VERSIONS = ["3.6", "3.7", "3.8"] @nox.session(python=DEFAULT_PYTHON_VERSION) @@ -70,6 +70,8 @@ def lint_setup_py(session): def default(session): # Install all test dependencies, then install this package in-place. + session.install("asyncmock", "pytest-asyncio") + session.install("mock", "pytest", "pytest-cov") session.install("-e", ".") @@ -135,7 +137,7 @@ def cover(session): test runs (not system test runs), and then erases coverage data. """ session.install("coverage", "pytest-cov") - session.run("coverage", "report", "--show-missing", "--fail-under=83") + session.run("coverage", "report", "--show-missing", "--fail-under=99") session.run("coverage", "erase") @@ -150,7 +152,7 @@ def docs(session): shutil.rmtree(os.path.join("docs", "_build"), ignore_errors=True) session.run( "sphinx-build", - "-W", # warnings as errors + # "-W", # warnings as errors "-T", # show full traceback on exception "-N", # no colors "-b", diff --git a/samples/AUTHORING_GUIDE.md b/samples/AUTHORING_GUIDE.md new file mode 100644 index 00000000..55c97b32 --- /dev/null +++ b/samples/AUTHORING_GUIDE.md @@ -0,0 +1 @@ +See https://github.com/GoogleCloudPlatform/python-docs-samples/blob/master/AUTHORING_GUIDE.md \ No newline at end of file diff --git a/samples/CONTRIBUTING.md b/samples/CONTRIBUTING.md new file mode 100644 index 00000000..34c882b6 --- /dev/null +++ b/samples/CONTRIBUTING.md @@ -0,0 +1 @@ +See https://github.com/GoogleCloudPlatform/python-docs-samples/blob/master/CONTRIBUTING.md \ No newline at end of file diff --git a/scripts/fixup_talent_v4beta1_keywords.py b/scripts/fixup_talent_v4beta1_keywords.py new file mode 100644 index 00000000..e74650c5 --- /dev/null +++ b/scripts/fixup_talent_v4beta1_keywords.py @@ -0,0 +1,210 @@ +# -*- 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. +# + +import argparse +import os +import libcst as cst +import pathlib +import sys +from typing import (Any, Callable, Dict, List, Sequence, Tuple) + + +def partition( + predicate: Callable[[Any], bool], + iterator: Sequence[Any] +) -> Tuple[List[Any], List[Any]]: + """A stable, out-of-place partition.""" + results = ([], []) + + for i in iterator: + results[int(predicate(i))].append(i) + + # Returns trueList, falseList + return results[1], results[0] + + +class talentCallTransformer(cst.CSTTransformer): + CTRL_PARAMS: Tuple[str] = ('retry', 'timeout', 'metadata') + METHOD_TO_PARAMS: Dict[str, Tuple[str]] = { + 'batch_create_jobs': ('parent', 'jobs', ), + 'batch_delete_jobs': ('parent', 'filter', ), + 'batch_update_jobs': ('parent', 'jobs', 'update_mask', ), + 'complete_query': ('parent', 'query', 'page_size', 'language_codes', 'company', 'scope', 'type', ), + 'create_application': ('parent', 'application', ), + 'create_client_event': ('parent', 'client_event', ), + 'create_company': ('parent', 'company', ), + 'create_job': ('parent', 'job', ), + 'create_profile': ('parent', 'profile', ), + 'create_tenant': ('parent', 'tenant', ), + 'delete_application': ('name', ), + 'delete_company': ('name', ), + 'delete_job': ('name', ), + 'delete_profile': ('name', ), + 'delete_tenant': ('name', ), + 'get_application': ('name', ), + 'get_company': ('name', ), + 'get_job': ('name', ), + 'get_profile': ('name', ), + 'get_tenant': ('name', ), + 'list_applications': ('parent', 'page_token', 'page_size', ), + 'list_companies': ('parent', 'page_token', 'page_size', 'require_open_jobs', ), + 'list_jobs': ('parent', 'filter', 'page_token', 'page_size', 'job_view', ), + 'list_profiles': ('parent', 'filter', 'page_token', 'page_size', 'read_mask', ), + 'list_tenants': ('parent', 'page_token', 'page_size', ), + 'search_jobs': ('parent', 'request_metadata', 'search_mode', 'job_query', 'enable_broadening', 'require_precise_result_size', 'histogram_queries', 'job_view', 'offset', 'page_size', 'page_token', 'order_by', 'diversification_level', 'custom_ranking_info', 'disable_keyword_match', ), + 'search_jobs_for_alert': ('parent', 'request_metadata', 'search_mode', 'job_query', 'enable_broadening', 'require_precise_result_size', 'histogram_queries', 'job_view', 'offset', 'page_size', 'page_token', 'order_by', 'diversification_level', 'custom_ranking_info', 'disable_keyword_match', ), + 'search_profiles': ('parent', 'request_metadata', 'profile_query', 'page_size', 'page_token', 'offset', 'disable_spell_check', 'order_by', 'case_sensitive_sort', 'histogram_queries', 'result_set_id', 'strict_keywords_search', ), + 'update_application': ('application', 'update_mask', ), + 'update_company': ('company', 'update_mask', ), + 'update_job': ('job', 'update_mask', ), + 'update_profile': ('profile', 'update_mask', ), + 'update_tenant': ('tenant', 'update_mask', ), + + } + + def leave_Call(self, original: cst.Call, updated: cst.Call) -> cst.CSTNode: + try: + key = original.func.attr.value + kword_params = self.METHOD_TO_PARAMS[key] + except (AttributeError, KeyError): + # Either not a method from the API or too convoluted to be sure. + return updated + + # If the existing code is valid, keyword args come after positional args. + # Therefore, all positional args must map to the first parameters. + args, kwargs = partition(lambda a: not bool(a.keyword), updated.args) + if any(k.keyword.value == "request" for k in kwargs): + # We've already fixed this file, don't fix it again. + return updated + + kwargs, ctrl_kwargs = partition( + lambda a: not a.keyword.value in self.CTRL_PARAMS, + kwargs + ) + + args, ctrl_args = args[:len(kword_params)], args[len(kword_params):] + ctrl_kwargs.extend(cst.Arg(value=a.value, keyword=cst.Name(value=ctrl)) + for a, ctrl in zip(ctrl_args, self.CTRL_PARAMS)) + + request_arg = cst.Arg( + value=cst.Dict([ + cst.DictElement( + cst.SimpleString("'{}'".format(name)), + cst.Element(value=arg.value) + ) + # Note: the args + kwargs looks silly, but keep in mind that + # the control parameters had to be stripped out, and that + # those could have been passed positionally or by keyword. + for name, arg in zip(kword_params, args + kwargs)]), + keyword=cst.Name("request") + ) + + return updated.with_changes( + args=[request_arg] + ctrl_kwargs + ) + + +def fix_files( + in_dir: pathlib.Path, + out_dir: pathlib.Path, + *, + transformer=talentCallTransformer(), +): + """Duplicate the input dir to the output dir, fixing file method calls. + + Preconditions: + * in_dir is a real directory + * out_dir is a real, empty directory + """ + pyfile_gen = ( + pathlib.Path(os.path.join(root, f)) + for root, _, files in os.walk(in_dir) + for f in files if os.path.splitext(f)[1] == ".py" + ) + + for fpath in pyfile_gen: + with open(fpath, 'r') as f: + src = f.read() + + # Parse the code and insert method call fixes. + tree = cst.parse_module(src) + updated = tree.visit(transformer) + + # Create the path and directory structure for the new file. + updated_path = out_dir.joinpath(fpath.relative_to(in_dir)) + updated_path.parent.mkdir(parents=True, exist_ok=True) + + # Generate the updated source file at the corresponding path. + with open(updated_path, 'w') as f: + f.write(updated.code) + + +if __name__ == '__main__': + parser = argparse.ArgumentParser( + description="""Fix up source that uses the talent client library. + +The existing sources are NOT overwritten but are copied to output_dir with changes made. + +Note: This tool operates at a best-effort level at converting positional + parameters in client method calls to keyword based parameters. + Cases where it WILL FAIL include + A) * or ** expansion in a method call. + B) Calls via function or method alias (includes free function calls) + C) Indirect or dispatched calls (e.g. the method is looked up dynamically) + + These all constitute false negatives. The tool will also detect false + positives when an API method shares a name with another method. +""") + parser.add_argument( + '-d', + '--input-directory', + required=True, + dest='input_dir', + help='the input directory to walk for python files to fix up', + ) + parser.add_argument( + '-o', + '--output-directory', + required=True, + dest='output_dir', + help='the directory to output files fixed via un-flattening', + ) + args = parser.parse_args() + input_dir = pathlib.Path(args.input_dir) + output_dir = pathlib.Path(args.output_dir) + if not input_dir.is_dir(): + print( + f"input directory '{input_dir}' does not exist or is not a directory", + file=sys.stderr, + ) + sys.exit(-1) + + if not output_dir.is_dir(): + print( + f"output directory '{output_dir}' does not exist or is not a directory", + file=sys.stderr, + ) + sys.exit(-1) + + if os.listdir(output_dir): + print( + f"output directory '{output_dir}' is not empty", + file=sys.stderr, + ) + sys.exit(-1) + + fix_files(input_dir, output_dir) diff --git a/setup.py b/setup.py index 73bafb32..5a385a86 100644 --- a/setup.py +++ b/setup.py @@ -28,7 +28,11 @@ # 'Development Status :: 4 - Beta' # 'Development Status :: 5 - Production/Stable' release_status = "Development Status :: 4 - Beta" -dependencies = ["google-api-core[grpc] >= 1.14.0, < 2.0.0dev"] +dependencies = [ + "google-api-core[grpc] >= 1.22.0, < 2.0.0dev", + "proto-plus >= 1.4.0", + "libcst >= 0.2.5", +] extras = {} @@ -43,7 +47,9 @@ # Only include packages under the 'google' namespace. Do not include tests, # benchmarks, etc. packages = [ - package for package in setuptools.find_packages() if package.startswith("google") + package + for package in setuptools.PEP420PackageFinder.find() + if package.startswith("google") ] # Determine which namespaces are needed. @@ -66,12 +72,10 @@ "Intended Audience :: Developers", "License :: OSI Approved :: Apache Software License", "Programming Language :: Python", - "Programming Language :: Python :: 2", - "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.7", + "Programming Language :: Python :: 3.8", "Operating System :: OS Independent", "Topic :: Internet", ], @@ -80,7 +84,8 @@ namespace_packages=namespaces, install_requires=dependencies, extras_require=extras, - python_requires=">=2.7,!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*", + python_requires=">=3.6", + scripts=["scripts/fixup_talent_v4beta1_keywords.py"], include_package_data=True, zip_safe=False, ) diff --git a/synth.metadata b/synth.metadata index ee2c3f5b..dc6fa66a 100644 --- a/synth.metadata +++ b/synth.metadata @@ -3,23 +3,15 @@ { "git": { "name": ".", - "remote": "https://github.com/googleapis/python-talent.git", - "sha": "a337dcc7e9f5e40408e5091197d9190aeba6d7cf" - } - }, - { - "git": { - "name": "googleapis", - "remote": "https://github.com/googleapis/googleapis.git", - "sha": "b882b8e6bfcd708042ff00f7adc67ce750817dd0", - "internalRef": "318028816" + "remote": "git@github.com:googleapis/python-talent.git", + "sha": "2dfbb967b35e9edc97fdbe13bf536a6dff0ea676" } }, { "git": { "name": "synthtool", "remote": "https://github.com/googleapis/synthtool.git", - "sha": "303271797a360f8a439203413f13a160f2f5b3b4" + "sha": "ee7506d15daa3873accfff9430eff7e3953f0248" } } ], diff --git a/synth.py b/synth.py index 22a72a64..31dca605 100644 --- a/synth.py +++ b/synth.py @@ -50,10 +50,17 @@ # ---------------------------------------------------------------------------- # Add templated files # ---------------------------------------------------------------------------- -templated_files = common.py_library(cov_level=83) -s.move(templated_files) +templated_files = common.py_library( + samples=False, # set to True only if there are samples + microgenerator=True, + cov_level=99, +) +s.move(templated_files, excludes=[".coveragerc"]) # microgenerator has a good .coveragerc file # TODO(busunkim): Use latest sphinx after microgenerator transition s.replace("noxfile.py", """['"]sphinx['"]""", '"sphinx<3.0.0"') +# Temporarily disable warnings due to +# https://github.com/googleapis/gapic-generator-python/issues/525 +s.replace("noxfile.py", '[\"\']-W[\"\']', '# "-W"') s.shell.run(["nox", "-s", "blacken"], hide_output=False) diff --git a/tests/unit/gapic/talent_v4beta1/__init__.py b/tests/unit/gapic/talent_v4beta1/__init__.py new file mode 100644 index 00000000..8b137891 --- /dev/null +++ b/tests/unit/gapic/talent_v4beta1/__init__.py @@ -0,0 +1 @@ + diff --git a/tests/unit/gapic/talent_v4beta1/test_application_service.py b/tests/unit/gapic/talent_v4beta1/test_application_service.py new file mode 100644 index 00000000..defe6406 --- /dev/null +++ b/tests/unit/gapic/talent_v4beta1/test_application_service.py @@ -0,0 +1,2096 @@ +# -*- 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. +# + +import os +import mock + +import grpc +from grpc.experimental import aio +import math +import pytest +from proto.marshal.rules.dates import DurationRule, TimestampRule + +from google import auth +from google.api_core import client_options +from google.api_core import exceptions +from google.api_core import gapic_v1 +from google.api_core import grpc_helpers +from google.api_core import grpc_helpers_async +from google.auth import credentials +from google.auth.exceptions import MutualTLSChannelError +from google.cloud.talent_v4beta1.services.application_service import ( + ApplicationServiceAsyncClient, +) +from google.cloud.talent_v4beta1.services.application_service import ( + ApplicationServiceClient, +) +from google.cloud.talent_v4beta1.services.application_service import pagers +from google.cloud.talent_v4beta1.services.application_service import transports +from google.cloud.talent_v4beta1.types import application +from google.cloud.talent_v4beta1.types import application as gct_application +from google.cloud.talent_v4beta1.types import application_service +from google.cloud.talent_v4beta1.types import common +from google.oauth2 import service_account +from google.protobuf import field_mask_pb2 as field_mask # type: ignore +from google.protobuf import timestamp_pb2 as timestamp # type: ignore +from google.protobuf import wrappers_pb2 as wrappers # type: ignore +from google.type import date_pb2 as date # type: ignore + + +def client_cert_source_callback(): + return b"cert bytes", b"key bytes" + + +# If default endpoint is localhost, then default mtls endpoint will be the same. +# This method modifies the default endpoint so the client can produce a different +# mtls endpoint for endpoint testing purposes. +def modify_default_endpoint(client): + return ( + "foo.googleapis.com" + if ("localhost" in client.DEFAULT_ENDPOINT) + else client.DEFAULT_ENDPOINT + ) + + +def test__get_default_mtls_endpoint(): + api_endpoint = "example.googleapis.com" + api_mtls_endpoint = "example.mtls.googleapis.com" + sandbox_endpoint = "example.sandbox.googleapis.com" + sandbox_mtls_endpoint = "example.mtls.sandbox.googleapis.com" + non_googleapi = "api.example.com" + + assert ApplicationServiceClient._get_default_mtls_endpoint(None) is None + assert ( + ApplicationServiceClient._get_default_mtls_endpoint(api_endpoint) + == api_mtls_endpoint + ) + assert ( + ApplicationServiceClient._get_default_mtls_endpoint(api_mtls_endpoint) + == api_mtls_endpoint + ) + assert ( + ApplicationServiceClient._get_default_mtls_endpoint(sandbox_endpoint) + == sandbox_mtls_endpoint + ) + assert ( + ApplicationServiceClient._get_default_mtls_endpoint(sandbox_mtls_endpoint) + == sandbox_mtls_endpoint + ) + assert ( + ApplicationServiceClient._get_default_mtls_endpoint(non_googleapi) + == non_googleapi + ) + + +@pytest.mark.parametrize( + "client_class", [ApplicationServiceClient, ApplicationServiceAsyncClient] +) +def test_application_service_client_from_service_account_file(client_class): + creds = credentials.AnonymousCredentials() + with mock.patch.object( + service_account.Credentials, "from_service_account_file" + ) as factory: + factory.return_value = creds + client = client_class.from_service_account_file("dummy/file/path.json") + assert client._transport._credentials == creds + + client = client_class.from_service_account_json("dummy/file/path.json") + assert client._transport._credentials == creds + + assert client._transport._host == "jobs.googleapis.com:443" + + +def test_application_service_client_get_transport_class(): + transport = ApplicationServiceClient.get_transport_class() + assert transport == transports.ApplicationServiceGrpcTransport + + transport = ApplicationServiceClient.get_transport_class("grpc") + assert transport == transports.ApplicationServiceGrpcTransport + + +@pytest.mark.parametrize( + "client_class,transport_class,transport_name", + [ + (ApplicationServiceClient, transports.ApplicationServiceGrpcTransport, "grpc"), + ( + ApplicationServiceAsyncClient, + transports.ApplicationServiceGrpcAsyncIOTransport, + "grpc_asyncio", + ), + ], +) +@mock.patch.object( + ApplicationServiceClient, + "DEFAULT_ENDPOINT", + modify_default_endpoint(ApplicationServiceClient), +) +@mock.patch.object( + ApplicationServiceAsyncClient, + "DEFAULT_ENDPOINT", + modify_default_endpoint(ApplicationServiceAsyncClient), +) +def test_application_service_client_client_options( + client_class, transport_class, transport_name +): + # Check that if channel is provided we won't create a new one. + with mock.patch.object(ApplicationServiceClient, "get_transport_class") as gtc: + transport = transport_class(credentials=credentials.AnonymousCredentials()) + client = client_class(transport=transport) + gtc.assert_not_called() + + # Check that if channel is provided via str we will create a new one. + with mock.patch.object(ApplicationServiceClient, "get_transport_class") as gtc: + client = client_class(transport=transport_name) + gtc.assert_called() + + # Check the case api_endpoint is provided. + options = client_options.ClientOptions(api_endpoint="squid.clam.whelk") + with mock.patch.object(transport_class, "__init__") as patched: + patched.return_value = None + client = client_class(client_options=options) + patched.assert_called_once_with( + credentials=None, + credentials_file=None, + host="squid.clam.whelk", + scopes=None, + api_mtls_endpoint="squid.clam.whelk", + client_cert_source=None, + quota_project_id=None, + ) + + # Check the case api_endpoint is not provided and GOOGLE_API_USE_MTLS is + # "never". + with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS": "never"}): + with mock.patch.object(transport_class, "__init__") as patched: + patched.return_value = None + client = client_class() + patched.assert_called_once_with( + credentials=None, + credentials_file=None, + host=client.DEFAULT_ENDPOINT, + scopes=None, + api_mtls_endpoint=client.DEFAULT_ENDPOINT, + client_cert_source=None, + quota_project_id=None, + ) + + # Check the case api_endpoint is not provided and GOOGLE_API_USE_MTLS is + # "always". + with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS": "always"}): + with mock.patch.object(transport_class, "__init__") as patched: + patched.return_value = None + client = client_class() + patched.assert_called_once_with( + credentials=None, + credentials_file=None, + host=client.DEFAULT_MTLS_ENDPOINT, + scopes=None, + api_mtls_endpoint=client.DEFAULT_MTLS_ENDPOINT, + client_cert_source=None, + quota_project_id=None, + ) + + # Check the case api_endpoint is not provided, GOOGLE_API_USE_MTLS is + # "auto", and client_cert_source is provided. + with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS": "auto"}): + options = client_options.ClientOptions( + client_cert_source=client_cert_source_callback + ) + with mock.patch.object(transport_class, "__init__") as patched: + patched.return_value = None + client = client_class(client_options=options) + patched.assert_called_once_with( + credentials=None, + credentials_file=None, + host=client.DEFAULT_MTLS_ENDPOINT, + scopes=None, + api_mtls_endpoint=client.DEFAULT_MTLS_ENDPOINT, + client_cert_source=client_cert_source_callback, + quota_project_id=None, + ) + + # Check the case api_endpoint is not provided, GOOGLE_API_USE_MTLS is + # "auto", and default_client_cert_source is provided. + with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS": "auto"}): + with mock.patch.object(transport_class, "__init__") as patched: + with mock.patch( + "google.auth.transport.mtls.has_default_client_cert_source", + return_value=True, + ): + patched.return_value = None + client = client_class() + patched.assert_called_once_with( + credentials=None, + credentials_file=None, + host=client.DEFAULT_MTLS_ENDPOINT, + scopes=None, + api_mtls_endpoint=client.DEFAULT_MTLS_ENDPOINT, + client_cert_source=None, + quota_project_id=None, + ) + + # Check the case api_endpoint is not provided, GOOGLE_API_USE_MTLS is + # "auto", but client_cert_source and default_client_cert_source are None. + with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS": "auto"}): + with mock.patch.object(transport_class, "__init__") as patched: + with mock.patch( + "google.auth.transport.mtls.has_default_client_cert_source", + return_value=False, + ): + patched.return_value = None + client = client_class() + patched.assert_called_once_with( + credentials=None, + credentials_file=None, + host=client.DEFAULT_ENDPOINT, + scopes=None, + api_mtls_endpoint=client.DEFAULT_ENDPOINT, + client_cert_source=None, + quota_project_id=None, + ) + + # Check the case api_endpoint is not provided and GOOGLE_API_USE_MTLS has + # unsupported value. + with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS": "Unsupported"}): + with pytest.raises(MutualTLSChannelError): + client = client_class() + + # Check the case quota_project_id is provided + options = client_options.ClientOptions(quota_project_id="octopus") + with mock.patch.object(transport_class, "__init__") as patched: + patched.return_value = None + client = client_class(client_options=options) + patched.assert_called_once_with( + credentials=None, + credentials_file=None, + host=client.DEFAULT_ENDPOINT, + scopes=None, + api_mtls_endpoint=client.DEFAULT_ENDPOINT, + client_cert_source=None, + quota_project_id="octopus", + ) + + +@pytest.mark.parametrize( + "client_class,transport_class,transport_name", + [ + (ApplicationServiceClient, transports.ApplicationServiceGrpcTransport, "grpc"), + ( + ApplicationServiceAsyncClient, + transports.ApplicationServiceGrpcAsyncIOTransport, + "grpc_asyncio", + ), + ], +) +def test_application_service_client_client_options_scopes( + client_class, transport_class, transport_name +): + # Check the case scopes are provided. + options = client_options.ClientOptions(scopes=["1", "2"],) + with mock.patch.object(transport_class, "__init__") as patched: + patched.return_value = None + client = client_class(client_options=options) + patched.assert_called_once_with( + credentials=None, + credentials_file=None, + host=client.DEFAULT_ENDPOINT, + scopes=["1", "2"], + api_mtls_endpoint=client.DEFAULT_ENDPOINT, + client_cert_source=None, + quota_project_id=None, + ) + + +@pytest.mark.parametrize( + "client_class,transport_class,transport_name", + [ + (ApplicationServiceClient, transports.ApplicationServiceGrpcTransport, "grpc"), + ( + ApplicationServiceAsyncClient, + transports.ApplicationServiceGrpcAsyncIOTransport, + "grpc_asyncio", + ), + ], +) +def test_application_service_client_client_options_credentials_file( + client_class, transport_class, transport_name +): + # Check the case credentials file is provided. + options = client_options.ClientOptions(credentials_file="credentials.json") + with mock.patch.object(transport_class, "__init__") as patched: + patched.return_value = None + client = client_class(client_options=options) + patched.assert_called_once_with( + credentials=None, + credentials_file="credentials.json", + host=client.DEFAULT_ENDPOINT, + scopes=None, + api_mtls_endpoint=client.DEFAULT_ENDPOINT, + client_cert_source=None, + quota_project_id=None, + ) + + +def test_application_service_client_client_options_from_dict(): + with mock.patch( + "google.cloud.talent_v4beta1.services.application_service.transports.ApplicationServiceGrpcTransport.__init__" + ) as grpc_transport: + grpc_transport.return_value = None + client = ApplicationServiceClient( + client_options={"api_endpoint": "squid.clam.whelk"} + ) + grpc_transport.assert_called_once_with( + credentials=None, + credentials_file=None, + host="squid.clam.whelk", + scopes=None, + api_mtls_endpoint="squid.clam.whelk", + client_cert_source=None, + quota_project_id=None, + ) + + +def test_create_application( + transport: str = "grpc", request_type=application_service.CreateApplicationRequest +): + client = ApplicationServiceClient( + credentials=credentials.AnonymousCredentials(), transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client._transport.create_application), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = gct_application.Application( + name="name_value", + external_id="external_id_value", + profile="profile_value", + job="job_value", + company="company_value", + stage=gct_application.Application.ApplicationStage.NEW, + state=gct_application.Application.ApplicationState.IN_PROGRESS, + outcome_notes="outcome_notes_value", + outcome=common.Outcome.POSITIVE, + job_title_snippet="job_title_snippet_value", + ) + + response = client.create_application(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + + assert args[0] == application_service.CreateApplicationRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, gct_application.Application) + + assert response.name == "name_value" + + assert response.external_id == "external_id_value" + + assert response.profile == "profile_value" + + assert response.job == "job_value" + + assert response.company == "company_value" + + assert response.stage == gct_application.Application.ApplicationStage.NEW + + assert response.state == gct_application.Application.ApplicationState.IN_PROGRESS + + assert response.outcome_notes == "outcome_notes_value" + + assert response.outcome == common.Outcome.POSITIVE + + assert response.job_title_snippet == "job_title_snippet_value" + + +def test_create_application_from_dict(): + test_create_application(request_type=dict) + + +@pytest.mark.asyncio +async def test_create_application_async(transport: str = "grpc_asyncio"): + client = ApplicationServiceAsyncClient( + credentials=credentials.AnonymousCredentials(), transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = application_service.CreateApplicationRequest() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client._client._transport.create_application), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + gct_application.Application( + name="name_value", + external_id="external_id_value", + profile="profile_value", + job="job_value", + company="company_value", + stage=gct_application.Application.ApplicationStage.NEW, + state=gct_application.Application.ApplicationState.IN_PROGRESS, + outcome_notes="outcome_notes_value", + outcome=common.Outcome.POSITIVE, + job_title_snippet="job_title_snippet_value", + ) + ) + + response = await client.create_application(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + + assert args[0] == request + + # Establish that the response is the type that we expect. + assert isinstance(response, gct_application.Application) + + assert response.name == "name_value" + + assert response.external_id == "external_id_value" + + assert response.profile == "profile_value" + + assert response.job == "job_value" + + assert response.company == "company_value" + + assert response.stage == gct_application.Application.ApplicationStage.NEW + + assert response.state == gct_application.Application.ApplicationState.IN_PROGRESS + + assert response.outcome_notes == "outcome_notes_value" + + assert response.outcome == common.Outcome.POSITIVE + + assert response.job_title_snippet == "job_title_snippet_value" + + +def test_create_application_field_headers(): + client = ApplicationServiceClient(credentials=credentials.AnonymousCredentials(),) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = application_service.CreateApplicationRequest() + request.parent = "parent/value" + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client._transport.create_application), "__call__" + ) as call: + call.return_value = gct_application.Application() + + client.create_application(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + + +@pytest.mark.asyncio +async def test_create_application_field_headers_async(): + client = ApplicationServiceAsyncClient( + credentials=credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = application_service.CreateApplicationRequest() + request.parent = "parent/value" + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client._client._transport.create_application), "__call__" + ) as call: + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + gct_application.Application() + ) + + await client.create_application(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + + +def test_create_application_flattened(): + client = ApplicationServiceClient(credentials=credentials.AnonymousCredentials(),) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client._transport.create_application), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = gct_application.Application() + + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + client.create_application( + parent="parent_value", + application=gct_application.Application(name="name_value"), + ) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + + assert args[0].parent == "parent_value" + + assert args[0].application == gct_application.Application(name="name_value") + + +def test_create_application_flattened_error(): + client = ApplicationServiceClient(credentials=credentials.AnonymousCredentials(),) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + client.create_application( + application_service.CreateApplicationRequest(), + parent="parent_value", + application=gct_application.Application(name="name_value"), + ) + + +@pytest.mark.asyncio +async def test_create_application_flattened_async(): + client = ApplicationServiceAsyncClient( + credentials=credentials.AnonymousCredentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client._client._transport.create_application), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = gct_application.Application() + + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + gct_application.Application() + ) + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + response = await client.create_application( + parent="parent_value", + application=gct_application.Application(name="name_value"), + ) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + + assert args[0].parent == "parent_value" + + assert args[0].application == gct_application.Application(name="name_value") + + +@pytest.mark.asyncio +async def test_create_application_flattened_error_async(): + client = ApplicationServiceAsyncClient( + credentials=credentials.AnonymousCredentials(), + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + await client.create_application( + application_service.CreateApplicationRequest(), + parent="parent_value", + application=gct_application.Application(name="name_value"), + ) + + +def test_get_application( + transport: str = "grpc", request_type=application_service.GetApplicationRequest +): + client = ApplicationServiceClient( + credentials=credentials.AnonymousCredentials(), transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client._transport.get_application), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = application.Application( + name="name_value", + external_id="external_id_value", + profile="profile_value", + job="job_value", + company="company_value", + stage=application.Application.ApplicationStage.NEW, + state=application.Application.ApplicationState.IN_PROGRESS, + outcome_notes="outcome_notes_value", + outcome=common.Outcome.POSITIVE, + job_title_snippet="job_title_snippet_value", + ) + + response = client.get_application(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + + assert args[0] == application_service.GetApplicationRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, application.Application) + + assert response.name == "name_value" + + assert response.external_id == "external_id_value" + + assert response.profile == "profile_value" + + assert response.job == "job_value" + + assert response.company == "company_value" + + assert response.stage == application.Application.ApplicationStage.NEW + + assert response.state == application.Application.ApplicationState.IN_PROGRESS + + assert response.outcome_notes == "outcome_notes_value" + + assert response.outcome == common.Outcome.POSITIVE + + assert response.job_title_snippet == "job_title_snippet_value" + + +def test_get_application_from_dict(): + test_get_application(request_type=dict) + + +@pytest.mark.asyncio +async def test_get_application_async(transport: str = "grpc_asyncio"): + client = ApplicationServiceAsyncClient( + credentials=credentials.AnonymousCredentials(), transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = application_service.GetApplicationRequest() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client._client._transport.get_application), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + application.Application( + name="name_value", + external_id="external_id_value", + profile="profile_value", + job="job_value", + company="company_value", + stage=application.Application.ApplicationStage.NEW, + state=application.Application.ApplicationState.IN_PROGRESS, + outcome_notes="outcome_notes_value", + outcome=common.Outcome.POSITIVE, + job_title_snippet="job_title_snippet_value", + ) + ) + + response = await client.get_application(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + + assert args[0] == request + + # Establish that the response is the type that we expect. + assert isinstance(response, application.Application) + + assert response.name == "name_value" + + assert response.external_id == "external_id_value" + + assert response.profile == "profile_value" + + assert response.job == "job_value" + + assert response.company == "company_value" + + assert response.stage == application.Application.ApplicationStage.NEW + + assert response.state == application.Application.ApplicationState.IN_PROGRESS + + assert response.outcome_notes == "outcome_notes_value" + + assert response.outcome == common.Outcome.POSITIVE + + assert response.job_title_snippet == "job_title_snippet_value" + + +def test_get_application_field_headers(): + client = ApplicationServiceClient(credentials=credentials.AnonymousCredentials(),) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = application_service.GetApplicationRequest() + request.name = "name/value" + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client._transport.get_application), "__call__") as call: + call.return_value = application.Application() + + client.get_application(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + + +@pytest.mark.asyncio +async def test_get_application_field_headers_async(): + client = ApplicationServiceAsyncClient( + credentials=credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = application_service.GetApplicationRequest() + request.name = "name/value" + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client._client._transport.get_application), "__call__" + ) as call: + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + application.Application() + ) + + await client.get_application(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + + +def test_get_application_flattened(): + client = ApplicationServiceClient(credentials=credentials.AnonymousCredentials(),) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client._transport.get_application), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = application.Application() + + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + client.get_application(name="name_value",) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + + assert args[0].name == "name_value" + + +def test_get_application_flattened_error(): + client = ApplicationServiceClient(credentials=credentials.AnonymousCredentials(),) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + client.get_application( + application_service.GetApplicationRequest(), name="name_value", + ) + + +@pytest.mark.asyncio +async def test_get_application_flattened_async(): + client = ApplicationServiceAsyncClient( + credentials=credentials.AnonymousCredentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client._client._transport.get_application), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = application.Application() + + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + application.Application() + ) + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + response = await client.get_application(name="name_value",) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + + assert args[0].name == "name_value" + + +@pytest.mark.asyncio +async def test_get_application_flattened_error_async(): + client = ApplicationServiceAsyncClient( + credentials=credentials.AnonymousCredentials(), + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + await client.get_application( + application_service.GetApplicationRequest(), name="name_value", + ) + + +def test_update_application( + transport: str = "grpc", request_type=application_service.UpdateApplicationRequest +): + client = ApplicationServiceClient( + credentials=credentials.AnonymousCredentials(), transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client._transport.update_application), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = gct_application.Application( + name="name_value", + external_id="external_id_value", + profile="profile_value", + job="job_value", + company="company_value", + stage=gct_application.Application.ApplicationStage.NEW, + state=gct_application.Application.ApplicationState.IN_PROGRESS, + outcome_notes="outcome_notes_value", + outcome=common.Outcome.POSITIVE, + job_title_snippet="job_title_snippet_value", + ) + + response = client.update_application(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + + assert args[0] == application_service.UpdateApplicationRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, gct_application.Application) + + assert response.name == "name_value" + + assert response.external_id == "external_id_value" + + assert response.profile == "profile_value" + + assert response.job == "job_value" + + assert response.company == "company_value" + + assert response.stage == gct_application.Application.ApplicationStage.NEW + + assert response.state == gct_application.Application.ApplicationState.IN_PROGRESS + + assert response.outcome_notes == "outcome_notes_value" + + assert response.outcome == common.Outcome.POSITIVE + + assert response.job_title_snippet == "job_title_snippet_value" + + +def test_update_application_from_dict(): + test_update_application(request_type=dict) + + +@pytest.mark.asyncio +async def test_update_application_async(transport: str = "grpc_asyncio"): + client = ApplicationServiceAsyncClient( + credentials=credentials.AnonymousCredentials(), transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = application_service.UpdateApplicationRequest() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client._client._transport.update_application), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + gct_application.Application( + name="name_value", + external_id="external_id_value", + profile="profile_value", + job="job_value", + company="company_value", + stage=gct_application.Application.ApplicationStage.NEW, + state=gct_application.Application.ApplicationState.IN_PROGRESS, + outcome_notes="outcome_notes_value", + outcome=common.Outcome.POSITIVE, + job_title_snippet="job_title_snippet_value", + ) + ) + + response = await client.update_application(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + + assert args[0] == request + + # Establish that the response is the type that we expect. + assert isinstance(response, gct_application.Application) + + assert response.name == "name_value" + + assert response.external_id == "external_id_value" + + assert response.profile == "profile_value" + + assert response.job == "job_value" + + assert response.company == "company_value" + + assert response.stage == gct_application.Application.ApplicationStage.NEW + + assert response.state == gct_application.Application.ApplicationState.IN_PROGRESS + + assert response.outcome_notes == "outcome_notes_value" + + assert response.outcome == common.Outcome.POSITIVE + + assert response.job_title_snippet == "job_title_snippet_value" + + +def test_update_application_field_headers(): + client = ApplicationServiceClient(credentials=credentials.AnonymousCredentials(),) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = application_service.UpdateApplicationRequest() + request.application.name = "application.name/value" + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client._transport.update_application), "__call__" + ) as call: + call.return_value = gct_application.Application() + + client.update_application(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ("x-goog-request-params", "application.name=application.name/value",) in kw[ + "metadata" + ] + + +@pytest.mark.asyncio +async def test_update_application_field_headers_async(): + client = ApplicationServiceAsyncClient( + credentials=credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = application_service.UpdateApplicationRequest() + request.application.name = "application.name/value" + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client._client._transport.update_application), "__call__" + ) as call: + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + gct_application.Application() + ) + + await client.update_application(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ("x-goog-request-params", "application.name=application.name/value",) in kw[ + "metadata" + ] + + +def test_update_application_flattened(): + client = ApplicationServiceClient(credentials=credentials.AnonymousCredentials(),) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client._transport.update_application), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = gct_application.Application() + + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + client.update_application( + application=gct_application.Application(name="name_value"), + ) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + + assert args[0].application == gct_application.Application(name="name_value") + + +def test_update_application_flattened_error(): + client = ApplicationServiceClient(credentials=credentials.AnonymousCredentials(),) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + client.update_application( + application_service.UpdateApplicationRequest(), + application=gct_application.Application(name="name_value"), + ) + + +@pytest.mark.asyncio +async def test_update_application_flattened_async(): + client = ApplicationServiceAsyncClient( + credentials=credentials.AnonymousCredentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client._client._transport.update_application), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = gct_application.Application() + + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + gct_application.Application() + ) + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + response = await client.update_application( + application=gct_application.Application(name="name_value"), + ) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + + assert args[0].application == gct_application.Application(name="name_value") + + +@pytest.mark.asyncio +async def test_update_application_flattened_error_async(): + client = ApplicationServiceAsyncClient( + credentials=credentials.AnonymousCredentials(), + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + await client.update_application( + application_service.UpdateApplicationRequest(), + application=gct_application.Application(name="name_value"), + ) + + +def test_delete_application( + transport: str = "grpc", request_type=application_service.DeleteApplicationRequest +): + client = ApplicationServiceClient( + credentials=credentials.AnonymousCredentials(), transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client._transport.delete_application), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = None + + response = client.delete_application(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + + assert args[0] == application_service.DeleteApplicationRequest() + + # Establish that the response is the type that we expect. + assert response is None + + +def test_delete_application_from_dict(): + test_delete_application(request_type=dict) + + +@pytest.mark.asyncio +async def test_delete_application_async(transport: str = "grpc_asyncio"): + client = ApplicationServiceAsyncClient( + credentials=credentials.AnonymousCredentials(), transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = application_service.DeleteApplicationRequest() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client._client._transport.delete_application), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(None) + + response = await client.delete_application(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + + assert args[0] == request + + # Establish that the response is the type that we expect. + assert response is None + + +def test_delete_application_field_headers(): + client = ApplicationServiceClient(credentials=credentials.AnonymousCredentials(),) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = application_service.DeleteApplicationRequest() + request.name = "name/value" + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client._transport.delete_application), "__call__" + ) as call: + call.return_value = None + + client.delete_application(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + + +@pytest.mark.asyncio +async def test_delete_application_field_headers_async(): + client = ApplicationServiceAsyncClient( + credentials=credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = application_service.DeleteApplicationRequest() + request.name = "name/value" + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client._client._transport.delete_application), "__call__" + ) as call: + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(None) + + await client.delete_application(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + + +def test_delete_application_flattened(): + client = ApplicationServiceClient(credentials=credentials.AnonymousCredentials(),) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client._transport.delete_application), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = None + + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + client.delete_application(name="name_value",) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + + assert args[0].name == "name_value" + + +def test_delete_application_flattened_error(): + client = ApplicationServiceClient(credentials=credentials.AnonymousCredentials(),) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + client.delete_application( + application_service.DeleteApplicationRequest(), name="name_value", + ) + + +@pytest.mark.asyncio +async def test_delete_application_flattened_async(): + client = ApplicationServiceAsyncClient( + credentials=credentials.AnonymousCredentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client._client._transport.delete_application), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = None + + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(None) + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + response = await client.delete_application(name="name_value",) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + + assert args[0].name == "name_value" + + +@pytest.mark.asyncio +async def test_delete_application_flattened_error_async(): + client = ApplicationServiceAsyncClient( + credentials=credentials.AnonymousCredentials(), + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + await client.delete_application( + application_service.DeleteApplicationRequest(), name="name_value", + ) + + +def test_list_applications( + transport: str = "grpc", request_type=application_service.ListApplicationsRequest +): + client = ApplicationServiceClient( + credentials=credentials.AnonymousCredentials(), transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client._transport.list_applications), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = application_service.ListApplicationsResponse( + next_page_token="next_page_token_value", + ) + + response = client.list_applications(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + + assert args[0] == application_service.ListApplicationsRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, pagers.ListApplicationsPager) + + assert response.next_page_token == "next_page_token_value" + + +def test_list_applications_from_dict(): + test_list_applications(request_type=dict) + + +@pytest.mark.asyncio +async def test_list_applications_async(transport: str = "grpc_asyncio"): + client = ApplicationServiceAsyncClient( + credentials=credentials.AnonymousCredentials(), transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = application_service.ListApplicationsRequest() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client._client._transport.list_applications), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + application_service.ListApplicationsResponse( + next_page_token="next_page_token_value", + ) + ) + + response = await client.list_applications(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + + assert args[0] == request + + # Establish that the response is the type that we expect. + assert isinstance(response, pagers.ListApplicationsAsyncPager) + + assert response.next_page_token == "next_page_token_value" + + +def test_list_applications_field_headers(): + client = ApplicationServiceClient(credentials=credentials.AnonymousCredentials(),) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = application_service.ListApplicationsRequest() + request.parent = "parent/value" + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client._transport.list_applications), "__call__" + ) as call: + call.return_value = application_service.ListApplicationsResponse() + + client.list_applications(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + + +@pytest.mark.asyncio +async def test_list_applications_field_headers_async(): + client = ApplicationServiceAsyncClient( + credentials=credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = application_service.ListApplicationsRequest() + request.parent = "parent/value" + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client._client._transport.list_applications), "__call__" + ) as call: + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + application_service.ListApplicationsResponse() + ) + + await client.list_applications(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + + +def test_list_applications_flattened(): + client = ApplicationServiceClient(credentials=credentials.AnonymousCredentials(),) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client._transport.list_applications), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = application_service.ListApplicationsResponse() + + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + client.list_applications(parent="parent_value",) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + + assert args[0].parent == "parent_value" + + +def test_list_applications_flattened_error(): + client = ApplicationServiceClient(credentials=credentials.AnonymousCredentials(),) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + client.list_applications( + application_service.ListApplicationsRequest(), parent="parent_value", + ) + + +@pytest.mark.asyncio +async def test_list_applications_flattened_async(): + client = ApplicationServiceAsyncClient( + credentials=credentials.AnonymousCredentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client._client._transport.list_applications), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = application_service.ListApplicationsResponse() + + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + application_service.ListApplicationsResponse() + ) + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + response = await client.list_applications(parent="parent_value",) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + + assert args[0].parent == "parent_value" + + +@pytest.mark.asyncio +async def test_list_applications_flattened_error_async(): + client = ApplicationServiceAsyncClient( + credentials=credentials.AnonymousCredentials(), + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + await client.list_applications( + application_service.ListApplicationsRequest(), parent="parent_value", + ) + + +def test_list_applications_pager(): + client = ApplicationServiceClient(credentials=credentials.AnonymousCredentials,) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client._transport.list_applications), "__call__" + ) as call: + # Set the response to a series of pages. + call.side_effect = ( + application_service.ListApplicationsResponse( + applications=[ + application.Application(), + application.Application(), + application.Application(), + ], + next_page_token="abc", + ), + application_service.ListApplicationsResponse( + applications=[], next_page_token="def", + ), + application_service.ListApplicationsResponse( + applications=[application.Application(),], next_page_token="ghi", + ), + application_service.ListApplicationsResponse( + applications=[application.Application(), application.Application(),], + ), + RuntimeError, + ) + + metadata = () + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata((("parent", ""),)), + ) + pager = client.list_applications(request={}) + + assert pager._metadata == metadata + + results = [i for i in pager] + assert len(results) == 6 + assert all(isinstance(i, application.Application) for i in results) + + +def test_list_applications_pages(): + client = ApplicationServiceClient(credentials=credentials.AnonymousCredentials,) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client._transport.list_applications), "__call__" + ) as call: + # Set the response to a series of pages. + call.side_effect = ( + application_service.ListApplicationsResponse( + applications=[ + application.Application(), + application.Application(), + application.Application(), + ], + next_page_token="abc", + ), + application_service.ListApplicationsResponse( + applications=[], next_page_token="def", + ), + application_service.ListApplicationsResponse( + applications=[application.Application(),], next_page_token="ghi", + ), + application_service.ListApplicationsResponse( + applications=[application.Application(), application.Application(),], + ), + RuntimeError, + ) + pages = list(client.list_applications(request={}).pages) + for page, token in zip(pages, ["abc", "def", "ghi", ""]): + assert page.raw_page.next_page_token == token + + +@pytest.mark.asyncio +async def test_list_applications_async_pager(): + client = ApplicationServiceAsyncClient( + credentials=credentials.AnonymousCredentials, + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client._client._transport.list_applications), + "__call__", + new_callable=mock.AsyncMock, + ) as call: + # Set the response to a series of pages. + call.side_effect = ( + application_service.ListApplicationsResponse( + applications=[ + application.Application(), + application.Application(), + application.Application(), + ], + next_page_token="abc", + ), + application_service.ListApplicationsResponse( + applications=[], next_page_token="def", + ), + application_service.ListApplicationsResponse( + applications=[application.Application(),], next_page_token="ghi", + ), + application_service.ListApplicationsResponse( + applications=[application.Application(), application.Application(),], + ), + RuntimeError, + ) + async_pager = await client.list_applications(request={},) + assert async_pager.next_page_token == "abc" + responses = [] + async for response in async_pager: + responses.append(response) + + assert len(responses) == 6 + assert all(isinstance(i, application.Application) for i in responses) + + +@pytest.mark.asyncio +async def test_list_applications_async_pages(): + client = ApplicationServiceAsyncClient( + credentials=credentials.AnonymousCredentials, + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client._client._transport.list_applications), + "__call__", + new_callable=mock.AsyncMock, + ) as call: + # Set the response to a series of pages. + call.side_effect = ( + application_service.ListApplicationsResponse( + applications=[ + application.Application(), + application.Application(), + application.Application(), + ], + next_page_token="abc", + ), + application_service.ListApplicationsResponse( + applications=[], next_page_token="def", + ), + application_service.ListApplicationsResponse( + applications=[application.Application(),], next_page_token="ghi", + ), + application_service.ListApplicationsResponse( + applications=[application.Application(), application.Application(),], + ), + RuntimeError, + ) + pages = [] + async for page in (await client.list_applications(request={})).pages: + pages.append(page) + for page, token in zip(pages, ["abc", "def", "ghi", ""]): + assert page.raw_page.next_page_token == token + + +def test_credentials_transport_error(): + # It is an error to provide credentials and a transport instance. + transport = transports.ApplicationServiceGrpcTransport( + credentials=credentials.AnonymousCredentials(), + ) + with pytest.raises(ValueError): + client = ApplicationServiceClient( + credentials=credentials.AnonymousCredentials(), transport=transport, + ) + + # It is an error to provide a credentials file and a transport instance. + transport = transports.ApplicationServiceGrpcTransport( + credentials=credentials.AnonymousCredentials(), + ) + with pytest.raises(ValueError): + client = ApplicationServiceClient( + client_options={"credentials_file": "credentials.json"}, + transport=transport, + ) + + # It is an error to provide scopes and a transport instance. + transport = transports.ApplicationServiceGrpcTransport( + credentials=credentials.AnonymousCredentials(), + ) + with pytest.raises(ValueError): + client = ApplicationServiceClient( + client_options={"scopes": ["1", "2"]}, transport=transport, + ) + + +def test_transport_instance(): + # A client may be instantiated with a custom transport instance. + transport = transports.ApplicationServiceGrpcTransport( + credentials=credentials.AnonymousCredentials(), + ) + client = ApplicationServiceClient(transport=transport) + assert client._transport is transport + + +def test_transport_get_channel(): + # A client may be instantiated with a custom transport instance. + transport = transports.ApplicationServiceGrpcTransport( + credentials=credentials.AnonymousCredentials(), + ) + channel = transport.grpc_channel + assert channel + + transport = transports.ApplicationServiceGrpcAsyncIOTransport( + credentials=credentials.AnonymousCredentials(), + ) + channel = transport.grpc_channel + assert channel + + +def test_transport_grpc_default(): + # A client should use the gRPC transport by default. + client = ApplicationServiceClient(credentials=credentials.AnonymousCredentials(),) + assert isinstance(client._transport, transports.ApplicationServiceGrpcTransport,) + + +def test_application_service_base_transport_error(): + # Passing both a credentials object and credentials_file should raise an error + with pytest.raises(exceptions.DuplicateCredentialArgs): + transport = transports.ApplicationServiceTransport( + credentials=credentials.AnonymousCredentials(), + credentials_file="credentials.json", + ) + + +def test_application_service_base_transport(): + # Instantiate the base transport. + with mock.patch( + "google.cloud.talent_v4beta1.services.application_service.transports.ApplicationServiceTransport.__init__" + ) as Transport: + Transport.return_value = None + transport = transports.ApplicationServiceTransport( + credentials=credentials.AnonymousCredentials(), + ) + + # Every method on the transport should just blindly + # raise NotImplementedError. + methods = ( + "create_application", + "get_application", + "update_application", + "delete_application", + "list_applications", + ) + for method in methods: + with pytest.raises(NotImplementedError): + getattr(transport, method)(request=object()) + + +def test_application_service_base_transport_with_credentials_file(): + # Instantiate the base transport with a credentials file + with mock.patch.object( + auth, "load_credentials_from_file" + ) as load_creds, mock.patch( + "google.cloud.talent_v4beta1.services.application_service.transports.ApplicationServiceTransport._prep_wrapped_messages" + ) as Transport: + Transport.return_value = None + load_creds.return_value = (credentials.AnonymousCredentials(), None) + transport = transports.ApplicationServiceTransport( + credentials_file="credentials.json", quota_project_id="octopus", + ) + load_creds.assert_called_once_with( + "credentials.json", + scopes=( + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/jobs", + ), + quota_project_id="octopus", + ) + + +def test_application_service_auth_adc(): + # If no credentials are provided, we should use ADC credentials. + with mock.patch.object(auth, "default") as adc: + adc.return_value = (credentials.AnonymousCredentials(), None) + ApplicationServiceClient() + adc.assert_called_once_with( + scopes=( + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/jobs", + ), + quota_project_id=None, + ) + + +def test_application_service_transport_auth_adc(): + # If credentials and host are not provided, the transport class should use + # ADC credentials. + with mock.patch.object(auth, "default") as adc: + adc.return_value = (credentials.AnonymousCredentials(), None) + transports.ApplicationServiceGrpcTransport( + host="squid.clam.whelk", quota_project_id="octopus" + ) + adc.assert_called_once_with( + scopes=( + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/jobs", + ), + quota_project_id="octopus", + ) + + +def test_application_service_host_no_port(): + client = ApplicationServiceClient( + credentials=credentials.AnonymousCredentials(), + client_options=client_options.ClientOptions(api_endpoint="jobs.googleapis.com"), + ) + assert client._transport._host == "jobs.googleapis.com:443" + + +def test_application_service_host_with_port(): + client = ApplicationServiceClient( + credentials=credentials.AnonymousCredentials(), + client_options=client_options.ClientOptions( + api_endpoint="jobs.googleapis.com:8000" + ), + ) + assert client._transport._host == "jobs.googleapis.com:8000" + + +def test_application_service_grpc_transport_channel(): + channel = grpc.insecure_channel("http://localhost/") + + # Check that if channel is provided, mtls endpoint and client_cert_source + # won't be used. + callback = mock.MagicMock() + transport = transports.ApplicationServiceGrpcTransport( + host="squid.clam.whelk", + channel=channel, + api_mtls_endpoint="mtls.squid.clam.whelk", + client_cert_source=callback, + ) + assert transport.grpc_channel == channel + assert transport._host == "squid.clam.whelk:443" + assert not callback.called + + +def test_application_service_grpc_asyncio_transport_channel(): + channel = aio.insecure_channel("http://localhost/") + + # Check that if channel is provided, mtls endpoint and client_cert_source + # won't be used. + callback = mock.MagicMock() + transport = transports.ApplicationServiceGrpcAsyncIOTransport( + host="squid.clam.whelk", + channel=channel, + api_mtls_endpoint="mtls.squid.clam.whelk", + client_cert_source=callback, + ) + assert transport.grpc_channel == channel + assert transport._host == "squid.clam.whelk:443" + assert not callback.called + + +@mock.patch("grpc.ssl_channel_credentials", autospec=True) +@mock.patch("google.api_core.grpc_helpers.create_channel", autospec=True) +def test_application_service_grpc_transport_channel_mtls_with_client_cert_source( + grpc_create_channel, grpc_ssl_channel_cred +): + # Check that if channel is None, but api_mtls_endpoint and client_cert_source + # are provided, then a mTLS channel will be created. + mock_cred = mock.Mock() + + mock_ssl_cred = mock.Mock() + grpc_ssl_channel_cred.return_value = mock_ssl_cred + + mock_grpc_channel = mock.Mock() + grpc_create_channel.return_value = mock_grpc_channel + + transport = transports.ApplicationServiceGrpcTransport( + host="squid.clam.whelk", + credentials=mock_cred, + api_mtls_endpoint="mtls.squid.clam.whelk", + client_cert_source=client_cert_source_callback, + ) + grpc_ssl_channel_cred.assert_called_once_with( + certificate_chain=b"cert bytes", private_key=b"key bytes" + ) + grpc_create_channel.assert_called_once_with( + "mtls.squid.clam.whelk:443", + credentials=mock_cred, + credentials_file=None, + scopes=( + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/jobs", + ), + ssl_credentials=mock_ssl_cred, + quota_project_id=None, + ) + assert transport.grpc_channel == mock_grpc_channel + + +@mock.patch("grpc.ssl_channel_credentials", autospec=True) +@mock.patch("google.api_core.grpc_helpers_async.create_channel", autospec=True) +def test_application_service_grpc_asyncio_transport_channel_mtls_with_client_cert_source( + grpc_create_channel, grpc_ssl_channel_cred +): + # Check that if channel is None, but api_mtls_endpoint and client_cert_source + # are provided, then a mTLS channel will be created. + mock_cred = mock.Mock() + + mock_ssl_cred = mock.Mock() + grpc_ssl_channel_cred.return_value = mock_ssl_cred + + mock_grpc_channel = mock.Mock() + grpc_create_channel.return_value = mock_grpc_channel + + transport = transports.ApplicationServiceGrpcAsyncIOTransport( + host="squid.clam.whelk", + credentials=mock_cred, + api_mtls_endpoint="mtls.squid.clam.whelk", + client_cert_source=client_cert_source_callback, + ) + grpc_ssl_channel_cred.assert_called_once_with( + certificate_chain=b"cert bytes", private_key=b"key bytes" + ) + grpc_create_channel.assert_called_once_with( + "mtls.squid.clam.whelk:443", + credentials=mock_cred, + credentials_file=None, + scopes=( + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/jobs", + ), + ssl_credentials=mock_ssl_cred, + quota_project_id=None, + ) + assert transport.grpc_channel == mock_grpc_channel + + +@pytest.mark.parametrize( + "api_mtls_endpoint", ["mtls.squid.clam.whelk", "mtls.squid.clam.whelk:443"] +) +@mock.patch("google.api_core.grpc_helpers.create_channel", autospec=True) +def test_application_service_grpc_transport_channel_mtls_with_adc( + grpc_create_channel, api_mtls_endpoint +): + # Check that if channel and client_cert_source are None, but api_mtls_endpoint + # is provided, then a mTLS channel will be created with SSL ADC. + mock_grpc_channel = mock.Mock() + grpc_create_channel.return_value = mock_grpc_channel + + # Mock google.auth.transport.grpc.SslCredentials class. + mock_ssl_cred = mock.Mock() + with mock.patch.multiple( + "google.auth.transport.grpc.SslCredentials", + __init__=mock.Mock(return_value=None), + ssl_credentials=mock.PropertyMock(return_value=mock_ssl_cred), + ): + mock_cred = mock.Mock() + transport = transports.ApplicationServiceGrpcTransport( + host="squid.clam.whelk", + credentials=mock_cred, + api_mtls_endpoint=api_mtls_endpoint, + client_cert_source=None, + ) + grpc_create_channel.assert_called_once_with( + "mtls.squid.clam.whelk:443", + credentials=mock_cred, + credentials_file=None, + scopes=( + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/jobs", + ), + ssl_credentials=mock_ssl_cred, + quota_project_id=None, + ) + assert transport.grpc_channel == mock_grpc_channel + + +@pytest.mark.parametrize( + "api_mtls_endpoint", ["mtls.squid.clam.whelk", "mtls.squid.clam.whelk:443"] +) +@mock.patch("google.api_core.grpc_helpers_async.create_channel", autospec=True) +def test_application_service_grpc_asyncio_transport_channel_mtls_with_adc( + grpc_create_channel, api_mtls_endpoint +): + # Check that if channel and client_cert_source are None, but api_mtls_endpoint + # is provided, then a mTLS channel will be created with SSL ADC. + mock_grpc_channel = mock.Mock() + grpc_create_channel.return_value = mock_grpc_channel + + # Mock google.auth.transport.grpc.SslCredentials class. + mock_ssl_cred = mock.Mock() + with mock.patch.multiple( + "google.auth.transport.grpc.SslCredentials", + __init__=mock.Mock(return_value=None), + ssl_credentials=mock.PropertyMock(return_value=mock_ssl_cred), + ): + mock_cred = mock.Mock() + transport = transports.ApplicationServiceGrpcAsyncIOTransport( + host="squid.clam.whelk", + credentials=mock_cred, + api_mtls_endpoint=api_mtls_endpoint, + client_cert_source=None, + ) + grpc_create_channel.assert_called_once_with( + "mtls.squid.clam.whelk:443", + credentials=mock_cred, + credentials_file=None, + scopes=( + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/jobs", + ), + ssl_credentials=mock_ssl_cred, + quota_project_id=None, + ) + assert transport.grpc_channel == mock_grpc_channel + + +def test_application_path(): + project = "squid" + tenant = "clam" + profile = "whelk" + application = "octopus" + + expected = "projects/{project}/tenants/{tenant}/profiles/{profile}/applications/{application}".format( + project=project, tenant=tenant, profile=profile, application=application, + ) + actual = ApplicationServiceClient.application_path( + project, tenant, profile, application + ) + assert expected == actual + + +def test_parse_application_path(): + expected = { + "project": "oyster", + "tenant": "nudibranch", + "profile": "cuttlefish", + "application": "mussel", + } + path = ApplicationServiceClient.application_path(**expected) + + # Check that the path construction is reversible. + actual = ApplicationServiceClient.parse_application_path(path) + assert expected == actual diff --git a/tests/unit/gapic/talent_v4beta1/test_company_service.py b/tests/unit/gapic/talent_v4beta1/test_company_service.py new file mode 100644 index 00000000..29ac1a52 --- /dev/null +++ b/tests/unit/gapic/talent_v4beta1/test_company_service.py @@ -0,0 +1,2046 @@ +# -*- 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. +# + +import os +import mock + +import grpc +from grpc.experimental import aio +import math +import pytest +from proto.marshal.rules.dates import DurationRule, TimestampRule + +from google import auth +from google.api_core import client_options +from google.api_core import exceptions +from google.api_core import gapic_v1 +from google.api_core import grpc_helpers +from google.api_core import grpc_helpers_async +from google.auth import credentials +from google.auth.exceptions import MutualTLSChannelError +from google.cloud.talent_v4beta1.services.company_service import ( + CompanyServiceAsyncClient, +) +from google.cloud.talent_v4beta1.services.company_service import CompanyServiceClient +from google.cloud.talent_v4beta1.services.company_service import pagers +from google.cloud.talent_v4beta1.services.company_service import transports +from google.cloud.talent_v4beta1.types import common +from google.cloud.talent_v4beta1.types import company +from google.cloud.talent_v4beta1.types import company as gct_company +from google.cloud.talent_v4beta1.types import company_service +from google.oauth2 import service_account +from google.protobuf import field_mask_pb2 as field_mask # type: ignore +from google.type import latlng_pb2 as latlng # type: ignore +from google.type import postal_address_pb2 as gt_postal_address # type: ignore + + +def client_cert_source_callback(): + return b"cert bytes", b"key bytes" + + +# If default endpoint is localhost, then default mtls endpoint will be the same. +# This method modifies the default endpoint so the client can produce a different +# mtls endpoint for endpoint testing purposes. +def modify_default_endpoint(client): + return ( + "foo.googleapis.com" + if ("localhost" in client.DEFAULT_ENDPOINT) + else client.DEFAULT_ENDPOINT + ) + + +def test__get_default_mtls_endpoint(): + api_endpoint = "example.googleapis.com" + api_mtls_endpoint = "example.mtls.googleapis.com" + sandbox_endpoint = "example.sandbox.googleapis.com" + sandbox_mtls_endpoint = "example.mtls.sandbox.googleapis.com" + non_googleapi = "api.example.com" + + assert CompanyServiceClient._get_default_mtls_endpoint(None) is None + assert ( + CompanyServiceClient._get_default_mtls_endpoint(api_endpoint) + == api_mtls_endpoint + ) + assert ( + CompanyServiceClient._get_default_mtls_endpoint(api_mtls_endpoint) + == api_mtls_endpoint + ) + assert ( + CompanyServiceClient._get_default_mtls_endpoint(sandbox_endpoint) + == sandbox_mtls_endpoint + ) + assert ( + CompanyServiceClient._get_default_mtls_endpoint(sandbox_mtls_endpoint) + == sandbox_mtls_endpoint + ) + assert ( + CompanyServiceClient._get_default_mtls_endpoint(non_googleapi) == non_googleapi + ) + + +@pytest.mark.parametrize( + "client_class", [CompanyServiceClient, CompanyServiceAsyncClient] +) +def test_company_service_client_from_service_account_file(client_class): + creds = credentials.AnonymousCredentials() + with mock.patch.object( + service_account.Credentials, "from_service_account_file" + ) as factory: + factory.return_value = creds + client = client_class.from_service_account_file("dummy/file/path.json") + assert client._transport._credentials == creds + + client = client_class.from_service_account_json("dummy/file/path.json") + assert client._transport._credentials == creds + + assert client._transport._host == "jobs.googleapis.com:443" + + +def test_company_service_client_get_transport_class(): + transport = CompanyServiceClient.get_transport_class() + assert transport == transports.CompanyServiceGrpcTransport + + transport = CompanyServiceClient.get_transport_class("grpc") + assert transport == transports.CompanyServiceGrpcTransport + + +@pytest.mark.parametrize( + "client_class,transport_class,transport_name", + [ + (CompanyServiceClient, transports.CompanyServiceGrpcTransport, "grpc"), + ( + CompanyServiceAsyncClient, + transports.CompanyServiceGrpcAsyncIOTransport, + "grpc_asyncio", + ), + ], +) +@mock.patch.object( + CompanyServiceClient, + "DEFAULT_ENDPOINT", + modify_default_endpoint(CompanyServiceClient), +) +@mock.patch.object( + CompanyServiceAsyncClient, + "DEFAULT_ENDPOINT", + modify_default_endpoint(CompanyServiceAsyncClient), +) +def test_company_service_client_client_options( + client_class, transport_class, transport_name +): + # Check that if channel is provided we won't create a new one. + with mock.patch.object(CompanyServiceClient, "get_transport_class") as gtc: + transport = transport_class(credentials=credentials.AnonymousCredentials()) + client = client_class(transport=transport) + gtc.assert_not_called() + + # Check that if channel is provided via str we will create a new one. + with mock.patch.object(CompanyServiceClient, "get_transport_class") as gtc: + client = client_class(transport=transport_name) + gtc.assert_called() + + # Check the case api_endpoint is provided. + options = client_options.ClientOptions(api_endpoint="squid.clam.whelk") + with mock.patch.object(transport_class, "__init__") as patched: + patched.return_value = None + client = client_class(client_options=options) + patched.assert_called_once_with( + credentials=None, + credentials_file=None, + host="squid.clam.whelk", + scopes=None, + api_mtls_endpoint="squid.clam.whelk", + client_cert_source=None, + quota_project_id=None, + ) + + # Check the case api_endpoint is not provided and GOOGLE_API_USE_MTLS is + # "never". + with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS": "never"}): + with mock.patch.object(transport_class, "__init__") as patched: + patched.return_value = None + client = client_class() + patched.assert_called_once_with( + credentials=None, + credentials_file=None, + host=client.DEFAULT_ENDPOINT, + scopes=None, + api_mtls_endpoint=client.DEFAULT_ENDPOINT, + client_cert_source=None, + quota_project_id=None, + ) + + # Check the case api_endpoint is not provided and GOOGLE_API_USE_MTLS is + # "always". + with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS": "always"}): + with mock.patch.object(transport_class, "__init__") as patched: + patched.return_value = None + client = client_class() + patched.assert_called_once_with( + credentials=None, + credentials_file=None, + host=client.DEFAULT_MTLS_ENDPOINT, + scopes=None, + api_mtls_endpoint=client.DEFAULT_MTLS_ENDPOINT, + client_cert_source=None, + quota_project_id=None, + ) + + # Check the case api_endpoint is not provided, GOOGLE_API_USE_MTLS is + # "auto", and client_cert_source is provided. + with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS": "auto"}): + options = client_options.ClientOptions( + client_cert_source=client_cert_source_callback + ) + with mock.patch.object(transport_class, "__init__") as patched: + patched.return_value = None + client = client_class(client_options=options) + patched.assert_called_once_with( + credentials=None, + credentials_file=None, + host=client.DEFAULT_MTLS_ENDPOINT, + scopes=None, + api_mtls_endpoint=client.DEFAULT_MTLS_ENDPOINT, + client_cert_source=client_cert_source_callback, + quota_project_id=None, + ) + + # Check the case api_endpoint is not provided, GOOGLE_API_USE_MTLS is + # "auto", and default_client_cert_source is provided. + with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS": "auto"}): + with mock.patch.object(transport_class, "__init__") as patched: + with mock.patch( + "google.auth.transport.mtls.has_default_client_cert_source", + return_value=True, + ): + patched.return_value = None + client = client_class() + patched.assert_called_once_with( + credentials=None, + credentials_file=None, + host=client.DEFAULT_MTLS_ENDPOINT, + scopes=None, + api_mtls_endpoint=client.DEFAULT_MTLS_ENDPOINT, + client_cert_source=None, + quota_project_id=None, + ) + + # Check the case api_endpoint is not provided, GOOGLE_API_USE_MTLS is + # "auto", but client_cert_source and default_client_cert_source are None. + with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS": "auto"}): + with mock.patch.object(transport_class, "__init__") as patched: + with mock.patch( + "google.auth.transport.mtls.has_default_client_cert_source", + return_value=False, + ): + patched.return_value = None + client = client_class() + patched.assert_called_once_with( + credentials=None, + credentials_file=None, + host=client.DEFAULT_ENDPOINT, + scopes=None, + api_mtls_endpoint=client.DEFAULT_ENDPOINT, + client_cert_source=None, + quota_project_id=None, + ) + + # Check the case api_endpoint is not provided and GOOGLE_API_USE_MTLS has + # unsupported value. + with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS": "Unsupported"}): + with pytest.raises(MutualTLSChannelError): + client = client_class() + + # Check the case quota_project_id is provided + options = client_options.ClientOptions(quota_project_id="octopus") + with mock.patch.object(transport_class, "__init__") as patched: + patched.return_value = None + client = client_class(client_options=options) + patched.assert_called_once_with( + credentials=None, + credentials_file=None, + host=client.DEFAULT_ENDPOINT, + scopes=None, + api_mtls_endpoint=client.DEFAULT_ENDPOINT, + client_cert_source=None, + quota_project_id="octopus", + ) + + +@pytest.mark.parametrize( + "client_class,transport_class,transport_name", + [ + (CompanyServiceClient, transports.CompanyServiceGrpcTransport, "grpc"), + ( + CompanyServiceAsyncClient, + transports.CompanyServiceGrpcAsyncIOTransport, + "grpc_asyncio", + ), + ], +) +def test_company_service_client_client_options_scopes( + client_class, transport_class, transport_name +): + # Check the case scopes are provided. + options = client_options.ClientOptions(scopes=["1", "2"],) + with mock.patch.object(transport_class, "__init__") as patched: + patched.return_value = None + client = client_class(client_options=options) + patched.assert_called_once_with( + credentials=None, + credentials_file=None, + host=client.DEFAULT_ENDPOINT, + scopes=["1", "2"], + api_mtls_endpoint=client.DEFAULT_ENDPOINT, + client_cert_source=None, + quota_project_id=None, + ) + + +@pytest.mark.parametrize( + "client_class,transport_class,transport_name", + [ + (CompanyServiceClient, transports.CompanyServiceGrpcTransport, "grpc"), + ( + CompanyServiceAsyncClient, + transports.CompanyServiceGrpcAsyncIOTransport, + "grpc_asyncio", + ), + ], +) +def test_company_service_client_client_options_credentials_file( + client_class, transport_class, transport_name +): + # Check the case credentials file is provided. + options = client_options.ClientOptions(credentials_file="credentials.json") + with mock.patch.object(transport_class, "__init__") as patched: + patched.return_value = None + client = client_class(client_options=options) + patched.assert_called_once_with( + credentials=None, + credentials_file="credentials.json", + host=client.DEFAULT_ENDPOINT, + scopes=None, + api_mtls_endpoint=client.DEFAULT_ENDPOINT, + client_cert_source=None, + quota_project_id=None, + ) + + +def test_company_service_client_client_options_from_dict(): + with mock.patch( + "google.cloud.talent_v4beta1.services.company_service.transports.CompanyServiceGrpcTransport.__init__" + ) as grpc_transport: + grpc_transport.return_value = None + client = CompanyServiceClient( + client_options={"api_endpoint": "squid.clam.whelk"} + ) + grpc_transport.assert_called_once_with( + credentials=None, + credentials_file=None, + host="squid.clam.whelk", + scopes=None, + api_mtls_endpoint="squid.clam.whelk", + client_cert_source=None, + quota_project_id=None, + ) + + +def test_create_company( + transport: str = "grpc", request_type=company_service.CreateCompanyRequest +): + client = CompanyServiceClient( + credentials=credentials.AnonymousCredentials(), transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client._transport.create_company), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = gct_company.Company( + name="name_value", + display_name="display_name_value", + external_id="external_id_value", + size=common.CompanySize.MINI, + headquarters_address="headquarters_address_value", + hiring_agency=True, + eeo_text="eeo_text_value", + website_uri="website_uri_value", + career_site_uri="career_site_uri_value", + image_uri="image_uri_value", + keyword_searchable_job_custom_attributes=[ + "keyword_searchable_job_custom_attributes_value" + ], + suspended=True, + ) + + response = client.create_company(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + + assert args[0] == company_service.CreateCompanyRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, gct_company.Company) + + assert response.name == "name_value" + + assert response.display_name == "display_name_value" + + assert response.external_id == "external_id_value" + + assert response.size == common.CompanySize.MINI + + assert response.headquarters_address == "headquarters_address_value" + + assert response.hiring_agency is True + + assert response.eeo_text == "eeo_text_value" + + assert response.website_uri == "website_uri_value" + + assert response.career_site_uri == "career_site_uri_value" + + assert response.image_uri == "image_uri_value" + + assert response.keyword_searchable_job_custom_attributes == [ + "keyword_searchable_job_custom_attributes_value" + ] + + assert response.suspended is True + + +def test_create_company_from_dict(): + test_create_company(request_type=dict) + + +@pytest.mark.asyncio +async def test_create_company_async(transport: str = "grpc_asyncio"): + client = CompanyServiceAsyncClient( + credentials=credentials.AnonymousCredentials(), transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = company_service.CreateCompanyRequest() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client._client._transport.create_company), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + gct_company.Company( + name="name_value", + display_name="display_name_value", + external_id="external_id_value", + size=common.CompanySize.MINI, + headquarters_address="headquarters_address_value", + hiring_agency=True, + eeo_text="eeo_text_value", + website_uri="website_uri_value", + career_site_uri="career_site_uri_value", + image_uri="image_uri_value", + keyword_searchable_job_custom_attributes=[ + "keyword_searchable_job_custom_attributes_value" + ], + suspended=True, + ) + ) + + response = await client.create_company(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + + assert args[0] == request + + # Establish that the response is the type that we expect. + assert isinstance(response, gct_company.Company) + + assert response.name == "name_value" + + assert response.display_name == "display_name_value" + + assert response.external_id == "external_id_value" + + assert response.size == common.CompanySize.MINI + + assert response.headquarters_address == "headquarters_address_value" + + assert response.hiring_agency is True + + assert response.eeo_text == "eeo_text_value" + + assert response.website_uri == "website_uri_value" + + assert response.career_site_uri == "career_site_uri_value" + + assert response.image_uri == "image_uri_value" + + assert response.keyword_searchable_job_custom_attributes == [ + "keyword_searchable_job_custom_attributes_value" + ] + + assert response.suspended is True + + +def test_create_company_field_headers(): + client = CompanyServiceClient(credentials=credentials.AnonymousCredentials(),) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = company_service.CreateCompanyRequest() + request.parent = "parent/value" + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client._transport.create_company), "__call__") as call: + call.return_value = gct_company.Company() + + client.create_company(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + + +@pytest.mark.asyncio +async def test_create_company_field_headers_async(): + client = CompanyServiceAsyncClient(credentials=credentials.AnonymousCredentials(),) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = company_service.CreateCompanyRequest() + request.parent = "parent/value" + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client._client._transport.create_company), "__call__" + ) as call: + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(gct_company.Company()) + + await client.create_company(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + + +def test_create_company_flattened(): + client = CompanyServiceClient(credentials=credentials.AnonymousCredentials(),) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client._transport.create_company), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = gct_company.Company() + + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + client.create_company( + parent="parent_value", company=gct_company.Company(name="name_value"), + ) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + + assert args[0].parent == "parent_value" + + assert args[0].company == gct_company.Company(name="name_value") + + +def test_create_company_flattened_error(): + client = CompanyServiceClient(credentials=credentials.AnonymousCredentials(),) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + client.create_company( + company_service.CreateCompanyRequest(), + parent="parent_value", + company=gct_company.Company(name="name_value"), + ) + + +@pytest.mark.asyncio +async def test_create_company_flattened_async(): + client = CompanyServiceAsyncClient(credentials=credentials.AnonymousCredentials(),) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client._client._transport.create_company), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = gct_company.Company() + + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(gct_company.Company()) + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + response = await client.create_company( + parent="parent_value", company=gct_company.Company(name="name_value"), + ) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + + assert args[0].parent == "parent_value" + + assert args[0].company == gct_company.Company(name="name_value") + + +@pytest.mark.asyncio +async def test_create_company_flattened_error_async(): + client = CompanyServiceAsyncClient(credentials=credentials.AnonymousCredentials(),) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + await client.create_company( + company_service.CreateCompanyRequest(), + parent="parent_value", + company=gct_company.Company(name="name_value"), + ) + + +def test_get_company( + transport: str = "grpc", request_type=company_service.GetCompanyRequest +): + client = CompanyServiceClient( + credentials=credentials.AnonymousCredentials(), transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client._transport.get_company), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = company.Company( + name="name_value", + display_name="display_name_value", + external_id="external_id_value", + size=common.CompanySize.MINI, + headquarters_address="headquarters_address_value", + hiring_agency=True, + eeo_text="eeo_text_value", + website_uri="website_uri_value", + career_site_uri="career_site_uri_value", + image_uri="image_uri_value", + keyword_searchable_job_custom_attributes=[ + "keyword_searchable_job_custom_attributes_value" + ], + suspended=True, + ) + + response = client.get_company(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + + assert args[0] == company_service.GetCompanyRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, company.Company) + + assert response.name == "name_value" + + assert response.display_name == "display_name_value" + + assert response.external_id == "external_id_value" + + assert response.size == common.CompanySize.MINI + + assert response.headquarters_address == "headquarters_address_value" + + assert response.hiring_agency is True + + assert response.eeo_text == "eeo_text_value" + + assert response.website_uri == "website_uri_value" + + assert response.career_site_uri == "career_site_uri_value" + + assert response.image_uri == "image_uri_value" + + assert response.keyword_searchable_job_custom_attributes == [ + "keyword_searchable_job_custom_attributes_value" + ] + + assert response.suspended is True + + +def test_get_company_from_dict(): + test_get_company(request_type=dict) + + +@pytest.mark.asyncio +async def test_get_company_async(transport: str = "grpc_asyncio"): + client = CompanyServiceAsyncClient( + credentials=credentials.AnonymousCredentials(), transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = company_service.GetCompanyRequest() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client._client._transport.get_company), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + company.Company( + name="name_value", + display_name="display_name_value", + external_id="external_id_value", + size=common.CompanySize.MINI, + headquarters_address="headquarters_address_value", + hiring_agency=True, + eeo_text="eeo_text_value", + website_uri="website_uri_value", + career_site_uri="career_site_uri_value", + image_uri="image_uri_value", + keyword_searchable_job_custom_attributes=[ + "keyword_searchable_job_custom_attributes_value" + ], + suspended=True, + ) + ) + + response = await client.get_company(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + + assert args[0] == request + + # Establish that the response is the type that we expect. + assert isinstance(response, company.Company) + + assert response.name == "name_value" + + assert response.display_name == "display_name_value" + + assert response.external_id == "external_id_value" + + assert response.size == common.CompanySize.MINI + + assert response.headquarters_address == "headquarters_address_value" + + assert response.hiring_agency is True + + assert response.eeo_text == "eeo_text_value" + + assert response.website_uri == "website_uri_value" + + assert response.career_site_uri == "career_site_uri_value" + + assert response.image_uri == "image_uri_value" + + assert response.keyword_searchable_job_custom_attributes == [ + "keyword_searchable_job_custom_attributes_value" + ] + + assert response.suspended is True + + +def test_get_company_field_headers(): + client = CompanyServiceClient(credentials=credentials.AnonymousCredentials(),) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = company_service.GetCompanyRequest() + request.name = "name/value" + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client._transport.get_company), "__call__") as call: + call.return_value = company.Company() + + client.get_company(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + + +@pytest.mark.asyncio +async def test_get_company_field_headers_async(): + client = CompanyServiceAsyncClient(credentials=credentials.AnonymousCredentials(),) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = company_service.GetCompanyRequest() + request.name = "name/value" + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client._client._transport.get_company), "__call__" + ) as call: + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(company.Company()) + + await client.get_company(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + + +def test_get_company_flattened(): + client = CompanyServiceClient(credentials=credentials.AnonymousCredentials(),) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client._transport.get_company), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = company.Company() + + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + client.get_company(name="name_value",) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + + assert args[0].name == "name_value" + + +def test_get_company_flattened_error(): + client = CompanyServiceClient(credentials=credentials.AnonymousCredentials(),) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + client.get_company( + company_service.GetCompanyRequest(), name="name_value", + ) + + +@pytest.mark.asyncio +async def test_get_company_flattened_async(): + client = CompanyServiceAsyncClient(credentials=credentials.AnonymousCredentials(),) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client._client._transport.get_company), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = company.Company() + + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(company.Company()) + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + response = await client.get_company(name="name_value",) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + + assert args[0].name == "name_value" + + +@pytest.mark.asyncio +async def test_get_company_flattened_error_async(): + client = CompanyServiceAsyncClient(credentials=credentials.AnonymousCredentials(),) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + await client.get_company( + company_service.GetCompanyRequest(), name="name_value", + ) + + +def test_update_company( + transport: str = "grpc", request_type=company_service.UpdateCompanyRequest +): + client = CompanyServiceClient( + credentials=credentials.AnonymousCredentials(), transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client._transport.update_company), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = gct_company.Company( + name="name_value", + display_name="display_name_value", + external_id="external_id_value", + size=common.CompanySize.MINI, + headquarters_address="headquarters_address_value", + hiring_agency=True, + eeo_text="eeo_text_value", + website_uri="website_uri_value", + career_site_uri="career_site_uri_value", + image_uri="image_uri_value", + keyword_searchable_job_custom_attributes=[ + "keyword_searchable_job_custom_attributes_value" + ], + suspended=True, + ) + + response = client.update_company(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + + assert args[0] == company_service.UpdateCompanyRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, gct_company.Company) + + assert response.name == "name_value" + + assert response.display_name == "display_name_value" + + assert response.external_id == "external_id_value" + + assert response.size == common.CompanySize.MINI + + assert response.headquarters_address == "headquarters_address_value" + + assert response.hiring_agency is True + + assert response.eeo_text == "eeo_text_value" + + assert response.website_uri == "website_uri_value" + + assert response.career_site_uri == "career_site_uri_value" + + assert response.image_uri == "image_uri_value" + + assert response.keyword_searchable_job_custom_attributes == [ + "keyword_searchable_job_custom_attributes_value" + ] + + assert response.suspended is True + + +def test_update_company_from_dict(): + test_update_company(request_type=dict) + + +@pytest.mark.asyncio +async def test_update_company_async(transport: str = "grpc_asyncio"): + client = CompanyServiceAsyncClient( + credentials=credentials.AnonymousCredentials(), transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = company_service.UpdateCompanyRequest() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client._client._transport.update_company), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + gct_company.Company( + name="name_value", + display_name="display_name_value", + external_id="external_id_value", + size=common.CompanySize.MINI, + headquarters_address="headquarters_address_value", + hiring_agency=True, + eeo_text="eeo_text_value", + website_uri="website_uri_value", + career_site_uri="career_site_uri_value", + image_uri="image_uri_value", + keyword_searchable_job_custom_attributes=[ + "keyword_searchable_job_custom_attributes_value" + ], + suspended=True, + ) + ) + + response = await client.update_company(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + + assert args[0] == request + + # Establish that the response is the type that we expect. + assert isinstance(response, gct_company.Company) + + assert response.name == "name_value" + + assert response.display_name == "display_name_value" + + assert response.external_id == "external_id_value" + + assert response.size == common.CompanySize.MINI + + assert response.headquarters_address == "headquarters_address_value" + + assert response.hiring_agency is True + + assert response.eeo_text == "eeo_text_value" + + assert response.website_uri == "website_uri_value" + + assert response.career_site_uri == "career_site_uri_value" + + assert response.image_uri == "image_uri_value" + + assert response.keyword_searchable_job_custom_attributes == [ + "keyword_searchable_job_custom_attributes_value" + ] + + assert response.suspended is True + + +def test_update_company_field_headers(): + client = CompanyServiceClient(credentials=credentials.AnonymousCredentials(),) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = company_service.UpdateCompanyRequest() + request.company.name = "company.name/value" + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client._transport.update_company), "__call__") as call: + call.return_value = gct_company.Company() + + client.update_company(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ("x-goog-request-params", "company.name=company.name/value",) in kw[ + "metadata" + ] + + +@pytest.mark.asyncio +async def test_update_company_field_headers_async(): + client = CompanyServiceAsyncClient(credentials=credentials.AnonymousCredentials(),) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = company_service.UpdateCompanyRequest() + request.company.name = "company.name/value" + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client._client._transport.update_company), "__call__" + ) as call: + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(gct_company.Company()) + + await client.update_company(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ("x-goog-request-params", "company.name=company.name/value",) in kw[ + "metadata" + ] + + +def test_update_company_flattened(): + client = CompanyServiceClient(credentials=credentials.AnonymousCredentials(),) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client._transport.update_company), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = gct_company.Company() + + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + client.update_company(company=gct_company.Company(name="name_value"),) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + + assert args[0].company == gct_company.Company(name="name_value") + + +def test_update_company_flattened_error(): + client = CompanyServiceClient(credentials=credentials.AnonymousCredentials(),) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + client.update_company( + company_service.UpdateCompanyRequest(), + company=gct_company.Company(name="name_value"), + ) + + +@pytest.mark.asyncio +async def test_update_company_flattened_async(): + client = CompanyServiceAsyncClient(credentials=credentials.AnonymousCredentials(),) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client._client._transport.update_company), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = gct_company.Company() + + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(gct_company.Company()) + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + response = await client.update_company( + company=gct_company.Company(name="name_value"), + ) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + + assert args[0].company == gct_company.Company(name="name_value") + + +@pytest.mark.asyncio +async def test_update_company_flattened_error_async(): + client = CompanyServiceAsyncClient(credentials=credentials.AnonymousCredentials(),) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + await client.update_company( + company_service.UpdateCompanyRequest(), + company=gct_company.Company(name="name_value"), + ) + + +def test_delete_company( + transport: str = "grpc", request_type=company_service.DeleteCompanyRequest +): + client = CompanyServiceClient( + credentials=credentials.AnonymousCredentials(), transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client._transport.delete_company), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = None + + response = client.delete_company(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + + assert args[0] == company_service.DeleteCompanyRequest() + + # Establish that the response is the type that we expect. + assert response is None + + +def test_delete_company_from_dict(): + test_delete_company(request_type=dict) + + +@pytest.mark.asyncio +async def test_delete_company_async(transport: str = "grpc_asyncio"): + client = CompanyServiceAsyncClient( + credentials=credentials.AnonymousCredentials(), transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = company_service.DeleteCompanyRequest() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client._client._transport.delete_company), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(None) + + response = await client.delete_company(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + + assert args[0] == request + + # Establish that the response is the type that we expect. + assert response is None + + +def test_delete_company_field_headers(): + client = CompanyServiceClient(credentials=credentials.AnonymousCredentials(),) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = company_service.DeleteCompanyRequest() + request.name = "name/value" + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client._transport.delete_company), "__call__") as call: + call.return_value = None + + client.delete_company(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + + +@pytest.mark.asyncio +async def test_delete_company_field_headers_async(): + client = CompanyServiceAsyncClient(credentials=credentials.AnonymousCredentials(),) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = company_service.DeleteCompanyRequest() + request.name = "name/value" + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client._client._transport.delete_company), "__call__" + ) as call: + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(None) + + await client.delete_company(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + + +def test_delete_company_flattened(): + client = CompanyServiceClient(credentials=credentials.AnonymousCredentials(),) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client._transport.delete_company), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = None + + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + client.delete_company(name="name_value",) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + + assert args[0].name == "name_value" + + +def test_delete_company_flattened_error(): + client = CompanyServiceClient(credentials=credentials.AnonymousCredentials(),) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + client.delete_company( + company_service.DeleteCompanyRequest(), name="name_value", + ) + + +@pytest.mark.asyncio +async def test_delete_company_flattened_async(): + client = CompanyServiceAsyncClient(credentials=credentials.AnonymousCredentials(),) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client._client._transport.delete_company), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = None + + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(None) + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + response = await client.delete_company(name="name_value",) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + + assert args[0].name == "name_value" + + +@pytest.mark.asyncio +async def test_delete_company_flattened_error_async(): + client = CompanyServiceAsyncClient(credentials=credentials.AnonymousCredentials(),) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + await client.delete_company( + company_service.DeleteCompanyRequest(), name="name_value", + ) + + +def test_list_companies( + transport: str = "grpc", request_type=company_service.ListCompaniesRequest +): + client = CompanyServiceClient( + credentials=credentials.AnonymousCredentials(), transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client._transport.list_companies), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = company_service.ListCompaniesResponse( + next_page_token="next_page_token_value", + ) + + response = client.list_companies(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + + assert args[0] == company_service.ListCompaniesRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, pagers.ListCompaniesPager) + + assert response.next_page_token == "next_page_token_value" + + +def test_list_companies_from_dict(): + test_list_companies(request_type=dict) + + +@pytest.mark.asyncio +async def test_list_companies_async(transport: str = "grpc_asyncio"): + client = CompanyServiceAsyncClient( + credentials=credentials.AnonymousCredentials(), transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = company_service.ListCompaniesRequest() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client._client._transport.list_companies), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + company_service.ListCompaniesResponse( + next_page_token="next_page_token_value", + ) + ) + + response = await client.list_companies(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + + assert args[0] == request + + # Establish that the response is the type that we expect. + assert isinstance(response, pagers.ListCompaniesAsyncPager) + + assert response.next_page_token == "next_page_token_value" + + +def test_list_companies_field_headers(): + client = CompanyServiceClient(credentials=credentials.AnonymousCredentials(),) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = company_service.ListCompaniesRequest() + request.parent = "parent/value" + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client._transport.list_companies), "__call__") as call: + call.return_value = company_service.ListCompaniesResponse() + + client.list_companies(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + + +@pytest.mark.asyncio +async def test_list_companies_field_headers_async(): + client = CompanyServiceAsyncClient(credentials=credentials.AnonymousCredentials(),) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = company_service.ListCompaniesRequest() + request.parent = "parent/value" + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client._client._transport.list_companies), "__call__" + ) as call: + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + company_service.ListCompaniesResponse() + ) + + await client.list_companies(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + + +def test_list_companies_flattened(): + client = CompanyServiceClient(credentials=credentials.AnonymousCredentials(),) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client._transport.list_companies), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = company_service.ListCompaniesResponse() + + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + client.list_companies(parent="parent_value",) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + + assert args[0].parent == "parent_value" + + +def test_list_companies_flattened_error(): + client = CompanyServiceClient(credentials=credentials.AnonymousCredentials(),) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + client.list_companies( + company_service.ListCompaniesRequest(), parent="parent_value", + ) + + +@pytest.mark.asyncio +async def test_list_companies_flattened_async(): + client = CompanyServiceAsyncClient(credentials=credentials.AnonymousCredentials(),) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client._client._transport.list_companies), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = company_service.ListCompaniesResponse() + + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + company_service.ListCompaniesResponse() + ) + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + response = await client.list_companies(parent="parent_value",) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + + assert args[0].parent == "parent_value" + + +@pytest.mark.asyncio +async def test_list_companies_flattened_error_async(): + client = CompanyServiceAsyncClient(credentials=credentials.AnonymousCredentials(),) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + await client.list_companies( + company_service.ListCompaniesRequest(), parent="parent_value", + ) + + +def test_list_companies_pager(): + client = CompanyServiceClient(credentials=credentials.AnonymousCredentials,) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client._transport.list_companies), "__call__") as call: + # Set the response to a series of pages. + call.side_effect = ( + company_service.ListCompaniesResponse( + companies=[company.Company(), company.Company(), company.Company(),], + next_page_token="abc", + ), + company_service.ListCompaniesResponse(companies=[], next_page_token="def",), + company_service.ListCompaniesResponse( + companies=[company.Company(),], next_page_token="ghi", + ), + company_service.ListCompaniesResponse( + companies=[company.Company(), company.Company(),], + ), + RuntimeError, + ) + + metadata = () + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata((("parent", ""),)), + ) + pager = client.list_companies(request={}) + + assert pager._metadata == metadata + + results = [i for i in pager] + assert len(results) == 6 + assert all(isinstance(i, company.Company) for i in results) + + +def test_list_companies_pages(): + client = CompanyServiceClient(credentials=credentials.AnonymousCredentials,) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client._transport.list_companies), "__call__") as call: + # Set the response to a series of pages. + call.side_effect = ( + company_service.ListCompaniesResponse( + companies=[company.Company(), company.Company(), company.Company(),], + next_page_token="abc", + ), + company_service.ListCompaniesResponse(companies=[], next_page_token="def",), + company_service.ListCompaniesResponse( + companies=[company.Company(),], next_page_token="ghi", + ), + company_service.ListCompaniesResponse( + companies=[company.Company(), company.Company(),], + ), + RuntimeError, + ) + pages = list(client.list_companies(request={}).pages) + for page, token in zip(pages, ["abc", "def", "ghi", ""]): + assert page.raw_page.next_page_token == token + + +@pytest.mark.asyncio +async def test_list_companies_async_pager(): + client = CompanyServiceAsyncClient(credentials=credentials.AnonymousCredentials,) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client._client._transport.list_companies), + "__call__", + new_callable=mock.AsyncMock, + ) as call: + # Set the response to a series of pages. + call.side_effect = ( + company_service.ListCompaniesResponse( + companies=[company.Company(), company.Company(), company.Company(),], + next_page_token="abc", + ), + company_service.ListCompaniesResponse(companies=[], next_page_token="def",), + company_service.ListCompaniesResponse( + companies=[company.Company(),], next_page_token="ghi", + ), + company_service.ListCompaniesResponse( + companies=[company.Company(), company.Company(),], + ), + RuntimeError, + ) + async_pager = await client.list_companies(request={},) + assert async_pager.next_page_token == "abc" + responses = [] + async for response in async_pager: + responses.append(response) + + assert len(responses) == 6 + assert all(isinstance(i, company.Company) for i in responses) + + +@pytest.mark.asyncio +async def test_list_companies_async_pages(): + client = CompanyServiceAsyncClient(credentials=credentials.AnonymousCredentials,) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client._client._transport.list_companies), + "__call__", + new_callable=mock.AsyncMock, + ) as call: + # Set the response to a series of pages. + call.side_effect = ( + company_service.ListCompaniesResponse( + companies=[company.Company(), company.Company(), company.Company(),], + next_page_token="abc", + ), + company_service.ListCompaniesResponse(companies=[], next_page_token="def",), + company_service.ListCompaniesResponse( + companies=[company.Company(),], next_page_token="ghi", + ), + company_service.ListCompaniesResponse( + companies=[company.Company(), company.Company(),], + ), + RuntimeError, + ) + pages = [] + async for page in (await client.list_companies(request={})).pages: + pages.append(page) + for page, token in zip(pages, ["abc", "def", "ghi", ""]): + assert page.raw_page.next_page_token == token + + +def test_credentials_transport_error(): + # It is an error to provide credentials and a transport instance. + transport = transports.CompanyServiceGrpcTransport( + credentials=credentials.AnonymousCredentials(), + ) + with pytest.raises(ValueError): + client = CompanyServiceClient( + credentials=credentials.AnonymousCredentials(), transport=transport, + ) + + # It is an error to provide a credentials file and a transport instance. + transport = transports.CompanyServiceGrpcTransport( + credentials=credentials.AnonymousCredentials(), + ) + with pytest.raises(ValueError): + client = CompanyServiceClient( + client_options={"credentials_file": "credentials.json"}, + transport=transport, + ) + + # It is an error to provide scopes and a transport instance. + transport = transports.CompanyServiceGrpcTransport( + credentials=credentials.AnonymousCredentials(), + ) + with pytest.raises(ValueError): + client = CompanyServiceClient( + client_options={"scopes": ["1", "2"]}, transport=transport, + ) + + +def test_transport_instance(): + # A client may be instantiated with a custom transport instance. + transport = transports.CompanyServiceGrpcTransport( + credentials=credentials.AnonymousCredentials(), + ) + client = CompanyServiceClient(transport=transport) + assert client._transport is transport + + +def test_transport_get_channel(): + # A client may be instantiated with a custom transport instance. + transport = transports.CompanyServiceGrpcTransport( + credentials=credentials.AnonymousCredentials(), + ) + channel = transport.grpc_channel + assert channel + + transport = transports.CompanyServiceGrpcAsyncIOTransport( + credentials=credentials.AnonymousCredentials(), + ) + channel = transport.grpc_channel + assert channel + + +def test_transport_grpc_default(): + # A client should use the gRPC transport by default. + client = CompanyServiceClient(credentials=credentials.AnonymousCredentials(),) + assert isinstance(client._transport, transports.CompanyServiceGrpcTransport,) + + +def test_company_service_base_transport_error(): + # Passing both a credentials object and credentials_file should raise an error + with pytest.raises(exceptions.DuplicateCredentialArgs): + transport = transports.CompanyServiceTransport( + credentials=credentials.AnonymousCredentials(), + credentials_file="credentials.json", + ) + + +def test_company_service_base_transport(): + # Instantiate the base transport. + with mock.patch( + "google.cloud.talent_v4beta1.services.company_service.transports.CompanyServiceTransport.__init__" + ) as Transport: + Transport.return_value = None + transport = transports.CompanyServiceTransport( + credentials=credentials.AnonymousCredentials(), + ) + + # Every method on the transport should just blindly + # raise NotImplementedError. + methods = ( + "create_company", + "get_company", + "update_company", + "delete_company", + "list_companies", + ) + for method in methods: + with pytest.raises(NotImplementedError): + getattr(transport, method)(request=object()) + + +def test_company_service_base_transport_with_credentials_file(): + # Instantiate the base transport with a credentials file + with mock.patch.object( + auth, "load_credentials_from_file" + ) as load_creds, mock.patch( + "google.cloud.talent_v4beta1.services.company_service.transports.CompanyServiceTransport._prep_wrapped_messages" + ) as Transport: + Transport.return_value = None + load_creds.return_value = (credentials.AnonymousCredentials(), None) + transport = transports.CompanyServiceTransport( + credentials_file="credentials.json", quota_project_id="octopus", + ) + load_creds.assert_called_once_with( + "credentials.json", + scopes=( + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/jobs", + ), + quota_project_id="octopus", + ) + + +def test_company_service_auth_adc(): + # If no credentials are provided, we should use ADC credentials. + with mock.patch.object(auth, "default") as adc: + adc.return_value = (credentials.AnonymousCredentials(), None) + CompanyServiceClient() + adc.assert_called_once_with( + scopes=( + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/jobs", + ), + quota_project_id=None, + ) + + +def test_company_service_transport_auth_adc(): + # If credentials and host are not provided, the transport class should use + # ADC credentials. + with mock.patch.object(auth, "default") as adc: + adc.return_value = (credentials.AnonymousCredentials(), None) + transports.CompanyServiceGrpcTransport( + host="squid.clam.whelk", quota_project_id="octopus" + ) + adc.assert_called_once_with( + scopes=( + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/jobs", + ), + quota_project_id="octopus", + ) + + +def test_company_service_host_no_port(): + client = CompanyServiceClient( + credentials=credentials.AnonymousCredentials(), + client_options=client_options.ClientOptions(api_endpoint="jobs.googleapis.com"), + ) + assert client._transport._host == "jobs.googleapis.com:443" + + +def test_company_service_host_with_port(): + client = CompanyServiceClient( + credentials=credentials.AnonymousCredentials(), + client_options=client_options.ClientOptions( + api_endpoint="jobs.googleapis.com:8000" + ), + ) + assert client._transport._host == "jobs.googleapis.com:8000" + + +def test_company_service_grpc_transport_channel(): + channel = grpc.insecure_channel("http://localhost/") + + # Check that if channel is provided, mtls endpoint and client_cert_source + # won't be used. + callback = mock.MagicMock() + transport = transports.CompanyServiceGrpcTransport( + host="squid.clam.whelk", + channel=channel, + api_mtls_endpoint="mtls.squid.clam.whelk", + client_cert_source=callback, + ) + assert transport.grpc_channel == channel + assert transport._host == "squid.clam.whelk:443" + assert not callback.called + + +def test_company_service_grpc_asyncio_transport_channel(): + channel = aio.insecure_channel("http://localhost/") + + # Check that if channel is provided, mtls endpoint and client_cert_source + # won't be used. + callback = mock.MagicMock() + transport = transports.CompanyServiceGrpcAsyncIOTransport( + host="squid.clam.whelk", + channel=channel, + api_mtls_endpoint="mtls.squid.clam.whelk", + client_cert_source=callback, + ) + assert transport.grpc_channel == channel + assert transport._host == "squid.clam.whelk:443" + assert not callback.called + + +@mock.patch("grpc.ssl_channel_credentials", autospec=True) +@mock.patch("google.api_core.grpc_helpers.create_channel", autospec=True) +def test_company_service_grpc_transport_channel_mtls_with_client_cert_source( + grpc_create_channel, grpc_ssl_channel_cred +): + # Check that if channel is None, but api_mtls_endpoint and client_cert_source + # are provided, then a mTLS channel will be created. + mock_cred = mock.Mock() + + mock_ssl_cred = mock.Mock() + grpc_ssl_channel_cred.return_value = mock_ssl_cred + + mock_grpc_channel = mock.Mock() + grpc_create_channel.return_value = mock_grpc_channel + + transport = transports.CompanyServiceGrpcTransport( + host="squid.clam.whelk", + credentials=mock_cred, + api_mtls_endpoint="mtls.squid.clam.whelk", + client_cert_source=client_cert_source_callback, + ) + grpc_ssl_channel_cred.assert_called_once_with( + certificate_chain=b"cert bytes", private_key=b"key bytes" + ) + grpc_create_channel.assert_called_once_with( + "mtls.squid.clam.whelk:443", + credentials=mock_cred, + credentials_file=None, + scopes=( + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/jobs", + ), + ssl_credentials=mock_ssl_cred, + quota_project_id=None, + ) + assert transport.grpc_channel == mock_grpc_channel + + +@mock.patch("grpc.ssl_channel_credentials", autospec=True) +@mock.patch("google.api_core.grpc_helpers_async.create_channel", autospec=True) +def test_company_service_grpc_asyncio_transport_channel_mtls_with_client_cert_source( + grpc_create_channel, grpc_ssl_channel_cred +): + # Check that if channel is None, but api_mtls_endpoint and client_cert_source + # are provided, then a mTLS channel will be created. + mock_cred = mock.Mock() + + mock_ssl_cred = mock.Mock() + grpc_ssl_channel_cred.return_value = mock_ssl_cred + + mock_grpc_channel = mock.Mock() + grpc_create_channel.return_value = mock_grpc_channel + + transport = transports.CompanyServiceGrpcAsyncIOTransport( + host="squid.clam.whelk", + credentials=mock_cred, + api_mtls_endpoint="mtls.squid.clam.whelk", + client_cert_source=client_cert_source_callback, + ) + grpc_ssl_channel_cred.assert_called_once_with( + certificate_chain=b"cert bytes", private_key=b"key bytes" + ) + grpc_create_channel.assert_called_once_with( + "mtls.squid.clam.whelk:443", + credentials=mock_cred, + credentials_file=None, + scopes=( + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/jobs", + ), + ssl_credentials=mock_ssl_cred, + quota_project_id=None, + ) + assert transport.grpc_channel == mock_grpc_channel + + +@pytest.mark.parametrize( + "api_mtls_endpoint", ["mtls.squid.clam.whelk", "mtls.squid.clam.whelk:443"] +) +@mock.patch("google.api_core.grpc_helpers.create_channel", autospec=True) +def test_company_service_grpc_transport_channel_mtls_with_adc( + grpc_create_channel, api_mtls_endpoint +): + # Check that if channel and client_cert_source are None, but api_mtls_endpoint + # is provided, then a mTLS channel will be created with SSL ADC. + mock_grpc_channel = mock.Mock() + grpc_create_channel.return_value = mock_grpc_channel + + # Mock google.auth.transport.grpc.SslCredentials class. + mock_ssl_cred = mock.Mock() + with mock.patch.multiple( + "google.auth.transport.grpc.SslCredentials", + __init__=mock.Mock(return_value=None), + ssl_credentials=mock.PropertyMock(return_value=mock_ssl_cred), + ): + mock_cred = mock.Mock() + transport = transports.CompanyServiceGrpcTransport( + host="squid.clam.whelk", + credentials=mock_cred, + api_mtls_endpoint=api_mtls_endpoint, + client_cert_source=None, + ) + grpc_create_channel.assert_called_once_with( + "mtls.squid.clam.whelk:443", + credentials=mock_cred, + credentials_file=None, + scopes=( + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/jobs", + ), + ssl_credentials=mock_ssl_cred, + quota_project_id=None, + ) + assert transport.grpc_channel == mock_grpc_channel + + +@pytest.mark.parametrize( + "api_mtls_endpoint", ["mtls.squid.clam.whelk", "mtls.squid.clam.whelk:443"] +) +@mock.patch("google.api_core.grpc_helpers_async.create_channel", autospec=True) +def test_company_service_grpc_asyncio_transport_channel_mtls_with_adc( + grpc_create_channel, api_mtls_endpoint +): + # Check that if channel and client_cert_source are None, but api_mtls_endpoint + # is provided, then a mTLS channel will be created with SSL ADC. + mock_grpc_channel = mock.Mock() + grpc_create_channel.return_value = mock_grpc_channel + + # Mock google.auth.transport.grpc.SslCredentials class. + mock_ssl_cred = mock.Mock() + with mock.patch.multiple( + "google.auth.transport.grpc.SslCredentials", + __init__=mock.Mock(return_value=None), + ssl_credentials=mock.PropertyMock(return_value=mock_ssl_cred), + ): + mock_cred = mock.Mock() + transport = transports.CompanyServiceGrpcAsyncIOTransport( + host="squid.clam.whelk", + credentials=mock_cred, + api_mtls_endpoint=api_mtls_endpoint, + client_cert_source=None, + ) + grpc_create_channel.assert_called_once_with( + "mtls.squid.clam.whelk:443", + credentials=mock_cred, + credentials_file=None, + scopes=( + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/jobs", + ), + ssl_credentials=mock_ssl_cred, + quota_project_id=None, + ) + assert transport.grpc_channel == mock_grpc_channel + + +def test_company_path(): + project = "squid" + tenant = "clam" + company = "whelk" + + expected = "projects/{project}/tenants/{tenant}/companies/{company}".format( + project=project, tenant=tenant, company=company, + ) + actual = CompanyServiceClient.company_path(project, tenant, company) + assert expected == actual + + +def test_parse_company_path(): + expected = { + "project": "octopus", + "tenant": "oyster", + "company": "nudibranch", + } + path = CompanyServiceClient.company_path(**expected) + + # Check that the path construction is reversible. + actual = CompanyServiceClient.parse_company_path(path) + assert expected == actual diff --git a/tests/unit/gapic/talent_v4beta1/test_completion.py b/tests/unit/gapic/talent_v4beta1/test_completion.py new file mode 100644 index 00000000..5e65aa06 --- /dev/null +++ b/tests/unit/gapic/talent_v4beta1/test_completion.py @@ -0,0 +1,806 @@ +# -*- 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. +# + +import os +import mock + +import grpc +from grpc.experimental import aio +import math +import pytest +from proto.marshal.rules.dates import DurationRule, TimestampRule + +from google import auth +from google.api_core import client_options +from google.api_core import exceptions +from google.api_core import grpc_helpers +from google.api_core import grpc_helpers_async +from google.auth import credentials +from google.auth.exceptions import MutualTLSChannelError +from google.cloud.talent_v4beta1.services.completion import CompletionAsyncClient +from google.cloud.talent_v4beta1.services.completion import CompletionClient +from google.cloud.talent_v4beta1.services.completion import transports +from google.cloud.talent_v4beta1.types import common +from google.cloud.talent_v4beta1.types import completion_service +from google.oauth2 import service_account + + +def client_cert_source_callback(): + return b"cert bytes", b"key bytes" + + +# If default endpoint is localhost, then default mtls endpoint will be the same. +# This method modifies the default endpoint so the client can produce a different +# mtls endpoint for endpoint testing purposes. +def modify_default_endpoint(client): + return ( + "foo.googleapis.com" + if ("localhost" in client.DEFAULT_ENDPOINT) + else client.DEFAULT_ENDPOINT + ) + + +def test__get_default_mtls_endpoint(): + api_endpoint = "example.googleapis.com" + api_mtls_endpoint = "example.mtls.googleapis.com" + sandbox_endpoint = "example.sandbox.googleapis.com" + sandbox_mtls_endpoint = "example.mtls.sandbox.googleapis.com" + non_googleapi = "api.example.com" + + assert CompletionClient._get_default_mtls_endpoint(None) is None + assert ( + CompletionClient._get_default_mtls_endpoint(api_endpoint) == api_mtls_endpoint + ) + assert ( + CompletionClient._get_default_mtls_endpoint(api_mtls_endpoint) + == api_mtls_endpoint + ) + assert ( + CompletionClient._get_default_mtls_endpoint(sandbox_endpoint) + == sandbox_mtls_endpoint + ) + assert ( + CompletionClient._get_default_mtls_endpoint(sandbox_mtls_endpoint) + == sandbox_mtls_endpoint + ) + assert CompletionClient._get_default_mtls_endpoint(non_googleapi) == non_googleapi + + +@pytest.mark.parametrize("client_class", [CompletionClient, CompletionAsyncClient]) +def test_completion_client_from_service_account_file(client_class): + creds = credentials.AnonymousCredentials() + with mock.patch.object( + service_account.Credentials, "from_service_account_file" + ) as factory: + factory.return_value = creds + client = client_class.from_service_account_file("dummy/file/path.json") + assert client._transport._credentials == creds + + client = client_class.from_service_account_json("dummy/file/path.json") + assert client._transport._credentials == creds + + assert client._transport._host == "jobs.googleapis.com:443" + + +def test_completion_client_get_transport_class(): + transport = CompletionClient.get_transport_class() + assert transport == transports.CompletionGrpcTransport + + transport = CompletionClient.get_transport_class("grpc") + assert transport == transports.CompletionGrpcTransport + + +@pytest.mark.parametrize( + "client_class,transport_class,transport_name", + [ + (CompletionClient, transports.CompletionGrpcTransport, "grpc"), + ( + CompletionAsyncClient, + transports.CompletionGrpcAsyncIOTransport, + "grpc_asyncio", + ), + ], +) +@mock.patch.object( + CompletionClient, "DEFAULT_ENDPOINT", modify_default_endpoint(CompletionClient) +) +@mock.patch.object( + CompletionAsyncClient, + "DEFAULT_ENDPOINT", + modify_default_endpoint(CompletionAsyncClient), +) +def test_completion_client_client_options( + client_class, transport_class, transport_name +): + # Check that if channel is provided we won't create a new one. + with mock.patch.object(CompletionClient, "get_transport_class") as gtc: + transport = transport_class(credentials=credentials.AnonymousCredentials()) + client = client_class(transport=transport) + gtc.assert_not_called() + + # Check that if channel is provided via str we will create a new one. + with mock.patch.object(CompletionClient, "get_transport_class") as gtc: + client = client_class(transport=transport_name) + gtc.assert_called() + + # Check the case api_endpoint is provided. + options = client_options.ClientOptions(api_endpoint="squid.clam.whelk") + with mock.patch.object(transport_class, "__init__") as patched: + patched.return_value = None + client = client_class(client_options=options) + patched.assert_called_once_with( + credentials=None, + credentials_file=None, + host="squid.clam.whelk", + scopes=None, + api_mtls_endpoint="squid.clam.whelk", + client_cert_source=None, + quota_project_id=None, + ) + + # Check the case api_endpoint is not provided and GOOGLE_API_USE_MTLS is + # "never". + with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS": "never"}): + with mock.patch.object(transport_class, "__init__") as patched: + patched.return_value = None + client = client_class() + patched.assert_called_once_with( + credentials=None, + credentials_file=None, + host=client.DEFAULT_ENDPOINT, + scopes=None, + api_mtls_endpoint=client.DEFAULT_ENDPOINT, + client_cert_source=None, + quota_project_id=None, + ) + + # Check the case api_endpoint is not provided and GOOGLE_API_USE_MTLS is + # "always". + with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS": "always"}): + with mock.patch.object(transport_class, "__init__") as patched: + patched.return_value = None + client = client_class() + patched.assert_called_once_with( + credentials=None, + credentials_file=None, + host=client.DEFAULT_MTLS_ENDPOINT, + scopes=None, + api_mtls_endpoint=client.DEFAULT_MTLS_ENDPOINT, + client_cert_source=None, + quota_project_id=None, + ) + + # Check the case api_endpoint is not provided, GOOGLE_API_USE_MTLS is + # "auto", and client_cert_source is provided. + with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS": "auto"}): + options = client_options.ClientOptions( + client_cert_source=client_cert_source_callback + ) + with mock.patch.object(transport_class, "__init__") as patched: + patched.return_value = None + client = client_class(client_options=options) + patched.assert_called_once_with( + credentials=None, + credentials_file=None, + host=client.DEFAULT_MTLS_ENDPOINT, + scopes=None, + api_mtls_endpoint=client.DEFAULT_MTLS_ENDPOINT, + client_cert_source=client_cert_source_callback, + quota_project_id=None, + ) + + # Check the case api_endpoint is not provided, GOOGLE_API_USE_MTLS is + # "auto", and default_client_cert_source is provided. + with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS": "auto"}): + with mock.patch.object(transport_class, "__init__") as patched: + with mock.patch( + "google.auth.transport.mtls.has_default_client_cert_source", + return_value=True, + ): + patched.return_value = None + client = client_class() + patched.assert_called_once_with( + credentials=None, + credentials_file=None, + host=client.DEFAULT_MTLS_ENDPOINT, + scopes=None, + api_mtls_endpoint=client.DEFAULT_MTLS_ENDPOINT, + client_cert_source=None, + quota_project_id=None, + ) + + # Check the case api_endpoint is not provided, GOOGLE_API_USE_MTLS is + # "auto", but client_cert_source and default_client_cert_source are None. + with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS": "auto"}): + with mock.patch.object(transport_class, "__init__") as patched: + with mock.patch( + "google.auth.transport.mtls.has_default_client_cert_source", + return_value=False, + ): + patched.return_value = None + client = client_class() + patched.assert_called_once_with( + credentials=None, + credentials_file=None, + host=client.DEFAULT_ENDPOINT, + scopes=None, + api_mtls_endpoint=client.DEFAULT_ENDPOINT, + client_cert_source=None, + quota_project_id=None, + ) + + # Check the case api_endpoint is not provided and GOOGLE_API_USE_MTLS has + # unsupported value. + with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS": "Unsupported"}): + with pytest.raises(MutualTLSChannelError): + client = client_class() + + # Check the case quota_project_id is provided + options = client_options.ClientOptions(quota_project_id="octopus") + with mock.patch.object(transport_class, "__init__") as patched: + patched.return_value = None + client = client_class(client_options=options) + patched.assert_called_once_with( + credentials=None, + credentials_file=None, + host=client.DEFAULT_ENDPOINT, + scopes=None, + api_mtls_endpoint=client.DEFAULT_ENDPOINT, + client_cert_source=None, + quota_project_id="octopus", + ) + + +@pytest.mark.parametrize( + "client_class,transport_class,transport_name", + [ + (CompletionClient, transports.CompletionGrpcTransport, "grpc"), + ( + CompletionAsyncClient, + transports.CompletionGrpcAsyncIOTransport, + "grpc_asyncio", + ), + ], +) +def test_completion_client_client_options_scopes( + client_class, transport_class, transport_name +): + # Check the case scopes are provided. + options = client_options.ClientOptions(scopes=["1", "2"],) + with mock.patch.object(transport_class, "__init__") as patched: + patched.return_value = None + client = client_class(client_options=options) + patched.assert_called_once_with( + credentials=None, + credentials_file=None, + host=client.DEFAULT_ENDPOINT, + scopes=["1", "2"], + api_mtls_endpoint=client.DEFAULT_ENDPOINT, + client_cert_source=None, + quota_project_id=None, + ) + + +@pytest.mark.parametrize( + "client_class,transport_class,transport_name", + [ + (CompletionClient, transports.CompletionGrpcTransport, "grpc"), + ( + CompletionAsyncClient, + transports.CompletionGrpcAsyncIOTransport, + "grpc_asyncio", + ), + ], +) +def test_completion_client_client_options_credentials_file( + client_class, transport_class, transport_name +): + # Check the case credentials file is provided. + options = client_options.ClientOptions(credentials_file="credentials.json") + with mock.patch.object(transport_class, "__init__") as patched: + patched.return_value = None + client = client_class(client_options=options) + patched.assert_called_once_with( + credentials=None, + credentials_file="credentials.json", + host=client.DEFAULT_ENDPOINT, + scopes=None, + api_mtls_endpoint=client.DEFAULT_ENDPOINT, + client_cert_source=None, + quota_project_id=None, + ) + + +def test_completion_client_client_options_from_dict(): + with mock.patch( + "google.cloud.talent_v4beta1.services.completion.transports.CompletionGrpcTransport.__init__" + ) as grpc_transport: + grpc_transport.return_value = None + client = CompletionClient(client_options={"api_endpoint": "squid.clam.whelk"}) + grpc_transport.assert_called_once_with( + credentials=None, + credentials_file=None, + host="squid.clam.whelk", + scopes=None, + api_mtls_endpoint="squid.clam.whelk", + client_cert_source=None, + quota_project_id=None, + ) + + +def test_complete_query( + transport: str = "grpc", request_type=completion_service.CompleteQueryRequest +): + client = CompletionClient( + credentials=credentials.AnonymousCredentials(), transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client._transport.complete_query), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = completion_service.CompleteQueryResponse() + + response = client.complete_query(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + + assert args[0] == completion_service.CompleteQueryRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, completion_service.CompleteQueryResponse) + + +def test_complete_query_from_dict(): + test_complete_query(request_type=dict) + + +@pytest.mark.asyncio +async def test_complete_query_async(transport: str = "grpc_asyncio"): + client = CompletionAsyncClient( + credentials=credentials.AnonymousCredentials(), transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = completion_service.CompleteQueryRequest() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client._client._transport.complete_query), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + completion_service.CompleteQueryResponse() + ) + + response = await client.complete_query(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + + assert args[0] == request + + # Establish that the response is the type that we expect. + assert isinstance(response, completion_service.CompleteQueryResponse) + + +def test_complete_query_field_headers(): + client = CompletionClient(credentials=credentials.AnonymousCredentials(),) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = completion_service.CompleteQueryRequest() + request.parent = "parent/value" + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client._transport.complete_query), "__call__") as call: + call.return_value = completion_service.CompleteQueryResponse() + + client.complete_query(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + + +@pytest.mark.asyncio +async def test_complete_query_field_headers_async(): + client = CompletionAsyncClient(credentials=credentials.AnonymousCredentials(),) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = completion_service.CompleteQueryRequest() + request.parent = "parent/value" + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client._client._transport.complete_query), "__call__" + ) as call: + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + completion_service.CompleteQueryResponse() + ) + + await client.complete_query(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + + +def test_credentials_transport_error(): + # It is an error to provide credentials and a transport instance. + transport = transports.CompletionGrpcTransport( + credentials=credentials.AnonymousCredentials(), + ) + with pytest.raises(ValueError): + client = CompletionClient( + credentials=credentials.AnonymousCredentials(), transport=transport, + ) + + # It is an error to provide a credentials file and a transport instance. + transport = transports.CompletionGrpcTransport( + credentials=credentials.AnonymousCredentials(), + ) + with pytest.raises(ValueError): + client = CompletionClient( + client_options={"credentials_file": "credentials.json"}, + transport=transport, + ) + + # It is an error to provide scopes and a transport instance. + transport = transports.CompletionGrpcTransport( + credentials=credentials.AnonymousCredentials(), + ) + with pytest.raises(ValueError): + client = CompletionClient( + client_options={"scopes": ["1", "2"]}, transport=transport, + ) + + +def test_transport_instance(): + # A client may be instantiated with a custom transport instance. + transport = transports.CompletionGrpcTransport( + credentials=credentials.AnonymousCredentials(), + ) + client = CompletionClient(transport=transport) + assert client._transport is transport + + +def test_transport_get_channel(): + # A client may be instantiated with a custom transport instance. + transport = transports.CompletionGrpcTransport( + credentials=credentials.AnonymousCredentials(), + ) + channel = transport.grpc_channel + assert channel + + transport = transports.CompletionGrpcAsyncIOTransport( + credentials=credentials.AnonymousCredentials(), + ) + channel = transport.grpc_channel + assert channel + + +def test_transport_grpc_default(): + # A client should use the gRPC transport by default. + client = CompletionClient(credentials=credentials.AnonymousCredentials(),) + assert isinstance(client._transport, transports.CompletionGrpcTransport,) + + +def test_completion_base_transport_error(): + # Passing both a credentials object and credentials_file should raise an error + with pytest.raises(exceptions.DuplicateCredentialArgs): + transport = transports.CompletionTransport( + credentials=credentials.AnonymousCredentials(), + credentials_file="credentials.json", + ) + + +def test_completion_base_transport(): + # Instantiate the base transport. + with mock.patch( + "google.cloud.talent_v4beta1.services.completion.transports.CompletionTransport.__init__" + ) as Transport: + Transport.return_value = None + transport = transports.CompletionTransport( + credentials=credentials.AnonymousCredentials(), + ) + + # Every method on the transport should just blindly + # raise NotImplementedError. + methods = ("complete_query",) + for method in methods: + with pytest.raises(NotImplementedError): + getattr(transport, method)(request=object()) + + +def test_completion_base_transport_with_credentials_file(): + # Instantiate the base transport with a credentials file + with mock.patch.object( + auth, "load_credentials_from_file" + ) as load_creds, mock.patch( + "google.cloud.talent_v4beta1.services.completion.transports.CompletionTransport._prep_wrapped_messages" + ) as Transport: + Transport.return_value = None + load_creds.return_value = (credentials.AnonymousCredentials(), None) + transport = transports.CompletionTransport( + credentials_file="credentials.json", quota_project_id="octopus", + ) + load_creds.assert_called_once_with( + "credentials.json", + scopes=( + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/jobs", + ), + quota_project_id="octopus", + ) + + +def test_completion_auth_adc(): + # If no credentials are provided, we should use ADC credentials. + with mock.patch.object(auth, "default") as adc: + adc.return_value = (credentials.AnonymousCredentials(), None) + CompletionClient() + adc.assert_called_once_with( + scopes=( + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/jobs", + ), + quota_project_id=None, + ) + + +def test_completion_transport_auth_adc(): + # If credentials and host are not provided, the transport class should use + # ADC credentials. + with mock.patch.object(auth, "default") as adc: + adc.return_value = (credentials.AnonymousCredentials(), None) + transports.CompletionGrpcTransport( + host="squid.clam.whelk", quota_project_id="octopus" + ) + adc.assert_called_once_with( + scopes=( + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/jobs", + ), + quota_project_id="octopus", + ) + + +def test_completion_host_no_port(): + client = CompletionClient( + credentials=credentials.AnonymousCredentials(), + client_options=client_options.ClientOptions(api_endpoint="jobs.googleapis.com"), + ) + assert client._transport._host == "jobs.googleapis.com:443" + + +def test_completion_host_with_port(): + client = CompletionClient( + credentials=credentials.AnonymousCredentials(), + client_options=client_options.ClientOptions( + api_endpoint="jobs.googleapis.com:8000" + ), + ) + assert client._transport._host == "jobs.googleapis.com:8000" + + +def test_completion_grpc_transport_channel(): + channel = grpc.insecure_channel("http://localhost/") + + # Check that if channel is provided, mtls endpoint and client_cert_source + # won't be used. + callback = mock.MagicMock() + transport = transports.CompletionGrpcTransport( + host="squid.clam.whelk", + channel=channel, + api_mtls_endpoint="mtls.squid.clam.whelk", + client_cert_source=callback, + ) + assert transport.grpc_channel == channel + assert transport._host == "squid.clam.whelk:443" + assert not callback.called + + +def test_completion_grpc_asyncio_transport_channel(): + channel = aio.insecure_channel("http://localhost/") + + # Check that if channel is provided, mtls endpoint and client_cert_source + # won't be used. + callback = mock.MagicMock() + transport = transports.CompletionGrpcAsyncIOTransport( + host="squid.clam.whelk", + channel=channel, + api_mtls_endpoint="mtls.squid.clam.whelk", + client_cert_source=callback, + ) + assert transport.grpc_channel == channel + assert transport._host == "squid.clam.whelk:443" + assert not callback.called + + +@mock.patch("grpc.ssl_channel_credentials", autospec=True) +@mock.patch("google.api_core.grpc_helpers.create_channel", autospec=True) +def test_completion_grpc_transport_channel_mtls_with_client_cert_source( + grpc_create_channel, grpc_ssl_channel_cred +): + # Check that if channel is None, but api_mtls_endpoint and client_cert_source + # are provided, then a mTLS channel will be created. + mock_cred = mock.Mock() + + mock_ssl_cred = mock.Mock() + grpc_ssl_channel_cred.return_value = mock_ssl_cred + + mock_grpc_channel = mock.Mock() + grpc_create_channel.return_value = mock_grpc_channel + + transport = transports.CompletionGrpcTransport( + host="squid.clam.whelk", + credentials=mock_cred, + api_mtls_endpoint="mtls.squid.clam.whelk", + client_cert_source=client_cert_source_callback, + ) + grpc_ssl_channel_cred.assert_called_once_with( + certificate_chain=b"cert bytes", private_key=b"key bytes" + ) + grpc_create_channel.assert_called_once_with( + "mtls.squid.clam.whelk:443", + credentials=mock_cred, + credentials_file=None, + scopes=( + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/jobs", + ), + ssl_credentials=mock_ssl_cred, + quota_project_id=None, + ) + assert transport.grpc_channel == mock_grpc_channel + + +@mock.patch("grpc.ssl_channel_credentials", autospec=True) +@mock.patch("google.api_core.grpc_helpers_async.create_channel", autospec=True) +def test_completion_grpc_asyncio_transport_channel_mtls_with_client_cert_source( + grpc_create_channel, grpc_ssl_channel_cred +): + # Check that if channel is None, but api_mtls_endpoint and client_cert_source + # are provided, then a mTLS channel will be created. + mock_cred = mock.Mock() + + mock_ssl_cred = mock.Mock() + grpc_ssl_channel_cred.return_value = mock_ssl_cred + + mock_grpc_channel = mock.Mock() + grpc_create_channel.return_value = mock_grpc_channel + + transport = transports.CompletionGrpcAsyncIOTransport( + host="squid.clam.whelk", + credentials=mock_cred, + api_mtls_endpoint="mtls.squid.clam.whelk", + client_cert_source=client_cert_source_callback, + ) + grpc_ssl_channel_cred.assert_called_once_with( + certificate_chain=b"cert bytes", private_key=b"key bytes" + ) + grpc_create_channel.assert_called_once_with( + "mtls.squid.clam.whelk:443", + credentials=mock_cred, + credentials_file=None, + scopes=( + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/jobs", + ), + ssl_credentials=mock_ssl_cred, + quota_project_id=None, + ) + assert transport.grpc_channel == mock_grpc_channel + + +@pytest.mark.parametrize( + "api_mtls_endpoint", ["mtls.squid.clam.whelk", "mtls.squid.clam.whelk:443"] +) +@mock.patch("google.api_core.grpc_helpers.create_channel", autospec=True) +def test_completion_grpc_transport_channel_mtls_with_adc( + grpc_create_channel, api_mtls_endpoint +): + # Check that if channel and client_cert_source are None, but api_mtls_endpoint + # is provided, then a mTLS channel will be created with SSL ADC. + mock_grpc_channel = mock.Mock() + grpc_create_channel.return_value = mock_grpc_channel + + # Mock google.auth.transport.grpc.SslCredentials class. + mock_ssl_cred = mock.Mock() + with mock.patch.multiple( + "google.auth.transport.grpc.SslCredentials", + __init__=mock.Mock(return_value=None), + ssl_credentials=mock.PropertyMock(return_value=mock_ssl_cred), + ): + mock_cred = mock.Mock() + transport = transports.CompletionGrpcTransport( + host="squid.clam.whelk", + credentials=mock_cred, + api_mtls_endpoint=api_mtls_endpoint, + client_cert_source=None, + ) + grpc_create_channel.assert_called_once_with( + "mtls.squid.clam.whelk:443", + credentials=mock_cred, + credentials_file=None, + scopes=( + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/jobs", + ), + ssl_credentials=mock_ssl_cred, + quota_project_id=None, + ) + assert transport.grpc_channel == mock_grpc_channel + + +@pytest.mark.parametrize( + "api_mtls_endpoint", ["mtls.squid.clam.whelk", "mtls.squid.clam.whelk:443"] +) +@mock.patch("google.api_core.grpc_helpers_async.create_channel", autospec=True) +def test_completion_grpc_asyncio_transport_channel_mtls_with_adc( + grpc_create_channel, api_mtls_endpoint +): + # Check that if channel and client_cert_source are None, but api_mtls_endpoint + # is provided, then a mTLS channel will be created with SSL ADC. + mock_grpc_channel = mock.Mock() + grpc_create_channel.return_value = mock_grpc_channel + + # Mock google.auth.transport.grpc.SslCredentials class. + mock_ssl_cred = mock.Mock() + with mock.patch.multiple( + "google.auth.transport.grpc.SslCredentials", + __init__=mock.Mock(return_value=None), + ssl_credentials=mock.PropertyMock(return_value=mock_ssl_cred), + ): + mock_cred = mock.Mock() + transport = transports.CompletionGrpcAsyncIOTransport( + host="squid.clam.whelk", + credentials=mock_cred, + api_mtls_endpoint=api_mtls_endpoint, + client_cert_source=None, + ) + grpc_create_channel.assert_called_once_with( + "mtls.squid.clam.whelk:443", + credentials=mock_cred, + credentials_file=None, + scopes=( + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/jobs", + ), + ssl_credentials=mock_ssl_cred, + quota_project_id=None, + ) + assert transport.grpc_channel == mock_grpc_channel diff --git a/tests/unit/gapic/talent_v4beta1/test_event_service.py b/tests/unit/gapic/talent_v4beta1/test_event_service.py new file mode 100644 index 00000000..fea20890 --- /dev/null +++ b/tests/unit/gapic/talent_v4beta1/test_event_service.py @@ -0,0 +1,913 @@ +# -*- 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. +# + +import os +import mock + +import grpc +from grpc.experimental import aio +import math +import pytest +from proto.marshal.rules.dates import DurationRule, TimestampRule + +from google import auth +from google.api_core import client_options +from google.api_core import exceptions +from google.api_core import grpc_helpers +from google.api_core import grpc_helpers_async +from google.auth import credentials +from google.auth.exceptions import MutualTLSChannelError +from google.cloud.talent_v4beta1.services.event_service import EventServiceAsyncClient +from google.cloud.talent_v4beta1.services.event_service import EventServiceClient +from google.cloud.talent_v4beta1.services.event_service import transports +from google.cloud.talent_v4beta1.types import event +from google.cloud.talent_v4beta1.types import event_service +from google.oauth2 import service_account +from google.protobuf import timestamp_pb2 as timestamp # type: ignore + + +def client_cert_source_callback(): + return b"cert bytes", b"key bytes" + + +# If default endpoint is localhost, then default mtls endpoint will be the same. +# This method modifies the default endpoint so the client can produce a different +# mtls endpoint for endpoint testing purposes. +def modify_default_endpoint(client): + return ( + "foo.googleapis.com" + if ("localhost" in client.DEFAULT_ENDPOINT) + else client.DEFAULT_ENDPOINT + ) + + +def test__get_default_mtls_endpoint(): + api_endpoint = "example.googleapis.com" + api_mtls_endpoint = "example.mtls.googleapis.com" + sandbox_endpoint = "example.sandbox.googleapis.com" + sandbox_mtls_endpoint = "example.mtls.sandbox.googleapis.com" + non_googleapi = "api.example.com" + + assert EventServiceClient._get_default_mtls_endpoint(None) is None + assert ( + EventServiceClient._get_default_mtls_endpoint(api_endpoint) == api_mtls_endpoint + ) + assert ( + EventServiceClient._get_default_mtls_endpoint(api_mtls_endpoint) + == api_mtls_endpoint + ) + assert ( + EventServiceClient._get_default_mtls_endpoint(sandbox_endpoint) + == sandbox_mtls_endpoint + ) + assert ( + EventServiceClient._get_default_mtls_endpoint(sandbox_mtls_endpoint) + == sandbox_mtls_endpoint + ) + assert EventServiceClient._get_default_mtls_endpoint(non_googleapi) == non_googleapi + + +@pytest.mark.parametrize("client_class", [EventServiceClient, EventServiceAsyncClient]) +def test_event_service_client_from_service_account_file(client_class): + creds = credentials.AnonymousCredentials() + with mock.patch.object( + service_account.Credentials, "from_service_account_file" + ) as factory: + factory.return_value = creds + client = client_class.from_service_account_file("dummy/file/path.json") + assert client._transport._credentials == creds + + client = client_class.from_service_account_json("dummy/file/path.json") + assert client._transport._credentials == creds + + assert client._transport._host == "jobs.googleapis.com:443" + + +def test_event_service_client_get_transport_class(): + transport = EventServiceClient.get_transport_class() + assert transport == transports.EventServiceGrpcTransport + + transport = EventServiceClient.get_transport_class("grpc") + assert transport == transports.EventServiceGrpcTransport + + +@pytest.mark.parametrize( + "client_class,transport_class,transport_name", + [ + (EventServiceClient, transports.EventServiceGrpcTransport, "grpc"), + ( + EventServiceAsyncClient, + transports.EventServiceGrpcAsyncIOTransport, + "grpc_asyncio", + ), + ], +) +@mock.patch.object( + EventServiceClient, "DEFAULT_ENDPOINT", modify_default_endpoint(EventServiceClient) +) +@mock.patch.object( + EventServiceAsyncClient, + "DEFAULT_ENDPOINT", + modify_default_endpoint(EventServiceAsyncClient), +) +def test_event_service_client_client_options( + client_class, transport_class, transport_name +): + # Check that if channel is provided we won't create a new one. + with mock.patch.object(EventServiceClient, "get_transport_class") as gtc: + transport = transport_class(credentials=credentials.AnonymousCredentials()) + client = client_class(transport=transport) + gtc.assert_not_called() + + # Check that if channel is provided via str we will create a new one. + with mock.patch.object(EventServiceClient, "get_transport_class") as gtc: + client = client_class(transport=transport_name) + gtc.assert_called() + + # Check the case api_endpoint is provided. + options = client_options.ClientOptions(api_endpoint="squid.clam.whelk") + with mock.patch.object(transport_class, "__init__") as patched: + patched.return_value = None + client = client_class(client_options=options) + patched.assert_called_once_with( + credentials=None, + credentials_file=None, + host="squid.clam.whelk", + scopes=None, + api_mtls_endpoint="squid.clam.whelk", + client_cert_source=None, + quota_project_id=None, + ) + + # Check the case api_endpoint is not provided and GOOGLE_API_USE_MTLS is + # "never". + with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS": "never"}): + with mock.patch.object(transport_class, "__init__") as patched: + patched.return_value = None + client = client_class() + patched.assert_called_once_with( + credentials=None, + credentials_file=None, + host=client.DEFAULT_ENDPOINT, + scopes=None, + api_mtls_endpoint=client.DEFAULT_ENDPOINT, + client_cert_source=None, + quota_project_id=None, + ) + + # Check the case api_endpoint is not provided and GOOGLE_API_USE_MTLS is + # "always". + with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS": "always"}): + with mock.patch.object(transport_class, "__init__") as patched: + patched.return_value = None + client = client_class() + patched.assert_called_once_with( + credentials=None, + credentials_file=None, + host=client.DEFAULT_MTLS_ENDPOINT, + scopes=None, + api_mtls_endpoint=client.DEFAULT_MTLS_ENDPOINT, + client_cert_source=None, + quota_project_id=None, + ) + + # Check the case api_endpoint is not provided, GOOGLE_API_USE_MTLS is + # "auto", and client_cert_source is provided. + with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS": "auto"}): + options = client_options.ClientOptions( + client_cert_source=client_cert_source_callback + ) + with mock.patch.object(transport_class, "__init__") as patched: + patched.return_value = None + client = client_class(client_options=options) + patched.assert_called_once_with( + credentials=None, + credentials_file=None, + host=client.DEFAULT_MTLS_ENDPOINT, + scopes=None, + api_mtls_endpoint=client.DEFAULT_MTLS_ENDPOINT, + client_cert_source=client_cert_source_callback, + quota_project_id=None, + ) + + # Check the case api_endpoint is not provided, GOOGLE_API_USE_MTLS is + # "auto", and default_client_cert_source is provided. + with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS": "auto"}): + with mock.patch.object(transport_class, "__init__") as patched: + with mock.patch( + "google.auth.transport.mtls.has_default_client_cert_source", + return_value=True, + ): + patched.return_value = None + client = client_class() + patched.assert_called_once_with( + credentials=None, + credentials_file=None, + host=client.DEFAULT_MTLS_ENDPOINT, + scopes=None, + api_mtls_endpoint=client.DEFAULT_MTLS_ENDPOINT, + client_cert_source=None, + quota_project_id=None, + ) + + # Check the case api_endpoint is not provided, GOOGLE_API_USE_MTLS is + # "auto", but client_cert_source and default_client_cert_source are None. + with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS": "auto"}): + with mock.patch.object(transport_class, "__init__") as patched: + with mock.patch( + "google.auth.transport.mtls.has_default_client_cert_source", + return_value=False, + ): + patched.return_value = None + client = client_class() + patched.assert_called_once_with( + credentials=None, + credentials_file=None, + host=client.DEFAULT_ENDPOINT, + scopes=None, + api_mtls_endpoint=client.DEFAULT_ENDPOINT, + client_cert_source=None, + quota_project_id=None, + ) + + # Check the case api_endpoint is not provided and GOOGLE_API_USE_MTLS has + # unsupported value. + with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS": "Unsupported"}): + with pytest.raises(MutualTLSChannelError): + client = client_class() + + # Check the case quota_project_id is provided + options = client_options.ClientOptions(quota_project_id="octopus") + with mock.patch.object(transport_class, "__init__") as patched: + patched.return_value = None + client = client_class(client_options=options) + patched.assert_called_once_with( + credentials=None, + credentials_file=None, + host=client.DEFAULT_ENDPOINT, + scopes=None, + api_mtls_endpoint=client.DEFAULT_ENDPOINT, + client_cert_source=None, + quota_project_id="octopus", + ) + + +@pytest.mark.parametrize( + "client_class,transport_class,transport_name", + [ + (EventServiceClient, transports.EventServiceGrpcTransport, "grpc"), + ( + EventServiceAsyncClient, + transports.EventServiceGrpcAsyncIOTransport, + "grpc_asyncio", + ), + ], +) +def test_event_service_client_client_options_scopes( + client_class, transport_class, transport_name +): + # Check the case scopes are provided. + options = client_options.ClientOptions(scopes=["1", "2"],) + with mock.patch.object(transport_class, "__init__") as patched: + patched.return_value = None + client = client_class(client_options=options) + patched.assert_called_once_with( + credentials=None, + credentials_file=None, + host=client.DEFAULT_ENDPOINT, + scopes=["1", "2"], + api_mtls_endpoint=client.DEFAULT_ENDPOINT, + client_cert_source=None, + quota_project_id=None, + ) + + +@pytest.mark.parametrize( + "client_class,transport_class,transport_name", + [ + (EventServiceClient, transports.EventServiceGrpcTransport, "grpc"), + ( + EventServiceAsyncClient, + transports.EventServiceGrpcAsyncIOTransport, + "grpc_asyncio", + ), + ], +) +def test_event_service_client_client_options_credentials_file( + client_class, transport_class, transport_name +): + # Check the case credentials file is provided. + options = client_options.ClientOptions(credentials_file="credentials.json") + with mock.patch.object(transport_class, "__init__") as patched: + patched.return_value = None + client = client_class(client_options=options) + patched.assert_called_once_with( + credentials=None, + credentials_file="credentials.json", + host=client.DEFAULT_ENDPOINT, + scopes=None, + api_mtls_endpoint=client.DEFAULT_ENDPOINT, + client_cert_source=None, + quota_project_id=None, + ) + + +def test_event_service_client_client_options_from_dict(): + with mock.patch( + "google.cloud.talent_v4beta1.services.event_service.transports.EventServiceGrpcTransport.__init__" + ) as grpc_transport: + grpc_transport.return_value = None + client = EventServiceClient(client_options={"api_endpoint": "squid.clam.whelk"}) + grpc_transport.assert_called_once_with( + credentials=None, + credentials_file=None, + host="squid.clam.whelk", + scopes=None, + api_mtls_endpoint="squid.clam.whelk", + client_cert_source=None, + quota_project_id=None, + ) + + +def test_create_client_event( + transport: str = "grpc", request_type=event_service.CreateClientEventRequest +): + client = EventServiceClient( + credentials=credentials.AnonymousCredentials(), transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client._transport.create_client_event), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = event.ClientEvent( + request_id="request_id_value", + event_id="event_id_value", + event_notes="event_notes_value", + job_event=event.JobEvent(type=event.JobEvent.JobEventType.IMPRESSION), + ) + + response = client.create_client_event(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + + assert args[0] == event_service.CreateClientEventRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, event.ClientEvent) + + assert response.request_id == "request_id_value" + + assert response.event_id == "event_id_value" + + assert response.event_notes == "event_notes_value" + + +def test_create_client_event_from_dict(): + test_create_client_event(request_type=dict) + + +@pytest.mark.asyncio +async def test_create_client_event_async(transport: str = "grpc_asyncio"): + client = EventServiceAsyncClient( + credentials=credentials.AnonymousCredentials(), transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = event_service.CreateClientEventRequest() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client._client._transport.create_client_event), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + event.ClientEvent( + request_id="request_id_value", + event_id="event_id_value", + event_notes="event_notes_value", + ) + ) + + response = await client.create_client_event(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + + assert args[0] == request + + # Establish that the response is the type that we expect. + assert isinstance(response, event.ClientEvent) + + assert response.request_id == "request_id_value" + + assert response.event_id == "event_id_value" + + assert response.event_notes == "event_notes_value" + + +def test_create_client_event_field_headers(): + client = EventServiceClient(credentials=credentials.AnonymousCredentials(),) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = event_service.CreateClientEventRequest() + request.parent = "parent/value" + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client._transport.create_client_event), "__call__" + ) as call: + call.return_value = event.ClientEvent() + + client.create_client_event(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + + +@pytest.mark.asyncio +async def test_create_client_event_field_headers_async(): + client = EventServiceAsyncClient(credentials=credentials.AnonymousCredentials(),) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = event_service.CreateClientEventRequest() + request.parent = "parent/value" + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client._client._transport.create_client_event), "__call__" + ) as call: + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(event.ClientEvent()) + + await client.create_client_event(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + + +def test_create_client_event_flattened(): + client = EventServiceClient(credentials=credentials.AnonymousCredentials(),) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client._transport.create_client_event), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = event.ClientEvent() + + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + client.create_client_event( + parent="parent_value", + client_event=event.ClientEvent(request_id="request_id_value"), + ) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + + assert args[0].parent == "parent_value" + + assert args[0].client_event == event.ClientEvent(request_id="request_id_value") + + +def test_create_client_event_flattened_error(): + client = EventServiceClient(credentials=credentials.AnonymousCredentials(),) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + client.create_client_event( + event_service.CreateClientEventRequest(), + parent="parent_value", + client_event=event.ClientEvent(request_id="request_id_value"), + ) + + +@pytest.mark.asyncio +async def test_create_client_event_flattened_async(): + client = EventServiceAsyncClient(credentials=credentials.AnonymousCredentials(),) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client._client._transport.create_client_event), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = event.ClientEvent() + + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(event.ClientEvent()) + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + response = await client.create_client_event( + parent="parent_value", + client_event=event.ClientEvent(request_id="request_id_value"), + ) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + + assert args[0].parent == "parent_value" + + assert args[0].client_event == event.ClientEvent(request_id="request_id_value") + + +@pytest.mark.asyncio +async def test_create_client_event_flattened_error_async(): + client = EventServiceAsyncClient(credentials=credentials.AnonymousCredentials(),) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + await client.create_client_event( + event_service.CreateClientEventRequest(), + parent="parent_value", + client_event=event.ClientEvent(request_id="request_id_value"), + ) + + +def test_credentials_transport_error(): + # It is an error to provide credentials and a transport instance. + transport = transports.EventServiceGrpcTransport( + credentials=credentials.AnonymousCredentials(), + ) + with pytest.raises(ValueError): + client = EventServiceClient( + credentials=credentials.AnonymousCredentials(), transport=transport, + ) + + # It is an error to provide a credentials file and a transport instance. + transport = transports.EventServiceGrpcTransport( + credentials=credentials.AnonymousCredentials(), + ) + with pytest.raises(ValueError): + client = EventServiceClient( + client_options={"credentials_file": "credentials.json"}, + transport=transport, + ) + + # It is an error to provide scopes and a transport instance. + transport = transports.EventServiceGrpcTransport( + credentials=credentials.AnonymousCredentials(), + ) + with pytest.raises(ValueError): + client = EventServiceClient( + client_options={"scopes": ["1", "2"]}, transport=transport, + ) + + +def test_transport_instance(): + # A client may be instantiated with a custom transport instance. + transport = transports.EventServiceGrpcTransport( + credentials=credentials.AnonymousCredentials(), + ) + client = EventServiceClient(transport=transport) + assert client._transport is transport + + +def test_transport_get_channel(): + # A client may be instantiated with a custom transport instance. + transport = transports.EventServiceGrpcTransport( + credentials=credentials.AnonymousCredentials(), + ) + channel = transport.grpc_channel + assert channel + + transport = transports.EventServiceGrpcAsyncIOTransport( + credentials=credentials.AnonymousCredentials(), + ) + channel = transport.grpc_channel + assert channel + + +def test_transport_grpc_default(): + # A client should use the gRPC transport by default. + client = EventServiceClient(credentials=credentials.AnonymousCredentials(),) + assert isinstance(client._transport, transports.EventServiceGrpcTransport,) + + +def test_event_service_base_transport_error(): + # Passing both a credentials object and credentials_file should raise an error + with pytest.raises(exceptions.DuplicateCredentialArgs): + transport = transports.EventServiceTransport( + credentials=credentials.AnonymousCredentials(), + credentials_file="credentials.json", + ) + + +def test_event_service_base_transport(): + # Instantiate the base transport. + with mock.patch( + "google.cloud.talent_v4beta1.services.event_service.transports.EventServiceTransport.__init__" + ) as Transport: + Transport.return_value = None + transport = transports.EventServiceTransport( + credentials=credentials.AnonymousCredentials(), + ) + + # Every method on the transport should just blindly + # raise NotImplementedError. + methods = ("create_client_event",) + for method in methods: + with pytest.raises(NotImplementedError): + getattr(transport, method)(request=object()) + + +def test_event_service_base_transport_with_credentials_file(): + # Instantiate the base transport with a credentials file + with mock.patch.object( + auth, "load_credentials_from_file" + ) as load_creds, mock.patch( + "google.cloud.talent_v4beta1.services.event_service.transports.EventServiceTransport._prep_wrapped_messages" + ) as Transport: + Transport.return_value = None + load_creds.return_value = (credentials.AnonymousCredentials(), None) + transport = transports.EventServiceTransport( + credentials_file="credentials.json", quota_project_id="octopus", + ) + load_creds.assert_called_once_with( + "credentials.json", + scopes=( + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/jobs", + ), + quota_project_id="octopus", + ) + + +def test_event_service_auth_adc(): + # If no credentials are provided, we should use ADC credentials. + with mock.patch.object(auth, "default") as adc: + adc.return_value = (credentials.AnonymousCredentials(), None) + EventServiceClient() + adc.assert_called_once_with( + scopes=( + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/jobs", + ), + quota_project_id=None, + ) + + +def test_event_service_transport_auth_adc(): + # If credentials and host are not provided, the transport class should use + # ADC credentials. + with mock.patch.object(auth, "default") as adc: + adc.return_value = (credentials.AnonymousCredentials(), None) + transports.EventServiceGrpcTransport( + host="squid.clam.whelk", quota_project_id="octopus" + ) + adc.assert_called_once_with( + scopes=( + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/jobs", + ), + quota_project_id="octopus", + ) + + +def test_event_service_host_no_port(): + client = EventServiceClient( + credentials=credentials.AnonymousCredentials(), + client_options=client_options.ClientOptions(api_endpoint="jobs.googleapis.com"), + ) + assert client._transport._host == "jobs.googleapis.com:443" + + +def test_event_service_host_with_port(): + client = EventServiceClient( + credentials=credentials.AnonymousCredentials(), + client_options=client_options.ClientOptions( + api_endpoint="jobs.googleapis.com:8000" + ), + ) + assert client._transport._host == "jobs.googleapis.com:8000" + + +def test_event_service_grpc_transport_channel(): + channel = grpc.insecure_channel("http://localhost/") + + # Check that if channel is provided, mtls endpoint and client_cert_source + # won't be used. + callback = mock.MagicMock() + transport = transports.EventServiceGrpcTransport( + host="squid.clam.whelk", + channel=channel, + api_mtls_endpoint="mtls.squid.clam.whelk", + client_cert_source=callback, + ) + assert transport.grpc_channel == channel + assert transport._host == "squid.clam.whelk:443" + assert not callback.called + + +def test_event_service_grpc_asyncio_transport_channel(): + channel = aio.insecure_channel("http://localhost/") + + # Check that if channel is provided, mtls endpoint and client_cert_source + # won't be used. + callback = mock.MagicMock() + transport = transports.EventServiceGrpcAsyncIOTransport( + host="squid.clam.whelk", + channel=channel, + api_mtls_endpoint="mtls.squid.clam.whelk", + client_cert_source=callback, + ) + assert transport.grpc_channel == channel + assert transport._host == "squid.clam.whelk:443" + assert not callback.called + + +@mock.patch("grpc.ssl_channel_credentials", autospec=True) +@mock.patch("google.api_core.grpc_helpers.create_channel", autospec=True) +def test_event_service_grpc_transport_channel_mtls_with_client_cert_source( + grpc_create_channel, grpc_ssl_channel_cred +): + # Check that if channel is None, but api_mtls_endpoint and client_cert_source + # are provided, then a mTLS channel will be created. + mock_cred = mock.Mock() + + mock_ssl_cred = mock.Mock() + grpc_ssl_channel_cred.return_value = mock_ssl_cred + + mock_grpc_channel = mock.Mock() + grpc_create_channel.return_value = mock_grpc_channel + + transport = transports.EventServiceGrpcTransport( + host="squid.clam.whelk", + credentials=mock_cred, + api_mtls_endpoint="mtls.squid.clam.whelk", + client_cert_source=client_cert_source_callback, + ) + grpc_ssl_channel_cred.assert_called_once_with( + certificate_chain=b"cert bytes", private_key=b"key bytes" + ) + grpc_create_channel.assert_called_once_with( + "mtls.squid.clam.whelk:443", + credentials=mock_cred, + credentials_file=None, + scopes=( + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/jobs", + ), + ssl_credentials=mock_ssl_cred, + quota_project_id=None, + ) + assert transport.grpc_channel == mock_grpc_channel + + +@mock.patch("grpc.ssl_channel_credentials", autospec=True) +@mock.patch("google.api_core.grpc_helpers_async.create_channel", autospec=True) +def test_event_service_grpc_asyncio_transport_channel_mtls_with_client_cert_source( + grpc_create_channel, grpc_ssl_channel_cred +): + # Check that if channel is None, but api_mtls_endpoint and client_cert_source + # are provided, then a mTLS channel will be created. + mock_cred = mock.Mock() + + mock_ssl_cred = mock.Mock() + grpc_ssl_channel_cred.return_value = mock_ssl_cred + + mock_grpc_channel = mock.Mock() + grpc_create_channel.return_value = mock_grpc_channel + + transport = transports.EventServiceGrpcAsyncIOTransport( + host="squid.clam.whelk", + credentials=mock_cred, + api_mtls_endpoint="mtls.squid.clam.whelk", + client_cert_source=client_cert_source_callback, + ) + grpc_ssl_channel_cred.assert_called_once_with( + certificate_chain=b"cert bytes", private_key=b"key bytes" + ) + grpc_create_channel.assert_called_once_with( + "mtls.squid.clam.whelk:443", + credentials=mock_cred, + credentials_file=None, + scopes=( + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/jobs", + ), + ssl_credentials=mock_ssl_cred, + quota_project_id=None, + ) + assert transport.grpc_channel == mock_grpc_channel + + +@pytest.mark.parametrize( + "api_mtls_endpoint", ["mtls.squid.clam.whelk", "mtls.squid.clam.whelk:443"] +) +@mock.patch("google.api_core.grpc_helpers.create_channel", autospec=True) +def test_event_service_grpc_transport_channel_mtls_with_adc( + grpc_create_channel, api_mtls_endpoint +): + # Check that if channel and client_cert_source are None, but api_mtls_endpoint + # is provided, then a mTLS channel will be created with SSL ADC. + mock_grpc_channel = mock.Mock() + grpc_create_channel.return_value = mock_grpc_channel + + # Mock google.auth.transport.grpc.SslCredentials class. + mock_ssl_cred = mock.Mock() + with mock.patch.multiple( + "google.auth.transport.grpc.SslCredentials", + __init__=mock.Mock(return_value=None), + ssl_credentials=mock.PropertyMock(return_value=mock_ssl_cred), + ): + mock_cred = mock.Mock() + transport = transports.EventServiceGrpcTransport( + host="squid.clam.whelk", + credentials=mock_cred, + api_mtls_endpoint=api_mtls_endpoint, + client_cert_source=None, + ) + grpc_create_channel.assert_called_once_with( + "mtls.squid.clam.whelk:443", + credentials=mock_cred, + credentials_file=None, + scopes=( + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/jobs", + ), + ssl_credentials=mock_ssl_cred, + quota_project_id=None, + ) + assert transport.grpc_channel == mock_grpc_channel + + +@pytest.mark.parametrize( + "api_mtls_endpoint", ["mtls.squid.clam.whelk", "mtls.squid.clam.whelk:443"] +) +@mock.patch("google.api_core.grpc_helpers_async.create_channel", autospec=True) +def test_event_service_grpc_asyncio_transport_channel_mtls_with_adc( + grpc_create_channel, api_mtls_endpoint +): + # Check that if channel and client_cert_source are None, but api_mtls_endpoint + # is provided, then a mTLS channel will be created with SSL ADC. + mock_grpc_channel = mock.Mock() + grpc_create_channel.return_value = mock_grpc_channel + + # Mock google.auth.transport.grpc.SslCredentials class. + mock_ssl_cred = mock.Mock() + with mock.patch.multiple( + "google.auth.transport.grpc.SslCredentials", + __init__=mock.Mock(return_value=None), + ssl_credentials=mock.PropertyMock(return_value=mock_ssl_cred), + ): + mock_cred = mock.Mock() + transport = transports.EventServiceGrpcAsyncIOTransport( + host="squid.clam.whelk", + credentials=mock_cred, + api_mtls_endpoint=api_mtls_endpoint, + client_cert_source=None, + ) + grpc_create_channel.assert_called_once_with( + "mtls.squid.clam.whelk:443", + credentials=mock_cred, + credentials_file=None, + scopes=( + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/jobs", + ), + ssl_credentials=mock_ssl_cred, + quota_project_id=None, + ) + assert transport.grpc_channel == mock_grpc_channel diff --git a/tests/unit/gapic/talent_v4beta1/test_job_service.py b/tests/unit/gapic/talent_v4beta1/test_job_service.py new file mode 100644 index 00000000..b4446d66 --- /dev/null +++ b/tests/unit/gapic/talent_v4beta1/test_job_service.py @@ -0,0 +1,3363 @@ +# -*- 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. +# + +import os +import mock + +import grpc +from grpc.experimental import aio +import math +import pytest +from proto.marshal.rules.dates import DurationRule, TimestampRule + +from google import auth +from google.api_core import client_options +from google.api_core import exceptions +from google.api_core import future +from google.api_core import gapic_v1 +from google.api_core import grpc_helpers +from google.api_core import grpc_helpers_async +from google.api_core import operation_async +from google.api_core import operations_v1 +from google.auth import credentials +from google.auth.exceptions import MutualTLSChannelError +from google.cloud.talent_v4beta1.services.job_service import JobServiceAsyncClient +from google.cloud.talent_v4beta1.services.job_service import JobServiceClient +from google.cloud.talent_v4beta1.services.job_service import pagers +from google.cloud.talent_v4beta1.services.job_service import transports +from google.cloud.talent_v4beta1.types import common +from google.cloud.talent_v4beta1.types import filters +from google.cloud.talent_v4beta1.types import histogram +from google.cloud.talent_v4beta1.types import job +from google.cloud.talent_v4beta1.types import job as gct_job +from google.cloud.talent_v4beta1.types import job_service +from google.longrunning import operations_pb2 +from google.oauth2 import service_account +from google.protobuf import duration_pb2 as duration # type: ignore +from google.protobuf import field_mask_pb2 as field_mask # type: ignore +from google.protobuf import timestamp_pb2 as timestamp # type: ignore +from google.protobuf import wrappers_pb2 as wrappers # type: ignore +from google.type import latlng_pb2 as latlng # type: ignore +from google.type import money_pb2 as money # type: ignore +from google.type import postal_address_pb2 as gt_postal_address # type: ignore +from google.type import timeofday_pb2 as timeofday # type: ignore + + +def client_cert_source_callback(): + return b"cert bytes", b"key bytes" + + +# If default endpoint is localhost, then default mtls endpoint will be the same. +# This method modifies the default endpoint so the client can produce a different +# mtls endpoint for endpoint testing purposes. +def modify_default_endpoint(client): + return ( + "foo.googleapis.com" + if ("localhost" in client.DEFAULT_ENDPOINT) + else client.DEFAULT_ENDPOINT + ) + + +def test__get_default_mtls_endpoint(): + api_endpoint = "example.googleapis.com" + api_mtls_endpoint = "example.mtls.googleapis.com" + sandbox_endpoint = "example.sandbox.googleapis.com" + sandbox_mtls_endpoint = "example.mtls.sandbox.googleapis.com" + non_googleapi = "api.example.com" + + assert JobServiceClient._get_default_mtls_endpoint(None) is None + assert ( + JobServiceClient._get_default_mtls_endpoint(api_endpoint) == api_mtls_endpoint + ) + assert ( + JobServiceClient._get_default_mtls_endpoint(api_mtls_endpoint) + == api_mtls_endpoint + ) + assert ( + JobServiceClient._get_default_mtls_endpoint(sandbox_endpoint) + == sandbox_mtls_endpoint + ) + assert ( + JobServiceClient._get_default_mtls_endpoint(sandbox_mtls_endpoint) + == sandbox_mtls_endpoint + ) + assert JobServiceClient._get_default_mtls_endpoint(non_googleapi) == non_googleapi + + +@pytest.mark.parametrize("client_class", [JobServiceClient, JobServiceAsyncClient]) +def test_job_service_client_from_service_account_file(client_class): + creds = credentials.AnonymousCredentials() + with mock.patch.object( + service_account.Credentials, "from_service_account_file" + ) as factory: + factory.return_value = creds + client = client_class.from_service_account_file("dummy/file/path.json") + assert client._transport._credentials == creds + + client = client_class.from_service_account_json("dummy/file/path.json") + assert client._transport._credentials == creds + + assert client._transport._host == "jobs.googleapis.com:443" + + +def test_job_service_client_get_transport_class(): + transport = JobServiceClient.get_transport_class() + assert transport == transports.JobServiceGrpcTransport + + transport = JobServiceClient.get_transport_class("grpc") + assert transport == transports.JobServiceGrpcTransport + + +@pytest.mark.parametrize( + "client_class,transport_class,transport_name", + [ + (JobServiceClient, transports.JobServiceGrpcTransport, "grpc"), + ( + JobServiceAsyncClient, + transports.JobServiceGrpcAsyncIOTransport, + "grpc_asyncio", + ), + ], +) +@mock.patch.object( + JobServiceClient, "DEFAULT_ENDPOINT", modify_default_endpoint(JobServiceClient) +) +@mock.patch.object( + JobServiceAsyncClient, + "DEFAULT_ENDPOINT", + modify_default_endpoint(JobServiceAsyncClient), +) +def test_job_service_client_client_options( + client_class, transport_class, transport_name +): + # Check that if channel is provided we won't create a new one. + with mock.patch.object(JobServiceClient, "get_transport_class") as gtc: + transport = transport_class(credentials=credentials.AnonymousCredentials()) + client = client_class(transport=transport) + gtc.assert_not_called() + + # Check that if channel is provided via str we will create a new one. + with mock.patch.object(JobServiceClient, "get_transport_class") as gtc: + client = client_class(transport=transport_name) + gtc.assert_called() + + # Check the case api_endpoint is provided. + options = client_options.ClientOptions(api_endpoint="squid.clam.whelk") + with mock.patch.object(transport_class, "__init__") as patched: + patched.return_value = None + client = client_class(client_options=options) + patched.assert_called_once_with( + credentials=None, + credentials_file=None, + host="squid.clam.whelk", + scopes=None, + api_mtls_endpoint="squid.clam.whelk", + client_cert_source=None, + quota_project_id=None, + ) + + # Check the case api_endpoint is not provided and GOOGLE_API_USE_MTLS is + # "never". + with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS": "never"}): + with mock.patch.object(transport_class, "__init__") as patched: + patched.return_value = None + client = client_class() + patched.assert_called_once_with( + credentials=None, + credentials_file=None, + host=client.DEFAULT_ENDPOINT, + scopes=None, + api_mtls_endpoint=client.DEFAULT_ENDPOINT, + client_cert_source=None, + quota_project_id=None, + ) + + # Check the case api_endpoint is not provided and GOOGLE_API_USE_MTLS is + # "always". + with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS": "always"}): + with mock.patch.object(transport_class, "__init__") as patched: + patched.return_value = None + client = client_class() + patched.assert_called_once_with( + credentials=None, + credentials_file=None, + host=client.DEFAULT_MTLS_ENDPOINT, + scopes=None, + api_mtls_endpoint=client.DEFAULT_MTLS_ENDPOINT, + client_cert_source=None, + quota_project_id=None, + ) + + # Check the case api_endpoint is not provided, GOOGLE_API_USE_MTLS is + # "auto", and client_cert_source is provided. + with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS": "auto"}): + options = client_options.ClientOptions( + client_cert_source=client_cert_source_callback + ) + with mock.patch.object(transport_class, "__init__") as patched: + patched.return_value = None + client = client_class(client_options=options) + patched.assert_called_once_with( + credentials=None, + credentials_file=None, + host=client.DEFAULT_MTLS_ENDPOINT, + scopes=None, + api_mtls_endpoint=client.DEFAULT_MTLS_ENDPOINT, + client_cert_source=client_cert_source_callback, + quota_project_id=None, + ) + + # Check the case api_endpoint is not provided, GOOGLE_API_USE_MTLS is + # "auto", and default_client_cert_source is provided. + with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS": "auto"}): + with mock.patch.object(transport_class, "__init__") as patched: + with mock.patch( + "google.auth.transport.mtls.has_default_client_cert_source", + return_value=True, + ): + patched.return_value = None + client = client_class() + patched.assert_called_once_with( + credentials=None, + credentials_file=None, + host=client.DEFAULT_MTLS_ENDPOINT, + scopes=None, + api_mtls_endpoint=client.DEFAULT_MTLS_ENDPOINT, + client_cert_source=None, + quota_project_id=None, + ) + + # Check the case api_endpoint is not provided, GOOGLE_API_USE_MTLS is + # "auto", but client_cert_source and default_client_cert_source are None. + with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS": "auto"}): + with mock.patch.object(transport_class, "__init__") as patched: + with mock.patch( + "google.auth.transport.mtls.has_default_client_cert_source", + return_value=False, + ): + patched.return_value = None + client = client_class() + patched.assert_called_once_with( + credentials=None, + credentials_file=None, + host=client.DEFAULT_ENDPOINT, + scopes=None, + api_mtls_endpoint=client.DEFAULT_ENDPOINT, + client_cert_source=None, + quota_project_id=None, + ) + + # Check the case api_endpoint is not provided and GOOGLE_API_USE_MTLS has + # unsupported value. + with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS": "Unsupported"}): + with pytest.raises(MutualTLSChannelError): + client = client_class() + + # Check the case quota_project_id is provided + options = client_options.ClientOptions(quota_project_id="octopus") + with mock.patch.object(transport_class, "__init__") as patched: + patched.return_value = None + client = client_class(client_options=options) + patched.assert_called_once_with( + credentials=None, + credentials_file=None, + host=client.DEFAULT_ENDPOINT, + scopes=None, + api_mtls_endpoint=client.DEFAULT_ENDPOINT, + client_cert_source=None, + quota_project_id="octopus", + ) + + +@pytest.mark.parametrize( + "client_class,transport_class,transport_name", + [ + (JobServiceClient, transports.JobServiceGrpcTransport, "grpc"), + ( + JobServiceAsyncClient, + transports.JobServiceGrpcAsyncIOTransport, + "grpc_asyncio", + ), + ], +) +def test_job_service_client_client_options_scopes( + client_class, transport_class, transport_name +): + # Check the case scopes are provided. + options = client_options.ClientOptions(scopes=["1", "2"],) + with mock.patch.object(transport_class, "__init__") as patched: + patched.return_value = None + client = client_class(client_options=options) + patched.assert_called_once_with( + credentials=None, + credentials_file=None, + host=client.DEFAULT_ENDPOINT, + scopes=["1", "2"], + api_mtls_endpoint=client.DEFAULT_ENDPOINT, + client_cert_source=None, + quota_project_id=None, + ) + + +@pytest.mark.parametrize( + "client_class,transport_class,transport_name", + [ + (JobServiceClient, transports.JobServiceGrpcTransport, "grpc"), + ( + JobServiceAsyncClient, + transports.JobServiceGrpcAsyncIOTransport, + "grpc_asyncio", + ), + ], +) +def test_job_service_client_client_options_credentials_file( + client_class, transport_class, transport_name +): + # Check the case credentials file is provided. + options = client_options.ClientOptions(credentials_file="credentials.json") + with mock.patch.object(transport_class, "__init__") as patched: + patched.return_value = None + client = client_class(client_options=options) + patched.assert_called_once_with( + credentials=None, + credentials_file="credentials.json", + host=client.DEFAULT_ENDPOINT, + scopes=None, + api_mtls_endpoint=client.DEFAULT_ENDPOINT, + client_cert_source=None, + quota_project_id=None, + ) + + +def test_job_service_client_client_options_from_dict(): + with mock.patch( + "google.cloud.talent_v4beta1.services.job_service.transports.JobServiceGrpcTransport.__init__" + ) as grpc_transport: + grpc_transport.return_value = None + client = JobServiceClient(client_options={"api_endpoint": "squid.clam.whelk"}) + grpc_transport.assert_called_once_with( + credentials=None, + credentials_file=None, + host="squid.clam.whelk", + scopes=None, + api_mtls_endpoint="squid.clam.whelk", + client_cert_source=None, + quota_project_id=None, + ) + + +def test_create_job(transport: str = "grpc", request_type=job_service.CreateJobRequest): + client = JobServiceClient( + credentials=credentials.AnonymousCredentials(), transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client._transport.create_job), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = gct_job.Job( + name="name_value", + company="company_value", + requisition_id="requisition_id_value", + title="title_value", + description="description_value", + addresses=["addresses_value"], + job_benefits=[common.JobBenefit.CHILD_CARE], + degree_types=[common.DegreeType.PRIMARY_EDUCATION], + department="department_value", + employment_types=[common.EmploymentType.FULL_TIME], + incentives="incentives_value", + language_code="language_code_value", + job_level=common.JobLevel.ENTRY_LEVEL, + promotion_value=1635, + qualifications="qualifications_value", + responsibilities="responsibilities_value", + posting_region=common.PostingRegion.ADMINISTRATIVE_AREA, + visibility=common.Visibility.ACCOUNT_ONLY, + company_display_name="company_display_name_value", + ) + + response = client.create_job(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + + assert args[0] == job_service.CreateJobRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, gct_job.Job) + + assert response.name == "name_value" + + assert response.company == "company_value" + + assert response.requisition_id == "requisition_id_value" + + assert response.title == "title_value" + + assert response.description == "description_value" + + assert response.addresses == ["addresses_value"] + + assert response.job_benefits == [common.JobBenefit.CHILD_CARE] + + assert response.degree_types == [common.DegreeType.PRIMARY_EDUCATION] + + assert response.department == "department_value" + + assert response.employment_types == [common.EmploymentType.FULL_TIME] + + assert response.incentives == "incentives_value" + + assert response.language_code == "language_code_value" + + assert response.job_level == common.JobLevel.ENTRY_LEVEL + + assert response.promotion_value == 1635 + + assert response.qualifications == "qualifications_value" + + assert response.responsibilities == "responsibilities_value" + + assert response.posting_region == common.PostingRegion.ADMINISTRATIVE_AREA + + assert response.visibility == common.Visibility.ACCOUNT_ONLY + + assert response.company_display_name == "company_display_name_value" + + +def test_create_job_from_dict(): + test_create_job(request_type=dict) + + +@pytest.mark.asyncio +async def test_create_job_async(transport: str = "grpc_asyncio"): + client = JobServiceAsyncClient( + credentials=credentials.AnonymousCredentials(), transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = job_service.CreateJobRequest() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client._client._transport.create_job), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + gct_job.Job( + name="name_value", + company="company_value", + requisition_id="requisition_id_value", + title="title_value", + description="description_value", + addresses=["addresses_value"], + job_benefits=[common.JobBenefit.CHILD_CARE], + degree_types=[common.DegreeType.PRIMARY_EDUCATION], + department="department_value", + employment_types=[common.EmploymentType.FULL_TIME], + incentives="incentives_value", + language_code="language_code_value", + job_level=common.JobLevel.ENTRY_LEVEL, + promotion_value=1635, + qualifications="qualifications_value", + responsibilities="responsibilities_value", + posting_region=common.PostingRegion.ADMINISTRATIVE_AREA, + visibility=common.Visibility.ACCOUNT_ONLY, + company_display_name="company_display_name_value", + ) + ) + + response = await client.create_job(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + + assert args[0] == request + + # Establish that the response is the type that we expect. + assert isinstance(response, gct_job.Job) + + assert response.name == "name_value" + + assert response.company == "company_value" + + assert response.requisition_id == "requisition_id_value" + + assert response.title == "title_value" + + assert response.description == "description_value" + + assert response.addresses == ["addresses_value"] + + assert response.job_benefits == [common.JobBenefit.CHILD_CARE] + + assert response.degree_types == [common.DegreeType.PRIMARY_EDUCATION] + + assert response.department == "department_value" + + assert response.employment_types == [common.EmploymentType.FULL_TIME] + + assert response.incentives == "incentives_value" + + assert response.language_code == "language_code_value" + + assert response.job_level == common.JobLevel.ENTRY_LEVEL + + assert response.promotion_value == 1635 + + assert response.qualifications == "qualifications_value" + + assert response.responsibilities == "responsibilities_value" + + assert response.posting_region == common.PostingRegion.ADMINISTRATIVE_AREA + + assert response.visibility == common.Visibility.ACCOUNT_ONLY + + assert response.company_display_name == "company_display_name_value" + + +def test_create_job_field_headers(): + client = JobServiceClient(credentials=credentials.AnonymousCredentials(),) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = job_service.CreateJobRequest() + request.parent = "parent/value" + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client._transport.create_job), "__call__") as call: + call.return_value = gct_job.Job() + + client.create_job(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + + +@pytest.mark.asyncio +async def test_create_job_field_headers_async(): + client = JobServiceAsyncClient(credentials=credentials.AnonymousCredentials(),) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = job_service.CreateJobRequest() + request.parent = "parent/value" + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client._client._transport.create_job), "__call__" + ) as call: + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(gct_job.Job()) + + await client.create_job(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + + +def test_create_job_flattened(): + client = JobServiceClient(credentials=credentials.AnonymousCredentials(),) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client._transport.create_job), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = gct_job.Job() + + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + client.create_job( + parent="parent_value", job=gct_job.Job(name="name_value"), + ) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + + assert args[0].parent == "parent_value" + + assert args[0].job == gct_job.Job(name="name_value") + + +def test_create_job_flattened_error(): + client = JobServiceClient(credentials=credentials.AnonymousCredentials(),) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + client.create_job( + job_service.CreateJobRequest(), + parent="parent_value", + job=gct_job.Job(name="name_value"), + ) + + +@pytest.mark.asyncio +async def test_create_job_flattened_async(): + client = JobServiceAsyncClient(credentials=credentials.AnonymousCredentials(),) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client._client._transport.create_job), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = gct_job.Job() + + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(gct_job.Job()) + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + response = await client.create_job( + parent="parent_value", job=gct_job.Job(name="name_value"), + ) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + + assert args[0].parent == "parent_value" + + assert args[0].job == gct_job.Job(name="name_value") + + +@pytest.mark.asyncio +async def test_create_job_flattened_error_async(): + client = JobServiceAsyncClient(credentials=credentials.AnonymousCredentials(),) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + await client.create_job( + job_service.CreateJobRequest(), + parent="parent_value", + job=gct_job.Job(name="name_value"), + ) + + +def test_batch_create_jobs( + transport: str = "grpc", request_type=job_service.BatchCreateJobsRequest +): + client = JobServiceClient( + credentials=credentials.AnonymousCredentials(), transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client._transport.batch_create_jobs), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = operations_pb2.Operation(name="operations/spam") + + response = client.batch_create_jobs(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + + assert args[0] == job_service.BatchCreateJobsRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, future.Future) + + +def test_batch_create_jobs_from_dict(): + test_batch_create_jobs(request_type=dict) + + +@pytest.mark.asyncio +async def test_batch_create_jobs_async(transport: str = "grpc_asyncio"): + client = JobServiceAsyncClient( + credentials=credentials.AnonymousCredentials(), transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = job_service.BatchCreateJobsRequest() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client._client._transport.batch_create_jobs), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + operations_pb2.Operation(name="operations/spam") + ) + + response = await client.batch_create_jobs(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + + assert args[0] == request + + # Establish that the response is the type that we expect. + assert isinstance(response, future.Future) + + +def test_batch_create_jobs_field_headers(): + client = JobServiceClient(credentials=credentials.AnonymousCredentials(),) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = job_service.BatchCreateJobsRequest() + request.parent = "parent/value" + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client._transport.batch_create_jobs), "__call__" + ) as call: + call.return_value = operations_pb2.Operation(name="operations/op") + + client.batch_create_jobs(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + + +@pytest.mark.asyncio +async def test_batch_create_jobs_field_headers_async(): + client = JobServiceAsyncClient(credentials=credentials.AnonymousCredentials(),) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = job_service.BatchCreateJobsRequest() + request.parent = "parent/value" + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client._client._transport.batch_create_jobs), "__call__" + ) as call: + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + operations_pb2.Operation(name="operations/op") + ) + + await client.batch_create_jobs(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + + +def test_batch_create_jobs_flattened(): + client = JobServiceClient(credentials=credentials.AnonymousCredentials(),) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client._transport.batch_create_jobs), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = operations_pb2.Operation(name="operations/op") + + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + client.batch_create_jobs( + parent="parent_value", jobs=[job.Job(name="name_value")], + ) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + + assert args[0].parent == "parent_value" + + assert args[0].jobs == [job.Job(name="name_value")] + + +def test_batch_create_jobs_flattened_error(): + client = JobServiceClient(credentials=credentials.AnonymousCredentials(),) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + client.batch_create_jobs( + job_service.BatchCreateJobsRequest(), + parent="parent_value", + jobs=[job.Job(name="name_value")], + ) + + +@pytest.mark.asyncio +async def test_batch_create_jobs_flattened_async(): + client = JobServiceAsyncClient(credentials=credentials.AnonymousCredentials(),) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client._client._transport.batch_create_jobs), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = operations_pb2.Operation(name="operations/op") + + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + operations_pb2.Operation(name="operations/spam") + ) + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + response = await client.batch_create_jobs( + parent="parent_value", jobs=[job.Job(name="name_value")], + ) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + + assert args[0].parent == "parent_value" + + assert args[0].jobs == [job.Job(name="name_value")] + + +@pytest.mark.asyncio +async def test_batch_create_jobs_flattened_error_async(): + client = JobServiceAsyncClient(credentials=credentials.AnonymousCredentials(),) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + await client.batch_create_jobs( + job_service.BatchCreateJobsRequest(), + parent="parent_value", + jobs=[job.Job(name="name_value")], + ) + + +def test_get_job(transport: str = "grpc", request_type=job_service.GetJobRequest): + client = JobServiceClient( + credentials=credentials.AnonymousCredentials(), transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client._transport.get_job), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = job.Job( + name="name_value", + company="company_value", + requisition_id="requisition_id_value", + title="title_value", + description="description_value", + addresses=["addresses_value"], + job_benefits=[common.JobBenefit.CHILD_CARE], + degree_types=[common.DegreeType.PRIMARY_EDUCATION], + department="department_value", + employment_types=[common.EmploymentType.FULL_TIME], + incentives="incentives_value", + language_code="language_code_value", + job_level=common.JobLevel.ENTRY_LEVEL, + promotion_value=1635, + qualifications="qualifications_value", + responsibilities="responsibilities_value", + posting_region=common.PostingRegion.ADMINISTRATIVE_AREA, + visibility=common.Visibility.ACCOUNT_ONLY, + company_display_name="company_display_name_value", + ) + + response = client.get_job(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + + assert args[0] == job_service.GetJobRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, job.Job) + + assert response.name == "name_value" + + assert response.company == "company_value" + + assert response.requisition_id == "requisition_id_value" + + assert response.title == "title_value" + + assert response.description == "description_value" + + assert response.addresses == ["addresses_value"] + + assert response.job_benefits == [common.JobBenefit.CHILD_CARE] + + assert response.degree_types == [common.DegreeType.PRIMARY_EDUCATION] + + assert response.department == "department_value" + + assert response.employment_types == [common.EmploymentType.FULL_TIME] + + assert response.incentives == "incentives_value" + + assert response.language_code == "language_code_value" + + assert response.job_level == common.JobLevel.ENTRY_LEVEL + + assert response.promotion_value == 1635 + + assert response.qualifications == "qualifications_value" + + assert response.responsibilities == "responsibilities_value" + + assert response.posting_region == common.PostingRegion.ADMINISTRATIVE_AREA + + assert response.visibility == common.Visibility.ACCOUNT_ONLY + + assert response.company_display_name == "company_display_name_value" + + +def test_get_job_from_dict(): + test_get_job(request_type=dict) + + +@pytest.mark.asyncio +async def test_get_job_async(transport: str = "grpc_asyncio"): + client = JobServiceAsyncClient( + credentials=credentials.AnonymousCredentials(), transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = job_service.GetJobRequest() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client._client._transport.get_job), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + job.Job( + name="name_value", + company="company_value", + requisition_id="requisition_id_value", + title="title_value", + description="description_value", + addresses=["addresses_value"], + job_benefits=[common.JobBenefit.CHILD_CARE], + degree_types=[common.DegreeType.PRIMARY_EDUCATION], + department="department_value", + employment_types=[common.EmploymentType.FULL_TIME], + incentives="incentives_value", + language_code="language_code_value", + job_level=common.JobLevel.ENTRY_LEVEL, + promotion_value=1635, + qualifications="qualifications_value", + responsibilities="responsibilities_value", + posting_region=common.PostingRegion.ADMINISTRATIVE_AREA, + visibility=common.Visibility.ACCOUNT_ONLY, + company_display_name="company_display_name_value", + ) + ) + + response = await client.get_job(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + + assert args[0] == request + + # Establish that the response is the type that we expect. + assert isinstance(response, job.Job) + + assert response.name == "name_value" + + assert response.company == "company_value" + + assert response.requisition_id == "requisition_id_value" + + assert response.title == "title_value" + + assert response.description == "description_value" + + assert response.addresses == ["addresses_value"] + + assert response.job_benefits == [common.JobBenefit.CHILD_CARE] + + assert response.degree_types == [common.DegreeType.PRIMARY_EDUCATION] + + assert response.department == "department_value" + + assert response.employment_types == [common.EmploymentType.FULL_TIME] + + assert response.incentives == "incentives_value" + + assert response.language_code == "language_code_value" + + assert response.job_level == common.JobLevel.ENTRY_LEVEL + + assert response.promotion_value == 1635 + + assert response.qualifications == "qualifications_value" + + assert response.responsibilities == "responsibilities_value" + + assert response.posting_region == common.PostingRegion.ADMINISTRATIVE_AREA + + assert response.visibility == common.Visibility.ACCOUNT_ONLY + + assert response.company_display_name == "company_display_name_value" + + +def test_get_job_field_headers(): + client = JobServiceClient(credentials=credentials.AnonymousCredentials(),) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = job_service.GetJobRequest() + request.name = "name/value" + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client._transport.get_job), "__call__") as call: + call.return_value = job.Job() + + client.get_job(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + + +@pytest.mark.asyncio +async def test_get_job_field_headers_async(): + client = JobServiceAsyncClient(credentials=credentials.AnonymousCredentials(),) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = job_service.GetJobRequest() + request.name = "name/value" + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client._client._transport.get_job), "__call__") as call: + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(job.Job()) + + await client.get_job(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + + +def test_get_job_flattened(): + client = JobServiceClient(credentials=credentials.AnonymousCredentials(),) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client._transport.get_job), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = job.Job() + + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + client.get_job(name="name_value",) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + + assert args[0].name == "name_value" + + +def test_get_job_flattened_error(): + client = JobServiceClient(credentials=credentials.AnonymousCredentials(),) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + client.get_job( + job_service.GetJobRequest(), name="name_value", + ) + + +@pytest.mark.asyncio +async def test_get_job_flattened_async(): + client = JobServiceAsyncClient(credentials=credentials.AnonymousCredentials(),) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client._client._transport.get_job), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = job.Job() + + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(job.Job()) + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + response = await client.get_job(name="name_value",) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + + assert args[0].name == "name_value" + + +@pytest.mark.asyncio +async def test_get_job_flattened_error_async(): + client = JobServiceAsyncClient(credentials=credentials.AnonymousCredentials(),) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + await client.get_job( + job_service.GetJobRequest(), name="name_value", + ) + + +def test_update_job(transport: str = "grpc", request_type=job_service.UpdateJobRequest): + client = JobServiceClient( + credentials=credentials.AnonymousCredentials(), transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client._transport.update_job), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = gct_job.Job( + name="name_value", + company="company_value", + requisition_id="requisition_id_value", + title="title_value", + description="description_value", + addresses=["addresses_value"], + job_benefits=[common.JobBenefit.CHILD_CARE], + degree_types=[common.DegreeType.PRIMARY_EDUCATION], + department="department_value", + employment_types=[common.EmploymentType.FULL_TIME], + incentives="incentives_value", + language_code="language_code_value", + job_level=common.JobLevel.ENTRY_LEVEL, + promotion_value=1635, + qualifications="qualifications_value", + responsibilities="responsibilities_value", + posting_region=common.PostingRegion.ADMINISTRATIVE_AREA, + visibility=common.Visibility.ACCOUNT_ONLY, + company_display_name="company_display_name_value", + ) + + response = client.update_job(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + + assert args[0] == job_service.UpdateJobRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, gct_job.Job) + + assert response.name == "name_value" + + assert response.company == "company_value" + + assert response.requisition_id == "requisition_id_value" + + assert response.title == "title_value" + + assert response.description == "description_value" + + assert response.addresses == ["addresses_value"] + + assert response.job_benefits == [common.JobBenefit.CHILD_CARE] + + assert response.degree_types == [common.DegreeType.PRIMARY_EDUCATION] + + assert response.department == "department_value" + + assert response.employment_types == [common.EmploymentType.FULL_TIME] + + assert response.incentives == "incentives_value" + + assert response.language_code == "language_code_value" + + assert response.job_level == common.JobLevel.ENTRY_LEVEL + + assert response.promotion_value == 1635 + + assert response.qualifications == "qualifications_value" + + assert response.responsibilities == "responsibilities_value" + + assert response.posting_region == common.PostingRegion.ADMINISTRATIVE_AREA + + assert response.visibility == common.Visibility.ACCOUNT_ONLY + + assert response.company_display_name == "company_display_name_value" + + +def test_update_job_from_dict(): + test_update_job(request_type=dict) + + +@pytest.mark.asyncio +async def test_update_job_async(transport: str = "grpc_asyncio"): + client = JobServiceAsyncClient( + credentials=credentials.AnonymousCredentials(), transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = job_service.UpdateJobRequest() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client._client._transport.update_job), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + gct_job.Job( + name="name_value", + company="company_value", + requisition_id="requisition_id_value", + title="title_value", + description="description_value", + addresses=["addresses_value"], + job_benefits=[common.JobBenefit.CHILD_CARE], + degree_types=[common.DegreeType.PRIMARY_EDUCATION], + department="department_value", + employment_types=[common.EmploymentType.FULL_TIME], + incentives="incentives_value", + language_code="language_code_value", + job_level=common.JobLevel.ENTRY_LEVEL, + promotion_value=1635, + qualifications="qualifications_value", + responsibilities="responsibilities_value", + posting_region=common.PostingRegion.ADMINISTRATIVE_AREA, + visibility=common.Visibility.ACCOUNT_ONLY, + company_display_name="company_display_name_value", + ) + ) + + response = await client.update_job(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + + assert args[0] == request + + # Establish that the response is the type that we expect. + assert isinstance(response, gct_job.Job) + + assert response.name == "name_value" + + assert response.company == "company_value" + + assert response.requisition_id == "requisition_id_value" + + assert response.title == "title_value" + + assert response.description == "description_value" + + assert response.addresses == ["addresses_value"] + + assert response.job_benefits == [common.JobBenefit.CHILD_CARE] + + assert response.degree_types == [common.DegreeType.PRIMARY_EDUCATION] + + assert response.department == "department_value" + + assert response.employment_types == [common.EmploymentType.FULL_TIME] + + assert response.incentives == "incentives_value" + + assert response.language_code == "language_code_value" + + assert response.job_level == common.JobLevel.ENTRY_LEVEL + + assert response.promotion_value == 1635 + + assert response.qualifications == "qualifications_value" + + assert response.responsibilities == "responsibilities_value" + + assert response.posting_region == common.PostingRegion.ADMINISTRATIVE_AREA + + assert response.visibility == common.Visibility.ACCOUNT_ONLY + + assert response.company_display_name == "company_display_name_value" + + +def test_update_job_field_headers(): + client = JobServiceClient(credentials=credentials.AnonymousCredentials(),) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = job_service.UpdateJobRequest() + request.job.name = "job.name/value" + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client._transport.update_job), "__call__") as call: + call.return_value = gct_job.Job() + + client.update_job(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ("x-goog-request-params", "job.name=job.name/value",) in kw["metadata"] + + +@pytest.mark.asyncio +async def test_update_job_field_headers_async(): + client = JobServiceAsyncClient(credentials=credentials.AnonymousCredentials(),) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = job_service.UpdateJobRequest() + request.job.name = "job.name/value" + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client._client._transport.update_job), "__call__" + ) as call: + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(gct_job.Job()) + + await client.update_job(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ("x-goog-request-params", "job.name=job.name/value",) in kw["metadata"] + + +def test_update_job_flattened(): + client = JobServiceClient(credentials=credentials.AnonymousCredentials(),) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client._transport.update_job), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = gct_job.Job() + + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + client.update_job(job=gct_job.Job(name="name_value"),) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + + assert args[0].job == gct_job.Job(name="name_value") + + +def test_update_job_flattened_error(): + client = JobServiceClient(credentials=credentials.AnonymousCredentials(),) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + client.update_job( + job_service.UpdateJobRequest(), job=gct_job.Job(name="name_value"), + ) + + +@pytest.mark.asyncio +async def test_update_job_flattened_async(): + client = JobServiceAsyncClient(credentials=credentials.AnonymousCredentials(),) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client._client._transport.update_job), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = gct_job.Job() + + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(gct_job.Job()) + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + response = await client.update_job(job=gct_job.Job(name="name_value"),) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + + assert args[0].job == gct_job.Job(name="name_value") + + +@pytest.mark.asyncio +async def test_update_job_flattened_error_async(): + client = JobServiceAsyncClient(credentials=credentials.AnonymousCredentials(),) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + await client.update_job( + job_service.UpdateJobRequest(), job=gct_job.Job(name="name_value"), + ) + + +def test_batch_update_jobs( + transport: str = "grpc", request_type=job_service.BatchUpdateJobsRequest +): + client = JobServiceClient( + credentials=credentials.AnonymousCredentials(), transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client._transport.batch_update_jobs), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = operations_pb2.Operation(name="operations/spam") + + response = client.batch_update_jobs(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + + assert args[0] == job_service.BatchUpdateJobsRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, future.Future) + + +def test_batch_update_jobs_from_dict(): + test_batch_update_jobs(request_type=dict) + + +@pytest.mark.asyncio +async def test_batch_update_jobs_async(transport: str = "grpc_asyncio"): + client = JobServiceAsyncClient( + credentials=credentials.AnonymousCredentials(), transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = job_service.BatchUpdateJobsRequest() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client._client._transport.batch_update_jobs), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + operations_pb2.Operation(name="operations/spam") + ) + + response = await client.batch_update_jobs(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + + assert args[0] == request + + # Establish that the response is the type that we expect. + assert isinstance(response, future.Future) + + +def test_batch_update_jobs_field_headers(): + client = JobServiceClient(credentials=credentials.AnonymousCredentials(),) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = job_service.BatchUpdateJobsRequest() + request.parent = "parent/value" + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client._transport.batch_update_jobs), "__call__" + ) as call: + call.return_value = operations_pb2.Operation(name="operations/op") + + client.batch_update_jobs(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + + +@pytest.mark.asyncio +async def test_batch_update_jobs_field_headers_async(): + client = JobServiceAsyncClient(credentials=credentials.AnonymousCredentials(),) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = job_service.BatchUpdateJobsRequest() + request.parent = "parent/value" + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client._client._transport.batch_update_jobs), "__call__" + ) as call: + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + operations_pb2.Operation(name="operations/op") + ) + + await client.batch_update_jobs(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + + +def test_batch_update_jobs_flattened(): + client = JobServiceClient(credentials=credentials.AnonymousCredentials(),) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client._transport.batch_update_jobs), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = operations_pb2.Operation(name="operations/op") + + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + client.batch_update_jobs( + parent="parent_value", jobs=[job.Job(name="name_value")], + ) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + + assert args[0].parent == "parent_value" + + assert args[0].jobs == [job.Job(name="name_value")] + + +def test_batch_update_jobs_flattened_error(): + client = JobServiceClient(credentials=credentials.AnonymousCredentials(),) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + client.batch_update_jobs( + job_service.BatchUpdateJobsRequest(), + parent="parent_value", + jobs=[job.Job(name="name_value")], + ) + + +@pytest.mark.asyncio +async def test_batch_update_jobs_flattened_async(): + client = JobServiceAsyncClient(credentials=credentials.AnonymousCredentials(),) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client._client._transport.batch_update_jobs), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = operations_pb2.Operation(name="operations/op") + + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + operations_pb2.Operation(name="operations/spam") + ) + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + response = await client.batch_update_jobs( + parent="parent_value", jobs=[job.Job(name="name_value")], + ) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + + assert args[0].parent == "parent_value" + + assert args[0].jobs == [job.Job(name="name_value")] + + +@pytest.mark.asyncio +async def test_batch_update_jobs_flattened_error_async(): + client = JobServiceAsyncClient(credentials=credentials.AnonymousCredentials(),) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + await client.batch_update_jobs( + job_service.BatchUpdateJobsRequest(), + parent="parent_value", + jobs=[job.Job(name="name_value")], + ) + + +def test_delete_job(transport: str = "grpc", request_type=job_service.DeleteJobRequest): + client = JobServiceClient( + credentials=credentials.AnonymousCredentials(), transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client._transport.delete_job), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = None + + response = client.delete_job(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + + assert args[0] == job_service.DeleteJobRequest() + + # Establish that the response is the type that we expect. + assert response is None + + +def test_delete_job_from_dict(): + test_delete_job(request_type=dict) + + +@pytest.mark.asyncio +async def test_delete_job_async(transport: str = "grpc_asyncio"): + client = JobServiceAsyncClient( + credentials=credentials.AnonymousCredentials(), transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = job_service.DeleteJobRequest() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client._client._transport.delete_job), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(None) + + response = await client.delete_job(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + + assert args[0] == request + + # Establish that the response is the type that we expect. + assert response is None + + +def test_delete_job_field_headers(): + client = JobServiceClient(credentials=credentials.AnonymousCredentials(),) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = job_service.DeleteJobRequest() + request.name = "name/value" + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client._transport.delete_job), "__call__") as call: + call.return_value = None + + client.delete_job(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + + +@pytest.mark.asyncio +async def test_delete_job_field_headers_async(): + client = JobServiceAsyncClient(credentials=credentials.AnonymousCredentials(),) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = job_service.DeleteJobRequest() + request.name = "name/value" + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client._client._transport.delete_job), "__call__" + ) as call: + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(None) + + await client.delete_job(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + + +def test_delete_job_flattened(): + client = JobServiceClient(credentials=credentials.AnonymousCredentials(),) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client._transport.delete_job), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = None + + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + client.delete_job(name="name_value",) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + + assert args[0].name == "name_value" + + +def test_delete_job_flattened_error(): + client = JobServiceClient(credentials=credentials.AnonymousCredentials(),) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + client.delete_job( + job_service.DeleteJobRequest(), name="name_value", + ) + + +@pytest.mark.asyncio +async def test_delete_job_flattened_async(): + client = JobServiceAsyncClient(credentials=credentials.AnonymousCredentials(),) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client._client._transport.delete_job), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = None + + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(None) + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + response = await client.delete_job(name="name_value",) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + + assert args[0].name == "name_value" + + +@pytest.mark.asyncio +async def test_delete_job_flattened_error_async(): + client = JobServiceAsyncClient(credentials=credentials.AnonymousCredentials(),) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + await client.delete_job( + job_service.DeleteJobRequest(), name="name_value", + ) + + +def test_batch_delete_jobs( + transport: str = "grpc", request_type=job_service.BatchDeleteJobsRequest +): + client = JobServiceClient( + credentials=credentials.AnonymousCredentials(), transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client._transport.batch_delete_jobs), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = None + + response = client.batch_delete_jobs(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + + assert args[0] == job_service.BatchDeleteJobsRequest() + + # Establish that the response is the type that we expect. + assert response is None + + +def test_batch_delete_jobs_from_dict(): + test_batch_delete_jobs(request_type=dict) + + +@pytest.mark.asyncio +async def test_batch_delete_jobs_async(transport: str = "grpc_asyncio"): + client = JobServiceAsyncClient( + credentials=credentials.AnonymousCredentials(), transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = job_service.BatchDeleteJobsRequest() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client._client._transport.batch_delete_jobs), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(None) + + response = await client.batch_delete_jobs(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + + assert args[0] == request + + # Establish that the response is the type that we expect. + assert response is None + + +def test_batch_delete_jobs_field_headers(): + client = JobServiceClient(credentials=credentials.AnonymousCredentials(),) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = job_service.BatchDeleteJobsRequest() + request.parent = "parent/value" + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client._transport.batch_delete_jobs), "__call__" + ) as call: + call.return_value = None + + client.batch_delete_jobs(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + + +@pytest.mark.asyncio +async def test_batch_delete_jobs_field_headers_async(): + client = JobServiceAsyncClient(credentials=credentials.AnonymousCredentials(),) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = job_service.BatchDeleteJobsRequest() + request.parent = "parent/value" + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client._client._transport.batch_delete_jobs), "__call__" + ) as call: + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(None) + + await client.batch_delete_jobs(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + + +def test_batch_delete_jobs_flattened(): + client = JobServiceClient(credentials=credentials.AnonymousCredentials(),) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client._transport.batch_delete_jobs), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = None + + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + client.batch_delete_jobs( + parent="parent_value", filter="filter_value", + ) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + + assert args[0].parent == "parent_value" + + assert args[0].filter == "filter_value" + + +def test_batch_delete_jobs_flattened_error(): + client = JobServiceClient(credentials=credentials.AnonymousCredentials(),) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + client.batch_delete_jobs( + job_service.BatchDeleteJobsRequest(), + parent="parent_value", + filter="filter_value", + ) + + +@pytest.mark.asyncio +async def test_batch_delete_jobs_flattened_async(): + client = JobServiceAsyncClient(credentials=credentials.AnonymousCredentials(),) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client._client._transport.batch_delete_jobs), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = None + + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(None) + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + response = await client.batch_delete_jobs( + parent="parent_value", filter="filter_value", + ) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + + assert args[0].parent == "parent_value" + + assert args[0].filter == "filter_value" + + +@pytest.mark.asyncio +async def test_batch_delete_jobs_flattened_error_async(): + client = JobServiceAsyncClient(credentials=credentials.AnonymousCredentials(),) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + await client.batch_delete_jobs( + job_service.BatchDeleteJobsRequest(), + parent="parent_value", + filter="filter_value", + ) + + +def test_list_jobs(transport: str = "grpc", request_type=job_service.ListJobsRequest): + client = JobServiceClient( + credentials=credentials.AnonymousCredentials(), transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client._transport.list_jobs), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = job_service.ListJobsResponse( + next_page_token="next_page_token_value", + ) + + response = client.list_jobs(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + + assert args[0] == job_service.ListJobsRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, pagers.ListJobsPager) + + assert response.next_page_token == "next_page_token_value" + + +def test_list_jobs_from_dict(): + test_list_jobs(request_type=dict) + + +@pytest.mark.asyncio +async def test_list_jobs_async(transport: str = "grpc_asyncio"): + client = JobServiceAsyncClient( + credentials=credentials.AnonymousCredentials(), transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = job_service.ListJobsRequest() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client._client._transport.list_jobs), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + job_service.ListJobsResponse(next_page_token="next_page_token_value",) + ) + + response = await client.list_jobs(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + + assert args[0] == request + + # Establish that the response is the type that we expect. + assert isinstance(response, pagers.ListJobsAsyncPager) + + assert response.next_page_token == "next_page_token_value" + + +def test_list_jobs_field_headers(): + client = JobServiceClient(credentials=credentials.AnonymousCredentials(),) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = job_service.ListJobsRequest() + request.parent = "parent/value" + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client._transport.list_jobs), "__call__") as call: + call.return_value = job_service.ListJobsResponse() + + client.list_jobs(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + + +@pytest.mark.asyncio +async def test_list_jobs_field_headers_async(): + client = JobServiceAsyncClient(credentials=credentials.AnonymousCredentials(),) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = job_service.ListJobsRequest() + request.parent = "parent/value" + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client._client._transport.list_jobs), "__call__" + ) as call: + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + job_service.ListJobsResponse() + ) + + await client.list_jobs(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + + +def test_list_jobs_flattened(): + client = JobServiceClient(credentials=credentials.AnonymousCredentials(),) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client._transport.list_jobs), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = job_service.ListJobsResponse() + + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + client.list_jobs( + parent="parent_value", filter="filter_value", + ) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + + assert args[0].parent == "parent_value" + + assert args[0].filter == "filter_value" + + +def test_list_jobs_flattened_error(): + client = JobServiceClient(credentials=credentials.AnonymousCredentials(),) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + client.list_jobs( + job_service.ListJobsRequest(), parent="parent_value", filter="filter_value", + ) + + +@pytest.mark.asyncio +async def test_list_jobs_flattened_async(): + client = JobServiceAsyncClient(credentials=credentials.AnonymousCredentials(),) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client._client._transport.list_jobs), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = job_service.ListJobsResponse() + + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + job_service.ListJobsResponse() + ) + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + response = await client.list_jobs(parent="parent_value", filter="filter_value",) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + + assert args[0].parent == "parent_value" + + assert args[0].filter == "filter_value" + + +@pytest.mark.asyncio +async def test_list_jobs_flattened_error_async(): + client = JobServiceAsyncClient(credentials=credentials.AnonymousCredentials(),) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + await client.list_jobs( + job_service.ListJobsRequest(), parent="parent_value", filter="filter_value", + ) + + +def test_list_jobs_pager(): + client = JobServiceClient(credentials=credentials.AnonymousCredentials,) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client._transport.list_jobs), "__call__") as call: + # Set the response to a series of pages. + call.side_effect = ( + job_service.ListJobsResponse( + jobs=[job.Job(), job.Job(), job.Job(),], next_page_token="abc", + ), + job_service.ListJobsResponse(jobs=[], next_page_token="def",), + job_service.ListJobsResponse(jobs=[job.Job(),], next_page_token="ghi",), + job_service.ListJobsResponse(jobs=[job.Job(), job.Job(),],), + RuntimeError, + ) + + metadata = () + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata((("parent", ""),)), + ) + pager = client.list_jobs(request={}) + + assert pager._metadata == metadata + + results = [i for i in pager] + assert len(results) == 6 + assert all(isinstance(i, job.Job) for i in results) + + +def test_list_jobs_pages(): + client = JobServiceClient(credentials=credentials.AnonymousCredentials,) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client._transport.list_jobs), "__call__") as call: + # Set the response to a series of pages. + call.side_effect = ( + job_service.ListJobsResponse( + jobs=[job.Job(), job.Job(), job.Job(),], next_page_token="abc", + ), + job_service.ListJobsResponse(jobs=[], next_page_token="def",), + job_service.ListJobsResponse(jobs=[job.Job(),], next_page_token="ghi",), + job_service.ListJobsResponse(jobs=[job.Job(), job.Job(),],), + RuntimeError, + ) + pages = list(client.list_jobs(request={}).pages) + for page, token in zip(pages, ["abc", "def", "ghi", ""]): + assert page.raw_page.next_page_token == token + + +@pytest.mark.asyncio +async def test_list_jobs_async_pager(): + client = JobServiceAsyncClient(credentials=credentials.AnonymousCredentials,) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client._client._transport.list_jobs), + "__call__", + new_callable=mock.AsyncMock, + ) as call: + # Set the response to a series of pages. + call.side_effect = ( + job_service.ListJobsResponse( + jobs=[job.Job(), job.Job(), job.Job(),], next_page_token="abc", + ), + job_service.ListJobsResponse(jobs=[], next_page_token="def",), + job_service.ListJobsResponse(jobs=[job.Job(),], next_page_token="ghi",), + job_service.ListJobsResponse(jobs=[job.Job(), job.Job(),],), + RuntimeError, + ) + async_pager = await client.list_jobs(request={},) + assert async_pager.next_page_token == "abc" + responses = [] + async for response in async_pager: + responses.append(response) + + assert len(responses) == 6 + assert all(isinstance(i, job.Job) for i in responses) + + +@pytest.mark.asyncio +async def test_list_jobs_async_pages(): + client = JobServiceAsyncClient(credentials=credentials.AnonymousCredentials,) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client._client._transport.list_jobs), + "__call__", + new_callable=mock.AsyncMock, + ) as call: + # Set the response to a series of pages. + call.side_effect = ( + job_service.ListJobsResponse( + jobs=[job.Job(), job.Job(), job.Job(),], next_page_token="abc", + ), + job_service.ListJobsResponse(jobs=[], next_page_token="def",), + job_service.ListJobsResponse(jobs=[job.Job(),], next_page_token="ghi",), + job_service.ListJobsResponse(jobs=[job.Job(), job.Job(),],), + RuntimeError, + ) + pages = [] + async for page in (await client.list_jobs(request={})).pages: + pages.append(page) + for page, token in zip(pages, ["abc", "def", "ghi", ""]): + assert page.raw_page.next_page_token == token + + +def test_search_jobs( + transport: str = "grpc", request_type=job_service.SearchJobsRequest +): + client = JobServiceClient( + credentials=credentials.AnonymousCredentials(), transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client._transport.search_jobs), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = job_service.SearchJobsResponse( + next_page_token="next_page_token_value", + estimated_total_size=2141, + total_size=1086, + broadened_query_jobs_count=2766, + ) + + response = client.search_jobs(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + + assert args[0] == job_service.SearchJobsRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, pagers.SearchJobsPager) + + assert response.next_page_token == "next_page_token_value" + + assert response.estimated_total_size == 2141 + + assert response.total_size == 1086 + + assert response.broadened_query_jobs_count == 2766 + + +def test_search_jobs_from_dict(): + test_search_jobs(request_type=dict) + + +@pytest.mark.asyncio +async def test_search_jobs_async(transport: str = "grpc_asyncio"): + client = JobServiceAsyncClient( + credentials=credentials.AnonymousCredentials(), transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = job_service.SearchJobsRequest() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client._client._transport.search_jobs), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + job_service.SearchJobsResponse( + next_page_token="next_page_token_value", + estimated_total_size=2141, + total_size=1086, + broadened_query_jobs_count=2766, + ) + ) + + response = await client.search_jobs(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + + assert args[0] == request + + # Establish that the response is the type that we expect. + assert isinstance(response, pagers.SearchJobsAsyncPager) + + assert response.next_page_token == "next_page_token_value" + + assert response.estimated_total_size == 2141 + + assert response.total_size == 1086 + + assert response.broadened_query_jobs_count == 2766 + + +def test_search_jobs_field_headers(): + client = JobServiceClient(credentials=credentials.AnonymousCredentials(),) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = job_service.SearchJobsRequest() + request.parent = "parent/value" + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client._transport.search_jobs), "__call__") as call: + call.return_value = job_service.SearchJobsResponse() + + client.search_jobs(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + + +@pytest.mark.asyncio +async def test_search_jobs_field_headers_async(): + client = JobServiceAsyncClient(credentials=credentials.AnonymousCredentials(),) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = job_service.SearchJobsRequest() + request.parent = "parent/value" + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client._client._transport.search_jobs), "__call__" + ) as call: + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + job_service.SearchJobsResponse() + ) + + await client.search_jobs(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + + +def test_search_jobs_pager(): + client = JobServiceClient(credentials=credentials.AnonymousCredentials,) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client._transport.search_jobs), "__call__") as call: + # Set the response to a series of pages. + call.side_effect = ( + job_service.SearchJobsResponse( + matching_jobs=[ + job_service.SearchJobsResponse.MatchingJob(), + job_service.SearchJobsResponse.MatchingJob(), + job_service.SearchJobsResponse.MatchingJob(), + ], + next_page_token="abc", + ), + job_service.SearchJobsResponse(matching_jobs=[], next_page_token="def",), + job_service.SearchJobsResponse( + matching_jobs=[job_service.SearchJobsResponse.MatchingJob(),], + next_page_token="ghi", + ), + job_service.SearchJobsResponse( + matching_jobs=[ + job_service.SearchJobsResponse.MatchingJob(), + job_service.SearchJobsResponse.MatchingJob(), + ], + ), + RuntimeError, + ) + + metadata = () + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata((("parent", ""),)), + ) + pager = client.search_jobs(request={}) + + assert pager._metadata == metadata + + results = [i for i in pager] + assert len(results) == 6 + assert all( + isinstance(i, job_service.SearchJobsResponse.MatchingJob) for i in results + ) + + +def test_search_jobs_pages(): + client = JobServiceClient(credentials=credentials.AnonymousCredentials,) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client._transport.search_jobs), "__call__") as call: + # Set the response to a series of pages. + call.side_effect = ( + job_service.SearchJobsResponse( + matching_jobs=[ + job_service.SearchJobsResponse.MatchingJob(), + job_service.SearchJobsResponse.MatchingJob(), + job_service.SearchJobsResponse.MatchingJob(), + ], + next_page_token="abc", + ), + job_service.SearchJobsResponse(matching_jobs=[], next_page_token="def",), + job_service.SearchJobsResponse( + matching_jobs=[job_service.SearchJobsResponse.MatchingJob(),], + next_page_token="ghi", + ), + job_service.SearchJobsResponse( + matching_jobs=[ + job_service.SearchJobsResponse.MatchingJob(), + job_service.SearchJobsResponse.MatchingJob(), + ], + ), + RuntimeError, + ) + pages = list(client.search_jobs(request={}).pages) + for page, token in zip(pages, ["abc", "def", "ghi", ""]): + assert page.raw_page.next_page_token == token + + +@pytest.mark.asyncio +async def test_search_jobs_async_pager(): + client = JobServiceAsyncClient(credentials=credentials.AnonymousCredentials,) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client._client._transport.search_jobs), + "__call__", + new_callable=mock.AsyncMock, + ) as call: + # Set the response to a series of pages. + call.side_effect = ( + job_service.SearchJobsResponse( + matching_jobs=[ + job_service.SearchJobsResponse.MatchingJob(), + job_service.SearchJobsResponse.MatchingJob(), + job_service.SearchJobsResponse.MatchingJob(), + ], + next_page_token="abc", + ), + job_service.SearchJobsResponse(matching_jobs=[], next_page_token="def",), + job_service.SearchJobsResponse( + matching_jobs=[job_service.SearchJobsResponse.MatchingJob(),], + next_page_token="ghi", + ), + job_service.SearchJobsResponse( + matching_jobs=[ + job_service.SearchJobsResponse.MatchingJob(), + job_service.SearchJobsResponse.MatchingJob(), + ], + ), + RuntimeError, + ) + async_pager = await client.search_jobs(request={},) + assert async_pager.next_page_token == "abc" + responses = [] + async for response in async_pager: + responses.append(response) + + assert len(responses) == 6 + assert all( + isinstance(i, job_service.SearchJobsResponse.MatchingJob) for i in responses + ) + + +@pytest.mark.asyncio +async def test_search_jobs_async_pages(): + client = JobServiceAsyncClient(credentials=credentials.AnonymousCredentials,) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client._client._transport.search_jobs), + "__call__", + new_callable=mock.AsyncMock, + ) as call: + # Set the response to a series of pages. + call.side_effect = ( + job_service.SearchJobsResponse( + matching_jobs=[ + job_service.SearchJobsResponse.MatchingJob(), + job_service.SearchJobsResponse.MatchingJob(), + job_service.SearchJobsResponse.MatchingJob(), + ], + next_page_token="abc", + ), + job_service.SearchJobsResponse(matching_jobs=[], next_page_token="def",), + job_service.SearchJobsResponse( + matching_jobs=[job_service.SearchJobsResponse.MatchingJob(),], + next_page_token="ghi", + ), + job_service.SearchJobsResponse( + matching_jobs=[ + job_service.SearchJobsResponse.MatchingJob(), + job_service.SearchJobsResponse.MatchingJob(), + ], + ), + RuntimeError, + ) + pages = [] + async for page in (await client.search_jobs(request={})).pages: + pages.append(page) + for page, token in zip(pages, ["abc", "def", "ghi", ""]): + assert page.raw_page.next_page_token == token + + +def test_search_jobs_for_alert( + transport: str = "grpc", request_type=job_service.SearchJobsRequest +): + client = JobServiceClient( + credentials=credentials.AnonymousCredentials(), transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client._transport.search_jobs_for_alert), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = job_service.SearchJobsResponse( + next_page_token="next_page_token_value", + estimated_total_size=2141, + total_size=1086, + broadened_query_jobs_count=2766, + ) + + response = client.search_jobs_for_alert(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + + assert args[0] == job_service.SearchJobsRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, pagers.SearchJobsForAlertPager) + + assert response.next_page_token == "next_page_token_value" + + assert response.estimated_total_size == 2141 + + assert response.total_size == 1086 + + assert response.broadened_query_jobs_count == 2766 + + +def test_search_jobs_for_alert_from_dict(): + test_search_jobs_for_alert(request_type=dict) + + +@pytest.mark.asyncio +async def test_search_jobs_for_alert_async(transport: str = "grpc_asyncio"): + client = JobServiceAsyncClient( + credentials=credentials.AnonymousCredentials(), transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = job_service.SearchJobsRequest() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client._client._transport.search_jobs_for_alert), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + job_service.SearchJobsResponse( + next_page_token="next_page_token_value", + estimated_total_size=2141, + total_size=1086, + broadened_query_jobs_count=2766, + ) + ) + + response = await client.search_jobs_for_alert(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + + assert args[0] == request + + # Establish that the response is the type that we expect. + assert isinstance(response, pagers.SearchJobsForAlertAsyncPager) + + assert response.next_page_token == "next_page_token_value" + + assert response.estimated_total_size == 2141 + + assert response.total_size == 1086 + + assert response.broadened_query_jobs_count == 2766 + + +def test_search_jobs_for_alert_field_headers(): + client = JobServiceClient(credentials=credentials.AnonymousCredentials(),) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = job_service.SearchJobsRequest() + request.parent = "parent/value" + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client._transport.search_jobs_for_alert), "__call__" + ) as call: + call.return_value = job_service.SearchJobsResponse() + + client.search_jobs_for_alert(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + + +@pytest.mark.asyncio +async def test_search_jobs_for_alert_field_headers_async(): + client = JobServiceAsyncClient(credentials=credentials.AnonymousCredentials(),) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = job_service.SearchJobsRequest() + request.parent = "parent/value" + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client._client._transport.search_jobs_for_alert), "__call__" + ) as call: + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + job_service.SearchJobsResponse() + ) + + await client.search_jobs_for_alert(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + + +def test_search_jobs_for_alert_pager(): + client = JobServiceClient(credentials=credentials.AnonymousCredentials,) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client._transport.search_jobs_for_alert), "__call__" + ) as call: + # Set the response to a series of pages. + call.side_effect = ( + job_service.SearchJobsResponse( + matching_jobs=[ + job_service.SearchJobsResponse.MatchingJob(), + job_service.SearchJobsResponse.MatchingJob(), + job_service.SearchJobsResponse.MatchingJob(), + ], + next_page_token="abc", + ), + job_service.SearchJobsResponse(matching_jobs=[], next_page_token="def",), + job_service.SearchJobsResponse( + matching_jobs=[job_service.SearchJobsResponse.MatchingJob(),], + next_page_token="ghi", + ), + job_service.SearchJobsResponse( + matching_jobs=[ + job_service.SearchJobsResponse.MatchingJob(), + job_service.SearchJobsResponse.MatchingJob(), + ], + ), + RuntimeError, + ) + + metadata = () + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata((("parent", ""),)), + ) + pager = client.search_jobs_for_alert(request={}) + + assert pager._metadata == metadata + + results = [i for i in pager] + assert len(results) == 6 + assert all( + isinstance(i, job_service.SearchJobsResponse.MatchingJob) for i in results + ) + + +def test_search_jobs_for_alert_pages(): + client = JobServiceClient(credentials=credentials.AnonymousCredentials,) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client._transport.search_jobs_for_alert), "__call__" + ) as call: + # Set the response to a series of pages. + call.side_effect = ( + job_service.SearchJobsResponse( + matching_jobs=[ + job_service.SearchJobsResponse.MatchingJob(), + job_service.SearchJobsResponse.MatchingJob(), + job_service.SearchJobsResponse.MatchingJob(), + ], + next_page_token="abc", + ), + job_service.SearchJobsResponse(matching_jobs=[], next_page_token="def",), + job_service.SearchJobsResponse( + matching_jobs=[job_service.SearchJobsResponse.MatchingJob(),], + next_page_token="ghi", + ), + job_service.SearchJobsResponse( + matching_jobs=[ + job_service.SearchJobsResponse.MatchingJob(), + job_service.SearchJobsResponse.MatchingJob(), + ], + ), + RuntimeError, + ) + pages = list(client.search_jobs_for_alert(request={}).pages) + for page, token in zip(pages, ["abc", "def", "ghi", ""]): + assert page.raw_page.next_page_token == token + + +@pytest.mark.asyncio +async def test_search_jobs_for_alert_async_pager(): + client = JobServiceAsyncClient(credentials=credentials.AnonymousCredentials,) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client._client._transport.search_jobs_for_alert), + "__call__", + new_callable=mock.AsyncMock, + ) as call: + # Set the response to a series of pages. + call.side_effect = ( + job_service.SearchJobsResponse( + matching_jobs=[ + job_service.SearchJobsResponse.MatchingJob(), + job_service.SearchJobsResponse.MatchingJob(), + job_service.SearchJobsResponse.MatchingJob(), + ], + next_page_token="abc", + ), + job_service.SearchJobsResponse(matching_jobs=[], next_page_token="def",), + job_service.SearchJobsResponse( + matching_jobs=[job_service.SearchJobsResponse.MatchingJob(),], + next_page_token="ghi", + ), + job_service.SearchJobsResponse( + matching_jobs=[ + job_service.SearchJobsResponse.MatchingJob(), + job_service.SearchJobsResponse.MatchingJob(), + ], + ), + RuntimeError, + ) + async_pager = await client.search_jobs_for_alert(request={},) + assert async_pager.next_page_token == "abc" + responses = [] + async for response in async_pager: + responses.append(response) + + assert len(responses) == 6 + assert all( + isinstance(i, job_service.SearchJobsResponse.MatchingJob) for i in responses + ) + + +@pytest.mark.asyncio +async def test_search_jobs_for_alert_async_pages(): + client = JobServiceAsyncClient(credentials=credentials.AnonymousCredentials,) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client._client._transport.search_jobs_for_alert), + "__call__", + new_callable=mock.AsyncMock, + ) as call: + # Set the response to a series of pages. + call.side_effect = ( + job_service.SearchJobsResponse( + matching_jobs=[ + job_service.SearchJobsResponse.MatchingJob(), + job_service.SearchJobsResponse.MatchingJob(), + job_service.SearchJobsResponse.MatchingJob(), + ], + next_page_token="abc", + ), + job_service.SearchJobsResponse(matching_jobs=[], next_page_token="def",), + job_service.SearchJobsResponse( + matching_jobs=[job_service.SearchJobsResponse.MatchingJob(),], + next_page_token="ghi", + ), + job_service.SearchJobsResponse( + matching_jobs=[ + job_service.SearchJobsResponse.MatchingJob(), + job_service.SearchJobsResponse.MatchingJob(), + ], + ), + RuntimeError, + ) + pages = [] + async for page in (await client.search_jobs_for_alert(request={})).pages: + pages.append(page) + for page, token in zip(pages, ["abc", "def", "ghi", ""]): + assert page.raw_page.next_page_token == token + + +def test_credentials_transport_error(): + # It is an error to provide credentials and a transport instance. + transport = transports.JobServiceGrpcTransport( + credentials=credentials.AnonymousCredentials(), + ) + with pytest.raises(ValueError): + client = JobServiceClient( + credentials=credentials.AnonymousCredentials(), transport=transport, + ) + + # It is an error to provide a credentials file and a transport instance. + transport = transports.JobServiceGrpcTransport( + credentials=credentials.AnonymousCredentials(), + ) + with pytest.raises(ValueError): + client = JobServiceClient( + client_options={"credentials_file": "credentials.json"}, + transport=transport, + ) + + # It is an error to provide scopes and a transport instance. + transport = transports.JobServiceGrpcTransport( + credentials=credentials.AnonymousCredentials(), + ) + with pytest.raises(ValueError): + client = JobServiceClient( + client_options={"scopes": ["1", "2"]}, transport=transport, + ) + + +def test_transport_instance(): + # A client may be instantiated with a custom transport instance. + transport = transports.JobServiceGrpcTransport( + credentials=credentials.AnonymousCredentials(), + ) + client = JobServiceClient(transport=transport) + assert client._transport is transport + + +def test_transport_get_channel(): + # A client may be instantiated with a custom transport instance. + transport = transports.JobServiceGrpcTransport( + credentials=credentials.AnonymousCredentials(), + ) + channel = transport.grpc_channel + assert channel + + transport = transports.JobServiceGrpcAsyncIOTransport( + credentials=credentials.AnonymousCredentials(), + ) + channel = transport.grpc_channel + assert channel + + +def test_transport_grpc_default(): + # A client should use the gRPC transport by default. + client = JobServiceClient(credentials=credentials.AnonymousCredentials(),) + assert isinstance(client._transport, transports.JobServiceGrpcTransport,) + + +def test_job_service_base_transport_error(): + # Passing both a credentials object and credentials_file should raise an error + with pytest.raises(exceptions.DuplicateCredentialArgs): + transport = transports.JobServiceTransport( + credentials=credentials.AnonymousCredentials(), + credentials_file="credentials.json", + ) + + +def test_job_service_base_transport(): + # Instantiate the base transport. + with mock.patch( + "google.cloud.talent_v4beta1.services.job_service.transports.JobServiceTransport.__init__" + ) as Transport: + Transport.return_value = None + transport = transports.JobServiceTransport( + credentials=credentials.AnonymousCredentials(), + ) + + # Every method on the transport should just blindly + # raise NotImplementedError. + methods = ( + "create_job", + "batch_create_jobs", + "get_job", + "update_job", + "batch_update_jobs", + "delete_job", + "batch_delete_jobs", + "list_jobs", + "search_jobs", + "search_jobs_for_alert", + ) + for method in methods: + with pytest.raises(NotImplementedError): + getattr(transport, method)(request=object()) + + # Additionally, the LRO client (a property) should + # also raise NotImplementedError + with pytest.raises(NotImplementedError): + transport.operations_client + + +def test_job_service_base_transport_with_credentials_file(): + # Instantiate the base transport with a credentials file + with mock.patch.object( + auth, "load_credentials_from_file" + ) as load_creds, mock.patch( + "google.cloud.talent_v4beta1.services.job_service.transports.JobServiceTransport._prep_wrapped_messages" + ) as Transport: + Transport.return_value = None + load_creds.return_value = (credentials.AnonymousCredentials(), None) + transport = transports.JobServiceTransport( + credentials_file="credentials.json", quota_project_id="octopus", + ) + load_creds.assert_called_once_with( + "credentials.json", + scopes=( + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/jobs", + ), + quota_project_id="octopus", + ) + + +def test_job_service_auth_adc(): + # If no credentials are provided, we should use ADC credentials. + with mock.patch.object(auth, "default") as adc: + adc.return_value = (credentials.AnonymousCredentials(), None) + JobServiceClient() + adc.assert_called_once_with( + scopes=( + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/jobs", + ), + quota_project_id=None, + ) + + +def test_job_service_transport_auth_adc(): + # If credentials and host are not provided, the transport class should use + # ADC credentials. + with mock.patch.object(auth, "default") as adc: + adc.return_value = (credentials.AnonymousCredentials(), None) + transports.JobServiceGrpcTransport( + host="squid.clam.whelk", quota_project_id="octopus" + ) + adc.assert_called_once_with( + scopes=( + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/jobs", + ), + quota_project_id="octopus", + ) + + +def test_job_service_host_no_port(): + client = JobServiceClient( + credentials=credentials.AnonymousCredentials(), + client_options=client_options.ClientOptions(api_endpoint="jobs.googleapis.com"), + ) + assert client._transport._host == "jobs.googleapis.com:443" + + +def test_job_service_host_with_port(): + client = JobServiceClient( + credentials=credentials.AnonymousCredentials(), + client_options=client_options.ClientOptions( + api_endpoint="jobs.googleapis.com:8000" + ), + ) + assert client._transport._host == "jobs.googleapis.com:8000" + + +def test_job_service_grpc_transport_channel(): + channel = grpc.insecure_channel("http://localhost/") + + # Check that if channel is provided, mtls endpoint and client_cert_source + # won't be used. + callback = mock.MagicMock() + transport = transports.JobServiceGrpcTransport( + host="squid.clam.whelk", + channel=channel, + api_mtls_endpoint="mtls.squid.clam.whelk", + client_cert_source=callback, + ) + assert transport.grpc_channel == channel + assert transport._host == "squid.clam.whelk:443" + assert not callback.called + + +def test_job_service_grpc_asyncio_transport_channel(): + channel = aio.insecure_channel("http://localhost/") + + # Check that if channel is provided, mtls endpoint and client_cert_source + # won't be used. + callback = mock.MagicMock() + transport = transports.JobServiceGrpcAsyncIOTransport( + host="squid.clam.whelk", + channel=channel, + api_mtls_endpoint="mtls.squid.clam.whelk", + client_cert_source=callback, + ) + assert transport.grpc_channel == channel + assert transport._host == "squid.clam.whelk:443" + assert not callback.called + + +@mock.patch("grpc.ssl_channel_credentials", autospec=True) +@mock.patch("google.api_core.grpc_helpers.create_channel", autospec=True) +def test_job_service_grpc_transport_channel_mtls_with_client_cert_source( + grpc_create_channel, grpc_ssl_channel_cred +): + # Check that if channel is None, but api_mtls_endpoint and client_cert_source + # are provided, then a mTLS channel will be created. + mock_cred = mock.Mock() + + mock_ssl_cred = mock.Mock() + grpc_ssl_channel_cred.return_value = mock_ssl_cred + + mock_grpc_channel = mock.Mock() + grpc_create_channel.return_value = mock_grpc_channel + + transport = transports.JobServiceGrpcTransport( + host="squid.clam.whelk", + credentials=mock_cred, + api_mtls_endpoint="mtls.squid.clam.whelk", + client_cert_source=client_cert_source_callback, + ) + grpc_ssl_channel_cred.assert_called_once_with( + certificate_chain=b"cert bytes", private_key=b"key bytes" + ) + grpc_create_channel.assert_called_once_with( + "mtls.squid.clam.whelk:443", + credentials=mock_cred, + credentials_file=None, + scopes=( + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/jobs", + ), + ssl_credentials=mock_ssl_cred, + quota_project_id=None, + ) + assert transport.grpc_channel == mock_grpc_channel + + +@mock.patch("grpc.ssl_channel_credentials", autospec=True) +@mock.patch("google.api_core.grpc_helpers_async.create_channel", autospec=True) +def test_job_service_grpc_asyncio_transport_channel_mtls_with_client_cert_source( + grpc_create_channel, grpc_ssl_channel_cred +): + # Check that if channel is None, but api_mtls_endpoint and client_cert_source + # are provided, then a mTLS channel will be created. + mock_cred = mock.Mock() + + mock_ssl_cred = mock.Mock() + grpc_ssl_channel_cred.return_value = mock_ssl_cred + + mock_grpc_channel = mock.Mock() + grpc_create_channel.return_value = mock_grpc_channel + + transport = transports.JobServiceGrpcAsyncIOTransport( + host="squid.clam.whelk", + credentials=mock_cred, + api_mtls_endpoint="mtls.squid.clam.whelk", + client_cert_source=client_cert_source_callback, + ) + grpc_ssl_channel_cred.assert_called_once_with( + certificate_chain=b"cert bytes", private_key=b"key bytes" + ) + grpc_create_channel.assert_called_once_with( + "mtls.squid.clam.whelk:443", + credentials=mock_cred, + credentials_file=None, + scopes=( + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/jobs", + ), + ssl_credentials=mock_ssl_cred, + quota_project_id=None, + ) + assert transport.grpc_channel == mock_grpc_channel + + +@pytest.mark.parametrize( + "api_mtls_endpoint", ["mtls.squid.clam.whelk", "mtls.squid.clam.whelk:443"] +) +@mock.patch("google.api_core.grpc_helpers.create_channel", autospec=True) +def test_job_service_grpc_transport_channel_mtls_with_adc( + grpc_create_channel, api_mtls_endpoint +): + # Check that if channel and client_cert_source are None, but api_mtls_endpoint + # is provided, then a mTLS channel will be created with SSL ADC. + mock_grpc_channel = mock.Mock() + grpc_create_channel.return_value = mock_grpc_channel + + # Mock google.auth.transport.grpc.SslCredentials class. + mock_ssl_cred = mock.Mock() + with mock.patch.multiple( + "google.auth.transport.grpc.SslCredentials", + __init__=mock.Mock(return_value=None), + ssl_credentials=mock.PropertyMock(return_value=mock_ssl_cred), + ): + mock_cred = mock.Mock() + transport = transports.JobServiceGrpcTransport( + host="squid.clam.whelk", + credentials=mock_cred, + api_mtls_endpoint=api_mtls_endpoint, + client_cert_source=None, + ) + grpc_create_channel.assert_called_once_with( + "mtls.squid.clam.whelk:443", + credentials=mock_cred, + credentials_file=None, + scopes=( + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/jobs", + ), + ssl_credentials=mock_ssl_cred, + quota_project_id=None, + ) + assert transport.grpc_channel == mock_grpc_channel + + +@pytest.mark.parametrize( + "api_mtls_endpoint", ["mtls.squid.clam.whelk", "mtls.squid.clam.whelk:443"] +) +@mock.patch("google.api_core.grpc_helpers_async.create_channel", autospec=True) +def test_job_service_grpc_asyncio_transport_channel_mtls_with_adc( + grpc_create_channel, api_mtls_endpoint +): + # Check that if channel and client_cert_source are None, but api_mtls_endpoint + # is provided, then a mTLS channel will be created with SSL ADC. + mock_grpc_channel = mock.Mock() + grpc_create_channel.return_value = mock_grpc_channel + + # Mock google.auth.transport.grpc.SslCredentials class. + mock_ssl_cred = mock.Mock() + with mock.patch.multiple( + "google.auth.transport.grpc.SslCredentials", + __init__=mock.Mock(return_value=None), + ssl_credentials=mock.PropertyMock(return_value=mock_ssl_cred), + ): + mock_cred = mock.Mock() + transport = transports.JobServiceGrpcAsyncIOTransport( + host="squid.clam.whelk", + credentials=mock_cred, + api_mtls_endpoint=api_mtls_endpoint, + client_cert_source=None, + ) + grpc_create_channel.assert_called_once_with( + "mtls.squid.clam.whelk:443", + credentials=mock_cred, + credentials_file=None, + scopes=( + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/jobs", + ), + ssl_credentials=mock_ssl_cred, + quota_project_id=None, + ) + assert transport.grpc_channel == mock_grpc_channel + + +def test_job_service_grpc_lro_client(): + client = JobServiceClient( + credentials=credentials.AnonymousCredentials(), transport="grpc", + ) + transport = client._transport + + # Ensure that we have a api-core operations client. + assert isinstance(transport.operations_client, operations_v1.OperationsClient,) + + # Ensure that subsequent calls to the property send the exact same object. + assert transport.operations_client is transport.operations_client + + +def test_job_service_grpc_lro_async_client(): + client = JobServiceAsyncClient( + credentials=credentials.AnonymousCredentials(), transport="grpc_asyncio", + ) + transport = client._client._transport + + # Ensure that we have a api-core operations client. + assert isinstance(transport.operations_client, operations_v1.OperationsAsyncClient,) + + # Ensure that subsequent calls to the property send the exact same object. + assert transport.operations_client is transport.operations_client + + +def test_job_path(): + project = "squid" + tenant = "clam" + job = "whelk" + + expected = "projects/{project}/tenants/{tenant}/jobs/{job}".format( + project=project, tenant=tenant, job=job, + ) + actual = JobServiceClient.job_path(project, tenant, job) + assert expected == actual + + +def test_parse_job_path(): + expected = { + "project": "octopus", + "tenant": "oyster", + "job": "nudibranch", + } + path = JobServiceClient.job_path(**expected) + + # Check that the path construction is reversible. + actual = JobServiceClient.parse_job_path(path) + assert expected == actual diff --git a/tests/unit/gapic/talent_v4beta1/test_profile_service.py b/tests/unit/gapic/talent_v4beta1/test_profile_service.py new file mode 100644 index 00000000..f95669da --- /dev/null +++ b/tests/unit/gapic/talent_v4beta1/test_profile_service.py @@ -0,0 +1,2277 @@ +# -*- 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. +# + +import os +import mock + +import grpc +from grpc.experimental import aio +import math +import pytest +from proto.marshal.rules.dates import DurationRule, TimestampRule + +from google import auth +from google.api_core import client_options +from google.api_core import exceptions +from google.api_core import gapic_v1 +from google.api_core import grpc_helpers +from google.api_core import grpc_helpers_async +from google.auth import credentials +from google.auth.exceptions import MutualTLSChannelError +from google.cloud.talent_v4beta1.services.profile_service import ( + ProfileServiceAsyncClient, +) +from google.cloud.talent_v4beta1.services.profile_service import ProfileServiceClient +from google.cloud.talent_v4beta1.services.profile_service import pagers +from google.cloud.talent_v4beta1.services.profile_service import transports +from google.cloud.talent_v4beta1.types import common +from google.cloud.talent_v4beta1.types import filters +from google.cloud.talent_v4beta1.types import histogram +from google.cloud.talent_v4beta1.types import profile +from google.cloud.talent_v4beta1.types import profile as gct_profile +from google.cloud.talent_v4beta1.types import profile_service +from google.oauth2 import service_account +from google.protobuf import duration_pb2 as duration # type: ignore +from google.protobuf import field_mask_pb2 as field_mask # type: ignore +from google.protobuf import timestamp_pb2 as timestamp # type: ignore +from google.protobuf import wrappers_pb2 as wrappers # type: ignore +from google.type import date_pb2 as date # type: ignore +from google.type import latlng_pb2 as latlng # type: ignore +from google.type import postal_address_pb2 as gt_postal_address # type: ignore + + +def client_cert_source_callback(): + return b"cert bytes", b"key bytes" + + +# If default endpoint is localhost, then default mtls endpoint will be the same. +# This method modifies the default endpoint so the client can produce a different +# mtls endpoint for endpoint testing purposes. +def modify_default_endpoint(client): + return ( + "foo.googleapis.com" + if ("localhost" in client.DEFAULT_ENDPOINT) + else client.DEFAULT_ENDPOINT + ) + + +def test__get_default_mtls_endpoint(): + api_endpoint = "example.googleapis.com" + api_mtls_endpoint = "example.mtls.googleapis.com" + sandbox_endpoint = "example.sandbox.googleapis.com" + sandbox_mtls_endpoint = "example.mtls.sandbox.googleapis.com" + non_googleapi = "api.example.com" + + assert ProfileServiceClient._get_default_mtls_endpoint(None) is None + assert ( + ProfileServiceClient._get_default_mtls_endpoint(api_endpoint) + == api_mtls_endpoint + ) + assert ( + ProfileServiceClient._get_default_mtls_endpoint(api_mtls_endpoint) + == api_mtls_endpoint + ) + assert ( + ProfileServiceClient._get_default_mtls_endpoint(sandbox_endpoint) + == sandbox_mtls_endpoint + ) + assert ( + ProfileServiceClient._get_default_mtls_endpoint(sandbox_mtls_endpoint) + == sandbox_mtls_endpoint + ) + assert ( + ProfileServiceClient._get_default_mtls_endpoint(non_googleapi) == non_googleapi + ) + + +@pytest.mark.parametrize( + "client_class", [ProfileServiceClient, ProfileServiceAsyncClient] +) +def test_profile_service_client_from_service_account_file(client_class): + creds = credentials.AnonymousCredentials() + with mock.patch.object( + service_account.Credentials, "from_service_account_file" + ) as factory: + factory.return_value = creds + client = client_class.from_service_account_file("dummy/file/path.json") + assert client._transport._credentials == creds + + client = client_class.from_service_account_json("dummy/file/path.json") + assert client._transport._credentials == creds + + assert client._transport._host == "jobs.googleapis.com:443" + + +def test_profile_service_client_get_transport_class(): + transport = ProfileServiceClient.get_transport_class() + assert transport == transports.ProfileServiceGrpcTransport + + transport = ProfileServiceClient.get_transport_class("grpc") + assert transport == transports.ProfileServiceGrpcTransport + + +@pytest.mark.parametrize( + "client_class,transport_class,transport_name", + [ + (ProfileServiceClient, transports.ProfileServiceGrpcTransport, "grpc"), + ( + ProfileServiceAsyncClient, + transports.ProfileServiceGrpcAsyncIOTransport, + "grpc_asyncio", + ), + ], +) +@mock.patch.object( + ProfileServiceClient, + "DEFAULT_ENDPOINT", + modify_default_endpoint(ProfileServiceClient), +) +@mock.patch.object( + ProfileServiceAsyncClient, + "DEFAULT_ENDPOINT", + modify_default_endpoint(ProfileServiceAsyncClient), +) +def test_profile_service_client_client_options( + client_class, transport_class, transport_name +): + # Check that if channel is provided we won't create a new one. + with mock.patch.object(ProfileServiceClient, "get_transport_class") as gtc: + transport = transport_class(credentials=credentials.AnonymousCredentials()) + client = client_class(transport=transport) + gtc.assert_not_called() + + # Check that if channel is provided via str we will create a new one. + with mock.patch.object(ProfileServiceClient, "get_transport_class") as gtc: + client = client_class(transport=transport_name) + gtc.assert_called() + + # Check the case api_endpoint is provided. + options = client_options.ClientOptions(api_endpoint="squid.clam.whelk") + with mock.patch.object(transport_class, "__init__") as patched: + patched.return_value = None + client = client_class(client_options=options) + patched.assert_called_once_with( + credentials=None, + credentials_file=None, + host="squid.clam.whelk", + scopes=None, + api_mtls_endpoint="squid.clam.whelk", + client_cert_source=None, + quota_project_id=None, + ) + + # Check the case api_endpoint is not provided and GOOGLE_API_USE_MTLS is + # "never". + with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS": "never"}): + with mock.patch.object(transport_class, "__init__") as patched: + patched.return_value = None + client = client_class() + patched.assert_called_once_with( + credentials=None, + credentials_file=None, + host=client.DEFAULT_ENDPOINT, + scopes=None, + api_mtls_endpoint=client.DEFAULT_ENDPOINT, + client_cert_source=None, + quota_project_id=None, + ) + + # Check the case api_endpoint is not provided and GOOGLE_API_USE_MTLS is + # "always". + with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS": "always"}): + with mock.patch.object(transport_class, "__init__") as patched: + patched.return_value = None + client = client_class() + patched.assert_called_once_with( + credentials=None, + credentials_file=None, + host=client.DEFAULT_MTLS_ENDPOINT, + scopes=None, + api_mtls_endpoint=client.DEFAULT_MTLS_ENDPOINT, + client_cert_source=None, + quota_project_id=None, + ) + + # Check the case api_endpoint is not provided, GOOGLE_API_USE_MTLS is + # "auto", and client_cert_source is provided. + with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS": "auto"}): + options = client_options.ClientOptions( + client_cert_source=client_cert_source_callback + ) + with mock.patch.object(transport_class, "__init__") as patched: + patched.return_value = None + client = client_class(client_options=options) + patched.assert_called_once_with( + credentials=None, + credentials_file=None, + host=client.DEFAULT_MTLS_ENDPOINT, + scopes=None, + api_mtls_endpoint=client.DEFAULT_MTLS_ENDPOINT, + client_cert_source=client_cert_source_callback, + quota_project_id=None, + ) + + # Check the case api_endpoint is not provided, GOOGLE_API_USE_MTLS is + # "auto", and default_client_cert_source is provided. + with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS": "auto"}): + with mock.patch.object(transport_class, "__init__") as patched: + with mock.patch( + "google.auth.transport.mtls.has_default_client_cert_source", + return_value=True, + ): + patched.return_value = None + client = client_class() + patched.assert_called_once_with( + credentials=None, + credentials_file=None, + host=client.DEFAULT_MTLS_ENDPOINT, + scopes=None, + api_mtls_endpoint=client.DEFAULT_MTLS_ENDPOINT, + client_cert_source=None, + quota_project_id=None, + ) + + # Check the case api_endpoint is not provided, GOOGLE_API_USE_MTLS is + # "auto", but client_cert_source and default_client_cert_source are None. + with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS": "auto"}): + with mock.patch.object(transport_class, "__init__") as patched: + with mock.patch( + "google.auth.transport.mtls.has_default_client_cert_source", + return_value=False, + ): + patched.return_value = None + client = client_class() + patched.assert_called_once_with( + credentials=None, + credentials_file=None, + host=client.DEFAULT_ENDPOINT, + scopes=None, + api_mtls_endpoint=client.DEFAULT_ENDPOINT, + client_cert_source=None, + quota_project_id=None, + ) + + # Check the case api_endpoint is not provided and GOOGLE_API_USE_MTLS has + # unsupported value. + with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS": "Unsupported"}): + with pytest.raises(MutualTLSChannelError): + client = client_class() + + # Check the case quota_project_id is provided + options = client_options.ClientOptions(quota_project_id="octopus") + with mock.patch.object(transport_class, "__init__") as patched: + patched.return_value = None + client = client_class(client_options=options) + patched.assert_called_once_with( + credentials=None, + credentials_file=None, + host=client.DEFAULT_ENDPOINT, + scopes=None, + api_mtls_endpoint=client.DEFAULT_ENDPOINT, + client_cert_source=None, + quota_project_id="octopus", + ) + + +@pytest.mark.parametrize( + "client_class,transport_class,transport_name", + [ + (ProfileServiceClient, transports.ProfileServiceGrpcTransport, "grpc"), + ( + ProfileServiceAsyncClient, + transports.ProfileServiceGrpcAsyncIOTransport, + "grpc_asyncio", + ), + ], +) +def test_profile_service_client_client_options_scopes( + client_class, transport_class, transport_name +): + # Check the case scopes are provided. + options = client_options.ClientOptions(scopes=["1", "2"],) + with mock.patch.object(transport_class, "__init__") as patched: + patched.return_value = None + client = client_class(client_options=options) + patched.assert_called_once_with( + credentials=None, + credentials_file=None, + host=client.DEFAULT_ENDPOINT, + scopes=["1", "2"], + api_mtls_endpoint=client.DEFAULT_ENDPOINT, + client_cert_source=None, + quota_project_id=None, + ) + + +@pytest.mark.parametrize( + "client_class,transport_class,transport_name", + [ + (ProfileServiceClient, transports.ProfileServiceGrpcTransport, "grpc"), + ( + ProfileServiceAsyncClient, + transports.ProfileServiceGrpcAsyncIOTransport, + "grpc_asyncio", + ), + ], +) +def test_profile_service_client_client_options_credentials_file( + client_class, transport_class, transport_name +): + # Check the case credentials file is provided. + options = client_options.ClientOptions(credentials_file="credentials.json") + with mock.patch.object(transport_class, "__init__") as patched: + patched.return_value = None + client = client_class(client_options=options) + patched.assert_called_once_with( + credentials=None, + credentials_file="credentials.json", + host=client.DEFAULT_ENDPOINT, + scopes=None, + api_mtls_endpoint=client.DEFAULT_ENDPOINT, + client_cert_source=None, + quota_project_id=None, + ) + + +def test_profile_service_client_client_options_from_dict(): + with mock.patch( + "google.cloud.talent_v4beta1.services.profile_service.transports.ProfileServiceGrpcTransport.__init__" + ) as grpc_transport: + grpc_transport.return_value = None + client = ProfileServiceClient( + client_options={"api_endpoint": "squid.clam.whelk"} + ) + grpc_transport.assert_called_once_with( + credentials=None, + credentials_file=None, + host="squid.clam.whelk", + scopes=None, + api_mtls_endpoint="squid.clam.whelk", + client_cert_source=None, + quota_project_id=None, + ) + + +def test_list_profiles( + transport: str = "grpc", request_type=profile_service.ListProfilesRequest +): + client = ProfileServiceClient( + credentials=credentials.AnonymousCredentials(), transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client._transport.list_profiles), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = profile_service.ListProfilesResponse( + next_page_token="next_page_token_value", + ) + + response = client.list_profiles(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + + assert args[0] == profile_service.ListProfilesRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, pagers.ListProfilesPager) + + assert response.next_page_token == "next_page_token_value" + + +def test_list_profiles_from_dict(): + test_list_profiles(request_type=dict) + + +@pytest.mark.asyncio +async def test_list_profiles_async(transport: str = "grpc_asyncio"): + client = ProfileServiceAsyncClient( + credentials=credentials.AnonymousCredentials(), transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = profile_service.ListProfilesRequest() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client._client._transport.list_profiles), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + profile_service.ListProfilesResponse( + next_page_token="next_page_token_value", + ) + ) + + response = await client.list_profiles(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + + assert args[0] == request + + # Establish that the response is the type that we expect. + assert isinstance(response, pagers.ListProfilesAsyncPager) + + assert response.next_page_token == "next_page_token_value" + + +def test_list_profiles_field_headers(): + client = ProfileServiceClient(credentials=credentials.AnonymousCredentials(),) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = profile_service.ListProfilesRequest() + request.parent = "parent/value" + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client._transport.list_profiles), "__call__") as call: + call.return_value = profile_service.ListProfilesResponse() + + client.list_profiles(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + + +@pytest.mark.asyncio +async def test_list_profiles_field_headers_async(): + client = ProfileServiceAsyncClient(credentials=credentials.AnonymousCredentials(),) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = profile_service.ListProfilesRequest() + request.parent = "parent/value" + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client._client._transport.list_profiles), "__call__" + ) as call: + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + profile_service.ListProfilesResponse() + ) + + await client.list_profiles(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + + +def test_list_profiles_flattened(): + client = ProfileServiceClient(credentials=credentials.AnonymousCredentials(),) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client._transport.list_profiles), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = profile_service.ListProfilesResponse() + + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + client.list_profiles(parent="parent_value",) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + + assert args[0].parent == "parent_value" + + +def test_list_profiles_flattened_error(): + client = ProfileServiceClient(credentials=credentials.AnonymousCredentials(),) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + client.list_profiles( + profile_service.ListProfilesRequest(), parent="parent_value", + ) + + +@pytest.mark.asyncio +async def test_list_profiles_flattened_async(): + client = ProfileServiceAsyncClient(credentials=credentials.AnonymousCredentials(),) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client._client._transport.list_profiles), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = profile_service.ListProfilesResponse() + + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + profile_service.ListProfilesResponse() + ) + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + response = await client.list_profiles(parent="parent_value",) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + + assert args[0].parent == "parent_value" + + +@pytest.mark.asyncio +async def test_list_profiles_flattened_error_async(): + client = ProfileServiceAsyncClient(credentials=credentials.AnonymousCredentials(),) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + await client.list_profiles( + profile_service.ListProfilesRequest(), parent="parent_value", + ) + + +def test_list_profiles_pager(): + client = ProfileServiceClient(credentials=credentials.AnonymousCredentials,) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client._transport.list_profiles), "__call__") as call: + # Set the response to a series of pages. + call.side_effect = ( + profile_service.ListProfilesResponse( + profiles=[profile.Profile(), profile.Profile(), profile.Profile(),], + next_page_token="abc", + ), + profile_service.ListProfilesResponse(profiles=[], next_page_token="def",), + profile_service.ListProfilesResponse( + profiles=[profile.Profile(),], next_page_token="ghi", + ), + profile_service.ListProfilesResponse( + profiles=[profile.Profile(), profile.Profile(),], + ), + RuntimeError, + ) + + metadata = () + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata((("parent", ""),)), + ) + pager = client.list_profiles(request={}) + + assert pager._metadata == metadata + + results = [i for i in pager] + assert len(results) == 6 + assert all(isinstance(i, profile.Profile) for i in results) + + +def test_list_profiles_pages(): + client = ProfileServiceClient(credentials=credentials.AnonymousCredentials,) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client._transport.list_profiles), "__call__") as call: + # Set the response to a series of pages. + call.side_effect = ( + profile_service.ListProfilesResponse( + profiles=[profile.Profile(), profile.Profile(), profile.Profile(),], + next_page_token="abc", + ), + profile_service.ListProfilesResponse(profiles=[], next_page_token="def",), + profile_service.ListProfilesResponse( + profiles=[profile.Profile(),], next_page_token="ghi", + ), + profile_service.ListProfilesResponse( + profiles=[profile.Profile(), profile.Profile(),], + ), + RuntimeError, + ) + pages = list(client.list_profiles(request={}).pages) + for page, token in zip(pages, ["abc", "def", "ghi", ""]): + assert page.raw_page.next_page_token == token + + +@pytest.mark.asyncio +async def test_list_profiles_async_pager(): + client = ProfileServiceAsyncClient(credentials=credentials.AnonymousCredentials,) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client._client._transport.list_profiles), + "__call__", + new_callable=mock.AsyncMock, + ) as call: + # Set the response to a series of pages. + call.side_effect = ( + profile_service.ListProfilesResponse( + profiles=[profile.Profile(), profile.Profile(), profile.Profile(),], + next_page_token="abc", + ), + profile_service.ListProfilesResponse(profiles=[], next_page_token="def",), + profile_service.ListProfilesResponse( + profiles=[profile.Profile(),], next_page_token="ghi", + ), + profile_service.ListProfilesResponse( + profiles=[profile.Profile(), profile.Profile(),], + ), + RuntimeError, + ) + async_pager = await client.list_profiles(request={},) + assert async_pager.next_page_token == "abc" + responses = [] + async for response in async_pager: + responses.append(response) + + assert len(responses) == 6 + assert all(isinstance(i, profile.Profile) for i in responses) + + +@pytest.mark.asyncio +async def test_list_profiles_async_pages(): + client = ProfileServiceAsyncClient(credentials=credentials.AnonymousCredentials,) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client._client._transport.list_profiles), + "__call__", + new_callable=mock.AsyncMock, + ) as call: + # Set the response to a series of pages. + call.side_effect = ( + profile_service.ListProfilesResponse( + profiles=[profile.Profile(), profile.Profile(), profile.Profile(),], + next_page_token="abc", + ), + profile_service.ListProfilesResponse(profiles=[], next_page_token="def",), + profile_service.ListProfilesResponse( + profiles=[profile.Profile(),], next_page_token="ghi", + ), + profile_service.ListProfilesResponse( + profiles=[profile.Profile(), profile.Profile(),], + ), + RuntimeError, + ) + pages = [] + async for page in (await client.list_profiles(request={})).pages: + pages.append(page) + for page, token in zip(pages, ["abc", "def", "ghi", ""]): + assert page.raw_page.next_page_token == token + + +def test_create_profile( + transport: str = "grpc", request_type=profile_service.CreateProfileRequest +): + client = ProfileServiceClient( + credentials=credentials.AnonymousCredentials(), transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client._transport.create_profile), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = gct_profile.Profile( + name="name_value", + external_id="external_id_value", + source="source_value", + uri="uri_value", + group_id="group_id_value", + applications=["applications_value"], + assignments=["assignments_value"], + processed=True, + keyword_snippet="keyword_snippet_value", + ) + + response = client.create_profile(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + + assert args[0] == profile_service.CreateProfileRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, gct_profile.Profile) + + assert response.name == "name_value" + + assert response.external_id == "external_id_value" + + assert response.source == "source_value" + + assert response.uri == "uri_value" + + assert response.group_id == "group_id_value" + + assert response.applications == ["applications_value"] + + assert response.assignments == ["assignments_value"] + + assert response.processed is True + + assert response.keyword_snippet == "keyword_snippet_value" + + +def test_create_profile_from_dict(): + test_create_profile(request_type=dict) + + +@pytest.mark.asyncio +async def test_create_profile_async(transport: str = "grpc_asyncio"): + client = ProfileServiceAsyncClient( + credentials=credentials.AnonymousCredentials(), transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = profile_service.CreateProfileRequest() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client._client._transport.create_profile), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + gct_profile.Profile( + name="name_value", + external_id="external_id_value", + source="source_value", + uri="uri_value", + group_id="group_id_value", + applications=["applications_value"], + assignments=["assignments_value"], + processed=True, + keyword_snippet="keyword_snippet_value", + ) + ) + + response = await client.create_profile(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + + assert args[0] == request + + # Establish that the response is the type that we expect. + assert isinstance(response, gct_profile.Profile) + + assert response.name == "name_value" + + assert response.external_id == "external_id_value" + + assert response.source == "source_value" + + assert response.uri == "uri_value" + + assert response.group_id == "group_id_value" + + assert response.applications == ["applications_value"] + + assert response.assignments == ["assignments_value"] + + assert response.processed is True + + assert response.keyword_snippet == "keyword_snippet_value" + + +def test_create_profile_field_headers(): + client = ProfileServiceClient(credentials=credentials.AnonymousCredentials(),) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = profile_service.CreateProfileRequest() + request.parent = "parent/value" + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client._transport.create_profile), "__call__") as call: + call.return_value = gct_profile.Profile() + + client.create_profile(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + + +@pytest.mark.asyncio +async def test_create_profile_field_headers_async(): + client = ProfileServiceAsyncClient(credentials=credentials.AnonymousCredentials(),) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = profile_service.CreateProfileRequest() + request.parent = "parent/value" + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client._client._transport.create_profile), "__call__" + ) as call: + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(gct_profile.Profile()) + + await client.create_profile(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + + +def test_create_profile_flattened(): + client = ProfileServiceClient(credentials=credentials.AnonymousCredentials(),) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client._transport.create_profile), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = gct_profile.Profile() + + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + client.create_profile( + parent="parent_value", profile=gct_profile.Profile(name="name_value"), + ) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + + assert args[0].parent == "parent_value" + + assert args[0].profile == gct_profile.Profile(name="name_value") + + +def test_create_profile_flattened_error(): + client = ProfileServiceClient(credentials=credentials.AnonymousCredentials(),) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + client.create_profile( + profile_service.CreateProfileRequest(), + parent="parent_value", + profile=gct_profile.Profile(name="name_value"), + ) + + +@pytest.mark.asyncio +async def test_create_profile_flattened_async(): + client = ProfileServiceAsyncClient(credentials=credentials.AnonymousCredentials(),) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client._client._transport.create_profile), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = gct_profile.Profile() + + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(gct_profile.Profile()) + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + response = await client.create_profile( + parent="parent_value", profile=gct_profile.Profile(name="name_value"), + ) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + + assert args[0].parent == "parent_value" + + assert args[0].profile == gct_profile.Profile(name="name_value") + + +@pytest.mark.asyncio +async def test_create_profile_flattened_error_async(): + client = ProfileServiceAsyncClient(credentials=credentials.AnonymousCredentials(),) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + await client.create_profile( + profile_service.CreateProfileRequest(), + parent="parent_value", + profile=gct_profile.Profile(name="name_value"), + ) + + +def test_get_profile( + transport: str = "grpc", request_type=profile_service.GetProfileRequest +): + client = ProfileServiceClient( + credentials=credentials.AnonymousCredentials(), transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client._transport.get_profile), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = profile.Profile( + name="name_value", + external_id="external_id_value", + source="source_value", + uri="uri_value", + group_id="group_id_value", + applications=["applications_value"], + assignments=["assignments_value"], + processed=True, + keyword_snippet="keyword_snippet_value", + ) + + response = client.get_profile(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + + assert args[0] == profile_service.GetProfileRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, profile.Profile) + + assert response.name == "name_value" + + assert response.external_id == "external_id_value" + + assert response.source == "source_value" + + assert response.uri == "uri_value" + + assert response.group_id == "group_id_value" + + assert response.applications == ["applications_value"] + + assert response.assignments == ["assignments_value"] + + assert response.processed is True + + assert response.keyword_snippet == "keyword_snippet_value" + + +def test_get_profile_from_dict(): + test_get_profile(request_type=dict) + + +@pytest.mark.asyncio +async def test_get_profile_async(transport: str = "grpc_asyncio"): + client = ProfileServiceAsyncClient( + credentials=credentials.AnonymousCredentials(), transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = profile_service.GetProfileRequest() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client._client._transport.get_profile), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + profile.Profile( + name="name_value", + external_id="external_id_value", + source="source_value", + uri="uri_value", + group_id="group_id_value", + applications=["applications_value"], + assignments=["assignments_value"], + processed=True, + keyword_snippet="keyword_snippet_value", + ) + ) + + response = await client.get_profile(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + + assert args[0] == request + + # Establish that the response is the type that we expect. + assert isinstance(response, profile.Profile) + + assert response.name == "name_value" + + assert response.external_id == "external_id_value" + + assert response.source == "source_value" + + assert response.uri == "uri_value" + + assert response.group_id == "group_id_value" + + assert response.applications == ["applications_value"] + + assert response.assignments == ["assignments_value"] + + assert response.processed is True + + assert response.keyword_snippet == "keyword_snippet_value" + + +def test_get_profile_field_headers(): + client = ProfileServiceClient(credentials=credentials.AnonymousCredentials(),) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = profile_service.GetProfileRequest() + request.name = "name/value" + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client._transport.get_profile), "__call__") as call: + call.return_value = profile.Profile() + + client.get_profile(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + + +@pytest.mark.asyncio +async def test_get_profile_field_headers_async(): + client = ProfileServiceAsyncClient(credentials=credentials.AnonymousCredentials(),) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = profile_service.GetProfileRequest() + request.name = "name/value" + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client._client._transport.get_profile), "__call__" + ) as call: + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(profile.Profile()) + + await client.get_profile(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + + +def test_get_profile_flattened(): + client = ProfileServiceClient(credentials=credentials.AnonymousCredentials(),) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client._transport.get_profile), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = profile.Profile() + + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + client.get_profile(name="name_value",) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + + assert args[0].name == "name_value" + + +def test_get_profile_flattened_error(): + client = ProfileServiceClient(credentials=credentials.AnonymousCredentials(),) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + client.get_profile( + profile_service.GetProfileRequest(), name="name_value", + ) + + +@pytest.mark.asyncio +async def test_get_profile_flattened_async(): + client = ProfileServiceAsyncClient(credentials=credentials.AnonymousCredentials(),) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client._client._transport.get_profile), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = profile.Profile() + + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(profile.Profile()) + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + response = await client.get_profile(name="name_value",) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + + assert args[0].name == "name_value" + + +@pytest.mark.asyncio +async def test_get_profile_flattened_error_async(): + client = ProfileServiceAsyncClient(credentials=credentials.AnonymousCredentials(),) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + await client.get_profile( + profile_service.GetProfileRequest(), name="name_value", + ) + + +def test_update_profile( + transport: str = "grpc", request_type=profile_service.UpdateProfileRequest +): + client = ProfileServiceClient( + credentials=credentials.AnonymousCredentials(), transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client._transport.update_profile), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = gct_profile.Profile( + name="name_value", + external_id="external_id_value", + source="source_value", + uri="uri_value", + group_id="group_id_value", + applications=["applications_value"], + assignments=["assignments_value"], + processed=True, + keyword_snippet="keyword_snippet_value", + ) + + response = client.update_profile(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + + assert args[0] == profile_service.UpdateProfileRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, gct_profile.Profile) + + assert response.name == "name_value" + + assert response.external_id == "external_id_value" + + assert response.source == "source_value" + + assert response.uri == "uri_value" + + assert response.group_id == "group_id_value" + + assert response.applications == ["applications_value"] + + assert response.assignments == ["assignments_value"] + + assert response.processed is True + + assert response.keyword_snippet == "keyword_snippet_value" + + +def test_update_profile_from_dict(): + test_update_profile(request_type=dict) + + +@pytest.mark.asyncio +async def test_update_profile_async(transport: str = "grpc_asyncio"): + client = ProfileServiceAsyncClient( + credentials=credentials.AnonymousCredentials(), transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = profile_service.UpdateProfileRequest() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client._client._transport.update_profile), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + gct_profile.Profile( + name="name_value", + external_id="external_id_value", + source="source_value", + uri="uri_value", + group_id="group_id_value", + applications=["applications_value"], + assignments=["assignments_value"], + processed=True, + keyword_snippet="keyword_snippet_value", + ) + ) + + response = await client.update_profile(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + + assert args[0] == request + + # Establish that the response is the type that we expect. + assert isinstance(response, gct_profile.Profile) + + assert response.name == "name_value" + + assert response.external_id == "external_id_value" + + assert response.source == "source_value" + + assert response.uri == "uri_value" + + assert response.group_id == "group_id_value" + + assert response.applications == ["applications_value"] + + assert response.assignments == ["assignments_value"] + + assert response.processed is True + + assert response.keyword_snippet == "keyword_snippet_value" + + +def test_update_profile_field_headers(): + client = ProfileServiceClient(credentials=credentials.AnonymousCredentials(),) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = profile_service.UpdateProfileRequest() + request.profile.name = "profile.name/value" + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client._transport.update_profile), "__call__") as call: + call.return_value = gct_profile.Profile() + + client.update_profile(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ("x-goog-request-params", "profile.name=profile.name/value",) in kw[ + "metadata" + ] + + +@pytest.mark.asyncio +async def test_update_profile_field_headers_async(): + client = ProfileServiceAsyncClient(credentials=credentials.AnonymousCredentials(),) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = profile_service.UpdateProfileRequest() + request.profile.name = "profile.name/value" + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client._client._transport.update_profile), "__call__" + ) as call: + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(gct_profile.Profile()) + + await client.update_profile(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ("x-goog-request-params", "profile.name=profile.name/value",) in kw[ + "metadata" + ] + + +def test_update_profile_flattened(): + client = ProfileServiceClient(credentials=credentials.AnonymousCredentials(),) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client._transport.update_profile), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = gct_profile.Profile() + + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + client.update_profile(profile=gct_profile.Profile(name="name_value"),) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + + assert args[0].profile == gct_profile.Profile(name="name_value") + + +def test_update_profile_flattened_error(): + client = ProfileServiceClient(credentials=credentials.AnonymousCredentials(),) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + client.update_profile( + profile_service.UpdateProfileRequest(), + profile=gct_profile.Profile(name="name_value"), + ) + + +@pytest.mark.asyncio +async def test_update_profile_flattened_async(): + client = ProfileServiceAsyncClient(credentials=credentials.AnonymousCredentials(),) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client._client._transport.update_profile), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = gct_profile.Profile() + + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(gct_profile.Profile()) + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + response = await client.update_profile( + profile=gct_profile.Profile(name="name_value"), + ) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + + assert args[0].profile == gct_profile.Profile(name="name_value") + + +@pytest.mark.asyncio +async def test_update_profile_flattened_error_async(): + client = ProfileServiceAsyncClient(credentials=credentials.AnonymousCredentials(),) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + await client.update_profile( + profile_service.UpdateProfileRequest(), + profile=gct_profile.Profile(name="name_value"), + ) + + +def test_delete_profile( + transport: str = "grpc", request_type=profile_service.DeleteProfileRequest +): + client = ProfileServiceClient( + credentials=credentials.AnonymousCredentials(), transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client._transport.delete_profile), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = None + + response = client.delete_profile(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + + assert args[0] == profile_service.DeleteProfileRequest() + + # Establish that the response is the type that we expect. + assert response is None + + +def test_delete_profile_from_dict(): + test_delete_profile(request_type=dict) + + +@pytest.mark.asyncio +async def test_delete_profile_async(transport: str = "grpc_asyncio"): + client = ProfileServiceAsyncClient( + credentials=credentials.AnonymousCredentials(), transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = profile_service.DeleteProfileRequest() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client._client._transport.delete_profile), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(None) + + response = await client.delete_profile(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + + assert args[0] == request + + # Establish that the response is the type that we expect. + assert response is None + + +def test_delete_profile_field_headers(): + client = ProfileServiceClient(credentials=credentials.AnonymousCredentials(),) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = profile_service.DeleteProfileRequest() + request.name = "name/value" + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client._transport.delete_profile), "__call__") as call: + call.return_value = None + + client.delete_profile(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + + +@pytest.mark.asyncio +async def test_delete_profile_field_headers_async(): + client = ProfileServiceAsyncClient(credentials=credentials.AnonymousCredentials(),) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = profile_service.DeleteProfileRequest() + request.name = "name/value" + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client._client._transport.delete_profile), "__call__" + ) as call: + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(None) + + await client.delete_profile(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + + +def test_delete_profile_flattened(): + client = ProfileServiceClient(credentials=credentials.AnonymousCredentials(),) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client._transport.delete_profile), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = None + + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + client.delete_profile(name="name_value",) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + + assert args[0].name == "name_value" + + +def test_delete_profile_flattened_error(): + client = ProfileServiceClient(credentials=credentials.AnonymousCredentials(),) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + client.delete_profile( + profile_service.DeleteProfileRequest(), name="name_value", + ) + + +@pytest.mark.asyncio +async def test_delete_profile_flattened_async(): + client = ProfileServiceAsyncClient(credentials=credentials.AnonymousCredentials(),) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client._client._transport.delete_profile), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = None + + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(None) + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + response = await client.delete_profile(name="name_value",) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + + assert args[0].name == "name_value" + + +@pytest.mark.asyncio +async def test_delete_profile_flattened_error_async(): + client = ProfileServiceAsyncClient(credentials=credentials.AnonymousCredentials(),) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + await client.delete_profile( + profile_service.DeleteProfileRequest(), name="name_value", + ) + + +def test_search_profiles( + transport: str = "grpc", request_type=profile_service.SearchProfilesRequest +): + client = ProfileServiceClient( + credentials=credentials.AnonymousCredentials(), transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client._transport.search_profiles), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = profile_service.SearchProfilesResponse( + estimated_total_size=2141, + next_page_token="next_page_token_value", + result_set_id="result_set_id_value", + ) + + response = client.search_profiles(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + + assert args[0] == profile_service.SearchProfilesRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, pagers.SearchProfilesPager) + + assert response.estimated_total_size == 2141 + + assert response.next_page_token == "next_page_token_value" + + assert response.result_set_id == "result_set_id_value" + + +def test_search_profiles_from_dict(): + test_search_profiles(request_type=dict) + + +@pytest.mark.asyncio +async def test_search_profiles_async(transport: str = "grpc_asyncio"): + client = ProfileServiceAsyncClient( + credentials=credentials.AnonymousCredentials(), transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = profile_service.SearchProfilesRequest() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client._client._transport.search_profiles), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + profile_service.SearchProfilesResponse( + estimated_total_size=2141, + next_page_token="next_page_token_value", + result_set_id="result_set_id_value", + ) + ) + + response = await client.search_profiles(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + + assert args[0] == request + + # Establish that the response is the type that we expect. + assert isinstance(response, pagers.SearchProfilesAsyncPager) + + assert response.estimated_total_size == 2141 + + assert response.next_page_token == "next_page_token_value" + + assert response.result_set_id == "result_set_id_value" + + +def test_search_profiles_field_headers(): + client = ProfileServiceClient(credentials=credentials.AnonymousCredentials(),) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = profile_service.SearchProfilesRequest() + request.parent = "parent/value" + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client._transport.search_profiles), "__call__") as call: + call.return_value = profile_service.SearchProfilesResponse() + + client.search_profiles(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + + +@pytest.mark.asyncio +async def test_search_profiles_field_headers_async(): + client = ProfileServiceAsyncClient(credentials=credentials.AnonymousCredentials(),) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = profile_service.SearchProfilesRequest() + request.parent = "parent/value" + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client._client._transport.search_profiles), "__call__" + ) as call: + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + profile_service.SearchProfilesResponse() + ) + + await client.search_profiles(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + + +def test_search_profiles_pager(): + client = ProfileServiceClient(credentials=credentials.AnonymousCredentials,) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client._transport.search_profiles), "__call__") as call: + # Set the response to a series of pages. + call.side_effect = ( + profile_service.SearchProfilesResponse( + histogram_query_results=[ + histogram.HistogramQueryResult(), + histogram.HistogramQueryResult(), + histogram.HistogramQueryResult(), + ], + next_page_token="abc", + ), + profile_service.SearchProfilesResponse( + histogram_query_results=[], next_page_token="def", + ), + profile_service.SearchProfilesResponse( + histogram_query_results=[histogram.HistogramQueryResult(),], + next_page_token="ghi", + ), + profile_service.SearchProfilesResponse( + histogram_query_results=[ + histogram.HistogramQueryResult(), + histogram.HistogramQueryResult(), + ], + ), + RuntimeError, + ) + + metadata = () + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata((("parent", ""),)), + ) + pager = client.search_profiles(request={}) + + assert pager._metadata == metadata + + results = [i for i in pager] + assert len(results) == 6 + assert all(isinstance(i, histogram.HistogramQueryResult) for i in results) + + +def test_search_profiles_pages(): + client = ProfileServiceClient(credentials=credentials.AnonymousCredentials,) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client._transport.search_profiles), "__call__") as call: + # Set the response to a series of pages. + call.side_effect = ( + profile_service.SearchProfilesResponse( + histogram_query_results=[ + histogram.HistogramQueryResult(), + histogram.HistogramQueryResult(), + histogram.HistogramQueryResult(), + ], + next_page_token="abc", + ), + profile_service.SearchProfilesResponse( + histogram_query_results=[], next_page_token="def", + ), + profile_service.SearchProfilesResponse( + histogram_query_results=[histogram.HistogramQueryResult(),], + next_page_token="ghi", + ), + profile_service.SearchProfilesResponse( + histogram_query_results=[ + histogram.HistogramQueryResult(), + histogram.HistogramQueryResult(), + ], + ), + RuntimeError, + ) + pages = list(client.search_profiles(request={}).pages) + for page, token in zip(pages, ["abc", "def", "ghi", ""]): + assert page.raw_page.next_page_token == token + + +@pytest.mark.asyncio +async def test_search_profiles_async_pager(): + client = ProfileServiceAsyncClient(credentials=credentials.AnonymousCredentials,) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client._client._transport.search_profiles), + "__call__", + new_callable=mock.AsyncMock, + ) as call: + # Set the response to a series of pages. + call.side_effect = ( + profile_service.SearchProfilesResponse( + histogram_query_results=[ + histogram.HistogramQueryResult(), + histogram.HistogramQueryResult(), + histogram.HistogramQueryResult(), + ], + next_page_token="abc", + ), + profile_service.SearchProfilesResponse( + histogram_query_results=[], next_page_token="def", + ), + profile_service.SearchProfilesResponse( + histogram_query_results=[histogram.HistogramQueryResult(),], + next_page_token="ghi", + ), + profile_service.SearchProfilesResponse( + histogram_query_results=[ + histogram.HistogramQueryResult(), + histogram.HistogramQueryResult(), + ], + ), + RuntimeError, + ) + async_pager = await client.search_profiles(request={},) + assert async_pager.next_page_token == "abc" + responses = [] + async for response in async_pager: + responses.append(response) + + assert len(responses) == 6 + assert all(isinstance(i, histogram.HistogramQueryResult) for i in responses) + + +@pytest.mark.asyncio +async def test_search_profiles_async_pages(): + client = ProfileServiceAsyncClient(credentials=credentials.AnonymousCredentials,) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client._client._transport.search_profiles), + "__call__", + new_callable=mock.AsyncMock, + ) as call: + # Set the response to a series of pages. + call.side_effect = ( + profile_service.SearchProfilesResponse( + histogram_query_results=[ + histogram.HistogramQueryResult(), + histogram.HistogramQueryResult(), + histogram.HistogramQueryResult(), + ], + next_page_token="abc", + ), + profile_service.SearchProfilesResponse( + histogram_query_results=[], next_page_token="def", + ), + profile_service.SearchProfilesResponse( + histogram_query_results=[histogram.HistogramQueryResult(),], + next_page_token="ghi", + ), + profile_service.SearchProfilesResponse( + histogram_query_results=[ + histogram.HistogramQueryResult(), + histogram.HistogramQueryResult(), + ], + ), + RuntimeError, + ) + pages = [] + async for page in (await client.search_profiles(request={})).pages: + pages.append(page) + for page, token in zip(pages, ["abc", "def", "ghi", ""]): + assert page.raw_page.next_page_token == token + + +def test_credentials_transport_error(): + # It is an error to provide credentials and a transport instance. + transport = transports.ProfileServiceGrpcTransport( + credentials=credentials.AnonymousCredentials(), + ) + with pytest.raises(ValueError): + client = ProfileServiceClient( + credentials=credentials.AnonymousCredentials(), transport=transport, + ) + + # It is an error to provide a credentials file and a transport instance. + transport = transports.ProfileServiceGrpcTransport( + credentials=credentials.AnonymousCredentials(), + ) + with pytest.raises(ValueError): + client = ProfileServiceClient( + client_options={"credentials_file": "credentials.json"}, + transport=transport, + ) + + # It is an error to provide scopes and a transport instance. + transport = transports.ProfileServiceGrpcTransport( + credentials=credentials.AnonymousCredentials(), + ) + with pytest.raises(ValueError): + client = ProfileServiceClient( + client_options={"scopes": ["1", "2"]}, transport=transport, + ) + + +def test_transport_instance(): + # A client may be instantiated with a custom transport instance. + transport = transports.ProfileServiceGrpcTransport( + credentials=credentials.AnonymousCredentials(), + ) + client = ProfileServiceClient(transport=transport) + assert client._transport is transport + + +def test_transport_get_channel(): + # A client may be instantiated with a custom transport instance. + transport = transports.ProfileServiceGrpcTransport( + credentials=credentials.AnonymousCredentials(), + ) + channel = transport.grpc_channel + assert channel + + transport = transports.ProfileServiceGrpcAsyncIOTransport( + credentials=credentials.AnonymousCredentials(), + ) + channel = transport.grpc_channel + assert channel + + +def test_transport_grpc_default(): + # A client should use the gRPC transport by default. + client = ProfileServiceClient(credentials=credentials.AnonymousCredentials(),) + assert isinstance(client._transport, transports.ProfileServiceGrpcTransport,) + + +def test_profile_service_base_transport_error(): + # Passing both a credentials object and credentials_file should raise an error + with pytest.raises(exceptions.DuplicateCredentialArgs): + transport = transports.ProfileServiceTransport( + credentials=credentials.AnonymousCredentials(), + credentials_file="credentials.json", + ) + + +def test_profile_service_base_transport(): + # Instantiate the base transport. + with mock.patch( + "google.cloud.talent_v4beta1.services.profile_service.transports.ProfileServiceTransport.__init__" + ) as Transport: + Transport.return_value = None + transport = transports.ProfileServiceTransport( + credentials=credentials.AnonymousCredentials(), + ) + + # Every method on the transport should just blindly + # raise NotImplementedError. + methods = ( + "list_profiles", + "create_profile", + "get_profile", + "update_profile", + "delete_profile", + "search_profiles", + ) + for method in methods: + with pytest.raises(NotImplementedError): + getattr(transport, method)(request=object()) + + +def test_profile_service_base_transport_with_credentials_file(): + # Instantiate the base transport with a credentials file + with mock.patch.object( + auth, "load_credentials_from_file" + ) as load_creds, mock.patch( + "google.cloud.talent_v4beta1.services.profile_service.transports.ProfileServiceTransport._prep_wrapped_messages" + ) as Transport: + Transport.return_value = None + load_creds.return_value = (credentials.AnonymousCredentials(), None) + transport = transports.ProfileServiceTransport( + credentials_file="credentials.json", quota_project_id="octopus", + ) + load_creds.assert_called_once_with( + "credentials.json", + scopes=( + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/jobs", + ), + quota_project_id="octopus", + ) + + +def test_profile_service_auth_adc(): + # If no credentials are provided, we should use ADC credentials. + with mock.patch.object(auth, "default") as adc: + adc.return_value = (credentials.AnonymousCredentials(), None) + ProfileServiceClient() + adc.assert_called_once_with( + scopes=( + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/jobs", + ), + quota_project_id=None, + ) + + +def test_profile_service_transport_auth_adc(): + # If credentials and host are not provided, the transport class should use + # ADC credentials. + with mock.patch.object(auth, "default") as adc: + adc.return_value = (credentials.AnonymousCredentials(), None) + transports.ProfileServiceGrpcTransport( + host="squid.clam.whelk", quota_project_id="octopus" + ) + adc.assert_called_once_with( + scopes=( + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/jobs", + ), + quota_project_id="octopus", + ) + + +def test_profile_service_host_no_port(): + client = ProfileServiceClient( + credentials=credentials.AnonymousCredentials(), + client_options=client_options.ClientOptions(api_endpoint="jobs.googleapis.com"), + ) + assert client._transport._host == "jobs.googleapis.com:443" + + +def test_profile_service_host_with_port(): + client = ProfileServiceClient( + credentials=credentials.AnonymousCredentials(), + client_options=client_options.ClientOptions( + api_endpoint="jobs.googleapis.com:8000" + ), + ) + assert client._transport._host == "jobs.googleapis.com:8000" + + +def test_profile_service_grpc_transport_channel(): + channel = grpc.insecure_channel("http://localhost/") + + # Check that if channel is provided, mtls endpoint and client_cert_source + # won't be used. + callback = mock.MagicMock() + transport = transports.ProfileServiceGrpcTransport( + host="squid.clam.whelk", + channel=channel, + api_mtls_endpoint="mtls.squid.clam.whelk", + client_cert_source=callback, + ) + assert transport.grpc_channel == channel + assert transport._host == "squid.clam.whelk:443" + assert not callback.called + + +def test_profile_service_grpc_asyncio_transport_channel(): + channel = aio.insecure_channel("http://localhost/") + + # Check that if channel is provided, mtls endpoint and client_cert_source + # won't be used. + callback = mock.MagicMock() + transport = transports.ProfileServiceGrpcAsyncIOTransport( + host="squid.clam.whelk", + channel=channel, + api_mtls_endpoint="mtls.squid.clam.whelk", + client_cert_source=callback, + ) + assert transport.grpc_channel == channel + assert transport._host == "squid.clam.whelk:443" + assert not callback.called + + +@mock.patch("grpc.ssl_channel_credentials", autospec=True) +@mock.patch("google.api_core.grpc_helpers.create_channel", autospec=True) +def test_profile_service_grpc_transport_channel_mtls_with_client_cert_source( + grpc_create_channel, grpc_ssl_channel_cred +): + # Check that if channel is None, but api_mtls_endpoint and client_cert_source + # are provided, then a mTLS channel will be created. + mock_cred = mock.Mock() + + mock_ssl_cred = mock.Mock() + grpc_ssl_channel_cred.return_value = mock_ssl_cred + + mock_grpc_channel = mock.Mock() + grpc_create_channel.return_value = mock_grpc_channel + + transport = transports.ProfileServiceGrpcTransport( + host="squid.clam.whelk", + credentials=mock_cred, + api_mtls_endpoint="mtls.squid.clam.whelk", + client_cert_source=client_cert_source_callback, + ) + grpc_ssl_channel_cred.assert_called_once_with( + certificate_chain=b"cert bytes", private_key=b"key bytes" + ) + grpc_create_channel.assert_called_once_with( + "mtls.squid.clam.whelk:443", + credentials=mock_cred, + credentials_file=None, + scopes=( + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/jobs", + ), + ssl_credentials=mock_ssl_cred, + quota_project_id=None, + ) + assert transport.grpc_channel == mock_grpc_channel + + +@mock.patch("grpc.ssl_channel_credentials", autospec=True) +@mock.patch("google.api_core.grpc_helpers_async.create_channel", autospec=True) +def test_profile_service_grpc_asyncio_transport_channel_mtls_with_client_cert_source( + grpc_create_channel, grpc_ssl_channel_cred +): + # Check that if channel is None, but api_mtls_endpoint and client_cert_source + # are provided, then a mTLS channel will be created. + mock_cred = mock.Mock() + + mock_ssl_cred = mock.Mock() + grpc_ssl_channel_cred.return_value = mock_ssl_cred + + mock_grpc_channel = mock.Mock() + grpc_create_channel.return_value = mock_grpc_channel + + transport = transports.ProfileServiceGrpcAsyncIOTransport( + host="squid.clam.whelk", + credentials=mock_cred, + api_mtls_endpoint="mtls.squid.clam.whelk", + client_cert_source=client_cert_source_callback, + ) + grpc_ssl_channel_cred.assert_called_once_with( + certificate_chain=b"cert bytes", private_key=b"key bytes" + ) + grpc_create_channel.assert_called_once_with( + "mtls.squid.clam.whelk:443", + credentials=mock_cred, + credentials_file=None, + scopes=( + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/jobs", + ), + ssl_credentials=mock_ssl_cred, + quota_project_id=None, + ) + assert transport.grpc_channel == mock_grpc_channel + + +@pytest.mark.parametrize( + "api_mtls_endpoint", ["mtls.squid.clam.whelk", "mtls.squid.clam.whelk:443"] +) +@mock.patch("google.api_core.grpc_helpers.create_channel", autospec=True) +def test_profile_service_grpc_transport_channel_mtls_with_adc( + grpc_create_channel, api_mtls_endpoint +): + # Check that if channel and client_cert_source are None, but api_mtls_endpoint + # is provided, then a mTLS channel will be created with SSL ADC. + mock_grpc_channel = mock.Mock() + grpc_create_channel.return_value = mock_grpc_channel + + # Mock google.auth.transport.grpc.SslCredentials class. + mock_ssl_cred = mock.Mock() + with mock.patch.multiple( + "google.auth.transport.grpc.SslCredentials", + __init__=mock.Mock(return_value=None), + ssl_credentials=mock.PropertyMock(return_value=mock_ssl_cred), + ): + mock_cred = mock.Mock() + transport = transports.ProfileServiceGrpcTransport( + host="squid.clam.whelk", + credentials=mock_cred, + api_mtls_endpoint=api_mtls_endpoint, + client_cert_source=None, + ) + grpc_create_channel.assert_called_once_with( + "mtls.squid.clam.whelk:443", + credentials=mock_cred, + credentials_file=None, + scopes=( + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/jobs", + ), + ssl_credentials=mock_ssl_cred, + quota_project_id=None, + ) + assert transport.grpc_channel == mock_grpc_channel + + +@pytest.mark.parametrize( + "api_mtls_endpoint", ["mtls.squid.clam.whelk", "mtls.squid.clam.whelk:443"] +) +@mock.patch("google.api_core.grpc_helpers_async.create_channel", autospec=True) +def test_profile_service_grpc_asyncio_transport_channel_mtls_with_adc( + grpc_create_channel, api_mtls_endpoint +): + # Check that if channel and client_cert_source are None, but api_mtls_endpoint + # is provided, then a mTLS channel will be created with SSL ADC. + mock_grpc_channel = mock.Mock() + grpc_create_channel.return_value = mock_grpc_channel + + # Mock google.auth.transport.grpc.SslCredentials class. + mock_ssl_cred = mock.Mock() + with mock.patch.multiple( + "google.auth.transport.grpc.SslCredentials", + __init__=mock.Mock(return_value=None), + ssl_credentials=mock.PropertyMock(return_value=mock_ssl_cred), + ): + mock_cred = mock.Mock() + transport = transports.ProfileServiceGrpcAsyncIOTransport( + host="squid.clam.whelk", + credentials=mock_cred, + api_mtls_endpoint=api_mtls_endpoint, + client_cert_source=None, + ) + grpc_create_channel.assert_called_once_with( + "mtls.squid.clam.whelk:443", + credentials=mock_cred, + credentials_file=None, + scopes=( + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/jobs", + ), + ssl_credentials=mock_ssl_cred, + quota_project_id=None, + ) + assert transport.grpc_channel == mock_grpc_channel + + +def test_profile_path(): + project = "squid" + tenant = "clam" + profile = "whelk" + + expected = "projects/{project}/tenants/{tenant}/profiles/{profile}".format( + project=project, tenant=tenant, profile=profile, + ) + actual = ProfileServiceClient.profile_path(project, tenant, profile) + assert expected == actual + + +def test_parse_profile_path(): + expected = { + "project": "octopus", + "tenant": "oyster", + "profile": "nudibranch", + } + path = ProfileServiceClient.profile_path(**expected) + + # Check that the path construction is reversible. + actual = ProfileServiceClient.parse_profile_path(path) + assert expected == actual diff --git a/tests/unit/gapic/talent_v4beta1/test_tenant_service.py b/tests/unit/gapic/talent_v4beta1/test_tenant_service.py new file mode 100644 index 00000000..cfbd0058 --- /dev/null +++ b/tests/unit/gapic/talent_v4beta1/test_tenant_service.py @@ -0,0 +1,1889 @@ +# -*- 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. +# + +import os +import mock + +import grpc +from grpc.experimental import aio +import math +import pytest +from proto.marshal.rules.dates import DurationRule, TimestampRule + +from google import auth +from google.api_core import client_options +from google.api_core import exceptions +from google.api_core import gapic_v1 +from google.api_core import grpc_helpers +from google.api_core import grpc_helpers_async +from google.auth import credentials +from google.auth.exceptions import MutualTLSChannelError +from google.cloud.talent_v4beta1.services.tenant_service import TenantServiceAsyncClient +from google.cloud.talent_v4beta1.services.tenant_service import TenantServiceClient +from google.cloud.talent_v4beta1.services.tenant_service import pagers +from google.cloud.talent_v4beta1.services.tenant_service import transports +from google.cloud.talent_v4beta1.types import tenant +from google.cloud.talent_v4beta1.types import tenant as gct_tenant +from google.cloud.talent_v4beta1.types import tenant_service +from google.oauth2 import service_account +from google.protobuf import field_mask_pb2 as field_mask # type: ignore + + +def client_cert_source_callback(): + return b"cert bytes", b"key bytes" + + +# If default endpoint is localhost, then default mtls endpoint will be the same. +# This method modifies the default endpoint so the client can produce a different +# mtls endpoint for endpoint testing purposes. +def modify_default_endpoint(client): + return ( + "foo.googleapis.com" + if ("localhost" in client.DEFAULT_ENDPOINT) + else client.DEFAULT_ENDPOINT + ) + + +def test__get_default_mtls_endpoint(): + api_endpoint = "example.googleapis.com" + api_mtls_endpoint = "example.mtls.googleapis.com" + sandbox_endpoint = "example.sandbox.googleapis.com" + sandbox_mtls_endpoint = "example.mtls.sandbox.googleapis.com" + non_googleapi = "api.example.com" + + assert TenantServiceClient._get_default_mtls_endpoint(None) is None + assert ( + TenantServiceClient._get_default_mtls_endpoint(api_endpoint) + == api_mtls_endpoint + ) + assert ( + TenantServiceClient._get_default_mtls_endpoint(api_mtls_endpoint) + == api_mtls_endpoint + ) + assert ( + TenantServiceClient._get_default_mtls_endpoint(sandbox_endpoint) + == sandbox_mtls_endpoint + ) + assert ( + TenantServiceClient._get_default_mtls_endpoint(sandbox_mtls_endpoint) + == sandbox_mtls_endpoint + ) + assert ( + TenantServiceClient._get_default_mtls_endpoint(non_googleapi) == non_googleapi + ) + + +@pytest.mark.parametrize( + "client_class", [TenantServiceClient, TenantServiceAsyncClient] +) +def test_tenant_service_client_from_service_account_file(client_class): + creds = credentials.AnonymousCredentials() + with mock.patch.object( + service_account.Credentials, "from_service_account_file" + ) as factory: + factory.return_value = creds + client = client_class.from_service_account_file("dummy/file/path.json") + assert client._transport._credentials == creds + + client = client_class.from_service_account_json("dummy/file/path.json") + assert client._transport._credentials == creds + + assert client._transport._host == "jobs.googleapis.com:443" + + +def test_tenant_service_client_get_transport_class(): + transport = TenantServiceClient.get_transport_class() + assert transport == transports.TenantServiceGrpcTransport + + transport = TenantServiceClient.get_transport_class("grpc") + assert transport == transports.TenantServiceGrpcTransport + + +@pytest.mark.parametrize( + "client_class,transport_class,transport_name", + [ + (TenantServiceClient, transports.TenantServiceGrpcTransport, "grpc"), + ( + TenantServiceAsyncClient, + transports.TenantServiceGrpcAsyncIOTransport, + "grpc_asyncio", + ), + ], +) +@mock.patch.object( + TenantServiceClient, + "DEFAULT_ENDPOINT", + modify_default_endpoint(TenantServiceClient), +) +@mock.patch.object( + TenantServiceAsyncClient, + "DEFAULT_ENDPOINT", + modify_default_endpoint(TenantServiceAsyncClient), +) +def test_tenant_service_client_client_options( + client_class, transport_class, transport_name +): + # Check that if channel is provided we won't create a new one. + with mock.patch.object(TenantServiceClient, "get_transport_class") as gtc: + transport = transport_class(credentials=credentials.AnonymousCredentials()) + client = client_class(transport=transport) + gtc.assert_not_called() + + # Check that if channel is provided via str we will create a new one. + with mock.patch.object(TenantServiceClient, "get_transport_class") as gtc: + client = client_class(transport=transport_name) + gtc.assert_called() + + # Check the case api_endpoint is provided. + options = client_options.ClientOptions(api_endpoint="squid.clam.whelk") + with mock.patch.object(transport_class, "__init__") as patched: + patched.return_value = None + client = client_class(client_options=options) + patched.assert_called_once_with( + credentials=None, + credentials_file=None, + host="squid.clam.whelk", + scopes=None, + api_mtls_endpoint="squid.clam.whelk", + client_cert_source=None, + quota_project_id=None, + ) + + # Check the case api_endpoint is not provided and GOOGLE_API_USE_MTLS is + # "never". + with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS": "never"}): + with mock.patch.object(transport_class, "__init__") as patched: + patched.return_value = None + client = client_class() + patched.assert_called_once_with( + credentials=None, + credentials_file=None, + host=client.DEFAULT_ENDPOINT, + scopes=None, + api_mtls_endpoint=client.DEFAULT_ENDPOINT, + client_cert_source=None, + quota_project_id=None, + ) + + # Check the case api_endpoint is not provided and GOOGLE_API_USE_MTLS is + # "always". + with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS": "always"}): + with mock.patch.object(transport_class, "__init__") as patched: + patched.return_value = None + client = client_class() + patched.assert_called_once_with( + credentials=None, + credentials_file=None, + host=client.DEFAULT_MTLS_ENDPOINT, + scopes=None, + api_mtls_endpoint=client.DEFAULT_MTLS_ENDPOINT, + client_cert_source=None, + quota_project_id=None, + ) + + # Check the case api_endpoint is not provided, GOOGLE_API_USE_MTLS is + # "auto", and client_cert_source is provided. + with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS": "auto"}): + options = client_options.ClientOptions( + client_cert_source=client_cert_source_callback + ) + with mock.patch.object(transport_class, "__init__") as patched: + patched.return_value = None + client = client_class(client_options=options) + patched.assert_called_once_with( + credentials=None, + credentials_file=None, + host=client.DEFAULT_MTLS_ENDPOINT, + scopes=None, + api_mtls_endpoint=client.DEFAULT_MTLS_ENDPOINT, + client_cert_source=client_cert_source_callback, + quota_project_id=None, + ) + + # Check the case api_endpoint is not provided, GOOGLE_API_USE_MTLS is + # "auto", and default_client_cert_source is provided. + with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS": "auto"}): + with mock.patch.object(transport_class, "__init__") as patched: + with mock.patch( + "google.auth.transport.mtls.has_default_client_cert_source", + return_value=True, + ): + patched.return_value = None + client = client_class() + patched.assert_called_once_with( + credentials=None, + credentials_file=None, + host=client.DEFAULT_MTLS_ENDPOINT, + scopes=None, + api_mtls_endpoint=client.DEFAULT_MTLS_ENDPOINT, + client_cert_source=None, + quota_project_id=None, + ) + + # Check the case api_endpoint is not provided, GOOGLE_API_USE_MTLS is + # "auto", but client_cert_source and default_client_cert_source are None. + with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS": "auto"}): + with mock.patch.object(transport_class, "__init__") as patched: + with mock.patch( + "google.auth.transport.mtls.has_default_client_cert_source", + return_value=False, + ): + patched.return_value = None + client = client_class() + patched.assert_called_once_with( + credentials=None, + credentials_file=None, + host=client.DEFAULT_ENDPOINT, + scopes=None, + api_mtls_endpoint=client.DEFAULT_ENDPOINT, + client_cert_source=None, + quota_project_id=None, + ) + + # Check the case api_endpoint is not provided and GOOGLE_API_USE_MTLS has + # unsupported value. + with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS": "Unsupported"}): + with pytest.raises(MutualTLSChannelError): + client = client_class() + + # Check the case quota_project_id is provided + options = client_options.ClientOptions(quota_project_id="octopus") + with mock.patch.object(transport_class, "__init__") as patched: + patched.return_value = None + client = client_class(client_options=options) + patched.assert_called_once_with( + credentials=None, + credentials_file=None, + host=client.DEFAULT_ENDPOINT, + scopes=None, + api_mtls_endpoint=client.DEFAULT_ENDPOINT, + client_cert_source=None, + quota_project_id="octopus", + ) + + +@pytest.mark.parametrize( + "client_class,transport_class,transport_name", + [ + (TenantServiceClient, transports.TenantServiceGrpcTransport, "grpc"), + ( + TenantServiceAsyncClient, + transports.TenantServiceGrpcAsyncIOTransport, + "grpc_asyncio", + ), + ], +) +def test_tenant_service_client_client_options_scopes( + client_class, transport_class, transport_name +): + # Check the case scopes are provided. + options = client_options.ClientOptions(scopes=["1", "2"],) + with mock.patch.object(transport_class, "__init__") as patched: + patched.return_value = None + client = client_class(client_options=options) + patched.assert_called_once_with( + credentials=None, + credentials_file=None, + host=client.DEFAULT_ENDPOINT, + scopes=["1", "2"], + api_mtls_endpoint=client.DEFAULT_ENDPOINT, + client_cert_source=None, + quota_project_id=None, + ) + + +@pytest.mark.parametrize( + "client_class,transport_class,transport_name", + [ + (TenantServiceClient, transports.TenantServiceGrpcTransport, "grpc"), + ( + TenantServiceAsyncClient, + transports.TenantServiceGrpcAsyncIOTransport, + "grpc_asyncio", + ), + ], +) +def test_tenant_service_client_client_options_credentials_file( + client_class, transport_class, transport_name +): + # Check the case credentials file is provided. + options = client_options.ClientOptions(credentials_file="credentials.json") + with mock.patch.object(transport_class, "__init__") as patched: + patched.return_value = None + client = client_class(client_options=options) + patched.assert_called_once_with( + credentials=None, + credentials_file="credentials.json", + host=client.DEFAULT_ENDPOINT, + scopes=None, + api_mtls_endpoint=client.DEFAULT_ENDPOINT, + client_cert_source=None, + quota_project_id=None, + ) + + +def test_tenant_service_client_client_options_from_dict(): + with mock.patch( + "google.cloud.talent_v4beta1.services.tenant_service.transports.TenantServiceGrpcTransport.__init__" + ) as grpc_transport: + grpc_transport.return_value = None + client = TenantServiceClient( + client_options={"api_endpoint": "squid.clam.whelk"} + ) + grpc_transport.assert_called_once_with( + credentials=None, + credentials_file=None, + host="squid.clam.whelk", + scopes=None, + api_mtls_endpoint="squid.clam.whelk", + client_cert_source=None, + quota_project_id=None, + ) + + +def test_create_tenant( + transport: str = "grpc", request_type=tenant_service.CreateTenantRequest +): + client = TenantServiceClient( + credentials=credentials.AnonymousCredentials(), transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client._transport.create_tenant), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = gct_tenant.Tenant( + name="name_value", + external_id="external_id_value", + usage_type=gct_tenant.Tenant.DataUsageType.AGGREGATED, + keyword_searchable_profile_custom_attributes=[ + "keyword_searchable_profile_custom_attributes_value" + ], + ) + + response = client.create_tenant(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + + assert args[0] == tenant_service.CreateTenantRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, gct_tenant.Tenant) + + assert response.name == "name_value" + + assert response.external_id == "external_id_value" + + assert response.usage_type == gct_tenant.Tenant.DataUsageType.AGGREGATED + + assert response.keyword_searchable_profile_custom_attributes == [ + "keyword_searchable_profile_custom_attributes_value" + ] + + +def test_create_tenant_from_dict(): + test_create_tenant(request_type=dict) + + +@pytest.mark.asyncio +async def test_create_tenant_async(transport: str = "grpc_asyncio"): + client = TenantServiceAsyncClient( + credentials=credentials.AnonymousCredentials(), transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = tenant_service.CreateTenantRequest() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client._client._transport.create_tenant), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + gct_tenant.Tenant( + name="name_value", + external_id="external_id_value", + usage_type=gct_tenant.Tenant.DataUsageType.AGGREGATED, + keyword_searchable_profile_custom_attributes=[ + "keyword_searchable_profile_custom_attributes_value" + ], + ) + ) + + response = await client.create_tenant(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + + assert args[0] == request + + # Establish that the response is the type that we expect. + assert isinstance(response, gct_tenant.Tenant) + + assert response.name == "name_value" + + assert response.external_id == "external_id_value" + + assert response.usage_type == gct_tenant.Tenant.DataUsageType.AGGREGATED + + assert response.keyword_searchable_profile_custom_attributes == [ + "keyword_searchable_profile_custom_attributes_value" + ] + + +def test_create_tenant_field_headers(): + client = TenantServiceClient(credentials=credentials.AnonymousCredentials(),) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = tenant_service.CreateTenantRequest() + request.parent = "parent/value" + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client._transport.create_tenant), "__call__") as call: + call.return_value = gct_tenant.Tenant() + + client.create_tenant(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + + +@pytest.mark.asyncio +async def test_create_tenant_field_headers_async(): + client = TenantServiceAsyncClient(credentials=credentials.AnonymousCredentials(),) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = tenant_service.CreateTenantRequest() + request.parent = "parent/value" + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client._client._transport.create_tenant), "__call__" + ) as call: + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(gct_tenant.Tenant()) + + await client.create_tenant(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + + +def test_create_tenant_flattened(): + client = TenantServiceClient(credentials=credentials.AnonymousCredentials(),) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client._transport.create_tenant), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = gct_tenant.Tenant() + + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + client.create_tenant( + parent="parent_value", tenant=gct_tenant.Tenant(name="name_value"), + ) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + + assert args[0].parent == "parent_value" + + assert args[0].tenant == gct_tenant.Tenant(name="name_value") + + +def test_create_tenant_flattened_error(): + client = TenantServiceClient(credentials=credentials.AnonymousCredentials(),) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + client.create_tenant( + tenant_service.CreateTenantRequest(), + parent="parent_value", + tenant=gct_tenant.Tenant(name="name_value"), + ) + + +@pytest.mark.asyncio +async def test_create_tenant_flattened_async(): + client = TenantServiceAsyncClient(credentials=credentials.AnonymousCredentials(),) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client._client._transport.create_tenant), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = gct_tenant.Tenant() + + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(gct_tenant.Tenant()) + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + response = await client.create_tenant( + parent="parent_value", tenant=gct_tenant.Tenant(name="name_value"), + ) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + + assert args[0].parent == "parent_value" + + assert args[0].tenant == gct_tenant.Tenant(name="name_value") + + +@pytest.mark.asyncio +async def test_create_tenant_flattened_error_async(): + client = TenantServiceAsyncClient(credentials=credentials.AnonymousCredentials(),) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + await client.create_tenant( + tenant_service.CreateTenantRequest(), + parent="parent_value", + tenant=gct_tenant.Tenant(name="name_value"), + ) + + +def test_get_tenant( + transport: str = "grpc", request_type=tenant_service.GetTenantRequest +): + client = TenantServiceClient( + credentials=credentials.AnonymousCredentials(), transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client._transport.get_tenant), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = tenant.Tenant( + name="name_value", + external_id="external_id_value", + usage_type=tenant.Tenant.DataUsageType.AGGREGATED, + keyword_searchable_profile_custom_attributes=[ + "keyword_searchable_profile_custom_attributes_value" + ], + ) + + response = client.get_tenant(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + + assert args[0] == tenant_service.GetTenantRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, tenant.Tenant) + + assert response.name == "name_value" + + assert response.external_id == "external_id_value" + + assert response.usage_type == tenant.Tenant.DataUsageType.AGGREGATED + + assert response.keyword_searchable_profile_custom_attributes == [ + "keyword_searchable_profile_custom_attributes_value" + ] + + +def test_get_tenant_from_dict(): + test_get_tenant(request_type=dict) + + +@pytest.mark.asyncio +async def test_get_tenant_async(transport: str = "grpc_asyncio"): + client = TenantServiceAsyncClient( + credentials=credentials.AnonymousCredentials(), transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = tenant_service.GetTenantRequest() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client._client._transport.get_tenant), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + tenant.Tenant( + name="name_value", + external_id="external_id_value", + usage_type=tenant.Tenant.DataUsageType.AGGREGATED, + keyword_searchable_profile_custom_attributes=[ + "keyword_searchable_profile_custom_attributes_value" + ], + ) + ) + + response = await client.get_tenant(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + + assert args[0] == request + + # Establish that the response is the type that we expect. + assert isinstance(response, tenant.Tenant) + + assert response.name == "name_value" + + assert response.external_id == "external_id_value" + + assert response.usage_type == tenant.Tenant.DataUsageType.AGGREGATED + + assert response.keyword_searchable_profile_custom_attributes == [ + "keyword_searchable_profile_custom_attributes_value" + ] + + +def test_get_tenant_field_headers(): + client = TenantServiceClient(credentials=credentials.AnonymousCredentials(),) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = tenant_service.GetTenantRequest() + request.name = "name/value" + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client._transport.get_tenant), "__call__") as call: + call.return_value = tenant.Tenant() + + client.get_tenant(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + + +@pytest.mark.asyncio +async def test_get_tenant_field_headers_async(): + client = TenantServiceAsyncClient(credentials=credentials.AnonymousCredentials(),) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = tenant_service.GetTenantRequest() + request.name = "name/value" + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client._client._transport.get_tenant), "__call__" + ) as call: + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(tenant.Tenant()) + + await client.get_tenant(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + + +def test_get_tenant_flattened(): + client = TenantServiceClient(credentials=credentials.AnonymousCredentials(),) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client._transport.get_tenant), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = tenant.Tenant() + + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + client.get_tenant(name="name_value",) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + + assert args[0].name == "name_value" + + +def test_get_tenant_flattened_error(): + client = TenantServiceClient(credentials=credentials.AnonymousCredentials(),) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + client.get_tenant( + tenant_service.GetTenantRequest(), name="name_value", + ) + + +@pytest.mark.asyncio +async def test_get_tenant_flattened_async(): + client = TenantServiceAsyncClient(credentials=credentials.AnonymousCredentials(),) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client._client._transport.get_tenant), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = tenant.Tenant() + + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(tenant.Tenant()) + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + response = await client.get_tenant(name="name_value",) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + + assert args[0].name == "name_value" + + +@pytest.mark.asyncio +async def test_get_tenant_flattened_error_async(): + client = TenantServiceAsyncClient(credentials=credentials.AnonymousCredentials(),) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + await client.get_tenant( + tenant_service.GetTenantRequest(), name="name_value", + ) + + +def test_update_tenant( + transport: str = "grpc", request_type=tenant_service.UpdateTenantRequest +): + client = TenantServiceClient( + credentials=credentials.AnonymousCredentials(), transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client._transport.update_tenant), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = gct_tenant.Tenant( + name="name_value", + external_id="external_id_value", + usage_type=gct_tenant.Tenant.DataUsageType.AGGREGATED, + keyword_searchable_profile_custom_attributes=[ + "keyword_searchable_profile_custom_attributes_value" + ], + ) + + response = client.update_tenant(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + + assert args[0] == tenant_service.UpdateTenantRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, gct_tenant.Tenant) + + assert response.name == "name_value" + + assert response.external_id == "external_id_value" + + assert response.usage_type == gct_tenant.Tenant.DataUsageType.AGGREGATED + + assert response.keyword_searchable_profile_custom_attributes == [ + "keyword_searchable_profile_custom_attributes_value" + ] + + +def test_update_tenant_from_dict(): + test_update_tenant(request_type=dict) + + +@pytest.mark.asyncio +async def test_update_tenant_async(transport: str = "grpc_asyncio"): + client = TenantServiceAsyncClient( + credentials=credentials.AnonymousCredentials(), transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = tenant_service.UpdateTenantRequest() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client._client._transport.update_tenant), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + gct_tenant.Tenant( + name="name_value", + external_id="external_id_value", + usage_type=gct_tenant.Tenant.DataUsageType.AGGREGATED, + keyword_searchable_profile_custom_attributes=[ + "keyword_searchable_profile_custom_attributes_value" + ], + ) + ) + + response = await client.update_tenant(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + + assert args[0] == request + + # Establish that the response is the type that we expect. + assert isinstance(response, gct_tenant.Tenant) + + assert response.name == "name_value" + + assert response.external_id == "external_id_value" + + assert response.usage_type == gct_tenant.Tenant.DataUsageType.AGGREGATED + + assert response.keyword_searchable_profile_custom_attributes == [ + "keyword_searchable_profile_custom_attributes_value" + ] + + +def test_update_tenant_field_headers(): + client = TenantServiceClient(credentials=credentials.AnonymousCredentials(),) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = tenant_service.UpdateTenantRequest() + request.tenant.name = "tenant.name/value" + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client._transport.update_tenant), "__call__") as call: + call.return_value = gct_tenant.Tenant() + + client.update_tenant(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ("x-goog-request-params", "tenant.name=tenant.name/value",) in kw["metadata"] + + +@pytest.mark.asyncio +async def test_update_tenant_field_headers_async(): + client = TenantServiceAsyncClient(credentials=credentials.AnonymousCredentials(),) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = tenant_service.UpdateTenantRequest() + request.tenant.name = "tenant.name/value" + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client._client._transport.update_tenant), "__call__" + ) as call: + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(gct_tenant.Tenant()) + + await client.update_tenant(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ("x-goog-request-params", "tenant.name=tenant.name/value",) in kw["metadata"] + + +def test_update_tenant_flattened(): + client = TenantServiceClient(credentials=credentials.AnonymousCredentials(),) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client._transport.update_tenant), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = gct_tenant.Tenant() + + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + client.update_tenant(tenant=gct_tenant.Tenant(name="name_value"),) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + + assert args[0].tenant == gct_tenant.Tenant(name="name_value") + + +def test_update_tenant_flattened_error(): + client = TenantServiceClient(credentials=credentials.AnonymousCredentials(),) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + client.update_tenant( + tenant_service.UpdateTenantRequest(), + tenant=gct_tenant.Tenant(name="name_value"), + ) + + +@pytest.mark.asyncio +async def test_update_tenant_flattened_async(): + client = TenantServiceAsyncClient(credentials=credentials.AnonymousCredentials(),) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client._client._transport.update_tenant), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = gct_tenant.Tenant() + + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(gct_tenant.Tenant()) + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + response = await client.update_tenant( + tenant=gct_tenant.Tenant(name="name_value"), + ) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + + assert args[0].tenant == gct_tenant.Tenant(name="name_value") + + +@pytest.mark.asyncio +async def test_update_tenant_flattened_error_async(): + client = TenantServiceAsyncClient(credentials=credentials.AnonymousCredentials(),) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + await client.update_tenant( + tenant_service.UpdateTenantRequest(), + tenant=gct_tenant.Tenant(name="name_value"), + ) + + +def test_delete_tenant( + transport: str = "grpc", request_type=tenant_service.DeleteTenantRequest +): + client = TenantServiceClient( + credentials=credentials.AnonymousCredentials(), transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client._transport.delete_tenant), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = None + + response = client.delete_tenant(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + + assert args[0] == tenant_service.DeleteTenantRequest() + + # Establish that the response is the type that we expect. + assert response is None + + +def test_delete_tenant_from_dict(): + test_delete_tenant(request_type=dict) + + +@pytest.mark.asyncio +async def test_delete_tenant_async(transport: str = "grpc_asyncio"): + client = TenantServiceAsyncClient( + credentials=credentials.AnonymousCredentials(), transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = tenant_service.DeleteTenantRequest() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client._client._transport.delete_tenant), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(None) + + response = await client.delete_tenant(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + + assert args[0] == request + + # Establish that the response is the type that we expect. + assert response is None + + +def test_delete_tenant_field_headers(): + client = TenantServiceClient(credentials=credentials.AnonymousCredentials(),) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = tenant_service.DeleteTenantRequest() + request.name = "name/value" + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client._transport.delete_tenant), "__call__") as call: + call.return_value = None + + client.delete_tenant(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + + +@pytest.mark.asyncio +async def test_delete_tenant_field_headers_async(): + client = TenantServiceAsyncClient(credentials=credentials.AnonymousCredentials(),) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = tenant_service.DeleteTenantRequest() + request.name = "name/value" + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client._client._transport.delete_tenant), "__call__" + ) as call: + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(None) + + await client.delete_tenant(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + + +def test_delete_tenant_flattened(): + client = TenantServiceClient(credentials=credentials.AnonymousCredentials(),) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client._transport.delete_tenant), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = None + + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + client.delete_tenant(name="name_value",) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + + assert args[0].name == "name_value" + + +def test_delete_tenant_flattened_error(): + client = TenantServiceClient(credentials=credentials.AnonymousCredentials(),) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + client.delete_tenant( + tenant_service.DeleteTenantRequest(), name="name_value", + ) + + +@pytest.mark.asyncio +async def test_delete_tenant_flattened_async(): + client = TenantServiceAsyncClient(credentials=credentials.AnonymousCredentials(),) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client._client._transport.delete_tenant), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = None + + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(None) + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + response = await client.delete_tenant(name="name_value",) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + + assert args[0].name == "name_value" + + +@pytest.mark.asyncio +async def test_delete_tenant_flattened_error_async(): + client = TenantServiceAsyncClient(credentials=credentials.AnonymousCredentials(),) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + await client.delete_tenant( + tenant_service.DeleteTenantRequest(), name="name_value", + ) + + +def test_list_tenants( + transport: str = "grpc", request_type=tenant_service.ListTenantsRequest +): + client = TenantServiceClient( + credentials=credentials.AnonymousCredentials(), transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client._transport.list_tenants), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = tenant_service.ListTenantsResponse( + next_page_token="next_page_token_value", + ) + + response = client.list_tenants(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + + assert args[0] == tenant_service.ListTenantsRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, pagers.ListTenantsPager) + + assert response.next_page_token == "next_page_token_value" + + +def test_list_tenants_from_dict(): + test_list_tenants(request_type=dict) + + +@pytest.mark.asyncio +async def test_list_tenants_async(transport: str = "grpc_asyncio"): + client = TenantServiceAsyncClient( + credentials=credentials.AnonymousCredentials(), transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = tenant_service.ListTenantsRequest() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client._client._transport.list_tenants), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + tenant_service.ListTenantsResponse(next_page_token="next_page_token_value",) + ) + + response = await client.list_tenants(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + + assert args[0] == request + + # Establish that the response is the type that we expect. + assert isinstance(response, pagers.ListTenantsAsyncPager) + + assert response.next_page_token == "next_page_token_value" + + +def test_list_tenants_field_headers(): + client = TenantServiceClient(credentials=credentials.AnonymousCredentials(),) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = tenant_service.ListTenantsRequest() + request.parent = "parent/value" + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client._transport.list_tenants), "__call__") as call: + call.return_value = tenant_service.ListTenantsResponse() + + client.list_tenants(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + + +@pytest.mark.asyncio +async def test_list_tenants_field_headers_async(): + client = TenantServiceAsyncClient(credentials=credentials.AnonymousCredentials(),) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = tenant_service.ListTenantsRequest() + request.parent = "parent/value" + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client._client._transport.list_tenants), "__call__" + ) as call: + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + tenant_service.ListTenantsResponse() + ) + + await client.list_tenants(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + + +def test_list_tenants_flattened(): + client = TenantServiceClient(credentials=credentials.AnonymousCredentials(),) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client._transport.list_tenants), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = tenant_service.ListTenantsResponse() + + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + client.list_tenants(parent="parent_value",) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + + assert args[0].parent == "parent_value" + + +def test_list_tenants_flattened_error(): + client = TenantServiceClient(credentials=credentials.AnonymousCredentials(),) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + client.list_tenants( + tenant_service.ListTenantsRequest(), parent="parent_value", + ) + + +@pytest.mark.asyncio +async def test_list_tenants_flattened_async(): + client = TenantServiceAsyncClient(credentials=credentials.AnonymousCredentials(),) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client._client._transport.list_tenants), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = tenant_service.ListTenantsResponse() + + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + tenant_service.ListTenantsResponse() + ) + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + response = await client.list_tenants(parent="parent_value",) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + + assert args[0].parent == "parent_value" + + +@pytest.mark.asyncio +async def test_list_tenants_flattened_error_async(): + client = TenantServiceAsyncClient(credentials=credentials.AnonymousCredentials(),) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + await client.list_tenants( + tenant_service.ListTenantsRequest(), parent="parent_value", + ) + + +def test_list_tenants_pager(): + client = TenantServiceClient(credentials=credentials.AnonymousCredentials,) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client._transport.list_tenants), "__call__") as call: + # Set the response to a series of pages. + call.side_effect = ( + tenant_service.ListTenantsResponse( + tenants=[tenant.Tenant(), tenant.Tenant(), tenant.Tenant(),], + next_page_token="abc", + ), + tenant_service.ListTenantsResponse(tenants=[], next_page_token="def",), + tenant_service.ListTenantsResponse( + tenants=[tenant.Tenant(),], next_page_token="ghi", + ), + tenant_service.ListTenantsResponse( + tenants=[tenant.Tenant(), tenant.Tenant(),], + ), + RuntimeError, + ) + + metadata = () + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata((("parent", ""),)), + ) + pager = client.list_tenants(request={}) + + assert pager._metadata == metadata + + results = [i for i in pager] + assert len(results) == 6 + assert all(isinstance(i, tenant.Tenant) for i in results) + + +def test_list_tenants_pages(): + client = TenantServiceClient(credentials=credentials.AnonymousCredentials,) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client._transport.list_tenants), "__call__") as call: + # Set the response to a series of pages. + call.side_effect = ( + tenant_service.ListTenantsResponse( + tenants=[tenant.Tenant(), tenant.Tenant(), tenant.Tenant(),], + next_page_token="abc", + ), + tenant_service.ListTenantsResponse(tenants=[], next_page_token="def",), + tenant_service.ListTenantsResponse( + tenants=[tenant.Tenant(),], next_page_token="ghi", + ), + tenant_service.ListTenantsResponse( + tenants=[tenant.Tenant(), tenant.Tenant(),], + ), + RuntimeError, + ) + pages = list(client.list_tenants(request={}).pages) + for page, token in zip(pages, ["abc", "def", "ghi", ""]): + assert page.raw_page.next_page_token == token + + +@pytest.mark.asyncio +async def test_list_tenants_async_pager(): + client = TenantServiceAsyncClient(credentials=credentials.AnonymousCredentials,) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client._client._transport.list_tenants), + "__call__", + new_callable=mock.AsyncMock, + ) as call: + # Set the response to a series of pages. + call.side_effect = ( + tenant_service.ListTenantsResponse( + tenants=[tenant.Tenant(), tenant.Tenant(), tenant.Tenant(),], + next_page_token="abc", + ), + tenant_service.ListTenantsResponse(tenants=[], next_page_token="def",), + tenant_service.ListTenantsResponse( + tenants=[tenant.Tenant(),], next_page_token="ghi", + ), + tenant_service.ListTenantsResponse( + tenants=[tenant.Tenant(), tenant.Tenant(),], + ), + RuntimeError, + ) + async_pager = await client.list_tenants(request={},) + assert async_pager.next_page_token == "abc" + responses = [] + async for response in async_pager: + responses.append(response) + + assert len(responses) == 6 + assert all(isinstance(i, tenant.Tenant) for i in responses) + + +@pytest.mark.asyncio +async def test_list_tenants_async_pages(): + client = TenantServiceAsyncClient(credentials=credentials.AnonymousCredentials,) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client._client._transport.list_tenants), + "__call__", + new_callable=mock.AsyncMock, + ) as call: + # Set the response to a series of pages. + call.side_effect = ( + tenant_service.ListTenantsResponse( + tenants=[tenant.Tenant(), tenant.Tenant(), tenant.Tenant(),], + next_page_token="abc", + ), + tenant_service.ListTenantsResponse(tenants=[], next_page_token="def",), + tenant_service.ListTenantsResponse( + tenants=[tenant.Tenant(),], next_page_token="ghi", + ), + tenant_service.ListTenantsResponse( + tenants=[tenant.Tenant(), tenant.Tenant(),], + ), + RuntimeError, + ) + pages = [] + async for page in (await client.list_tenants(request={})).pages: + pages.append(page) + for page, token in zip(pages, ["abc", "def", "ghi", ""]): + assert page.raw_page.next_page_token == token + + +def test_credentials_transport_error(): + # It is an error to provide credentials and a transport instance. + transport = transports.TenantServiceGrpcTransport( + credentials=credentials.AnonymousCredentials(), + ) + with pytest.raises(ValueError): + client = TenantServiceClient( + credentials=credentials.AnonymousCredentials(), transport=transport, + ) + + # It is an error to provide a credentials file and a transport instance. + transport = transports.TenantServiceGrpcTransport( + credentials=credentials.AnonymousCredentials(), + ) + with pytest.raises(ValueError): + client = TenantServiceClient( + client_options={"credentials_file": "credentials.json"}, + transport=transport, + ) + + # It is an error to provide scopes and a transport instance. + transport = transports.TenantServiceGrpcTransport( + credentials=credentials.AnonymousCredentials(), + ) + with pytest.raises(ValueError): + client = TenantServiceClient( + client_options={"scopes": ["1", "2"]}, transport=transport, + ) + + +def test_transport_instance(): + # A client may be instantiated with a custom transport instance. + transport = transports.TenantServiceGrpcTransport( + credentials=credentials.AnonymousCredentials(), + ) + client = TenantServiceClient(transport=transport) + assert client._transport is transport + + +def test_transport_get_channel(): + # A client may be instantiated with a custom transport instance. + transport = transports.TenantServiceGrpcTransport( + credentials=credentials.AnonymousCredentials(), + ) + channel = transport.grpc_channel + assert channel + + transport = transports.TenantServiceGrpcAsyncIOTransport( + credentials=credentials.AnonymousCredentials(), + ) + channel = transport.grpc_channel + assert channel + + +def test_transport_grpc_default(): + # A client should use the gRPC transport by default. + client = TenantServiceClient(credentials=credentials.AnonymousCredentials(),) + assert isinstance(client._transport, transports.TenantServiceGrpcTransport,) + + +def test_tenant_service_base_transport_error(): + # Passing both a credentials object and credentials_file should raise an error + with pytest.raises(exceptions.DuplicateCredentialArgs): + transport = transports.TenantServiceTransport( + credentials=credentials.AnonymousCredentials(), + credentials_file="credentials.json", + ) + + +def test_tenant_service_base_transport(): + # Instantiate the base transport. + with mock.patch( + "google.cloud.talent_v4beta1.services.tenant_service.transports.TenantServiceTransport.__init__" + ) as Transport: + Transport.return_value = None + transport = transports.TenantServiceTransport( + credentials=credentials.AnonymousCredentials(), + ) + + # Every method on the transport should just blindly + # raise NotImplementedError. + methods = ( + "create_tenant", + "get_tenant", + "update_tenant", + "delete_tenant", + "list_tenants", + ) + for method in methods: + with pytest.raises(NotImplementedError): + getattr(transport, method)(request=object()) + + +def test_tenant_service_base_transport_with_credentials_file(): + # Instantiate the base transport with a credentials file + with mock.patch.object( + auth, "load_credentials_from_file" + ) as load_creds, mock.patch( + "google.cloud.talent_v4beta1.services.tenant_service.transports.TenantServiceTransport._prep_wrapped_messages" + ) as Transport: + Transport.return_value = None + load_creds.return_value = (credentials.AnonymousCredentials(), None) + transport = transports.TenantServiceTransport( + credentials_file="credentials.json", quota_project_id="octopus", + ) + load_creds.assert_called_once_with( + "credentials.json", + scopes=( + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/jobs", + ), + quota_project_id="octopus", + ) + + +def test_tenant_service_auth_adc(): + # If no credentials are provided, we should use ADC credentials. + with mock.patch.object(auth, "default") as adc: + adc.return_value = (credentials.AnonymousCredentials(), None) + TenantServiceClient() + adc.assert_called_once_with( + scopes=( + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/jobs", + ), + quota_project_id=None, + ) + + +def test_tenant_service_transport_auth_adc(): + # If credentials and host are not provided, the transport class should use + # ADC credentials. + with mock.patch.object(auth, "default") as adc: + adc.return_value = (credentials.AnonymousCredentials(), None) + transports.TenantServiceGrpcTransport( + host="squid.clam.whelk", quota_project_id="octopus" + ) + adc.assert_called_once_with( + scopes=( + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/jobs", + ), + quota_project_id="octopus", + ) + + +def test_tenant_service_host_no_port(): + client = TenantServiceClient( + credentials=credentials.AnonymousCredentials(), + client_options=client_options.ClientOptions(api_endpoint="jobs.googleapis.com"), + ) + assert client._transport._host == "jobs.googleapis.com:443" + + +def test_tenant_service_host_with_port(): + client = TenantServiceClient( + credentials=credentials.AnonymousCredentials(), + client_options=client_options.ClientOptions( + api_endpoint="jobs.googleapis.com:8000" + ), + ) + assert client._transport._host == "jobs.googleapis.com:8000" + + +def test_tenant_service_grpc_transport_channel(): + channel = grpc.insecure_channel("http://localhost/") + + # Check that if channel is provided, mtls endpoint and client_cert_source + # won't be used. + callback = mock.MagicMock() + transport = transports.TenantServiceGrpcTransport( + host="squid.clam.whelk", + channel=channel, + api_mtls_endpoint="mtls.squid.clam.whelk", + client_cert_source=callback, + ) + assert transport.grpc_channel == channel + assert transport._host == "squid.clam.whelk:443" + assert not callback.called + + +def test_tenant_service_grpc_asyncio_transport_channel(): + channel = aio.insecure_channel("http://localhost/") + + # Check that if channel is provided, mtls endpoint and client_cert_source + # won't be used. + callback = mock.MagicMock() + transport = transports.TenantServiceGrpcAsyncIOTransport( + host="squid.clam.whelk", + channel=channel, + api_mtls_endpoint="mtls.squid.clam.whelk", + client_cert_source=callback, + ) + assert transport.grpc_channel == channel + assert transport._host == "squid.clam.whelk:443" + assert not callback.called + + +@mock.patch("grpc.ssl_channel_credentials", autospec=True) +@mock.patch("google.api_core.grpc_helpers.create_channel", autospec=True) +def test_tenant_service_grpc_transport_channel_mtls_with_client_cert_source( + grpc_create_channel, grpc_ssl_channel_cred +): + # Check that if channel is None, but api_mtls_endpoint and client_cert_source + # are provided, then a mTLS channel will be created. + mock_cred = mock.Mock() + + mock_ssl_cred = mock.Mock() + grpc_ssl_channel_cred.return_value = mock_ssl_cred + + mock_grpc_channel = mock.Mock() + grpc_create_channel.return_value = mock_grpc_channel + + transport = transports.TenantServiceGrpcTransport( + host="squid.clam.whelk", + credentials=mock_cred, + api_mtls_endpoint="mtls.squid.clam.whelk", + client_cert_source=client_cert_source_callback, + ) + grpc_ssl_channel_cred.assert_called_once_with( + certificate_chain=b"cert bytes", private_key=b"key bytes" + ) + grpc_create_channel.assert_called_once_with( + "mtls.squid.clam.whelk:443", + credentials=mock_cred, + credentials_file=None, + scopes=( + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/jobs", + ), + ssl_credentials=mock_ssl_cred, + quota_project_id=None, + ) + assert transport.grpc_channel == mock_grpc_channel + + +@mock.patch("grpc.ssl_channel_credentials", autospec=True) +@mock.patch("google.api_core.grpc_helpers_async.create_channel", autospec=True) +def test_tenant_service_grpc_asyncio_transport_channel_mtls_with_client_cert_source( + grpc_create_channel, grpc_ssl_channel_cred +): + # Check that if channel is None, but api_mtls_endpoint and client_cert_source + # are provided, then a mTLS channel will be created. + mock_cred = mock.Mock() + + mock_ssl_cred = mock.Mock() + grpc_ssl_channel_cred.return_value = mock_ssl_cred + + mock_grpc_channel = mock.Mock() + grpc_create_channel.return_value = mock_grpc_channel + + transport = transports.TenantServiceGrpcAsyncIOTransport( + host="squid.clam.whelk", + credentials=mock_cred, + api_mtls_endpoint="mtls.squid.clam.whelk", + client_cert_source=client_cert_source_callback, + ) + grpc_ssl_channel_cred.assert_called_once_with( + certificate_chain=b"cert bytes", private_key=b"key bytes" + ) + grpc_create_channel.assert_called_once_with( + "mtls.squid.clam.whelk:443", + credentials=mock_cred, + credentials_file=None, + scopes=( + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/jobs", + ), + ssl_credentials=mock_ssl_cred, + quota_project_id=None, + ) + assert transport.grpc_channel == mock_grpc_channel + + +@pytest.mark.parametrize( + "api_mtls_endpoint", ["mtls.squid.clam.whelk", "mtls.squid.clam.whelk:443"] +) +@mock.patch("google.api_core.grpc_helpers.create_channel", autospec=True) +def test_tenant_service_grpc_transport_channel_mtls_with_adc( + grpc_create_channel, api_mtls_endpoint +): + # Check that if channel and client_cert_source are None, but api_mtls_endpoint + # is provided, then a mTLS channel will be created with SSL ADC. + mock_grpc_channel = mock.Mock() + grpc_create_channel.return_value = mock_grpc_channel + + # Mock google.auth.transport.grpc.SslCredentials class. + mock_ssl_cred = mock.Mock() + with mock.patch.multiple( + "google.auth.transport.grpc.SslCredentials", + __init__=mock.Mock(return_value=None), + ssl_credentials=mock.PropertyMock(return_value=mock_ssl_cred), + ): + mock_cred = mock.Mock() + transport = transports.TenantServiceGrpcTransport( + host="squid.clam.whelk", + credentials=mock_cred, + api_mtls_endpoint=api_mtls_endpoint, + client_cert_source=None, + ) + grpc_create_channel.assert_called_once_with( + "mtls.squid.clam.whelk:443", + credentials=mock_cred, + credentials_file=None, + scopes=( + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/jobs", + ), + ssl_credentials=mock_ssl_cred, + quota_project_id=None, + ) + assert transport.grpc_channel == mock_grpc_channel + + +@pytest.mark.parametrize( + "api_mtls_endpoint", ["mtls.squid.clam.whelk", "mtls.squid.clam.whelk:443"] +) +@mock.patch("google.api_core.grpc_helpers_async.create_channel", autospec=True) +def test_tenant_service_grpc_asyncio_transport_channel_mtls_with_adc( + grpc_create_channel, api_mtls_endpoint +): + # Check that if channel and client_cert_source are None, but api_mtls_endpoint + # is provided, then a mTLS channel will be created with SSL ADC. + mock_grpc_channel = mock.Mock() + grpc_create_channel.return_value = mock_grpc_channel + + # Mock google.auth.transport.grpc.SslCredentials class. + mock_ssl_cred = mock.Mock() + with mock.patch.multiple( + "google.auth.transport.grpc.SslCredentials", + __init__=mock.Mock(return_value=None), + ssl_credentials=mock.PropertyMock(return_value=mock_ssl_cred), + ): + mock_cred = mock.Mock() + transport = transports.TenantServiceGrpcAsyncIOTransport( + host="squid.clam.whelk", + credentials=mock_cred, + api_mtls_endpoint=api_mtls_endpoint, + client_cert_source=None, + ) + grpc_create_channel.assert_called_once_with( + "mtls.squid.clam.whelk:443", + credentials=mock_cred, + credentials_file=None, + scopes=( + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/jobs", + ), + ssl_credentials=mock_ssl_cred, + quota_project_id=None, + ) + assert transport.grpc_channel == mock_grpc_channel + + +def test_tenant_path(): + project = "squid" + tenant = "clam" + + expected = "projects/{project}/tenants/{tenant}".format( + project=project, tenant=tenant, + ) + actual = TenantServiceClient.tenant_path(project, tenant) + assert expected == actual + + +def test_parse_tenant_path(): + expected = { + "project": "whelk", + "tenant": "octopus", + } + path = TenantServiceClient.tenant_path(**expected) + + # Check that the path construction is reversible. + actual = TenantServiceClient.parse_tenant_path(path) + assert expected == actual diff --git a/tests/unit/gapic/v4beta1/test_application_service_client_v4beta1.py b/tests/unit/gapic/v4beta1/test_application_service_client_v4beta1.py deleted file mode 100644 index f4b617e0..00000000 --- a/tests/unit/gapic/v4beta1/test_application_service_client_v4beta1.py +++ /dev/null @@ -1,314 +0,0 @@ -# -*- 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 -# -# https://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. - -"""Unit tests.""" - -import mock -import pytest - -from google.cloud import talent_v4beta1 -from google.cloud.talent_v4beta1.proto import application_pb2 -from google.cloud.talent_v4beta1.proto import application_service_pb2 -from google.protobuf import empty_pb2 - - -class MultiCallableStub(object): - """Stub for the grpc.UnaryUnaryMultiCallable interface.""" - - def __init__(self, method, channel_stub): - self.method = method - self.channel_stub = channel_stub - - def __call__(self, request, timeout=None, metadata=None, credentials=None): - self.channel_stub.requests.append((self.method, request)) - - response = None - if self.channel_stub.responses: - response = self.channel_stub.responses.pop() - - if isinstance(response, Exception): - raise response - - if response: - return response - - -class ChannelStub(object): - """Stub for the grpc.Channel interface.""" - - def __init__(self, responses=[]): - self.responses = responses - self.requests = [] - - def unary_unary(self, method, request_serializer=None, response_deserializer=None): - return MultiCallableStub(method, self) - - -class CustomException(Exception): - pass - - -class TestApplicationServiceClient(object): - def test_create_application(self): - # Setup Expected Response - name = "name3373707" - external_id = "externalId-1153075697" - profile = "profile-309425751" - job = "job105405" - company = "company950484093" - outcome_notes = "outcomeNotes-355961964" - job_title_snippet = "jobTitleSnippet-1100512972" - expected_response = { - "name": name, - "external_id": external_id, - "profile": profile, - "job": job, - "company": company, - "outcome_notes": outcome_notes, - "job_title_snippet": job_title_snippet, - } - expected_response = application_pb2.Application(**expected_response) - - # Mock the API response - channel = ChannelStub(responses=[expected_response]) - patch = mock.patch("google.api_core.grpc_helpers.create_channel") - with patch as create_channel: - create_channel.return_value = channel - client = talent_v4beta1.ApplicationServiceClient() - - # Setup Request - parent = client.profile_path("[PROJECT]", "[TENANT]", "[PROFILE]") - application = {} - - response = client.create_application(parent, application) - assert expected_response == response - - assert len(channel.requests) == 1 - expected_request = application_service_pb2.CreateApplicationRequest( - parent=parent, application=application - ) - actual_request = channel.requests[0][1] - assert expected_request == actual_request - - def test_create_application_exception(self): - # Mock the API response - channel = ChannelStub(responses=[CustomException()]) - patch = mock.patch("google.api_core.grpc_helpers.create_channel") - with patch as create_channel: - create_channel.return_value = channel - client = talent_v4beta1.ApplicationServiceClient() - - # Setup request - parent = client.profile_path("[PROJECT]", "[TENANT]", "[PROFILE]") - application = {} - - with pytest.raises(CustomException): - client.create_application(parent, application) - - def test_get_application(self): - # Setup Expected Response - name_2 = "name2-1052831874" - external_id = "externalId-1153075697" - profile = "profile-309425751" - job = "job105405" - company = "company950484093" - outcome_notes = "outcomeNotes-355961964" - job_title_snippet = "jobTitleSnippet-1100512972" - expected_response = { - "name": name_2, - "external_id": external_id, - "profile": profile, - "job": job, - "company": company, - "outcome_notes": outcome_notes, - "job_title_snippet": job_title_snippet, - } - expected_response = application_pb2.Application(**expected_response) - - # Mock the API response - channel = ChannelStub(responses=[expected_response]) - patch = mock.patch("google.api_core.grpc_helpers.create_channel") - with patch as create_channel: - create_channel.return_value = channel - client = talent_v4beta1.ApplicationServiceClient() - - # Setup Request - name = client.application_path( - "[PROJECT]", "[TENANT]", "[PROFILE]", "[APPLICATION]" - ) - - response = client.get_application(name) - assert expected_response == response - - assert len(channel.requests) == 1 - expected_request = application_service_pb2.GetApplicationRequest(name=name) - actual_request = channel.requests[0][1] - assert expected_request == actual_request - - def test_get_application_exception(self): - # Mock the API response - channel = ChannelStub(responses=[CustomException()]) - patch = mock.patch("google.api_core.grpc_helpers.create_channel") - with patch as create_channel: - create_channel.return_value = channel - client = talent_v4beta1.ApplicationServiceClient() - - # Setup request - name = client.application_path( - "[PROJECT]", "[TENANT]", "[PROFILE]", "[APPLICATION]" - ) - - with pytest.raises(CustomException): - client.get_application(name) - - def test_update_application(self): - # Setup Expected Response - name = "name3373707" - external_id = "externalId-1153075697" - profile = "profile-309425751" - job = "job105405" - company = "company950484093" - outcome_notes = "outcomeNotes-355961964" - job_title_snippet = "jobTitleSnippet-1100512972" - expected_response = { - "name": name, - "external_id": external_id, - "profile": profile, - "job": job, - "company": company, - "outcome_notes": outcome_notes, - "job_title_snippet": job_title_snippet, - } - expected_response = application_pb2.Application(**expected_response) - - # Mock the API response - channel = ChannelStub(responses=[expected_response]) - patch = mock.patch("google.api_core.grpc_helpers.create_channel") - with patch as create_channel: - create_channel.return_value = channel - client = talent_v4beta1.ApplicationServiceClient() - - # Setup Request - application = {} - - response = client.update_application(application) - assert expected_response == response - - assert len(channel.requests) == 1 - expected_request = application_service_pb2.UpdateApplicationRequest( - application=application - ) - actual_request = channel.requests[0][1] - assert expected_request == actual_request - - def test_update_application_exception(self): - # Mock the API response - channel = ChannelStub(responses=[CustomException()]) - patch = mock.patch("google.api_core.grpc_helpers.create_channel") - with patch as create_channel: - create_channel.return_value = channel - client = talent_v4beta1.ApplicationServiceClient() - - # Setup request - application = {} - - with pytest.raises(CustomException): - client.update_application(application) - - def test_delete_application(self): - channel = ChannelStub() - patch = mock.patch("google.api_core.grpc_helpers.create_channel") - with patch as create_channel: - create_channel.return_value = channel - client = talent_v4beta1.ApplicationServiceClient() - - # Setup Request - name = client.application_path( - "[PROJECT]", "[TENANT]", "[PROFILE]", "[APPLICATION]" - ) - - client.delete_application(name) - - assert len(channel.requests) == 1 - expected_request = application_service_pb2.DeleteApplicationRequest(name=name) - actual_request = channel.requests[0][1] - assert expected_request == actual_request - - def test_delete_application_exception(self): - # Mock the API response - channel = ChannelStub(responses=[CustomException()]) - patch = mock.patch("google.api_core.grpc_helpers.create_channel") - with patch as create_channel: - create_channel.return_value = channel - client = talent_v4beta1.ApplicationServiceClient() - - # Setup request - name = client.application_path( - "[PROJECT]", "[TENANT]", "[PROFILE]", "[APPLICATION]" - ) - - with pytest.raises(CustomException): - client.delete_application(name) - - def test_list_applications(self): - # Setup Expected Response - next_page_token = "" - applications_element = {} - applications = [applications_element] - expected_response = { - "next_page_token": next_page_token, - "applications": applications, - } - expected_response = application_service_pb2.ListApplicationsResponse( - **expected_response - ) - - # Mock the API response - channel = ChannelStub(responses=[expected_response]) - patch = mock.patch("google.api_core.grpc_helpers.create_channel") - with patch as create_channel: - create_channel.return_value = channel - client = talent_v4beta1.ApplicationServiceClient() - - # Setup Request - parent = client.profile_path("[PROJECT]", "[TENANT]", "[PROFILE]") - - paged_list_response = client.list_applications(parent) - resources = list(paged_list_response) - assert len(resources) == 1 - - assert expected_response.applications[0] == resources[0] - - assert len(channel.requests) == 1 - expected_request = application_service_pb2.ListApplicationsRequest( - parent=parent - ) - actual_request = channel.requests[0][1] - assert expected_request == actual_request - - def test_list_applications_exception(self): - channel = ChannelStub(responses=[CustomException()]) - patch = mock.patch("google.api_core.grpc_helpers.create_channel") - with patch as create_channel: - create_channel.return_value = channel - client = talent_v4beta1.ApplicationServiceClient() - - # Setup request - parent = client.profile_path("[PROJECT]", "[TENANT]", "[PROFILE]") - - paged_list_response = client.list_applications(parent) - with pytest.raises(CustomException): - list(paged_list_response) diff --git a/tests/unit/gapic/v4beta1/test_company_service_client_v4beta1.py b/tests/unit/gapic/v4beta1/test_company_service_client_v4beta1.py deleted file mode 100644 index 0d2259a2..00000000 --- a/tests/unit/gapic/v4beta1/test_company_service_client_v4beta1.py +++ /dev/null @@ -1,317 +0,0 @@ -# -*- 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 -# -# https://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. - -"""Unit tests.""" - -import mock -import pytest - -from google.cloud import talent_v4beta1 -from google.cloud.talent_v4beta1.proto import company_pb2 -from google.cloud.talent_v4beta1.proto import company_service_pb2 -from google.protobuf import empty_pb2 - - -class MultiCallableStub(object): - """Stub for the grpc.UnaryUnaryMultiCallable interface.""" - - def __init__(self, method, channel_stub): - self.method = method - self.channel_stub = channel_stub - - def __call__(self, request, timeout=None, metadata=None, credentials=None): - self.channel_stub.requests.append((self.method, request)) - - response = None - if self.channel_stub.responses: - response = self.channel_stub.responses.pop() - - if isinstance(response, Exception): - raise response - - if response: - return response - - -class ChannelStub(object): - """Stub for the grpc.Channel interface.""" - - def __init__(self, responses=[]): - self.responses = responses - self.requests = [] - - def unary_unary(self, method, request_serializer=None, response_deserializer=None): - return MultiCallableStub(method, self) - - -class CustomException(Exception): - pass - - -class TestCompanyServiceClient(object): - def test_create_company(self): - # Setup Expected Response - name = "name3373707" - display_name = "displayName1615086568" - external_id = "externalId-1153075697" - headquarters_address = "headquartersAddress-1879520036" - hiring_agency = False - eeo_text = "eeoText-1652097123" - website_uri = "websiteUri-2118185016" - career_site_uri = "careerSiteUri1223331861" - image_uri = "imageUri-877823864" - suspended = False - expected_response = { - "name": name, - "display_name": display_name, - "external_id": external_id, - "headquarters_address": headquarters_address, - "hiring_agency": hiring_agency, - "eeo_text": eeo_text, - "website_uri": website_uri, - "career_site_uri": career_site_uri, - "image_uri": image_uri, - "suspended": suspended, - } - expected_response = company_pb2.Company(**expected_response) - - # Mock the API response - channel = ChannelStub(responses=[expected_response]) - patch = mock.patch("google.api_core.grpc_helpers.create_channel") - with patch as create_channel: - create_channel.return_value = channel - client = talent_v4beta1.CompanyServiceClient() - - # Setup Request - parent = client.tenant_path("[PROJECT]", "[TENANT]") - company = {} - - response = client.create_company(parent, company) - assert expected_response == response - - assert len(channel.requests) == 1 - expected_request = company_service_pb2.CreateCompanyRequest( - parent=parent, company=company - ) - actual_request = channel.requests[0][1] - assert expected_request == actual_request - - def test_create_company_exception(self): - # Mock the API response - channel = ChannelStub(responses=[CustomException()]) - patch = mock.patch("google.api_core.grpc_helpers.create_channel") - with patch as create_channel: - create_channel.return_value = channel - client = talent_v4beta1.CompanyServiceClient() - - # Setup request - parent = client.tenant_path("[PROJECT]", "[TENANT]") - company = {} - - with pytest.raises(CustomException): - client.create_company(parent, company) - - def test_get_company(self): - # Setup Expected Response - name_2 = "name2-1052831874" - display_name = "displayName1615086568" - external_id = "externalId-1153075697" - headquarters_address = "headquartersAddress-1879520036" - hiring_agency = False - eeo_text = "eeoText-1652097123" - website_uri = "websiteUri-2118185016" - career_site_uri = "careerSiteUri1223331861" - image_uri = "imageUri-877823864" - suspended = False - expected_response = { - "name": name_2, - "display_name": display_name, - "external_id": external_id, - "headquarters_address": headquarters_address, - "hiring_agency": hiring_agency, - "eeo_text": eeo_text, - "website_uri": website_uri, - "career_site_uri": career_site_uri, - "image_uri": image_uri, - "suspended": suspended, - } - expected_response = company_pb2.Company(**expected_response) - - # Mock the API response - channel = ChannelStub(responses=[expected_response]) - patch = mock.patch("google.api_core.grpc_helpers.create_channel") - with patch as create_channel: - create_channel.return_value = channel - client = talent_v4beta1.CompanyServiceClient() - - # Setup Request - name = client.company_path("[PROJECT]", "[TENANT]", "[COMPANY]") - - response = client.get_company(name) - assert expected_response == response - - assert len(channel.requests) == 1 - expected_request = company_service_pb2.GetCompanyRequest(name=name) - actual_request = channel.requests[0][1] - assert expected_request == actual_request - - def test_get_company_exception(self): - # Mock the API response - channel = ChannelStub(responses=[CustomException()]) - patch = mock.patch("google.api_core.grpc_helpers.create_channel") - with patch as create_channel: - create_channel.return_value = channel - client = talent_v4beta1.CompanyServiceClient() - - # Setup request - name = client.company_path("[PROJECT]", "[TENANT]", "[COMPANY]") - - with pytest.raises(CustomException): - client.get_company(name) - - def test_update_company(self): - # Setup Expected Response - name = "name3373707" - display_name = "displayName1615086568" - external_id = "externalId-1153075697" - headquarters_address = "headquartersAddress-1879520036" - hiring_agency = False - eeo_text = "eeoText-1652097123" - website_uri = "websiteUri-2118185016" - career_site_uri = "careerSiteUri1223331861" - image_uri = "imageUri-877823864" - suspended = False - expected_response = { - "name": name, - "display_name": display_name, - "external_id": external_id, - "headquarters_address": headquarters_address, - "hiring_agency": hiring_agency, - "eeo_text": eeo_text, - "website_uri": website_uri, - "career_site_uri": career_site_uri, - "image_uri": image_uri, - "suspended": suspended, - } - expected_response = company_pb2.Company(**expected_response) - - # Mock the API response - channel = ChannelStub(responses=[expected_response]) - patch = mock.patch("google.api_core.grpc_helpers.create_channel") - with patch as create_channel: - create_channel.return_value = channel - client = talent_v4beta1.CompanyServiceClient() - - # Setup Request - company = {} - - response = client.update_company(company) - assert expected_response == response - - assert len(channel.requests) == 1 - expected_request = company_service_pb2.UpdateCompanyRequest(company=company) - actual_request = channel.requests[0][1] - assert expected_request == actual_request - - def test_update_company_exception(self): - # Mock the API response - channel = ChannelStub(responses=[CustomException()]) - patch = mock.patch("google.api_core.grpc_helpers.create_channel") - with patch as create_channel: - create_channel.return_value = channel - client = talent_v4beta1.CompanyServiceClient() - - # Setup request - company = {} - - with pytest.raises(CustomException): - client.update_company(company) - - def test_delete_company(self): - channel = ChannelStub() - patch = mock.patch("google.api_core.grpc_helpers.create_channel") - with patch as create_channel: - create_channel.return_value = channel - client = talent_v4beta1.CompanyServiceClient() - - # Setup Request - name = client.company_path("[PROJECT]", "[TENANT]", "[COMPANY]") - - client.delete_company(name) - - assert len(channel.requests) == 1 - expected_request = company_service_pb2.DeleteCompanyRequest(name=name) - actual_request = channel.requests[0][1] - assert expected_request == actual_request - - def test_delete_company_exception(self): - # Mock the API response - channel = ChannelStub(responses=[CustomException()]) - patch = mock.patch("google.api_core.grpc_helpers.create_channel") - with patch as create_channel: - create_channel.return_value = channel - client = talent_v4beta1.CompanyServiceClient() - - # Setup request - name = client.company_path("[PROJECT]", "[TENANT]", "[COMPANY]") - - with pytest.raises(CustomException): - client.delete_company(name) - - def test_list_companies(self): - # Setup Expected Response - next_page_token = "" - companies_element = {} - companies = [companies_element] - expected_response = {"next_page_token": next_page_token, "companies": companies} - expected_response = company_service_pb2.ListCompaniesResponse( - **expected_response - ) - - # Mock the API response - channel = ChannelStub(responses=[expected_response]) - patch = mock.patch("google.api_core.grpc_helpers.create_channel") - with patch as create_channel: - create_channel.return_value = channel - client = talent_v4beta1.CompanyServiceClient() - - # Setup Request - parent = client.tenant_path("[PROJECT]", "[TENANT]") - - paged_list_response = client.list_companies(parent) - resources = list(paged_list_response) - assert len(resources) == 1 - - assert expected_response.companies[0] == resources[0] - - assert len(channel.requests) == 1 - expected_request = company_service_pb2.ListCompaniesRequest(parent=parent) - actual_request = channel.requests[0][1] - assert expected_request == actual_request - - def test_list_companies_exception(self): - channel = ChannelStub(responses=[CustomException()]) - patch = mock.patch("google.api_core.grpc_helpers.create_channel") - with patch as create_channel: - create_channel.return_value = channel - client = talent_v4beta1.CompanyServiceClient() - - # Setup request - parent = client.tenant_path("[PROJECT]", "[TENANT]") - - paged_list_response = client.list_companies(parent) - with pytest.raises(CustomException): - list(paged_list_response) diff --git a/tests/unit/gapic/v4beta1/test_completion_client_v4beta1.py b/tests/unit/gapic/v4beta1/test_completion_client_v4beta1.py deleted file mode 100644 index 0e66aff0..00000000 --- a/tests/unit/gapic/v4beta1/test_completion_client_v4beta1.py +++ /dev/null @@ -1,106 +0,0 @@ -# -*- 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 -# -# https://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. - -"""Unit tests.""" - -import mock -import pytest - -from google.cloud import talent_v4beta1 -from google.cloud.talent_v4beta1.proto import completion_service_pb2 - - -class MultiCallableStub(object): - """Stub for the grpc.UnaryUnaryMultiCallable interface.""" - - def __init__(self, method, channel_stub): - self.method = method - self.channel_stub = channel_stub - - def __call__(self, request, timeout=None, metadata=None, credentials=None): - self.channel_stub.requests.append((self.method, request)) - - response = None - if self.channel_stub.responses: - response = self.channel_stub.responses.pop() - - if isinstance(response, Exception): - raise response - - if response: - return response - - -class ChannelStub(object): - """Stub for the grpc.Channel interface.""" - - def __init__(self, responses=[]): - self.responses = responses - self.requests = [] - - def unary_unary(self, method, request_serializer=None, response_deserializer=None): - return MultiCallableStub(method, self) - - -class CustomException(Exception): - pass - - -class TestCompletionClient(object): - def test_complete_query(self): - # Setup Expected Response - expected_response = {} - expected_response = completion_service_pb2.CompleteQueryResponse( - **expected_response - ) - - # Mock the API response - channel = ChannelStub(responses=[expected_response]) - patch = mock.patch("google.api_core.grpc_helpers.create_channel") - with patch as create_channel: - create_channel.return_value = channel - client = talent_v4beta1.CompletionClient() - - # Setup Request - parent = client.tenant_path("[PROJECT]", "[TENANT]") - query = "query107944136" - page_size = 883849137 - - response = client.complete_query(parent, query, page_size) - assert expected_response == response - - assert len(channel.requests) == 1 - expected_request = completion_service_pb2.CompleteQueryRequest( - parent=parent, query=query, page_size=page_size - ) - actual_request = channel.requests[0][1] - assert expected_request == actual_request - - def test_complete_query_exception(self): - # Mock the API response - channel = ChannelStub(responses=[CustomException()]) - patch = mock.patch("google.api_core.grpc_helpers.create_channel") - with patch as create_channel: - create_channel.return_value = channel - client = talent_v4beta1.CompletionClient() - - # Setup request - parent = client.tenant_path("[PROJECT]", "[TENANT]") - query = "query107944136" - page_size = 883849137 - - with pytest.raises(CustomException): - client.complete_query(parent, query, page_size) diff --git a/tests/unit/gapic/v4beta1/test_event_service_client_v4beta1.py b/tests/unit/gapic/v4beta1/test_event_service_client_v4beta1.py deleted file mode 100644 index ca2b4336..00000000 --- a/tests/unit/gapic/v4beta1/test_event_service_client_v4beta1.py +++ /dev/null @@ -1,110 +0,0 @@ -# -*- 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 -# -# https://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. - -"""Unit tests.""" - -import mock -import pytest - -from google.cloud import talent_v4beta1 -from google.cloud.talent_v4beta1.proto import event_pb2 -from google.cloud.talent_v4beta1.proto import event_service_pb2 - - -class MultiCallableStub(object): - """Stub for the grpc.UnaryUnaryMultiCallable interface.""" - - def __init__(self, method, channel_stub): - self.method = method - self.channel_stub = channel_stub - - def __call__(self, request, timeout=None, metadata=None, credentials=None): - self.channel_stub.requests.append((self.method, request)) - - response = None - if self.channel_stub.responses: - response = self.channel_stub.responses.pop() - - if isinstance(response, Exception): - raise response - - if response: - return response - - -class ChannelStub(object): - """Stub for the grpc.Channel interface.""" - - def __init__(self, responses=[]): - self.responses = responses - self.requests = [] - - def unary_unary(self, method, request_serializer=None, response_deserializer=None): - return MultiCallableStub(method, self) - - -class CustomException(Exception): - pass - - -class TestEventServiceClient(object): - def test_create_client_event(self): - # Setup Expected Response - request_id = "requestId37109963" - event_id = "eventId278118624" - event_notes = "eventNotes445073628" - expected_response = { - "request_id": request_id, - "event_id": event_id, - "event_notes": event_notes, - } - expected_response = event_pb2.ClientEvent(**expected_response) - - # Mock the API response - channel = ChannelStub(responses=[expected_response]) - patch = mock.patch("google.api_core.grpc_helpers.create_channel") - with patch as create_channel: - create_channel.return_value = channel - client = talent_v4beta1.EventServiceClient() - - # Setup Request - parent = client.tenant_path("[PROJECT]", "[TENANT]") - client_event = {} - - response = client.create_client_event(parent, client_event) - assert expected_response == response - - assert len(channel.requests) == 1 - expected_request = event_service_pb2.CreateClientEventRequest( - parent=parent, client_event=client_event - ) - actual_request = channel.requests[0][1] - assert expected_request == actual_request - - def test_create_client_event_exception(self): - # Mock the API response - channel = ChannelStub(responses=[CustomException()]) - patch = mock.patch("google.api_core.grpc_helpers.create_channel") - with patch as create_channel: - create_channel.return_value = channel - client = talent_v4beta1.EventServiceClient() - - # Setup request - parent = client.tenant_path("[PROJECT]", "[TENANT]") - client_event = {} - - with pytest.raises(CustomException): - client.create_client_event(parent, client_event) diff --git a/tests/unit/gapic/v4beta1/test_job_service_client_v4beta1.py b/tests/unit/gapic/v4beta1/test_job_service_client_v4beta1.py deleted file mode 100644 index 2af4b385..00000000 --- a/tests/unit/gapic/v4beta1/test_job_service_client_v4beta1.py +++ /dev/null @@ -1,588 +0,0 @@ -# -*- 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 -# -# https://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. - -"""Unit tests.""" - -import mock -import pytest - -from google.rpc import status_pb2 - -from google.cloud import talent_v4beta1 -from google.cloud.talent_v4beta1.proto import common_pb2 -from google.cloud.talent_v4beta1.proto import job_pb2 -from google.cloud.talent_v4beta1.proto import job_service_pb2 -from google.longrunning import operations_pb2 -from google.protobuf import empty_pb2 - - -class MultiCallableStub(object): - """Stub for the grpc.UnaryUnaryMultiCallable interface.""" - - def __init__(self, method, channel_stub): - self.method = method - self.channel_stub = channel_stub - - def __call__(self, request, timeout=None, metadata=None, credentials=None): - self.channel_stub.requests.append((self.method, request)) - - response = None - if self.channel_stub.responses: - response = self.channel_stub.responses.pop() - - if isinstance(response, Exception): - raise response - - if response: - return response - - -class ChannelStub(object): - """Stub for the grpc.Channel interface.""" - - def __init__(self, responses=[]): - self.responses = responses - self.requests = [] - - def unary_unary(self, method, request_serializer=None, response_deserializer=None): - return MultiCallableStub(method, self) - - -class CustomException(Exception): - pass - - -class TestJobServiceClient(object): - def test_create_job(self): - # Setup Expected Response - name = "name3373707" - company = "company950484093" - requisition_id = "requisitionId980224926" - title = "title110371416" - description = "description-1724546052" - department = "department848184146" - incentives = "incentives-1262874520" - language_code = "languageCode-412800396" - promotion_value = 353413845 - qualifications = "qualifications1903501412" - responsibilities = "responsibilities-926952660" - company_display_name = "companyDisplayName1982424170" - expected_response = { - "name": name, - "company": company, - "requisition_id": requisition_id, - "title": title, - "description": description, - "department": department, - "incentives": incentives, - "language_code": language_code, - "promotion_value": promotion_value, - "qualifications": qualifications, - "responsibilities": responsibilities, - "company_display_name": company_display_name, - } - expected_response = job_pb2.Job(**expected_response) - - # Mock the API response - channel = ChannelStub(responses=[expected_response]) - patch = mock.patch("google.api_core.grpc_helpers.create_channel") - with patch as create_channel: - create_channel.return_value = channel - client = talent_v4beta1.JobServiceClient() - - # Setup Request - parent = client.tenant_path("[PROJECT]", "[TENANT]") - job = {} - - response = client.create_job(parent, job) - assert expected_response == response - - assert len(channel.requests) == 1 - expected_request = job_service_pb2.CreateJobRequest(parent=parent, job=job) - actual_request = channel.requests[0][1] - assert expected_request == actual_request - - def test_create_job_exception(self): - # Mock the API response - channel = ChannelStub(responses=[CustomException()]) - patch = mock.patch("google.api_core.grpc_helpers.create_channel") - with patch as create_channel: - create_channel.return_value = channel - client = talent_v4beta1.JobServiceClient() - - # Setup request - parent = client.tenant_path("[PROJECT]", "[TENANT]") - job = {} - - with pytest.raises(CustomException): - client.create_job(parent, job) - - def test_batch_create_jobs(self): - # Setup Expected Response - expected_response = {} - expected_response = job_service_pb2.JobOperationResult(**expected_response) - operation = operations_pb2.Operation( - name="operations/test_batch_create_jobs", done=True - ) - operation.response.Pack(expected_response) - - # Mock the API response - channel = ChannelStub(responses=[operation]) - patch = mock.patch("google.api_core.grpc_helpers.create_channel") - with patch as create_channel: - create_channel.return_value = channel - client = talent_v4beta1.JobServiceClient() - - # Setup Request - parent = client.tenant_path("[PROJECT]", "[TENANT]") - jobs = [] - - response = client.batch_create_jobs(parent, jobs) - result = response.result() - assert expected_response == result - - assert len(channel.requests) == 1 - expected_request = job_service_pb2.BatchCreateJobsRequest( - parent=parent, jobs=jobs - ) - actual_request = channel.requests[0][1] - assert expected_request == actual_request - - def test_batch_create_jobs_exception(self): - # Setup Response - error = status_pb2.Status() - operation = operations_pb2.Operation( - name="operations/test_batch_create_jobs_exception", done=True - ) - operation.error.CopyFrom(error) - - # Mock the API response - channel = ChannelStub(responses=[operation]) - patch = mock.patch("google.api_core.grpc_helpers.create_channel") - with patch as create_channel: - create_channel.return_value = channel - client = talent_v4beta1.JobServiceClient() - - # Setup Request - parent = client.tenant_path("[PROJECT]", "[TENANT]") - jobs = [] - - response = client.batch_create_jobs(parent, jobs) - exception = response.exception() - assert exception.errors[0] == error - - def test_get_job(self): - # Setup Expected Response - name_2 = "name2-1052831874" - company = "company950484093" - requisition_id = "requisitionId980224926" - title = "title110371416" - description = "description-1724546052" - department = "department848184146" - incentives = "incentives-1262874520" - language_code = "languageCode-412800396" - promotion_value = 353413845 - qualifications = "qualifications1903501412" - responsibilities = "responsibilities-926952660" - company_display_name = "companyDisplayName1982424170" - expected_response = { - "name": name_2, - "company": company, - "requisition_id": requisition_id, - "title": title, - "description": description, - "department": department, - "incentives": incentives, - "language_code": language_code, - "promotion_value": promotion_value, - "qualifications": qualifications, - "responsibilities": responsibilities, - "company_display_name": company_display_name, - } - expected_response = job_pb2.Job(**expected_response) - - # Mock the API response - channel = ChannelStub(responses=[expected_response]) - patch = mock.patch("google.api_core.grpc_helpers.create_channel") - with patch as create_channel: - create_channel.return_value = channel - client = talent_v4beta1.JobServiceClient() - - # Setup Request - name = client.job_path("[PROJECT]", "[TENANT]", "[JOB]") - - response = client.get_job(name) - assert expected_response == response - - assert len(channel.requests) == 1 - expected_request = job_service_pb2.GetJobRequest(name=name) - actual_request = channel.requests[0][1] - assert expected_request == actual_request - - def test_get_job_exception(self): - # Mock the API response - channel = ChannelStub(responses=[CustomException()]) - patch = mock.patch("google.api_core.grpc_helpers.create_channel") - with patch as create_channel: - create_channel.return_value = channel - client = talent_v4beta1.JobServiceClient() - - # Setup request - name = client.job_path("[PROJECT]", "[TENANT]", "[JOB]") - - with pytest.raises(CustomException): - client.get_job(name) - - def test_update_job(self): - # Setup Expected Response - name = "name3373707" - company = "company950484093" - requisition_id = "requisitionId980224926" - title = "title110371416" - description = "description-1724546052" - department = "department848184146" - incentives = "incentives-1262874520" - language_code = "languageCode-412800396" - promotion_value = 353413845 - qualifications = "qualifications1903501412" - responsibilities = "responsibilities-926952660" - company_display_name = "companyDisplayName1982424170" - expected_response = { - "name": name, - "company": company, - "requisition_id": requisition_id, - "title": title, - "description": description, - "department": department, - "incentives": incentives, - "language_code": language_code, - "promotion_value": promotion_value, - "qualifications": qualifications, - "responsibilities": responsibilities, - "company_display_name": company_display_name, - } - expected_response = job_pb2.Job(**expected_response) - - # Mock the API response - channel = ChannelStub(responses=[expected_response]) - patch = mock.patch("google.api_core.grpc_helpers.create_channel") - with patch as create_channel: - create_channel.return_value = channel - client = talent_v4beta1.JobServiceClient() - - # Setup Request - job = {} - - response = client.update_job(job) - assert expected_response == response - - assert len(channel.requests) == 1 - expected_request = job_service_pb2.UpdateJobRequest(job=job) - actual_request = channel.requests[0][1] - assert expected_request == actual_request - - def test_update_job_exception(self): - # Mock the API response - channel = ChannelStub(responses=[CustomException()]) - patch = mock.patch("google.api_core.grpc_helpers.create_channel") - with patch as create_channel: - create_channel.return_value = channel - client = talent_v4beta1.JobServiceClient() - - # Setup request - job = {} - - with pytest.raises(CustomException): - client.update_job(job) - - def test_batch_update_jobs(self): - # Setup Expected Response - expected_response = {} - expected_response = job_service_pb2.JobOperationResult(**expected_response) - operation = operations_pb2.Operation( - name="operations/test_batch_update_jobs", done=True - ) - operation.response.Pack(expected_response) - - # Mock the API response - channel = ChannelStub(responses=[operation]) - patch = mock.patch("google.api_core.grpc_helpers.create_channel") - with patch as create_channel: - create_channel.return_value = channel - client = talent_v4beta1.JobServiceClient() - - # Setup Request - parent = client.tenant_path("[PROJECT]", "[TENANT]") - jobs = [] - - response = client.batch_update_jobs(parent, jobs) - result = response.result() - assert expected_response == result - - assert len(channel.requests) == 1 - expected_request = job_service_pb2.BatchUpdateJobsRequest( - parent=parent, jobs=jobs - ) - actual_request = channel.requests[0][1] - assert expected_request == actual_request - - def test_batch_update_jobs_exception(self): - # Setup Response - error = status_pb2.Status() - operation = operations_pb2.Operation( - name="operations/test_batch_update_jobs_exception", done=True - ) - operation.error.CopyFrom(error) - - # Mock the API response - channel = ChannelStub(responses=[operation]) - patch = mock.patch("google.api_core.grpc_helpers.create_channel") - with patch as create_channel: - create_channel.return_value = channel - client = talent_v4beta1.JobServiceClient() - - # Setup Request - parent = client.tenant_path("[PROJECT]", "[TENANT]") - jobs = [] - - response = client.batch_update_jobs(parent, jobs) - exception = response.exception() - assert exception.errors[0] == error - - def test_delete_job(self): - channel = ChannelStub() - patch = mock.patch("google.api_core.grpc_helpers.create_channel") - with patch as create_channel: - create_channel.return_value = channel - client = talent_v4beta1.JobServiceClient() - - # Setup Request - name = client.job_path("[PROJECT]", "[TENANT]", "[JOB]") - - client.delete_job(name) - - assert len(channel.requests) == 1 - expected_request = job_service_pb2.DeleteJobRequest(name=name) - actual_request = channel.requests[0][1] - assert expected_request == actual_request - - def test_delete_job_exception(self): - # Mock the API response - channel = ChannelStub(responses=[CustomException()]) - patch = mock.patch("google.api_core.grpc_helpers.create_channel") - with patch as create_channel: - create_channel.return_value = channel - client = talent_v4beta1.JobServiceClient() - - # Setup request - name = client.job_path("[PROJECT]", "[TENANT]", "[JOB]") - - with pytest.raises(CustomException): - client.delete_job(name) - - def test_batch_delete_jobs(self): - channel = ChannelStub() - patch = mock.patch("google.api_core.grpc_helpers.create_channel") - with patch as create_channel: - create_channel.return_value = channel - client = talent_v4beta1.JobServiceClient() - - # Setup Request - parent = client.tenant_path("[PROJECT]", "[TENANT]") - filter_ = "filter-1274492040" - - client.batch_delete_jobs(parent, filter_) - - assert len(channel.requests) == 1 - expected_request = job_service_pb2.BatchDeleteJobsRequest( - parent=parent, filter=filter_ - ) - actual_request = channel.requests[0][1] - assert expected_request == actual_request - - def test_batch_delete_jobs_exception(self): - # Mock the API response - channel = ChannelStub(responses=[CustomException()]) - patch = mock.patch("google.api_core.grpc_helpers.create_channel") - with patch as create_channel: - create_channel.return_value = channel - client = talent_v4beta1.JobServiceClient() - - # Setup request - parent = client.tenant_path("[PROJECT]", "[TENANT]") - filter_ = "filter-1274492040" - - with pytest.raises(CustomException): - client.batch_delete_jobs(parent, filter_) - - def test_list_jobs(self): - # Setup Expected Response - next_page_token = "" - jobs_element = {} - jobs = [jobs_element] - expected_response = {"next_page_token": next_page_token, "jobs": jobs} - expected_response = job_service_pb2.ListJobsResponse(**expected_response) - - # Mock the API response - channel = ChannelStub(responses=[expected_response]) - patch = mock.patch("google.api_core.grpc_helpers.create_channel") - with patch as create_channel: - create_channel.return_value = channel - client = talent_v4beta1.JobServiceClient() - - # Setup Request - parent = client.tenant_path("[PROJECT]", "[TENANT]") - filter_ = "filter-1274492040" - - paged_list_response = client.list_jobs(parent, filter_) - resources = list(paged_list_response) - assert len(resources) == 1 - - assert expected_response.jobs[0] == resources[0] - - assert len(channel.requests) == 1 - expected_request = job_service_pb2.ListJobsRequest( - parent=parent, filter=filter_ - ) - actual_request = channel.requests[0][1] - assert expected_request == actual_request - - def test_list_jobs_exception(self): - channel = ChannelStub(responses=[CustomException()]) - patch = mock.patch("google.api_core.grpc_helpers.create_channel") - with patch as create_channel: - create_channel.return_value = channel - client = talent_v4beta1.JobServiceClient() - - # Setup request - parent = client.tenant_path("[PROJECT]", "[TENANT]") - filter_ = "filter-1274492040" - - paged_list_response = client.list_jobs(parent, filter_) - with pytest.raises(CustomException): - list(paged_list_response) - - def test_search_jobs(self): - # Setup Expected Response - next_page_token = "" - estimated_total_size = 1882144769 - total_size = 705419236 - broadened_query_jobs_count = 1432104658 - matching_jobs_element = {} - matching_jobs = [matching_jobs_element] - expected_response = { - "next_page_token": next_page_token, - "estimated_total_size": estimated_total_size, - "total_size": total_size, - "broadened_query_jobs_count": broadened_query_jobs_count, - "matching_jobs": matching_jobs, - } - expected_response = job_service_pb2.SearchJobsResponse(**expected_response) - - # Mock the API response - channel = ChannelStub(responses=[expected_response]) - patch = mock.patch("google.api_core.grpc_helpers.create_channel") - with patch as create_channel: - create_channel.return_value = channel - client = talent_v4beta1.JobServiceClient() - - # Setup Request - parent = client.tenant_path("[PROJECT]", "[TENANT]") - request_metadata = {} - - paged_list_response = client.search_jobs(parent, request_metadata) - resources = list(paged_list_response) - assert len(resources) == 1 - - assert expected_response.matching_jobs[0] == resources[0] - - assert len(channel.requests) == 1 - expected_request = job_service_pb2.SearchJobsRequest( - parent=parent, request_metadata=request_metadata - ) - actual_request = channel.requests[0][1] - assert expected_request == actual_request - - def test_search_jobs_exception(self): - channel = ChannelStub(responses=[CustomException()]) - patch = mock.patch("google.api_core.grpc_helpers.create_channel") - with patch as create_channel: - create_channel.return_value = channel - client = talent_v4beta1.JobServiceClient() - - # Setup request - parent = client.tenant_path("[PROJECT]", "[TENANT]") - request_metadata = {} - - paged_list_response = client.search_jobs(parent, request_metadata) - with pytest.raises(CustomException): - list(paged_list_response) - - def test_search_jobs_for_alert(self): - # Setup Expected Response - next_page_token = "" - estimated_total_size = 1882144769 - total_size = 705419236 - broadened_query_jobs_count = 1432104658 - matching_jobs_element = {} - matching_jobs = [matching_jobs_element] - expected_response = { - "next_page_token": next_page_token, - "estimated_total_size": estimated_total_size, - "total_size": total_size, - "broadened_query_jobs_count": broadened_query_jobs_count, - "matching_jobs": matching_jobs, - } - expected_response = job_service_pb2.SearchJobsResponse(**expected_response) - - # Mock the API response - channel = ChannelStub(responses=[expected_response]) - patch = mock.patch("google.api_core.grpc_helpers.create_channel") - with patch as create_channel: - create_channel.return_value = channel - client = talent_v4beta1.JobServiceClient() - - # Setup Request - parent = client.tenant_path("[PROJECT]", "[TENANT]") - request_metadata = {} - - paged_list_response = client.search_jobs_for_alert(parent, request_metadata) - resources = list(paged_list_response) - assert len(resources) == 1 - - assert expected_response.matching_jobs[0] == resources[0] - - assert len(channel.requests) == 1 - expected_request = job_service_pb2.SearchJobsRequest( - parent=parent, request_metadata=request_metadata - ) - actual_request = channel.requests[0][1] - assert expected_request == actual_request - - def test_search_jobs_for_alert_exception(self): - channel = ChannelStub(responses=[CustomException()]) - patch = mock.patch("google.api_core.grpc_helpers.create_channel") - with patch as create_channel: - create_channel.return_value = channel - client = talent_v4beta1.JobServiceClient() - - # Setup request - parent = client.tenant_path("[PROJECT]", "[TENANT]") - request_metadata = {} - - paged_list_response = client.search_jobs_for_alert(parent, request_metadata) - with pytest.raises(CustomException): - list(paged_list_response) diff --git a/tests/unit/gapic/v4beta1/test_profile_service_client_v4beta1.py b/tests/unit/gapic/v4beta1/test_profile_service_client_v4beta1.py deleted file mode 100644 index 2171635f..00000000 --- a/tests/unit/gapic/v4beta1/test_profile_service_client_v4beta1.py +++ /dev/null @@ -1,356 +0,0 @@ -# -*- 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 -# -# https://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. - -"""Unit tests.""" - -import mock -import pytest - -from google.cloud import talent_v4beta1 -from google.cloud.talent_v4beta1.proto import common_pb2 -from google.cloud.talent_v4beta1.proto import profile_pb2 -from google.cloud.talent_v4beta1.proto import profile_service_pb2 -from google.protobuf import empty_pb2 - - -class MultiCallableStub(object): - """Stub for the grpc.UnaryUnaryMultiCallable interface.""" - - def __init__(self, method, channel_stub): - self.method = method - self.channel_stub = channel_stub - - def __call__(self, request, timeout=None, metadata=None, credentials=None): - self.channel_stub.requests.append((self.method, request)) - - response = None - if self.channel_stub.responses: - response = self.channel_stub.responses.pop() - - if isinstance(response, Exception): - raise response - - if response: - return response - - -class ChannelStub(object): - """Stub for the grpc.Channel interface.""" - - def __init__(self, responses=[]): - self.responses = responses - self.requests = [] - - def unary_unary(self, method, request_serializer=None, response_deserializer=None): - return MultiCallableStub(method, self) - - -class CustomException(Exception): - pass - - -class TestProfileServiceClient(object): - def test_search_profiles(self): - # Setup Expected Response - estimated_total_size = 1882144769 - next_page_token = "" - result_set_id = "resultSetId-770306950" - summarized_profiles_element = {} - summarized_profiles = [summarized_profiles_element] - expected_response = { - "estimated_total_size": estimated_total_size, - "next_page_token": next_page_token, - "result_set_id": result_set_id, - "summarized_profiles": summarized_profiles, - } - expected_response = profile_service_pb2.SearchProfilesResponse( - **expected_response - ) - - # Mock the API response - channel = ChannelStub(responses=[expected_response]) - patch = mock.patch("google.api_core.grpc_helpers.create_channel") - with patch as create_channel: - create_channel.return_value = channel - client = talent_v4beta1.ProfileServiceClient() - - # Setup Request - parent = client.tenant_path("[PROJECT]", "[TENANT]") - request_metadata = {} - - paged_list_response = client.search_profiles(parent, request_metadata) - resources = list(paged_list_response) - assert len(resources) == 1 - - assert expected_response.summarized_profiles[0] == resources[0] - - assert len(channel.requests) == 1 - expected_request = profile_service_pb2.SearchProfilesRequest( - parent=parent, request_metadata=request_metadata - ) - actual_request = channel.requests[0][1] - assert expected_request == actual_request - - def test_search_profiles_exception(self): - channel = ChannelStub(responses=[CustomException()]) - patch = mock.patch("google.api_core.grpc_helpers.create_channel") - with patch as create_channel: - create_channel.return_value = channel - client = talent_v4beta1.ProfileServiceClient() - - # Setup request - parent = client.tenant_path("[PROJECT]", "[TENANT]") - request_metadata = {} - - paged_list_response = client.search_profiles(parent, request_metadata) - with pytest.raises(CustomException): - list(paged_list_response) - - def test_list_profiles(self): - # Setup Expected Response - next_page_token = "" - profiles_element = {} - profiles = [profiles_element] - expected_response = {"next_page_token": next_page_token, "profiles": profiles} - expected_response = profile_service_pb2.ListProfilesResponse( - **expected_response - ) - - # Mock the API response - channel = ChannelStub(responses=[expected_response]) - patch = mock.patch("google.api_core.grpc_helpers.create_channel") - with patch as create_channel: - create_channel.return_value = channel - client = talent_v4beta1.ProfileServiceClient() - - # Setup Request - parent = client.tenant_path("[PROJECT]", "[TENANT]") - - paged_list_response = client.list_profiles(parent) - resources = list(paged_list_response) - assert len(resources) == 1 - - assert expected_response.profiles[0] == resources[0] - - assert len(channel.requests) == 1 - expected_request = profile_service_pb2.ListProfilesRequest(parent=parent) - actual_request = channel.requests[0][1] - assert expected_request == actual_request - - def test_list_profiles_exception(self): - channel = ChannelStub(responses=[CustomException()]) - patch = mock.patch("google.api_core.grpc_helpers.create_channel") - with patch as create_channel: - create_channel.return_value = channel - client = talent_v4beta1.ProfileServiceClient() - - # Setup request - parent = client.tenant_path("[PROJECT]", "[TENANT]") - - paged_list_response = client.list_profiles(parent) - with pytest.raises(CustomException): - list(paged_list_response) - - def test_create_profile(self): - # Setup Expected Response - name = "name3373707" - external_id = "externalId-1153075697" - source = "source-896505829" - uri = "uri116076" - group_id = "groupId506361563" - processed = True - keyword_snippet = "keywordSnippet1325317319" - expected_response = { - "name": name, - "external_id": external_id, - "source": source, - "uri": uri, - "group_id": group_id, - "processed": processed, - "keyword_snippet": keyword_snippet, - } - expected_response = profile_pb2.Profile(**expected_response) - - # Mock the API response - channel = ChannelStub(responses=[expected_response]) - patch = mock.patch("google.api_core.grpc_helpers.create_channel") - with patch as create_channel: - create_channel.return_value = channel - client = talent_v4beta1.ProfileServiceClient() - - # Setup Request - parent = client.tenant_path("[PROJECT]", "[TENANT]") - profile = {} - - response = client.create_profile(parent, profile) - assert expected_response == response - - assert len(channel.requests) == 1 - expected_request = profile_service_pb2.CreateProfileRequest( - parent=parent, profile=profile - ) - actual_request = channel.requests[0][1] - assert expected_request == actual_request - - def test_create_profile_exception(self): - # Mock the API response - channel = ChannelStub(responses=[CustomException()]) - patch = mock.patch("google.api_core.grpc_helpers.create_channel") - with patch as create_channel: - create_channel.return_value = channel - client = talent_v4beta1.ProfileServiceClient() - - # Setup request - parent = client.tenant_path("[PROJECT]", "[TENANT]") - profile = {} - - with pytest.raises(CustomException): - client.create_profile(parent, profile) - - def test_get_profile(self): - # Setup Expected Response - name_2 = "name2-1052831874" - external_id = "externalId-1153075697" - source = "source-896505829" - uri = "uri116076" - group_id = "groupId506361563" - processed = True - keyword_snippet = "keywordSnippet1325317319" - expected_response = { - "name": name_2, - "external_id": external_id, - "source": source, - "uri": uri, - "group_id": group_id, - "processed": processed, - "keyword_snippet": keyword_snippet, - } - expected_response = profile_pb2.Profile(**expected_response) - - # Mock the API response - channel = ChannelStub(responses=[expected_response]) - patch = mock.patch("google.api_core.grpc_helpers.create_channel") - with patch as create_channel: - create_channel.return_value = channel - client = talent_v4beta1.ProfileServiceClient() - - # Setup Request - name = client.profile_path("[PROJECT]", "[TENANT]", "[PROFILE]") - - response = client.get_profile(name) - assert expected_response == response - - assert len(channel.requests) == 1 - expected_request = profile_service_pb2.GetProfileRequest(name=name) - actual_request = channel.requests[0][1] - assert expected_request == actual_request - - def test_get_profile_exception(self): - # Mock the API response - channel = ChannelStub(responses=[CustomException()]) - patch = mock.patch("google.api_core.grpc_helpers.create_channel") - with patch as create_channel: - create_channel.return_value = channel - client = talent_v4beta1.ProfileServiceClient() - - # Setup request - name = client.profile_path("[PROJECT]", "[TENANT]", "[PROFILE]") - - with pytest.raises(CustomException): - client.get_profile(name) - - def test_update_profile(self): - # Setup Expected Response - name = "name3373707" - external_id = "externalId-1153075697" - source = "source-896505829" - uri = "uri116076" - group_id = "groupId506361563" - processed = True - keyword_snippet = "keywordSnippet1325317319" - expected_response = { - "name": name, - "external_id": external_id, - "source": source, - "uri": uri, - "group_id": group_id, - "processed": processed, - "keyword_snippet": keyword_snippet, - } - expected_response = profile_pb2.Profile(**expected_response) - - # Mock the API response - channel = ChannelStub(responses=[expected_response]) - patch = mock.patch("google.api_core.grpc_helpers.create_channel") - with patch as create_channel: - create_channel.return_value = channel - client = talent_v4beta1.ProfileServiceClient() - - # Setup Request - profile = {} - - response = client.update_profile(profile) - assert expected_response == response - - assert len(channel.requests) == 1 - expected_request = profile_service_pb2.UpdateProfileRequest(profile=profile) - actual_request = channel.requests[0][1] - assert expected_request == actual_request - - def test_update_profile_exception(self): - # Mock the API response - channel = ChannelStub(responses=[CustomException()]) - patch = mock.patch("google.api_core.grpc_helpers.create_channel") - with patch as create_channel: - create_channel.return_value = channel - client = talent_v4beta1.ProfileServiceClient() - - # Setup request - profile = {} - - with pytest.raises(CustomException): - client.update_profile(profile) - - def test_delete_profile(self): - channel = ChannelStub() - patch = mock.patch("google.api_core.grpc_helpers.create_channel") - with patch as create_channel: - create_channel.return_value = channel - client = talent_v4beta1.ProfileServiceClient() - - # Setup Request - name = client.profile_path("[PROJECT]", "[TENANT]", "[PROFILE]") - - client.delete_profile(name) - - assert len(channel.requests) == 1 - expected_request = profile_service_pb2.DeleteProfileRequest(name=name) - actual_request = channel.requests[0][1] - assert expected_request == actual_request - - def test_delete_profile_exception(self): - # Mock the API response - channel = ChannelStub(responses=[CustomException()]) - patch = mock.patch("google.api_core.grpc_helpers.create_channel") - with patch as create_channel: - create_channel.return_value = channel - client = talent_v4beta1.ProfileServiceClient() - - # Setup request - name = client.profile_path("[PROJECT]", "[TENANT]", "[PROFILE]") - - with pytest.raises(CustomException): - client.delete_profile(name) diff --git a/tests/unit/gapic/v4beta1/test_tenant_service_client_v4beta1.py b/tests/unit/gapic/v4beta1/test_tenant_service_client_v4beta1.py deleted file mode 100644 index 3ea8c09d..00000000 --- a/tests/unit/gapic/v4beta1/test_tenant_service_client_v4beta1.py +++ /dev/null @@ -1,258 +0,0 @@ -# -*- 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 -# -# https://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. - -"""Unit tests.""" - -import mock -import pytest - -from google.cloud import talent_v4beta1 -from google.cloud.talent_v4beta1.proto import tenant_pb2 -from google.cloud.talent_v4beta1.proto import tenant_service_pb2 -from google.protobuf import empty_pb2 - - -class MultiCallableStub(object): - """Stub for the grpc.UnaryUnaryMultiCallable interface.""" - - def __init__(self, method, channel_stub): - self.method = method - self.channel_stub = channel_stub - - def __call__(self, request, timeout=None, metadata=None, credentials=None): - self.channel_stub.requests.append((self.method, request)) - - response = None - if self.channel_stub.responses: - response = self.channel_stub.responses.pop() - - if isinstance(response, Exception): - raise response - - if response: - return response - - -class ChannelStub(object): - """Stub for the grpc.Channel interface.""" - - def __init__(self, responses=[]): - self.responses = responses - self.requests = [] - - def unary_unary(self, method, request_serializer=None, response_deserializer=None): - return MultiCallableStub(method, self) - - -class CustomException(Exception): - pass - - -class TestTenantServiceClient(object): - def test_create_tenant(self): - # Setup Expected Response - name = "name3373707" - external_id = "externalId-1153075697" - expected_response = {"name": name, "external_id": external_id} - expected_response = tenant_pb2.Tenant(**expected_response) - - # Mock the API response - channel = ChannelStub(responses=[expected_response]) - patch = mock.patch("google.api_core.grpc_helpers.create_channel") - with patch as create_channel: - create_channel.return_value = channel - client = talent_v4beta1.TenantServiceClient() - - # Setup Request - parent = client.project_path("[PROJECT]") - tenant = {} - - response = client.create_tenant(parent, tenant) - assert expected_response == response - - assert len(channel.requests) == 1 - expected_request = tenant_service_pb2.CreateTenantRequest( - parent=parent, tenant=tenant - ) - actual_request = channel.requests[0][1] - assert expected_request == actual_request - - def test_create_tenant_exception(self): - # Mock the API response - channel = ChannelStub(responses=[CustomException()]) - patch = mock.patch("google.api_core.grpc_helpers.create_channel") - with patch as create_channel: - create_channel.return_value = channel - client = talent_v4beta1.TenantServiceClient() - - # Setup request - parent = client.project_path("[PROJECT]") - tenant = {} - - with pytest.raises(CustomException): - client.create_tenant(parent, tenant) - - def test_get_tenant(self): - # Setup Expected Response - name_2 = "name2-1052831874" - external_id = "externalId-1153075697" - expected_response = {"name": name_2, "external_id": external_id} - expected_response = tenant_pb2.Tenant(**expected_response) - - # Mock the API response - channel = ChannelStub(responses=[expected_response]) - patch = mock.patch("google.api_core.grpc_helpers.create_channel") - with patch as create_channel: - create_channel.return_value = channel - client = talent_v4beta1.TenantServiceClient() - - # Setup Request - name = client.tenant_path("[PROJECT]", "[TENANT]") - - response = client.get_tenant(name) - assert expected_response == response - - assert len(channel.requests) == 1 - expected_request = tenant_service_pb2.GetTenantRequest(name=name) - actual_request = channel.requests[0][1] - assert expected_request == actual_request - - def test_get_tenant_exception(self): - # Mock the API response - channel = ChannelStub(responses=[CustomException()]) - patch = mock.patch("google.api_core.grpc_helpers.create_channel") - with patch as create_channel: - create_channel.return_value = channel - client = talent_v4beta1.TenantServiceClient() - - # Setup request - name = client.tenant_path("[PROJECT]", "[TENANT]") - - with pytest.raises(CustomException): - client.get_tenant(name) - - def test_update_tenant(self): - # Setup Expected Response - name = "name3373707" - external_id = "externalId-1153075697" - expected_response = {"name": name, "external_id": external_id} - expected_response = tenant_pb2.Tenant(**expected_response) - - # Mock the API response - channel = ChannelStub(responses=[expected_response]) - patch = mock.patch("google.api_core.grpc_helpers.create_channel") - with patch as create_channel: - create_channel.return_value = channel - client = talent_v4beta1.TenantServiceClient() - - # Setup Request - tenant = {} - - response = client.update_tenant(tenant) - assert expected_response == response - - assert len(channel.requests) == 1 - expected_request = tenant_service_pb2.UpdateTenantRequest(tenant=tenant) - actual_request = channel.requests[0][1] - assert expected_request == actual_request - - def test_update_tenant_exception(self): - # Mock the API response - channel = ChannelStub(responses=[CustomException()]) - patch = mock.patch("google.api_core.grpc_helpers.create_channel") - with patch as create_channel: - create_channel.return_value = channel - client = talent_v4beta1.TenantServiceClient() - - # Setup request - tenant = {} - - with pytest.raises(CustomException): - client.update_tenant(tenant) - - def test_delete_tenant(self): - channel = ChannelStub() - patch = mock.patch("google.api_core.grpc_helpers.create_channel") - with patch as create_channel: - create_channel.return_value = channel - client = talent_v4beta1.TenantServiceClient() - - # Setup Request - name = client.tenant_path("[PROJECT]", "[TENANT]") - - client.delete_tenant(name) - - assert len(channel.requests) == 1 - expected_request = tenant_service_pb2.DeleteTenantRequest(name=name) - actual_request = channel.requests[0][1] - assert expected_request == actual_request - - def test_delete_tenant_exception(self): - # Mock the API response - channel = ChannelStub(responses=[CustomException()]) - patch = mock.patch("google.api_core.grpc_helpers.create_channel") - with patch as create_channel: - create_channel.return_value = channel - client = talent_v4beta1.TenantServiceClient() - - # Setup request - name = client.tenant_path("[PROJECT]", "[TENANT]") - - with pytest.raises(CustomException): - client.delete_tenant(name) - - def test_list_tenants(self): - # Setup Expected Response - next_page_token = "" - tenants_element = {} - tenants = [tenants_element] - expected_response = {"next_page_token": next_page_token, "tenants": tenants} - expected_response = tenant_service_pb2.ListTenantsResponse(**expected_response) - - # Mock the API response - channel = ChannelStub(responses=[expected_response]) - patch = mock.patch("google.api_core.grpc_helpers.create_channel") - with patch as create_channel: - create_channel.return_value = channel - client = talent_v4beta1.TenantServiceClient() - - # Setup Request - parent = client.project_path("[PROJECT]") - - paged_list_response = client.list_tenants(parent) - resources = list(paged_list_response) - assert len(resources) == 1 - - assert expected_response.tenants[0] == resources[0] - - assert len(channel.requests) == 1 - expected_request = tenant_service_pb2.ListTenantsRequest(parent=parent) - actual_request = channel.requests[0][1] - assert expected_request == actual_request - - def test_list_tenants_exception(self): - channel = ChannelStub(responses=[CustomException()]) - patch = mock.patch("google.api_core.grpc_helpers.create_channel") - with patch as create_channel: - create_channel.return_value = channel - client = talent_v4beta1.TenantServiceClient() - - # Setup request - parent = client.project_path("[PROJECT]") - - paged_list_response = client.list_tenants(parent) - with pytest.raises(CustomException): - list(paged_list_response)