From 6f6c09bec728d0930082396d9ebb6936d903180f Mon Sep 17 00:00:00 2001 From: yoshi-automation Date: Tue, 23 Mar 2021 18:28:54 -0700 Subject: [PATCH 01/38] changes without context autosynth cannot find the source of changes triggered by earlier changes in this repository, or by version upgrades to tools such as linters. --- .kokoro/test-samples.sh | 8 ++++---- .kokoro/trampoline_v2.sh | 2 +- google/cloud/talent_v4/__init__.py | 4 ++-- google/cloud/talent_v4beta1/__init__.py | 4 ++-- synth.metadata | 2 +- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/.kokoro/test-samples.sh b/.kokoro/test-samples.sh index 71fab05d..4b0afc93 100755 --- a/.kokoro/test-samples.sh +++ b/.kokoro/test-samples.sh @@ -87,11 +87,11 @@ for file in samples/**/requirements.txt; do python3.6 -m nox -s "$RUN_TESTS_SESSION" EXIT=$? - # If this is a periodic build, send the test log to the FlakyBot. - # See https://github.com/googleapis/repo-automation-bots/tree/master/packages/flakybot. + # If this is a periodic build, send the test log to the Build Cop Bot. + # See https://github.com/googleapis/repo-automation-bots/tree/master/packages/buildcop. if [[ $KOKORO_BUILD_ARTIFACTS_SUBDIR = *"periodic"* ]]; then - chmod +x $KOKORO_GFILE_DIR/linux_amd64/flakybot - $KOKORO_GFILE_DIR/linux_amd64/flakybot + chmod +x $KOKORO_GFILE_DIR/linux_amd64/buildcop + $KOKORO_GFILE_DIR/linux_amd64/buildcop fi if [[ $EXIT -ne 0 ]]; then diff --git a/.kokoro/trampoline_v2.sh b/.kokoro/trampoline_v2.sh index 4af6cdc2..719bcd5b 100755 --- a/.kokoro/trampoline_v2.sh +++ b/.kokoro/trampoline_v2.sh @@ -159,7 +159,7 @@ if [[ -n "${KOKORO_BUILD_ID:-}" ]]; then "KOKORO_GITHUB_COMMIT" "KOKORO_GITHUB_PULL_REQUEST_NUMBER" "KOKORO_GITHUB_PULL_REQUEST_COMMIT" - # For FlakyBot + # For Build Cop Bot "KOKORO_GITHUB_COMMIT_URL" "KOKORO_GITHUB_PULL_REQUEST_URL" ) diff --git a/google/cloud/talent_v4/__init__.py b/google/cloud/talent_v4/__init__.py index 1d4b845e..b193e4de 100644 --- a/google/cloud/talent_v4/__init__.py +++ b/google/cloud/talent_v4/__init__.py @@ -127,6 +127,7 @@ "JobLevel", "JobQuery", "JobResult", + "JobServiceClient", "JobView", "ListCompaniesRequest", "ListCompaniesResponse", @@ -143,11 +144,10 @@ "SearchJobsResponse", "SpellingCorrection", "Tenant", - "TenantServiceClient", "TimestampRange", "UpdateCompanyRequest", "UpdateJobRequest", "UpdateTenantRequest", "Visibility", - "JobServiceClient", + "TenantServiceClient", ) diff --git a/google/cloud/talent_v4beta1/__init__.py b/google/cloud/talent_v4beta1/__init__.py index 4743ac58..b751ef4a 100644 --- a/google/cloud/talent_v4beta1/__init__.py +++ b/google/cloud/talent_v4beta1/__init__.py @@ -203,7 +203,6 @@ "JobLevel", "JobOperationResult", "JobQuery", - "JobServiceClient", "JobTitleFilter", "JobView", "ListApplicationsRequest", @@ -244,6 +243,7 @@ "SpellingCorrection", "SummarizedProfile", "Tenant", + "TenantServiceClient", "TimeFilter", "TimestampRange", "UpdateApplicationRequest", @@ -253,5 +253,5 @@ "UpdateTenantRequest", "Visibility", "WorkExperienceFilter", - "TenantServiceClient", + "JobServiceClient", ) diff --git a/synth.metadata b/synth.metadata index 83804676..674a7366 100644 --- a/synth.metadata +++ b/synth.metadata @@ -4,7 +4,7 @@ "git": { "name": ".", "remote": "https://github.com/googleapis/python-talent.git", - "sha": "8a53830a77532e25ff0794e9fb5400e4ec01d4f5" + "sha": "bb632f21c24cdca6094f989657ec6e72d4ffb371" } }, { From 563eb8bb7673688e982fbb92828427832f0a728b Mon Sep 17 00:00:00 2001 From: yoshi-automation Date: Tue, 23 Mar 2021 18:36:59 -0700 Subject: [PATCH 02/38] docs: update comments on parameters and validation result. PiperOrigin-RevId: 348696929 Source-Author: Google APIs Source-Date: Tue Dec 22 14:46:59 2020 -0800 Source-Repo: googleapis/googleapis Source-Sha: 8a6f4d9acb1620af2156b42b37b54eae257b7cad Source-Link: https://github.com/googleapis/googleapis/commit/8a6f4d9acb1620af2156b42b37b54eae257b7cad --- google/cloud/talent_v4/__init__.py | 4 ++-- google/cloud/talent_v4beta1/__init__.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/google/cloud/talent_v4/__init__.py b/google/cloud/talent_v4/__init__.py index b193e4de..9bf1bf95 100644 --- a/google/cloud/talent_v4/__init__.py +++ b/google/cloud/talent_v4/__init__.py @@ -95,7 +95,6 @@ "CommuteFilter", "CommuteMethod", "Company", - "CompanyServiceClient", "CompanySize", "CompensationFilter", "CompensationInfo", @@ -144,10 +143,11 @@ "SearchJobsResponse", "SpellingCorrection", "Tenant", + "TenantServiceClient", "TimestampRange", "UpdateCompanyRequest", "UpdateJobRequest", "UpdateTenantRequest", "Visibility", - "TenantServiceClient", + "CompanyServiceClient", ) diff --git a/google/cloud/talent_v4beta1/__init__.py b/google/cloud/talent_v4beta1/__init__.py index b751ef4a..e486a156 100644 --- a/google/cloud/talent_v4beta1/__init__.py +++ b/google/cloud/talent_v4beta1/__init__.py @@ -186,7 +186,6 @@ "EmployerFilter", "EmploymentRecord", "EmploymentType", - "EventServiceClient", "GetApplicationRequest", "GetCompanyRequest", "GetJobRequest", @@ -203,6 +202,7 @@ "JobLevel", "JobOperationResult", "JobQuery", + "JobServiceClient", "JobTitleFilter", "JobView", "ListApplicationsRequest", @@ -253,5 +253,5 @@ "UpdateTenantRequest", "Visibility", "WorkExperienceFilter", - "JobServiceClient", + "EventServiceClient", ) From c2a9ce70ddc9740932498ec5ca4e4f7ed99b1158 Mon Sep 17 00:00:00 2001 From: yoshi-automation Date: Tue, 23 Mar 2021 18:37:54 -0700 Subject: [PATCH 03/38] chore: upgrade gapic-generator-python to 0.39.1 feat: add 'from_service_account_info' factory to clients fix: fix sphinx identifiers PiperOrigin-RevId: 350246057 Source-Author: Google APIs Source-Date: Tue Jan 5 16:44:11 2021 -0800 Source-Repo: googleapis/googleapis Source-Sha: 520682435235d9c503983a360a2090025aa47cd1 Source-Link: https://github.com/googleapis/googleapis/commit/520682435235d9c503983a360a2090025aa47cd1 --- .coveragerc | 31 +--- docs/talent_v4/company_service.rst | 11 ++ docs/talent_v4/completion.rst | 6 + docs/talent_v4/event_service.rst | 6 + docs/talent_v4/job_service.rst | 11 ++ docs/talent_v4/services.rst | 22 +-- docs/talent_v4/tenant_service.rst | 11 ++ docs/talent_v4/types.rst | 1 + docs/talent_v4beta1/application_service.rst | 11 ++ docs/talent_v4beta1/company_service.rst | 11 ++ docs/talent_v4beta1/completion.rst | 6 + docs/talent_v4beta1/event_service.rst | 6 + docs/talent_v4beta1/job_service.rst | 11 ++ docs/talent_v4beta1/profile_service.rst | 11 ++ docs/talent_v4beta1/services.rst | 30 +--- docs/talent_v4beta1/tenant_service.rst | 11 ++ docs/talent_v4beta1/types.rst | 1 + google/cloud/talent_v4/__init__.py | 4 +- .../services/company_service/async_client.py | 31 ++-- .../services/company_service/client.py | 60 ++++--- .../services/company_service/pagers.py | 16 +- .../services/completion/async_client.py | 5 +- .../talent_v4/services/completion/client.py | 26 ++- .../services/event_service/async_client.py | 9 +- .../services/event_service/client.py | 32 +++- .../services/job_service/async_client.py | 120 ++++++------- .../talent_v4/services/job_service/client.py | 159 ++++++++++-------- .../talent_v4/services/job_service/pagers.py | 16 +- .../services/tenant_service/async_client.py | 31 ++-- .../services/tenant_service/client.py | 60 ++++--- .../services/tenant_service/pagers.py | 16 +- google/cloud/talent_v4/types/common.py | 42 ++--- google/cloud/talent_v4/types/company.py | 6 +- .../cloud/talent_v4/types/company_service.py | 10 +- .../talent_v4/types/completion_service.py | 10 +- google/cloud/talent_v4/types/event.py | 6 +- google/cloud/talent_v4/types/event_service.py | 2 +- google/cloud/talent_v4/types/filters.py | 32 ++-- google/cloud/talent_v4/types/histogram.py | 2 +- google/cloud/talent_v4/types/job.py | 40 ++--- google/cloud/talent_v4/types/job_service.py | 62 +++---- .../cloud/talent_v4/types/tenant_service.py | 10 +- google/cloud/talent_v4beta1/__init__.py | 4 +- .../application_service/async_client.py | 29 ++-- .../services/application_service/client.py | 58 +++++-- .../services/application_service/pagers.py | 16 +- .../services/company_service/async_client.py | 28 +-- .../services/company_service/client.py | 57 +++++-- .../services/company_service/pagers.py | 16 +- .../services/completion/async_client.py | 5 +- .../services/completion/client.py | 26 ++- .../services/event_service/async_client.py | 9 +- .../services/event_service/client.py | 32 +++- .../services/job_service/async_client.py | 113 ++++++------- .../services/job_service/client.py | 152 +++++++++-------- .../services/job_service/pagers.py | 48 +++--- .../services/profile_service/async_client.py | 31 ++-- .../services/profile_service/client.py | 60 ++++--- .../services/profile_service/pagers.py | 32 ++-- .../services/tenant_service/async_client.py | 28 +-- .../services/tenant_service/client.py | 57 +++++-- .../services/tenant_service/pagers.py | 16 +- .../cloud/talent_v4beta1/types/application.py | 18 +- .../types/application_service.py | 10 +- google/cloud/talent_v4beta1/types/common.py | 54 +++--- google/cloud/talent_v4beta1/types/company.py | 6 +- .../talent_v4beta1/types/company_service.py | 10 +- .../types/completion_service.py | 10 +- google/cloud/talent_v4beta1/types/event.py | 10 +- .../talent_v4beta1/types/event_service.py | 2 +- google/cloud/talent_v4beta1/types/filters.py | 82 ++++----- .../cloud/talent_v4beta1/types/histogram.py | 2 +- google/cloud/talent_v4beta1/types/job.py | 40 ++--- .../cloud/talent_v4beta1/types/job_service.py | 58 +++---- google/cloud/talent_v4beta1/types/profile.py | 108 ++++++------ .../talent_v4beta1/types/profile_service.py | 28 +-- google/cloud/talent_v4beta1/types/tenant.py | 2 +- .../talent_v4beta1/types/tenant_service.py | 10 +- synth.metadata | 17 +- .../gapic/talent_v4/test_company_service.py | 28 ++- tests/unit/gapic/talent_v4/test_completion.py | 30 +++- .../gapic/talent_v4/test_event_service.py | 33 +++- .../unit/gapic/talent_v4/test_job_service.py | 30 +++- .../gapic/talent_v4/test_tenant_service.py | 28 ++- .../test_application_service.py | 28 ++- .../talent_v4beta1/test_company_service.py | 28 ++- .../gapic/talent_v4beta1/test_completion.py | 30 +++- .../talent_v4beta1/test_event_service.py | 33 +++- .../gapic/talent_v4beta1/test_job_service.py | 30 +++- .../talent_v4beta1/test_profile_service.py | 28 ++- .../talent_v4beta1/test_tenant_service.py | 28 ++- 91 files changed, 1604 insertions(+), 1038 deletions(-) create mode 100644 docs/talent_v4/company_service.rst create mode 100644 docs/talent_v4/completion.rst create mode 100644 docs/talent_v4/event_service.rst create mode 100644 docs/talent_v4/job_service.rst create mode 100644 docs/talent_v4/tenant_service.rst create mode 100644 docs/talent_v4beta1/application_service.rst create mode 100644 docs/talent_v4beta1/company_service.rst create mode 100644 docs/talent_v4beta1/completion.rst create mode 100644 docs/talent_v4beta1/event_service.rst create mode 100644 docs/talent_v4beta1/job_service.rst create mode 100644 docs/talent_v4beta1/profile_service.rst create mode 100644 docs/talent_v4beta1/tenant_service.rst diff --git a/.coveragerc b/.coveragerc index dd39c854..8a9e352c 100644 --- a/.coveragerc +++ b/.coveragerc @@ -1,35 +1,18 @@ -# -*- 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. - -# Generated by synthtool. DO NOT EDIT! [run] branch = True [report] fail_under = 100 show_missing = True +omit = + google/cloud/talent/__init__.py exclude_lines = # Re-enable the standard pragma pragma: NO COVER # Ignore debug-only repr def __repr__ - # Ignore abstract methods - raise NotImplementedError -omit = - */gapic/*.py - */proto/*.py - */core/*.py - */site-packages/*.py \ No newline at end of file + # Ignore pkg_resources exceptions. + # This is added at the module level as a safeguard for if someone + # generates the code and tries to run it without pip installing. This + # makes it virtually impossible to test properly. + except pkg_resources.DistributionNotFound diff --git a/docs/talent_v4/company_service.rst b/docs/talent_v4/company_service.rst new file mode 100644 index 00000000..f850f370 --- /dev/null +++ b/docs/talent_v4/company_service.rst @@ -0,0 +1,11 @@ +CompanyService +-------------------------------- + +.. automodule:: google.cloud.talent_v4.services.company_service + :members: + :inherited-members: + + +.. automodule:: google.cloud.talent_v4.services.company_service.pagers + :members: + :inherited-members: diff --git a/docs/talent_v4/completion.rst b/docs/talent_v4/completion.rst new file mode 100644 index 00000000..3044c5a8 --- /dev/null +++ b/docs/talent_v4/completion.rst @@ -0,0 +1,6 @@ +Completion +---------------------------- + +.. automodule:: google.cloud.talent_v4.services.completion + :members: + :inherited-members: diff --git a/docs/talent_v4/event_service.rst b/docs/talent_v4/event_service.rst new file mode 100644 index 00000000..1c90bae1 --- /dev/null +++ b/docs/talent_v4/event_service.rst @@ -0,0 +1,6 @@ +EventService +------------------------------ + +.. automodule:: google.cloud.talent_v4.services.event_service + :members: + :inherited-members: diff --git a/docs/talent_v4/job_service.rst b/docs/talent_v4/job_service.rst new file mode 100644 index 00000000..28d73f01 --- /dev/null +++ b/docs/talent_v4/job_service.rst @@ -0,0 +1,11 @@ +JobService +---------------------------- + +.. automodule:: google.cloud.talent_v4.services.job_service + :members: + :inherited-members: + + +.. automodule:: google.cloud.talent_v4.services.job_service.pagers + :members: + :inherited-members: diff --git a/docs/talent_v4/services.rst b/docs/talent_v4/services.rst index 5efed8a2..b2eb192c 100644 --- a/docs/talent_v4/services.rst +++ b/docs/talent_v4/services.rst @@ -1,18 +1,10 @@ Services for Google Cloud Talent v4 API ======================================= +.. toctree:: + :maxdepth: 2 -.. automodule:: google.cloud.talent_v4.services.company_service - :members: - :inherited-members: -.. automodule:: google.cloud.talent_v4.services.completion - :members: - :inherited-members: -.. automodule:: google.cloud.talent_v4.services.event_service - :members: - :inherited-members: -.. automodule:: google.cloud.talent_v4.services.job_service - :members: - :inherited-members: -.. automodule:: google.cloud.talent_v4.services.tenant_service - :members: - :inherited-members: + company_service + completion + event_service + job_service + tenant_service diff --git a/docs/talent_v4/tenant_service.rst b/docs/talent_v4/tenant_service.rst new file mode 100644 index 00000000..d38c6bcd --- /dev/null +++ b/docs/talent_v4/tenant_service.rst @@ -0,0 +1,11 @@ +TenantService +------------------------------- + +.. automodule:: google.cloud.talent_v4.services.tenant_service + :members: + :inherited-members: + + +.. automodule:: google.cloud.talent_v4.services.tenant_service.pagers + :members: + :inherited-members: diff --git a/docs/talent_v4/types.rst b/docs/talent_v4/types.rst index 559524b9..9c08edc9 100644 --- a/docs/talent_v4/types.rst +++ b/docs/talent_v4/types.rst @@ -3,4 +3,5 @@ Types for Google Cloud Talent v4 API .. automodule:: google.cloud.talent_v4.types :members: + :undoc-members: :show-inheritance: diff --git a/docs/talent_v4beta1/application_service.rst b/docs/talent_v4beta1/application_service.rst new file mode 100644 index 00000000..6539e8fd --- /dev/null +++ b/docs/talent_v4beta1/application_service.rst @@ -0,0 +1,11 @@ +ApplicationService +------------------------------------ + +.. automodule:: google.cloud.talent_v4beta1.services.application_service + :members: + :inherited-members: + + +.. automodule:: google.cloud.talent_v4beta1.services.application_service.pagers + :members: + :inherited-members: diff --git a/docs/talent_v4beta1/company_service.rst b/docs/talent_v4beta1/company_service.rst new file mode 100644 index 00000000..e2050c75 --- /dev/null +++ b/docs/talent_v4beta1/company_service.rst @@ -0,0 +1,11 @@ +CompanyService +-------------------------------- + +.. automodule:: google.cloud.talent_v4beta1.services.company_service + :members: + :inherited-members: + + +.. automodule:: google.cloud.talent_v4beta1.services.company_service.pagers + :members: + :inherited-members: diff --git a/docs/talent_v4beta1/completion.rst b/docs/talent_v4beta1/completion.rst new file mode 100644 index 00000000..764a23f3 --- /dev/null +++ b/docs/talent_v4beta1/completion.rst @@ -0,0 +1,6 @@ +Completion +---------------------------- + +.. automodule:: google.cloud.talent_v4beta1.services.completion + :members: + :inherited-members: diff --git a/docs/talent_v4beta1/event_service.rst b/docs/talent_v4beta1/event_service.rst new file mode 100644 index 00000000..8e489d4c --- /dev/null +++ b/docs/talent_v4beta1/event_service.rst @@ -0,0 +1,6 @@ +EventService +------------------------------ + +.. automodule:: google.cloud.talent_v4beta1.services.event_service + :members: + :inherited-members: diff --git a/docs/talent_v4beta1/job_service.rst b/docs/talent_v4beta1/job_service.rst new file mode 100644 index 00000000..a78f4f32 --- /dev/null +++ b/docs/talent_v4beta1/job_service.rst @@ -0,0 +1,11 @@ +JobService +---------------------------- + +.. automodule:: google.cloud.talent_v4beta1.services.job_service + :members: + :inherited-members: + + +.. automodule:: google.cloud.talent_v4beta1.services.job_service.pagers + :members: + :inherited-members: diff --git a/docs/talent_v4beta1/profile_service.rst b/docs/talent_v4beta1/profile_service.rst new file mode 100644 index 00000000..e558ed06 --- /dev/null +++ b/docs/talent_v4beta1/profile_service.rst @@ -0,0 +1,11 @@ +ProfileService +-------------------------------- + +.. automodule:: google.cloud.talent_v4beta1.services.profile_service + :members: + :inherited-members: + + +.. automodule:: google.cloud.talent_v4beta1.services.profile_service.pagers + :members: + :inherited-members: diff --git a/docs/talent_v4beta1/services.rst b/docs/talent_v4beta1/services.rst index babbaa4e..019f928f 100644 --- a/docs/talent_v4beta1/services.rst +++ b/docs/talent_v4beta1/services.rst @@ -1,24 +1,12 @@ Services for Google Cloud Talent v4beta1 API ============================================ +.. toctree:: + :maxdepth: 2 -.. 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: + application_service + company_service + completion + event_service + job_service + profile_service + tenant_service diff --git a/docs/talent_v4beta1/tenant_service.rst b/docs/talent_v4beta1/tenant_service.rst new file mode 100644 index 00000000..4de1dcfe --- /dev/null +++ b/docs/talent_v4beta1/tenant_service.rst @@ -0,0 +1,11 @@ +TenantService +------------------------------- + +.. automodule:: google.cloud.talent_v4beta1.services.tenant_service + :members: + :inherited-members: + + +.. automodule:: google.cloud.talent_v4beta1.services.tenant_service.pagers + :members: + :inherited-members: diff --git a/docs/talent_v4beta1/types.rst b/docs/talent_v4beta1/types.rst index 170f4b18..e6abbcac 100644 --- a/docs/talent_v4beta1/types.rst +++ b/docs/talent_v4beta1/types.rst @@ -3,4 +3,5 @@ Types for Google Cloud Talent v4beta1 API .. automodule:: google.cloud.talent_v4beta1.types :members: + :undoc-members: :show-inheritance: diff --git a/google/cloud/talent_v4/__init__.py b/google/cloud/talent_v4/__init__.py index 9bf1bf95..b193e4de 100644 --- a/google/cloud/talent_v4/__init__.py +++ b/google/cloud/talent_v4/__init__.py @@ -95,6 +95,7 @@ "CommuteFilter", "CommuteMethod", "Company", + "CompanyServiceClient", "CompanySize", "CompensationFilter", "CompensationInfo", @@ -143,11 +144,10 @@ "SearchJobsResponse", "SpellingCorrection", "Tenant", - "TenantServiceClient", "TimestampRange", "UpdateCompanyRequest", "UpdateJobRequest", "UpdateTenantRequest", "Visibility", - "CompanyServiceClient", + "TenantServiceClient", ) diff --git a/google/cloud/talent_v4/services/company_service/async_client.py b/google/cloud/talent_v4/services/company_service/async_client.py index dc84e1fd..ce76dc6c 100644 --- a/google/cloud/talent_v4/services/company_service/async_client.py +++ b/google/cloud/talent_v4/services/company_service/async_client.py @@ -84,6 +84,7 @@ class CompanyServiceAsyncClient: CompanyServiceClient.parse_common_location_path ) + from_service_account_info = CompanyServiceClient.from_service_account_info from_service_account_file = CompanyServiceClient.from_service_account_file from_service_account_json = from_service_account_file @@ -161,7 +162,7 @@ async def create_company( r"""Creates a new company entity. Args: - request (:class:`~.company_service.CreateCompanyRequest`): + request (:class:`google.cloud.talent_v4.types.CreateCompanyRequest`): The request object. The Request of the CreateCompany method. parent (:class:`str`): @@ -171,10 +172,11 @@ async def create_company( 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. - company (:class:`~.gct_company.Company`): + company (:class:`google.cloud.talent_v4.types.Company`): Required. The company to be created. This corresponds to the ``company`` field on the ``request`` instance; if ``request`` is provided, this @@ -187,7 +189,7 @@ async def create_company( sent along with the request as metadata. Returns: - ~.gct_company.Company: + google.cloud.talent_v4.types.Company: A Company resource represents a company in the service. A company is the entity that owns job postings, that is, @@ -248,7 +250,7 @@ async def get_company( r"""Retrieves specified company. Args: - request (:class:`~.company_service.GetCompanyRequest`): + request (:class:`google.cloud.talent_v4.types.GetCompanyRequest`): The request object. Request for getting a company by name. name (:class:`str`): @@ -259,6 +261,7 @@ async def get_company( "projects/{project_id}/tenants/{tenant_id}/companies/{company_id}", for example, "projects/api-test-project/tenants/foo/companies/bar". + This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -270,7 +273,7 @@ async def get_company( sent along with the request as metadata. Returns: - ~.company.Company: + google.cloud.talent_v4.types.Company: A Company resource represents a company in the service. A company is the entity that owns job postings, that is, @@ -338,17 +341,18 @@ async def update_company( r"""Updates specified company. Args: - request (:class:`~.company_service.UpdateCompanyRequest`): + request (:class:`google.cloud.talent_v4.types.UpdateCompanyRequest`): The request object. Request for updating a specified company. - company (:class:`~.gct_company.Company`): + company (:class:`google.cloud.talent_v4.types.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. - update_mask (:class:`~.field_mask.FieldMask`): + update_mask (:class:`google.protobuf.field_mask_pb2.FieldMask`): Strongly recommended for the best service experience. If @@ -360,6 +364,7 @@ async def update_company( A field mask to specify the company fields to be updated. Only top level fields of [Company][google.cloud.talent.v4.Company] are supported. + This corresponds to the ``update_mask`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -371,7 +376,7 @@ async def update_company( sent along with the request as metadata. Returns: - ~.gct_company.Company: + google.cloud.talent_v4.types.Company: A Company resource represents a company in the service. A company is the entity that owns job postings, that is, @@ -436,7 +441,7 @@ async def delete_company( it. Args: - request (:class:`~.company_service.DeleteCompanyRequest`): + request (:class:`google.cloud.talent_v4.types.DeleteCompanyRequest`): The request object. Request to delete a company. name (:class:`str`): Required. The resource name of the company to be @@ -445,6 +450,7 @@ async def delete_company( The format is "projects/{project_id}/tenants/{tenant_id}/companies/{company_id}", for example, "projects/foo/tenants/bar/companies/baz". + This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -512,7 +518,7 @@ async def list_companies( r"""Lists all companies associated with the project. Args: - request (:class:`~.company_service.ListCompaniesRequest`): + request (:class:`google.cloud.talent_v4.types.ListCompaniesRequest`): The request object. List companies for which the client has ACL visibility. parent (:class:`str`): @@ -522,6 +528,7 @@ async def list_companies( 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. @@ -533,7 +540,7 @@ async def list_companies( sent along with the request as metadata. Returns: - ~.pagers.ListCompaniesAsyncPager: + google.cloud.talent_v4.services.company_service.pagers.ListCompaniesAsyncPager: The List companies response object. Iterating over this object will yield results and resolve additional pages diff --git a/google/cloud/talent_v4/services/company_service/client.py b/google/cloud/talent_v4/services/company_service/client.py index 7b32d9b6..8cc6a72f 100644 --- a/google/cloud/talent_v4/services/company_service/client.py +++ b/google/cloud/talent_v4/services/company_service/client.py @@ -116,6 +116,22 @@ def _get_default_mtls_endpoint(api_endpoint): DEFAULT_ENDPOINT ) + @classmethod + def from_service_account_info(cls, info: dict, *args, **kwargs): + """Creates an instance of this client using the provided credentials info. + + Args: + info (dict): The service account private key info. + args: Additional arguments to pass to the constructor. + kwargs: Additional arguments to pass to the constructor. + + Returns: + CompanyServiceClient: The constructed client. + """ + credentials = service_account.Credentials.from_service_account_info(info) + kwargs["credentials"] = credentials + return cls(*args, **kwargs) + @classmethod def from_service_account_file(cls, filename: str, *args, **kwargs): """Creates an instance of this client using the provided credentials @@ -128,7 +144,7 @@ def from_service_account_file(cls, filename: str, *args, **kwargs): kwargs: Additional arguments to pass to the constructor. Returns: - {@api.name}: The constructed client. + CompanyServiceClient: The constructed client. """ credentials = service_account.Credentials.from_service_account_file(filename) kwargs["credentials"] = credentials @@ -249,10 +265,10 @@ def __init__( 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 (Union[str, CompanyServiceTransport]): The transport to use. If set to None, a transport is chosen automatically. - client_options (client_options_lib.ClientOptions): Custom options for the + client_options (google.api_core.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_ENDPOINT @@ -363,20 +379,21 @@ def create_company( r"""Creates a new company entity. Args: - request (:class:`~.company_service.CreateCompanyRequest`): + request (google.cloud.talent_v4.types.CreateCompanyRequest): The request object. The Request of the CreateCompany method. - parent (:class:`str`): + 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/tenants/bar". + This corresponds to the ``parent`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - company (:class:`~.gct_company.Company`): + company (google.cloud.talent_v4.types.Company): Required. The company to be created. This corresponds to the ``company`` field on the ``request`` instance; if ``request`` is provided, this @@ -389,7 +406,7 @@ def create_company( sent along with the request as metadata. Returns: - ~.gct_company.Company: + google.cloud.talent_v4.types.Company: A Company resource represents a company in the service. A company is the entity that owns job postings, that is, @@ -451,10 +468,10 @@ def get_company( r"""Retrieves specified company. Args: - request (:class:`~.company_service.GetCompanyRequest`): + request (google.cloud.talent_v4.types.GetCompanyRequest): The request object. Request for getting a company by name. - name (:class:`str`): + name (str): Required. The resource name of the company to be retrieved. @@ -462,6 +479,7 @@ def get_company( "projects/{project_id}/tenants/{tenant_id}/companies/{company_id}", for example, "projects/api-test-project/tenants/foo/companies/bar". + This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -473,7 +491,7 @@ def get_company( sent along with the request as metadata. Returns: - ~.company.Company: + google.cloud.talent_v4.types.Company: A Company resource represents a company in the service. A company is the entity that owns job postings, that is, @@ -534,17 +552,18 @@ def update_company( r"""Updates specified company. Args: - request (:class:`~.company_service.UpdateCompanyRequest`): + request (google.cloud.talent_v4.types.UpdateCompanyRequest): The request object. Request for updating a specified company. - company (:class:`~.gct_company.Company`): + company (google.cloud.talent_v4.types.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. - update_mask (:class:`~.field_mask.FieldMask`): + update_mask (google.protobuf.field_mask_pb2.FieldMask): Strongly recommended for the best service experience. If @@ -556,6 +575,7 @@ def update_company( A field mask to specify the company fields to be updated. Only top level fields of [Company][google.cloud.talent.v4.Company] are supported. + This corresponds to the ``update_mask`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -567,7 +587,7 @@ def update_company( sent along with the request as metadata. Returns: - ~.gct_company.Company: + google.cloud.talent_v4.types.Company: A Company resource represents a company in the service. A company is the entity that owns job postings, that is, @@ -633,15 +653,16 @@ def delete_company( it. Args: - request (:class:`~.company_service.DeleteCompanyRequest`): + request (google.cloud.talent_v4.types.DeleteCompanyRequest): The request object. Request to delete a company. - name (:class:`str`): + 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". + This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -702,16 +723,17 @@ def list_companies( r"""Lists all companies associated with the project. Args: - request (:class:`~.company_service.ListCompaniesRequest`): + request (google.cloud.talent_v4.types.ListCompaniesRequest): The request object. List companies for which the client has ACL visibility. - parent (:class:`str`): + 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/tenants/bar". + This corresponds to the ``parent`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -723,7 +745,7 @@ def list_companies( sent along with the request as metadata. Returns: - ~.pagers.ListCompaniesPager: + google.cloud.talent_v4.services.company_service.pagers.ListCompaniesPager: The List companies response object. Iterating over this object will yield results and resolve additional pages diff --git a/google/cloud/talent_v4/services/company_service/pagers.py b/google/cloud/talent_v4/services/company_service/pagers.py index 992c4b53..a9eafc75 100644 --- a/google/cloud/talent_v4/services/company_service/pagers.py +++ b/google/cloud/talent_v4/services/company_service/pagers.py @@ -25,7 +25,7 @@ class ListCompaniesPager: """A pager for iterating through ``list_companies`` requests. This class thinly wraps an initial - :class:`~.company_service.ListCompaniesResponse` object, and + :class:`google.cloud.talent_v4.types.ListCompaniesResponse` object, and provides an ``__iter__`` method to iterate through its ``companies`` field. @@ -34,7 +34,7 @@ class ListCompaniesPager: through the ``companies`` field on the corresponding responses. - All the usual :class:`~.company_service.ListCompaniesResponse` + All the usual :class:`google.cloud.talent_v4.types.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. """ @@ -52,9 +52,9 @@ def __init__( Args: method (Callable): The method that was originally called, and which instantiated this pager. - request (:class:`~.company_service.ListCompaniesRequest`): + request (google.cloud.talent_v4.types.ListCompaniesRequest): The initial request object. - response (:class:`~.company_service.ListCompaniesResponse`): + response (google.cloud.talent_v4.types.ListCompaniesResponse): The initial response object. metadata (Sequence[Tuple[str, str]]): Strings which should be sent along with the request as metadata. @@ -87,7 +87,7 @@ class ListCompaniesAsyncPager: """A pager for iterating through ``list_companies`` requests. This class thinly wraps an initial - :class:`~.company_service.ListCompaniesResponse` object, and + :class:`google.cloud.talent_v4.types.ListCompaniesResponse` object, and provides an ``__aiter__`` method to iterate through its ``companies`` field. @@ -96,7 +96,7 @@ class ListCompaniesAsyncPager: through the ``companies`` field on the corresponding responses. - All the usual :class:`~.company_service.ListCompaniesResponse` + All the usual :class:`google.cloud.talent_v4.types.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. """ @@ -114,9 +114,9 @@ def __init__( Args: method (Callable): The method that was originally called, and which instantiated this pager. - request (:class:`~.company_service.ListCompaniesRequest`): + request (google.cloud.talent_v4.types.ListCompaniesRequest): The initial request object. - response (:class:`~.company_service.ListCompaniesResponse`): + response (google.cloud.talent_v4.types.ListCompaniesResponse): The initial response object. metadata (Sequence[Tuple[str, str]]): Strings which should be sent along with the request as metadata. diff --git a/google/cloud/talent_v4/services/completion/async_client.py b/google/cloud/talent_v4/services/completion/async_client.py index 2c91e861..778ebbd2 100644 --- a/google/cloud/talent_v4/services/completion/async_client.py +++ b/google/cloud/talent_v4/services/completion/async_client.py @@ -72,6 +72,7 @@ class CompletionAsyncClient: CompletionClient.parse_common_location_path ) + from_service_account_info = CompletionClient.from_service_account_info from_service_account_file = CompletionClient.from_service_account_file from_service_account_json = from_service_account_file @@ -149,7 +150,7 @@ async def complete_query( complete search box. Args: - request (:class:`~.completion_service.CompleteQueryRequest`): + request (:class:`google.cloud.talent_v4.types.CompleteQueryRequest`): The request object. Auto-complete parameters. retry (google.api_core.retry.Retry): Designation of what errors, if any, @@ -159,7 +160,7 @@ async def complete_query( sent along with the request as metadata. Returns: - ~.completion_service.CompleteQueryResponse: + google.cloud.talent_v4.types.CompleteQueryResponse: Response of auto-complete query. """ # Create or coerce a protobuf request object. diff --git a/google/cloud/talent_v4/services/completion/client.py b/google/cloud/talent_v4/services/completion/client.py index 3d3b0589..0d4eb789 100644 --- a/google/cloud/talent_v4/services/completion/client.py +++ b/google/cloud/talent_v4/services/completion/client.py @@ -108,6 +108,22 @@ def _get_default_mtls_endpoint(api_endpoint): DEFAULT_ENDPOINT ) + @classmethod + def from_service_account_info(cls, info: dict, *args, **kwargs): + """Creates an instance of this client using the provided credentials info. + + Args: + info (dict): The service account private key info. + args: Additional arguments to pass to the constructor. + kwargs: Additional arguments to pass to the constructor. + + Returns: + CompletionClient: The constructed client. + """ + credentials = service_account.Credentials.from_service_account_info(info) + kwargs["credentials"] = credentials + return cls(*args, **kwargs) + @classmethod def from_service_account_file(cls, filename: str, *args, **kwargs): """Creates an instance of this client using the provided credentials @@ -120,7 +136,7 @@ def from_service_account_file(cls, filename: str, *args, **kwargs): kwargs: Additional arguments to pass to the constructor. Returns: - {@api.name}: The constructed client. + CompletionClient: The constructed client. """ credentials = service_account.Credentials.from_service_account_file(filename) kwargs["credentials"] = credentials @@ -241,10 +257,10 @@ def __init__( 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 (Union[str, CompletionTransport]): The transport to use. If set to None, a transport is chosen automatically. - client_options (client_options_lib.ClientOptions): Custom options for the + client_options (google.api_core.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_ENDPOINT @@ -355,7 +371,7 @@ def complete_query( complete search box. Args: - request (:class:`~.completion_service.CompleteQueryRequest`): + request (google.cloud.talent_v4.types.CompleteQueryRequest): The request object. Auto-complete parameters. retry (google.api_core.retry.Retry): Designation of what errors, if any, @@ -365,7 +381,7 @@ def complete_query( sent along with the request as metadata. Returns: - ~.completion_service.CompleteQueryResponse: + google.cloud.talent_v4.types.CompleteQueryResponse: Response of auto-complete query. """ # Create or coerce a protobuf request object. diff --git a/google/cloud/talent_v4/services/event_service/async_client.py b/google/cloud/talent_v4/services/event_service/async_client.py index 8a6a6e41..e5c364f0 100644 --- a/google/cloud/talent_v4/services/event_service/async_client.py +++ b/google/cloud/talent_v4/services/event_service/async_client.py @@ -73,6 +73,7 @@ class EventServiceAsyncClient: EventServiceClient.parse_common_location_path ) + from_service_account_info = EventServiceClient.from_service_account_info from_service_account_file = EventServiceClient.from_service_account_file from_service_account_json = from_service_account_file @@ -156,7 +157,7 @@ async def create_client_event( about self service tools. Args: - request (:class:`~.event_service.CreateClientEventRequest`): + request (:class:`google.cloud.talent_v4.types.CreateClientEventRequest`): The request object. The report event request. parent (:class:`str`): Required. Resource name of the tenant under which the @@ -165,13 +166,15 @@ async def create_client_event( 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. - client_event (:class:`~.event.ClientEvent`): + client_event (:class:`google.cloud.talent_v4.types.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. @@ -183,7 +186,7 @@ async def create_client_event( sent along with the request as metadata. Returns: - ~.event.ClientEvent: + google.cloud.talent_v4.types.ClientEvent: An event issued when an end user interacts with the application that implements Cloud Talent Solution. diff --git a/google/cloud/talent_v4/services/event_service/client.py b/google/cloud/talent_v4/services/event_service/client.py index 06f1fd4f..d962a574 100644 --- a/google/cloud/talent_v4/services/event_service/client.py +++ b/google/cloud/talent_v4/services/event_service/client.py @@ -109,6 +109,22 @@ def _get_default_mtls_endpoint(api_endpoint): DEFAULT_ENDPOINT ) + @classmethod + def from_service_account_info(cls, info: dict, *args, **kwargs): + """Creates an instance of this client using the provided credentials info. + + Args: + info (dict): The service account private key info. + args: Additional arguments to pass to the constructor. + kwargs: Additional arguments to pass to the constructor. + + Returns: + EventServiceClient: The constructed client. + """ + credentials = service_account.Credentials.from_service_account_info(info) + kwargs["credentials"] = credentials + return cls(*args, **kwargs) + @classmethod def from_service_account_file(cls, filename: str, *args, **kwargs): """Creates an instance of this client using the provided credentials @@ -121,7 +137,7 @@ def from_service_account_file(cls, filename: str, *args, **kwargs): kwargs: Additional arguments to pass to the constructor. Returns: - {@api.name}: The constructed client. + EventServiceClient: The constructed client. """ credentials = service_account.Credentials.from_service_account_file(filename) kwargs["credentials"] = credentials @@ -226,10 +242,10 @@ def __init__( 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 (Union[str, EventServiceTransport]): The transport to use. If set to None, a transport is chosen automatically. - client_options (client_options_lib.ClientOptions): Custom options for the + client_options (google.api_core.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_ENDPOINT @@ -346,22 +362,24 @@ def create_client_event( about self service tools. Args: - request (:class:`~.event_service.CreateClientEventRequest`): + request (google.cloud.talent_v4.types.CreateClientEventRequest): The request object. The report event request. - parent (:class:`str`): + 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/tenants/bar". + This corresponds to the ``parent`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - client_event (:class:`~.event.ClientEvent`): + client_event (google.cloud.talent_v4.types.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. @@ -373,7 +391,7 @@ def create_client_event( sent along with the request as metadata. Returns: - ~.event.ClientEvent: + google.cloud.talent_v4.types.ClientEvent: An event issued when an end user interacts with the application that implements Cloud Talent Solution. diff --git a/google/cloud/talent_v4/services/job_service/async_client.py b/google/cloud/talent_v4/services/job_service/async_client.py index ec420503..88e0e7ca 100644 --- a/google/cloud/talent_v4/services/job_service/async_client.py +++ b/google/cloud/talent_v4/services/job_service/async_client.py @@ -84,6 +84,7 @@ class JobServiceAsyncClient: JobServiceClient.parse_common_location_path ) + from_service_account_info = JobServiceClient.from_service_account_info from_service_account_file = JobServiceClient.from_service_account_file from_service_account_json = from_service_account_file @@ -163,7 +164,7 @@ async def create_job( but it may take up to 5 minutes. Args: - request (:class:`~.job_service.CreateJobRequest`): + request (:class:`google.cloud.talent_v4.types.CreateJobRequest`): The request object. Create job request. parent (:class:`str`): Required. The resource name of the tenant under which @@ -172,10 +173,11 @@ async def create_job( 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. - job (:class:`~.gct_job.Job`): + job (:class:`google.cloud.talent_v4.types.Job`): Required. The Job to be created. This corresponds to the ``job`` field on the ``request`` instance; if ``request`` is provided, this @@ -188,11 +190,11 @@ async def create_job( 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.v4.Company], - which is the hiring entity responsible for the job. + google.cloud.talent_v4.types.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.v4.Company], which is + the hiring entity responsible for the job. """ # Create or coerce a protobuf request object. @@ -248,7 +250,7 @@ async def batch_create_jobs( r"""Begins executing a batch create jobs operation. Args: - request (:class:`~.job_service.BatchCreateJobsRequest`): + request (:class:`google.cloud.talent_v4.types.BatchCreateJobsRequest`): The request object. Request to create a batch of jobs. parent (:class:`str`): Required. The resource name of the tenant under which @@ -257,13 +259,15 @@ async def batch_create_jobs( 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. - jobs (:class:`Sequence[~.job.Job]`): + jobs (:class:`Sequence[google.cloud.talent_v4.types.Job]`): Required. The jobs to be created. A maximum of 200 jobs can be created in a batch. + This corresponds to the ``jobs`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -275,16 +279,13 @@ async def batch_create_jobs( sent along with the request as metadata. Returns: - ~.operation_async.AsyncOperation: + google.api_core.operation_async.AsyncOperation: An object representing a long-running operation. - The result type for the operation will be - :class:``~.job_service.BatchCreateJobsResponse``: The - result of - [JobService.BatchCreateJobs][google.cloud.talent.v4.JobService.BatchCreateJobs]. - It's used to replace - [google.longrunning.Operation.response][google.longrunning.Operation.response] - in case of success. + The result type for the operation will be :class:`google.cloud.talent_v4.types.BatchCreateJobsResponse` The result of [JobService.BatchCreateJobs][google.cloud.talent.v4.JobService.BatchCreateJobs]. It's used to + replace + [google.longrunning.Operation.response][google.longrunning.Operation.response] + in case of success. """ # Create or coerce a protobuf request object. @@ -349,7 +350,7 @@ async def get_job( recently EXPIRED within the last 90 days. Args: - request (:class:`~.job_service.GetJobRequest`): + request (:class:`google.cloud.talent_v4.types.GetJobRequest`): The request object. Get job request. name (:class:`str`): Required. The resource name of the job to retrieve. @@ -357,6 +358,7 @@ async def get_job( The format is "projects/{project_id}/tenants/{tenant_id}/jobs/{job_id}". For example, "projects/foo/tenants/bar/jobs/baz". + This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -368,11 +370,11 @@ async def get_job( 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.v4.Company], - which is the hiring entity responsible for the job. + google.cloud.talent_v4.types.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.v4.Company], which is + the hiring entity responsible for the job. """ # Create or coerce a protobuf request object. @@ -437,14 +439,14 @@ async def update_job( minutes. Args: - request (:class:`~.job_service.UpdateJobRequest`): + request (:class:`google.cloud.talent_v4.types.UpdateJobRequest`): The request object. Update job request. - job (:class:`~.gct_job.Job`): + job (:class:`google.cloud.talent_v4.types.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. - update_mask (:class:`~.field_mask.FieldMask`): + update_mask (:class:`google.protobuf.field_mask_pb2.FieldMask`): Strongly recommended for the best service experience. If @@ -456,6 +458,7 @@ async def update_job( A field mask to restrict the fields that are updated. Only top level fields of [Job][google.cloud.talent.v4.Job] are supported. + This corresponds to the ``update_mask`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -467,11 +470,11 @@ async def update_job( 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.v4.Company], - which is the hiring entity responsible for the job. + google.cloud.talent_v4.types.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.v4.Company], which is + the hiring entity responsible for the job. """ # Create or coerce a protobuf request object. @@ -527,7 +530,7 @@ async def batch_update_jobs( r"""Begins executing a batch update jobs operation. Args: - request (:class:`~.job_service.BatchUpdateJobsRequest`): + request (:class:`google.cloud.talent_v4.types.BatchUpdateJobsRequest`): The request object. Request to update a batch of jobs. parent (:class:`str`): Required. The resource name of the tenant under which @@ -536,13 +539,15 @@ async def batch_update_jobs( 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. - jobs (:class:`Sequence[~.job.Job]`): + jobs (:class:`Sequence[google.cloud.talent_v4.types.Job]`): Required. The jobs to be updated. A maximum of 200 jobs can be updated in a batch. + This corresponds to the ``jobs`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -554,16 +559,13 @@ async def batch_update_jobs( sent along with the request as metadata. Returns: - ~.operation_async.AsyncOperation: + google.api_core.operation_async.AsyncOperation: An object representing a long-running operation. - The result type for the operation will be - :class:``~.job_service.BatchUpdateJobsResponse``: The - result of - [JobService.BatchUpdateJobs][google.cloud.talent.v4.JobService.BatchUpdateJobs]. - It's used to replace - [google.longrunning.Operation.response][google.longrunning.Operation.response] - in case of success. + The result type for the operation will be :class:`google.cloud.talent_v4.types.BatchUpdateJobsResponse` The result of [JobService.BatchUpdateJobs][google.cloud.talent.v4.JobService.BatchUpdateJobs]. It's used to + replace + [google.longrunning.Operation.response][google.longrunning.Operation.response] + in case of success. """ # Create or coerce a protobuf request object. @@ -629,7 +631,7 @@ async def delete_job( seconds, but it may take up to 5 minutes. Args: - request (:class:`~.job_service.DeleteJobRequest`): + request (:class:`google.cloud.talent_v4.types.DeleteJobRequest`): The request object. Delete job request. name (:class:`str`): Required. The resource name of the job to be deleted. @@ -637,6 +639,7 @@ async def delete_job( The format is "projects/{project_id}/tenants/{tenant_id}/jobs/{job_id}". For example, "projects/foo/tenants/bar/jobs/baz". + This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -705,7 +708,7 @@ async def batch_delete_jobs( r"""Begins executing a batch delete jobs operation. Args: - request (:class:`~.job_service.BatchDeleteJobsRequest`): + request (:class:`google.cloud.talent_v4.types.BatchDeleteJobsRequest`): The request object. Request to delete a batch of jobs. parent (:class:`str`): Required. The resource name of the tenant under which @@ -717,6 +720,7 @@ async def batch_delete_jobs( The parent of all of the jobs specified in ``names`` must match this field. + This corresponds to the ``parent`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -728,6 +732,7 @@ async def batch_delete_jobs( For example, "projects/foo/tenants/bar/jobs/baz". A maximum of 200 jobs can be deleted in a batch. + This corresponds to the ``names`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -739,16 +744,13 @@ async def batch_delete_jobs( sent along with the request as metadata. Returns: - ~.operation_async.AsyncOperation: + google.api_core.operation_async.AsyncOperation: An object representing a long-running operation. - The result type for the operation will be - :class:``~.job_service.BatchDeleteJobsResponse``: The - result of - [JobService.BatchDeleteJobs][google.cloud.talent.v4.JobService.BatchDeleteJobs]. - It's used to replace - [google.longrunning.Operation.response][google.longrunning.Operation.response] - in case of success. + The result type for the operation will be :class:`google.cloud.talent_v4.types.BatchDeleteJobsResponse` The result of [JobService.BatchDeleteJobs][google.cloud.talent.v4.JobService.BatchDeleteJobs]. It's used to + replace + [google.longrunning.Operation.response][google.longrunning.Operation.response] + in case of success. """ # Create or coerce a protobuf request object. @@ -813,7 +815,7 @@ async def list_jobs( r"""Lists jobs by filter. Args: - request (:class:`~.job_service.ListJobsRequest`): + request (:class:`google.cloud.talent_v4.types.ListJobsRequest`): The request object. List jobs request. parent (:class:`str`): Required. The resource name of the tenant under which @@ -822,6 +824,7 @@ async def list_jobs( 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. @@ -847,7 +850,8 @@ async def list_jobs( requisitionId = "req-1" - companyName = "projects/foo/tenants/bar/companies/baz" AND status = - "EXPIRED". + "EXPIRED" + This corresponds to the ``filter`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -859,7 +863,7 @@ async def list_jobs( sent along with the request as metadata. Returns: - ~.pagers.ListJobsAsyncPager: + google.cloud.talent_v4.services.job_service.pagers.ListJobsAsyncPager: List jobs response. Iterating over this object will yield results and resolve additional pages @@ -937,7 +941,7 @@ async def search_jobs( has permission to search against. Args: - request (:class:`~.job_service.SearchJobsRequest`): + request (:class:`google.cloud.talent_v4.types.SearchJobsRequest`): The request object. The Request body of the `SearchJobs` call. @@ -948,7 +952,7 @@ async def search_jobs( sent along with the request as metadata. Returns: - ~.job_service.SearchJobsResponse: + google.cloud.talent_v4.types.SearchJobsResponse: Response for SearchJob method. """ # Create or coerce a protobuf request object. @@ -998,7 +1002,7 @@ async def search_jobs_for_alert( permission to search against. Args: - request (:class:`~.job_service.SearchJobsRequest`): + request (:class:`google.cloud.talent_v4.types.SearchJobsRequest`): The request object. The Request body of the `SearchJobs` call. @@ -1009,7 +1013,7 @@ async def search_jobs_for_alert( sent along with the request as metadata. Returns: - ~.job_service.SearchJobsResponse: + google.cloud.talent_v4.types.SearchJobsResponse: Response for SearchJob method. """ # Create or coerce a protobuf request object. diff --git a/google/cloud/talent_v4/services/job_service/client.py b/google/cloud/talent_v4/services/job_service/client.py index 0e8ec2b0..ea5bff91 100644 --- a/google/cloud/talent_v4/services/job_service/client.py +++ b/google/cloud/talent_v4/services/job_service/client.py @@ -118,6 +118,22 @@ def _get_default_mtls_endpoint(api_endpoint): DEFAULT_ENDPOINT ) + @classmethod + def from_service_account_info(cls, info: dict, *args, **kwargs): + """Creates an instance of this client using the provided credentials info. + + Args: + info (dict): The service account private key info. + args: Additional arguments to pass to the constructor. + kwargs: Additional arguments to pass to the constructor. + + Returns: + JobServiceClient: The constructed client. + """ + credentials = service_account.Credentials.from_service_account_info(info) + kwargs["credentials"] = credentials + return cls(*args, **kwargs) + @classmethod def from_service_account_file(cls, filename: str, *args, **kwargs): """Creates an instance of this client using the provided credentials @@ -130,7 +146,7 @@ def from_service_account_file(cls, filename: str, *args, **kwargs): kwargs: Additional arguments to pass to the constructor. Returns: - {@api.name}: The constructed client. + JobServiceClient: The constructed client. """ credentials = service_account.Credentials.from_service_account_file(filename) kwargs["credentials"] = credentials @@ -267,10 +283,10 @@ def __init__( 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 (Union[str, JobServiceTransport]): The transport to use. If set to None, a transport is chosen automatically. - client_options (client_options_lib.ClientOptions): Custom options for the + client_options (google.api_core.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_ENDPOINT @@ -383,19 +399,20 @@ def create_job( but it may take up to 5 minutes. Args: - request (:class:`~.job_service.CreateJobRequest`): + request (google.cloud.talent_v4.types.CreateJobRequest): The request object. Create job request. - parent (:class:`str`): + 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/tenants/bar". + This corresponds to the ``parent`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - job (:class:`~.gct_job.Job`): + job (google.cloud.talent_v4.types.Job): Required. The Job to be created. This corresponds to the ``job`` field on the ``request`` instance; if ``request`` is provided, this @@ -408,11 +425,11 @@ def create_job( 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.v4.Company], - which is the hiring entity responsible for the job. + google.cloud.talent_v4.types.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.v4.Company], which is + the hiring entity responsible for the job. """ # Create or coerce a protobuf request object. @@ -469,22 +486,24 @@ def batch_create_jobs( r"""Begins executing a batch create jobs operation. Args: - request (:class:`~.job_service.BatchCreateJobsRequest`): + request (google.cloud.talent_v4.types.BatchCreateJobsRequest): The request object. Request to create a batch of jobs. - parent (:class:`str`): + 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/tenants/bar". + This corresponds to the ``parent`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - jobs (:class:`Sequence[~.job.Job]`): + jobs (Sequence[google.cloud.talent_v4.types.Job]): Required. The jobs to be created. A maximum of 200 jobs can be created in a batch. + This corresponds to the ``jobs`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -496,16 +515,13 @@ def batch_create_jobs( sent along with the request as metadata. Returns: - ~.operation.Operation: + google.api_core.operation.Operation: An object representing a long-running operation. - The result type for the operation will be - :class:``~.job_service.BatchCreateJobsResponse``: The - result of - [JobService.BatchCreateJobs][google.cloud.talent.v4.JobService.BatchCreateJobs]. - It's used to replace - [google.longrunning.Operation.response][google.longrunning.Operation.response] - in case of success. + The result type for the operation will be :class:`google.cloud.talent_v4.types.BatchCreateJobsResponse` The result of [JobService.BatchCreateJobs][google.cloud.talent.v4.JobService.BatchCreateJobs]. It's used to + replace + [google.longrunning.Operation.response][google.longrunning.Operation.response] + in case of success. """ # Create or coerce a protobuf request object. @@ -571,14 +587,15 @@ def get_job( recently EXPIRED within the last 90 days. Args: - request (:class:`~.job_service.GetJobRequest`): + request (google.cloud.talent_v4.types.GetJobRequest): The request object. Get job request. - name (:class:`str`): + 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". + This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -590,11 +607,11 @@ def get_job( 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.v4.Company], - which is the hiring entity responsible for the job. + google.cloud.talent_v4.types.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.v4.Company], which is + the hiring entity responsible for the job. """ # Create or coerce a protobuf request object. @@ -652,14 +669,14 @@ def update_job( minutes. Args: - request (:class:`~.job_service.UpdateJobRequest`): + request (google.cloud.talent_v4.types.UpdateJobRequest): The request object. Update job request. - job (:class:`~.gct_job.Job`): + job (google.cloud.talent_v4.types.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. - update_mask (:class:`~.field_mask.FieldMask`): + update_mask (google.protobuf.field_mask_pb2.FieldMask): Strongly recommended for the best service experience. If @@ -671,6 +688,7 @@ def update_job( A field mask to restrict the fields that are updated. Only top level fields of [Job][google.cloud.talent.v4.Job] are supported. + This corresponds to the ``update_mask`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -682,11 +700,11 @@ def update_job( 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.v4.Company], - which is the hiring entity responsible for the job. + google.cloud.talent_v4.types.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.v4.Company], which is + the hiring entity responsible for the job. """ # Create or coerce a protobuf request object. @@ -743,22 +761,24 @@ def batch_update_jobs( r"""Begins executing a batch update jobs operation. Args: - request (:class:`~.job_service.BatchUpdateJobsRequest`): + request (google.cloud.talent_v4.types.BatchUpdateJobsRequest): The request object. Request to update a batch of jobs. - parent (:class:`str`): + 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/tenants/bar". + This corresponds to the ``parent`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - jobs (:class:`Sequence[~.job.Job]`): + jobs (Sequence[google.cloud.talent_v4.types.Job]): Required. The jobs to be updated. A maximum of 200 jobs can be updated in a batch. + This corresponds to the ``jobs`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -770,16 +790,13 @@ def batch_update_jobs( sent along with the request as metadata. Returns: - ~.operation.Operation: + google.api_core.operation.Operation: An object representing a long-running operation. - The result type for the operation will be - :class:``~.job_service.BatchUpdateJobsResponse``: The - result of - [JobService.BatchUpdateJobs][google.cloud.talent.v4.JobService.BatchUpdateJobs]. - It's used to replace - [google.longrunning.Operation.response][google.longrunning.Operation.response] - in case of success. + The result type for the operation will be :class:`google.cloud.talent_v4.types.BatchUpdateJobsResponse` The result of [JobService.BatchUpdateJobs][google.cloud.talent.v4.JobService.BatchUpdateJobs]. It's used to + replace + [google.longrunning.Operation.response][google.longrunning.Operation.response] + in case of success. """ # Create or coerce a protobuf request object. @@ -846,14 +863,15 @@ def delete_job( seconds, but it may take up to 5 minutes. Args: - request (:class:`~.job_service.DeleteJobRequest`): + request (google.cloud.talent_v4.types.DeleteJobRequest): The request object. Delete job request. - name (:class:`str`): + 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". + This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -915,9 +933,9 @@ def batch_delete_jobs( r"""Begins executing a batch delete jobs operation. Args: - request (:class:`~.job_service.BatchDeleteJobsRequest`): + request (google.cloud.talent_v4.types.BatchDeleteJobsRequest): The request object. Request to delete a batch of jobs. - parent (:class:`str`): + parent (str): Required. The resource name of the tenant under which the job is created. @@ -927,10 +945,11 @@ def batch_delete_jobs( The parent of all of the jobs specified in ``names`` must match this field. + This corresponds to the ``parent`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - names (:class:`Sequence[str]`): + names (Sequence[str]): The names of the jobs to delete. The format is @@ -938,6 +957,7 @@ def batch_delete_jobs( For example, "projects/foo/tenants/bar/jobs/baz". A maximum of 200 jobs can be deleted in a batch. + This corresponds to the ``names`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -949,16 +969,13 @@ def batch_delete_jobs( sent along with the request as metadata. Returns: - ~.operation.Operation: + google.api_core.operation.Operation: An object representing a long-running operation. - The result type for the operation will be - :class:``~.job_service.BatchDeleteJobsResponse``: The - result of - [JobService.BatchDeleteJobs][google.cloud.talent.v4.JobService.BatchDeleteJobs]. - It's used to replace - [google.longrunning.Operation.response][google.longrunning.Operation.response] - in case of success. + The result type for the operation will be :class:`google.cloud.talent_v4.types.BatchDeleteJobsResponse` The result of [JobService.BatchDeleteJobs][google.cloud.talent.v4.JobService.BatchDeleteJobs]. It's used to + replace + [google.longrunning.Operation.response][google.longrunning.Operation.response] + in case of success. """ # Create or coerce a protobuf request object. @@ -1024,19 +1041,20 @@ def list_jobs( r"""Lists jobs by filter. Args: - request (:class:`~.job_service.ListJobsRequest`): + request (google.cloud.talent_v4.types.ListJobsRequest): The request object. List jobs request. - parent (:class:`str`): + 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/tenants/bar". + This corresponds to the ``parent`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - filter (:class:`str`): + filter (str): Required. The filter string specifies the jobs to be enumerated. @@ -1058,7 +1076,8 @@ def list_jobs( requisitionId = "req-1" - companyName = "projects/foo/tenants/bar/companies/baz" AND status = - "EXPIRED". + "EXPIRED" + This corresponds to the ``filter`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -1070,7 +1089,7 @@ def list_jobs( sent along with the request as metadata. Returns: - ~.pagers.ListJobsPager: + google.cloud.talent_v4.services.job_service.pagers.ListJobsPager: List jobs response. Iterating over this object will yield results and resolve additional pages @@ -1141,7 +1160,7 @@ def search_jobs( has permission to search against. Args: - request (:class:`~.job_service.SearchJobsRequest`): + request (google.cloud.talent_v4.types.SearchJobsRequest): The request object. The Request body of the `SearchJobs` call. @@ -1152,7 +1171,7 @@ def search_jobs( sent along with the request as metadata. Returns: - ~.job_service.SearchJobsResponse: + google.cloud.talent_v4.types.SearchJobsResponse: Response for SearchJob method. """ # Create or coerce a protobuf request object. @@ -1203,7 +1222,7 @@ def search_jobs_for_alert( permission to search against. Args: - request (:class:`~.job_service.SearchJobsRequest`): + request (google.cloud.talent_v4.types.SearchJobsRequest): The request object. The Request body of the `SearchJobs` call. @@ -1214,7 +1233,7 @@ def search_jobs_for_alert( sent along with the request as metadata. Returns: - ~.job_service.SearchJobsResponse: + google.cloud.talent_v4.types.SearchJobsResponse: Response for SearchJob method. """ # Create or coerce a protobuf request object. diff --git a/google/cloud/talent_v4/services/job_service/pagers.py b/google/cloud/talent_v4/services/job_service/pagers.py index e759d8e3..15f5218f 100644 --- a/google/cloud/talent_v4/services/job_service/pagers.py +++ b/google/cloud/talent_v4/services/job_service/pagers.py @@ -25,7 +25,7 @@ class ListJobsPager: """A pager for iterating through ``list_jobs`` requests. This class thinly wraps an initial - :class:`~.job_service.ListJobsResponse` object, and + :class:`google.cloud.talent_v4.types.ListJobsResponse` object, and provides an ``__iter__`` method to iterate through its ``jobs`` field. @@ -34,7 +34,7 @@ class ListJobsPager: through the ``jobs`` field on the corresponding responses. - All the usual :class:`~.job_service.ListJobsResponse` + All the usual :class:`google.cloud.talent_v4.types.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. """ @@ -52,9 +52,9 @@ def __init__( Args: method (Callable): The method that was originally called, and which instantiated this pager. - request (:class:`~.job_service.ListJobsRequest`): + request (google.cloud.talent_v4.types.ListJobsRequest): The initial request object. - response (:class:`~.job_service.ListJobsResponse`): + response (google.cloud.talent_v4.types.ListJobsResponse): The initial response object. metadata (Sequence[Tuple[str, str]]): Strings which should be sent along with the request as metadata. @@ -87,7 +87,7 @@ class ListJobsAsyncPager: """A pager for iterating through ``list_jobs`` requests. This class thinly wraps an initial - :class:`~.job_service.ListJobsResponse` object, and + :class:`google.cloud.talent_v4.types.ListJobsResponse` object, and provides an ``__aiter__`` method to iterate through its ``jobs`` field. @@ -96,7 +96,7 @@ class ListJobsAsyncPager: through the ``jobs`` field on the corresponding responses. - All the usual :class:`~.job_service.ListJobsResponse` + All the usual :class:`google.cloud.talent_v4.types.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. """ @@ -114,9 +114,9 @@ def __init__( Args: method (Callable): The method that was originally called, and which instantiated this pager. - request (:class:`~.job_service.ListJobsRequest`): + request (google.cloud.talent_v4.types.ListJobsRequest): The initial request object. - response (:class:`~.job_service.ListJobsResponse`): + response (google.cloud.talent_v4.types.ListJobsResponse): The initial response object. metadata (Sequence[Tuple[str, str]]): Strings which should be sent along with the request as metadata. diff --git a/google/cloud/talent_v4/services/tenant_service/async_client.py b/google/cloud/talent_v4/services/tenant_service/async_client.py index 07940a99..46170195 100644 --- a/google/cloud/talent_v4/services/tenant_service/async_client.py +++ b/google/cloud/talent_v4/services/tenant_service/async_client.py @@ -81,6 +81,7 @@ class TenantServiceAsyncClient: TenantServiceClient.parse_common_location_path ) + from_service_account_info = TenantServiceClient.from_service_account_info from_service_account_file = TenantServiceClient.from_service_account_file from_service_account_json = from_service_account_file @@ -158,7 +159,7 @@ async def create_tenant( r"""Creates a new tenant entity. Args: - request (:class:`~.tenant_service.CreateTenantRequest`): + request (:class:`google.cloud.talent_v4.types.CreateTenantRequest`): The request object. The Request of the CreateTenant method. parent (:class:`str`): @@ -167,10 +168,11 @@ async def create_tenant( 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`): + tenant (:class:`google.cloud.talent_v4.types.Tenant`): Required. The tenant to be created. This corresponds to the ``tenant`` field on the ``request`` instance; if ``request`` is provided, this @@ -183,7 +185,7 @@ async def create_tenant( sent along with the request as metadata. Returns: - ~.gct_tenant.Tenant: + google.cloud.talent_v4.types.Tenant: A Tenant resource represents a tenant in the service. A tenant is a group or entity that shares common access with @@ -245,7 +247,7 @@ async def get_tenant( r"""Retrieves specified tenant. Args: - request (:class:`~.tenant_service.GetTenantRequest`): + request (:class:`google.cloud.talent_v4.types.GetTenantRequest`): The request object. Request for getting a tenant by name. name (:class:`str`): @@ -255,6 +257,7 @@ async def get_tenant( 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. @@ -266,7 +269,7 @@ async def get_tenant( sent along with the request as metadata. Returns: - ~.tenant.Tenant: + google.cloud.talent_v4.types.Tenant: A Tenant resource represents a tenant in the service. A tenant is a group or entity that shares common access with @@ -335,17 +338,18 @@ async def update_tenant( r"""Updates specified tenant. Args: - request (:class:`~.tenant_service.UpdateTenantRequest`): + request (:class:`google.cloud.talent_v4.types.UpdateTenantRequest`): The request object. Request for updating a specified tenant. - tenant (:class:`~.gct_tenant.Tenant`): + tenant (:class:`google.cloud.talent_v4.types.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. - update_mask (:class:`~.field_mask.FieldMask`): + update_mask (:class:`google.protobuf.field_mask_pb2.FieldMask`): Strongly recommended for the best service experience. If @@ -357,6 +361,7 @@ async def update_tenant( A field mask to specify the tenant fields to be updated. Only top level fields of [Tenant][google.cloud.talent.v4.Tenant] are supported. + This corresponds to the ``update_mask`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -368,7 +373,7 @@ async def update_tenant( sent along with the request as metadata. Returns: - ~.gct_tenant.Tenant: + google.cloud.talent_v4.types.Tenant: A Tenant resource represents a tenant in the service. A tenant is a group or entity that shares common access with @@ -432,7 +437,7 @@ async def delete_tenant( r"""Deletes specified tenant. Args: - request (:class:`~.tenant_service.DeleteTenantRequest`): + request (:class:`google.cloud.talent_v4.types.DeleteTenantRequest`): The request object. Request to delete a tenant. name (:class:`str`): Required. The resource name of the tenant to be deleted. @@ -440,6 +445,7 @@ async def delete_tenant( 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. @@ -507,7 +513,7 @@ async def list_tenants( r"""Lists all tenants associated with the project. Args: - request (:class:`~.tenant_service.ListTenantsRequest`): + request (:class:`google.cloud.talent_v4.types.ListTenantsRequest`): The request object. List tenants for which the client has ACL visibility. parent (:class:`str`): @@ -516,6 +522,7 @@ async def list_tenants( 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. @@ -527,7 +534,7 @@ async def list_tenants( sent along with the request as metadata. Returns: - ~.pagers.ListTenantsAsyncPager: + google.cloud.talent_v4.services.tenant_service.pagers.ListTenantsAsyncPager: The List tenants response object. Iterating over this object will yield results and resolve additional pages diff --git a/google/cloud/talent_v4/services/tenant_service/client.py b/google/cloud/talent_v4/services/tenant_service/client.py index 7492a9c3..30cb76bf 100644 --- a/google/cloud/talent_v4/services/tenant_service/client.py +++ b/google/cloud/talent_v4/services/tenant_service/client.py @@ -113,6 +113,22 @@ def _get_default_mtls_endpoint(api_endpoint): DEFAULT_ENDPOINT ) + @classmethod + def from_service_account_info(cls, info: dict, *args, **kwargs): + """Creates an instance of this client using the provided credentials info. + + Args: + info (dict): The service account private key info. + args: Additional arguments to pass to the constructor. + kwargs: Additional arguments to pass to the constructor. + + Returns: + TenantServiceClient: The constructed client. + """ + credentials = service_account.Credentials.from_service_account_info(info) + kwargs["credentials"] = credentials + return cls(*args, **kwargs) + @classmethod def from_service_account_file(cls, filename: str, *args, **kwargs): """Creates an instance of this client using the provided credentials @@ -125,7 +141,7 @@ def from_service_account_file(cls, filename: str, *args, **kwargs): kwargs: Additional arguments to pass to the constructor. Returns: - {@api.name}: The constructed client. + TenantServiceClient: The constructed client. """ credentials = service_account.Credentials.from_service_account_file(filename) kwargs["credentials"] = credentials @@ -230,10 +246,10 @@ def __init__( 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 (Union[str, TenantServiceTransport]): The transport to use. If set to None, a transport is chosen automatically. - client_options (client_options_lib.ClientOptions): Custom options for the + client_options (google.api_core.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_ENDPOINT @@ -344,19 +360,20 @@ def create_tenant( r"""Creates a new tenant entity. Args: - request (:class:`~.tenant_service.CreateTenantRequest`): + request (google.cloud.talent_v4.types.CreateTenantRequest): The request object. The Request of the CreateTenant method. - parent (:class:`str`): + parent (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`): + tenant (google.cloud.talent_v4.types.Tenant): Required. The tenant to be created. This corresponds to the ``tenant`` field on the ``request`` instance; if ``request`` is provided, this @@ -369,7 +386,7 @@ def create_tenant( sent along with the request as metadata. Returns: - ~.gct_tenant.Tenant: + google.cloud.talent_v4.types.Tenant: A Tenant resource represents a tenant in the service. A tenant is a group or entity that shares common access with @@ -432,16 +449,17 @@ def get_tenant( r"""Retrieves specified tenant. Args: - request (:class:`~.tenant_service.GetTenantRequest`): + request (google.cloud.talent_v4.types.GetTenantRequest): The request object. Request for getting a tenant by name. - name (:class:`str`): + 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". + This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -453,7 +471,7 @@ def get_tenant( sent along with the request as metadata. Returns: - ~.tenant.Tenant: + google.cloud.talent_v4.types.Tenant: A Tenant resource represents a tenant in the service. A tenant is a group or entity that shares common access with @@ -515,17 +533,18 @@ def update_tenant( r"""Updates specified tenant. Args: - request (:class:`~.tenant_service.UpdateTenantRequest`): + request (google.cloud.talent_v4.types.UpdateTenantRequest): The request object. Request for updating a specified tenant. - tenant (:class:`~.gct_tenant.Tenant`): + tenant (google.cloud.talent_v4.types.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. - update_mask (:class:`~.field_mask.FieldMask`): + update_mask (google.protobuf.field_mask_pb2.FieldMask): Strongly recommended for the best service experience. If @@ -537,6 +556,7 @@ def update_tenant( A field mask to specify the tenant fields to be updated. Only top level fields of [Tenant][google.cloud.talent.v4.Tenant] are supported. + This corresponds to the ``update_mask`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -548,7 +568,7 @@ def update_tenant( sent along with the request as metadata. Returns: - ~.gct_tenant.Tenant: + google.cloud.talent_v4.types.Tenant: A Tenant resource represents a tenant in the service. A tenant is a group or entity that shares common access with @@ -613,14 +633,15 @@ def delete_tenant( r"""Deletes specified tenant. Args: - request (:class:`~.tenant_service.DeleteTenantRequest`): + request (google.cloud.talent_v4.types.DeleteTenantRequest): The request object. Request to delete a tenant. - name (:class:`str`): + 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". + This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -681,15 +702,16 @@ def list_tenants( r"""Lists all tenants associated with the project. Args: - request (:class:`~.tenant_service.ListTenantsRequest`): + request (google.cloud.talent_v4.types.ListTenantsRequest): The request object. List tenants for which the client has ACL visibility. - parent (:class:`str`): + parent (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. @@ -701,7 +723,7 @@ def list_tenants( sent along with the request as metadata. Returns: - ~.pagers.ListTenantsPager: + google.cloud.talent_v4.services.tenant_service.pagers.ListTenantsPager: The List tenants response object. Iterating over this object will yield results and resolve additional pages diff --git a/google/cloud/talent_v4/services/tenant_service/pagers.py b/google/cloud/talent_v4/services/tenant_service/pagers.py index d671fdb7..e5df990c 100644 --- a/google/cloud/talent_v4/services/tenant_service/pagers.py +++ b/google/cloud/talent_v4/services/tenant_service/pagers.py @@ -25,7 +25,7 @@ class ListTenantsPager: """A pager for iterating through ``list_tenants`` requests. This class thinly wraps an initial - :class:`~.tenant_service.ListTenantsResponse` object, and + :class:`google.cloud.talent_v4.types.ListTenantsResponse` object, and provides an ``__iter__`` method to iterate through its ``tenants`` field. @@ -34,7 +34,7 @@ class ListTenantsPager: through the ``tenants`` field on the corresponding responses. - All the usual :class:`~.tenant_service.ListTenantsResponse` + All the usual :class:`google.cloud.talent_v4.types.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. """ @@ -52,9 +52,9 @@ def __init__( Args: method (Callable): The method that was originally called, and which instantiated this pager. - request (:class:`~.tenant_service.ListTenantsRequest`): + request (google.cloud.talent_v4.types.ListTenantsRequest): The initial request object. - response (:class:`~.tenant_service.ListTenantsResponse`): + response (google.cloud.talent_v4.types.ListTenantsResponse): The initial response object. metadata (Sequence[Tuple[str, str]]): Strings which should be sent along with the request as metadata. @@ -87,7 +87,7 @@ class ListTenantsAsyncPager: """A pager for iterating through ``list_tenants`` requests. This class thinly wraps an initial - :class:`~.tenant_service.ListTenantsResponse` object, and + :class:`google.cloud.talent_v4.types.ListTenantsResponse` object, and provides an ``__aiter__`` method to iterate through its ``tenants`` field. @@ -96,7 +96,7 @@ class ListTenantsAsyncPager: through the ``tenants`` field on the corresponding responses. - All the usual :class:`~.tenant_service.ListTenantsResponse` + All the usual :class:`google.cloud.talent_v4.types.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. """ @@ -114,9 +114,9 @@ def __init__( Args: method (Callable): The method that was originally called, and which instantiated this pager. - request (:class:`~.tenant_service.ListTenantsRequest`): + request (google.cloud.talent_v4.types.ListTenantsRequest): The initial request object. - response (:class:`~.tenant_service.ListTenantsResponse`): + response (google.cloud.talent_v4.types.ListTenantsResponse): The initial response object. metadata (Sequence[Tuple[str, str]]): Strings which should be sent along with the request as metadata. diff --git a/google/cloud/talent_v4/types/common.py b/google/cloud/talent_v4/types/common.py index 13b73611..90e92333 100644 --- a/google/cloud/talent_v4/types/common.py +++ b/google/cloud/talent_v4/types/common.py @@ -206,9 +206,9 @@ class TimestampRange(proto.Message): r"""Message representing a period of time between two timestamps. Attributes: - start_time (~.timestamp.Timestamp): + start_time (google.protobuf.timestamp_pb2.Timestamp): Begin of the period (inclusive). - end_time (~.timestamp.Timestamp): + end_time (google.protobuf.timestamp_pb2.Timestamp): End of the period (exclusive). """ @@ -222,7 +222,7 @@ class Location(proto.Message): information. Attributes: - location_type (~.common.Location.LocationType): + location_type (google.cloud.talent_v4.types.Location.LocationType): The type of a location, which corresponds to the address lines field of [google.type.PostalAddress][google.type.PostalAddress]. For @@ -230,13 +230,13 @@ class Location(proto.Message): [LocationType.NEIGHBORHOOD][google.cloud.talent.v4.Location.LocationType.NEIGHBORHOOD], and "Kansas City, KS, USA" has a type of [LocationType.LOCALITY][google.cloud.talent.v4.Location.LocationType.LOCALITY]. - postal_address (~.gt_postal_address.PostalAddress): + postal_address (google.type.postal_address_pb2.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): + lat_lng (google.type.latlng_pb2.LatLng): An object representing a latitude/longitude pair. radius_miles (float): @@ -342,7 +342,7 @@ class RequestMetadata(proto.Message): and [user_id][google.cloud.talent.v4.RequestMetadata.user_id] for the best service experience. - device_info (~.common.DeviceInfo): + device_info (google.cloud.talent_v4.types.DeviceInfo): The type of device used by the job seeker at the time of the call to the service. """ @@ -378,7 +378,7 @@ class DeviceInfo(proto.Message): devices. Attributes: - device_type (~.common.DeviceInfo.DeviceType): + device_type (google.cloud.talent_v4.types.DeviceInfo.DeviceType): Type of the device. id (str): A device-specific ID. The ID must be a unique @@ -495,14 +495,14 @@ class CompensationInfo(proto.Message): r"""Job compensation details. Attributes: - entries (Sequence[~.common.CompensationInfo.CompensationEntry]): + entries (Sequence[google.cloud.talent_v4.types.CompensationInfo.CompensationEntry]): Job compensation information. At most one entry can be of type [CompensationInfo.CompensationType.BASE][google.cloud.talent.v4.CompensationInfo.CompensationType.BASE], which is referred as **base compensation entry** for the job. - annualized_base_compensation_range (~.common.CompensationInfo.CompensationRange): + annualized_base_compensation_range (google.cloud.talent_v4.types.CompensationInfo.CompensationRange): Output only. Annualized base compensation range. Computed as base compensation entry's [CompensationEntry.amount][google.cloud.talent.v4.CompensationInfo.CompensationEntry.amount] @@ -512,7 +512,7 @@ class CompensationInfo(proto.Message): See [CompensationEntry][google.cloud.talent.v4.CompensationInfo.CompensationEntry] for explanation on compensation annualization. - annualized_total_compensation_range (~.common.CompensationInfo.CompensationRange): + annualized_total_compensation_range (google.cloud.talent_v4.types.CompensationInfo.CompensationRange): Output only. Annualized total compensation range. Computed as all compensation entries' [CompensationEntry.amount][google.cloud.talent.v4.CompensationInfo.CompensationEntry.amount] @@ -594,25 +594,25 @@ class CompensationEntry(proto.Message): [expected_units_per_year][google.cloud.talent.v4.CompensationInfo.CompensationEntry.expected_units_per_year]. Attributes: - type_ (~.common.CompensationInfo.CompensationType): + type_ (google.cloud.talent_v4.types.CompensationInfo.CompensationType): Compensation type. Default is [CompensationType.COMPENSATION_TYPE_UNSPECIFIED][google.cloud.talent.v4.CompensationInfo.CompensationType.COMPENSATION_TYPE_UNSPECIFIED]. - unit (~.common.CompensationInfo.CompensationUnit): + unit (google.cloud.talent_v4.types.CompensationInfo.CompensationUnit): Frequency of the specified amount. Default is [CompensationUnit.COMPENSATION_UNIT_UNSPECIFIED][google.cloud.talent.v4.CompensationInfo.CompensationUnit.COMPENSATION_UNIT_UNSPECIFIED]. - amount (~.money.Money): + amount (google.type.money_pb2.Money): Compensation amount. - range_ (~.common.CompensationInfo.CompensationRange): + range_ (google.cloud.talent_v4.types.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_units_per_year (google.protobuf.wrappers_pb2.DoubleValue): Expected number of units paid each year. If not specified, when [Job.employment_types][google.cloud.talent.v4.Job.employment_types] @@ -656,12 +656,12 @@ class CompensationRange(proto.Message): r"""Compensation range. Attributes: - max_compensation (~.money.Money): + max_compensation (google.type.money_pb2.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): + min_compensation (google.type.money_pb2.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 @@ -689,7 +689,7 @@ class BatchOperationMetadata(proto.Message): [google.longrunning.Operation.metadata][google.longrunning.Operation.metadata]. Attributes: - state (~.common.BatchOperationMetadata.State): + state (google.cloud.talent_v4.types.BatchOperationMetadata.State): The state of a long running operation. state_description (str): More detailed information about operation @@ -701,14 +701,14 @@ class BatchOperationMetadata(proto.Message): Count of failed item(s) inside an operation. total_count (int): Count of total item(s) inside an operation. - create_time (~.timestamp.Timestamp): + create_time (google.protobuf.timestamp_pb2.Timestamp): The time when the batch operation is created. - update_time (~.timestamp.Timestamp): + update_time (google.protobuf.timestamp_pb2.Timestamp): The time when the batch operation status is updated. The metadata and the [update_time][google.cloud.talent.v4.BatchOperationMetadata.update_time] is refreshed every minute otherwise cached data is returned. - end_time (~.timestamp.Timestamp): + end_time (google.protobuf.timestamp_pb2.Timestamp): The time when the batch operation is finished and [google.longrunning.Operation.done][google.longrunning.Operation.done] is set to ``true``. diff --git a/google/cloud/talent_v4/types/company.py b/google/cloud/talent_v4/types/company.py index 9955928e..84df7fe7 100644 --- a/google/cloud/talent_v4/types/company.py +++ b/google/cloud/talent_v4/types/company.py @@ -48,7 +48,7 @@ class Company(proto.Message): used to uniquely identify the company. The maximum number of allowed characters is 255. - size (~.common.CompanySize): + size (google.cloud.talent_v4.types.CompanySize): The employer's company size. headquarters_address (str): The street address of the company's main headquarters, which @@ -87,7 +87,7 @@ class Company(proto.Message): 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): + derived_info (google.cloud.talent_v4.types.Company.DerivedInfo): Output only. Derived details about the company. suspended (bool): @@ -101,7 +101,7 @@ class DerivedInfo(proto.Message): r"""Derived details about the company. Attributes: - headquarters_location (~.common.Location): + headquarters_location (google.cloud.talent_v4.types.Location): A structured headquarters location of the company, resolved from [Company.headquarters_address][google.cloud.talent.v4.Company.headquarters_address] diff --git a/google/cloud/talent_v4/types/company_service.py b/google/cloud/talent_v4/types/company_service.py index 0e166ef9..c6862175 100644 --- a/google/cloud/talent_v4/types/company_service.py +++ b/google/cloud/talent_v4/types/company_service.py @@ -46,7 +46,7 @@ class CreateCompanyRequest(proto.Message): The format is "projects/{project_id}/tenants/{tenant_id}", for example, "projects/foo/tenants/bar". - company (~.gct_company.Company): + company (google.cloud.talent_v4.types.Company): Required. The company to be created. """ @@ -75,10 +75,10 @@ class UpdateCompanyRequest(proto.Message): r"""Request for updating a specified company. Attributes: - company (~.gct_company.Company): + company (google.cloud.talent_v4.types.Company): Required. The company resource to replace the current resource in the system. - update_mask (~.field_mask.FieldMask): + update_mask (google.protobuf.field_mask_pb2.FieldMask): Strongly recommended for the best service experience. If @@ -153,11 +153,11 @@ class ListCompaniesResponse(proto.Message): r"""The List companies response object. Attributes: - companies (Sequence[~.gct_company.Company]): + companies (Sequence[google.cloud.talent_v4.types.Company]): Companies for the current client. next_page_token (str): A token to retrieve the next page of results. - metadata (~.common.ResponseMetadata): + metadata (google.cloud.talent_v4.types.ResponseMetadata): Additional information for the API invocation, such as the request tracking id. """ diff --git a/google/cloud/talent_v4/types/completion_service.py b/google/cloud/talent_v4/types/completion_service.py index ba2529b2..fe233356 100644 --- a/google/cloud/talent_v4/types/completion_service.py +++ b/google/cloud/talent_v4/types/completion_service.py @@ -57,10 +57,10 @@ class CompleteQueryRequest(proto.Message): The format is "projects/{project_id}/tenants/{tenant_id}/companies/{company_id}", for example, "projects/foo/tenants/bar/companies/baz". - scope (~.completion_service.CompleteQueryRequest.CompletionScope): + scope (google.cloud.talent_v4.types.CompleteQueryRequest.CompletionScope): The scope of the completion. The defaults is [CompletionScope.PUBLIC][google.cloud.talent.v4.CompleteQueryRequest.CompletionScope.PUBLIC]. - type_ (~.completion_service.CompleteQueryRequest.CompletionType): + type_ (google.cloud.talent_v4.types.CompleteQueryRequest.CompletionType): The completion topic. The default is [CompletionType.COMBINED][google.cloud.talent.v4.CompleteQueryRequest.CompletionType.COMBINED]. """ @@ -97,10 +97,10 @@ class CompleteQueryResponse(proto.Message): r"""Response of auto-complete query. Attributes: - completion_results (Sequence[~.completion_service.CompleteQueryResponse.CompletionResult]): + completion_results (Sequence[google.cloud.talent_v4.types.CompleteQueryResponse.CompletionResult]): Results of the matching job/company candidates. - metadata (~.common.ResponseMetadata): + metadata (google.cloud.talent_v4.types.ResponseMetadata): Additional information for the API invocation, such as the request tracking id. """ @@ -111,7 +111,7 @@ class CompletionResult(proto.Message): Attributes: suggestion (str): The suggestion for the query. - type_ (~.completion_service.CompleteQueryRequest.CompletionType): + type_ (google.cloud.talent_v4.types.CompleteQueryRequest.CompletionType): The completion topic. image_uri (str): The URI of the company image for diff --git a/google/cloud/talent_v4/types/event.py b/google/cloud/talent_v4/types/event.py index 8ecb3a87..40ffe6f2 100644 --- a/google/cloud/talent_v4/types/event.py +++ b/google/cloud/talent_v4/types/event.py @@ -44,9 +44,9 @@ class ClientEvent(proto.Message): event_id (str): Required. A unique identifier, generated by the client application. - create_time (~.timestamp.Timestamp): + create_time (google.protobuf.timestamp_pb2.Timestamp): Required. The timestamp of the event. - job_event (~.event.JobEvent): + job_event (google.cloud.talent_v4.types.JobEvent): An event issued when a job seeker interacts with the application that implements Cloud Talent Solution. @@ -72,7 +72,7 @@ class JobEvent(proto.Message): application that implements Cloud Talent Solution. Attributes: - type_ (~.event.JobEvent.JobEventType): + type_ (google.cloud.talent_v4.types.JobEvent.JobEventType): Required. The type of the event (see [JobEventType][google.cloud.talent.v4.JobEvent.JobEventType]). jobs (Sequence[str]): diff --git a/google/cloud/talent_v4/types/event_service.py b/google/cloud/talent_v4/types/event_service.py index 264d2f2d..8a328f9a 100644 --- a/google/cloud/talent_v4/types/event_service.py +++ b/google/cloud/talent_v4/types/event_service.py @@ -36,7 +36,7 @@ class CreateClientEventRequest(proto.Message): The format is "projects/{project_id}/tenants/{tenant_id}", for example, "projects/foo/tenants/bar". - client_event (~.event.ClientEvent): + client_event (google.cloud.talent_v4.types.ClientEvent): Required. Events issued when end user interacts with customer's application that uses Cloud Talent Solution. diff --git a/google/cloud/talent_v4/types/filters.py b/google/cloud/talent_v4/types/filters.py index 62a8aa57..482632fa 100644 --- a/google/cloud/talent_v4/types/filters.py +++ b/google/cloud/talent_v4/types/filters.py @@ -65,7 +65,7 @@ class JobQuery(proto.Message): For example, "projects/foo/tenants/bar/companies/baz". At most 20 company filters are allowed. - location_filters (Sequence[~.filters.LocationFilter]): + location_filters (Sequence[google.cloud.talent_v4.types.LocationFilter]): The location filter specifies geo-regions containing the jobs to search against. See [LocationFilter][google.cloud.talent.v4.LocationFilter] for @@ -83,7 +83,7 @@ class JobQuery(proto.Message): locations. At most 5 location filters are allowed. - job_categories (Sequence[~.common.JobCategory]): + job_categories (Sequence[google.cloud.talent_v4.types.JobCategory]): The category filter specifies the categories of jobs to search against. See [JobCategory][google.cloud.talent.v4.JobCategory] for more @@ -94,7 +94,7 @@ class JobQuery(proto.Message): If multiple values are specified, jobs from any of the specified categories are searched against. - commute_filter (~.filters.CommuteFilter): + commute_filter (google.cloud.talent_v4.types.CommuteFilter): Allows filtering jobs by commute time with different travel methods (for example, driving or public transit). @@ -118,7 +118,7 @@ class JobQuery(proto.Message): companies. At most 20 company display name filters are allowed. - compensation_filter (~.filters.CompensationFilter): + compensation_filter (google.cloud.talent_v4.types.CompensationFilter): This search filter is applied only to [Job.compensation_info][google.cloud.talent.v4.Job.compensation_info]. For example, if the filter is specified as "Hourly job with @@ -157,7 +157,7 @@ class JobQuery(proto.Message): misspelled query, for example, "enginee" is corrected to "engineer". Defaults to false: a spell check is performed. - employment_types (Sequence[~.common.EmploymentType]): + employment_types (Sequence[google.cloud.talent_v4.types.EmploymentType]): The employment type filter specifies the employment type of jobs to search against, such as [EmploymentType.FULL_TIME][google.cloud.talent.v4.EmploymentType.FULL_TIME]. @@ -180,7 +180,7 @@ class JobQuery(proto.Message): Languages `__. At most 10 language code filters are allowed. - publish_time_range (~.common.TimestampRange): + publish_time_range (google.cloud.talent_v4.types.TimestampRange): Jobs published within a range specified by this filter are searched against. excluded_jobs (Sequence[str]): @@ -246,7 +246,7 @@ class LocationFilter(proto.Message): See https://www.unicode.org/cldr/charts/30/supplemental/territory_information.html for details. Example: "CH" for Switzerland. - lat_lng (~.latlng.LatLng): + lat_lng (google.type.latlng_pb2.LatLng): The latitude and longitude of the geographic center to search from. This field is ignored if ``address`` is provided. @@ -255,7 +255,7 @@ class LocationFilter(proto.Message): 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): + telecommute_preference (google.cloud.talent_v4.types.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. @@ -304,12 +304,12 @@ class CompensationFilter(proto.Message): r"""Filter on job compensation type and amount. Attributes: - type_ (~.filters.CompensationFilter.FilterType): + type_ (google.cloud.talent_v4.types.CompensationFilter.FilterType): Required. Type of filter. - units (Sequence[~.common.CompensationInfo.CompensationUnit]): + units (Sequence[google.cloud.talent_v4.types.CompensationInfo.CompensationUnit]): Required. Specify desired ``base compensation entry's`` [CompensationInfo.CompensationUnit][google.cloud.talent.v4.CompensationInfo.CompensationUnit]. - range_ (~.common.CompensationInfo.CompensationRange): + range_ (google.cloud.talent_v4.types.CompensationInfo.CompensationRange): Compensation range. include_jobs_with_unspecified_compensation_range (bool): If set to true, jobs with unspecified @@ -341,13 +341,13 @@ class CommuteFilter(proto.Message): r"""Parameters needed for commute search. Attributes: - commute_method (~.common.CommuteMethod): + commute_method (google.cloud.talent_v4.types.CommuteMethod): Required. The method of transportation to calculate the commute time for. - start_coordinates (~.latlng.LatLng): + start_coordinates (google.type.latlng_pb2.LatLng): Required. The latitude and longitude of the location to calculate the commute time from. - travel_duration (~.duration.Duration): + travel_duration (google.protobuf.duration_pb2.Duration): Required. The maximum travel time in seconds. The maximum allowed value is ``3600s`` (one hour). Format is ``123s``. allow_imprecise_addresses (bool): @@ -357,10 +357,10 @@ class CommuteFilter(proto.Message): 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): + road_traffic (google.cloud.talent_v4.types.CommuteFilter.RoadTraffic): Specifies the traffic density to use when calculating commute time. - departure_time (~.timeofday.TimeOfDay): + departure_time (google.type.timeofday_pb2.TimeOfDay): The departure time used to calculate traffic impact, represented as [google.type.TimeOfDay][google.type.TimeOfDay] in local time diff --git a/google/cloud/talent_v4/types/histogram.py b/google/cloud/talent_v4/types/histogram.py index ac6443df..ec9484c9 100644 --- a/google/cloud/talent_v4/types/histogram.py +++ b/google/cloud/talent_v4/types/histogram.py @@ -48,7 +48,7 @@ class HistogramQueryResult(proto.Message): Attributes: histogram_query (str): Requested histogram expression. - histogram (Sequence[~.gct_histogram.HistogramQueryResult.HistogramEntry]): + histogram (Sequence[google.cloud.talent_v4.types.HistogramQueryResult.HistogramEntry]): A map from the values of the facet associated with distinct values to the number of matching entries with corresponding value. diff --git a/google/cloud/talent_v4/types/job.py b/google/cloud/talent_v4/types/job.py index f1320f94..2bd27c59 100644 --- a/google/cloud/talent_v4/types/job.py +++ b/google/cloud/talent_v4/types/job.py @@ -111,15 +111,15 @@ class Job(proto.Message): experience. The maximum number of allowed characters is 500. - application_info (~.job.Job.ApplicationInfo): + application_info (google.cloud.talent_v4.types.Job.ApplicationInfo): Job application information. - job_benefits (Sequence[~.common.JobBenefit]): + job_benefits (Sequence[google.cloud.talent_v4.types.JobBenefit]): The benefits included with the job. - compensation_info (~.common.CompensationInfo): + compensation_info (google.cloud.talent_v4.types.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]): + custom_attributes (Sequence[google.cloud.talent_v4.types.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. @@ -134,7 +134,7 @@ class Job(proto.Message): than 255 characters. For unfilterable ``string_values``, the maximum total size of ``string_values`` across all keys is 50KB. - degree_types (Sequence[~.common.DegreeType]): + degree_types (Sequence[google.cloud.talent_v4.types.DegreeType]): The desired education degrees for the job, such as Bachelors, Masters. department (str): @@ -142,7 +142,7 @@ class Job(proto.Message): company with the open position. The maximum number of allowed characters is 255. - employment_types (Sequence[~.common.EmploymentType]): + employment_types (Sequence[google.cloud.talent_v4.types.EmploymentType]): The employment type(s) of a job, for example, [full time][google.cloud.talent.v4.EmploymentType.FULL_TIME] or [part @@ -167,7 +167,7 @@ class Job(proto.Message): present, detected language code based on [Job.description][google.cloud.talent.v4.Job.description] is assigned, otherwise defaults to 'en_US'. - job_level (~.common.JobLevel): + job_level (google.cloud.talent_v4.types.JobLevel): The experience level associated with the job, such as "Entry Level". promotion_value (int): @@ -200,7 +200,7 @@ class Job(proto.Message): markup tags. The maximum number of allowed characters is 10,000. - posting_region (~.common.PostingRegion): + posting_region (google.cloud.talent_v4.types.PostingRegion): The job [PostingRegion][google.cloud.talent.v4.PostingRegion] (for example, state, country) throughout which the job is @@ -215,7 +215,7 @@ class Job(proto.Message): setting job [Job.addresses][google.cloud.talent.v4.Job.addresses] to the same location level as this field is strongly recommended. - visibility (~.common.Visibility): + visibility (google.cloud.talent_v4.types.Visibility): Deprecated. The job is only visible to the owner. The visibility of the job. @@ -223,21 +223,21 @@ class Job(proto.Message): Defaults to [Visibility.ACCOUNT_ONLY][google.cloud.talent.v4.Visibility.ACCOUNT_ONLY] if not specified. - job_start_time (~.timestamp.Timestamp): + job_start_time (google.protobuf.timestamp_pb2.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): + job_end_time (google.protobuf.timestamp_pb2.Timestamp): The end timestamp of the job. Typically this field is used for contracting engagements. Invalid timestamps are ignored. - posting_publish_time (~.timestamp.Timestamp): + posting_publish_time (google.protobuf.timestamp_pb2.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): + posting_expire_time (google.protobuf.timestamp_pb2.Timestamp): Strongly recommended for the best service experience. The expiration timestamp of the job. After this timestamp, @@ -295,19 +295,19 @@ class Job(proto.Message): 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): + posting_create_time (google.protobuf.timestamp_pb2.Timestamp): Output only. The timestamp when this job posting was created. - posting_update_time (~.timestamp.Timestamp): + posting_update_time (google.protobuf.timestamp_pb2.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): + derived_info (google.cloud.talent_v4.types.Job.DerivedInfo): Output only. Derived details about the job posting. - processing_options (~.job.Job.ProcessingOptions): + processing_options (google.cloud.talent_v4.types.Job.ProcessingOptions): Options for job processing. """ @@ -347,7 +347,7 @@ class DerivedInfo(proto.Message): r"""Derived details about the job posting. Attributes: - locations (Sequence[~.common.Location]): + locations (Sequence[google.cloud.talent_v4.types.Location]): Structured locations of the job, resolved from [Job.addresses][google.cloud.talent.v4.Job.addresses]. @@ -355,7 +355,7 @@ class DerivedInfo(proto.Message): are exactly matched to [Job.addresses][google.cloud.talent.v4.Job.addresses] in the same order. - job_categories (Sequence[~.common.JobCategory]): + job_categories (Sequence[google.cloud.talent_v4.types.JobCategory]): Job categories derived from [Job.title][google.cloud.talent.v4.Job.title] and [Job.description][google.cloud.talent.v4.Job.description]. @@ -376,7 +376,7 @@ class ProcessingOptions(proto.Message): 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): + html_sanitization (google.cloud.talent_v4.types.HtmlSanitization): Option for job HTML content sanitization. Applied fields are: diff --git a/google/cloud/talent_v4/types/job_service.py b/google/cloud/talent_v4/types/job_service.py index 4b53ed10..78289bbe 100644 --- a/google/cloud/talent_v4/types/job_service.py +++ b/google/cloud/talent_v4/types/job_service.py @@ -74,7 +74,7 @@ class CreateJobRequest(proto.Message): The format is "projects/{project_id}/tenants/{tenant_id}". For example, "projects/foo/tenants/bar". - job (~.gct_job.Job): + job (google.cloud.talent_v4.types.Job): Required. The Job to be created. """ @@ -102,9 +102,9 @@ class UpdateJobRequest(proto.Message): r"""Update job request. Attributes: - job (~.gct_job.Job): + job (google.cloud.talent_v4.types.Job): Required. The Job to be updated. - update_mask (~.field_mask.FieldMask): + update_mask (google.protobuf.field_mask_pb2.FieldMask): Strongly recommended for the best service experience. If @@ -182,7 +182,7 @@ class ListJobsRequest(proto.Message): maximum allowed page size is 100. Default is 100 if empty or a number < 1 is specified. - job_view (~.job_service.JobView): + job_view (google.cloud.talent_v4.types.JobView): The desired job attributes returned for jobs in the search response. Defaults to [JobView.JOB_VIEW_FULL][google.cloud.talent.v4.JobView.JOB_VIEW_FULL] @@ -204,13 +204,13 @@ class ListJobsResponse(proto.Message): r"""List jobs response. Attributes: - jobs (Sequence[~.gct_job.Job]): + jobs (Sequence[google.cloud.talent_v4.types.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): + metadata (google.cloud.talent_v4.types.ResponseMetadata): Additional information for the API invocation, such as the request tracking id. """ @@ -235,17 +235,17 @@ class SearchJobsRequest(proto.Message): The format is "projects/{project_id}/tenants/{tenant_id}". For example, "projects/foo/tenants/bar". - search_mode (~.job_service.SearchJobsRequest.SearchMode): + search_mode (google.cloud.talent_v4.types.SearchJobsRequest.SearchMode): Mode of a search. Defaults to [SearchMode.JOB_SEARCH][google.cloud.talent.v4.SearchJobsRequest.SearchMode.JOB_SEARCH]. - request_metadata (~.common.RequestMetadata): + request_metadata (google.cloud.talent_v4.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. - job_query (~.filters.JobQuery): + job_query (google.cloud.talent_v4.types.JobQuery): Query used to search against jobs, such as keyword, location filters, etc. enable_broadening (bool): @@ -255,7 +255,7 @@ class SearchJobsRequest(proto.Message): results list. Defaults to false. - histogram_queries (Sequence[~.histogram.HistogramQuery]): + histogram_queries (Sequence[google.cloud.talent_v4.types.HistogramQuery]): An expression specifies a histogram request against matching jobs. @@ -368,7 +368,7 @@ class SearchJobsRequest(proto.Message): - ``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): + job_view (google.cloud.talent_v4.types.JobView): The desired job attributes returned for jobs in the search response. Defaults to [JobView.JOB_VIEW_SMALL][google.cloud.talent.v4.JobView.JOB_VIEW_SMALL] @@ -458,7 +458,7 @@ class SearchJobsRequest(proto.Message): (37.4 feet). Diversification strategy is still applied unless explicitly disabled in [diversification_level][google.cloud.talent.v4.SearchJobsRequest.diversification_level]. - diversification_level (~.job_service.SearchJobsRequest.DiversificationLevel): + diversification_level (google.cloud.talent_v4.types.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 @@ -470,7 +470,7 @@ class SearchJobsRequest(proto.Message): Defaults to [DiversificationLevel.SIMPLE][google.cloud.talent.v4.SearchJobsRequest.DiversificationLevel.SIMPLE] if no value is specified. - custom_ranking_info (~.job_service.SearchJobsRequest.CustomRankingInfo): + custom_ranking_info (google.cloud.talent_v4.types.SearchJobsRequest.CustomRankingInfo): Controls over how job documents get ranked on top of existing relevance score (determined by API algorithm). @@ -528,7 +528,7 @@ class CustomRankingInfo(proto.Message): [SearchJobsRequest][google.cloud.talent.v4.SearchJobsRequest]. Attributes: - importance_level (~.job_service.SearchJobsRequest.CustomRankingInfo.ImportanceLevel): + importance_level (google.cloud.talent_v4.types.SearchJobsRequest.CustomRankingInfo.ImportanceLevel): Required. Controls over how important the score of [CustomRankingInfo.ranking_expression][google.cloud.talent.v4.SearchJobsRequest.CustomRankingInfo.ranking_expression] gets applied to job's final ranking position. @@ -623,17 +623,17 @@ class SearchJobsResponse(proto.Message): r"""Response for SearchJob method. Attributes: - matching_jobs (Sequence[~.job_service.SearchJobsResponse.MatchingJob]): + matching_jobs (Sequence[google.cloud.talent_v4.types.SearchJobsResponse.MatchingJob]): The Job entities that match the specified [SearchJobsRequest][google.cloud.talent.v4.SearchJobsRequest]. - histogram_query_results (Sequence[~.histogram.HistogramQueryResult]): + histogram_query_results (Sequence[google.cloud.talent_v4.types.HistogramQueryResult]): The histogram results that match with specified [SearchJobsRequest.histogram_queries][google.cloud.talent.v4.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]): + location_filters (Sequence[google.cloud.talent_v4.types.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.v4.Location.location_type] @@ -644,7 +644,7 @@ class SearchJobsResponse(proto.Message): query. Note: This size is precise only if the total is less than 100,000. - metadata (~.common.ResponseMetadata): + metadata (google.cloud.talent_v4.types.ResponseMetadata): Additional information for the API invocation, such as the request tracking id. broadened_query_jobs_count (int): @@ -659,7 +659,7 @@ class SearchJobsResponse(proto.Message): 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): + spell_correction (google.cloud.talent_v4.types.SpellingCorrection): The spell checking result, and correction. """ @@ -668,7 +668,7 @@ class MatchingJob(proto.Message): [SearchJobsResponse][google.cloud.talent.v4.SearchJobsResponse]. Attributes: - job (~.gct_job.Job): + job (google.cloud.talent_v4.types.Job): Job resource that matches the specified [SearchJobsRequest][google.cloud.talent.v4.SearchJobsRequest]. job_summary (str): @@ -687,7 +687,7 @@ class MatchingJob(proto.Message): 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_info (google.cloud.talent_v4.types.SearchJobsResponse.CommuteInfo): Commute information which is generated based on specified [CommuteFilter][google.cloud.talent.v4.CommuteFilter]. """ @@ -708,10 +708,10 @@ class CommuteInfo(proto.Message): r"""Commute details related to this job. Attributes: - job_location (~.common.Location): + job_location (google.cloud.talent_v4.types.Location): Location used as the destination in the commute calculation. - travel_duration (~.duration.Duration): + travel_duration (google.protobuf.duration_pb2.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 @@ -762,7 +762,7 @@ class BatchCreateJobsRequest(proto.Message): The format is "projects/{project_id}/tenants/{tenant_id}". For example, "projects/foo/tenants/bar". - jobs (Sequence[~.gct_job.Job]): + jobs (Sequence[google.cloud.talent_v4.types.Job]): Required. The jobs to be created. A maximum of 200 jobs can be created in a batch. """ @@ -782,10 +782,10 @@ class BatchUpdateJobsRequest(proto.Message): The format is "projects/{project_id}/tenants/{tenant_id}". For example, "projects/foo/tenants/bar". - jobs (Sequence[~.gct_job.Job]): + jobs (Sequence[google.cloud.talent_v4.types.Job]): Required. The jobs to be updated. A maximum of 200 jobs can be updated in a batch. - update_mask (~.field_mask.FieldMask): + update_mask (google.protobuf.field_mask_pb2.FieldMask): Strongly recommended for the best service experience. Be aware that it will also increase latency when checking the status of a batch operation. @@ -848,7 +848,7 @@ class JobResult(proto.Message): r"""Mutation result of a job from a batch operation. Attributes: - job (~.gct_job.Job): + job (google.cloud.talent_v4.types.Job): Here [Job][google.cloud.talent.v4.Job] only contains basic information including [name][google.cloud.talent.v4.Job.name], @@ -858,7 +858,7 @@ class JobResult(proto.Message): [requisition_id][google.cloud.talent.v4.Job.requisition_id], use getJob method to retrieve detailed information of the created/updated job. - status (~.gr_status.Status): + status (google.rpc.status_pb2.Status): The status of the job processed. This field is populated if the processing of the [job][google.cloud.talent.v4.JobResult.job] fails. @@ -877,7 +877,7 @@ class BatchCreateJobsResponse(proto.Message): in case of success. Attributes: - job_results (Sequence[~.job_service.JobResult]): + job_results (Sequence[google.cloud.talent_v4.types.JobResult]): List of job mutation results from a batch create operation. It can change until operation status is FINISHED, FAILED or CANCELLED. @@ -894,7 +894,7 @@ class BatchUpdateJobsResponse(proto.Message): in case of success. Attributes: - job_results (Sequence[~.job_service.JobResult]): + job_results (Sequence[google.cloud.talent_v4.types.JobResult]): List of job mutation results from a batch update operation. It can change until operation status is FINISHED, FAILED or CANCELLED. @@ -911,7 +911,7 @@ class BatchDeleteJobsResponse(proto.Message): in case of success. Attributes: - job_results (Sequence[~.job_service.JobResult]): + job_results (Sequence[google.cloud.talent_v4.types.JobResult]): List of job mutation results from a batch delete operation. It can change until operation status is FINISHED, FAILED or CANCELLED. diff --git a/google/cloud/talent_v4/types/tenant_service.py b/google/cloud/talent_v4/types/tenant_service.py index 2f77b0d1..be5e4d8d 100644 --- a/google/cloud/talent_v4/types/tenant_service.py +++ b/google/cloud/talent_v4/types/tenant_service.py @@ -46,7 +46,7 @@ class CreateTenantRequest(proto.Message): The format is "projects/{project_id}", for example, "projects/foo". - tenant (~.gct_tenant.Tenant): + tenant (google.cloud.talent_v4.types.Tenant): Required. The tenant to be created. """ @@ -73,10 +73,10 @@ class UpdateTenantRequest(proto.Message): r"""Request for updating a specified tenant. Attributes: - tenant (~.gct_tenant.Tenant): + tenant (google.cloud.talent_v4.types.Tenant): Required. The tenant resource to replace the current resource in the system. - update_mask (~.field_mask.FieldMask): + update_mask (google.protobuf.field_mask_pb2.FieldMask): Strongly recommended for the best service experience. If @@ -139,11 +139,11 @@ class ListTenantsResponse(proto.Message): r"""The List tenants response object. Attributes: - tenants (Sequence[~.gct_tenant.Tenant]): + tenants (Sequence[google.cloud.talent_v4.types.Tenant]): Tenants for the current client. next_page_token (str): A token to retrieve the next page of results. - metadata (~.common.ResponseMetadata): + metadata (google.cloud.talent_v4.types.ResponseMetadata): Additional information for the API invocation, such as the request tracking id. """ diff --git a/google/cloud/talent_v4beta1/__init__.py b/google/cloud/talent_v4beta1/__init__.py index e486a156..9494115b 100644 --- a/google/cloud/talent_v4beta1/__init__.py +++ b/google/cloud/talent_v4beta1/__init__.py @@ -143,7 +143,6 @@ "ApplicationDateFilter", "ApplicationJobFilter", "ApplicationOutcomeNotesFilter", - "ApplicationServiceClient", "AvailabilityFilter", "AvailabilitySignal", "AvailabilitySignalType", @@ -186,6 +185,7 @@ "EmployerFilter", "EmploymentRecord", "EmploymentType", + "EventServiceClient", "GetApplicationRequest", "GetCompanyRequest", "GetJobRequest", @@ -253,5 +253,5 @@ "UpdateTenantRequest", "Visibility", "WorkExperienceFilter", - "EventServiceClient", + "ApplicationServiceClient", ) diff --git a/google/cloud/talent_v4beta1/services/application_service/async_client.py b/google/cloud/talent_v4beta1/services/application_service/async_client.py index 8236846b..0d274c27 100644 --- a/google/cloud/talent_v4beta1/services/application_service/async_client.py +++ b/google/cloud/talent_v4beta1/services/application_service/async_client.py @@ -92,6 +92,7 @@ class ApplicationServiceAsyncClient: ApplicationServiceClient.parse_common_location_path ) + from_service_account_info = ApplicationServiceClient.from_service_account_info from_service_account_file = ApplicationServiceClient.from_service_account_file from_service_account_json = from_service_account_file @@ -170,7 +171,7 @@ async def create_application( r"""Creates a new application entity. Args: - request (:class:`~.application_service.CreateApplicationRequest`): + request (:class:`google.cloud.talent_v4beta1.types.CreateApplicationRequest`): The request object. The Request of the CreateApplication method. parent (:class:`str`): @@ -180,12 +181,14 @@ async def create_application( 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`): + application (:class:`google.cloud.talent_v4beta1.types.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. @@ -197,7 +200,7 @@ async def create_application( sent along with the request as metadata. Returns: - ~.gct_application.Application: + google.cloud.talent_v4beta1.types.Application: Resource that represents a job application record of a candidate. @@ -254,7 +257,7 @@ async def get_application( r"""Retrieves specified application. Args: - request (:class:`~.application_service.GetApplicationRequest`): + request (:class:`google.cloud.talent_v4beta1.types.GetApplicationRequest`): The request object. Request for getting a application by name. name (:class:`str`): @@ -265,6 +268,7 @@ async def get_application( "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. @@ -276,7 +280,7 @@ async def get_application( sent along with the request as metadata. Returns: - ~.application.Application: + google.cloud.talent_v4beta1.types.Application: Resource that represents a job application record of a candidate. @@ -339,13 +343,14 @@ async def update_application( r"""Updates specified application. Args: - request (:class:`~.application_service.UpdateApplicationRequest`): + request (:class:`google.cloud.talent_v4beta1.types.UpdateApplicationRequest`): The request object. Request for updating a specified application. - application (:class:`~.gct_application.Application`): + application (:class:`google.cloud.talent_v4beta1.types.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. @@ -357,7 +362,7 @@ async def update_application( sent along with the request as metadata. Returns: - ~.gct_application.Application: + google.cloud.talent_v4beta1.types.Application: Resource that represents a job application record of a candidate. @@ -414,7 +419,7 @@ async def delete_application( r"""Deletes specified application. Args: - request (:class:`~.application_service.DeleteApplicationRequest`): + request (:class:`google.cloud.talent_v4beta1.types.DeleteApplicationRequest`): The request object. Request to delete a application. name (:class:`str`): Required. The resource name of the application to be @@ -424,6 +429,7 @@ async def delete_application( "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. @@ -491,7 +497,7 @@ async def list_applications( r"""Lists all applications associated with the profile. Args: - request (:class:`~.application_service.ListApplicationsRequest`): + request (:class:`google.cloud.talent_v4beta1.types.ListApplicationsRequest`): The request object. List applications for which the client has ACL visibility. parent (:class:`str`): @@ -501,6 +507,7 @@ async def list_applications( 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. @@ -512,7 +519,7 @@ async def list_applications( sent along with the request as metadata. Returns: - ~.pagers.ListApplicationsAsyncPager: + google.cloud.talent_v4beta1.services.application_service.pagers.ListApplicationsAsyncPager: The List applications response object. Iterating over this object will yield diff --git a/google/cloud/talent_v4beta1/services/application_service/client.py b/google/cloud/talent_v4beta1/services/application_service/client.py index b8204de1..f6c8163a 100644 --- a/google/cloud/talent_v4beta1/services/application_service/client.py +++ b/google/cloud/talent_v4beta1/services/application_service/client.py @@ -120,6 +120,22 @@ def _get_default_mtls_endpoint(api_endpoint): DEFAULT_ENDPOINT ) + @classmethod + def from_service_account_info(cls, info: dict, *args, **kwargs): + """Creates an instance of this client using the provided credentials info. + + Args: + info (dict): The service account private key info. + args: Additional arguments to pass to the constructor. + kwargs: Additional arguments to pass to the constructor. + + Returns: + ApplicationServiceClient: The constructed client. + """ + credentials = service_account.Credentials.from_service_account_info(info) + kwargs["credentials"] = credentials + return cls(*args, **kwargs) + @classmethod def from_service_account_file(cls, filename: str, *args, **kwargs): """Creates an instance of this client using the provided credentials @@ -132,7 +148,7 @@ def from_service_account_file(cls, filename: str, *args, **kwargs): kwargs: Additional arguments to pass to the constructor. Returns: - {@api.name}: The constructed client. + ApplicationServiceClient: The constructed client. """ credentials = service_account.Credentials.from_service_account_file(filename) kwargs["credentials"] = credentials @@ -290,10 +306,10 @@ def __init__( 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 (Union[str, ApplicationServiceTransport]): The transport to use. If set to None, a transport is chosen automatically. - client_options (client_options_lib.ClientOptions): Custom options for the + client_options (google.api_core.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_ENDPOINT @@ -404,22 +420,24 @@ def create_application( r"""Creates a new application entity. Args: - request (:class:`~.application_service.CreateApplicationRequest`): + request (google.cloud.talent_v4beta1.types.CreateApplicationRequest): The request object. The Request of the CreateApplication method. - parent (:class:`str`): + 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". + This corresponds to the ``parent`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - application (:class:`~.gct_application.Application`): + application (google.cloud.talent_v4beta1.types.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. @@ -431,7 +449,7 @@ def create_application( sent along with the request as metadata. Returns: - ~.gct_application.Application: + google.cloud.talent_v4beta1.types.Application: Resource that represents a job application record of a candidate. @@ -489,10 +507,10 @@ def get_application( r"""Retrieves specified application. Args: - request (:class:`~.application_service.GetApplicationRequest`): + request (google.cloud.talent_v4beta1.types.GetApplicationRequest): The request object. Request for getting a application by name. - name (:class:`str`): + name (str): Required. The resource name of the application to be retrieved. @@ -500,6 +518,7 @@ def get_application( "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. @@ -511,7 +530,7 @@ def get_application( sent along with the request as metadata. Returns: - ~.application.Application: + google.cloud.talent_v4beta1.types.Application: Resource that represents a job application record of a candidate. @@ -567,13 +586,14 @@ def update_application( r"""Updates specified application. Args: - request (:class:`~.application_service.UpdateApplicationRequest`): + request (google.cloud.talent_v4beta1.types.UpdateApplicationRequest): The request object. Request for updating a specified application. - application (:class:`~.gct_application.Application`): + application (google.cloud.talent_v4beta1.types.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. @@ -585,7 +605,7 @@ def update_application( sent along with the request as metadata. Returns: - ~.gct_application.Application: + google.cloud.talent_v4beta1.types.Application: Resource that represents a job application record of a candidate. @@ -643,9 +663,9 @@ def delete_application( r"""Deletes specified application. Args: - request (:class:`~.application_service.DeleteApplicationRequest`): + request (google.cloud.talent_v4beta1.types.DeleteApplicationRequest): The request object. Request to delete a application. - name (:class:`str`): + name (str): Required. The resource name of the application to be deleted. @@ -653,6 +673,7 @@ def delete_application( "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. @@ -713,16 +734,17 @@ def list_applications( r"""Lists all applications associated with the profile. Args: - request (:class:`~.application_service.ListApplicationsRequest`): + request (google.cloud.talent_v4beta1.types.ListApplicationsRequest): The request object. List applications for which the client has ACL visibility. - parent (:class:`str`): + 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". + This corresponds to the ``parent`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -734,7 +756,7 @@ def list_applications( sent along with the request as metadata. Returns: - ~.pagers.ListApplicationsPager: + google.cloud.talent_v4beta1.services.application_service.pagers.ListApplicationsPager: The List applications response object. Iterating over this object will yield diff --git a/google/cloud/talent_v4beta1/services/application_service/pagers.py b/google/cloud/talent_v4beta1/services/application_service/pagers.py index 0525dae8..12862dc2 100644 --- a/google/cloud/talent_v4beta1/services/application_service/pagers.py +++ b/google/cloud/talent_v4beta1/services/application_service/pagers.py @@ -25,7 +25,7 @@ class ListApplicationsPager: """A pager for iterating through ``list_applications`` requests. This class thinly wraps an initial - :class:`~.application_service.ListApplicationsResponse` object, and + :class:`google.cloud.talent_v4beta1.types.ListApplicationsResponse` object, and provides an ``__iter__`` method to iterate through its ``applications`` field. @@ -34,7 +34,7 @@ class ListApplicationsPager: through the ``applications`` field on the corresponding responses. - All the usual :class:`~.application_service.ListApplicationsResponse` + All the usual :class:`google.cloud.talent_v4beta1.types.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. """ @@ -52,9 +52,9 @@ def __init__( Args: method (Callable): The method that was originally called, and which instantiated this pager. - request (:class:`~.application_service.ListApplicationsRequest`): + request (google.cloud.talent_v4beta1.types.ListApplicationsRequest): The initial request object. - response (:class:`~.application_service.ListApplicationsResponse`): + response (google.cloud.talent_v4beta1.types.ListApplicationsResponse): The initial response object. metadata (Sequence[Tuple[str, str]]): Strings which should be sent along with the request as metadata. @@ -87,7 +87,7 @@ class ListApplicationsAsyncPager: """A pager for iterating through ``list_applications`` requests. This class thinly wraps an initial - :class:`~.application_service.ListApplicationsResponse` object, and + :class:`google.cloud.talent_v4beta1.types.ListApplicationsResponse` object, and provides an ``__aiter__`` method to iterate through its ``applications`` field. @@ -96,7 +96,7 @@ class ListApplicationsAsyncPager: through the ``applications`` field on the corresponding responses. - All the usual :class:`~.application_service.ListApplicationsResponse` + All the usual :class:`google.cloud.talent_v4beta1.types.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. """ @@ -114,9 +114,9 @@ def __init__( Args: method (Callable): The method that was originally called, and which instantiated this pager. - request (:class:`~.application_service.ListApplicationsRequest`): + request (google.cloud.talent_v4beta1.types.ListApplicationsRequest): The initial request object. - response (:class:`~.application_service.ListApplicationsResponse`): + response (google.cloud.talent_v4beta1.types.ListApplicationsResponse): The initial response object. metadata (Sequence[Tuple[str, str]]): Strings which should be sent along with the request as metadata. diff --git a/google/cloud/talent_v4beta1/services/company_service/async_client.py b/google/cloud/talent_v4beta1/services/company_service/async_client.py index 98c39a8e..e8e29ed0 100644 --- a/google/cloud/talent_v4beta1/services/company_service/async_client.py +++ b/google/cloud/talent_v4beta1/services/company_service/async_client.py @@ -81,6 +81,7 @@ class CompanyServiceAsyncClient: CompanyServiceClient.parse_common_location_path ) + from_service_account_info = CompanyServiceClient.from_service_account_info from_service_account_file = CompanyServiceClient.from_service_account_file from_service_account_json = from_service_account_file @@ -158,7 +159,7 @@ async def create_company( r"""Creates a new company entity. Args: - request (:class:`~.company_service.CreateCompanyRequest`): + request (:class:`google.cloud.talent_v4beta1.types.CreateCompanyRequest`): The request object. The Request of the CreateCompany method. parent (:class:`str`): @@ -170,10 +171,11 @@ async def create_company( 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`): + company (:class:`google.cloud.talent_v4beta1.types.Company`): Required. The company to be created. This corresponds to the ``company`` field on the ``request`` instance; if ``request`` is provided, this @@ -186,7 +188,7 @@ async def create_company( sent along with the request as metadata. Returns: - ~.gct_company.Company: + google.cloud.talent_v4beta1.types.Company: A Company resource represents a company in the service. A company is the entity that owns job postings, that is, @@ -247,7 +249,7 @@ async def get_company( r"""Retrieves specified company. Args: - request (:class:`~.company_service.GetCompanyRequest`): + request (:class:`google.cloud.talent_v4beta1.types.GetCompanyRequest`): The request object. Request for getting a company by name. name (:class:`str`): @@ -261,6 +263,7 @@ async def get_company( 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. @@ -272,7 +275,7 @@ async def get_company( sent along with the request as metadata. Returns: - ~.company.Company: + google.cloud.talent_v4beta1.types.Company: A Company resource represents a company in the service. A company is the entity that owns job postings, that is, @@ -339,13 +342,14 @@ async def update_company( r"""Updates specified company. Args: - request (:class:`~.company_service.UpdateCompanyRequest`): + request (:class:`google.cloud.talent_v4beta1.types.UpdateCompanyRequest`): The request object. Request for updating a specified company. - company (:class:`~.gct_company.Company`): + company (:class:`google.cloud.talent_v4beta1.types.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. @@ -357,7 +361,7 @@ async def update_company( sent along with the request as metadata. Returns: - ~.gct_company.Company: + google.cloud.talent_v4beta1.types.Company: A Company resource represents a company in the service. A company is the entity that owns job postings, that is, @@ -420,7 +424,7 @@ async def delete_company( it. Args: - request (:class:`~.company_service.DeleteCompanyRequest`): + request (:class:`google.cloud.talent_v4beta1.types.DeleteCompanyRequest`): The request object. Request to delete a company. name (:class:`str`): Required. The resource name of the company to be @@ -432,6 +436,7 @@ async def delete_company( 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. @@ -499,7 +504,7 @@ async def list_companies( r"""Lists all companies associated with the project. Args: - request (:class:`~.company_service.ListCompaniesRequest`): + request (:class:`google.cloud.talent_v4beta1.types.ListCompaniesRequest`): The request object. List companies for which the client has ACL visibility. parent (:class:`str`): @@ -512,6 +517,7 @@ async def list_companies( 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. @@ -523,7 +529,7 @@ async def list_companies( sent along with the request as metadata. Returns: - ~.pagers.ListCompaniesAsyncPager: + google.cloud.talent_v4beta1.services.company_service.pagers.ListCompaniesAsyncPager: The List companies response object. Iterating over this object will yield results and resolve additional pages diff --git a/google/cloud/talent_v4beta1/services/company_service/client.py b/google/cloud/talent_v4beta1/services/company_service/client.py index e4638852..228516b4 100644 --- a/google/cloud/talent_v4beta1/services/company_service/client.py +++ b/google/cloud/talent_v4beta1/services/company_service/client.py @@ -115,6 +115,22 @@ def _get_default_mtls_endpoint(api_endpoint): DEFAULT_ENDPOINT ) + @classmethod + def from_service_account_info(cls, info: dict, *args, **kwargs): + """Creates an instance of this client using the provided credentials info. + + Args: + info (dict): The service account private key info. + args: Additional arguments to pass to the constructor. + kwargs: Additional arguments to pass to the constructor. + + Returns: + CompanyServiceClient: The constructed client. + """ + credentials = service_account.Credentials.from_service_account_info(info) + kwargs["credentials"] = credentials + return cls(*args, **kwargs) + @classmethod def from_service_account_file(cls, filename: str, *args, **kwargs): """Creates an instance of this client using the provided credentials @@ -127,7 +143,7 @@ def from_service_account_file(cls, filename: str, *args, **kwargs): kwargs: Additional arguments to pass to the constructor. Returns: - {@api.name}: The constructed client. + CompanyServiceClient: The constructed client. """ credentials = service_account.Credentials.from_service_account_file(filename) kwargs["credentials"] = credentials @@ -235,10 +251,10 @@ def __init__( 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 (Union[str, CompanyServiceTransport]): The transport to use. If set to None, a transport is chosen automatically. - client_options (client_options_lib.ClientOptions): Custom options for the + client_options (google.api_core.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_ENDPOINT @@ -349,10 +365,10 @@ def create_company( r"""Creates a new company entity. Args: - request (:class:`~.company_service.CreateCompanyRequest`): + request (google.cloud.talent_v4beta1.types.CreateCompanyRequest): The request object. The Request of the CreateCompany method. - parent (:class:`str`): + parent (str): Required. Resource name of the tenant under which the company is created. @@ -361,10 +377,11 @@ def create_company( 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`): + company (google.cloud.talent_v4beta1.types.Company): Required. The company to be created. This corresponds to the ``company`` field on the ``request`` instance; if ``request`` is provided, this @@ -377,7 +394,7 @@ def create_company( sent along with the request as metadata. Returns: - ~.gct_company.Company: + google.cloud.talent_v4beta1.types.Company: A Company resource represents a company in the service. A company is the entity that owns job postings, that is, @@ -439,10 +456,10 @@ def get_company( r"""Retrieves specified company. Args: - request (:class:`~.company_service.GetCompanyRequest`): + request (google.cloud.talent_v4beta1.types.GetCompanyRequest): The request object. Request for getting a company by name. - name (:class:`str`): + name (str): Required. The resource name of the company to be retrieved. @@ -453,6 +470,7 @@ def get_company( 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. @@ -464,7 +482,7 @@ def get_company( sent along with the request as metadata. Returns: - ~.company.Company: + google.cloud.talent_v4beta1.types.Company: A Company resource represents a company in the service. A company is the entity that owns job postings, that is, @@ -524,13 +542,14 @@ def update_company( r"""Updates specified company. Args: - request (:class:`~.company_service.UpdateCompanyRequest`): + request (google.cloud.talent_v4beta1.types.UpdateCompanyRequest): The request object. Request for updating a specified company. - company (:class:`~.gct_company.Company`): + company (google.cloud.talent_v4beta1.types.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. @@ -542,7 +561,7 @@ def update_company( sent along with the request as metadata. Returns: - ~.gct_company.Company: + google.cloud.talent_v4beta1.types.Company: A Company resource represents a company in the service. A company is the entity that owns job postings, that is, @@ -606,9 +625,9 @@ def delete_company( it. Args: - request (:class:`~.company_service.DeleteCompanyRequest`): + request (google.cloud.talent_v4beta1.types.DeleteCompanyRequest): The request object. Request to delete a company. - name (:class:`str`): + name (str): Required. The resource name of the company to be deleted. @@ -618,6 +637,7 @@ def delete_company( 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. @@ -678,10 +698,10 @@ def list_companies( r"""Lists all companies associated with the project. Args: - request (:class:`~.company_service.ListCompaniesRequest`): + request (google.cloud.talent_v4beta1.types.ListCompaniesRequest): The request object. List companies for which the client has ACL visibility. - parent (:class:`str`): + parent (str): Required. Resource name of the tenant under which the company is created. @@ -691,6 +711,7 @@ def list_companies( 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. @@ -702,7 +723,7 @@ def list_companies( sent along with the request as metadata. Returns: - ~.pagers.ListCompaniesPager: + google.cloud.talent_v4beta1.services.company_service.pagers.ListCompaniesPager: The List companies response object. Iterating over this object will yield results and resolve additional pages diff --git a/google/cloud/talent_v4beta1/services/company_service/pagers.py b/google/cloud/talent_v4beta1/services/company_service/pagers.py index 6b25c9a9..d3cf81a7 100644 --- a/google/cloud/talent_v4beta1/services/company_service/pagers.py +++ b/google/cloud/talent_v4beta1/services/company_service/pagers.py @@ -25,7 +25,7 @@ class ListCompaniesPager: """A pager for iterating through ``list_companies`` requests. This class thinly wraps an initial - :class:`~.company_service.ListCompaniesResponse` object, and + :class:`google.cloud.talent_v4beta1.types.ListCompaniesResponse` object, and provides an ``__iter__`` method to iterate through its ``companies`` field. @@ -34,7 +34,7 @@ class ListCompaniesPager: through the ``companies`` field on the corresponding responses. - All the usual :class:`~.company_service.ListCompaniesResponse` + All the usual :class:`google.cloud.talent_v4beta1.types.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. """ @@ -52,9 +52,9 @@ def __init__( Args: method (Callable): The method that was originally called, and which instantiated this pager. - request (:class:`~.company_service.ListCompaniesRequest`): + request (google.cloud.talent_v4beta1.types.ListCompaniesRequest): The initial request object. - response (:class:`~.company_service.ListCompaniesResponse`): + response (google.cloud.talent_v4beta1.types.ListCompaniesResponse): The initial response object. metadata (Sequence[Tuple[str, str]]): Strings which should be sent along with the request as metadata. @@ -87,7 +87,7 @@ class ListCompaniesAsyncPager: """A pager for iterating through ``list_companies`` requests. This class thinly wraps an initial - :class:`~.company_service.ListCompaniesResponse` object, and + :class:`google.cloud.talent_v4beta1.types.ListCompaniesResponse` object, and provides an ``__aiter__`` method to iterate through its ``companies`` field. @@ -96,7 +96,7 @@ class ListCompaniesAsyncPager: through the ``companies`` field on the corresponding responses. - All the usual :class:`~.company_service.ListCompaniesResponse` + All the usual :class:`google.cloud.talent_v4beta1.types.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. """ @@ -114,9 +114,9 @@ def __init__( Args: method (Callable): The method that was originally called, and which instantiated this pager. - request (:class:`~.company_service.ListCompaniesRequest`): + request (google.cloud.talent_v4beta1.types.ListCompaniesRequest): The initial request object. - response (:class:`~.company_service.ListCompaniesResponse`): + response (google.cloud.talent_v4beta1.types.ListCompaniesResponse): The initial response object. metadata (Sequence[Tuple[str, str]]): Strings which should be sent along with the request as metadata. diff --git a/google/cloud/talent_v4beta1/services/completion/async_client.py b/google/cloud/talent_v4beta1/services/completion/async_client.py index 40da92eb..7472c5f0 100644 --- a/google/cloud/talent_v4beta1/services/completion/async_client.py +++ b/google/cloud/talent_v4beta1/services/completion/async_client.py @@ -70,6 +70,7 @@ class CompletionAsyncClient: CompletionClient.parse_common_location_path ) + from_service_account_info = CompletionClient.from_service_account_info from_service_account_file = CompletionClient.from_service_account_file from_service_account_json = from_service_account_file @@ -147,7 +148,7 @@ async def complete_query( complete search box. Args: - request (:class:`~.completion_service.CompleteQueryRequest`): + request (:class:`google.cloud.talent_v4beta1.types.CompleteQueryRequest`): The request object. Auto-complete parameters. retry (google.api_core.retry.Retry): Designation of what errors, if any, @@ -157,7 +158,7 @@ async def complete_query( sent along with the request as metadata. Returns: - ~.completion_service.CompleteQueryResponse: + google.cloud.talent_v4beta1.types.CompleteQueryResponse: Response of auto-complete query. """ # Create or coerce a protobuf request object. diff --git a/google/cloud/talent_v4beta1/services/completion/client.py b/google/cloud/talent_v4beta1/services/completion/client.py index f01febaf..b704925c 100644 --- a/google/cloud/talent_v4beta1/services/completion/client.py +++ b/google/cloud/talent_v4beta1/services/completion/client.py @@ -108,6 +108,22 @@ def _get_default_mtls_endpoint(api_endpoint): DEFAULT_ENDPOINT ) + @classmethod + def from_service_account_info(cls, info: dict, *args, **kwargs): + """Creates an instance of this client using the provided credentials info. + + Args: + info (dict): The service account private key info. + args: Additional arguments to pass to the constructor. + kwargs: Additional arguments to pass to the constructor. + + Returns: + CompletionClient: The constructed client. + """ + credentials = service_account.Credentials.from_service_account_info(info) + kwargs["credentials"] = credentials + return cls(*args, **kwargs) + @classmethod def from_service_account_file(cls, filename: str, *args, **kwargs): """Creates an instance of this client using the provided credentials @@ -120,7 +136,7 @@ def from_service_account_file(cls, filename: str, *args, **kwargs): kwargs: Additional arguments to pass to the constructor. Returns: - {@api.name}: The constructed client. + CompletionClient: The constructed client. """ credentials = service_account.Credentials.from_service_account_file(filename) kwargs["credentials"] = credentials @@ -228,10 +244,10 @@ def __init__( 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 (Union[str, CompletionTransport]): The transport to use. If set to None, a transport is chosen automatically. - client_options (client_options_lib.ClientOptions): Custom options for the + client_options (google.api_core.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_ENDPOINT @@ -342,7 +358,7 @@ def complete_query( complete search box. Args: - request (:class:`~.completion_service.CompleteQueryRequest`): + request (google.cloud.talent_v4beta1.types.CompleteQueryRequest): The request object. Auto-complete parameters. retry (google.api_core.retry.Retry): Designation of what errors, if any, @@ -352,7 +368,7 @@ def complete_query( sent along with the request as metadata. Returns: - ~.completion_service.CompleteQueryResponse: + google.cloud.talent_v4beta1.types.CompleteQueryResponse: Response of auto-complete query. """ # Create or coerce a protobuf request object. diff --git a/google/cloud/talent_v4beta1/services/event_service/async_client.py b/google/cloud/talent_v4beta1/services/event_service/async_client.py index 553aed17..c90c5964 100644 --- a/google/cloud/talent_v4beta1/services/event_service/async_client.py +++ b/google/cloud/talent_v4beta1/services/event_service/async_client.py @@ -73,6 +73,7 @@ class EventServiceAsyncClient: EventServiceClient.parse_common_location_path ) + from_service_account_info = EventServiceClient.from_service_account_info from_service_account_file = EventServiceClient.from_service_account_file from_service_account_json = from_service_account_file @@ -156,7 +157,7 @@ async def create_client_event( about self service tools. Args: - request (:class:`~.event_service.CreateClientEventRequest`): + request (:class:`google.cloud.talent_v4beta1.types.CreateClientEventRequest`): The request object. The report event request. parent (:class:`str`): Required. Resource name of the tenant under which the @@ -167,13 +168,15 @@ async def create_client_event( 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`): + client_event (:class:`google.cloud.talent_v4beta1.types.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. @@ -185,7 +188,7 @@ async def create_client_event( sent along with the request as metadata. Returns: - ~.event.ClientEvent: + google.cloud.talent_v4beta1.types.ClientEvent: An event issued when an end user interacts with the application that implements Cloud Talent Solution. diff --git a/google/cloud/talent_v4beta1/services/event_service/client.py b/google/cloud/talent_v4beta1/services/event_service/client.py index 21204729..c38b8537 100644 --- a/google/cloud/talent_v4beta1/services/event_service/client.py +++ b/google/cloud/talent_v4beta1/services/event_service/client.py @@ -109,6 +109,22 @@ def _get_default_mtls_endpoint(api_endpoint): DEFAULT_ENDPOINT ) + @classmethod + def from_service_account_info(cls, info: dict, *args, **kwargs): + """Creates an instance of this client using the provided credentials info. + + Args: + info (dict): The service account private key info. + args: Additional arguments to pass to the constructor. + kwargs: Additional arguments to pass to the constructor. + + Returns: + EventServiceClient: The constructed client. + """ + credentials = service_account.Credentials.from_service_account_info(info) + kwargs["credentials"] = credentials + return cls(*args, **kwargs) + @classmethod def from_service_account_file(cls, filename: str, *args, **kwargs): """Creates an instance of this client using the provided credentials @@ -121,7 +137,7 @@ def from_service_account_file(cls, filename: str, *args, **kwargs): kwargs: Additional arguments to pass to the constructor. Returns: - {@api.name}: The constructed client. + EventServiceClient: The constructed client. """ credentials = service_account.Credentials.from_service_account_file(filename) kwargs["credentials"] = credentials @@ -229,10 +245,10 @@ def __init__( 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 (Union[str, EventServiceTransport]): The transport to use. If set to None, a transport is chosen automatically. - client_options (client_options_lib.ClientOptions): Custom options for the + client_options (google.api_core.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_ENDPOINT @@ -349,9 +365,9 @@ def create_client_event( about self service tools. Args: - request (:class:`~.event_service.CreateClientEventRequest`): + request (google.cloud.talent_v4beta1.types.CreateClientEventRequest): The request object. The report event request. - parent (:class:`str`): + parent (str): Required. Resource name of the tenant under which the event is created. @@ -360,13 +376,15 @@ def create_client_event( 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`): + client_event (google.cloud.talent_v4beta1.types.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. @@ -378,7 +396,7 @@ def create_client_event( sent along with the request as metadata. Returns: - ~.event.ClientEvent: + google.cloud.talent_v4beta1.types.ClientEvent: An event issued when an end user interacts with the application that implements Cloud Talent Solution. diff --git a/google/cloud/talent_v4beta1/services/job_service/async_client.py b/google/cloud/talent_v4beta1/services/job_service/async_client.py index a5ad40c6..0c9d7d91 100644 --- a/google/cloud/talent_v4beta1/services/job_service/async_client.py +++ b/google/cloud/talent_v4beta1/services/job_service/async_client.py @@ -80,6 +80,7 @@ class JobServiceAsyncClient: JobServiceClient.parse_common_location_path ) + from_service_account_info = JobServiceClient.from_service_account_info from_service_account_file = JobServiceClient.from_service_account_file from_service_account_json = from_service_account_file @@ -159,7 +160,7 @@ async def create_job( but it may take up to 5 minutes. Args: - request (:class:`~.job_service.CreateJobRequest`): + request (:class:`google.cloud.talent_v4beta1.types.CreateJobRequest`): The request object. Create job request. parent (:class:`str`): Required. The resource name of the tenant under which @@ -170,10 +171,11 @@ async def create_job( 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`): + job (:class:`google.cloud.talent_v4beta1.types.Job`): Required. The Job to be created. This corresponds to the ``job`` field on the ``request`` instance; if ``request`` is provided, this @@ -186,12 +188,11 @@ async def create_job( 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. + google.cloud.talent_v4beta1.types.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. @@ -247,7 +248,7 @@ async def batch_create_jobs( r"""Begins executing a batch create jobs operation. Args: - request (:class:`~.job_service.BatchCreateJobsRequest`): + request (:class:`google.cloud.talent_v4beta1.types.BatchCreateJobsRequest`): The request object. Request to create a batch of jobs. parent (:class:`str`): Required. The resource name of the tenant under which @@ -258,10 +259,11 @@ async def batch_create_jobs( 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]`): + jobs (:class:`Sequence[google.cloud.talent_v4beta1.types.Job]`): Required. The jobs to be created. This corresponds to the ``jobs`` field on the ``request`` instance; if ``request`` is provided, this @@ -274,18 +276,14 @@ async def batch_create_jobs( sent along with the request as metadata. Returns: - ~.operation_async.AsyncOperation: + google.api_core.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. + The result type for the operation will be :class:`google.cloud.talent_v4beta1.types.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. @@ -350,7 +348,7 @@ async def get_job( recently EXPIRED within the last 90 days. Args: - request (:class:`~.job_service.GetJobRequest`): + request (:class:`google.cloud.talent_v4beta1.types.GetJobRequest`): The request object. Get job request. name (:class:`str`): Required. The resource name of the job to retrieve. @@ -361,6 +359,7 @@ async def get_job( 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. @@ -372,12 +371,11 @@ async def get_job( 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. + google.cloud.talent_v4beta1.types.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. @@ -441,9 +439,9 @@ async def update_job( minutes. Args: - request (:class:`~.job_service.UpdateJobRequest`): + request (:class:`google.cloud.talent_v4beta1.types.UpdateJobRequest`): The request object. Update job request. - job (:class:`~.gct_job.Job`): + job (:class:`google.cloud.talent_v4beta1.types.Job`): Required. The Job to be updated. This corresponds to the ``job`` field on the ``request`` instance; if ``request`` is provided, this @@ -456,12 +454,11 @@ async def update_job( 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. + google.cloud.talent_v4beta1.types.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. @@ -515,7 +512,7 @@ async def batch_update_jobs( r"""Begins executing a batch update jobs operation. Args: - request (:class:`~.job_service.BatchUpdateJobsRequest`): + request (:class:`google.cloud.talent_v4beta1.types.BatchUpdateJobsRequest`): The request object. Request to update a batch of jobs. parent (:class:`str`): Required. The resource name of the tenant under which @@ -526,10 +523,11 @@ async def batch_update_jobs( 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]`): + jobs (:class:`Sequence[google.cloud.talent_v4beta1.types.Job]`): Required. The jobs to be updated. This corresponds to the ``jobs`` field on the ``request`` instance; if ``request`` is provided, this @@ -542,18 +540,14 @@ async def batch_update_jobs( sent along with the request as metadata. Returns: - ~.operation_async.AsyncOperation: + google.api_core.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. + The result type for the operation will be :class:`google.cloud.talent_v4beta1.types.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. @@ -619,7 +613,7 @@ async def delete_job( seconds, but it may take up to 5 minutes. Args: - request (:class:`~.job_service.DeleteJobRequest`): + request (:class:`google.cloud.talent_v4beta1.types.DeleteJobRequest`): The request object. Delete job request. name (:class:`str`): Required. The resource name of the job to be deleted. @@ -630,6 +624,7 @@ async def delete_job( 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. @@ -699,7 +694,7 @@ async def batch_delete_jobs( filter. Args: - request (:class:`~.job_service.BatchDeleteJobsRequest`): + request (:class:`google.cloud.talent_v4beta1.types.BatchDeleteJobsRequest`): The request object. Batch delete jobs request. parent (:class:`str`): Required. The resource name of the tenant under which @@ -710,6 +705,7 @@ async def batch_delete_jobs( 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. @@ -725,7 +721,8 @@ async def batch_delete_jobs( - ``requisitionId`` (Required) Sample Query: companyName = "projects/foo/companies/bar" - AND requisitionId = "req-1". + AND requisitionId = "req-1" + This corresponds to the ``filter`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -788,7 +785,7 @@ async def list_jobs( r"""Lists jobs by filter. Args: - request (:class:`~.job_service.ListJobsRequest`): + request (:class:`google.cloud.talent_v4beta1.types.ListJobsRequest`): The request object. List jobs request. parent (:class:`str`): Required. The resource name of the tenant under which @@ -799,6 +796,7 @@ async def list_jobs( 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. @@ -824,7 +822,8 @@ async def list_jobs( requisitionId = "req-1" - companyName = "projects/foo/tenants/bar/companies/baz" AND status = - "EXPIRED". + "EXPIRED" + This corresponds to the ``filter`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -836,7 +835,7 @@ async def list_jobs( sent along with the request as metadata. Returns: - ~.pagers.ListJobsAsyncPager: + google.cloud.talent_v4beta1.services.job_service.pagers.ListJobsAsyncPager: List jobs response. Iterating over this object will yield results and resolve additional pages @@ -914,7 +913,7 @@ async def search_jobs( has permission to search against. Args: - request (:class:`~.job_service.SearchJobsRequest`): + request (:class:`google.cloud.talent_v4beta1.types.SearchJobsRequest`): The request object. The Request body of the `SearchJobs` call. @@ -925,7 +924,7 @@ async def search_jobs( sent along with the request as metadata. Returns: - ~.pagers.SearchJobsAsyncPager: + google.cloud.talent_v4beta1.services.job_service.pagers.SearchJobsAsyncPager: Response for SearchJob method. Iterating over this object will yield results and resolve additional pages @@ -985,7 +984,7 @@ async def search_jobs_for_alert( permission to search against. Args: - request (:class:`~.job_service.SearchJobsRequest`): + request (:class:`google.cloud.talent_v4beta1.types.SearchJobsRequest`): The request object. The Request body of the `SearchJobs` call. @@ -996,7 +995,7 @@ async def search_jobs_for_alert( sent along with the request as metadata. Returns: - ~.pagers.SearchJobsForAlertAsyncPager: + google.cloud.talent_v4beta1.services.job_service.pagers.SearchJobsForAlertAsyncPager: Response for SearchJob method. Iterating over this object will yield results and resolve additional pages diff --git a/google/cloud/talent_v4beta1/services/job_service/client.py b/google/cloud/talent_v4beta1/services/job_service/client.py index 726b75ae..ddc96a07 100644 --- a/google/cloud/talent_v4beta1/services/job_service/client.py +++ b/google/cloud/talent_v4beta1/services/job_service/client.py @@ -116,6 +116,22 @@ def _get_default_mtls_endpoint(api_endpoint): DEFAULT_ENDPOINT ) + @classmethod + def from_service_account_info(cls, info: dict, *args, **kwargs): + """Creates an instance of this client using the provided credentials info. + + Args: + info (dict): The service account private key info. + args: Additional arguments to pass to the constructor. + kwargs: Additional arguments to pass to the constructor. + + Returns: + JobServiceClient: The constructed client. + """ + credentials = service_account.Credentials.from_service_account_info(info) + kwargs["credentials"] = credentials + return cls(*args, **kwargs) + @classmethod def from_service_account_file(cls, filename: str, *args, **kwargs): """Creates an instance of this client using the provided credentials @@ -128,7 +144,7 @@ def from_service_account_file(cls, filename: str, *args, **kwargs): kwargs: Additional arguments to pass to the constructor. Returns: - {@api.name}: The constructed client. + JobServiceClient: The constructed client. """ credentials = service_account.Credentials.from_service_account_file(filename) kwargs["credentials"] = credentials @@ -252,10 +268,10 @@ def __init__( 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 (Union[str, JobServiceTransport]): The transport to use. If set to None, a transport is chosen automatically. - client_options (client_options_lib.ClientOptions): Custom options for the + client_options (google.api_core.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_ENDPOINT @@ -368,9 +384,9 @@ def create_job( but it may take up to 5 minutes. Args: - request (:class:`~.job_service.CreateJobRequest`): + request (google.cloud.talent_v4beta1.types.CreateJobRequest): The request object. Create job request. - parent (:class:`str`): + parent (str): Required. The resource name of the tenant under which the job is created. @@ -379,10 +395,11 @@ def create_job( 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`): + job (google.cloud.talent_v4beta1.types.Job): Required. The Job to be created. This corresponds to the ``job`` field on the ``request`` instance; if ``request`` is provided, this @@ -395,12 +412,11 @@ def create_job( 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. + google.cloud.talent_v4beta1.types.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. @@ -457,9 +473,9 @@ def batch_create_jobs( r"""Begins executing a batch create jobs operation. Args: - request (:class:`~.job_service.BatchCreateJobsRequest`): + request (google.cloud.talent_v4beta1.types.BatchCreateJobsRequest): The request object. Request to create a batch of jobs. - parent (:class:`str`): + parent (str): Required. The resource name of the tenant under which the job is created. @@ -468,10 +484,11 @@ def batch_create_jobs( 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]`): + jobs (Sequence[google.cloud.talent_v4beta1.types.Job]): Required. The jobs to be created. This corresponds to the ``jobs`` field on the ``request`` instance; if ``request`` is provided, this @@ -484,18 +501,14 @@ def batch_create_jobs( sent along with the request as metadata. Returns: - ~.operation.Operation: + google.api_core.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. + The result type for the operation will be :class:`google.cloud.talent_v4beta1.types.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. @@ -561,9 +574,9 @@ def get_job( recently EXPIRED within the last 90 days. Args: - request (:class:`~.job_service.GetJobRequest`): + request (google.cloud.talent_v4beta1.types.GetJobRequest): The request object. Get job request. - name (:class:`str`): + name (str): Required. The resource name of the job to retrieve. The format is @@ -572,6 +585,7 @@ def get_job( 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. @@ -583,12 +597,11 @@ def get_job( 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. + google.cloud.talent_v4beta1.types.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. @@ -645,9 +658,9 @@ def update_job( minutes. Args: - request (:class:`~.job_service.UpdateJobRequest`): + request (google.cloud.talent_v4beta1.types.UpdateJobRequest): The request object. Update job request. - job (:class:`~.gct_job.Job`): + job (google.cloud.talent_v4beta1.types.Job): Required. The Job to be updated. This corresponds to the ``job`` field on the ``request`` instance; if ``request`` is provided, this @@ -660,12 +673,11 @@ def update_job( 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. + google.cloud.talent_v4beta1.types.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. @@ -720,9 +732,9 @@ def batch_update_jobs( r"""Begins executing a batch update jobs operation. Args: - request (:class:`~.job_service.BatchUpdateJobsRequest`): + request (google.cloud.talent_v4beta1.types.BatchUpdateJobsRequest): The request object. Request to update a batch of jobs. - parent (:class:`str`): + parent (str): Required. The resource name of the tenant under which the job is created. @@ -731,10 +743,11 @@ def batch_update_jobs( 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]`): + jobs (Sequence[google.cloud.talent_v4beta1.types.Job]): Required. The jobs to be updated. This corresponds to the ``jobs`` field on the ``request`` instance; if ``request`` is provided, this @@ -747,18 +760,14 @@ def batch_update_jobs( sent along with the request as metadata. Returns: - ~.operation.Operation: + google.api_core.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. + The result type for the operation will be :class:`google.cloud.talent_v4beta1.types.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. @@ -825,9 +834,9 @@ def delete_job( seconds, but it may take up to 5 minutes. Args: - request (:class:`~.job_service.DeleteJobRequest`): + request (google.cloud.talent_v4beta1.types.DeleteJobRequest): The request object. Delete job request. - name (:class:`str`): + name (str): Required. The resource name of the job to be deleted. The format is @@ -836,6 +845,7 @@ def delete_job( 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. @@ -898,9 +908,9 @@ def batch_delete_jobs( filter. Args: - request (:class:`~.job_service.BatchDeleteJobsRequest`): + request (google.cloud.talent_v4beta1.types.BatchDeleteJobsRequest): The request object. Batch delete jobs request. - parent (:class:`str`): + parent (str): Required. The resource name of the tenant under which the job is created. @@ -909,10 +919,11 @@ def batch_delete_jobs( 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`): + filter (str): Required. The filter string specifies the jobs to be deleted. @@ -924,7 +935,8 @@ def batch_delete_jobs( - ``requisitionId`` (Required) Sample Query: companyName = "projects/foo/companies/bar" - AND requisitionId = "req-1". + AND requisitionId = "req-1" + This corresponds to the ``filter`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -988,9 +1000,9 @@ def list_jobs( r"""Lists jobs by filter. Args: - request (:class:`~.job_service.ListJobsRequest`): + request (google.cloud.talent_v4beta1.types.ListJobsRequest): The request object. List jobs request. - parent (:class:`str`): + parent (str): Required. The resource name of the tenant under which the job is created. @@ -999,10 +1011,11 @@ def list_jobs( 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`): + filter (str): Required. The filter string specifies the jobs to be enumerated. @@ -1024,7 +1037,8 @@ def list_jobs( requisitionId = "req-1" - companyName = "projects/foo/tenants/bar/companies/baz" AND status = - "EXPIRED". + "EXPIRED" + This corresponds to the ``filter`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -1036,7 +1050,7 @@ def list_jobs( sent along with the request as metadata. Returns: - ~.pagers.ListJobsPager: + google.cloud.talent_v4beta1.services.job_service.pagers.ListJobsPager: List jobs response. Iterating over this object will yield results and resolve additional pages @@ -1107,7 +1121,7 @@ def search_jobs( has permission to search against. Args: - request (:class:`~.job_service.SearchJobsRequest`): + request (google.cloud.talent_v4beta1.types.SearchJobsRequest): The request object. The Request body of the `SearchJobs` call. @@ -1118,7 +1132,7 @@ def search_jobs( sent along with the request as metadata. Returns: - ~.pagers.SearchJobsPager: + google.cloud.talent_v4beta1.services.job_service.pagers.SearchJobsPager: Response for SearchJob method. Iterating over this object will yield results and resolve additional pages @@ -1179,7 +1193,7 @@ def search_jobs_for_alert( permission to search against. Args: - request (:class:`~.job_service.SearchJobsRequest`): + request (google.cloud.talent_v4beta1.types.SearchJobsRequest): The request object. The Request body of the `SearchJobs` call. @@ -1190,7 +1204,7 @@ def search_jobs_for_alert( sent along with the request as metadata. Returns: - ~.pagers.SearchJobsForAlertPager: + google.cloud.talent_v4beta1.services.job_service.pagers.SearchJobsForAlertPager: Response for SearchJob method. Iterating over this object will yield results and resolve additional pages diff --git a/google/cloud/talent_v4beta1/services/job_service/pagers.py b/google/cloud/talent_v4beta1/services/job_service/pagers.py index fcefff46..57d6d4c1 100644 --- a/google/cloud/talent_v4beta1/services/job_service/pagers.py +++ b/google/cloud/talent_v4beta1/services/job_service/pagers.py @@ -25,7 +25,7 @@ class ListJobsPager: """A pager for iterating through ``list_jobs`` requests. This class thinly wraps an initial - :class:`~.job_service.ListJobsResponse` object, and + :class:`google.cloud.talent_v4beta1.types.ListJobsResponse` object, and provides an ``__iter__`` method to iterate through its ``jobs`` field. @@ -34,7 +34,7 @@ class ListJobsPager: through the ``jobs`` field on the corresponding responses. - All the usual :class:`~.job_service.ListJobsResponse` + All the usual :class:`google.cloud.talent_v4beta1.types.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. """ @@ -52,9 +52,9 @@ def __init__( Args: method (Callable): The method that was originally called, and which instantiated this pager. - request (:class:`~.job_service.ListJobsRequest`): + request (google.cloud.talent_v4beta1.types.ListJobsRequest): The initial request object. - response (:class:`~.job_service.ListJobsResponse`): + response (google.cloud.talent_v4beta1.types.ListJobsResponse): The initial response object. metadata (Sequence[Tuple[str, str]]): Strings which should be sent along with the request as metadata. @@ -87,7 +87,7 @@ class ListJobsAsyncPager: """A pager for iterating through ``list_jobs`` requests. This class thinly wraps an initial - :class:`~.job_service.ListJobsResponse` object, and + :class:`google.cloud.talent_v4beta1.types.ListJobsResponse` object, and provides an ``__aiter__`` method to iterate through its ``jobs`` field. @@ -96,7 +96,7 @@ class ListJobsAsyncPager: through the ``jobs`` field on the corresponding responses. - All the usual :class:`~.job_service.ListJobsResponse` + All the usual :class:`google.cloud.talent_v4beta1.types.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. """ @@ -114,9 +114,9 @@ def __init__( Args: method (Callable): The method that was originally called, and which instantiated this pager. - request (:class:`~.job_service.ListJobsRequest`): + request (google.cloud.talent_v4beta1.types.ListJobsRequest): The initial request object. - response (:class:`~.job_service.ListJobsResponse`): + response (google.cloud.talent_v4beta1.types.ListJobsResponse): The initial response object. metadata (Sequence[Tuple[str, str]]): Strings which should be sent along with the request as metadata. @@ -153,7 +153,7 @@ class SearchJobsPager: """A pager for iterating through ``search_jobs`` requests. This class thinly wraps an initial - :class:`~.job_service.SearchJobsResponse` object, and + :class:`google.cloud.talent_v4beta1.types.SearchJobsResponse` object, and provides an ``__iter__`` method to iterate through its ``matching_jobs`` field. @@ -162,7 +162,7 @@ class SearchJobsPager: through the ``matching_jobs`` field on the corresponding responses. - All the usual :class:`~.job_service.SearchJobsResponse` + All the usual :class:`google.cloud.talent_v4beta1.types.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. """ @@ -180,9 +180,9 @@ def __init__( Args: method (Callable): The method that was originally called, and which instantiated this pager. - request (:class:`~.job_service.SearchJobsRequest`): + request (google.cloud.talent_v4beta1.types.SearchJobsRequest): The initial request object. - response (:class:`~.job_service.SearchJobsResponse`): + response (google.cloud.talent_v4beta1.types.SearchJobsResponse): The initial response object. metadata (Sequence[Tuple[str, str]]): Strings which should be sent along with the request as metadata. @@ -215,7 +215,7 @@ class SearchJobsAsyncPager: """A pager for iterating through ``search_jobs`` requests. This class thinly wraps an initial - :class:`~.job_service.SearchJobsResponse` object, and + :class:`google.cloud.talent_v4beta1.types.SearchJobsResponse` object, and provides an ``__aiter__`` method to iterate through its ``matching_jobs`` field. @@ -224,7 +224,7 @@ class SearchJobsAsyncPager: through the ``matching_jobs`` field on the corresponding responses. - All the usual :class:`~.job_service.SearchJobsResponse` + All the usual :class:`google.cloud.talent_v4beta1.types.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. """ @@ -242,9 +242,9 @@ def __init__( Args: method (Callable): The method that was originally called, and which instantiated this pager. - request (:class:`~.job_service.SearchJobsRequest`): + request (google.cloud.talent_v4beta1.types.SearchJobsRequest): The initial request object. - response (:class:`~.job_service.SearchJobsResponse`): + response (google.cloud.talent_v4beta1.types.SearchJobsResponse): The initial response object. metadata (Sequence[Tuple[str, str]]): Strings which should be sent along with the request as metadata. @@ -281,7 +281,7 @@ class SearchJobsForAlertPager: """A pager for iterating through ``search_jobs_for_alert`` requests. This class thinly wraps an initial - :class:`~.job_service.SearchJobsResponse` object, and + :class:`google.cloud.talent_v4beta1.types.SearchJobsResponse` object, and provides an ``__iter__`` method to iterate through its ``matching_jobs`` field. @@ -290,7 +290,7 @@ class SearchJobsForAlertPager: through the ``matching_jobs`` field on the corresponding responses. - All the usual :class:`~.job_service.SearchJobsResponse` + All the usual :class:`google.cloud.talent_v4beta1.types.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. """ @@ -308,9 +308,9 @@ def __init__( Args: method (Callable): The method that was originally called, and which instantiated this pager. - request (:class:`~.job_service.SearchJobsRequest`): + request (google.cloud.talent_v4beta1.types.SearchJobsRequest): The initial request object. - response (:class:`~.job_service.SearchJobsResponse`): + response (google.cloud.talent_v4beta1.types.SearchJobsResponse): The initial response object. metadata (Sequence[Tuple[str, str]]): Strings which should be sent along with the request as metadata. @@ -343,7 +343,7 @@ class SearchJobsForAlertAsyncPager: """A pager for iterating through ``search_jobs_for_alert`` requests. This class thinly wraps an initial - :class:`~.job_service.SearchJobsResponse` object, and + :class:`google.cloud.talent_v4beta1.types.SearchJobsResponse` object, and provides an ``__aiter__`` method to iterate through its ``matching_jobs`` field. @@ -352,7 +352,7 @@ class SearchJobsForAlertAsyncPager: through the ``matching_jobs`` field on the corresponding responses. - All the usual :class:`~.job_service.SearchJobsResponse` + All the usual :class:`google.cloud.talent_v4beta1.types.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. """ @@ -370,9 +370,9 @@ def __init__( Args: method (Callable): The method that was originally called, and which instantiated this pager. - request (:class:`~.job_service.SearchJobsRequest`): + request (google.cloud.talent_v4beta1.types.SearchJobsRequest): The initial request object. - response (:class:`~.job_service.SearchJobsResponse`): + response (google.cloud.talent_v4beta1.types.SearchJobsResponse): The initial response object. metadata (Sequence[Tuple[str, str]]): Strings which should be sent along with the request as metadata. diff --git a/google/cloud/talent_v4beta1/services/profile_service/async_client.py b/google/cloud/talent_v4beta1/services/profile_service/async_client.py index 914e2bf4..5ea23b8a 100644 --- a/google/cloud/talent_v4beta1/services/profile_service/async_client.py +++ b/google/cloud/talent_v4beta1/services/profile_service/async_client.py @@ -86,6 +86,7 @@ class ProfileServiceAsyncClient: ProfileServiceClient.parse_common_location_path ) + from_service_account_info = ProfileServiceClient.from_service_account_info from_service_account_file = ProfileServiceClient.from_service_account_file from_service_account_json = from_service_account_file @@ -162,7 +163,7 @@ async def list_profiles( r"""Lists profiles by filter. The order is unspecified. Args: - request (:class:`~.profile_service.ListProfilesRequest`): + request (:class:`google.cloud.talent_v4beta1.types.ListProfilesRequest`): The request object. List profiles request. parent (:class:`str`): Required. The resource name of the tenant under which @@ -171,6 +172,7 @@ async def list_profiles( 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. @@ -182,7 +184,7 @@ async def list_profiles( sent along with the request as metadata. Returns: - ~.pagers.ListProfilesAsyncPager: + google.cloud.talent_v4beta1.services.profile_service.pagers.ListProfilesAsyncPager: The List profiles response object. Iterating over this object will yield results and resolve additional pages @@ -254,7 +256,7 @@ async def create_profile( r"""Creates and returns a new profile. Args: - request (:class:`~.profile_service.CreateProfileRequest`): + request (:class:`google.cloud.talent_v4beta1.types.CreateProfileRequest`): The request object. Create profile request. parent (:class:`str`): Required. The name of the tenant this profile belongs @@ -263,10 +265,11 @@ async def create_profile( 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`): + profile (:class:`google.cloud.talent_v4beta1.types.Profile`): Required. The profile to be created. This corresponds to the ``profile`` field on the ``request`` instance; if ``request`` is provided, this @@ -279,7 +282,7 @@ async def create_profile( sent along with the request as metadata. Returns: - ~.gct_profile.Profile: + google.cloud.talent_v4beta1.types.Profile: A resource that represents the profile for a job candidate (also referred to as a "single-source @@ -338,7 +341,7 @@ async def get_profile( r"""Gets the specified profile. Args: - request (:class:`~.profile_service.GetProfileRequest`): + request (:class:`google.cloud.talent_v4beta1.types.GetProfileRequest`): The request object. Get profile request. name (:class:`str`): Required. Resource name of the profile to get. @@ -346,6 +349,7 @@ async def get_profile( 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. @@ -357,7 +361,7 @@ async def get_profile( sent along with the request as metadata. Returns: - ~.profile.Profile: + google.cloud.talent_v4beta1.types.Profile: A resource that represents the profile for a job candidate (also referred to as a "single-source @@ -423,9 +427,9 @@ async def update_profile( result. Args: - request (:class:`~.profile_service.UpdateProfileRequest`): + request (:class:`google.cloud.talent_v4beta1.types.UpdateProfileRequest`): The request object. Update profile request - profile (:class:`~.gct_profile.Profile`): + profile (:class:`google.cloud.talent_v4beta1.types.Profile`): Required. Profile to be updated. This corresponds to the ``profile`` field on the ``request`` instance; if ``request`` is provided, this @@ -438,7 +442,7 @@ async def update_profile( sent along with the request as metadata. Returns: - ~.gct_profile.Profile: + google.cloud.talent_v4beta1.types.Profile: A resource that represents the profile for a job candidate (also referred to as a "single-source @@ -499,7 +503,7 @@ async def delete_profile( or assignments associated. Args: - request (:class:`~.profile_service.DeleteProfileRequest`): + request (:class:`google.cloud.talent_v4beta1.types.DeleteProfileRequest`): The request object. Delete profile request. name (:class:`str`): Required. Resource name of the profile to be deleted. @@ -507,6 +511,7 @@ async def delete_profile( 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. @@ -581,7 +586,7 @@ async def search_profiles( for more information. Args: - request (:class:`~.profile_service.SearchProfilesRequest`): + request (:class:`google.cloud.talent_v4beta1.types.SearchProfilesRequest`): The request object. The request body of the `SearchProfiles` call. @@ -592,7 +597,7 @@ async def search_profiles( sent along with the request as metadata. Returns: - ~.pagers.SearchProfilesAsyncPager: + google.cloud.talent_v4beta1.services.profile_service.pagers.SearchProfilesAsyncPager: Response of SearchProfiles method. Iterating over this object will yield results and resolve additional pages diff --git a/google/cloud/talent_v4beta1/services/profile_service/client.py b/google/cloud/talent_v4beta1/services/profile_service/client.py index 4cef4bba..6347da06 100644 --- a/google/cloud/talent_v4beta1/services/profile_service/client.py +++ b/google/cloud/talent_v4beta1/services/profile_service/client.py @@ -118,6 +118,22 @@ def _get_default_mtls_endpoint(api_endpoint): DEFAULT_ENDPOINT ) + @classmethod + def from_service_account_info(cls, info: dict, *args, **kwargs): + """Creates an instance of this client using the provided credentials info. + + Args: + info (dict): The service account private key info. + args: Additional arguments to pass to the constructor. + kwargs: Additional arguments to pass to the constructor. + + Returns: + ProfileServiceClient: The constructed client. + """ + credentials = service_account.Credentials.from_service_account_info(info) + kwargs["credentials"] = credentials + return cls(*args, **kwargs) + @classmethod def from_service_account_file(cls, filename: str, *args, **kwargs): """Creates an instance of this client using the provided credentials @@ -130,7 +146,7 @@ def from_service_account_file(cls, filename: str, *args, **kwargs): kwargs: Additional arguments to pass to the constructor. Returns: - {@api.name}: The constructed client. + ProfileServiceClient: The constructed client. """ credentials = service_account.Credentials.from_service_account_file(filename) kwargs["credentials"] = credentials @@ -251,10 +267,10 @@ def __init__( 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 (Union[str, ProfileServiceTransport]): The transport to use. If set to None, a transport is chosen automatically. - client_options (client_options_lib.ClientOptions): Custom options for the + client_options (google.api_core.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_ENDPOINT @@ -364,15 +380,16 @@ def list_profiles( r"""Lists profiles by filter. The order is unspecified. Args: - request (:class:`~.profile_service.ListProfilesRequest`): + request (google.cloud.talent_v4beta1.types.ListProfilesRequest): The request object. List profiles request. - parent (:class:`str`): + 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". + This corresponds to the ``parent`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -384,7 +401,7 @@ def list_profiles( sent along with the request as metadata. Returns: - ~.pagers.ListProfilesPager: + google.cloud.talent_v4beta1.services.profile_service.pagers.ListProfilesPager: The List profiles response object. Iterating over this object will yield results and resolve additional pages @@ -449,19 +466,20 @@ def create_profile( r"""Creates and returns a new profile. Args: - request (:class:`~.profile_service.CreateProfileRequest`): + request (google.cloud.talent_v4beta1.types.CreateProfileRequest): The request object. Create profile request. - parent (:class:`str`): + 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". + This corresponds to the ``parent`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - profile (:class:`~.gct_profile.Profile`): + profile (google.cloud.talent_v4beta1.types.Profile): Required. The profile to be created. This corresponds to the ``profile`` field on the ``request`` instance; if ``request`` is provided, this @@ -474,7 +492,7 @@ def create_profile( sent along with the request as metadata. Returns: - ~.gct_profile.Profile: + google.cloud.talent_v4beta1.types.Profile: A resource that represents the profile for a job candidate (also referred to as a "single-source @@ -534,14 +552,15 @@ def get_profile( r"""Gets the specified profile. Args: - request (:class:`~.profile_service.GetProfileRequest`): + request (google.cloud.talent_v4beta1.types.GetProfileRequest): The request object. Get profile request. - name (:class:`str`): + 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". + This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -553,7 +572,7 @@ def get_profile( sent along with the request as metadata. Returns: - ~.profile.Profile: + google.cloud.talent_v4beta1.types.Profile: A resource that represents the profile for a job candidate (also referred to as a "single-source @@ -612,9 +631,9 @@ def update_profile( result. Args: - request (:class:`~.profile_service.UpdateProfileRequest`): + request (google.cloud.talent_v4beta1.types.UpdateProfileRequest): The request object. Update profile request - profile (:class:`~.gct_profile.Profile`): + profile (google.cloud.talent_v4beta1.types.Profile): Required. Profile to be updated. This corresponds to the ``profile`` field on the ``request`` instance; if ``request`` is provided, this @@ -627,7 +646,7 @@ def update_profile( sent along with the request as metadata. Returns: - ~.gct_profile.Profile: + google.cloud.talent_v4beta1.types.Profile: A resource that represents the profile for a job candidate (also referred to as a "single-source @@ -689,14 +708,15 @@ def delete_profile( or assignments associated. Args: - request (:class:`~.profile_service.DeleteProfileRequest`): + request (google.cloud.talent_v4beta1.types.DeleteProfileRequest): The request object. Delete profile request. - name (:class:`str`): + 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". + This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -764,7 +784,7 @@ def search_profiles( for more information. Args: - request (:class:`~.profile_service.SearchProfilesRequest`): + request (google.cloud.talent_v4beta1.types.SearchProfilesRequest): The request object. The request body of the `SearchProfiles` call. @@ -775,7 +795,7 @@ def search_profiles( sent along with the request as metadata. Returns: - ~.pagers.SearchProfilesPager: + google.cloud.talent_v4beta1.services.profile_service.pagers.SearchProfilesPager: Response of SearchProfiles method. Iterating over this object will yield results and resolve additional pages diff --git a/google/cloud/talent_v4beta1/services/profile_service/pagers.py b/google/cloud/talent_v4beta1/services/profile_service/pagers.py index c2f71326..29de6067 100644 --- a/google/cloud/talent_v4beta1/services/profile_service/pagers.py +++ b/google/cloud/talent_v4beta1/services/profile_service/pagers.py @@ -26,7 +26,7 @@ class ListProfilesPager: """A pager for iterating through ``list_profiles`` requests. This class thinly wraps an initial - :class:`~.profile_service.ListProfilesResponse` object, and + :class:`google.cloud.talent_v4beta1.types.ListProfilesResponse` object, and provides an ``__iter__`` method to iterate through its ``profiles`` field. @@ -35,7 +35,7 @@ class ListProfilesPager: through the ``profiles`` field on the corresponding responses. - All the usual :class:`~.profile_service.ListProfilesResponse` + All the usual :class:`google.cloud.talent_v4beta1.types.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. """ @@ -53,9 +53,9 @@ def __init__( Args: method (Callable): The method that was originally called, and which instantiated this pager. - request (:class:`~.profile_service.ListProfilesRequest`): + request (google.cloud.talent_v4beta1.types.ListProfilesRequest): The initial request object. - response (:class:`~.profile_service.ListProfilesResponse`): + response (google.cloud.talent_v4beta1.types.ListProfilesResponse): The initial response object. metadata (Sequence[Tuple[str, str]]): Strings which should be sent along with the request as metadata. @@ -88,7 +88,7 @@ class ListProfilesAsyncPager: """A pager for iterating through ``list_profiles`` requests. This class thinly wraps an initial - :class:`~.profile_service.ListProfilesResponse` object, and + :class:`google.cloud.talent_v4beta1.types.ListProfilesResponse` object, and provides an ``__aiter__`` method to iterate through its ``profiles`` field. @@ -97,7 +97,7 @@ class ListProfilesAsyncPager: through the ``profiles`` field on the corresponding responses. - All the usual :class:`~.profile_service.ListProfilesResponse` + All the usual :class:`google.cloud.talent_v4beta1.types.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. """ @@ -115,9 +115,9 @@ def __init__( Args: method (Callable): The method that was originally called, and which instantiated this pager. - request (:class:`~.profile_service.ListProfilesRequest`): + request (google.cloud.talent_v4beta1.types.ListProfilesRequest): The initial request object. - response (:class:`~.profile_service.ListProfilesResponse`): + response (google.cloud.talent_v4beta1.types.ListProfilesResponse): The initial response object. metadata (Sequence[Tuple[str, str]]): Strings which should be sent along with the request as metadata. @@ -154,7 +154,7 @@ class SearchProfilesPager: """A pager for iterating through ``search_profiles`` requests. This class thinly wraps an initial - :class:`~.profile_service.SearchProfilesResponse` object, and + :class:`google.cloud.talent_v4beta1.types.SearchProfilesResponse` object, and provides an ``__iter__`` method to iterate through its ``histogram_query_results`` field. @@ -163,7 +163,7 @@ class SearchProfilesPager: through the ``histogram_query_results`` field on the corresponding responses. - All the usual :class:`~.profile_service.SearchProfilesResponse` + All the usual :class:`google.cloud.talent_v4beta1.types.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. """ @@ -181,9 +181,9 @@ def __init__( Args: method (Callable): The method that was originally called, and which instantiated this pager. - request (:class:`~.profile_service.SearchProfilesRequest`): + request (google.cloud.talent_v4beta1.types.SearchProfilesRequest): The initial request object. - response (:class:`~.profile_service.SearchProfilesResponse`): + response (google.cloud.talent_v4beta1.types.SearchProfilesResponse): The initial response object. metadata (Sequence[Tuple[str, str]]): Strings which should be sent along with the request as metadata. @@ -216,7 +216,7 @@ class SearchProfilesAsyncPager: """A pager for iterating through ``search_profiles`` requests. This class thinly wraps an initial - :class:`~.profile_service.SearchProfilesResponse` object, and + :class:`google.cloud.talent_v4beta1.types.SearchProfilesResponse` object, and provides an ``__aiter__`` method to iterate through its ``histogram_query_results`` field. @@ -225,7 +225,7 @@ class SearchProfilesAsyncPager: through the ``histogram_query_results`` field on the corresponding responses. - All the usual :class:`~.profile_service.SearchProfilesResponse` + All the usual :class:`google.cloud.talent_v4beta1.types.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. """ @@ -243,9 +243,9 @@ def __init__( Args: method (Callable): The method that was originally called, and which instantiated this pager. - request (:class:`~.profile_service.SearchProfilesRequest`): + request (google.cloud.talent_v4beta1.types.SearchProfilesRequest): The initial request object. - response (:class:`~.profile_service.SearchProfilesResponse`): + response (google.cloud.talent_v4beta1.types.SearchProfilesResponse): The initial response object. metadata (Sequence[Tuple[str, str]]): Strings which should be sent along with the request as metadata. diff --git a/google/cloud/talent_v4beta1/services/tenant_service/async_client.py b/google/cloud/talent_v4beta1/services/tenant_service/async_client.py index be6fce85..450811a6 100644 --- a/google/cloud/talent_v4beta1/services/tenant_service/async_client.py +++ b/google/cloud/talent_v4beta1/services/tenant_service/async_client.py @@ -80,6 +80,7 @@ class TenantServiceAsyncClient: TenantServiceClient.parse_common_location_path ) + from_service_account_info = TenantServiceClient.from_service_account_info from_service_account_file = TenantServiceClient.from_service_account_file from_service_account_json = from_service_account_file @@ -157,7 +158,7 @@ async def create_tenant( r"""Creates a new tenant entity. Args: - request (:class:`~.tenant_service.CreateTenantRequest`): + request (:class:`google.cloud.talent_v4beta1.types.CreateTenantRequest`): The request object. The Request of the CreateTenant method. parent (:class:`str`): @@ -166,10 +167,11 @@ async def create_tenant( 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`): + tenant (:class:`google.cloud.talent_v4beta1.types.Tenant`): Required. The tenant to be created. This corresponds to the ``tenant`` field on the ``request`` instance; if ``request`` is provided, this @@ -182,7 +184,7 @@ async def create_tenant( sent along with the request as metadata. Returns: - ~.gct_tenant.Tenant: + google.cloud.talent_v4beta1.types.Tenant: A Tenant resource represents a tenant in the service. A tenant is a group or entity that shares common access with @@ -244,7 +246,7 @@ async def get_tenant( r"""Retrieves specified tenant. Args: - request (:class:`~.tenant_service.GetTenantRequest`): + request (:class:`google.cloud.talent_v4beta1.types.GetTenantRequest`): The request object. Request for getting a tenant by name. name (:class:`str`): @@ -254,6 +256,7 @@ async def get_tenant( 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. @@ -265,7 +268,7 @@ async def get_tenant( sent along with the request as metadata. Returns: - ~.tenant.Tenant: + google.cloud.talent_v4beta1.types.Tenant: A Tenant resource represents a tenant in the service. A tenant is a group or entity that shares common access with @@ -333,13 +336,14 @@ async def update_tenant( r"""Updates specified tenant. Args: - request (:class:`~.tenant_service.UpdateTenantRequest`): + request (:class:`google.cloud.talent_v4beta1.types.UpdateTenantRequest`): The request object. Request for updating a specified tenant. - tenant (:class:`~.gct_tenant.Tenant`): + tenant (:class:`google.cloud.talent_v4beta1.types.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. @@ -351,7 +355,7 @@ async def update_tenant( sent along with the request as metadata. Returns: - ~.gct_tenant.Tenant: + google.cloud.talent_v4beta1.types.Tenant: A Tenant resource represents a tenant in the service. A tenant is a group or entity that shares common access with @@ -413,7 +417,7 @@ async def delete_tenant( r"""Deletes specified tenant. Args: - request (:class:`~.tenant_service.DeleteTenantRequest`): + request (:class:`google.cloud.talent_v4beta1.types.DeleteTenantRequest`): The request object. Request to delete a tenant. name (:class:`str`): Required. The resource name of the tenant to be deleted. @@ -421,6 +425,7 @@ async def delete_tenant( 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. @@ -488,7 +493,7 @@ async def list_tenants( r"""Lists all tenants associated with the project. Args: - request (:class:`~.tenant_service.ListTenantsRequest`): + request (:class:`google.cloud.talent_v4beta1.types.ListTenantsRequest`): The request object. List tenants for which the client has ACL visibility. parent (:class:`str`): @@ -497,6 +502,7 @@ async def list_tenants( 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. @@ -508,7 +514,7 @@ async def list_tenants( sent along with the request as metadata. Returns: - ~.pagers.ListTenantsAsyncPager: + google.cloud.talent_v4beta1.services.tenant_service.pagers.ListTenantsAsyncPager: The List tenants response object. Iterating over this object will yield results and resolve additional pages diff --git a/google/cloud/talent_v4beta1/services/tenant_service/client.py b/google/cloud/talent_v4beta1/services/tenant_service/client.py index 52898cda..88c5a746 100644 --- a/google/cloud/talent_v4beta1/services/tenant_service/client.py +++ b/google/cloud/talent_v4beta1/services/tenant_service/client.py @@ -112,6 +112,22 @@ def _get_default_mtls_endpoint(api_endpoint): DEFAULT_ENDPOINT ) + @classmethod + def from_service_account_info(cls, info: dict, *args, **kwargs): + """Creates an instance of this client using the provided credentials info. + + Args: + info (dict): The service account private key info. + args: Additional arguments to pass to the constructor. + kwargs: Additional arguments to pass to the constructor. + + Returns: + TenantServiceClient: The constructed client. + """ + credentials = service_account.Credentials.from_service_account_info(info) + kwargs["credentials"] = credentials + return cls(*args, **kwargs) + @classmethod def from_service_account_file(cls, filename: str, *args, **kwargs): """Creates an instance of this client using the provided credentials @@ -124,7 +140,7 @@ def from_service_account_file(cls, filename: str, *args, **kwargs): kwargs: Additional arguments to pass to the constructor. Returns: - {@api.name}: The constructed client. + TenantServiceClient: The constructed client. """ credentials = service_account.Credentials.from_service_account_file(filename) kwargs["credentials"] = credentials @@ -229,10 +245,10 @@ def __init__( 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 (Union[str, TenantServiceTransport]): The transport to use. If set to None, a transport is chosen automatically. - client_options (client_options_lib.ClientOptions): Custom options for the + client_options (google.api_core.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_ENDPOINT @@ -343,19 +359,20 @@ def create_tenant( r"""Creates a new tenant entity. Args: - request (:class:`~.tenant_service.CreateTenantRequest`): + request (google.cloud.talent_v4beta1.types.CreateTenantRequest): The request object. The Request of the CreateTenant method. - parent (:class:`str`): + parent (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`): + tenant (google.cloud.talent_v4beta1.types.Tenant): Required. The tenant to be created. This corresponds to the ``tenant`` field on the ``request`` instance; if ``request`` is provided, this @@ -368,7 +385,7 @@ def create_tenant( sent along with the request as metadata. Returns: - ~.gct_tenant.Tenant: + google.cloud.talent_v4beta1.types.Tenant: A Tenant resource represents a tenant in the service. A tenant is a group or entity that shares common access with @@ -431,16 +448,17 @@ def get_tenant( r"""Retrieves specified tenant. Args: - request (:class:`~.tenant_service.GetTenantRequest`): + request (google.cloud.talent_v4beta1.types.GetTenantRequest): The request object. Request for getting a tenant by name. - name (:class:`str`): + 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". + This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -452,7 +470,7 @@ def get_tenant( sent along with the request as metadata. Returns: - ~.tenant.Tenant: + google.cloud.talent_v4beta1.types.Tenant: A Tenant resource represents a tenant in the service. A tenant is a group or entity that shares common access with @@ -513,13 +531,14 @@ def update_tenant( r"""Updates specified tenant. Args: - request (:class:`~.tenant_service.UpdateTenantRequest`): + request (google.cloud.talent_v4beta1.types.UpdateTenantRequest): The request object. Request for updating a specified tenant. - tenant (:class:`~.gct_tenant.Tenant`): + tenant (google.cloud.talent_v4beta1.types.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. @@ -531,7 +550,7 @@ def update_tenant( sent along with the request as metadata. Returns: - ~.gct_tenant.Tenant: + google.cloud.talent_v4beta1.types.Tenant: A Tenant resource represents a tenant in the service. A tenant is a group or entity that shares common access with @@ -594,14 +613,15 @@ def delete_tenant( r"""Deletes specified tenant. Args: - request (:class:`~.tenant_service.DeleteTenantRequest`): + request (google.cloud.talent_v4beta1.types.DeleteTenantRequest): The request object. Request to delete a tenant. - name (:class:`str`): + 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". + This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -662,15 +682,16 @@ def list_tenants( r"""Lists all tenants associated with the project. Args: - request (:class:`~.tenant_service.ListTenantsRequest`): + request (google.cloud.talent_v4beta1.types.ListTenantsRequest): The request object. List tenants for which the client has ACL visibility. - parent (:class:`str`): + parent (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. @@ -682,7 +703,7 @@ def list_tenants( sent along with the request as metadata. Returns: - ~.pagers.ListTenantsPager: + google.cloud.talent_v4beta1.services.tenant_service.pagers.ListTenantsPager: The List tenants response object. Iterating over this object will yield results and resolve additional pages diff --git a/google/cloud/talent_v4beta1/services/tenant_service/pagers.py b/google/cloud/talent_v4beta1/services/tenant_service/pagers.py index 99dfee65..5adc6788 100644 --- a/google/cloud/talent_v4beta1/services/tenant_service/pagers.py +++ b/google/cloud/talent_v4beta1/services/tenant_service/pagers.py @@ -25,7 +25,7 @@ class ListTenantsPager: """A pager for iterating through ``list_tenants`` requests. This class thinly wraps an initial - :class:`~.tenant_service.ListTenantsResponse` object, and + :class:`google.cloud.talent_v4beta1.types.ListTenantsResponse` object, and provides an ``__iter__`` method to iterate through its ``tenants`` field. @@ -34,7 +34,7 @@ class ListTenantsPager: through the ``tenants`` field on the corresponding responses. - All the usual :class:`~.tenant_service.ListTenantsResponse` + All the usual :class:`google.cloud.talent_v4beta1.types.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. """ @@ -52,9 +52,9 @@ def __init__( Args: method (Callable): The method that was originally called, and which instantiated this pager. - request (:class:`~.tenant_service.ListTenantsRequest`): + request (google.cloud.talent_v4beta1.types.ListTenantsRequest): The initial request object. - response (:class:`~.tenant_service.ListTenantsResponse`): + response (google.cloud.talent_v4beta1.types.ListTenantsResponse): The initial response object. metadata (Sequence[Tuple[str, str]]): Strings which should be sent along with the request as metadata. @@ -87,7 +87,7 @@ class ListTenantsAsyncPager: """A pager for iterating through ``list_tenants`` requests. This class thinly wraps an initial - :class:`~.tenant_service.ListTenantsResponse` object, and + :class:`google.cloud.talent_v4beta1.types.ListTenantsResponse` object, and provides an ``__aiter__`` method to iterate through its ``tenants`` field. @@ -96,7 +96,7 @@ class ListTenantsAsyncPager: through the ``tenants`` field on the corresponding responses. - All the usual :class:`~.tenant_service.ListTenantsResponse` + All the usual :class:`google.cloud.talent_v4beta1.types.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. """ @@ -114,9 +114,9 @@ def __init__( Args: method (Callable): The method that was originally called, and which instantiated this pager. - request (:class:`~.tenant_service.ListTenantsRequest`): + request (google.cloud.talent_v4beta1.types.ListTenantsRequest): The initial request object. - response (:class:`~.tenant_service.ListTenantsResponse`): + response (google.cloud.talent_v4beta1.types.ListTenantsResponse): The initial response object. metadata (Sequence[Tuple[str, str]]): Strings which should be sent along with the request as metadata. diff --git a/google/cloud/talent_v4beta1/types/application.py b/google/cloud/talent_v4beta1/types/application.py index c407b4bc..41eda976 100644 --- a/google/cloud/talent_v4beta1/types/application.py +++ b/google/cloud/talent_v4beta1/types/application.py @@ -69,9 +69,9 @@ class Application(proto.Message): The format is "projects/{project_id}/tenants/{tenant_id}/companies/{company_id}". For example, "projects/foo/tenants/bar/companies/baz". - application_date (~.date.Date): + application_date (google.type.date_pb2.Date): The application date. - stage (~.application.Application.ApplicationStage): + stage (google.cloud.talent_v4beta1.types.Application.ApplicationStage): Required. What is the most recent stage of the application (that is, new, screen, send cv, hired, finished work)? This field is @@ -79,19 +79,19 @@ class Application(proto.Message): possible status, but instead, represents statuses that would be used to indicate to the ML models good / bad matches. - state (~.application.Application.ApplicationState): + state (google.cloud.talent_v4beta1.types.Application.ApplicationState): The application state. - interviews (Sequence[~.common.Interview]): + interviews (Sequence[google.cloud.talent_v4beta1.types.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): + referral (google.protobuf.wrappers_pb2.BoolValue): If the candidate is referred by a employee. - create_time (~.timestamp.Timestamp): + create_time (google.protobuf.timestamp_pb2.Timestamp): Required. Reflects the time that the application was created. - update_time (~.timestamp.Timestamp): + update_time (google.protobuf.timestamp_pb2.Timestamp): The last update timestamp. outcome_notes (str): Free text reason behind the recruitement @@ -99,10 +99,10 @@ class Application(proto.Message): reject, reason for an unsuccessful finish, and so on). Number of characters allowed is 100. - outcome (~.common.Outcome): + outcome (google.cloud.talent_v4beta1.types.Outcome): Outcome positiveness shows how positive the outcome is. - is_match (~.wrappers.BoolValue): + is_match (google.protobuf.wrappers_pb2.BoolValue): Output only. Indicates whether this job application is a match to application related filters. This value is only applicable in diff --git a/google/cloud/talent_v4beta1/types/application_service.py b/google/cloud/talent_v4beta1/types/application_service.py index 8c906e91..81a0bae8 100644 --- a/google/cloud/talent_v4beta1/types/application_service.py +++ b/google/cloud/talent_v4beta1/types/application_service.py @@ -47,7 +47,7 @@ class CreateApplicationRequest(proto.Message): The format is "projects/{project_id}/tenants/{tenant_id}/profiles/{profile_id}". For example, "projects/foo/tenants/bar/profiles/baz". - application (~.gct_application.Application): + application (google.cloud.talent_v4beta1.types.Application): Required. The application to be created. """ @@ -79,10 +79,10 @@ class UpdateApplicationRequest(proto.Message): r"""Request for updating a specified application. Attributes: - application (~.gct_application.Application): + application (google.cloud.talent_v4beta1.types.Application): Required. The application resource to replace the current resource in the system. - update_mask (~.field_mask.FieldMask): + update_mask (google.protobuf.field_mask_pb2.FieldMask): Strongly recommended for the best service experience. If @@ -152,11 +152,11 @@ class ListApplicationsResponse(proto.Message): r"""The List applications response object. Attributes: - applications (Sequence[~.gct_application.Application]): + applications (Sequence[google.cloud.talent_v4beta1.types.Application]): Applications for the current client. next_page_token (str): A token to retrieve the next page of results. - metadata (~.common.ResponseMetadata): + metadata (google.cloud.talent_v4beta1.types.ResponseMetadata): Additional information for the API invocation, such as the request tracking id. """ diff --git a/google/cloud/talent_v4beta1/types/common.py b/google/cloud/talent_v4beta1/types/common.py index 61614a0a..c1cdd9b5 100644 --- a/google/cloud/talent_v4beta1/types/common.py +++ b/google/cloud/talent_v4beta1/types/common.py @@ -254,9 +254,9 @@ class TimestampRange(proto.Message): r"""Message representing a period of time between two timestamps. Attributes: - start_time (~.timestamp.Timestamp): + start_time (google.protobuf.timestamp_pb2.Timestamp): Begin of the period (inclusive). - end_time (~.timestamp.Timestamp): + end_time (google.protobuf.timestamp_pb2.Timestamp): End of the period (exclusive). """ @@ -270,7 +270,7 @@ class Location(proto.Message): information. Attributes: - location_type (~.common.Location.LocationType): + location_type (google.cloud.talent_v4beta1.types.Location.LocationType): The type of a location, which corresponds to the address lines field of [google.type.PostalAddress][google.type.PostalAddress]. For @@ -278,13 +278,13 @@ class Location(proto.Message): [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 (google.type.postal_address_pb2.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): + lat_lng (google.type.latlng_pb2.LatLng): An object representing a latitude/longitude pair. radius_miles (float): @@ -390,7 +390,7 @@ class RequestMetadata(proto.Message): and [user_id][google.cloud.talent.v4beta1.RequestMetadata.user_id] for the best service experience. - device_info (~.common.DeviceInfo): + device_info (google.cloud.talent_v4beta1.types.DeviceInfo): The type of device used by the job seeker at the time of the call to the service. """ @@ -426,7 +426,7 @@ class DeviceInfo(proto.Message): devices. Attributes: - device_type (~.common.DeviceInfo.DeviceType): + device_type (google.cloud.talent_v4beta1.types.DeviceInfo.DeviceType): Type of the device. id (str): A device-specific ID. The ID must be a unique @@ -532,14 +532,14 @@ class CompensationInfo(proto.Message): r"""Job compensation details. Attributes: - entries (Sequence[~.common.CompensationInfo.CompensationEntry]): + entries (Sequence[google.cloud.talent_v4beta1.types.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): + annualized_base_compensation_range (google.cloud.talent_v4beta1.types.CompensationInfo.CompensationRange): Output only. Annualized base compensation range. Computed as base compensation entry's [CompensationEntry.amount][google.cloud.talent.v4beta1.CompensationInfo.CompensationEntry.amount] @@ -549,7 +549,7 @@ class CompensationInfo(proto.Message): See [CompensationEntry][google.cloud.talent.v4beta1.CompensationInfo.CompensationEntry] for explanation on compensation annualization. - annualized_total_compensation_range (~.common.CompensationInfo.CompensationRange): + annualized_total_compensation_range (google.cloud.talent_v4beta1.types.CompensationInfo.CompensationRange): Output only. Annualized total compensation range. Computed as all compensation entries' [CompensationEntry.amount][google.cloud.talent.v4beta1.CompensationInfo.CompensationEntry.amount] @@ -631,25 +631,25 @@ class CompensationEntry(proto.Message): [expected_units_per_year][google.cloud.talent.v4beta1.CompensationInfo.CompensationEntry.expected_units_per_year]. Attributes: - type_ (~.common.CompensationInfo.CompensationType): + type_ (google.cloud.talent_v4beta1.types.CompensationInfo.CompensationType): Compensation type. Default is [CompensationType.COMPENSATION_TYPE_UNSPECIFIED][google.cloud.talent.v4beta1.CompensationInfo.CompensationType.COMPENSATION_TYPE_UNSPECIFIED]. - unit (~.common.CompensationInfo.CompensationUnit): + unit (google.cloud.talent_v4beta1.types.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): + amount (google.type.money_pb2.Money): Compensation amount. - range_ (~.common.CompensationInfo.CompensationRange): + range_ (google.cloud.talent_v4beta1.types.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_units_per_year (google.protobuf.wrappers_pb2.DoubleValue): Expected number of units paid each year. If not specified, when [Job.employment_types][google.cloud.talent.v4beta1.Job.employment_types] @@ -693,12 +693,12 @@ class CompensationRange(proto.Message): r"""Compensation range. Attributes: - max_compensation (~.money.Money): + max_compensation (google.type.money_pb2.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): + min_compensation (google.type.money_pb2.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 @@ -727,10 +727,10 @@ class Certification(proto.Message): display_name (str): Name of license or certification. Number of characters allowed is 100. - acquire_date (~.date.Date): + acquire_date (google.type.date_pb2.Date): Acquisition date or effective date of license or certification. - expire_date (~.date.Date): + expire_date (google.type.date_pb2.Date): Expiration date of license of certification. authority (str): Authority of license, such as government. @@ -760,9 +760,9 @@ class Skill(proto.Message): For example, "Java", "Python". Number of characters allowed is 100. - last_used_date (~.date.Date): + last_used_date (google.type.date_pb2.Date): The last time this skill was used. - level (~.common.SkillProficiencyLevel): + level (google.cloud.talent_v4beta1.types.SkillProficiencyLevel): Skill proficiency level which indicates how proficient the candidate is at this skill. context (str): @@ -791,9 +791,9 @@ class Interview(proto.Message): r"""Details of an interview. Attributes: - rating (~.common.Rating): + rating (google.cloud.talent_v4beta1.types.Rating): The rating on this interview. - outcome (~.common.Outcome): + outcome (google.cloud.talent_v4beta1.types.Outcome): Required. The overall decision resulting from this interview (positive, negative, nuetral). """ @@ -835,7 +835,7 @@ class BatchOperationMetadata(proto.Message): [google.longrunning.Operation.metadata][google.longrunning.Operation.metadata]. Attributes: - state (~.common.BatchOperationMetadata.State): + state (google.cloud.talent_v4beta1.types.BatchOperationMetadata.State): The state of a long running operation. state_description (str): More detailed information about operation @@ -847,14 +847,14 @@ class BatchOperationMetadata(proto.Message): Count of failed item(s) inside an operation. total_count (int): Count of total item(s) inside an operation. - create_time (~.timestamp.Timestamp): + create_time (google.protobuf.timestamp_pb2.Timestamp): The time when the batch operation is created. - update_time (~.timestamp.Timestamp): + update_time (google.protobuf.timestamp_pb2.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): + end_time (google.protobuf.timestamp_pb2.Timestamp): The time when the batch operation is finished and [google.longrunning.Operation.done][google.longrunning.Operation.done] is set to ``true``. diff --git a/google/cloud/talent_v4beta1/types/company.py b/google/cloud/talent_v4beta1/types/company.py index ac333e29..ed091608 100644 --- a/google/cloud/talent_v4beta1/types/company.py +++ b/google/cloud/talent_v4beta1/types/company.py @@ -53,7 +53,7 @@ class Company(proto.Message): used to uniquely identify the company. The maximum number of allowed characters is 255. - size (~.common.CompanySize): + size (google.cloud.talent_v4beta1.types.CompanySize): The employer's company size. headquarters_address (str): The street address of the company's main headquarters, which @@ -92,7 +92,7 @@ class Company(proto.Message): 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): + derived_info (google.cloud.talent_v4beta1.types.Company.DerivedInfo): Output only. Derived details about the company. suspended (bool): @@ -106,7 +106,7 @@ class DerivedInfo(proto.Message): r"""Derived details about the company. Attributes: - headquarters_location (~.common.Location): + headquarters_location (google.cloud.talent_v4beta1.types.Location): A structured headquarters location of the company, resolved from [Company.headquarters_address][google.cloud.talent.v4beta1.Company.headquarters_address] diff --git a/google/cloud/talent_v4beta1/types/company_service.py b/google/cloud/talent_v4beta1/types/company_service.py index 960ab39c..ab1de2b8 100644 --- a/google/cloud/talent_v4beta1/types/company_service.py +++ b/google/cloud/talent_v4beta1/types/company_service.py @@ -48,7 +48,7 @@ class CreateCompanyRequest(proto.Message): for example, "projects/foo/tenant/bar". If tenant id is unspecified, a default tenant is created, for example, "projects/foo". - company (~.gct_company.Company): + company (google.cloud.talent_v4beta1.types.Company): Required. The company to be created. """ @@ -80,10 +80,10 @@ class UpdateCompanyRequest(proto.Message): r"""Request for updating a specified company. Attributes: - company (~.gct_company.Company): + company (google.cloud.talent_v4beta1.types.Company): Required. The company resource to replace the current resource in the system. - update_mask (~.field_mask.FieldMask): + update_mask (google.protobuf.field_mask_pb2.FieldMask): Strongly recommended for the best service experience. If @@ -165,11 +165,11 @@ class ListCompaniesResponse(proto.Message): r"""The List companies response object. Attributes: - companies (Sequence[~.gct_company.Company]): + companies (Sequence[google.cloud.talent_v4beta1.types.Company]): Companies for the current client. next_page_token (str): A token to retrieve the next page of results. - metadata (~.common.ResponseMetadata): + metadata (google.cloud.talent_v4beta1.types.ResponseMetadata): Additional information for the API invocation, such as the request tracking id. """ diff --git a/google/cloud/talent_v4beta1/types/completion_service.py b/google/cloud/talent_v4beta1/types/completion_service.py index 69f4882a..1b53f07e 100644 --- a/google/cloud/talent_v4beta1/types/completion_service.py +++ b/google/cloud/talent_v4beta1/types/completion_service.py @@ -63,10 +63,10 @@ class CompleteQueryRequest(proto.Message): If tenant id is unspecified, the default tenant is used, for example, "projects/foo". - scope (~.completion_service.CompleteQueryRequest.CompletionScope): + scope (google.cloud.talent_v4beta1.types.CompleteQueryRequest.CompletionScope): The scope of the completion. The defaults is [CompletionScope.PUBLIC][google.cloud.talent.v4beta1.CompleteQueryRequest.CompletionScope.PUBLIC]. - type_ (~.completion_service.CompleteQueryRequest.CompletionType): + type_ (google.cloud.talent_v4beta1.types.CompleteQueryRequest.CompletionType): The completion topic. The default is [CompletionType.COMBINED][google.cloud.talent.v4beta1.CompleteQueryRequest.CompletionType.COMBINED]. """ @@ -103,10 +103,10 @@ class CompleteQueryResponse(proto.Message): r"""Response of auto-complete query. Attributes: - completion_results (Sequence[~.completion_service.CompleteQueryResponse.CompletionResult]): + completion_results (Sequence[google.cloud.talent_v4beta1.types.CompleteQueryResponse.CompletionResult]): Results of the matching job/company candidates. - metadata (~.common.ResponseMetadata): + metadata (google.cloud.talent_v4beta1.types.ResponseMetadata): Additional information for the API invocation, such as the request tracking id. """ @@ -117,7 +117,7 @@ class CompletionResult(proto.Message): Attributes: suggestion (str): The suggestion for the query. - type_ (~.completion_service.CompleteQueryRequest.CompletionType): + type_ (google.cloud.talent_v4beta1.types.CompleteQueryRequest.CompletionType): The completion topic. image_uri (str): The URI of the company image for diff --git a/google/cloud/talent_v4beta1/types/event.py b/google/cloud/talent_v4beta1/types/event.py index 4583b654..70cec508 100644 --- a/google/cloud/talent_v4beta1/types/event.py +++ b/google/cloud/talent_v4beta1/types/event.py @@ -45,13 +45,13 @@ class ClientEvent(proto.Message): event_id (str): Required. A unique identifier, generated by the client application. - create_time (~.timestamp.Timestamp): + create_time (google.protobuf.timestamp_pb2.Timestamp): Required. The timestamp of the event. - job_event (~.event.JobEvent): + job_event (google.cloud.talent_v4beta1.types.JobEvent): An event issued when a job seeker interacts with the application that implements Cloud Talent Solution. - profile_event (~.event.ProfileEvent): + profile_event (google.cloud.talent_v4beta1.types.ProfileEvent): An event issued when a profile searcher interacts with the application that implements Cloud Talent Solution. @@ -81,7 +81,7 @@ class JobEvent(proto.Message): application that implements Cloud Talent Solution. Attributes: - type_ (~.event.JobEvent.JobEventType): + type_ (google.cloud.talent_v4beta1.types.JobEvent.JobEventType): Required. The type of the event (see [JobEventType][google.cloud.talent.v4beta1.JobEvent.JobEventType]). jobs (Sequence[str]): @@ -139,7 +139,7 @@ class ProfileEvent(proto.Message): application that implements Cloud Talent Solution. Attributes: - type_ (~.event.ProfileEvent.ProfileEventType): + type_ (google.cloud.talent_v4beta1.types.ProfileEvent.ProfileEventType): Required. Type of event. profiles (Sequence[str]): Required. The [profile diff --git a/google/cloud/talent_v4beta1/types/event_service.py b/google/cloud/talent_v4beta1/types/event_service.py index dad4a639..d389c18f 100644 --- a/google/cloud/talent_v4beta1/types/event_service.py +++ b/google/cloud/talent_v4beta1/types/event_service.py @@ -38,7 +38,7 @@ class CreateClientEventRequest(proto.Message): for example, "projects/foo/tenant/bar". If tenant id is unspecified, a default tenant is created, for example, "projects/foo". - client_event (~.event.ClientEvent): + client_event (google.cloud.talent_v4beta1.types.ClientEvent): Required. Events issued when end user interacts with customer's application that uses Cloud Talent Solution. diff --git a/google/cloud/talent_v4beta1/types/filters.py b/google/cloud/talent_v4beta1/types/filters.py index 48d631b4..70f87f90 100644 --- a/google/cloud/talent_v4beta1/types/filters.py +++ b/google/cloud/talent_v4beta1/types/filters.py @@ -90,7 +90,7 @@ class JobQuery(proto.Message): example, "projects/foo/companies/bar". At most 20 company filters are allowed. - location_filters (Sequence[~.filters.LocationFilter]): + location_filters (Sequence[google.cloud.talent_v4beta1.types.LocationFilter]): The location filter specifies geo-regions containing the jobs to search against. See [LocationFilter][google.cloud.talent.v4beta1.LocationFilter] @@ -108,7 +108,7 @@ class JobQuery(proto.Message): locations. At most 5 location filters are allowed. - job_categories (Sequence[~.common.JobCategory]): + job_categories (Sequence[google.cloud.talent_v4beta1.types.JobCategory]): The category filter specifies the categories of jobs to search against. See [JobCategory][google.cloud.talent.v4beta1.JobCategory] for @@ -119,7 +119,7 @@ class JobQuery(proto.Message): If multiple values are specified, jobs from any of the specified categories are searched against. - commute_filter (~.filters.CommuteFilter): + commute_filter (google.cloud.talent_v4beta1.types.CommuteFilter): Allows filtering jobs by commute time with different travel methods (for example, driving or public transit). @@ -143,7 +143,7 @@ class JobQuery(proto.Message): companies. At most 20 company display name filters are allowed. - compensation_filter (~.filters.CompensationFilter): + compensation_filter (google.cloud.talent_v4beta1.types.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 @@ -182,7 +182,7 @@ class JobQuery(proto.Message): misspelled query, for example, "enginee" is corrected to "engineer". Defaults to false: a spell check is performed. - employment_types (Sequence[~.common.EmploymentType]): + employment_types (Sequence[google.cloud.talent_v4beta1.types.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]. @@ -205,7 +205,7 @@ class JobQuery(proto.Message): Languages `__. At most 10 language code filters are allowed. - publish_time_range (~.common.TimestampRange): + publish_time_range (google.cloud.talent_v4beta1.types.TimestampRange): Jobs published within a range specified by this filter are searched against. excluded_jobs (Sequence[str]): @@ -259,7 +259,7 @@ class ProfileQuery(proto.Message): Keywords to match any text fields of profiles. For example, "software engineer in Palo Alto". - location_filters (Sequence[~.filters.LocationFilter]): + location_filters (Sequence[google.cloud.talent_v4beta1.types.LocationFilter]): The location filter specifies geo-regions containing the profiles to search against. @@ -379,7 +379,7 @@ class ProfileQuery(proto.Message): 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_filters (Sequence[google.cloud.talent_v4beta1.types.JobTitleFilter]): Job title filter specifies job titles of profiles to match on. @@ -396,7 +396,7 @@ class ProfileQuery(proto.Message): For example, search for profiles with a job title "Product Manager". - employer_filters (Sequence[~.filters.EmployerFilter]): + employer_filters (Sequence[google.cloud.talent_v4beta1.types.EmployerFilter]): Employer filter specifies employers of profiles to match on. If an employer filter isn't specified, profiles with any @@ -412,7 +412,7 @@ class ProfileQuery(proto.Message): For example, search for profiles that have working experience at "Google LLC". - education_filters (Sequence[~.filters.EducationFilter]): + education_filters (Sequence[google.cloud.talent_v4beta1.types.EducationFilter]): Education filter specifies education of profiles to match on. @@ -428,7 +428,7 @@ class ProfileQuery(proto.Message): the educations. For example, search for profiles with a master degree. - skill_filters (Sequence[~.filters.SkillFilter]): + skill_filters (Sequence[google.cloud.talent_v4beta1.types.SkillFilter]): Skill filter specifies skill of profiles to match on. If a skill filter isn't specified, profiles with any skills @@ -444,7 +444,7 @@ class ProfileQuery(proto.Message): For example, search for profiles that have "Java" and "Python" in skill list. - work_experience_filter (Sequence[~.filters.WorkExperienceFilter]): + work_experience_filter (Sequence[google.cloud.talent_v4beta1.types.WorkExperienceFilter]): Work experience filter specifies the total working experience of profiles to match on. @@ -458,23 +458,23 @@ class ProfileQuery(proto.Message): For example, search for profiles with 10 years of work experience. - time_filters (Sequence[~.filters.TimeFilter]): + time_filters (Sequence[google.cloud.talent_v4beta1.types.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): + hirable_filter (google.protobuf.wrappers_pb2.BoolValue): The hirable filter specifies the profile's hirable status to match on. - application_date_filters (Sequence[~.filters.ApplicationDateFilter]): + application_date_filters (Sequence[google.cloud.talent_v4beta1.types.ApplicationDateFilter]): The application date filters specify application date ranges to match on. - application_outcome_notes_filters (Sequence[~.filters.ApplicationOutcomeNotesFilter]): + application_outcome_notes_filters (Sequence[google.cloud.talent_v4beta1.types.ApplicationOutcomeNotesFilter]): The application outcome notes filters specify the notes for the outcome of the job application. - application_job_filters (Sequence[~.filters.ApplicationJobFilter]): + application_job_filters (Sequence[google.cloud.talent_v4beta1.types.ApplicationJobFilter]): The application job filters specify the job applied for in the application. custom_attribute_filter (str): @@ -507,7 +507,7 @@ class ProfileQuery(proto.Message): Sample Query: (key1 = "TEST" OR LOWER(key1)="test" OR NOT EMPTY(key1)) - candidate_availability_filter (~.filters.CandidateAvailabilityFilter): + candidate_availability_filter (google.cloud.talent_v4beta1.types.CandidateAvailabilityFilter): Deprecated. Use availability_filters instead. The candidate availability filter which filters based on @@ -528,7 +528,7 @@ class ProfileQuery(proto.Message): 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]): + availability_filters (Sequence[google.cloud.talent_v4beta1.types.AvailabilityFilter]): The availability filter which filters based on [Profile.availability_signals][google.cloud.talent.v4beta1.Profile.availability_signals]. @@ -548,7 +548,7 @@ class ProfileQuery(proto.Message): for a [signal_type][google.cloud.talent.v4beta1.AvailabilityFilter.signal_type], an error is thrown. - person_name_filters (Sequence[~.filters.PersonNameFilter]): + person_name_filters (Sequence[google.cloud.talent_v4beta1.types.PersonNameFilter]): Person name filter specifies person name of profiles to match on. If multiple person name filters are specified, @@ -635,7 +635,7 @@ class LocationFilter(proto.Message): 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): + lat_lng (google.type.latlng_pb2.LatLng): The latitude and longitude of the geographic center to search from. This field is ignored if ``address`` is provided. @@ -644,7 +644,7 @@ class LocationFilter(proto.Message): 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): + telecommute_preference (google.cloud.talent_v4beta1.types.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. @@ -701,12 +701,12 @@ class CompensationFilter(proto.Message): r"""Filter on job compensation type and amount. Attributes: - type_ (~.filters.CompensationFilter.FilterType): + type_ (google.cloud.talent_v4beta1.types.CompensationFilter.FilterType): Required. Type of filter. - units (Sequence[~.common.CompensationInfo.CompensationUnit]): + units (Sequence[google.cloud.talent_v4beta1.types.CompensationInfo.CompensationUnit]): Required. Specify desired ``base compensation entry's`` [CompensationInfo.CompensationUnit][google.cloud.talent.v4beta1.CompensationInfo.CompensationUnit]. - range_ (~.common.CompensationInfo.CompensationRange): + range_ (google.cloud.talent_v4beta1.types.CompensationInfo.CompensationRange): Compensation range. include_jobs_with_unspecified_compensation_range (bool): If set to true, jobs with unspecified @@ -738,13 +738,13 @@ class CommuteFilter(proto.Message): r"""Parameters needed for commute search. Attributes: - commute_method (~.common.CommuteMethod): + commute_method (google.cloud.talent_v4beta1.types.CommuteMethod): Required. The method of transportation to calculate the commute time for. - start_coordinates (~.latlng.LatLng): + start_coordinates (google.type.latlng_pb2.LatLng): Required. The latitude and longitude of the location to calculate the commute time from. - travel_duration (~.duration.Duration): + travel_duration (google.protobuf.duration_pb2.Duration): Required. The maximum travel time in seconds. The maximum allowed value is ``3600s`` (one hour). Format is ``123s``. allow_imprecise_addresses (bool): @@ -754,10 +754,10 @@ class CommuteFilter(proto.Message): 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): + road_traffic (google.cloud.talent_v4beta1.types.CommuteFilter.RoadTraffic): Specifies the traffic density to use when calculating commute time. - departure_time (~.timeofday.TimeOfDay): + departure_time (google.type.timeofday_pb2.TimeOfDay): The departure time used to calculate traffic impact, represented as [google.type.TimeOfDay][google.type.TimeOfDay] in local time @@ -831,7 +831,7 @@ class EmployerFilter(proto.Message): employer (str): Required. The name of the employer, for example "Google", "Alphabet". - mode (~.filters.EmployerFilter.EmployerFilterMode): + mode (google.cloud.talent_v4beta1.types.EmployerFilter.EmployerFilterMode): Define set of [EmploymentRecord][google.cloud.talent.v4beta1.EmploymentRecord]s to search against. @@ -872,7 +872,7 @@ class EducationFilter(proto.Message): in [Degree.fields_of_study][google.cloud.talent.v4beta1.Degree.fields_of_study]. For example "Computer Science", "Mathematics". - degree_type (~.common.DegreeType): + degree_type (google.cloud.talent_v4beta1.types.DegreeType): Education degree in ISCED code. Each value in degree covers a specific level of education, without any expansion to upper nor lower levels @@ -901,10 +901,10 @@ class WorkExperienceFilter(proto.Message): [max_experience][google.cloud.talent.v4beta1.WorkExperienceFilter.max_experience]. Attributes: - min_experience (~.duration.Duration): + min_experience (google.protobuf.duration_pb2.Duration): The minimum duration of the work experience (inclusive). - max_experience (~.duration.Duration): + max_experience (google.protobuf.duration_pb2.Duration): The maximum duration of the work experience (exclusive). """ @@ -927,11 +927,11 @@ class ApplicationDateFilter(proto.Message): are missing. Attributes: - start_date (~.date.Date): + start_date (google.type.date_pb2.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 (google.type.date_pb2.Date): End date. If it's missing, The API matches profiles with application date not before the start date. @@ -996,17 +996,17 @@ class TimeFilter(proto.Message): r"""Filter on create timestamp or update timestamp of profiles. Attributes: - start_time (~.timestamp.Timestamp): + start_time (google.protobuf.timestamp_pb2.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_time (google.protobuf.timestamp_pb2.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): + time_field (google.cloud.talent_v4beta1.types.TimeFilter.TimeField): Specifies which time field to filter profiles. Defaults to @@ -1043,9 +1043,9 @@ class AvailabilityFilter(proto.Message): r"""Filter on availability signals. Attributes: - signal_type (~.common.AvailabilitySignalType): + signal_type (google.cloud.talent_v4beta1.types.AvailabilitySignalType): Required. Type of signal to apply filter on. - range_ (~.common.TimestampRange): + range_ (google.cloud.talent_v4beta1.types.TimestampRange): Required. Range of times to filter candidate signals by. required (bool): diff --git a/google/cloud/talent_v4beta1/types/histogram.py b/google/cloud/talent_v4beta1/types/histogram.py index 6c72e53e..b809ac0b 100644 --- a/google/cloud/talent_v4beta1/types/histogram.py +++ b/google/cloud/talent_v4beta1/types/histogram.py @@ -50,7 +50,7 @@ class HistogramQueryResult(proto.Message): Attributes: histogram_query (str): Requested histogram expression. - histogram (Sequence[~.gct_histogram.HistogramQueryResult.HistogramEntry]): + histogram (Sequence[google.cloud.talent_v4beta1.types.HistogramQueryResult.HistogramEntry]): A map from the values of the facet associated with distinct values to the number of matching entries with corresponding value. diff --git a/google/cloud/talent_v4beta1/types/job.py b/google/cloud/talent_v4beta1/types/job.py index 147fbe55..a378bbd5 100644 --- a/google/cloud/talent_v4beta1/types/job.py +++ b/google/cloud/talent_v4beta1/types/job.py @@ -117,15 +117,15 @@ class Job(proto.Message): experience. The maximum number of allowed characters is 500. - application_info (~.job.Job.ApplicationInfo): + application_info (google.cloud.talent_v4beta1.types.Job.ApplicationInfo): Job application information. - job_benefits (Sequence[~.common.JobBenefit]): + job_benefits (Sequence[google.cloud.talent_v4beta1.types.JobBenefit]): The benefits included with the job. - compensation_info (~.common.CompensationInfo): + compensation_info (google.cloud.talent_v4beta1.types.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]): + custom_attributes (Sequence[google.cloud.talent_v4beta1.types.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. @@ -140,7 +140,7 @@ class Job(proto.Message): than 255 characters. For unfilterable ``string_values``, the maximum total size of ``string_values`` across all keys is 50KB. - degree_types (Sequence[~.common.DegreeType]): + degree_types (Sequence[google.cloud.talent_v4beta1.types.DegreeType]): The desired education degrees for the job, such as Bachelors, Masters. department (str): @@ -148,7 +148,7 @@ class Job(proto.Message): company with the open position. The maximum number of allowed characters is 255. - employment_types (Sequence[~.common.EmploymentType]): + employment_types (Sequence[google.cloud.talent_v4beta1.types.EmploymentType]): The employment type(s) of a job, for example, [full time][google.cloud.talent.v4beta1.EmploymentType.FULL_TIME] or [part @@ -173,7 +173,7 @@ class Job(proto.Message): 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): + job_level (google.cloud.talent_v4beta1.types.JobLevel): The experience level associated with the job, such as "Entry Level". promotion_value (int): @@ -208,7 +208,7 @@ class Job(proto.Message): markup tags. The maximum number of allowed characters is 10,000. - posting_region (~.common.PostingRegion): + posting_region (google.cloud.talent_v4beta1.types.PostingRegion): The job [PostingRegion][google.cloud.talent.v4beta1.PostingRegion] (for example, state, country) throughout which the job is @@ -224,7 +224,7 @@ class Job(proto.Message): [Job.addresses][google.cloud.talent.v4beta1.Job.addresses] to the same location level as this field is strongly recommended. - visibility (~.common.Visibility): + visibility (google.cloud.talent_v4beta1.types.Visibility): Deprecated. The job is only visible to the owner. The visibility of the job. @@ -232,21 +232,21 @@ class Job(proto.Message): Defaults to [Visibility.ACCOUNT_ONLY][google.cloud.talent.v4beta1.Visibility.ACCOUNT_ONLY] if not specified. - job_start_time (~.timestamp.Timestamp): + job_start_time (google.protobuf.timestamp_pb2.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): + job_end_time (google.protobuf.timestamp_pb2.Timestamp): The end timestamp of the job. Typically this field is used for contracting engagements. Invalid timestamps are ignored. - posting_publish_time (~.timestamp.Timestamp): + posting_publish_time (google.protobuf.timestamp_pb2.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): + posting_expire_time (google.protobuf.timestamp_pb2.Timestamp): Strongly recommended for the best service experience. The expiration timestamp of the job. After this timestamp, @@ -304,19 +304,19 @@ class Job(proto.Message): 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): + posting_create_time (google.protobuf.timestamp_pb2.Timestamp): Output only. The timestamp when this job posting was created. - posting_update_time (~.timestamp.Timestamp): + posting_update_time (google.protobuf.timestamp_pb2.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): + derived_info (google.cloud.talent_v4beta1.types.Job.DerivedInfo): Output only. Derived details about the job posting. - processing_options (~.job.Job.ProcessingOptions): + processing_options (google.cloud.talent_v4beta1.types.Job.ProcessingOptions): Options for job processing. """ @@ -356,7 +356,7 @@ class DerivedInfo(proto.Message): r"""Derived details about the job posting. Attributes: - locations (Sequence[~.common.Location]): + locations (Sequence[google.cloud.talent_v4beta1.types.Location]): Structured locations of the job, resolved from [Job.addresses][google.cloud.talent.v4beta1.Job.addresses]. @@ -364,7 +364,7 @@ class DerivedInfo(proto.Message): are exactly matched to [Job.addresses][google.cloud.talent.v4beta1.Job.addresses] in the same order. - job_categories (Sequence[~.common.JobCategory]): + job_categories (Sequence[google.cloud.talent_v4beta1.types.JobCategory]): Job categories derived from [Job.title][google.cloud.talent.v4beta1.Job.title] and [Job.description][google.cloud.talent.v4beta1.Job.description]. @@ -385,7 +385,7 @@ class ProcessingOptions(proto.Message): 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): + html_sanitization (google.cloud.talent_v4beta1.types.HtmlSanitization): Option for job HTML content sanitization. Applied fields are: diff --git a/google/cloud/talent_v4beta1/types/job_service.py b/google/cloud/talent_v4beta1/types/job_service.py index 5cad2836..8ee4d6fa 100644 --- a/google/cloud/talent_v4beta1/types/job_service.py +++ b/google/cloud/talent_v4beta1/types/job_service.py @@ -73,7 +73,7 @@ class CreateJobRequest(proto.Message): For example, "projects/foo/tenant/bar". If tenant id is unspecified a default tenant is created. For example, "projects/foo". - job (~.gct_job.Job): + job (google.cloud.talent_v4beta1.types.Job): Required. The Job to be created. """ @@ -104,9 +104,9 @@ class UpdateJobRequest(proto.Message): r"""Update job request. Attributes: - job (~.gct_job.Job): + job (google.cloud.talent_v4beta1.types.Job): Required. The Job to be updated. - update_mask (~.field_mask.FieldMask): + update_mask (google.protobuf.field_mask_pb2.FieldMask): Strongly recommended for the best service experience. If @@ -221,7 +221,7 @@ class ListJobsRequest(proto.Message): maximum allowed page size is 100. Default is 100 if empty or a number < 1 is specified. - job_view (~.job_service.JobView): + 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][google.cloud.talent.v4beta1.JobView.JOB_VIEW_FULL] @@ -243,13 +243,13 @@ class ListJobsResponse(proto.Message): r"""List jobs response. Attributes: - jobs (Sequence[~.gct_job.Job]): + jobs (Sequence[google.cloud.talent_v4beta1.types.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): + metadata (google.cloud.talent_v4beta1.types.ResponseMetadata): Additional information for the API invocation, such as the request tracking id. """ @@ -276,17 +276,17 @@ class SearchJobsRequest(proto.Message): 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): + search_mode (google.cloud.talent_v4beta1.types.SearchJobsRequest.SearchMode): Mode of a search. Defaults to [SearchMode.JOB_SEARCH][google.cloud.talent.v4beta1.SearchJobsRequest.SearchMode.JOB_SEARCH]. - request_metadata (~.common.RequestMetadata): + request_metadata (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. - job_query (~.filters.JobQuery): + job_query (google.cloud.talent_v4beta1.types.JobQuery): Query used to search against jobs, such as keyword, location filters, etc. enable_broadening (bool): @@ -307,7 +307,7 @@ class SearchJobsRequest(proto.Message): Enabling this flag may adversely impact performance. Defaults to false. - histogram_queries (Sequence[~.histogram.HistogramQuery]): + histogram_queries (Sequence[google.cloud.talent_v4beta1.types.HistogramQuery]): An expression specifies a histogram request against matching jobs. @@ -420,7 +420,7 @@ class SearchJobsRequest(proto.Message): - ``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): + 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][google.cloud.talent.v4beta1.JobView.JOB_VIEW_SMALL] @@ -512,7 +512,7 @@ class SearchJobsRequest(proto.Message): (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): + diversification_level (google.cloud.talent_v4beta1.types.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 @@ -524,7 +524,7 @@ class SearchJobsRequest(proto.Message): Defaults to [DiversificationLevel.SIMPLE][google.cloud.talent.v4beta1.SearchJobsRequest.DiversificationLevel.SIMPLE] if no value is specified. - custom_ranking_info (~.job_service.SearchJobsRequest.CustomRankingInfo): + custom_ranking_info (google.cloud.talent_v4beta1.types.SearchJobsRequest.CustomRankingInfo): Controls over how job documents get ranked on top of existing relevance score (determined by API algorithm). @@ -582,7 +582,7 @@ class CustomRankingInfo(proto.Message): [SearchJobsRequest][google.cloud.talent.v4beta1.SearchJobsRequest]. Attributes: - importance_level (~.job_service.SearchJobsRequest.CustomRankingInfo.ImportanceLevel): + importance_level (google.cloud.talent_v4beta1.types.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. @@ -679,17 +679,17 @@ class SearchJobsResponse(proto.Message): r"""Response for SearchJob method. Attributes: - matching_jobs (Sequence[~.job_service.SearchJobsResponse.MatchingJob]): + matching_jobs (Sequence[google.cloud.talent_v4beta1.types.SearchJobsResponse.MatchingJob]): The Job entities that match the specified [SearchJobsRequest][google.cloud.talent.v4beta1.SearchJobsRequest]. - histogram_query_results (Sequence[~.histogram.HistogramQueryResult]): + histogram_query_results (Sequence[google.cloud.talent_v4beta1.types.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]): + location_filters (Sequence[google.cloud.talent_v4beta1.types.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] @@ -708,7 +708,7 @@ class SearchJobsResponse(proto.Message): [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): + metadata (google.cloud.talent_v4beta1.types.ResponseMetadata): Additional information for the API invocation, such as the request tracking id. broadened_query_jobs_count (int): @@ -723,7 +723,7 @@ class SearchJobsResponse(proto.Message): 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): + spell_correction (google.cloud.talent_v4beta1.types.SpellingCorrection): The spell checking result, and correction. """ @@ -732,7 +732,7 @@ class MatchingJob(proto.Message): [SearchJobsResponse][google.cloud.talent.v4beta1.SearchJobsResponse]. Attributes: - job (~.gct_job.Job): + job (google.cloud.talent_v4beta1.types.Job): Job resource that matches the specified [SearchJobsRequest][google.cloud.talent.v4beta1.SearchJobsRequest]. job_summary (str): @@ -752,7 +752,7 @@ class MatchingJob(proto.Message): 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_info (google.cloud.talent_v4beta1.types.SearchJobsResponse.CommuteInfo): Commute information which is generated based on specified [CommuteFilter][google.cloud.talent.v4beta1.CommuteFilter]. """ @@ -773,10 +773,10 @@ class CommuteInfo(proto.Message): r"""Commute details related to this job. Attributes: - job_location (~.common.Location): + job_location (google.cloud.talent_v4beta1.types.Location): Location used as the destination in the commute calculation. - travel_duration (~.duration.Duration): + travel_duration (google.protobuf.duration_pb2.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 @@ -831,7 +831,7 @@ class BatchCreateJobsRequest(proto.Message): 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]): + jobs (Sequence[google.cloud.talent_v4beta1.types.Job]): Required. The jobs to be created. """ @@ -852,9 +852,9 @@ class BatchUpdateJobsRequest(proto.Message): 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]): + jobs (Sequence[google.cloud.talent_v4beta1.types.Job]): Required. The jobs to be updated. - update_mask (~.field_mask.FieldMask): + update_mask (google.protobuf.field_mask_pb2.FieldMask): Strongly recommended for the best service experience. Be aware that it will also increase latency when checking the status of a batch operation. @@ -897,7 +897,7 @@ class JobOperationResult(proto.Message): in case of success. Attributes: - job_results (Sequence[~.job_service.JobOperationResult.JobResult]): + job_results (Sequence[google.cloud.talent_v4beta1.types.JobOperationResult.JobResult]): List of job mutation results from a batch mutate operation. It can change until operation status is FINISHED, FAILED or CANCELLED. @@ -907,7 +907,7 @@ class JobResult(proto.Message): r"""Mutation result of a job. Attributes: - job (~.gct_job.Job): + job (google.cloud.talent_v4beta1.types.Job): Here [Job][google.cloud.talent.v4beta1.Job] only contains basic information including [name][google.cloud.talent.v4beta1.Job.name], @@ -917,7 +917,7 @@ class JobResult(proto.Message): [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): + status (google.rpc.status_pb2.Status): The status of the job processed. This field is populated if the processing of the [job][google.cloud.talent.v4beta1.JobOperationResult.JobResult.job] diff --git a/google/cloud/talent_v4beta1/types/profile.py b/google/cloud/talent_v4beta1/types/profile.py index 38428498..33c9a31f 100644 --- a/google/cloud/talent_v4beta1/types/profile.py +++ b/google/cloud/talent_v4beta1/types/profile.py @@ -95,16 +95,16 @@ class Profile(proto.Message): [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): + is_hirable (google.protobuf.wrappers_pb2.BoolValue): Indicates the hirable status of the candidate. - create_time (~.timestamp.Timestamp): + create_time (google.protobuf.timestamp_pb2.Timestamp): The timestamp when the profile was first created at this source. - update_time (~.timestamp.Timestamp): + update_time (google.protobuf.timestamp_pb2.Timestamp): The timestamp when the profile was last updated at this source. - candidate_update_time (~.timestamp.Timestamp): + candidate_update_time (google.protobuf.timestamp_pb2.Timestamp): The timestamp when the profile was last updated as a result of a direct or indirect action by a candidate. @@ -130,7 +130,7 @@ class Profile(proto.Message): 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): + resume_update_time (google.protobuf.timestamp_pb2.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 @@ -139,13 +139,13 @@ class Profile(proto.Message): 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): + resume (google.cloud.talent_v4beta1.types.Resume): The resume representing this profile. - person_names (Sequence[~.profile.PersonName]): + person_names (Sequence[google.cloud.talent_v4beta1.types.PersonName]): The names of the candidate this profile references. Currently only one person name is supported. - addresses (Sequence[~.profile.Address]): + addresses (Sequence[google.cloud.talent_v4beta1.types.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: @@ -183,13 +183,13 @@ class Profile(proto.Message): is CONTACT_INFO_USAGE_UNSPECIFIED and [Address.current][google.cloud.talent.v4beta1.Address.current] is false or not set. - email_addresses (Sequence[~.profile.Email]): + email_addresses (Sequence[google.cloud.talent_v4beta1.types.Email]): The candidate's email addresses. - phone_numbers (Sequence[~.profile.Phone]): + phone_numbers (Sequence[google.cloud.talent_v4beta1.types.Phone]): The candidate's phone number(s). - personal_uris (Sequence[~.profile.PersonalUri]): + personal_uris (Sequence[google.cloud.talent_v4beta1.types.PersonalUri]): The candidate's personal URIs. - additional_contact_info (Sequence[~.profile.AdditionalContactInfo]): + additional_contact_info (Sequence[google.cloud.talent_v4beta1.types.AdditionalContactInfo]): Available contact information besides [addresses][google.cloud.talent.v4beta1.Profile.addresses], [email_addresses][google.cloud.talent.v4beta1.Profile.email_addresses], @@ -197,7 +197,7 @@ class Profile(proto.Message): and [personal_uris][google.cloud.talent.v4beta1.Profile.personal_uris]. For example, Hang-out, Skype. - employment_records (Sequence[~.profile.EmploymentRecord]): + employment_records (Sequence[google.cloud.talent_v4beta1.types.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 @@ -215,7 +215,7 @@ class Profile(proto.Message): inferred from user inputs. The limitation for max number of employment records is 100. - education_records (Sequence[~.profile.EducationRecord]): + education_records (Sequence[google.cloud.talent_v4beta1.types.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 @@ -232,25 +232,25 @@ class Profile(proto.Message): inferred from user inputs. The limitation for max number of education records is 100. - skills (Sequence[~.common.Skill]): + skills (Sequence[google.cloud.talent_v4beta1.types.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]): + activities (Sequence[google.cloud.talent_v4beta1.types.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]): + publications (Sequence[google.cloud.talent_v4beta1.types.Publication]): The publications published by the candidate. The limitation for max number of publications is 50. - patents (Sequence[~.profile.Patent]): + patents (Sequence[google.cloud.talent_v4beta1.types.Patent]): The patents acquired by the candidate. - certifications (Sequence[~.common.Certification]): + certifications (Sequence[google.cloud.talent_v4beta1.types.Certification]): The certifications acquired by the candidate. applications (Sequence[str]): Output only. The resource names of the @@ -258,7 +258,7 @@ class Profile(proto.Message): assignments (Sequence[str]): Output only. The resource names of the candidate's assignments. - custom_attributes (Sequence[~.profile.Profile.CustomAttributesEntry]): + custom_attributes (Sequence[google.cloud.talent_v4beta1.types.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 @@ -290,10 +290,10 @@ class Profile(proto.Message): 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]): + availability_signals (Sequence[google.cloud.talent_v4beta1.types.AvailabilitySignal]): Output only. Candidate's availability signals. - derived_addresses (Sequence[~.common.Location]): + derived_addresses (Sequence[google.cloud.talent_v4beta1.types.Location]): Output only. Derived locations of the profile, resolved from [Profile.addresses][google.cloud.talent.v4beta1.Profile.addresses]. @@ -390,12 +390,12 @@ class AvailabilitySignal(proto.Message): r"""Candidate availability signal. Attributes: - type_ (~.common.AvailabilitySignalType): + type_ (google.cloud.talent_v4beta1.types.AvailabilitySignalType): Type of signal. - last_update_time (~.timestamp.Timestamp): + last_update_time (google.protobuf.timestamp_pb2.Timestamp): Timestamp of when the given availability activity last happened. - filter_satisfied (~.wrappers.BoolValue): + filter_satisfied (google.protobuf.wrappers_pb2.BoolValue): Indicates if the [last_update_time][google.cloud.talent.v4beta1.AvailabilitySignal.last_update_time] is within @@ -439,7 +439,7 @@ class Resume(proto.Message): 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): + resume_type (google.cloud.talent_v4beta1.types.Resume.ResumeType): The format of [structured_resume][google.cloud.talent.v4beta1.Resume.structured_resume]. """ @@ -463,7 +463,7 @@ class PersonName(proto.Message): A string represents a person's full name. For example, "Dr. John Smith". Number of characters allowed is 100. - structured_name (~.profile.PersonName.PersonStructuredName): + structured_name (google.cloud.talent_v4beta1.types.PersonName.PersonStructuredName): A person's name in a structured way (last name, first name, suffix, and so on.) preferred_name (str): @@ -538,7 +538,7 @@ class Address(proto.Message): r"""Resource that represents a address. Attributes: - usage (~.common.ContactInfoUsage): + usage (google.cloud.talent_v4beta1.types.ContactInfoUsage): The usage of the address. For example, SCHOOL, WORK, PERSONAL. unstructured_address (str): @@ -547,10 +547,10 @@ class Address(proto.Message): View, CA 94043", "Sunnyvale, California". Number of characters allowed is 100. - structured_address (~.postal_address.PostalAddress): + structured_address (google.type.postal_address_pb2.PostalAddress): Structured address that contains street address, city, state, country, and so on. - current (~.wrappers.BoolValue): + current (google.protobuf.wrappers_pb2.BoolValue): Indicates if it's the person's current address. """ @@ -570,7 +570,7 @@ class Email(proto.Message): r"""Resource that represents a person's email address. Attributes: - usage (~.common.ContactInfoUsage): + usage (google.cloud.talent_v4beta1.types.ContactInfoUsage): The usage of the email address. For example, SCHOOL, WORK, PERSONAL. email_address (str): @@ -587,10 +587,10 @@ class Phone(proto.Message): r"""Resource that represents a person's telephone number. Attributes: - usage (~.common.ContactInfoUsage): + usage (google.cloud.talent_v4beta1.types.ContactInfoUsage): The usage of the phone. For example, SCHOOL, WORK, PERSONAL. - type_ (~.profile.Phone.PhoneType): + type_ (google.cloud.talent_v4beta1.types.Phone.PhoneType): The phone type. For example, LANDLINE, MOBILE, FAX. number (str): @@ -647,7 +647,7 @@ class AdditionalContactInfo(proto.Message): phone, email, URI and addresses. Attributes: - usage (~.common.ContactInfoUsage): + usage (google.cloud.talent_v4beta1.types.ContactInfoUsage): The usage of this contact method. For example, SCHOOL, WORK, PERSONAL. name (str): @@ -671,9 +671,9 @@ class EmploymentRecord(proto.Message): r"""Resource that represents an employment record of a candidate. Attributes: - start_date (~.date.Date): + start_date (google.type.date_pb2.Date): Start date of the employment. - end_date (~.date.Date): + end_date (google.type.date_pb2.Date): End date of the employment. employer_name (str): The name of the employer @@ -685,7 +685,7 @@ class EmploymentRecord(proto.Message): For example, division, department, client, and so on. Number of characters allowed is 100. - address (~.profile.Address): + address (google.cloud.talent_v4beta1.types.Address): The physical address of the employer. job_title (str): The job title of the employment. @@ -695,11 +695,11 @@ class EmploymentRecord(proto.Message): job_description (str): The description of job content. Number of characters allowed is 100,000. - is_supervisor (~.wrappers.BoolValue): + is_supervisor (google.protobuf.wrappers_pb2.BoolValue): If the jobs is a supervisor position. - is_self_employed (~.wrappers.BoolValue): + is_self_employed (google.protobuf.wrappers_pb2.BoolValue): If this employment is self-employed. - is_current (~.wrappers.BoolValue): + is_current (google.protobuf.wrappers_pb2.BoolValue): If this employment is current. job_title_snippet (str): Output only. The job title snippet shows how the @@ -752,11 +752,11 @@ class EducationRecord(proto.Message): r"""Resource that represents an education record of a candidate. Attributes: - start_date (~.date.Date): + start_date (google.type.date_pb2.Date): The start date of the education. - end_date (~.date.Date): + end_date (google.type.date_pb2.Date): The end date of the education. - expected_graduation_date (~.date.Date): + expected_graduation_date (google.type.date_pb2.Date): The expected graduation date if currently pursuing a degree. school_name (str): @@ -764,7 +764,7 @@ class EducationRecord(proto.Message): For example, "Stanford University", "UC Berkeley", and so on. Number of characters allowed is 250. - address (~.profile.Address): + address (google.cloud.talent_v4beta1.types.Address): The physical address of the education institution. degree_description (str): @@ -772,12 +772,12 @@ class EducationRecord(proto.Message): For example, "Master of Science in Computer Science", "B.S in Math". Number of characters allowed is 100. - structured_degree (~.profile.Degree): + structured_degree (google.cloud.talent_v4beta1.types.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): + is_current (google.protobuf.wrappers_pb2.BoolValue): If this education is current. school_name_snippet (str): Output only. The school name snippet shows how the @@ -824,7 +824,7 @@ class Degree(proto.Message): candidate. Attributes: - degree_type (~.common.DegreeType): + degree_type (google.cloud.talent_v4beta1.types.DegreeType): ISCED degree type. degree_name (str): Full Degree name. @@ -859,9 +859,9 @@ class Activity(proto.Message): uri (str): Activity URI. Number of characters allowed is 4,000. - create_date (~.date.Date): + create_date (google.type.date_pb2.Date): The first creation date of the activity. - update_date (~.date.Date): + update_date (google.type.date_pb2.Date): The last update date of the activity. team_members (Sequence[str]): A list of team members involved in this @@ -870,7 +870,7 @@ class Activity(proto.Message): The limitation for max number of team members is 50. - skills_used (Sequence[~.common.Skill]): + skills_used (Sequence[google.cloud.talent_v4beta1.types.Skill]): A list of skills used in this activity. The limitation for max number of skills used is 50. @@ -939,7 +939,7 @@ class Publication(proto.Message): publisher (str): The publisher of the journal. Number of characters allowed is 100. - publication_date (~.date.Date): + publication_date (google.type.date_pb2.Date): The publication date. publication_type (str): The publication type. @@ -981,10 +981,10 @@ class Patent(proto.Message): patent_status (str): The status of the patent. Number of characters allowed is 100. - patent_status_date (~.date.Date): + patent_status_date (google.type.date_pb2.Date): The date the last time the status of the patent was checked. - patent_filing_date (~.date.Date): + patent_filing_date (google.type.date_pb2.Date): The date that the patent was filed. patent_office (str): The name of the patent office. @@ -995,7 +995,7 @@ class Patent(proto.Message): patent_description (str): The description of the patent. Number of characters allowed is 100,000. - skills_used (Sequence[~.common.Skill]): + skills_used (Sequence[google.cloud.talent_v4beta1.types.Skill]): The skills used in this patent. """ diff --git a/google/cloud/talent_v4beta1/types/profile_service.py b/google/cloud/talent_v4beta1/types/profile_service.py index 1214e0ab..c64b7c3d 100644 --- a/google/cloud/talent_v4beta1/types/profile_service.py +++ b/google/cloud/talent_v4beta1/types/profile_service.py @@ -81,7 +81,7 @@ class ListProfilesRequest(proto.Message): returned, at most 100. Default is 100 unless a positive number smaller than 100 is specified. - read_mask (~.field_mask.FieldMask): + read_mask (google.protobuf.field_mask_pb2.FieldMask): A field mask to specify the profile fields to be listed in response. All fields are listed if it is unset. @@ -105,7 +105,7 @@ class ListProfilesResponse(proto.Message): r"""The List profiles response object. Attributes: - profiles (Sequence[~.gct_profile.Profile]): + profiles (Sequence[google.cloud.talent_v4beta1.types.Profile]): Profiles for the specific tenant. next_page_token (str): A token to retrieve the next page of results. @@ -132,7 +132,7 @@ class CreateProfileRequest(proto.Message): The format is "projects/{project_id}/tenants/{tenant_id}". For example, "projects/foo/tenants/bar". - profile (~.gct_profile.Profile): + profile (google.cloud.talent_v4beta1.types.Profile): Required. The profile to be created. """ @@ -160,9 +160,9 @@ class UpdateProfileRequest(proto.Message): r"""Update profile request Attributes: - profile (~.gct_profile.Profile): + profile (google.cloud.talent_v4beta1.types.Profile): Required. Profile to be updated. - update_mask (~.field_mask.FieldMask): + update_mask (google.protobuf.field_mask_pb2.FieldMask): A field mask to specify the profile fields to update. A full update is performed if it is unset. @@ -197,13 +197,13 @@ class SearchProfilesRequest(proto.Message): The format is "projects/{project_id}/tenants/{tenant_id}". For example, "projects/foo/tenants/bar". - request_metadata (~.common.RequestMetadata): + request_metadata (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. - profile_query (~.filters.ProfileQuery): + profile_query (google.cloud.talent_v4beta1.types.ProfileQuery): Search query to execute. See [ProfileQuery][google.cloud.talent.v4beta1.ProfileQuery] for more details. @@ -273,7 +273,7 @@ class SearchProfilesRequest(proto.Message): 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]): + histogram_queries (Sequence[google.cloud.talent_v4beta1.types.HistogramQuery]): A list of expressions specifies histogram requests against matching profiles for [SearchProfilesRequest][google.cloud.talent.v4beta1.SearchProfilesRequest]. @@ -463,18 +463,18 @@ class SearchProfilesResponse(proto.Message): An estimation of the number of profiles that match the specified query. This number isn't guaranteed to be accurate. - spell_correction (~.common.SpellingCorrection): + spell_correction (google.cloud.talent_v4beta1.types.SpellingCorrection): The spell checking result, and correction. - metadata (~.common.ResponseMetadata): + metadata (google.cloud.talent_v4beta1.types.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]): + histogram_query_results (Sequence[google.cloud.talent_v4beta1.types.HistogramQueryResult]): The histogram results that match with specified [SearchProfilesRequest.histogram_queries][google.cloud.talent.v4beta1.SearchProfilesRequest.histogram_queries]. - summarized_profiles (Sequence[~.profile_service.SummarizedProfile]): + summarized_profiles (Sequence[google.cloud.talent_v4beta1.types.SummarizedProfile]): The profile entities that match the specified [SearchProfilesRequest][google.cloud.talent.v4beta1.SearchProfilesRequest]. result_set_id (str): @@ -513,10 +513,10 @@ class SummarizedProfile(proto.Message): [SearchProfilesResponse][google.cloud.talent.v4beta1.SearchProfilesResponse]. Attributes: - profiles (Sequence[~.gct_profile.Profile]): + profiles (Sequence[google.cloud.talent_v4beta1.types.Profile]): A list of profiles that are linked by [Profile.group_id][google.cloud.talent.v4beta1.Profile.group_id]. - summary (~.gct_profile.Profile): + summary (google.cloud.talent_v4beta1.types.Profile): A profile summary shows the profile summary and how the profile matches the search query. diff --git a/google/cloud/talent_v4beta1/types/tenant.py b/google/cloud/talent_v4beta1/types/tenant.py index c7d1974d..c399eba2 100644 --- a/google/cloud/talent_v4beta1/types/tenant.py +++ b/google/cloud/talent_v4beta1/types/tenant.py @@ -43,7 +43,7 @@ class Tenant(proto.Message): Required. Client side tenant identifier, used to uniquely identify the tenant. The maximum number of allowed characters is 255. - usage_type (~.tenant.Tenant.DataUsageType): + usage_type (google.cloud.talent_v4beta1.types.Tenant.DataUsageType): Indicates whether data owned by this tenant may be used to provide product improvements across other tenants. diff --git a/google/cloud/talent_v4beta1/types/tenant_service.py b/google/cloud/talent_v4beta1/types/tenant_service.py index 505da6f7..104c43c7 100644 --- a/google/cloud/talent_v4beta1/types/tenant_service.py +++ b/google/cloud/talent_v4beta1/types/tenant_service.py @@ -46,7 +46,7 @@ class CreateTenantRequest(proto.Message): The format is "projects/{project_id}", for example, "projects/foo". - tenant (~.gct_tenant.Tenant): + tenant (google.cloud.talent_v4beta1.types.Tenant): Required. The tenant to be created. """ @@ -73,10 +73,10 @@ class UpdateTenantRequest(proto.Message): r"""Request for updating a specified tenant. Attributes: - tenant (~.gct_tenant.Tenant): + tenant (google.cloud.talent_v4beta1.types.Tenant): Required. The tenant resource to replace the current resource in the system. - update_mask (~.field_mask.FieldMask): + update_mask (google.protobuf.field_mask_pb2.FieldMask): Strongly recommended for the best service experience. If @@ -139,11 +139,11 @@ class ListTenantsResponse(proto.Message): r"""The List tenants response object. Attributes: - tenants (Sequence[~.gct_tenant.Tenant]): + tenants (Sequence[google.cloud.talent_v4beta1.types.Tenant]): Tenants for the current client. next_page_token (str): A token to retrieve the next page of results. - metadata (~.common.ResponseMetadata): + metadata (google.cloud.talent_v4beta1.types.ResponseMetadata): Additional information for the API invocation, such as the request tracking id. """ diff --git a/synth.metadata b/synth.metadata index 674a7366..f2dcc8c5 100644 --- a/synth.metadata +++ b/synth.metadata @@ -11,8 +11,8 @@ "git": { "name": "googleapis", "remote": "https://github.com/googleapis/googleapis.git", - "sha": "8a6f4d9acb1620af2156b42b37b54eae257b7cad", - "internalRef": "348696929" + "sha": "520682435235d9c503983a360a2090025aa47cd1", + "internalRef": "350246057" } }, { @@ -51,6 +51,7 @@ } ], "generatedFiles": [ + ".coveragerc", ".flake8", ".github/CONTRIBUTING.md", ".github/ISSUE_TEMPLATE/bug_report.md", @@ -104,9 +105,21 @@ "docs/_templates/layout.html", "docs/conf.py", "docs/multiprocessing.rst", + "docs/talent_v4/company_service.rst", + "docs/talent_v4/completion.rst", + "docs/talent_v4/event_service.rst", + "docs/talent_v4/job_service.rst", "docs/talent_v4/services.rst", + "docs/talent_v4/tenant_service.rst", "docs/talent_v4/types.rst", + "docs/talent_v4beta1/application_service.rst", + "docs/talent_v4beta1/company_service.rst", + "docs/talent_v4beta1/completion.rst", + "docs/talent_v4beta1/event_service.rst", + "docs/talent_v4beta1/job_service.rst", + "docs/talent_v4beta1/profile_service.rst", "docs/talent_v4beta1/services.rst", + "docs/talent_v4beta1/tenant_service.rst", "docs/talent_v4beta1/types.rst", "google/cloud/talent/__init__.py", "google/cloud/talent/py.typed", diff --git a/tests/unit/gapic/talent_v4/test_company_service.py b/tests/unit/gapic/talent_v4/test_company_service.py index bcb62811..d7d07f7c 100644 --- a/tests/unit/gapic/talent_v4/test_company_service.py +++ b/tests/unit/gapic/talent_v4/test_company_service.py @@ -90,8 +90,21 @@ def test__get_default_mtls_endpoint(): ) +def test_company_service_client_from_service_account_info(): + creds = credentials.AnonymousCredentials() + with mock.patch.object( + service_account.Credentials, "from_service_account_info" + ) as factory: + factory.return_value = creds + info = {"valid": True} + client = CompanyServiceClient.from_service_account_info(info) + assert client.transport._credentials == creds + + assert client.transport._host == "jobs.googleapis.com:443" + + @pytest.mark.parametrize( - "client_class", [CompanyServiceClient, CompanyServiceAsyncClient] + "client_class", [CompanyServiceClient, CompanyServiceAsyncClient,] ) def test_company_service_client_from_service_account_file(client_class): creds = credentials.AnonymousCredentials() @@ -110,7 +123,10 @@ def test_company_service_client_from_service_account_file(client_class): def test_company_service_client_get_transport_class(): transport = CompanyServiceClient.get_transport_class() - assert transport == transports.CompanyServiceGrpcTransport + available_transports = [ + transports.CompanyServiceGrpcTransport, + ] + assert transport in available_transports transport = CompanyServiceClient.get_transport_class("grpc") assert transport == transports.CompanyServiceGrpcTransport @@ -1956,7 +1972,7 @@ def test_company_service_host_with_port(): def test_company_service_grpc_transport_channel(): - channel = grpc.insecure_channel("http://localhost/") + channel = grpc.secure_channel("http://localhost/", grpc.local_channel_credentials()) # Check that channel is used if provided. transport = transports.CompanyServiceGrpcTransport( @@ -1968,7 +1984,7 @@ def test_company_service_grpc_transport_channel(): def test_company_service_grpc_asyncio_transport_channel(): - channel = aio.insecure_channel("http://localhost/") + channel = aio.secure_channel("http://localhost/", grpc.local_channel_credentials()) # Check that channel is used if provided. transport = transports.CompanyServiceGrpcAsyncIOTransport( @@ -1993,7 +2009,7 @@ def test_company_service_transport_channel_mtls_with_client_cert_source( "grpc.ssl_channel_credentials", autospec=True ) as grpc_ssl_channel_cred: with mock.patch.object( - transport_class, "create_channel", autospec=True + transport_class, "create_channel" ) as grpc_create_channel: mock_ssl_cred = mock.Mock() grpc_ssl_channel_cred.return_value = mock_ssl_cred @@ -2049,7 +2065,7 @@ def test_company_service_transport_channel_mtls_with_adc(transport_class): ssl_credentials=mock.PropertyMock(return_value=mock_ssl_cred), ): with mock.patch.object( - transport_class, "create_channel", autospec=True + transport_class, "create_channel" ) as grpc_create_channel: mock_grpc_channel = mock.Mock() grpc_create_channel.return_value = mock_grpc_channel diff --git a/tests/unit/gapic/talent_v4/test_completion.py b/tests/unit/gapic/talent_v4/test_completion.py index cafd4bc5..23269af7 100644 --- a/tests/unit/gapic/talent_v4/test_completion.py +++ b/tests/unit/gapic/talent_v4/test_completion.py @@ -81,7 +81,20 @@ def test__get_default_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_info(): + creds = credentials.AnonymousCredentials() + with mock.patch.object( + service_account.Credentials, "from_service_account_info" + ) as factory: + factory.return_value = creds + info = {"valid": True} + client = CompletionClient.from_service_account_info(info) + assert client.transport._credentials == creds + + assert client.transport._host == "jobs.googleapis.com:443" + + +@pytest.mark.parametrize("client_class", [CompletionClient, CompletionAsyncClient,]) def test_completion_client_from_service_account_file(client_class): creds = credentials.AnonymousCredentials() with mock.patch.object( @@ -99,7 +112,10 @@ def test_completion_client_from_service_account_file(client_class): def test_completion_client_get_transport_class(): transport = CompletionClient.get_transport_class() - assert transport == transports.CompletionGrpcTransport + available_transports = [ + transports.CompletionGrpcTransport, + ] + assert transport in available_transports transport = CompletionClient.get_transport_class("grpc") assert transport == transports.CompletionGrpcTransport @@ -603,7 +619,7 @@ def test_transport_get_channel(): @pytest.mark.parametrize( "transport_class", - [transports.CompletionGrpcTransport, transports.CompletionGrpcAsyncIOTransport], + [transports.CompletionGrpcTransport, transports.CompletionGrpcAsyncIOTransport,], ) def test_transport_adc(transport_class): # Test default credentials are used if not provided. @@ -729,7 +745,7 @@ def test_completion_host_with_port(): def test_completion_grpc_transport_channel(): - channel = grpc.insecure_channel("http://localhost/") + channel = grpc.secure_channel("http://localhost/", grpc.local_channel_credentials()) # Check that channel is used if provided. transport = transports.CompletionGrpcTransport( @@ -741,7 +757,7 @@ def test_completion_grpc_transport_channel(): def test_completion_grpc_asyncio_transport_channel(): - channel = aio.insecure_channel("http://localhost/") + channel = aio.secure_channel("http://localhost/", grpc.local_channel_credentials()) # Check that channel is used if provided. transport = transports.CompletionGrpcAsyncIOTransport( @@ -761,7 +777,7 @@ def test_completion_transport_channel_mtls_with_client_cert_source(transport_cla "grpc.ssl_channel_credentials", autospec=True ) as grpc_ssl_channel_cred: with mock.patch.object( - transport_class, "create_channel", autospec=True + transport_class, "create_channel" ) as grpc_create_channel: mock_ssl_cred = mock.Mock() grpc_ssl_channel_cred.return_value = mock_ssl_cred @@ -814,7 +830,7 @@ def test_completion_transport_channel_mtls_with_adc(transport_class): ssl_credentials=mock.PropertyMock(return_value=mock_ssl_cred), ): with mock.patch.object( - transport_class, "create_channel", autospec=True + transport_class, "create_channel" ) as grpc_create_channel: mock_grpc_channel = mock.Mock() grpc_create_channel.return_value = mock_grpc_channel diff --git a/tests/unit/gapic/talent_v4/test_event_service.py b/tests/unit/gapic/talent_v4/test_event_service.py index dcf80843..a89e7f2f 100644 --- a/tests/unit/gapic/talent_v4/test_event_service.py +++ b/tests/unit/gapic/talent_v4/test_event_service.py @@ -82,7 +82,20 @@ def test__get_default_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_info(): + creds = credentials.AnonymousCredentials() + with mock.patch.object( + service_account.Credentials, "from_service_account_info" + ) as factory: + factory.return_value = creds + info = {"valid": True} + client = EventServiceClient.from_service_account_info(info) + assert client.transport._credentials == creds + + assert client.transport._host == "jobs.googleapis.com:443" + + +@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( @@ -100,7 +113,10 @@ def test_event_service_client_from_service_account_file(client_class): def test_event_service_client_get_transport_class(): transport = EventServiceClient.get_transport_class() - assert transport == transports.EventServiceGrpcTransport + available_transports = [ + transports.EventServiceGrpcTransport, + ] + assert transport in available_transports transport = EventServiceClient.get_transport_class("grpc") assert transport == transports.EventServiceGrpcTransport @@ -713,7 +729,10 @@ def test_transport_get_channel(): @pytest.mark.parametrize( "transport_class", - [transports.EventServiceGrpcTransport, transports.EventServiceGrpcAsyncIOTransport], + [ + transports.EventServiceGrpcTransport, + transports.EventServiceGrpcAsyncIOTransport, + ], ) def test_transport_adc(transport_class): # Test default credentials are used if not provided. @@ -839,7 +858,7 @@ def test_event_service_host_with_port(): def test_event_service_grpc_transport_channel(): - channel = grpc.insecure_channel("http://localhost/") + channel = grpc.secure_channel("http://localhost/", grpc.local_channel_credentials()) # Check that channel is used if provided. transport = transports.EventServiceGrpcTransport( @@ -851,7 +870,7 @@ def test_event_service_grpc_transport_channel(): def test_event_service_grpc_asyncio_transport_channel(): - channel = aio.insecure_channel("http://localhost/") + channel = aio.secure_channel("http://localhost/", grpc.local_channel_credentials()) # Check that channel is used if provided. transport = transports.EventServiceGrpcAsyncIOTransport( @@ -871,7 +890,7 @@ def test_event_service_transport_channel_mtls_with_client_cert_source(transport_ "grpc.ssl_channel_credentials", autospec=True ) as grpc_ssl_channel_cred: with mock.patch.object( - transport_class, "create_channel", autospec=True + transport_class, "create_channel" ) as grpc_create_channel: mock_ssl_cred = mock.Mock() grpc_ssl_channel_cred.return_value = mock_ssl_cred @@ -924,7 +943,7 @@ def test_event_service_transport_channel_mtls_with_adc(transport_class): ssl_credentials=mock.PropertyMock(return_value=mock_ssl_cred), ): with mock.patch.object( - transport_class, "create_channel", autospec=True + transport_class, "create_channel" ) as grpc_create_channel: mock_grpc_channel = mock.Mock() grpc_create_channel.return_value = mock_grpc_channel diff --git a/tests/unit/gapic/talent_v4/test_job_service.py b/tests/unit/gapic/talent_v4/test_job_service.py index 208347d4..39a3dfe4 100644 --- a/tests/unit/gapic/talent_v4/test_job_service.py +++ b/tests/unit/gapic/talent_v4/test_job_service.py @@ -98,7 +98,20 @@ def test__get_default_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_info(): + creds = credentials.AnonymousCredentials() + with mock.patch.object( + service_account.Credentials, "from_service_account_info" + ) as factory: + factory.return_value = creds + info = {"valid": True} + client = JobServiceClient.from_service_account_info(info) + assert client.transport._credentials == creds + + assert client.transport._host == "jobs.googleapis.com:443" + + +@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( @@ -116,7 +129,10 @@ def test_job_service_client_from_service_account_file(client_class): def test_job_service_client_get_transport_class(): transport = JobServiceClient.get_transport_class() - assert transport == transports.JobServiceGrpcTransport + available_transports = [ + transports.JobServiceGrpcTransport, + ] + assert transport in available_transports transport = JobServiceClient.get_transport_class("grpc") assert transport == transports.JobServiceGrpcTransport @@ -2815,7 +2831,7 @@ def test_transport_get_channel(): @pytest.mark.parametrize( "transport_class", - [transports.JobServiceGrpcTransport, transports.JobServiceGrpcAsyncIOTransport], + [transports.JobServiceGrpcTransport, transports.JobServiceGrpcAsyncIOTransport,], ) def test_transport_adc(transport_class): # Test default credentials are used if not provided. @@ -2957,7 +2973,7 @@ def test_job_service_host_with_port(): def test_job_service_grpc_transport_channel(): - channel = grpc.insecure_channel("http://localhost/") + channel = grpc.secure_channel("http://localhost/", grpc.local_channel_credentials()) # Check that channel is used if provided. transport = transports.JobServiceGrpcTransport( @@ -2969,7 +2985,7 @@ def test_job_service_grpc_transport_channel(): def test_job_service_grpc_asyncio_transport_channel(): - channel = aio.insecure_channel("http://localhost/") + channel = aio.secure_channel("http://localhost/", grpc.local_channel_credentials()) # Check that channel is used if provided. transport = transports.JobServiceGrpcAsyncIOTransport( @@ -2989,7 +3005,7 @@ def test_job_service_transport_channel_mtls_with_client_cert_source(transport_cl "grpc.ssl_channel_credentials", autospec=True ) as grpc_ssl_channel_cred: with mock.patch.object( - transport_class, "create_channel", autospec=True + transport_class, "create_channel" ) as grpc_create_channel: mock_ssl_cred = mock.Mock() grpc_ssl_channel_cred.return_value = mock_ssl_cred @@ -3042,7 +3058,7 @@ def test_job_service_transport_channel_mtls_with_adc(transport_class): ssl_credentials=mock.PropertyMock(return_value=mock_ssl_cred), ): with mock.patch.object( - transport_class, "create_channel", autospec=True + transport_class, "create_channel" ) as grpc_create_channel: mock_grpc_channel = mock.Mock() grpc_create_channel.return_value = mock_grpc_channel diff --git a/tests/unit/gapic/talent_v4/test_tenant_service.py b/tests/unit/gapic/talent_v4/test_tenant_service.py index 32438832..cfc4edf8 100644 --- a/tests/unit/gapic/talent_v4/test_tenant_service.py +++ b/tests/unit/gapic/talent_v4/test_tenant_service.py @@ -87,8 +87,21 @@ def test__get_default_mtls_endpoint(): ) +def test_tenant_service_client_from_service_account_info(): + creds = credentials.AnonymousCredentials() + with mock.patch.object( + service_account.Credentials, "from_service_account_info" + ) as factory: + factory.return_value = creds + info = {"valid": True} + client = TenantServiceClient.from_service_account_info(info) + assert client.transport._credentials == creds + + assert client.transport._host == "jobs.googleapis.com:443" + + @pytest.mark.parametrize( - "client_class", [TenantServiceClient, TenantServiceAsyncClient] + "client_class", [TenantServiceClient, TenantServiceAsyncClient,] ) def test_tenant_service_client_from_service_account_file(client_class): creds = credentials.AnonymousCredentials() @@ -107,7 +120,10 @@ def test_tenant_service_client_from_service_account_file(client_class): def test_tenant_service_client_get_transport_class(): transport = TenantServiceClient.get_transport_class() - assert transport == transports.TenantServiceGrpcTransport + available_transports = [ + transports.TenantServiceGrpcTransport, + ] + assert transport in available_transports transport = TenantServiceClient.get_transport_class("grpc") assert transport == transports.TenantServiceGrpcTransport @@ -1731,7 +1747,7 @@ def test_tenant_service_host_with_port(): def test_tenant_service_grpc_transport_channel(): - channel = grpc.insecure_channel("http://localhost/") + channel = grpc.secure_channel("http://localhost/", grpc.local_channel_credentials()) # Check that channel is used if provided. transport = transports.TenantServiceGrpcTransport( @@ -1743,7 +1759,7 @@ def test_tenant_service_grpc_transport_channel(): def test_tenant_service_grpc_asyncio_transport_channel(): - channel = aio.insecure_channel("http://localhost/") + channel = aio.secure_channel("http://localhost/", grpc.local_channel_credentials()) # Check that channel is used if provided. transport = transports.TenantServiceGrpcAsyncIOTransport( @@ -1766,7 +1782,7 @@ def test_tenant_service_transport_channel_mtls_with_client_cert_source(transport "grpc.ssl_channel_credentials", autospec=True ) as grpc_ssl_channel_cred: with mock.patch.object( - transport_class, "create_channel", autospec=True + transport_class, "create_channel" ) as grpc_create_channel: mock_ssl_cred = mock.Mock() grpc_ssl_channel_cred.return_value = mock_ssl_cred @@ -1822,7 +1838,7 @@ def test_tenant_service_transport_channel_mtls_with_adc(transport_class): ssl_credentials=mock.PropertyMock(return_value=mock_ssl_cred), ): with mock.patch.object( - transport_class, "create_channel", autospec=True + transport_class, "create_channel" ) as grpc_create_channel: mock_grpc_channel = mock.Mock() grpc_create_channel.return_value = mock_grpc_channel diff --git a/tests/unit/gapic/talent_v4beta1/test_application_service.py b/tests/unit/gapic/talent_v4beta1/test_application_service.py index 9504a896..e1296286 100644 --- a/tests/unit/gapic/talent_v4beta1/test_application_service.py +++ b/tests/unit/gapic/talent_v4beta1/test_application_service.py @@ -96,8 +96,21 @@ def test__get_default_mtls_endpoint(): ) +def test_application_service_client_from_service_account_info(): + creds = credentials.AnonymousCredentials() + with mock.patch.object( + service_account.Credentials, "from_service_account_info" + ) as factory: + factory.return_value = creds + info = {"valid": True} + client = ApplicationServiceClient.from_service_account_info(info) + assert client.transport._credentials == creds + + assert client.transport._host == "jobs.googleapis.com:443" + + @pytest.mark.parametrize( - "client_class", [ApplicationServiceClient, ApplicationServiceAsyncClient] + "client_class", [ApplicationServiceClient, ApplicationServiceAsyncClient,] ) def test_application_service_client_from_service_account_file(client_class): creds = credentials.AnonymousCredentials() @@ -116,7 +129,10 @@ def test_application_service_client_from_service_account_file(client_class): def test_application_service_client_get_transport_class(): transport = ApplicationServiceClient.get_transport_class() - assert transport == transports.ApplicationServiceGrpcTransport + available_transports = [ + transports.ApplicationServiceGrpcTransport, + ] + assert transport in available_transports transport = ApplicationServiceClient.get_transport_class("grpc") assert transport == transports.ApplicationServiceGrpcTransport @@ -2037,7 +2053,7 @@ def test_application_service_host_with_port(): def test_application_service_grpc_transport_channel(): - channel = grpc.insecure_channel("http://localhost/") + channel = grpc.secure_channel("http://localhost/", grpc.local_channel_credentials()) # Check that channel is used if provided. transport = transports.ApplicationServiceGrpcTransport( @@ -2049,7 +2065,7 @@ def test_application_service_grpc_transport_channel(): def test_application_service_grpc_asyncio_transport_channel(): - channel = aio.insecure_channel("http://localhost/") + channel = aio.secure_channel("http://localhost/", grpc.local_channel_credentials()) # Check that channel is used if provided. transport = transports.ApplicationServiceGrpcAsyncIOTransport( @@ -2074,7 +2090,7 @@ def test_application_service_transport_channel_mtls_with_client_cert_source( "grpc.ssl_channel_credentials", autospec=True ) as grpc_ssl_channel_cred: with mock.patch.object( - transport_class, "create_channel", autospec=True + transport_class, "create_channel" ) as grpc_create_channel: mock_ssl_cred = mock.Mock() grpc_ssl_channel_cred.return_value = mock_ssl_cred @@ -2130,7 +2146,7 @@ def test_application_service_transport_channel_mtls_with_adc(transport_class): ssl_credentials=mock.PropertyMock(return_value=mock_ssl_cred), ): with mock.patch.object( - transport_class, "create_channel", autospec=True + transport_class, "create_channel" ) as grpc_create_channel: mock_grpc_channel = mock.Mock() grpc_create_channel.return_value = mock_grpc_channel diff --git a/tests/unit/gapic/talent_v4beta1/test_company_service.py b/tests/unit/gapic/talent_v4beta1/test_company_service.py index 603a1904..64314350 100644 --- a/tests/unit/gapic/talent_v4beta1/test_company_service.py +++ b/tests/unit/gapic/talent_v4beta1/test_company_service.py @@ -92,8 +92,21 @@ def test__get_default_mtls_endpoint(): ) +def test_company_service_client_from_service_account_info(): + creds = credentials.AnonymousCredentials() + with mock.patch.object( + service_account.Credentials, "from_service_account_info" + ) as factory: + factory.return_value = creds + info = {"valid": True} + client = CompanyServiceClient.from_service_account_info(info) + assert client.transport._credentials == creds + + assert client.transport._host == "jobs.googleapis.com:443" + + @pytest.mark.parametrize( - "client_class", [CompanyServiceClient, CompanyServiceAsyncClient] + "client_class", [CompanyServiceClient, CompanyServiceAsyncClient,] ) def test_company_service_client_from_service_account_file(client_class): creds = credentials.AnonymousCredentials() @@ -112,7 +125,10 @@ def test_company_service_client_from_service_account_file(client_class): def test_company_service_client_get_transport_class(): transport = CompanyServiceClient.get_transport_class() - assert transport == transports.CompanyServiceGrpcTransport + available_transports = [ + transports.CompanyServiceGrpcTransport, + ] + assert transport in available_transports transport = CompanyServiceClient.get_transport_class("grpc") assert transport == transports.CompanyServiceGrpcTransport @@ -1948,7 +1964,7 @@ def test_company_service_host_with_port(): def test_company_service_grpc_transport_channel(): - channel = grpc.insecure_channel("http://localhost/") + channel = grpc.secure_channel("http://localhost/", grpc.local_channel_credentials()) # Check that channel is used if provided. transport = transports.CompanyServiceGrpcTransport( @@ -1960,7 +1976,7 @@ def test_company_service_grpc_transport_channel(): def test_company_service_grpc_asyncio_transport_channel(): - channel = aio.insecure_channel("http://localhost/") + channel = aio.secure_channel("http://localhost/", grpc.local_channel_credentials()) # Check that channel is used if provided. transport = transports.CompanyServiceGrpcAsyncIOTransport( @@ -1985,7 +2001,7 @@ def test_company_service_transport_channel_mtls_with_client_cert_source( "grpc.ssl_channel_credentials", autospec=True ) as grpc_ssl_channel_cred: with mock.patch.object( - transport_class, "create_channel", autospec=True + transport_class, "create_channel" ) as grpc_create_channel: mock_ssl_cred = mock.Mock() grpc_ssl_channel_cred.return_value = mock_ssl_cred @@ -2041,7 +2057,7 @@ def test_company_service_transport_channel_mtls_with_adc(transport_class): ssl_credentials=mock.PropertyMock(return_value=mock_ssl_cred), ): with mock.patch.object( - transport_class, "create_channel", autospec=True + transport_class, "create_channel" ) as grpc_create_channel: mock_grpc_channel = mock.Mock() grpc_create_channel.return_value = mock_grpc_channel diff --git a/tests/unit/gapic/talent_v4beta1/test_completion.py b/tests/unit/gapic/talent_v4beta1/test_completion.py index b03a7da9..059d1ba9 100644 --- a/tests/unit/gapic/talent_v4beta1/test_completion.py +++ b/tests/unit/gapic/talent_v4beta1/test_completion.py @@ -81,7 +81,20 @@ def test__get_default_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_info(): + creds = credentials.AnonymousCredentials() + with mock.patch.object( + service_account.Credentials, "from_service_account_info" + ) as factory: + factory.return_value = creds + info = {"valid": True} + client = CompletionClient.from_service_account_info(info) + assert client.transport._credentials == creds + + assert client.transport._host == "jobs.googleapis.com:443" + + +@pytest.mark.parametrize("client_class", [CompletionClient, CompletionAsyncClient,]) def test_completion_client_from_service_account_file(client_class): creds = credentials.AnonymousCredentials() with mock.patch.object( @@ -99,7 +112,10 @@ def test_completion_client_from_service_account_file(client_class): def test_completion_client_get_transport_class(): transport = CompletionClient.get_transport_class() - assert transport == transports.CompletionGrpcTransport + available_transports = [ + transports.CompletionGrpcTransport, + ] + assert transport in available_transports transport = CompletionClient.get_transport_class("grpc") assert transport == transports.CompletionGrpcTransport @@ -603,7 +619,7 @@ def test_transport_get_channel(): @pytest.mark.parametrize( "transport_class", - [transports.CompletionGrpcTransport, transports.CompletionGrpcAsyncIOTransport], + [transports.CompletionGrpcTransport, transports.CompletionGrpcAsyncIOTransport,], ) def test_transport_adc(transport_class): # Test default credentials are used if not provided. @@ -729,7 +745,7 @@ def test_completion_host_with_port(): def test_completion_grpc_transport_channel(): - channel = grpc.insecure_channel("http://localhost/") + channel = grpc.secure_channel("http://localhost/", grpc.local_channel_credentials()) # Check that channel is used if provided. transport = transports.CompletionGrpcTransport( @@ -741,7 +757,7 @@ def test_completion_grpc_transport_channel(): def test_completion_grpc_asyncio_transport_channel(): - channel = aio.insecure_channel("http://localhost/") + channel = aio.secure_channel("http://localhost/", grpc.local_channel_credentials()) # Check that channel is used if provided. transport = transports.CompletionGrpcAsyncIOTransport( @@ -761,7 +777,7 @@ def test_completion_transport_channel_mtls_with_client_cert_source(transport_cla "grpc.ssl_channel_credentials", autospec=True ) as grpc_ssl_channel_cred: with mock.patch.object( - transport_class, "create_channel", autospec=True + transport_class, "create_channel" ) as grpc_create_channel: mock_ssl_cred = mock.Mock() grpc_ssl_channel_cred.return_value = mock_ssl_cred @@ -814,7 +830,7 @@ def test_completion_transport_channel_mtls_with_adc(transport_class): ssl_credentials=mock.PropertyMock(return_value=mock_ssl_cred), ): with mock.patch.object( - transport_class, "create_channel", autospec=True + transport_class, "create_channel" ) as grpc_create_channel: mock_grpc_channel = mock.Mock() grpc_create_channel.return_value = 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 index a5f2b7c0..3695cc12 100644 --- a/tests/unit/gapic/talent_v4beta1/test_event_service.py +++ b/tests/unit/gapic/talent_v4beta1/test_event_service.py @@ -82,7 +82,20 @@ def test__get_default_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_info(): + creds = credentials.AnonymousCredentials() + with mock.patch.object( + service_account.Credentials, "from_service_account_info" + ) as factory: + factory.return_value = creds + info = {"valid": True} + client = EventServiceClient.from_service_account_info(info) + assert client.transport._credentials == creds + + assert client.transport._host == "jobs.googleapis.com:443" + + +@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( @@ -100,7 +113,10 @@ def test_event_service_client_from_service_account_file(client_class): def test_event_service_client_get_transport_class(): transport = EventServiceClient.get_transport_class() - assert transport == transports.EventServiceGrpcTransport + available_transports = [ + transports.EventServiceGrpcTransport, + ] + assert transport in available_transports transport = EventServiceClient.get_transport_class("grpc") assert transport == transports.EventServiceGrpcTransport @@ -713,7 +729,10 @@ def test_transport_get_channel(): @pytest.mark.parametrize( "transport_class", - [transports.EventServiceGrpcTransport, transports.EventServiceGrpcAsyncIOTransport], + [ + transports.EventServiceGrpcTransport, + transports.EventServiceGrpcAsyncIOTransport, + ], ) def test_transport_adc(transport_class): # Test default credentials are used if not provided. @@ -839,7 +858,7 @@ def test_event_service_host_with_port(): def test_event_service_grpc_transport_channel(): - channel = grpc.insecure_channel("http://localhost/") + channel = grpc.secure_channel("http://localhost/", grpc.local_channel_credentials()) # Check that channel is used if provided. transport = transports.EventServiceGrpcTransport( @@ -851,7 +870,7 @@ def test_event_service_grpc_transport_channel(): def test_event_service_grpc_asyncio_transport_channel(): - channel = aio.insecure_channel("http://localhost/") + channel = aio.secure_channel("http://localhost/", grpc.local_channel_credentials()) # Check that channel is used if provided. transport = transports.EventServiceGrpcAsyncIOTransport( @@ -871,7 +890,7 @@ def test_event_service_transport_channel_mtls_with_client_cert_source(transport_ "grpc.ssl_channel_credentials", autospec=True ) as grpc_ssl_channel_cred: with mock.patch.object( - transport_class, "create_channel", autospec=True + transport_class, "create_channel" ) as grpc_create_channel: mock_ssl_cred = mock.Mock() grpc_ssl_channel_cred.return_value = mock_ssl_cred @@ -924,7 +943,7 @@ def test_event_service_transport_channel_mtls_with_adc(transport_class): ssl_credentials=mock.PropertyMock(return_value=mock_ssl_cred), ): with mock.patch.object( - transport_class, "create_channel", autospec=True + transport_class, "create_channel" ) as grpc_create_channel: mock_grpc_channel = mock.Mock() grpc_create_channel.return_value = 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 index 43896c99..4a239967 100644 --- a/tests/unit/gapic/talent_v4beta1/test_job_service.py +++ b/tests/unit/gapic/talent_v4beta1/test_job_service.py @@ -98,7 +98,20 @@ def test__get_default_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_info(): + creds = credentials.AnonymousCredentials() + with mock.patch.object( + service_account.Credentials, "from_service_account_info" + ) as factory: + factory.return_value = creds + info = {"valid": True} + client = JobServiceClient.from_service_account_info(info) + assert client.transport._credentials == creds + + assert client.transport._host == "jobs.googleapis.com:443" + + +@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( @@ -116,7 +129,10 @@ def test_job_service_client_from_service_account_file(client_class): def test_job_service_client_get_transport_class(): transport = JobServiceClient.get_transport_class() - assert transport == transports.JobServiceGrpcTransport + available_transports = [ + transports.JobServiceGrpcTransport, + ] + assert transport in available_transports transport = JobServiceClient.get_transport_class("grpc") assert transport == transports.JobServiceGrpcTransport @@ -3127,7 +3143,7 @@ def test_transport_get_channel(): @pytest.mark.parametrize( "transport_class", - [transports.JobServiceGrpcTransport, transports.JobServiceGrpcAsyncIOTransport], + [transports.JobServiceGrpcTransport, transports.JobServiceGrpcAsyncIOTransport,], ) def test_transport_adc(transport_class): # Test default credentials are used if not provided. @@ -3269,7 +3285,7 @@ def test_job_service_host_with_port(): def test_job_service_grpc_transport_channel(): - channel = grpc.insecure_channel("http://localhost/") + channel = grpc.secure_channel("http://localhost/", grpc.local_channel_credentials()) # Check that channel is used if provided. transport = transports.JobServiceGrpcTransport( @@ -3281,7 +3297,7 @@ def test_job_service_grpc_transport_channel(): def test_job_service_grpc_asyncio_transport_channel(): - channel = aio.insecure_channel("http://localhost/") + channel = aio.secure_channel("http://localhost/", grpc.local_channel_credentials()) # Check that channel is used if provided. transport = transports.JobServiceGrpcAsyncIOTransport( @@ -3301,7 +3317,7 @@ def test_job_service_transport_channel_mtls_with_client_cert_source(transport_cl "grpc.ssl_channel_credentials", autospec=True ) as grpc_ssl_channel_cred: with mock.patch.object( - transport_class, "create_channel", autospec=True + transport_class, "create_channel" ) as grpc_create_channel: mock_ssl_cred = mock.Mock() grpc_ssl_channel_cred.return_value = mock_ssl_cred @@ -3354,7 +3370,7 @@ def test_job_service_transport_channel_mtls_with_adc(transport_class): ssl_credentials=mock.PropertyMock(return_value=mock_ssl_cred), ): with mock.patch.object( - transport_class, "create_channel", autospec=True + transport_class, "create_channel" ) as grpc_create_channel: mock_grpc_channel = mock.Mock() grpc_create_channel.return_value = mock_grpc_channel diff --git a/tests/unit/gapic/talent_v4beta1/test_profile_service.py b/tests/unit/gapic/talent_v4beta1/test_profile_service.py index 136e0be1..b85f2de2 100644 --- a/tests/unit/gapic/talent_v4beta1/test_profile_service.py +++ b/tests/unit/gapic/talent_v4beta1/test_profile_service.py @@ -98,8 +98,21 @@ def test__get_default_mtls_endpoint(): ) +def test_profile_service_client_from_service_account_info(): + creds = credentials.AnonymousCredentials() + with mock.patch.object( + service_account.Credentials, "from_service_account_info" + ) as factory: + factory.return_value = creds + info = {"valid": True} + client = ProfileServiceClient.from_service_account_info(info) + assert client.transport._credentials == creds + + assert client.transport._host == "jobs.googleapis.com:443" + + @pytest.mark.parametrize( - "client_class", [ProfileServiceClient, ProfileServiceAsyncClient] + "client_class", [ProfileServiceClient, ProfileServiceAsyncClient,] ) def test_profile_service_client_from_service_account_file(client_class): creds = credentials.AnonymousCredentials() @@ -118,7 +131,10 @@ def test_profile_service_client_from_service_account_file(client_class): def test_profile_service_client_get_transport_class(): transport = ProfileServiceClient.get_transport_class() - assert transport == transports.ProfileServiceGrpcTransport + available_transports = [ + transports.ProfileServiceGrpcTransport, + ] + assert transport in available_transports transport = ProfileServiceClient.get_transport_class("grpc") assert transport == transports.ProfileServiceGrpcTransport @@ -2179,7 +2195,7 @@ def test_profile_service_host_with_port(): def test_profile_service_grpc_transport_channel(): - channel = grpc.insecure_channel("http://localhost/") + channel = grpc.secure_channel("http://localhost/", grpc.local_channel_credentials()) # Check that channel is used if provided. transport = transports.ProfileServiceGrpcTransport( @@ -2191,7 +2207,7 @@ def test_profile_service_grpc_transport_channel(): def test_profile_service_grpc_asyncio_transport_channel(): - channel = aio.insecure_channel("http://localhost/") + channel = aio.secure_channel("http://localhost/", grpc.local_channel_credentials()) # Check that channel is used if provided. transport = transports.ProfileServiceGrpcAsyncIOTransport( @@ -2216,7 +2232,7 @@ def test_profile_service_transport_channel_mtls_with_client_cert_source( "grpc.ssl_channel_credentials", autospec=True ) as grpc_ssl_channel_cred: with mock.patch.object( - transport_class, "create_channel", autospec=True + transport_class, "create_channel" ) as grpc_create_channel: mock_ssl_cred = mock.Mock() grpc_ssl_channel_cred.return_value = mock_ssl_cred @@ -2272,7 +2288,7 @@ def test_profile_service_transport_channel_mtls_with_adc(transport_class): ssl_credentials=mock.PropertyMock(return_value=mock_ssl_cred), ): with mock.patch.object( - transport_class, "create_channel", autospec=True + transport_class, "create_channel" ) as grpc_create_channel: mock_grpc_channel = mock.Mock() grpc_create_channel.return_value = mock_grpc_channel diff --git a/tests/unit/gapic/talent_v4beta1/test_tenant_service.py b/tests/unit/gapic/talent_v4beta1/test_tenant_service.py index 62a13dd4..183cbdc6 100644 --- a/tests/unit/gapic/talent_v4beta1/test_tenant_service.py +++ b/tests/unit/gapic/talent_v4beta1/test_tenant_service.py @@ -87,8 +87,21 @@ def test__get_default_mtls_endpoint(): ) +def test_tenant_service_client_from_service_account_info(): + creds = credentials.AnonymousCredentials() + with mock.patch.object( + service_account.Credentials, "from_service_account_info" + ) as factory: + factory.return_value = creds + info = {"valid": True} + client = TenantServiceClient.from_service_account_info(info) + assert client.transport._credentials == creds + + assert client.transport._host == "jobs.googleapis.com:443" + + @pytest.mark.parametrize( - "client_class", [TenantServiceClient, TenantServiceAsyncClient] + "client_class", [TenantServiceClient, TenantServiceAsyncClient,] ) def test_tenant_service_client_from_service_account_file(client_class): creds = credentials.AnonymousCredentials() @@ -107,7 +120,10 @@ def test_tenant_service_client_from_service_account_file(client_class): def test_tenant_service_client_get_transport_class(): transport = TenantServiceClient.get_transport_class() - assert transport == transports.TenantServiceGrpcTransport + available_transports = [ + transports.TenantServiceGrpcTransport, + ] + assert transport in available_transports transport = TenantServiceClient.get_transport_class("grpc") assert transport == transports.TenantServiceGrpcTransport @@ -1793,7 +1809,7 @@ def test_tenant_service_host_with_port(): def test_tenant_service_grpc_transport_channel(): - channel = grpc.insecure_channel("http://localhost/") + channel = grpc.secure_channel("http://localhost/", grpc.local_channel_credentials()) # Check that channel is used if provided. transport = transports.TenantServiceGrpcTransport( @@ -1805,7 +1821,7 @@ def test_tenant_service_grpc_transport_channel(): def test_tenant_service_grpc_asyncio_transport_channel(): - channel = aio.insecure_channel("http://localhost/") + channel = aio.secure_channel("http://localhost/", grpc.local_channel_credentials()) # Check that channel is used if provided. transport = transports.TenantServiceGrpcAsyncIOTransport( @@ -1828,7 +1844,7 @@ def test_tenant_service_transport_channel_mtls_with_client_cert_source(transport "grpc.ssl_channel_credentials", autospec=True ) as grpc_ssl_channel_cred: with mock.patch.object( - transport_class, "create_channel", autospec=True + transport_class, "create_channel" ) as grpc_create_channel: mock_ssl_cred = mock.Mock() grpc_ssl_channel_cred.return_value = mock_ssl_cred @@ -1884,7 +1900,7 @@ def test_tenant_service_transport_channel_mtls_with_adc(transport_class): ssl_credentials=mock.PropertyMock(return_value=mock_ssl_cred), ): with mock.patch.object( - transport_class, "create_channel", autospec=True + transport_class, "create_channel" ) as grpc_create_channel: mock_grpc_channel = mock.Mock() grpc_create_channel.return_value = mock_grpc_channel From 9d7ad7bd4894c4019602025820b3883ff89b254c Mon Sep 17 00:00:00 2001 From: yoshi-automation Date: Tue, 23 Mar 2021 18:40:34 -0700 Subject: [PATCH 04/38] feat: added client library for Workflows Executions V1 API PiperOrigin-RevId: 351618705 Source-Author: Google APIs Source-Date: Wed Jan 13 10:45:45 2021 -0800 Source-Repo: googleapis/googleapis Source-Sha: 98911d3e77f3d541eaa841252a44905ea4a430ab Source-Link: https://github.com/googleapis/googleapis/commit/98911d3e77f3d541eaa841252a44905ea4a430ab --- google/cloud/talent_v4/__init__.py | 4 ++-- google/cloud/talent_v4beta1/__init__.py | 4 ++-- synth.metadata | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/google/cloud/talent_v4/__init__.py b/google/cloud/talent_v4/__init__.py index b193e4de..9bf1bf95 100644 --- a/google/cloud/talent_v4/__init__.py +++ b/google/cloud/talent_v4/__init__.py @@ -95,7 +95,6 @@ "CommuteFilter", "CommuteMethod", "Company", - "CompanyServiceClient", "CompanySize", "CompensationFilter", "CompensationInfo", @@ -144,10 +143,11 @@ "SearchJobsResponse", "SpellingCorrection", "Tenant", + "TenantServiceClient", "TimestampRange", "UpdateCompanyRequest", "UpdateJobRequest", "UpdateTenantRequest", "Visibility", - "TenantServiceClient", + "CompanyServiceClient", ) diff --git a/google/cloud/talent_v4beta1/__init__.py b/google/cloud/talent_v4beta1/__init__.py index 9494115b..c7d0e217 100644 --- a/google/cloud/talent_v4beta1/__init__.py +++ b/google/cloud/talent_v4beta1/__init__.py @@ -143,6 +143,7 @@ "ApplicationDateFilter", "ApplicationJobFilter", "ApplicationOutcomeNotesFilter", + "ApplicationServiceClient", "AvailabilityFilter", "AvailabilitySignal", "AvailabilitySignalType", @@ -156,7 +157,6 @@ "CommuteFilter", "CommuteMethod", "Company", - "CompanyServiceClient", "CompanySize", "CompensationFilter", "CompensationInfo", @@ -253,5 +253,5 @@ "UpdateTenantRequest", "Visibility", "WorkExperienceFilter", - "ApplicationServiceClient", + "CompanyServiceClient", ) diff --git a/synth.metadata b/synth.metadata index f2dcc8c5..f81e6c9e 100644 --- a/synth.metadata +++ b/synth.metadata @@ -11,8 +11,8 @@ "git": { "name": "googleapis", "remote": "https://github.com/googleapis/googleapis.git", - "sha": "520682435235d9c503983a360a2090025aa47cd1", - "internalRef": "350246057" + "sha": "98911d3e77f3d541eaa841252a44905ea4a430ab", + "internalRef": "351618705" } }, { From e830b2d7fa826e29a74b3e4317a29d2e69a26e9b Mon Sep 17 00:00:00 2001 From: yoshi-automation Date: Tue, 23 Mar 2021 18:46:43 -0700 Subject: [PATCH 05/38] chore: update Go generator, rules_go, and protobuf PiperOrigin-RevId: 352816749 Source-Author: Google APIs Source-Date: Wed Jan 20 10:06:23 2021 -0800 Source-Repo: googleapis/googleapis Source-Sha: ceaaf31b3d13badab7cf9d3b570f5639db5593d9 Source-Link: https://github.com/googleapis/googleapis/commit/ceaaf31b3d13badab7cf9d3b570f5639db5593d9 --- .coveragerc | 31 +++- .kokoro/test-samples.sh | 8 +- .kokoro/trampoline_v2.sh | 2 +- docs/talent_v4/company_service.rst | 11 -- docs/talent_v4/completion.rst | 6 - docs/talent_v4/event_service.rst | 6 - docs/talent_v4/job_service.rst | 11 -- docs/talent_v4/services.rst | 22 ++- docs/talent_v4/tenant_service.rst | 11 -- docs/talent_v4/types.rst | 1 - docs/talent_v4beta1/application_service.rst | 11 -- docs/talent_v4beta1/company_service.rst | 11 -- docs/talent_v4beta1/completion.rst | 6 - docs/talent_v4beta1/event_service.rst | 6 - docs/talent_v4beta1/job_service.rst | 11 -- docs/talent_v4beta1/profile_service.rst | 11 -- docs/talent_v4beta1/services.rst | 30 +++- docs/talent_v4beta1/tenant_service.rst | 11 -- docs/talent_v4beta1/types.rst | 1 - google/cloud/talent_v4/__init__.py | 4 +- .../services/company_service/async_client.py | 31 ++-- .../services/company_service/client.py | 60 +++---- .../services/company_service/pagers.py | 16 +- .../services/completion/async_client.py | 5 +- .../talent_v4/services/completion/client.py | 26 +-- .../services/event_service/async_client.py | 9 +- .../services/event_service/client.py | 32 +--- .../services/job_service/async_client.py | 120 +++++++------ .../talent_v4/services/job_service/client.py | 159 ++++++++---------- .../talent_v4/services/job_service/pagers.py | 16 +- .../services/tenant_service/async_client.py | 31 ++-- .../services/tenant_service/client.py | 60 +++---- .../services/tenant_service/pagers.py | 16 +- google/cloud/talent_v4/types/common.py | 42 ++--- google/cloud/talent_v4/types/company.py | 6 +- .../cloud/talent_v4/types/company_service.py | 10 +- .../talent_v4/types/completion_service.py | 10 +- google/cloud/talent_v4/types/event.py | 6 +- google/cloud/talent_v4/types/event_service.py | 2 +- google/cloud/talent_v4/types/filters.py | 32 ++-- google/cloud/talent_v4/types/histogram.py | 2 +- google/cloud/talent_v4/types/job.py | 40 ++--- google/cloud/talent_v4/types/job_service.py | 62 +++---- .../cloud/talent_v4/types/tenant_service.py | 10 +- google/cloud/talent_v4beta1/__init__.py | 4 +- .../application_service/async_client.py | 29 ++-- .../services/application_service/client.py | 58 ++----- .../services/application_service/pagers.py | 16 +- .../services/company_service/async_client.py | 28 ++- .../services/company_service/client.py | 57 ++----- .../services/company_service/pagers.py | 16 +- .../services/completion/async_client.py | 5 +- .../services/completion/client.py | 26 +-- .../services/event_service/async_client.py | 9 +- .../services/event_service/client.py | 32 +--- .../services/job_service/async_client.py | 113 +++++++------ .../services/job_service/client.py | 152 ++++++++--------- .../services/job_service/pagers.py | 48 +++--- .../services/profile_service/async_client.py | 31 ++-- .../services/profile_service/client.py | 60 +++---- .../services/profile_service/pagers.py | 32 ++-- .../services/tenant_service/async_client.py | 28 ++- .../services/tenant_service/client.py | 57 ++----- .../services/tenant_service/pagers.py | 16 +- .../cloud/talent_v4beta1/types/application.py | 18 +- .../types/application_service.py | 10 +- google/cloud/talent_v4beta1/types/common.py | 54 +++--- google/cloud/talent_v4beta1/types/company.py | 6 +- .../talent_v4beta1/types/company_service.py | 10 +- .../types/completion_service.py | 10 +- google/cloud/talent_v4beta1/types/event.py | 10 +- .../talent_v4beta1/types/event_service.py | 2 +- google/cloud/talent_v4beta1/types/filters.py | 82 ++++----- .../cloud/talent_v4beta1/types/histogram.py | 2 +- google/cloud/talent_v4beta1/types/job.py | 40 ++--- .../cloud/talent_v4beta1/types/job_service.py | 58 +++---- google/cloud/talent_v4beta1/types/profile.py | 108 ++++++------ .../talent_v4beta1/types/profile_service.py | 28 +-- google/cloud/talent_v4beta1/types/tenant.py | 2 +- .../talent_v4beta1/types/tenant_service.py | 10 +- synth.metadata | 19 +-- .../gapic/talent_v4/test_company_service.py | 28 +-- tests/unit/gapic/talent_v4/test_completion.py | 30 +--- .../gapic/talent_v4/test_event_service.py | 33 +--- .../unit/gapic/talent_v4/test_job_service.py | 30 +--- .../gapic/talent_v4/test_tenant_service.py | 28 +-- .../test_application_service.py | 28 +-- .../talent_v4beta1/test_company_service.py | 28 +-- .../gapic/talent_v4beta1/test_completion.py | 30 +--- .../talent_v4beta1/test_event_service.py | 33 +--- .../gapic/talent_v4beta1/test_job_service.py | 30 +--- .../talent_v4beta1/test_profile_service.py | 28 +-- .../talent_v4beta1/test_tenant_service.py | 28 +-- 93 files changed, 1044 insertions(+), 1610 deletions(-) delete mode 100644 docs/talent_v4/company_service.rst delete mode 100644 docs/talent_v4/completion.rst delete mode 100644 docs/talent_v4/event_service.rst delete mode 100644 docs/talent_v4/job_service.rst delete mode 100644 docs/talent_v4/tenant_service.rst delete mode 100644 docs/talent_v4beta1/application_service.rst delete mode 100644 docs/talent_v4beta1/company_service.rst delete mode 100644 docs/talent_v4beta1/completion.rst delete mode 100644 docs/talent_v4beta1/event_service.rst delete mode 100644 docs/talent_v4beta1/job_service.rst delete mode 100644 docs/talent_v4beta1/profile_service.rst delete mode 100644 docs/talent_v4beta1/tenant_service.rst diff --git a/.coveragerc b/.coveragerc index 8a9e352c..dd39c854 100644 --- a/.coveragerc +++ b/.coveragerc @@ -1,18 +1,35 @@ +# -*- 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. + +# Generated by synthtool. DO NOT EDIT! [run] branch = True [report] fail_under = 100 show_missing = True -omit = - google/cloud/talent/__init__.py exclude_lines = # Re-enable the standard pragma pragma: NO COVER # Ignore debug-only repr def __repr__ - # Ignore pkg_resources exceptions. - # This is added at the module level as a safeguard for if someone - # generates the code and tries to run it without pip installing. This - # makes it virtually impossible to test properly. - except pkg_resources.DistributionNotFound + # Ignore abstract methods + raise NotImplementedError +omit = + */gapic/*.py + */proto/*.py + */core/*.py + */site-packages/*.py \ No newline at end of file diff --git a/.kokoro/test-samples.sh b/.kokoro/test-samples.sh index 4b0afc93..71fab05d 100755 --- a/.kokoro/test-samples.sh +++ b/.kokoro/test-samples.sh @@ -87,11 +87,11 @@ for file in samples/**/requirements.txt; do python3.6 -m nox -s "$RUN_TESTS_SESSION" EXIT=$? - # If this is a periodic build, send the test log to the Build Cop Bot. - # See https://github.com/googleapis/repo-automation-bots/tree/master/packages/buildcop. + # If this is a periodic build, send the test log to the FlakyBot. + # See https://github.com/googleapis/repo-automation-bots/tree/master/packages/flakybot. if [[ $KOKORO_BUILD_ARTIFACTS_SUBDIR = *"periodic"* ]]; then - chmod +x $KOKORO_GFILE_DIR/linux_amd64/buildcop - $KOKORO_GFILE_DIR/linux_amd64/buildcop + chmod +x $KOKORO_GFILE_DIR/linux_amd64/flakybot + $KOKORO_GFILE_DIR/linux_amd64/flakybot fi if [[ $EXIT -ne 0 ]]; then diff --git a/.kokoro/trampoline_v2.sh b/.kokoro/trampoline_v2.sh index 719bcd5b..4af6cdc2 100755 --- a/.kokoro/trampoline_v2.sh +++ b/.kokoro/trampoline_v2.sh @@ -159,7 +159,7 @@ if [[ -n "${KOKORO_BUILD_ID:-}" ]]; then "KOKORO_GITHUB_COMMIT" "KOKORO_GITHUB_PULL_REQUEST_NUMBER" "KOKORO_GITHUB_PULL_REQUEST_COMMIT" - # For Build Cop Bot + # For FlakyBot "KOKORO_GITHUB_COMMIT_URL" "KOKORO_GITHUB_PULL_REQUEST_URL" ) diff --git a/docs/talent_v4/company_service.rst b/docs/talent_v4/company_service.rst deleted file mode 100644 index f850f370..00000000 --- a/docs/talent_v4/company_service.rst +++ /dev/null @@ -1,11 +0,0 @@ -CompanyService --------------------------------- - -.. automodule:: google.cloud.talent_v4.services.company_service - :members: - :inherited-members: - - -.. automodule:: google.cloud.talent_v4.services.company_service.pagers - :members: - :inherited-members: diff --git a/docs/talent_v4/completion.rst b/docs/talent_v4/completion.rst deleted file mode 100644 index 3044c5a8..00000000 --- a/docs/talent_v4/completion.rst +++ /dev/null @@ -1,6 +0,0 @@ -Completion ----------------------------- - -.. automodule:: google.cloud.talent_v4.services.completion - :members: - :inherited-members: diff --git a/docs/talent_v4/event_service.rst b/docs/talent_v4/event_service.rst deleted file mode 100644 index 1c90bae1..00000000 --- a/docs/talent_v4/event_service.rst +++ /dev/null @@ -1,6 +0,0 @@ -EventService ------------------------------- - -.. automodule:: google.cloud.talent_v4.services.event_service - :members: - :inherited-members: diff --git a/docs/talent_v4/job_service.rst b/docs/talent_v4/job_service.rst deleted file mode 100644 index 28d73f01..00000000 --- a/docs/talent_v4/job_service.rst +++ /dev/null @@ -1,11 +0,0 @@ -JobService ----------------------------- - -.. automodule:: google.cloud.talent_v4.services.job_service - :members: - :inherited-members: - - -.. automodule:: google.cloud.talent_v4.services.job_service.pagers - :members: - :inherited-members: diff --git a/docs/talent_v4/services.rst b/docs/talent_v4/services.rst index b2eb192c..5efed8a2 100644 --- a/docs/talent_v4/services.rst +++ b/docs/talent_v4/services.rst @@ -1,10 +1,18 @@ Services for Google Cloud Talent v4 API ======================================= -.. toctree:: - :maxdepth: 2 - company_service - completion - event_service - job_service - tenant_service +.. automodule:: google.cloud.talent_v4.services.company_service + :members: + :inherited-members: +.. automodule:: google.cloud.talent_v4.services.completion + :members: + :inherited-members: +.. automodule:: google.cloud.talent_v4.services.event_service + :members: + :inherited-members: +.. automodule:: google.cloud.talent_v4.services.job_service + :members: + :inherited-members: +.. automodule:: google.cloud.talent_v4.services.tenant_service + :members: + :inherited-members: diff --git a/docs/talent_v4/tenant_service.rst b/docs/talent_v4/tenant_service.rst deleted file mode 100644 index d38c6bcd..00000000 --- a/docs/talent_v4/tenant_service.rst +++ /dev/null @@ -1,11 +0,0 @@ -TenantService -------------------------------- - -.. automodule:: google.cloud.talent_v4.services.tenant_service - :members: - :inherited-members: - - -.. automodule:: google.cloud.talent_v4.services.tenant_service.pagers - :members: - :inherited-members: diff --git a/docs/talent_v4/types.rst b/docs/talent_v4/types.rst index 9c08edc9..559524b9 100644 --- a/docs/talent_v4/types.rst +++ b/docs/talent_v4/types.rst @@ -3,5 +3,4 @@ Types for Google Cloud Talent v4 API .. automodule:: google.cloud.talent_v4.types :members: - :undoc-members: :show-inheritance: diff --git a/docs/talent_v4beta1/application_service.rst b/docs/talent_v4beta1/application_service.rst deleted file mode 100644 index 6539e8fd..00000000 --- a/docs/talent_v4beta1/application_service.rst +++ /dev/null @@ -1,11 +0,0 @@ -ApplicationService ------------------------------------- - -.. automodule:: google.cloud.talent_v4beta1.services.application_service - :members: - :inherited-members: - - -.. automodule:: google.cloud.talent_v4beta1.services.application_service.pagers - :members: - :inherited-members: diff --git a/docs/talent_v4beta1/company_service.rst b/docs/talent_v4beta1/company_service.rst deleted file mode 100644 index e2050c75..00000000 --- a/docs/talent_v4beta1/company_service.rst +++ /dev/null @@ -1,11 +0,0 @@ -CompanyService --------------------------------- - -.. automodule:: google.cloud.talent_v4beta1.services.company_service - :members: - :inherited-members: - - -.. automodule:: google.cloud.talent_v4beta1.services.company_service.pagers - :members: - :inherited-members: diff --git a/docs/talent_v4beta1/completion.rst b/docs/talent_v4beta1/completion.rst deleted file mode 100644 index 764a23f3..00000000 --- a/docs/talent_v4beta1/completion.rst +++ /dev/null @@ -1,6 +0,0 @@ -Completion ----------------------------- - -.. automodule:: google.cloud.talent_v4beta1.services.completion - :members: - :inherited-members: diff --git a/docs/talent_v4beta1/event_service.rst b/docs/talent_v4beta1/event_service.rst deleted file mode 100644 index 8e489d4c..00000000 --- a/docs/talent_v4beta1/event_service.rst +++ /dev/null @@ -1,6 +0,0 @@ -EventService ------------------------------- - -.. automodule:: google.cloud.talent_v4beta1.services.event_service - :members: - :inherited-members: diff --git a/docs/talent_v4beta1/job_service.rst b/docs/talent_v4beta1/job_service.rst deleted file mode 100644 index a78f4f32..00000000 --- a/docs/talent_v4beta1/job_service.rst +++ /dev/null @@ -1,11 +0,0 @@ -JobService ----------------------------- - -.. automodule:: google.cloud.talent_v4beta1.services.job_service - :members: - :inherited-members: - - -.. automodule:: google.cloud.talent_v4beta1.services.job_service.pagers - :members: - :inherited-members: diff --git a/docs/talent_v4beta1/profile_service.rst b/docs/talent_v4beta1/profile_service.rst deleted file mode 100644 index e558ed06..00000000 --- a/docs/talent_v4beta1/profile_service.rst +++ /dev/null @@ -1,11 +0,0 @@ -ProfileService --------------------------------- - -.. automodule:: google.cloud.talent_v4beta1.services.profile_service - :members: - :inherited-members: - - -.. automodule:: google.cloud.talent_v4beta1.services.profile_service.pagers - :members: - :inherited-members: diff --git a/docs/talent_v4beta1/services.rst b/docs/talent_v4beta1/services.rst index 019f928f..babbaa4e 100644 --- a/docs/talent_v4beta1/services.rst +++ b/docs/talent_v4beta1/services.rst @@ -1,12 +1,24 @@ Services for Google Cloud Talent v4beta1 API ============================================ -.. toctree:: - :maxdepth: 2 - application_service - company_service - completion - event_service - job_service - profile_service - tenant_service +.. 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/tenant_service.rst b/docs/talent_v4beta1/tenant_service.rst deleted file mode 100644 index 4de1dcfe..00000000 --- a/docs/talent_v4beta1/tenant_service.rst +++ /dev/null @@ -1,11 +0,0 @@ -TenantService -------------------------------- - -.. automodule:: google.cloud.talent_v4beta1.services.tenant_service - :members: - :inherited-members: - - -.. automodule:: google.cloud.talent_v4beta1.services.tenant_service.pagers - :members: - :inherited-members: diff --git a/docs/talent_v4beta1/types.rst b/docs/talent_v4beta1/types.rst index e6abbcac..170f4b18 100644 --- a/docs/talent_v4beta1/types.rst +++ b/docs/talent_v4beta1/types.rst @@ -3,5 +3,4 @@ Types for Google Cloud Talent v4beta1 API .. automodule:: google.cloud.talent_v4beta1.types :members: - :undoc-members: :show-inheritance: diff --git a/google/cloud/talent_v4/__init__.py b/google/cloud/talent_v4/__init__.py index 9bf1bf95..1d4b845e 100644 --- a/google/cloud/talent_v4/__init__.py +++ b/google/cloud/talent_v4/__init__.py @@ -95,6 +95,7 @@ "CommuteFilter", "CommuteMethod", "Company", + "CompanyServiceClient", "CompanySize", "CompensationFilter", "CompensationInfo", @@ -126,7 +127,6 @@ "JobLevel", "JobQuery", "JobResult", - "JobServiceClient", "JobView", "ListCompaniesRequest", "ListCompaniesResponse", @@ -149,5 +149,5 @@ "UpdateJobRequest", "UpdateTenantRequest", "Visibility", - "CompanyServiceClient", + "JobServiceClient", ) diff --git a/google/cloud/talent_v4/services/company_service/async_client.py b/google/cloud/talent_v4/services/company_service/async_client.py index ce76dc6c..dc84e1fd 100644 --- a/google/cloud/talent_v4/services/company_service/async_client.py +++ b/google/cloud/talent_v4/services/company_service/async_client.py @@ -84,7 +84,6 @@ class CompanyServiceAsyncClient: CompanyServiceClient.parse_common_location_path ) - from_service_account_info = CompanyServiceClient.from_service_account_info from_service_account_file = CompanyServiceClient.from_service_account_file from_service_account_json = from_service_account_file @@ -162,7 +161,7 @@ async def create_company( r"""Creates a new company entity. Args: - request (:class:`google.cloud.talent_v4.types.CreateCompanyRequest`): + request (:class:`~.company_service.CreateCompanyRequest`): The request object. The Request of the CreateCompany method. parent (:class:`str`): @@ -172,11 +171,10 @@ async def create_company( 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. - company (:class:`google.cloud.talent_v4.types.Company`): + 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 @@ -189,7 +187,7 @@ async def create_company( sent along with the request as metadata. Returns: - google.cloud.talent_v4.types.Company: + ~.gct_company.Company: A Company resource represents a company in the service. A company is the entity that owns job postings, that is, @@ -250,7 +248,7 @@ async def get_company( r"""Retrieves specified company. Args: - request (:class:`google.cloud.talent_v4.types.GetCompanyRequest`): + request (:class:`~.company_service.GetCompanyRequest`): The request object. Request for getting a company by name. name (:class:`str`): @@ -261,7 +259,6 @@ async def get_company( "projects/{project_id}/tenants/{tenant_id}/companies/{company_id}", for example, "projects/api-test-project/tenants/foo/companies/bar". - This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -273,7 +270,7 @@ async def get_company( sent along with the request as metadata. Returns: - google.cloud.talent_v4.types.Company: + ~.company.Company: A Company resource represents a company in the service. A company is the entity that owns job postings, that is, @@ -341,18 +338,17 @@ async def update_company( r"""Updates specified company. Args: - request (:class:`google.cloud.talent_v4.types.UpdateCompanyRequest`): + request (:class:`~.company_service.UpdateCompanyRequest`): The request object. Request for updating a specified company. - company (:class:`google.cloud.talent_v4.types.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. - update_mask (:class:`google.protobuf.field_mask_pb2.FieldMask`): + update_mask (:class:`~.field_mask.FieldMask`): Strongly recommended for the best service experience. If @@ -364,7 +360,6 @@ async def update_company( A field mask to specify the company fields to be updated. Only top level fields of [Company][google.cloud.talent.v4.Company] are supported. - This corresponds to the ``update_mask`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -376,7 +371,7 @@ async def update_company( sent along with the request as metadata. Returns: - google.cloud.talent_v4.types.Company: + ~.gct_company.Company: A Company resource represents a company in the service. A company is the entity that owns job postings, that is, @@ -441,7 +436,7 @@ async def delete_company( it. Args: - request (:class:`google.cloud.talent_v4.types.DeleteCompanyRequest`): + 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 @@ -450,7 +445,6 @@ async def delete_company( The format is "projects/{project_id}/tenants/{tenant_id}/companies/{company_id}", for example, "projects/foo/tenants/bar/companies/baz". - This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -518,7 +512,7 @@ async def list_companies( r"""Lists all companies associated with the project. Args: - request (:class:`google.cloud.talent_v4.types.ListCompaniesRequest`): + request (:class:`~.company_service.ListCompaniesRequest`): The request object. List companies for which the client has ACL visibility. parent (:class:`str`): @@ -528,7 +522,6 @@ async def list_companies( 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. @@ -540,7 +533,7 @@ async def list_companies( sent along with the request as metadata. Returns: - google.cloud.talent_v4.services.company_service.pagers.ListCompaniesAsyncPager: + ~.pagers.ListCompaniesAsyncPager: The List companies response object. Iterating over this object will yield results and resolve additional pages diff --git a/google/cloud/talent_v4/services/company_service/client.py b/google/cloud/talent_v4/services/company_service/client.py index 8cc6a72f..7b32d9b6 100644 --- a/google/cloud/talent_v4/services/company_service/client.py +++ b/google/cloud/talent_v4/services/company_service/client.py @@ -116,22 +116,6 @@ def _get_default_mtls_endpoint(api_endpoint): DEFAULT_ENDPOINT ) - @classmethod - def from_service_account_info(cls, info: dict, *args, **kwargs): - """Creates an instance of this client using the provided credentials info. - - Args: - info (dict): The service account private key info. - args: Additional arguments to pass to the constructor. - kwargs: Additional arguments to pass to the constructor. - - Returns: - CompanyServiceClient: The constructed client. - """ - credentials = service_account.Credentials.from_service_account_info(info) - kwargs["credentials"] = credentials - return cls(*args, **kwargs) - @classmethod def from_service_account_file(cls, filename: str, *args, **kwargs): """Creates an instance of this client using the provided credentials @@ -144,7 +128,7 @@ def from_service_account_file(cls, filename: str, *args, **kwargs): kwargs: Additional arguments to pass to the constructor. Returns: - CompanyServiceClient: The constructed client. + {@api.name}: The constructed client. """ credentials = service_account.Credentials.from_service_account_file(filename) kwargs["credentials"] = credentials @@ -265,10 +249,10 @@ def __init__( 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 (Union[str, ~.CompanyServiceTransport]): The transport to use. If set to None, a transport is chosen automatically. - client_options (google.api_core.client_options.ClientOptions): Custom options for the + client_options (client_options_lib.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_ENDPOINT @@ -379,21 +363,20 @@ def create_company( r"""Creates a new company entity. Args: - request (google.cloud.talent_v4.types.CreateCompanyRequest): + request (:class:`~.company_service.CreateCompanyRequest`): The request object. The Request of the CreateCompany method. - parent (str): + 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/tenants/bar". - This corresponds to the ``parent`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - company (google.cloud.talent_v4.types.Company): + 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 @@ -406,7 +389,7 @@ def create_company( sent along with the request as metadata. Returns: - google.cloud.talent_v4.types.Company: + ~.gct_company.Company: A Company resource represents a company in the service. A company is the entity that owns job postings, that is, @@ -468,10 +451,10 @@ def get_company( r"""Retrieves specified company. Args: - request (google.cloud.talent_v4.types.GetCompanyRequest): + request (:class:`~.company_service.GetCompanyRequest`): The request object. Request for getting a company by name. - name (str): + name (:class:`str`): Required. The resource name of the company to be retrieved. @@ -479,7 +462,6 @@ def get_company( "projects/{project_id}/tenants/{tenant_id}/companies/{company_id}", for example, "projects/api-test-project/tenants/foo/companies/bar". - This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -491,7 +473,7 @@ def get_company( sent along with the request as metadata. Returns: - google.cloud.talent_v4.types.Company: + ~.company.Company: A Company resource represents a company in the service. A company is the entity that owns job postings, that is, @@ -552,18 +534,17 @@ def update_company( r"""Updates specified company. Args: - request (google.cloud.talent_v4.types.UpdateCompanyRequest): + request (:class:`~.company_service.UpdateCompanyRequest`): The request object. Request for updating a specified company. - company (google.cloud.talent_v4.types.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. - update_mask (google.protobuf.field_mask_pb2.FieldMask): + update_mask (:class:`~.field_mask.FieldMask`): Strongly recommended for the best service experience. If @@ -575,7 +556,6 @@ def update_company( A field mask to specify the company fields to be updated. Only top level fields of [Company][google.cloud.talent.v4.Company] are supported. - This corresponds to the ``update_mask`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -587,7 +567,7 @@ def update_company( sent along with the request as metadata. Returns: - google.cloud.talent_v4.types.Company: + ~.gct_company.Company: A Company resource represents a company in the service. A company is the entity that owns job postings, that is, @@ -653,16 +633,15 @@ def delete_company( it. Args: - request (google.cloud.talent_v4.types.DeleteCompanyRequest): + request (:class:`~.company_service.DeleteCompanyRequest`): The request object. Request to delete a company. - name (str): + 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". - This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -723,17 +702,16 @@ def list_companies( r"""Lists all companies associated with the project. Args: - request (google.cloud.talent_v4.types.ListCompaniesRequest): + request (:class:`~.company_service.ListCompaniesRequest`): The request object. List companies for which the client has ACL visibility. - parent (str): + 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/tenants/bar". - This corresponds to the ``parent`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -745,7 +723,7 @@ def list_companies( sent along with the request as metadata. Returns: - google.cloud.talent_v4.services.company_service.pagers.ListCompaniesPager: + ~.pagers.ListCompaniesPager: The List companies response object. Iterating over this object will yield results and resolve additional pages diff --git a/google/cloud/talent_v4/services/company_service/pagers.py b/google/cloud/talent_v4/services/company_service/pagers.py index a9eafc75..992c4b53 100644 --- a/google/cloud/talent_v4/services/company_service/pagers.py +++ b/google/cloud/talent_v4/services/company_service/pagers.py @@ -25,7 +25,7 @@ class ListCompaniesPager: """A pager for iterating through ``list_companies`` requests. This class thinly wraps an initial - :class:`google.cloud.talent_v4.types.ListCompaniesResponse` object, and + :class:`~.company_service.ListCompaniesResponse` object, and provides an ``__iter__`` method to iterate through its ``companies`` field. @@ -34,7 +34,7 @@ class ListCompaniesPager: through the ``companies`` field on the corresponding responses. - All the usual :class:`google.cloud.talent_v4.types.ListCompaniesResponse` + 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. """ @@ -52,9 +52,9 @@ def __init__( Args: method (Callable): The method that was originally called, and which instantiated this pager. - request (google.cloud.talent_v4.types.ListCompaniesRequest): + request (:class:`~.company_service.ListCompaniesRequest`): The initial request object. - response (google.cloud.talent_v4.types.ListCompaniesResponse): + 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. @@ -87,7 +87,7 @@ class ListCompaniesAsyncPager: """A pager for iterating through ``list_companies`` requests. This class thinly wraps an initial - :class:`google.cloud.talent_v4.types.ListCompaniesResponse` object, and + :class:`~.company_service.ListCompaniesResponse` object, and provides an ``__aiter__`` method to iterate through its ``companies`` field. @@ -96,7 +96,7 @@ class ListCompaniesAsyncPager: through the ``companies`` field on the corresponding responses. - All the usual :class:`google.cloud.talent_v4.types.ListCompaniesResponse` + 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. """ @@ -114,9 +114,9 @@ def __init__( Args: method (Callable): The method that was originally called, and which instantiated this pager. - request (google.cloud.talent_v4.types.ListCompaniesRequest): + request (:class:`~.company_service.ListCompaniesRequest`): The initial request object. - response (google.cloud.talent_v4.types.ListCompaniesResponse): + 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. diff --git a/google/cloud/talent_v4/services/completion/async_client.py b/google/cloud/talent_v4/services/completion/async_client.py index 778ebbd2..2c91e861 100644 --- a/google/cloud/talent_v4/services/completion/async_client.py +++ b/google/cloud/talent_v4/services/completion/async_client.py @@ -72,7 +72,6 @@ class CompletionAsyncClient: CompletionClient.parse_common_location_path ) - from_service_account_info = CompletionClient.from_service_account_info from_service_account_file = CompletionClient.from_service_account_file from_service_account_json = from_service_account_file @@ -150,7 +149,7 @@ async def complete_query( complete search box. Args: - request (:class:`google.cloud.talent_v4.types.CompleteQueryRequest`): + request (:class:`~.completion_service.CompleteQueryRequest`): The request object. Auto-complete parameters. retry (google.api_core.retry.Retry): Designation of what errors, if any, @@ -160,7 +159,7 @@ async def complete_query( sent along with the request as metadata. Returns: - google.cloud.talent_v4.types.CompleteQueryResponse: + ~.completion_service.CompleteQueryResponse: Response of auto-complete query. """ # Create or coerce a protobuf request object. diff --git a/google/cloud/talent_v4/services/completion/client.py b/google/cloud/talent_v4/services/completion/client.py index 0d4eb789..3d3b0589 100644 --- a/google/cloud/talent_v4/services/completion/client.py +++ b/google/cloud/talent_v4/services/completion/client.py @@ -108,22 +108,6 @@ def _get_default_mtls_endpoint(api_endpoint): DEFAULT_ENDPOINT ) - @classmethod - def from_service_account_info(cls, info: dict, *args, **kwargs): - """Creates an instance of this client using the provided credentials info. - - Args: - info (dict): The service account private key info. - args: Additional arguments to pass to the constructor. - kwargs: Additional arguments to pass to the constructor. - - Returns: - CompletionClient: The constructed client. - """ - credentials = service_account.Credentials.from_service_account_info(info) - kwargs["credentials"] = credentials - return cls(*args, **kwargs) - @classmethod def from_service_account_file(cls, filename: str, *args, **kwargs): """Creates an instance of this client using the provided credentials @@ -136,7 +120,7 @@ def from_service_account_file(cls, filename: str, *args, **kwargs): kwargs: Additional arguments to pass to the constructor. Returns: - CompletionClient: The constructed client. + {@api.name}: The constructed client. """ credentials = service_account.Credentials.from_service_account_file(filename) kwargs["credentials"] = credentials @@ -257,10 +241,10 @@ def __init__( 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 (Union[str, ~.CompletionTransport]): The transport to use. If set to None, a transport is chosen automatically. - client_options (google.api_core.client_options.ClientOptions): Custom options for the + client_options (client_options_lib.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_ENDPOINT @@ -371,7 +355,7 @@ def complete_query( complete search box. Args: - request (google.cloud.talent_v4.types.CompleteQueryRequest): + request (:class:`~.completion_service.CompleteQueryRequest`): The request object. Auto-complete parameters. retry (google.api_core.retry.Retry): Designation of what errors, if any, @@ -381,7 +365,7 @@ def complete_query( sent along with the request as metadata. Returns: - google.cloud.talent_v4.types.CompleteQueryResponse: + ~.completion_service.CompleteQueryResponse: Response of auto-complete query. """ # Create or coerce a protobuf request object. diff --git a/google/cloud/talent_v4/services/event_service/async_client.py b/google/cloud/talent_v4/services/event_service/async_client.py index e5c364f0..8a6a6e41 100644 --- a/google/cloud/talent_v4/services/event_service/async_client.py +++ b/google/cloud/talent_v4/services/event_service/async_client.py @@ -73,7 +73,6 @@ class EventServiceAsyncClient: EventServiceClient.parse_common_location_path ) - from_service_account_info = EventServiceClient.from_service_account_info from_service_account_file = EventServiceClient.from_service_account_file from_service_account_json = from_service_account_file @@ -157,7 +156,7 @@ async def create_client_event( about self service tools. Args: - request (:class:`google.cloud.talent_v4.types.CreateClientEventRequest`): + request (:class:`~.event_service.CreateClientEventRequest`): The request object. The report event request. parent (:class:`str`): Required. Resource name of the tenant under which the @@ -166,15 +165,13 @@ async def create_client_event( 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. - client_event (:class:`google.cloud.talent_v4.types.ClientEvent`): + 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. @@ -186,7 +183,7 @@ async def create_client_event( sent along with the request as metadata. Returns: - google.cloud.talent_v4.types.ClientEvent: + ~.event.ClientEvent: An event issued when an end user interacts with the application that implements Cloud Talent Solution. diff --git a/google/cloud/talent_v4/services/event_service/client.py b/google/cloud/talent_v4/services/event_service/client.py index d962a574..06f1fd4f 100644 --- a/google/cloud/talent_v4/services/event_service/client.py +++ b/google/cloud/talent_v4/services/event_service/client.py @@ -109,22 +109,6 @@ def _get_default_mtls_endpoint(api_endpoint): DEFAULT_ENDPOINT ) - @classmethod - def from_service_account_info(cls, info: dict, *args, **kwargs): - """Creates an instance of this client using the provided credentials info. - - Args: - info (dict): The service account private key info. - args: Additional arguments to pass to the constructor. - kwargs: Additional arguments to pass to the constructor. - - Returns: - EventServiceClient: The constructed client. - """ - credentials = service_account.Credentials.from_service_account_info(info) - kwargs["credentials"] = credentials - return cls(*args, **kwargs) - @classmethod def from_service_account_file(cls, filename: str, *args, **kwargs): """Creates an instance of this client using the provided credentials @@ -137,7 +121,7 @@ def from_service_account_file(cls, filename: str, *args, **kwargs): kwargs: Additional arguments to pass to the constructor. Returns: - EventServiceClient: The constructed client. + {@api.name}: The constructed client. """ credentials = service_account.Credentials.from_service_account_file(filename) kwargs["credentials"] = credentials @@ -242,10 +226,10 @@ def __init__( 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 (Union[str, ~.EventServiceTransport]): The transport to use. If set to None, a transport is chosen automatically. - client_options (google.api_core.client_options.ClientOptions): Custom options for the + client_options (client_options_lib.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_ENDPOINT @@ -362,24 +346,22 @@ def create_client_event( about self service tools. Args: - request (google.cloud.talent_v4.types.CreateClientEventRequest): + request (:class:`~.event_service.CreateClientEventRequest`): The request object. The report event request. - parent (str): + 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/tenants/bar". - This corresponds to the ``parent`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - client_event (google.cloud.talent_v4.types.ClientEvent): + 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. @@ -391,7 +373,7 @@ def create_client_event( sent along with the request as metadata. Returns: - google.cloud.talent_v4.types.ClientEvent: + ~.event.ClientEvent: An event issued when an end user interacts with the application that implements Cloud Talent Solution. diff --git a/google/cloud/talent_v4/services/job_service/async_client.py b/google/cloud/talent_v4/services/job_service/async_client.py index 88e0e7ca..ec420503 100644 --- a/google/cloud/talent_v4/services/job_service/async_client.py +++ b/google/cloud/talent_v4/services/job_service/async_client.py @@ -84,7 +84,6 @@ class JobServiceAsyncClient: JobServiceClient.parse_common_location_path ) - from_service_account_info = JobServiceClient.from_service_account_info from_service_account_file = JobServiceClient.from_service_account_file from_service_account_json = from_service_account_file @@ -164,7 +163,7 @@ async def create_job( but it may take up to 5 minutes. Args: - request (:class:`google.cloud.talent_v4.types.CreateJobRequest`): + request (:class:`~.job_service.CreateJobRequest`): The request object. Create job request. parent (:class:`str`): Required. The resource name of the tenant under which @@ -173,11 +172,10 @@ async def create_job( 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. - job (:class:`google.cloud.talent_v4.types.Job`): + 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 @@ -190,11 +188,11 @@ async def create_job( sent along with the request as metadata. Returns: - google.cloud.talent_v4.types.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.v4.Company], which is - the hiring entity responsible for the job. + ~.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.v4.Company], + which is the hiring entity responsible for the job. """ # Create or coerce a protobuf request object. @@ -250,7 +248,7 @@ async def batch_create_jobs( r"""Begins executing a batch create jobs operation. Args: - request (:class:`google.cloud.talent_v4.types.BatchCreateJobsRequest`): + 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 @@ -259,15 +257,13 @@ async def batch_create_jobs( 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. - jobs (:class:`Sequence[google.cloud.talent_v4.types.Job]`): + jobs (:class:`Sequence[~.job.Job]`): Required. The jobs to be created. A maximum of 200 jobs can be created in a batch. - This corresponds to the ``jobs`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -279,13 +275,16 @@ async def batch_create_jobs( sent along with the request as metadata. Returns: - google.api_core.operation_async.AsyncOperation: + ~.operation_async.AsyncOperation: An object representing a long-running operation. - The result type for the operation will be :class:`google.cloud.talent_v4.types.BatchCreateJobsResponse` The result of [JobService.BatchCreateJobs][google.cloud.talent.v4.JobService.BatchCreateJobs]. It's used to - replace - [google.longrunning.Operation.response][google.longrunning.Operation.response] - in case of success. + The result type for the operation will be + :class:``~.job_service.BatchCreateJobsResponse``: The + result of + [JobService.BatchCreateJobs][google.cloud.talent.v4.JobService.BatchCreateJobs]. + It's used to replace + [google.longrunning.Operation.response][google.longrunning.Operation.response] + in case of success. """ # Create or coerce a protobuf request object. @@ -350,7 +349,7 @@ async def get_job( recently EXPIRED within the last 90 days. Args: - request (:class:`google.cloud.talent_v4.types.GetJobRequest`): + request (:class:`~.job_service.GetJobRequest`): The request object. Get job request. name (:class:`str`): Required. The resource name of the job to retrieve. @@ -358,7 +357,6 @@ async def get_job( The format is "projects/{project_id}/tenants/{tenant_id}/jobs/{job_id}". For example, "projects/foo/tenants/bar/jobs/baz". - This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -370,11 +368,11 @@ async def get_job( sent along with the request as metadata. Returns: - google.cloud.talent_v4.types.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.v4.Company], which is - the hiring entity responsible for the job. + ~.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.v4.Company], + which is the hiring entity responsible for the job. """ # Create or coerce a protobuf request object. @@ -439,14 +437,14 @@ async def update_job( minutes. Args: - request (:class:`google.cloud.talent_v4.types.UpdateJobRequest`): + request (:class:`~.job_service.UpdateJobRequest`): The request object. Update job request. - job (:class:`google.cloud.talent_v4.types.Job`): + 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. - update_mask (:class:`google.protobuf.field_mask_pb2.FieldMask`): + update_mask (:class:`~.field_mask.FieldMask`): Strongly recommended for the best service experience. If @@ -458,7 +456,6 @@ async def update_job( A field mask to restrict the fields that are updated. Only top level fields of [Job][google.cloud.talent.v4.Job] are supported. - This corresponds to the ``update_mask`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -470,11 +467,11 @@ async def update_job( sent along with the request as metadata. Returns: - google.cloud.talent_v4.types.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.v4.Company], which is - the hiring entity responsible for the job. + ~.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.v4.Company], + which is the hiring entity responsible for the job. """ # Create or coerce a protobuf request object. @@ -530,7 +527,7 @@ async def batch_update_jobs( r"""Begins executing a batch update jobs operation. Args: - request (:class:`google.cloud.talent_v4.types.BatchUpdateJobsRequest`): + 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 @@ -539,15 +536,13 @@ async def batch_update_jobs( 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. - jobs (:class:`Sequence[google.cloud.talent_v4.types.Job]`): + jobs (:class:`Sequence[~.job.Job]`): Required. The jobs to be updated. A maximum of 200 jobs can be updated in a batch. - This corresponds to the ``jobs`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -559,13 +554,16 @@ async def batch_update_jobs( sent along with the request as metadata. Returns: - google.api_core.operation_async.AsyncOperation: + ~.operation_async.AsyncOperation: An object representing a long-running operation. - The result type for the operation will be :class:`google.cloud.talent_v4.types.BatchUpdateJobsResponse` The result of [JobService.BatchUpdateJobs][google.cloud.talent.v4.JobService.BatchUpdateJobs]. It's used to - replace - [google.longrunning.Operation.response][google.longrunning.Operation.response] - in case of success. + The result type for the operation will be + :class:``~.job_service.BatchUpdateJobsResponse``: The + result of + [JobService.BatchUpdateJobs][google.cloud.talent.v4.JobService.BatchUpdateJobs]. + It's used to replace + [google.longrunning.Operation.response][google.longrunning.Operation.response] + in case of success. """ # Create or coerce a protobuf request object. @@ -631,7 +629,7 @@ async def delete_job( seconds, but it may take up to 5 minutes. Args: - request (:class:`google.cloud.talent_v4.types.DeleteJobRequest`): + request (:class:`~.job_service.DeleteJobRequest`): The request object. Delete job request. name (:class:`str`): Required. The resource name of the job to be deleted. @@ -639,7 +637,6 @@ async def delete_job( The format is "projects/{project_id}/tenants/{tenant_id}/jobs/{job_id}". For example, "projects/foo/tenants/bar/jobs/baz". - This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -708,7 +705,7 @@ async def batch_delete_jobs( r"""Begins executing a batch delete jobs operation. Args: - request (:class:`google.cloud.talent_v4.types.BatchDeleteJobsRequest`): + request (:class:`~.job_service.BatchDeleteJobsRequest`): The request object. Request to delete a batch of jobs. parent (:class:`str`): Required. The resource name of the tenant under which @@ -720,7 +717,6 @@ async def batch_delete_jobs( The parent of all of the jobs specified in ``names`` must match this field. - This corresponds to the ``parent`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -732,7 +728,6 @@ async def batch_delete_jobs( For example, "projects/foo/tenants/bar/jobs/baz". A maximum of 200 jobs can be deleted in a batch. - This corresponds to the ``names`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -744,13 +739,16 @@ async def batch_delete_jobs( sent along with the request as metadata. Returns: - google.api_core.operation_async.AsyncOperation: + ~.operation_async.AsyncOperation: An object representing a long-running operation. - The result type for the operation will be :class:`google.cloud.talent_v4.types.BatchDeleteJobsResponse` The result of [JobService.BatchDeleteJobs][google.cloud.talent.v4.JobService.BatchDeleteJobs]. It's used to - replace - [google.longrunning.Operation.response][google.longrunning.Operation.response] - in case of success. + The result type for the operation will be + :class:``~.job_service.BatchDeleteJobsResponse``: The + result of + [JobService.BatchDeleteJobs][google.cloud.talent.v4.JobService.BatchDeleteJobs]. + It's used to replace + [google.longrunning.Operation.response][google.longrunning.Operation.response] + in case of success. """ # Create or coerce a protobuf request object. @@ -815,7 +813,7 @@ async def list_jobs( r"""Lists jobs by filter. Args: - request (:class:`google.cloud.talent_v4.types.ListJobsRequest`): + request (:class:`~.job_service.ListJobsRequest`): The request object. List jobs request. parent (:class:`str`): Required. The resource name of the tenant under which @@ -824,7 +822,6 @@ async def list_jobs( 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. @@ -850,8 +847,7 @@ async def list_jobs( requisitionId = "req-1" - companyName = "projects/foo/tenants/bar/companies/baz" AND status = - "EXPIRED" - + "EXPIRED". This corresponds to the ``filter`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -863,7 +859,7 @@ async def list_jobs( sent along with the request as metadata. Returns: - google.cloud.talent_v4.services.job_service.pagers.ListJobsAsyncPager: + ~.pagers.ListJobsAsyncPager: List jobs response. Iterating over this object will yield results and resolve additional pages @@ -941,7 +937,7 @@ async def search_jobs( has permission to search against. Args: - request (:class:`google.cloud.talent_v4.types.SearchJobsRequest`): + request (:class:`~.job_service.SearchJobsRequest`): The request object. The Request body of the `SearchJobs` call. @@ -952,7 +948,7 @@ async def search_jobs( sent along with the request as metadata. Returns: - google.cloud.talent_v4.types.SearchJobsResponse: + ~.job_service.SearchJobsResponse: Response for SearchJob method. """ # Create or coerce a protobuf request object. @@ -1002,7 +998,7 @@ async def search_jobs_for_alert( permission to search against. Args: - request (:class:`google.cloud.talent_v4.types.SearchJobsRequest`): + request (:class:`~.job_service.SearchJobsRequest`): The request object. The Request body of the `SearchJobs` call. @@ -1013,7 +1009,7 @@ async def search_jobs_for_alert( sent along with the request as metadata. Returns: - google.cloud.talent_v4.types.SearchJobsResponse: + ~.job_service.SearchJobsResponse: Response for SearchJob method. """ # Create or coerce a protobuf request object. diff --git a/google/cloud/talent_v4/services/job_service/client.py b/google/cloud/talent_v4/services/job_service/client.py index ea5bff91..0e8ec2b0 100644 --- a/google/cloud/talent_v4/services/job_service/client.py +++ b/google/cloud/talent_v4/services/job_service/client.py @@ -118,22 +118,6 @@ def _get_default_mtls_endpoint(api_endpoint): DEFAULT_ENDPOINT ) - @classmethod - def from_service_account_info(cls, info: dict, *args, **kwargs): - """Creates an instance of this client using the provided credentials info. - - Args: - info (dict): The service account private key info. - args: Additional arguments to pass to the constructor. - kwargs: Additional arguments to pass to the constructor. - - Returns: - JobServiceClient: The constructed client. - """ - credentials = service_account.Credentials.from_service_account_info(info) - kwargs["credentials"] = credentials - return cls(*args, **kwargs) - @classmethod def from_service_account_file(cls, filename: str, *args, **kwargs): """Creates an instance of this client using the provided credentials @@ -146,7 +130,7 @@ def from_service_account_file(cls, filename: str, *args, **kwargs): kwargs: Additional arguments to pass to the constructor. Returns: - JobServiceClient: The constructed client. + {@api.name}: The constructed client. """ credentials = service_account.Credentials.from_service_account_file(filename) kwargs["credentials"] = credentials @@ -283,10 +267,10 @@ def __init__( 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 (Union[str, ~.JobServiceTransport]): The transport to use. If set to None, a transport is chosen automatically. - client_options (google.api_core.client_options.ClientOptions): Custom options for the + client_options (client_options_lib.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_ENDPOINT @@ -399,20 +383,19 @@ def create_job( but it may take up to 5 minutes. Args: - request (google.cloud.talent_v4.types.CreateJobRequest): + request (:class:`~.job_service.CreateJobRequest`): The request object. Create job request. - parent (str): + 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/tenants/bar". - This corresponds to the ``parent`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - job (google.cloud.talent_v4.types.Job): + 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 @@ -425,11 +408,11 @@ def create_job( sent along with the request as metadata. Returns: - google.cloud.talent_v4.types.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.v4.Company], which is - the hiring entity responsible for the job. + ~.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.v4.Company], + which is the hiring entity responsible for the job. """ # Create or coerce a protobuf request object. @@ -486,24 +469,22 @@ def batch_create_jobs( r"""Begins executing a batch create jobs operation. Args: - request (google.cloud.talent_v4.types.BatchCreateJobsRequest): + request (:class:`~.job_service.BatchCreateJobsRequest`): The request object. Request to create a batch of jobs. - parent (str): + 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/tenants/bar". - This corresponds to the ``parent`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - jobs (Sequence[google.cloud.talent_v4.types.Job]): + jobs (:class:`Sequence[~.job.Job]`): Required. The jobs to be created. A maximum of 200 jobs can be created in a batch. - This corresponds to the ``jobs`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -515,13 +496,16 @@ def batch_create_jobs( sent along with the request as metadata. Returns: - google.api_core.operation.Operation: + ~.operation.Operation: An object representing a long-running operation. - The result type for the operation will be :class:`google.cloud.talent_v4.types.BatchCreateJobsResponse` The result of [JobService.BatchCreateJobs][google.cloud.talent.v4.JobService.BatchCreateJobs]. It's used to - replace - [google.longrunning.Operation.response][google.longrunning.Operation.response] - in case of success. + The result type for the operation will be + :class:``~.job_service.BatchCreateJobsResponse``: The + result of + [JobService.BatchCreateJobs][google.cloud.talent.v4.JobService.BatchCreateJobs]. + It's used to replace + [google.longrunning.Operation.response][google.longrunning.Operation.response] + in case of success. """ # Create or coerce a protobuf request object. @@ -587,15 +571,14 @@ def get_job( recently EXPIRED within the last 90 days. Args: - request (google.cloud.talent_v4.types.GetJobRequest): + request (:class:`~.job_service.GetJobRequest`): The request object. Get job request. - name (str): + 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". - This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -607,11 +590,11 @@ def get_job( sent along with the request as metadata. Returns: - google.cloud.talent_v4.types.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.v4.Company], which is - the hiring entity responsible for the job. + ~.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.v4.Company], + which is the hiring entity responsible for the job. """ # Create or coerce a protobuf request object. @@ -669,14 +652,14 @@ def update_job( minutes. Args: - request (google.cloud.talent_v4.types.UpdateJobRequest): + request (:class:`~.job_service.UpdateJobRequest`): The request object. Update job request. - job (google.cloud.talent_v4.types.Job): + 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. - update_mask (google.protobuf.field_mask_pb2.FieldMask): + update_mask (:class:`~.field_mask.FieldMask`): Strongly recommended for the best service experience. If @@ -688,7 +671,6 @@ def update_job( A field mask to restrict the fields that are updated. Only top level fields of [Job][google.cloud.talent.v4.Job] are supported. - This corresponds to the ``update_mask`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -700,11 +682,11 @@ def update_job( sent along with the request as metadata. Returns: - google.cloud.talent_v4.types.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.v4.Company], which is - the hiring entity responsible for the job. + ~.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.v4.Company], + which is the hiring entity responsible for the job. """ # Create or coerce a protobuf request object. @@ -761,24 +743,22 @@ def batch_update_jobs( r"""Begins executing a batch update jobs operation. Args: - request (google.cloud.talent_v4.types.BatchUpdateJobsRequest): + request (:class:`~.job_service.BatchUpdateJobsRequest`): The request object. Request to update a batch of jobs. - parent (str): + 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/tenants/bar". - This corresponds to the ``parent`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - jobs (Sequence[google.cloud.talent_v4.types.Job]): + jobs (:class:`Sequence[~.job.Job]`): Required. The jobs to be updated. A maximum of 200 jobs can be updated in a batch. - This corresponds to the ``jobs`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -790,13 +770,16 @@ def batch_update_jobs( sent along with the request as metadata. Returns: - google.api_core.operation.Operation: + ~.operation.Operation: An object representing a long-running operation. - The result type for the operation will be :class:`google.cloud.talent_v4.types.BatchUpdateJobsResponse` The result of [JobService.BatchUpdateJobs][google.cloud.talent.v4.JobService.BatchUpdateJobs]. It's used to - replace - [google.longrunning.Operation.response][google.longrunning.Operation.response] - in case of success. + The result type for the operation will be + :class:``~.job_service.BatchUpdateJobsResponse``: The + result of + [JobService.BatchUpdateJobs][google.cloud.talent.v4.JobService.BatchUpdateJobs]. + It's used to replace + [google.longrunning.Operation.response][google.longrunning.Operation.response] + in case of success. """ # Create or coerce a protobuf request object. @@ -863,15 +846,14 @@ def delete_job( seconds, but it may take up to 5 minutes. Args: - request (google.cloud.talent_v4.types.DeleteJobRequest): + request (:class:`~.job_service.DeleteJobRequest`): The request object. Delete job request. - name (str): + 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". - This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -933,9 +915,9 @@ def batch_delete_jobs( r"""Begins executing a batch delete jobs operation. Args: - request (google.cloud.talent_v4.types.BatchDeleteJobsRequest): + request (:class:`~.job_service.BatchDeleteJobsRequest`): The request object. Request to delete a batch of jobs. - parent (str): + parent (:class:`str`): Required. The resource name of the tenant under which the job is created. @@ -945,11 +927,10 @@ def batch_delete_jobs( The parent of all of the jobs specified in ``names`` must match this field. - This corresponds to the ``parent`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - names (Sequence[str]): + names (:class:`Sequence[str]`): The names of the jobs to delete. The format is @@ -957,7 +938,6 @@ def batch_delete_jobs( For example, "projects/foo/tenants/bar/jobs/baz". A maximum of 200 jobs can be deleted in a batch. - This corresponds to the ``names`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -969,13 +949,16 @@ def batch_delete_jobs( sent along with the request as metadata. Returns: - google.api_core.operation.Operation: + ~.operation.Operation: An object representing a long-running operation. - The result type for the operation will be :class:`google.cloud.talent_v4.types.BatchDeleteJobsResponse` The result of [JobService.BatchDeleteJobs][google.cloud.talent.v4.JobService.BatchDeleteJobs]. It's used to - replace - [google.longrunning.Operation.response][google.longrunning.Operation.response] - in case of success. + The result type for the operation will be + :class:``~.job_service.BatchDeleteJobsResponse``: The + result of + [JobService.BatchDeleteJobs][google.cloud.talent.v4.JobService.BatchDeleteJobs]. + It's used to replace + [google.longrunning.Operation.response][google.longrunning.Operation.response] + in case of success. """ # Create or coerce a protobuf request object. @@ -1041,20 +1024,19 @@ def list_jobs( r"""Lists jobs by filter. Args: - request (google.cloud.talent_v4.types.ListJobsRequest): + request (:class:`~.job_service.ListJobsRequest`): The request object. List jobs request. - parent (str): + 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/tenants/bar". - This corresponds to the ``parent`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - filter (str): + filter (:class:`str`): Required. The filter string specifies the jobs to be enumerated. @@ -1076,8 +1058,7 @@ def list_jobs( requisitionId = "req-1" - companyName = "projects/foo/tenants/bar/companies/baz" AND status = - "EXPIRED" - + "EXPIRED". This corresponds to the ``filter`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -1089,7 +1070,7 @@ def list_jobs( sent along with the request as metadata. Returns: - google.cloud.talent_v4.services.job_service.pagers.ListJobsPager: + ~.pagers.ListJobsPager: List jobs response. Iterating over this object will yield results and resolve additional pages @@ -1160,7 +1141,7 @@ def search_jobs( has permission to search against. Args: - request (google.cloud.talent_v4.types.SearchJobsRequest): + request (:class:`~.job_service.SearchJobsRequest`): The request object. The Request body of the `SearchJobs` call. @@ -1171,7 +1152,7 @@ def search_jobs( sent along with the request as metadata. Returns: - google.cloud.talent_v4.types.SearchJobsResponse: + ~.job_service.SearchJobsResponse: Response for SearchJob method. """ # Create or coerce a protobuf request object. @@ -1222,7 +1203,7 @@ def search_jobs_for_alert( permission to search against. Args: - request (google.cloud.talent_v4.types.SearchJobsRequest): + request (:class:`~.job_service.SearchJobsRequest`): The request object. The Request body of the `SearchJobs` call. @@ -1233,7 +1214,7 @@ def search_jobs_for_alert( sent along with the request as metadata. Returns: - google.cloud.talent_v4.types.SearchJobsResponse: + ~.job_service.SearchJobsResponse: Response for SearchJob method. """ # Create or coerce a protobuf request object. diff --git a/google/cloud/talent_v4/services/job_service/pagers.py b/google/cloud/talent_v4/services/job_service/pagers.py index 15f5218f..e759d8e3 100644 --- a/google/cloud/talent_v4/services/job_service/pagers.py +++ b/google/cloud/talent_v4/services/job_service/pagers.py @@ -25,7 +25,7 @@ class ListJobsPager: """A pager for iterating through ``list_jobs`` requests. This class thinly wraps an initial - :class:`google.cloud.talent_v4.types.ListJobsResponse` object, and + :class:`~.job_service.ListJobsResponse` object, and provides an ``__iter__`` method to iterate through its ``jobs`` field. @@ -34,7 +34,7 @@ class ListJobsPager: through the ``jobs`` field on the corresponding responses. - All the usual :class:`google.cloud.talent_v4.types.ListJobsResponse` + 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. """ @@ -52,9 +52,9 @@ def __init__( Args: method (Callable): The method that was originally called, and which instantiated this pager. - request (google.cloud.talent_v4.types.ListJobsRequest): + request (:class:`~.job_service.ListJobsRequest`): The initial request object. - response (google.cloud.talent_v4.types.ListJobsResponse): + 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. @@ -87,7 +87,7 @@ class ListJobsAsyncPager: """A pager for iterating through ``list_jobs`` requests. This class thinly wraps an initial - :class:`google.cloud.talent_v4.types.ListJobsResponse` object, and + :class:`~.job_service.ListJobsResponse` object, and provides an ``__aiter__`` method to iterate through its ``jobs`` field. @@ -96,7 +96,7 @@ class ListJobsAsyncPager: through the ``jobs`` field on the corresponding responses. - All the usual :class:`google.cloud.talent_v4.types.ListJobsResponse` + 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. """ @@ -114,9 +114,9 @@ def __init__( Args: method (Callable): The method that was originally called, and which instantiated this pager. - request (google.cloud.talent_v4.types.ListJobsRequest): + request (:class:`~.job_service.ListJobsRequest`): The initial request object. - response (google.cloud.talent_v4.types.ListJobsResponse): + 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. diff --git a/google/cloud/talent_v4/services/tenant_service/async_client.py b/google/cloud/talent_v4/services/tenant_service/async_client.py index 46170195..07940a99 100644 --- a/google/cloud/talent_v4/services/tenant_service/async_client.py +++ b/google/cloud/talent_v4/services/tenant_service/async_client.py @@ -81,7 +81,6 @@ class TenantServiceAsyncClient: TenantServiceClient.parse_common_location_path ) - from_service_account_info = TenantServiceClient.from_service_account_info from_service_account_file = TenantServiceClient.from_service_account_file from_service_account_json = from_service_account_file @@ -159,7 +158,7 @@ async def create_tenant( r"""Creates a new tenant entity. Args: - request (:class:`google.cloud.talent_v4.types.CreateTenantRequest`): + request (:class:`~.tenant_service.CreateTenantRequest`): The request object. The Request of the CreateTenant method. parent (:class:`str`): @@ -168,11 +167,10 @@ async def create_tenant( 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:`google.cloud.talent_v4.types.Tenant`): + 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 @@ -185,7 +183,7 @@ async def create_tenant( sent along with the request as metadata. Returns: - google.cloud.talent_v4.types.Tenant: + ~.gct_tenant.Tenant: A Tenant resource represents a tenant in the service. A tenant is a group or entity that shares common access with @@ -247,7 +245,7 @@ async def get_tenant( r"""Retrieves specified tenant. Args: - request (:class:`google.cloud.talent_v4.types.GetTenantRequest`): + request (:class:`~.tenant_service.GetTenantRequest`): The request object. Request for getting a tenant by name. name (:class:`str`): @@ -257,7 +255,6 @@ async def get_tenant( 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. @@ -269,7 +266,7 @@ async def get_tenant( sent along with the request as metadata. Returns: - google.cloud.talent_v4.types.Tenant: + ~.tenant.Tenant: A Tenant resource represents a tenant in the service. A tenant is a group or entity that shares common access with @@ -338,18 +335,17 @@ async def update_tenant( r"""Updates specified tenant. Args: - request (:class:`google.cloud.talent_v4.types.UpdateTenantRequest`): + request (:class:`~.tenant_service.UpdateTenantRequest`): The request object. Request for updating a specified tenant. - tenant (:class:`google.cloud.talent_v4.types.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. - update_mask (:class:`google.protobuf.field_mask_pb2.FieldMask`): + update_mask (:class:`~.field_mask.FieldMask`): Strongly recommended for the best service experience. If @@ -361,7 +357,6 @@ async def update_tenant( A field mask to specify the tenant fields to be updated. Only top level fields of [Tenant][google.cloud.talent.v4.Tenant] are supported. - This corresponds to the ``update_mask`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -373,7 +368,7 @@ async def update_tenant( sent along with the request as metadata. Returns: - google.cloud.talent_v4.types.Tenant: + ~.gct_tenant.Tenant: A Tenant resource represents a tenant in the service. A tenant is a group or entity that shares common access with @@ -437,7 +432,7 @@ async def delete_tenant( r"""Deletes specified tenant. Args: - request (:class:`google.cloud.talent_v4.types.DeleteTenantRequest`): + 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. @@ -445,7 +440,6 @@ async def delete_tenant( 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. @@ -513,7 +507,7 @@ async def list_tenants( r"""Lists all tenants associated with the project. Args: - request (:class:`google.cloud.talent_v4.types.ListTenantsRequest`): + request (:class:`~.tenant_service.ListTenantsRequest`): The request object. List tenants for which the client has ACL visibility. parent (:class:`str`): @@ -522,7 +516,6 @@ async def list_tenants( 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. @@ -534,7 +527,7 @@ async def list_tenants( sent along with the request as metadata. Returns: - google.cloud.talent_v4.services.tenant_service.pagers.ListTenantsAsyncPager: + ~.pagers.ListTenantsAsyncPager: The List tenants response object. Iterating over this object will yield results and resolve additional pages diff --git a/google/cloud/talent_v4/services/tenant_service/client.py b/google/cloud/talent_v4/services/tenant_service/client.py index 30cb76bf..7492a9c3 100644 --- a/google/cloud/talent_v4/services/tenant_service/client.py +++ b/google/cloud/talent_v4/services/tenant_service/client.py @@ -113,22 +113,6 @@ def _get_default_mtls_endpoint(api_endpoint): DEFAULT_ENDPOINT ) - @classmethod - def from_service_account_info(cls, info: dict, *args, **kwargs): - """Creates an instance of this client using the provided credentials info. - - Args: - info (dict): The service account private key info. - args: Additional arguments to pass to the constructor. - kwargs: Additional arguments to pass to the constructor. - - Returns: - TenantServiceClient: The constructed client. - """ - credentials = service_account.Credentials.from_service_account_info(info) - kwargs["credentials"] = credentials - return cls(*args, **kwargs) - @classmethod def from_service_account_file(cls, filename: str, *args, **kwargs): """Creates an instance of this client using the provided credentials @@ -141,7 +125,7 @@ def from_service_account_file(cls, filename: str, *args, **kwargs): kwargs: Additional arguments to pass to the constructor. Returns: - TenantServiceClient: The constructed client. + {@api.name}: The constructed client. """ credentials = service_account.Credentials.from_service_account_file(filename) kwargs["credentials"] = credentials @@ -246,10 +230,10 @@ def __init__( 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 (Union[str, ~.TenantServiceTransport]): The transport to use. If set to None, a transport is chosen automatically. - client_options (google.api_core.client_options.ClientOptions): Custom options for the + client_options (client_options_lib.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_ENDPOINT @@ -360,20 +344,19 @@ def create_tenant( r"""Creates a new tenant entity. Args: - request (google.cloud.talent_v4.types.CreateTenantRequest): + request (:class:`~.tenant_service.CreateTenantRequest`): The request object. The Request of the CreateTenant method. - parent (str): + 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 (google.cloud.talent_v4.types.Tenant): + 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 @@ -386,7 +369,7 @@ def create_tenant( sent along with the request as metadata. Returns: - google.cloud.talent_v4.types.Tenant: + ~.gct_tenant.Tenant: A Tenant resource represents a tenant in the service. A tenant is a group or entity that shares common access with @@ -449,17 +432,16 @@ def get_tenant( r"""Retrieves specified tenant. Args: - request (google.cloud.talent_v4.types.GetTenantRequest): + request (:class:`~.tenant_service.GetTenantRequest`): The request object. Request for getting a tenant by name. - name (str): + 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. @@ -471,7 +453,7 @@ def get_tenant( sent along with the request as metadata. Returns: - google.cloud.talent_v4.types.Tenant: + ~.tenant.Tenant: A Tenant resource represents a tenant in the service. A tenant is a group or entity that shares common access with @@ -533,18 +515,17 @@ def update_tenant( r"""Updates specified tenant. Args: - request (google.cloud.talent_v4.types.UpdateTenantRequest): + request (:class:`~.tenant_service.UpdateTenantRequest`): The request object. Request for updating a specified tenant. - tenant (google.cloud.talent_v4.types.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. - update_mask (google.protobuf.field_mask_pb2.FieldMask): + update_mask (:class:`~.field_mask.FieldMask`): Strongly recommended for the best service experience. If @@ -556,7 +537,6 @@ def update_tenant( A field mask to specify the tenant fields to be updated. Only top level fields of [Tenant][google.cloud.talent.v4.Tenant] are supported. - This corresponds to the ``update_mask`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -568,7 +548,7 @@ def update_tenant( sent along with the request as metadata. Returns: - google.cloud.talent_v4.types.Tenant: + ~.gct_tenant.Tenant: A Tenant resource represents a tenant in the service. A tenant is a group or entity that shares common access with @@ -633,15 +613,14 @@ def delete_tenant( r"""Deletes specified tenant. Args: - request (google.cloud.talent_v4.types.DeleteTenantRequest): + request (:class:`~.tenant_service.DeleteTenantRequest`): The request object. Request to delete a tenant. - name (str): + 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. @@ -702,16 +681,15 @@ def list_tenants( r"""Lists all tenants associated with the project. Args: - request (google.cloud.talent_v4.types.ListTenantsRequest): + request (:class:`~.tenant_service.ListTenantsRequest`): The request object. List tenants for which the client has ACL visibility. - parent (str): + 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. @@ -723,7 +701,7 @@ def list_tenants( sent along with the request as metadata. Returns: - google.cloud.talent_v4.services.tenant_service.pagers.ListTenantsPager: + ~.pagers.ListTenantsPager: The List tenants response object. Iterating over this object will yield results and resolve additional pages diff --git a/google/cloud/talent_v4/services/tenant_service/pagers.py b/google/cloud/talent_v4/services/tenant_service/pagers.py index e5df990c..d671fdb7 100644 --- a/google/cloud/talent_v4/services/tenant_service/pagers.py +++ b/google/cloud/talent_v4/services/tenant_service/pagers.py @@ -25,7 +25,7 @@ class ListTenantsPager: """A pager for iterating through ``list_tenants`` requests. This class thinly wraps an initial - :class:`google.cloud.talent_v4.types.ListTenantsResponse` object, and + :class:`~.tenant_service.ListTenantsResponse` object, and provides an ``__iter__`` method to iterate through its ``tenants`` field. @@ -34,7 +34,7 @@ class ListTenantsPager: through the ``tenants`` field on the corresponding responses. - All the usual :class:`google.cloud.talent_v4.types.ListTenantsResponse` + 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. """ @@ -52,9 +52,9 @@ def __init__( Args: method (Callable): The method that was originally called, and which instantiated this pager. - request (google.cloud.talent_v4.types.ListTenantsRequest): + request (:class:`~.tenant_service.ListTenantsRequest`): The initial request object. - response (google.cloud.talent_v4.types.ListTenantsResponse): + 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. @@ -87,7 +87,7 @@ class ListTenantsAsyncPager: """A pager for iterating through ``list_tenants`` requests. This class thinly wraps an initial - :class:`google.cloud.talent_v4.types.ListTenantsResponse` object, and + :class:`~.tenant_service.ListTenantsResponse` object, and provides an ``__aiter__`` method to iterate through its ``tenants`` field. @@ -96,7 +96,7 @@ class ListTenantsAsyncPager: through the ``tenants`` field on the corresponding responses. - All the usual :class:`google.cloud.talent_v4.types.ListTenantsResponse` + 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. """ @@ -114,9 +114,9 @@ def __init__( Args: method (Callable): The method that was originally called, and which instantiated this pager. - request (google.cloud.talent_v4.types.ListTenantsRequest): + request (:class:`~.tenant_service.ListTenantsRequest`): The initial request object. - response (google.cloud.talent_v4.types.ListTenantsResponse): + 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. diff --git a/google/cloud/talent_v4/types/common.py b/google/cloud/talent_v4/types/common.py index 90e92333..13b73611 100644 --- a/google/cloud/talent_v4/types/common.py +++ b/google/cloud/talent_v4/types/common.py @@ -206,9 +206,9 @@ class TimestampRange(proto.Message): r"""Message representing a period of time between two timestamps. Attributes: - start_time (google.protobuf.timestamp_pb2.Timestamp): + start_time (~.timestamp.Timestamp): Begin of the period (inclusive). - end_time (google.protobuf.timestamp_pb2.Timestamp): + end_time (~.timestamp.Timestamp): End of the period (exclusive). """ @@ -222,7 +222,7 @@ class Location(proto.Message): information. Attributes: - location_type (google.cloud.talent_v4.types.Location.LocationType): + 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 @@ -230,13 +230,13 @@ class Location(proto.Message): [LocationType.NEIGHBORHOOD][google.cloud.talent.v4.Location.LocationType.NEIGHBORHOOD], and "Kansas City, KS, USA" has a type of [LocationType.LOCALITY][google.cloud.talent.v4.Location.LocationType.LOCALITY]. - postal_address (google.type.postal_address_pb2.PostalAddress): + 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 (google.type.latlng_pb2.LatLng): + lat_lng (~.latlng.LatLng): An object representing a latitude/longitude pair. radius_miles (float): @@ -342,7 +342,7 @@ class RequestMetadata(proto.Message): and [user_id][google.cloud.talent.v4.RequestMetadata.user_id] for the best service experience. - device_info (google.cloud.talent_v4.types.DeviceInfo): + device_info (~.common.DeviceInfo): The type of device used by the job seeker at the time of the call to the service. """ @@ -378,7 +378,7 @@ class DeviceInfo(proto.Message): devices. Attributes: - device_type (google.cloud.talent_v4.types.DeviceInfo.DeviceType): + device_type (~.common.DeviceInfo.DeviceType): Type of the device. id (str): A device-specific ID. The ID must be a unique @@ -495,14 +495,14 @@ class CompensationInfo(proto.Message): r"""Job compensation details. Attributes: - entries (Sequence[google.cloud.talent_v4.types.CompensationInfo.CompensationEntry]): + entries (Sequence[~.common.CompensationInfo.CompensationEntry]): Job compensation information. At most one entry can be of type [CompensationInfo.CompensationType.BASE][google.cloud.talent.v4.CompensationInfo.CompensationType.BASE], which is referred as **base compensation entry** for the job. - annualized_base_compensation_range (google.cloud.talent_v4.types.CompensationInfo.CompensationRange): + annualized_base_compensation_range (~.common.CompensationInfo.CompensationRange): Output only. Annualized base compensation range. Computed as base compensation entry's [CompensationEntry.amount][google.cloud.talent.v4.CompensationInfo.CompensationEntry.amount] @@ -512,7 +512,7 @@ class CompensationInfo(proto.Message): See [CompensationEntry][google.cloud.talent.v4.CompensationInfo.CompensationEntry] for explanation on compensation annualization. - annualized_total_compensation_range (google.cloud.talent_v4.types.CompensationInfo.CompensationRange): + annualized_total_compensation_range (~.common.CompensationInfo.CompensationRange): Output only. Annualized total compensation range. Computed as all compensation entries' [CompensationEntry.amount][google.cloud.talent.v4.CompensationInfo.CompensationEntry.amount] @@ -594,25 +594,25 @@ class CompensationEntry(proto.Message): [expected_units_per_year][google.cloud.talent.v4.CompensationInfo.CompensationEntry.expected_units_per_year]. Attributes: - type_ (google.cloud.talent_v4.types.CompensationInfo.CompensationType): + type_ (~.common.CompensationInfo.CompensationType): Compensation type. Default is [CompensationType.COMPENSATION_TYPE_UNSPECIFIED][google.cloud.talent.v4.CompensationInfo.CompensationType.COMPENSATION_TYPE_UNSPECIFIED]. - unit (google.cloud.talent_v4.types.CompensationInfo.CompensationUnit): + unit (~.common.CompensationInfo.CompensationUnit): Frequency of the specified amount. Default is [CompensationUnit.COMPENSATION_UNIT_UNSPECIFIED][google.cloud.talent.v4.CompensationInfo.CompensationUnit.COMPENSATION_UNIT_UNSPECIFIED]. - amount (google.type.money_pb2.Money): + amount (~.money.Money): Compensation amount. - range_ (google.cloud.talent_v4.types.CompensationInfo.CompensationRange): + 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 (google.protobuf.wrappers_pb2.DoubleValue): + expected_units_per_year (~.wrappers.DoubleValue): Expected number of units paid each year. If not specified, when [Job.employment_types][google.cloud.talent.v4.Job.employment_types] @@ -656,12 +656,12 @@ class CompensationRange(proto.Message): r"""Compensation range. Attributes: - max_compensation (google.type.money_pb2.Money): + 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 (google.type.money_pb2.Money): + 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 @@ -689,7 +689,7 @@ class BatchOperationMetadata(proto.Message): [google.longrunning.Operation.metadata][google.longrunning.Operation.metadata]. Attributes: - state (google.cloud.talent_v4.types.BatchOperationMetadata.State): + state (~.common.BatchOperationMetadata.State): The state of a long running operation. state_description (str): More detailed information about operation @@ -701,14 +701,14 @@ class BatchOperationMetadata(proto.Message): Count of failed item(s) inside an operation. total_count (int): Count of total item(s) inside an operation. - create_time (google.protobuf.timestamp_pb2.Timestamp): + create_time (~.timestamp.Timestamp): The time when the batch operation is created. - update_time (google.protobuf.timestamp_pb2.Timestamp): + update_time (~.timestamp.Timestamp): The time when the batch operation status is updated. The metadata and the [update_time][google.cloud.talent.v4.BatchOperationMetadata.update_time] is refreshed every minute otherwise cached data is returned. - end_time (google.protobuf.timestamp_pb2.Timestamp): + 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``. diff --git a/google/cloud/talent_v4/types/company.py b/google/cloud/talent_v4/types/company.py index 84df7fe7..9955928e 100644 --- a/google/cloud/talent_v4/types/company.py +++ b/google/cloud/talent_v4/types/company.py @@ -48,7 +48,7 @@ class Company(proto.Message): used to uniquely identify the company. The maximum number of allowed characters is 255. - size (google.cloud.talent_v4.types.CompanySize): + size (~.common.CompanySize): The employer's company size. headquarters_address (str): The street address of the company's main headquarters, which @@ -87,7 +87,7 @@ class Company(proto.Message): 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 (google.cloud.talent_v4.types.Company.DerivedInfo): + derived_info (~.company.Company.DerivedInfo): Output only. Derived details about the company. suspended (bool): @@ -101,7 +101,7 @@ class DerivedInfo(proto.Message): r"""Derived details about the company. Attributes: - headquarters_location (google.cloud.talent_v4.types.Location): + headquarters_location (~.common.Location): A structured headquarters location of the company, resolved from [Company.headquarters_address][google.cloud.talent.v4.Company.headquarters_address] diff --git a/google/cloud/talent_v4/types/company_service.py b/google/cloud/talent_v4/types/company_service.py index c6862175..0e166ef9 100644 --- a/google/cloud/talent_v4/types/company_service.py +++ b/google/cloud/talent_v4/types/company_service.py @@ -46,7 +46,7 @@ class CreateCompanyRequest(proto.Message): The format is "projects/{project_id}/tenants/{tenant_id}", for example, "projects/foo/tenants/bar". - company (google.cloud.talent_v4.types.Company): + company (~.gct_company.Company): Required. The company to be created. """ @@ -75,10 +75,10 @@ class UpdateCompanyRequest(proto.Message): r"""Request for updating a specified company. Attributes: - company (google.cloud.talent_v4.types.Company): + company (~.gct_company.Company): Required. The company resource to replace the current resource in the system. - update_mask (google.protobuf.field_mask_pb2.FieldMask): + update_mask (~.field_mask.FieldMask): Strongly recommended for the best service experience. If @@ -153,11 +153,11 @@ class ListCompaniesResponse(proto.Message): r"""The List companies response object. Attributes: - companies (Sequence[google.cloud.talent_v4.types.Company]): + companies (Sequence[~.gct_company.Company]): Companies for the current client. next_page_token (str): A token to retrieve the next page of results. - metadata (google.cloud.talent_v4.types.ResponseMetadata): + metadata (~.common.ResponseMetadata): Additional information for the API invocation, such as the request tracking id. """ diff --git a/google/cloud/talent_v4/types/completion_service.py b/google/cloud/talent_v4/types/completion_service.py index fe233356..ba2529b2 100644 --- a/google/cloud/talent_v4/types/completion_service.py +++ b/google/cloud/talent_v4/types/completion_service.py @@ -57,10 +57,10 @@ class CompleteQueryRequest(proto.Message): The format is "projects/{project_id}/tenants/{tenant_id}/companies/{company_id}", for example, "projects/foo/tenants/bar/companies/baz". - scope (google.cloud.talent_v4.types.CompleteQueryRequest.CompletionScope): + scope (~.completion_service.CompleteQueryRequest.CompletionScope): The scope of the completion. The defaults is [CompletionScope.PUBLIC][google.cloud.talent.v4.CompleteQueryRequest.CompletionScope.PUBLIC]. - type_ (google.cloud.talent_v4.types.CompleteQueryRequest.CompletionType): + type_ (~.completion_service.CompleteQueryRequest.CompletionType): The completion topic. The default is [CompletionType.COMBINED][google.cloud.talent.v4.CompleteQueryRequest.CompletionType.COMBINED]. """ @@ -97,10 +97,10 @@ class CompleteQueryResponse(proto.Message): r"""Response of auto-complete query. Attributes: - completion_results (Sequence[google.cloud.talent_v4.types.CompleteQueryResponse.CompletionResult]): + completion_results (Sequence[~.completion_service.CompleteQueryResponse.CompletionResult]): Results of the matching job/company candidates. - metadata (google.cloud.talent_v4.types.ResponseMetadata): + metadata (~.common.ResponseMetadata): Additional information for the API invocation, such as the request tracking id. """ @@ -111,7 +111,7 @@ class CompletionResult(proto.Message): Attributes: suggestion (str): The suggestion for the query. - type_ (google.cloud.talent_v4.types.CompleteQueryRequest.CompletionType): + type_ (~.completion_service.CompleteQueryRequest.CompletionType): The completion topic. image_uri (str): The URI of the company image for diff --git a/google/cloud/talent_v4/types/event.py b/google/cloud/talent_v4/types/event.py index 40ffe6f2..8ecb3a87 100644 --- a/google/cloud/talent_v4/types/event.py +++ b/google/cloud/talent_v4/types/event.py @@ -44,9 +44,9 @@ class ClientEvent(proto.Message): event_id (str): Required. A unique identifier, generated by the client application. - create_time (google.protobuf.timestamp_pb2.Timestamp): + create_time (~.timestamp.Timestamp): Required. The timestamp of the event. - job_event (google.cloud.talent_v4.types.JobEvent): + job_event (~.event.JobEvent): An event issued when a job seeker interacts with the application that implements Cloud Talent Solution. @@ -72,7 +72,7 @@ class JobEvent(proto.Message): application that implements Cloud Talent Solution. Attributes: - type_ (google.cloud.talent_v4.types.JobEvent.JobEventType): + type_ (~.event.JobEvent.JobEventType): Required. The type of the event (see [JobEventType][google.cloud.talent.v4.JobEvent.JobEventType]). jobs (Sequence[str]): diff --git a/google/cloud/talent_v4/types/event_service.py b/google/cloud/talent_v4/types/event_service.py index 8a328f9a..264d2f2d 100644 --- a/google/cloud/talent_v4/types/event_service.py +++ b/google/cloud/talent_v4/types/event_service.py @@ -36,7 +36,7 @@ class CreateClientEventRequest(proto.Message): The format is "projects/{project_id}/tenants/{tenant_id}", for example, "projects/foo/tenants/bar". - client_event (google.cloud.talent_v4.types.ClientEvent): + client_event (~.event.ClientEvent): Required. Events issued when end user interacts with customer's application that uses Cloud Talent Solution. diff --git a/google/cloud/talent_v4/types/filters.py b/google/cloud/talent_v4/types/filters.py index 482632fa..62a8aa57 100644 --- a/google/cloud/talent_v4/types/filters.py +++ b/google/cloud/talent_v4/types/filters.py @@ -65,7 +65,7 @@ class JobQuery(proto.Message): For example, "projects/foo/tenants/bar/companies/baz". At most 20 company filters are allowed. - location_filters (Sequence[google.cloud.talent_v4.types.LocationFilter]): + location_filters (Sequence[~.filters.LocationFilter]): The location filter specifies geo-regions containing the jobs to search against. See [LocationFilter][google.cloud.talent.v4.LocationFilter] for @@ -83,7 +83,7 @@ class JobQuery(proto.Message): locations. At most 5 location filters are allowed. - job_categories (Sequence[google.cloud.talent_v4.types.JobCategory]): + job_categories (Sequence[~.common.JobCategory]): The category filter specifies the categories of jobs to search against. See [JobCategory][google.cloud.talent.v4.JobCategory] for more @@ -94,7 +94,7 @@ class JobQuery(proto.Message): If multiple values are specified, jobs from any of the specified categories are searched against. - commute_filter (google.cloud.talent_v4.types.CommuteFilter): + commute_filter (~.filters.CommuteFilter): Allows filtering jobs by commute time with different travel methods (for example, driving or public transit). @@ -118,7 +118,7 @@ class JobQuery(proto.Message): companies. At most 20 company display name filters are allowed. - compensation_filter (google.cloud.talent_v4.types.CompensationFilter): + compensation_filter (~.filters.CompensationFilter): This search filter is applied only to [Job.compensation_info][google.cloud.talent.v4.Job.compensation_info]. For example, if the filter is specified as "Hourly job with @@ -157,7 +157,7 @@ class JobQuery(proto.Message): misspelled query, for example, "enginee" is corrected to "engineer". Defaults to false: a spell check is performed. - employment_types (Sequence[google.cloud.talent_v4.types.EmploymentType]): + 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.v4.EmploymentType.FULL_TIME]. @@ -180,7 +180,7 @@ class JobQuery(proto.Message): Languages `__. At most 10 language code filters are allowed. - publish_time_range (google.cloud.talent_v4.types.TimestampRange): + publish_time_range (~.common.TimestampRange): Jobs published within a range specified by this filter are searched against. excluded_jobs (Sequence[str]): @@ -246,7 +246,7 @@ class LocationFilter(proto.Message): See https://www.unicode.org/cldr/charts/30/supplemental/territory_information.html for details. Example: "CH" for Switzerland. - lat_lng (google.type.latlng_pb2.LatLng): + lat_lng (~.latlng.LatLng): The latitude and longitude of the geographic center to search from. This field is ignored if ``address`` is provided. @@ -255,7 +255,7 @@ class LocationFilter(proto.Message): 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 (google.cloud.talent_v4.types.LocationFilter.TelecommutePreference): + 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. @@ -304,12 +304,12 @@ class CompensationFilter(proto.Message): r"""Filter on job compensation type and amount. Attributes: - type_ (google.cloud.talent_v4.types.CompensationFilter.FilterType): + type_ (~.filters.CompensationFilter.FilterType): Required. Type of filter. - units (Sequence[google.cloud.talent_v4.types.CompensationInfo.CompensationUnit]): + units (Sequence[~.common.CompensationInfo.CompensationUnit]): Required. Specify desired ``base compensation entry's`` [CompensationInfo.CompensationUnit][google.cloud.talent.v4.CompensationInfo.CompensationUnit]. - range_ (google.cloud.talent_v4.types.CompensationInfo.CompensationRange): + range_ (~.common.CompensationInfo.CompensationRange): Compensation range. include_jobs_with_unspecified_compensation_range (bool): If set to true, jobs with unspecified @@ -341,13 +341,13 @@ class CommuteFilter(proto.Message): r"""Parameters needed for commute search. Attributes: - commute_method (google.cloud.talent_v4.types.CommuteMethod): + commute_method (~.common.CommuteMethod): Required. The method of transportation to calculate the commute time for. - start_coordinates (google.type.latlng_pb2.LatLng): + start_coordinates (~.latlng.LatLng): Required. The latitude and longitude of the location to calculate the commute time from. - travel_duration (google.protobuf.duration_pb2.Duration): + 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): @@ -357,10 +357,10 @@ class CommuteFilter(proto.Message): 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 (google.cloud.talent_v4.types.CommuteFilter.RoadTraffic): + road_traffic (~.filters.CommuteFilter.RoadTraffic): Specifies the traffic density to use when calculating commute time. - departure_time (google.type.timeofday_pb2.TimeOfDay): + departure_time (~.timeofday.TimeOfDay): The departure time used to calculate traffic impact, represented as [google.type.TimeOfDay][google.type.TimeOfDay] in local time diff --git a/google/cloud/talent_v4/types/histogram.py b/google/cloud/talent_v4/types/histogram.py index ec9484c9..ac6443df 100644 --- a/google/cloud/talent_v4/types/histogram.py +++ b/google/cloud/talent_v4/types/histogram.py @@ -48,7 +48,7 @@ class HistogramQueryResult(proto.Message): Attributes: histogram_query (str): Requested histogram expression. - histogram (Sequence[google.cloud.talent_v4.types.HistogramQueryResult.HistogramEntry]): + 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. diff --git a/google/cloud/talent_v4/types/job.py b/google/cloud/talent_v4/types/job.py index 2bd27c59..f1320f94 100644 --- a/google/cloud/talent_v4/types/job.py +++ b/google/cloud/talent_v4/types/job.py @@ -111,15 +111,15 @@ class Job(proto.Message): experience. The maximum number of allowed characters is 500. - application_info (google.cloud.talent_v4.types.Job.ApplicationInfo): + application_info (~.job.Job.ApplicationInfo): Job application information. - job_benefits (Sequence[google.cloud.talent_v4.types.JobBenefit]): + job_benefits (Sequence[~.common.JobBenefit]): The benefits included with the job. - compensation_info (google.cloud.talent_v4.types.CompensationInfo): + 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[google.cloud.talent_v4.types.Job.CustomAttributesEntry]): + 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. @@ -134,7 +134,7 @@ class Job(proto.Message): than 255 characters. For unfilterable ``string_values``, the maximum total size of ``string_values`` across all keys is 50KB. - degree_types (Sequence[google.cloud.talent_v4.types.DegreeType]): + degree_types (Sequence[~.common.DegreeType]): The desired education degrees for the job, such as Bachelors, Masters. department (str): @@ -142,7 +142,7 @@ class Job(proto.Message): company with the open position. The maximum number of allowed characters is 255. - employment_types (Sequence[google.cloud.talent_v4.types.EmploymentType]): + employment_types (Sequence[~.common.EmploymentType]): The employment type(s) of a job, for example, [full time][google.cloud.talent.v4.EmploymentType.FULL_TIME] or [part @@ -167,7 +167,7 @@ class Job(proto.Message): present, detected language code based on [Job.description][google.cloud.talent.v4.Job.description] is assigned, otherwise defaults to 'en_US'. - job_level (google.cloud.talent_v4.types.JobLevel): + job_level (~.common.JobLevel): The experience level associated with the job, such as "Entry Level". promotion_value (int): @@ -200,7 +200,7 @@ class Job(proto.Message): markup tags. The maximum number of allowed characters is 10,000. - posting_region (google.cloud.talent_v4.types.PostingRegion): + posting_region (~.common.PostingRegion): The job [PostingRegion][google.cloud.talent.v4.PostingRegion] (for example, state, country) throughout which the job is @@ -215,7 +215,7 @@ class Job(proto.Message): setting job [Job.addresses][google.cloud.talent.v4.Job.addresses] to the same location level as this field is strongly recommended. - visibility (google.cloud.talent_v4.types.Visibility): + visibility (~.common.Visibility): Deprecated. The job is only visible to the owner. The visibility of the job. @@ -223,21 +223,21 @@ class Job(proto.Message): Defaults to [Visibility.ACCOUNT_ONLY][google.cloud.talent.v4.Visibility.ACCOUNT_ONLY] if not specified. - job_start_time (google.protobuf.timestamp_pb2.Timestamp): + 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 (google.protobuf.timestamp_pb2.Timestamp): + 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 (google.protobuf.timestamp_pb2.Timestamp): + 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 (google.protobuf.timestamp_pb2.Timestamp): + posting_expire_time (~.timestamp.Timestamp): Strongly recommended for the best service experience. The expiration timestamp of the job. After this timestamp, @@ -295,19 +295,19 @@ class Job(proto.Message): 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 (google.protobuf.timestamp_pb2.Timestamp): + posting_create_time (~.timestamp.Timestamp): Output only. The timestamp when this job posting was created. - posting_update_time (google.protobuf.timestamp_pb2.Timestamp): + 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 (google.cloud.talent_v4.types.Job.DerivedInfo): + derived_info (~.job.Job.DerivedInfo): Output only. Derived details about the job posting. - processing_options (google.cloud.talent_v4.types.Job.ProcessingOptions): + processing_options (~.job.Job.ProcessingOptions): Options for job processing. """ @@ -347,7 +347,7 @@ class DerivedInfo(proto.Message): r"""Derived details about the job posting. Attributes: - locations (Sequence[google.cloud.talent_v4.types.Location]): + locations (Sequence[~.common.Location]): Structured locations of the job, resolved from [Job.addresses][google.cloud.talent.v4.Job.addresses]. @@ -355,7 +355,7 @@ class DerivedInfo(proto.Message): are exactly matched to [Job.addresses][google.cloud.talent.v4.Job.addresses] in the same order. - job_categories (Sequence[google.cloud.talent_v4.types.JobCategory]): + job_categories (Sequence[~.common.JobCategory]): Job categories derived from [Job.title][google.cloud.talent.v4.Job.title] and [Job.description][google.cloud.talent.v4.Job.description]. @@ -376,7 +376,7 @@ class ProcessingOptions(proto.Message): 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 (google.cloud.talent_v4.types.HtmlSanitization): + html_sanitization (~.common.HtmlSanitization): Option for job HTML content sanitization. Applied fields are: diff --git a/google/cloud/talent_v4/types/job_service.py b/google/cloud/talent_v4/types/job_service.py index 78289bbe..4b53ed10 100644 --- a/google/cloud/talent_v4/types/job_service.py +++ b/google/cloud/talent_v4/types/job_service.py @@ -74,7 +74,7 @@ class CreateJobRequest(proto.Message): The format is "projects/{project_id}/tenants/{tenant_id}". For example, "projects/foo/tenants/bar". - job (google.cloud.talent_v4.types.Job): + job (~.gct_job.Job): Required. The Job to be created. """ @@ -102,9 +102,9 @@ class UpdateJobRequest(proto.Message): r"""Update job request. Attributes: - job (google.cloud.talent_v4.types.Job): + job (~.gct_job.Job): Required. The Job to be updated. - update_mask (google.protobuf.field_mask_pb2.FieldMask): + update_mask (~.field_mask.FieldMask): Strongly recommended for the best service experience. If @@ -182,7 +182,7 @@ class ListJobsRequest(proto.Message): maximum allowed page size is 100. Default is 100 if empty or a number < 1 is specified. - job_view (google.cloud.talent_v4.types.JobView): + 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.v4.JobView.JOB_VIEW_FULL] @@ -204,13 +204,13 @@ class ListJobsResponse(proto.Message): r"""List jobs response. Attributes: - jobs (Sequence[google.cloud.talent_v4.types.Job]): + 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 (google.cloud.talent_v4.types.ResponseMetadata): + metadata (~.common.ResponseMetadata): Additional information for the API invocation, such as the request tracking id. """ @@ -235,17 +235,17 @@ class SearchJobsRequest(proto.Message): The format is "projects/{project_id}/tenants/{tenant_id}". For example, "projects/foo/tenants/bar". - search_mode (google.cloud.talent_v4.types.SearchJobsRequest.SearchMode): + search_mode (~.job_service.SearchJobsRequest.SearchMode): Mode of a search. Defaults to [SearchMode.JOB_SEARCH][google.cloud.talent.v4.SearchJobsRequest.SearchMode.JOB_SEARCH]. - request_metadata (google.cloud.talent_v4.types.RequestMetadata): + 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 (google.cloud.talent_v4.types.JobQuery): + job_query (~.filters.JobQuery): Query used to search against jobs, such as keyword, location filters, etc. enable_broadening (bool): @@ -255,7 +255,7 @@ class SearchJobsRequest(proto.Message): results list. Defaults to false. - histogram_queries (Sequence[google.cloud.talent_v4.types.HistogramQuery]): + histogram_queries (Sequence[~.histogram.HistogramQuery]): An expression specifies a histogram request against matching jobs. @@ -368,7 +368,7 @@ class SearchJobsRequest(proto.Message): - ``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 (google.cloud.talent_v4.types.JobView): + 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.v4.JobView.JOB_VIEW_SMALL] @@ -458,7 +458,7 @@ class SearchJobsRequest(proto.Message): (37.4 feet). Diversification strategy is still applied unless explicitly disabled in [diversification_level][google.cloud.talent.v4.SearchJobsRequest.diversification_level]. - diversification_level (google.cloud.talent_v4.types.SearchJobsRequest.DiversificationLevel): + 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 @@ -470,7 +470,7 @@ class SearchJobsRequest(proto.Message): Defaults to [DiversificationLevel.SIMPLE][google.cloud.talent.v4.SearchJobsRequest.DiversificationLevel.SIMPLE] if no value is specified. - custom_ranking_info (google.cloud.talent_v4.types.SearchJobsRequest.CustomRankingInfo): + custom_ranking_info (~.job_service.SearchJobsRequest.CustomRankingInfo): Controls over how job documents get ranked on top of existing relevance score (determined by API algorithm). @@ -528,7 +528,7 @@ class CustomRankingInfo(proto.Message): [SearchJobsRequest][google.cloud.talent.v4.SearchJobsRequest]. Attributes: - importance_level (google.cloud.talent_v4.types.SearchJobsRequest.CustomRankingInfo.ImportanceLevel): + importance_level (~.job_service.SearchJobsRequest.CustomRankingInfo.ImportanceLevel): Required. Controls over how important the score of [CustomRankingInfo.ranking_expression][google.cloud.talent.v4.SearchJobsRequest.CustomRankingInfo.ranking_expression] gets applied to job's final ranking position. @@ -623,17 +623,17 @@ class SearchJobsResponse(proto.Message): r"""Response for SearchJob method. Attributes: - matching_jobs (Sequence[google.cloud.talent_v4.types.SearchJobsResponse.MatchingJob]): + matching_jobs (Sequence[~.job_service.SearchJobsResponse.MatchingJob]): The Job entities that match the specified [SearchJobsRequest][google.cloud.talent.v4.SearchJobsRequest]. - histogram_query_results (Sequence[google.cloud.talent_v4.types.HistogramQueryResult]): + histogram_query_results (Sequence[~.histogram.HistogramQueryResult]): The histogram results that match with specified [SearchJobsRequest.histogram_queries][google.cloud.talent.v4.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[google.cloud.talent_v4.types.Location]): + 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.v4.Location.location_type] @@ -644,7 +644,7 @@ class SearchJobsResponse(proto.Message): query. Note: This size is precise only if the total is less than 100,000. - metadata (google.cloud.talent_v4.types.ResponseMetadata): + metadata (~.common.ResponseMetadata): Additional information for the API invocation, such as the request tracking id. broadened_query_jobs_count (int): @@ -659,7 +659,7 @@ class SearchJobsResponse(proto.Message): broadening) query. If this field is non-zero, subsequent requests with offset after this result set should contain all broadened results. - spell_correction (google.cloud.talent_v4.types.SpellingCorrection): + spell_correction (~.common.SpellingCorrection): The spell checking result, and correction. """ @@ -668,7 +668,7 @@ class MatchingJob(proto.Message): [SearchJobsResponse][google.cloud.talent.v4.SearchJobsResponse]. Attributes: - job (google.cloud.talent_v4.types.Job): + job (~.gct_job.Job): Job resource that matches the specified [SearchJobsRequest][google.cloud.talent.v4.SearchJobsRequest]. job_summary (str): @@ -687,7 +687,7 @@ class MatchingJob(proto.Message): 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 (google.cloud.talent_v4.types.SearchJobsResponse.CommuteInfo): + commute_info (~.job_service.SearchJobsResponse.CommuteInfo): Commute information which is generated based on specified [CommuteFilter][google.cloud.talent.v4.CommuteFilter]. """ @@ -708,10 +708,10 @@ class CommuteInfo(proto.Message): r"""Commute details related to this job. Attributes: - job_location (google.cloud.talent_v4.types.Location): + job_location (~.common.Location): Location used as the destination in the commute calculation. - travel_duration (google.protobuf.duration_pb2.Duration): + 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 @@ -762,7 +762,7 @@ class BatchCreateJobsRequest(proto.Message): The format is "projects/{project_id}/tenants/{tenant_id}". For example, "projects/foo/tenants/bar". - jobs (Sequence[google.cloud.talent_v4.types.Job]): + jobs (Sequence[~.gct_job.Job]): Required. The jobs to be created. A maximum of 200 jobs can be created in a batch. """ @@ -782,10 +782,10 @@ class BatchUpdateJobsRequest(proto.Message): The format is "projects/{project_id}/tenants/{tenant_id}". For example, "projects/foo/tenants/bar". - jobs (Sequence[google.cloud.talent_v4.types.Job]): + jobs (Sequence[~.gct_job.Job]): Required. The jobs to be updated. A maximum of 200 jobs can be updated in a batch. - update_mask (google.protobuf.field_mask_pb2.FieldMask): + 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. @@ -848,7 +848,7 @@ class JobResult(proto.Message): r"""Mutation result of a job from a batch operation. Attributes: - job (google.cloud.talent_v4.types.Job): + job (~.gct_job.Job): Here [Job][google.cloud.talent.v4.Job] only contains basic information including [name][google.cloud.talent.v4.Job.name], @@ -858,7 +858,7 @@ class JobResult(proto.Message): [requisition_id][google.cloud.talent.v4.Job.requisition_id], use getJob method to retrieve detailed information of the created/updated job. - status (google.rpc.status_pb2.Status): + status (~.gr_status.Status): The status of the job processed. This field is populated if the processing of the [job][google.cloud.talent.v4.JobResult.job] fails. @@ -877,7 +877,7 @@ class BatchCreateJobsResponse(proto.Message): in case of success. Attributes: - job_results (Sequence[google.cloud.talent_v4.types.JobResult]): + job_results (Sequence[~.job_service.JobResult]): List of job mutation results from a batch create operation. It can change until operation status is FINISHED, FAILED or CANCELLED. @@ -894,7 +894,7 @@ class BatchUpdateJobsResponse(proto.Message): in case of success. Attributes: - job_results (Sequence[google.cloud.talent_v4.types.JobResult]): + job_results (Sequence[~.job_service.JobResult]): List of job mutation results from a batch update operation. It can change until operation status is FINISHED, FAILED or CANCELLED. @@ -911,7 +911,7 @@ class BatchDeleteJobsResponse(proto.Message): in case of success. Attributes: - job_results (Sequence[google.cloud.talent_v4.types.JobResult]): + job_results (Sequence[~.job_service.JobResult]): List of job mutation results from a batch delete operation. It can change until operation status is FINISHED, FAILED or CANCELLED. diff --git a/google/cloud/talent_v4/types/tenant_service.py b/google/cloud/talent_v4/types/tenant_service.py index be5e4d8d..2f77b0d1 100644 --- a/google/cloud/talent_v4/types/tenant_service.py +++ b/google/cloud/talent_v4/types/tenant_service.py @@ -46,7 +46,7 @@ class CreateTenantRequest(proto.Message): The format is "projects/{project_id}", for example, "projects/foo". - tenant (google.cloud.talent_v4.types.Tenant): + tenant (~.gct_tenant.Tenant): Required. The tenant to be created. """ @@ -73,10 +73,10 @@ class UpdateTenantRequest(proto.Message): r"""Request for updating a specified tenant. Attributes: - tenant (google.cloud.talent_v4.types.Tenant): + tenant (~.gct_tenant.Tenant): Required. The tenant resource to replace the current resource in the system. - update_mask (google.protobuf.field_mask_pb2.FieldMask): + update_mask (~.field_mask.FieldMask): Strongly recommended for the best service experience. If @@ -139,11 +139,11 @@ class ListTenantsResponse(proto.Message): r"""The List tenants response object. Attributes: - tenants (Sequence[google.cloud.talent_v4.types.Tenant]): + tenants (Sequence[~.gct_tenant.Tenant]): Tenants for the current client. next_page_token (str): A token to retrieve the next page of results. - metadata (google.cloud.talent_v4.types.ResponseMetadata): + metadata (~.common.ResponseMetadata): Additional information for the API invocation, such as the request tracking id. """ diff --git a/google/cloud/talent_v4beta1/__init__.py b/google/cloud/talent_v4beta1/__init__.py index c7d0e217..4743ac58 100644 --- a/google/cloud/talent_v4beta1/__init__.py +++ b/google/cloud/talent_v4beta1/__init__.py @@ -157,6 +157,7 @@ "CommuteFilter", "CommuteMethod", "Company", + "CompanyServiceClient", "CompanySize", "CompensationFilter", "CompensationInfo", @@ -243,7 +244,6 @@ "SpellingCorrection", "SummarizedProfile", "Tenant", - "TenantServiceClient", "TimeFilter", "TimestampRange", "UpdateApplicationRequest", @@ -253,5 +253,5 @@ "UpdateTenantRequest", "Visibility", "WorkExperienceFilter", - "CompanyServiceClient", + "TenantServiceClient", ) diff --git a/google/cloud/talent_v4beta1/services/application_service/async_client.py b/google/cloud/talent_v4beta1/services/application_service/async_client.py index 0d274c27..8236846b 100644 --- a/google/cloud/talent_v4beta1/services/application_service/async_client.py +++ b/google/cloud/talent_v4beta1/services/application_service/async_client.py @@ -92,7 +92,6 @@ class ApplicationServiceAsyncClient: ApplicationServiceClient.parse_common_location_path ) - from_service_account_info = ApplicationServiceClient.from_service_account_info from_service_account_file = ApplicationServiceClient.from_service_account_file from_service_account_json = from_service_account_file @@ -171,7 +170,7 @@ async def create_application( r"""Creates a new application entity. Args: - request (:class:`google.cloud.talent_v4beta1.types.CreateApplicationRequest`): + request (:class:`~.application_service.CreateApplicationRequest`): The request object. The Request of the CreateApplication method. parent (:class:`str`): @@ -181,14 +180,12 @@ async def create_application( 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:`google.cloud.talent_v4beta1.types.Application`): + 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. @@ -200,7 +197,7 @@ async def create_application( sent along with the request as metadata. Returns: - google.cloud.talent_v4beta1.types.Application: + ~.gct_application.Application: Resource that represents a job application record of a candidate. @@ -257,7 +254,7 @@ async def get_application( r"""Retrieves specified application. Args: - request (:class:`google.cloud.talent_v4beta1.types.GetApplicationRequest`): + request (:class:`~.application_service.GetApplicationRequest`): The request object. Request for getting a application by name. name (:class:`str`): @@ -268,7 +265,6 @@ async def get_application( "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. @@ -280,7 +276,7 @@ async def get_application( sent along with the request as metadata. Returns: - google.cloud.talent_v4beta1.types.Application: + ~.application.Application: Resource that represents a job application record of a candidate. @@ -343,14 +339,13 @@ async def update_application( r"""Updates specified application. Args: - request (:class:`google.cloud.talent_v4beta1.types.UpdateApplicationRequest`): + request (:class:`~.application_service.UpdateApplicationRequest`): The request object. Request for updating a specified application. - application (:class:`google.cloud.talent_v4beta1.types.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. @@ -362,7 +357,7 @@ async def update_application( sent along with the request as metadata. Returns: - google.cloud.talent_v4beta1.types.Application: + ~.gct_application.Application: Resource that represents a job application record of a candidate. @@ -419,7 +414,7 @@ async def delete_application( r"""Deletes specified application. Args: - request (:class:`google.cloud.talent_v4beta1.types.DeleteApplicationRequest`): + 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 @@ -429,7 +424,6 @@ async def delete_application( "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. @@ -497,7 +491,7 @@ async def list_applications( r"""Lists all applications associated with the profile. Args: - request (:class:`google.cloud.talent_v4beta1.types.ListApplicationsRequest`): + request (:class:`~.application_service.ListApplicationsRequest`): The request object. List applications for which the client has ACL visibility. parent (:class:`str`): @@ -507,7 +501,6 @@ async def list_applications( 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. @@ -519,7 +512,7 @@ async def list_applications( sent along with the request as metadata. Returns: - google.cloud.talent_v4beta1.services.application_service.pagers.ListApplicationsAsyncPager: + ~.pagers.ListApplicationsAsyncPager: The List applications response object. Iterating over this object will yield diff --git a/google/cloud/talent_v4beta1/services/application_service/client.py b/google/cloud/talent_v4beta1/services/application_service/client.py index f6c8163a..b8204de1 100644 --- a/google/cloud/talent_v4beta1/services/application_service/client.py +++ b/google/cloud/talent_v4beta1/services/application_service/client.py @@ -120,22 +120,6 @@ def _get_default_mtls_endpoint(api_endpoint): DEFAULT_ENDPOINT ) - @classmethod - def from_service_account_info(cls, info: dict, *args, **kwargs): - """Creates an instance of this client using the provided credentials info. - - Args: - info (dict): The service account private key info. - args: Additional arguments to pass to the constructor. - kwargs: Additional arguments to pass to the constructor. - - Returns: - ApplicationServiceClient: The constructed client. - """ - credentials = service_account.Credentials.from_service_account_info(info) - kwargs["credentials"] = credentials - return cls(*args, **kwargs) - @classmethod def from_service_account_file(cls, filename: str, *args, **kwargs): """Creates an instance of this client using the provided credentials @@ -148,7 +132,7 @@ def from_service_account_file(cls, filename: str, *args, **kwargs): kwargs: Additional arguments to pass to the constructor. Returns: - ApplicationServiceClient: The constructed client. + {@api.name}: The constructed client. """ credentials = service_account.Credentials.from_service_account_file(filename) kwargs["credentials"] = credentials @@ -306,10 +290,10 @@ def __init__( 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 (Union[str, ~.ApplicationServiceTransport]): The transport to use. If set to None, a transport is chosen automatically. - client_options (google.api_core.client_options.ClientOptions): Custom options for the + client_options (client_options_lib.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_ENDPOINT @@ -420,24 +404,22 @@ def create_application( r"""Creates a new application entity. Args: - request (google.cloud.talent_v4beta1.types.CreateApplicationRequest): + request (:class:`~.application_service.CreateApplicationRequest`): The request object. The Request of the CreateApplication method. - parent (str): + 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 (google.cloud.talent_v4beta1.types.Application): + 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. @@ -449,7 +431,7 @@ def create_application( sent along with the request as metadata. Returns: - google.cloud.talent_v4beta1.types.Application: + ~.gct_application.Application: Resource that represents a job application record of a candidate. @@ -507,10 +489,10 @@ def get_application( r"""Retrieves specified application. Args: - request (google.cloud.talent_v4beta1.types.GetApplicationRequest): + request (:class:`~.application_service.GetApplicationRequest`): The request object. Request for getting a application by name. - name (str): + name (:class:`str`): Required. The resource name of the application to be retrieved. @@ -518,7 +500,6 @@ def get_application( "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. @@ -530,7 +511,7 @@ def get_application( sent along with the request as metadata. Returns: - google.cloud.talent_v4beta1.types.Application: + ~.application.Application: Resource that represents a job application record of a candidate. @@ -586,14 +567,13 @@ def update_application( r"""Updates specified application. Args: - request (google.cloud.talent_v4beta1.types.UpdateApplicationRequest): + request (:class:`~.application_service.UpdateApplicationRequest`): The request object. Request for updating a specified application. - application (google.cloud.talent_v4beta1.types.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. @@ -605,7 +585,7 @@ def update_application( sent along with the request as metadata. Returns: - google.cloud.talent_v4beta1.types.Application: + ~.gct_application.Application: Resource that represents a job application record of a candidate. @@ -663,9 +643,9 @@ def delete_application( r"""Deletes specified application. Args: - request (google.cloud.talent_v4beta1.types.DeleteApplicationRequest): + request (:class:`~.application_service.DeleteApplicationRequest`): The request object. Request to delete a application. - name (str): + name (:class:`str`): Required. The resource name of the application to be deleted. @@ -673,7 +653,6 @@ def delete_application( "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. @@ -734,17 +713,16 @@ def list_applications( r"""Lists all applications associated with the profile. Args: - request (google.cloud.talent_v4beta1.types.ListApplicationsRequest): + request (:class:`~.application_service.ListApplicationsRequest`): The request object. List applications for which the client has ACL visibility. - parent (str): + 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. @@ -756,7 +734,7 @@ def list_applications( sent along with the request as metadata. Returns: - google.cloud.talent_v4beta1.services.application_service.pagers.ListApplicationsPager: + ~.pagers.ListApplicationsPager: The List applications response object. Iterating over this object will yield diff --git a/google/cloud/talent_v4beta1/services/application_service/pagers.py b/google/cloud/talent_v4beta1/services/application_service/pagers.py index 12862dc2..0525dae8 100644 --- a/google/cloud/talent_v4beta1/services/application_service/pagers.py +++ b/google/cloud/talent_v4beta1/services/application_service/pagers.py @@ -25,7 +25,7 @@ class ListApplicationsPager: """A pager for iterating through ``list_applications`` requests. This class thinly wraps an initial - :class:`google.cloud.talent_v4beta1.types.ListApplicationsResponse` object, and + :class:`~.application_service.ListApplicationsResponse` object, and provides an ``__iter__`` method to iterate through its ``applications`` field. @@ -34,7 +34,7 @@ class ListApplicationsPager: through the ``applications`` field on the corresponding responses. - All the usual :class:`google.cloud.talent_v4beta1.types.ListApplicationsResponse` + 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. """ @@ -52,9 +52,9 @@ def __init__( Args: method (Callable): The method that was originally called, and which instantiated this pager. - request (google.cloud.talent_v4beta1.types.ListApplicationsRequest): + request (:class:`~.application_service.ListApplicationsRequest`): The initial request object. - response (google.cloud.talent_v4beta1.types.ListApplicationsResponse): + 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. @@ -87,7 +87,7 @@ class ListApplicationsAsyncPager: """A pager for iterating through ``list_applications`` requests. This class thinly wraps an initial - :class:`google.cloud.talent_v4beta1.types.ListApplicationsResponse` object, and + :class:`~.application_service.ListApplicationsResponse` object, and provides an ``__aiter__`` method to iterate through its ``applications`` field. @@ -96,7 +96,7 @@ class ListApplicationsAsyncPager: through the ``applications`` field on the corresponding responses. - All the usual :class:`google.cloud.talent_v4beta1.types.ListApplicationsResponse` + 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. """ @@ -114,9 +114,9 @@ def __init__( Args: method (Callable): The method that was originally called, and which instantiated this pager. - request (google.cloud.talent_v4beta1.types.ListApplicationsRequest): + request (:class:`~.application_service.ListApplicationsRequest`): The initial request object. - response (google.cloud.talent_v4beta1.types.ListApplicationsResponse): + 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. diff --git a/google/cloud/talent_v4beta1/services/company_service/async_client.py b/google/cloud/talent_v4beta1/services/company_service/async_client.py index e8e29ed0..98c39a8e 100644 --- a/google/cloud/talent_v4beta1/services/company_service/async_client.py +++ b/google/cloud/talent_v4beta1/services/company_service/async_client.py @@ -81,7 +81,6 @@ class CompanyServiceAsyncClient: CompanyServiceClient.parse_common_location_path ) - from_service_account_info = CompanyServiceClient.from_service_account_info from_service_account_file = CompanyServiceClient.from_service_account_file from_service_account_json = from_service_account_file @@ -159,7 +158,7 @@ async def create_company( r"""Creates a new company entity. Args: - request (:class:`google.cloud.talent_v4beta1.types.CreateCompanyRequest`): + request (:class:`~.company_service.CreateCompanyRequest`): The request object. The Request of the CreateCompany method. parent (:class:`str`): @@ -171,11 +170,10 @@ async def create_company( 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:`google.cloud.talent_v4beta1.types.Company`): + 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 @@ -188,7 +186,7 @@ async def create_company( sent along with the request as metadata. Returns: - google.cloud.talent_v4beta1.types.Company: + ~.gct_company.Company: A Company resource represents a company in the service. A company is the entity that owns job postings, that is, @@ -249,7 +247,7 @@ async def get_company( r"""Retrieves specified company. Args: - request (:class:`google.cloud.talent_v4beta1.types.GetCompanyRequest`): + request (:class:`~.company_service.GetCompanyRequest`): The request object. Request for getting a company by name. name (:class:`str`): @@ -263,7 +261,6 @@ async def get_company( 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. @@ -275,7 +272,7 @@ async def get_company( sent along with the request as metadata. Returns: - google.cloud.talent_v4beta1.types.Company: + ~.company.Company: A Company resource represents a company in the service. A company is the entity that owns job postings, that is, @@ -342,14 +339,13 @@ async def update_company( r"""Updates specified company. Args: - request (:class:`google.cloud.talent_v4beta1.types.UpdateCompanyRequest`): + request (:class:`~.company_service.UpdateCompanyRequest`): The request object. Request for updating a specified company. - company (:class:`google.cloud.talent_v4beta1.types.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. @@ -361,7 +357,7 @@ async def update_company( sent along with the request as metadata. Returns: - google.cloud.talent_v4beta1.types.Company: + ~.gct_company.Company: A Company resource represents a company in the service. A company is the entity that owns job postings, that is, @@ -424,7 +420,7 @@ async def delete_company( it. Args: - request (:class:`google.cloud.talent_v4beta1.types.DeleteCompanyRequest`): + 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 @@ -436,7 +432,6 @@ async def delete_company( 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. @@ -504,7 +499,7 @@ async def list_companies( r"""Lists all companies associated with the project. Args: - request (:class:`google.cloud.talent_v4beta1.types.ListCompaniesRequest`): + request (:class:`~.company_service.ListCompaniesRequest`): The request object. List companies for which the client has ACL visibility. parent (:class:`str`): @@ -517,7 +512,6 @@ async def list_companies( 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. @@ -529,7 +523,7 @@ async def list_companies( sent along with the request as metadata. Returns: - google.cloud.talent_v4beta1.services.company_service.pagers.ListCompaniesAsyncPager: + ~.pagers.ListCompaniesAsyncPager: The List companies response object. Iterating over this object will yield results and resolve additional pages diff --git a/google/cloud/talent_v4beta1/services/company_service/client.py b/google/cloud/talent_v4beta1/services/company_service/client.py index 228516b4..e4638852 100644 --- a/google/cloud/talent_v4beta1/services/company_service/client.py +++ b/google/cloud/talent_v4beta1/services/company_service/client.py @@ -115,22 +115,6 @@ def _get_default_mtls_endpoint(api_endpoint): DEFAULT_ENDPOINT ) - @classmethod - def from_service_account_info(cls, info: dict, *args, **kwargs): - """Creates an instance of this client using the provided credentials info. - - Args: - info (dict): The service account private key info. - args: Additional arguments to pass to the constructor. - kwargs: Additional arguments to pass to the constructor. - - Returns: - CompanyServiceClient: The constructed client. - """ - credentials = service_account.Credentials.from_service_account_info(info) - kwargs["credentials"] = credentials - return cls(*args, **kwargs) - @classmethod def from_service_account_file(cls, filename: str, *args, **kwargs): """Creates an instance of this client using the provided credentials @@ -143,7 +127,7 @@ def from_service_account_file(cls, filename: str, *args, **kwargs): kwargs: Additional arguments to pass to the constructor. Returns: - CompanyServiceClient: The constructed client. + {@api.name}: The constructed client. """ credentials = service_account.Credentials.from_service_account_file(filename) kwargs["credentials"] = credentials @@ -251,10 +235,10 @@ def __init__( 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 (Union[str, ~.CompanyServiceTransport]): The transport to use. If set to None, a transport is chosen automatically. - client_options (google.api_core.client_options.ClientOptions): Custom options for the + client_options (client_options_lib.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_ENDPOINT @@ -365,10 +349,10 @@ def create_company( r"""Creates a new company entity. Args: - request (google.cloud.talent_v4beta1.types.CreateCompanyRequest): + request (:class:`~.company_service.CreateCompanyRequest`): The request object. The Request of the CreateCompany method. - parent (str): + parent (:class:`str`): Required. Resource name of the tenant under which the company is created. @@ -377,11 +361,10 @@ def create_company( 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 (google.cloud.talent_v4beta1.types.Company): + 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 @@ -394,7 +377,7 @@ def create_company( sent along with the request as metadata. Returns: - google.cloud.talent_v4beta1.types.Company: + ~.gct_company.Company: A Company resource represents a company in the service. A company is the entity that owns job postings, that is, @@ -456,10 +439,10 @@ def get_company( r"""Retrieves specified company. Args: - request (google.cloud.talent_v4beta1.types.GetCompanyRequest): + request (:class:`~.company_service.GetCompanyRequest`): The request object. Request for getting a company by name. - name (str): + name (:class:`str`): Required. The resource name of the company to be retrieved. @@ -470,7 +453,6 @@ def get_company( 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. @@ -482,7 +464,7 @@ def get_company( sent along with the request as metadata. Returns: - google.cloud.talent_v4beta1.types.Company: + ~.company.Company: A Company resource represents a company in the service. A company is the entity that owns job postings, that is, @@ -542,14 +524,13 @@ def update_company( r"""Updates specified company. Args: - request (google.cloud.talent_v4beta1.types.UpdateCompanyRequest): + request (:class:`~.company_service.UpdateCompanyRequest`): The request object. Request for updating a specified company. - company (google.cloud.talent_v4beta1.types.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. @@ -561,7 +542,7 @@ def update_company( sent along with the request as metadata. Returns: - google.cloud.talent_v4beta1.types.Company: + ~.gct_company.Company: A Company resource represents a company in the service. A company is the entity that owns job postings, that is, @@ -625,9 +606,9 @@ def delete_company( it. Args: - request (google.cloud.talent_v4beta1.types.DeleteCompanyRequest): + request (:class:`~.company_service.DeleteCompanyRequest`): The request object. Request to delete a company. - name (str): + name (:class:`str`): Required. The resource name of the company to be deleted. @@ -637,7 +618,6 @@ def delete_company( 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. @@ -698,10 +678,10 @@ def list_companies( r"""Lists all companies associated with the project. Args: - request (google.cloud.talent_v4beta1.types.ListCompaniesRequest): + request (:class:`~.company_service.ListCompaniesRequest`): The request object. List companies for which the client has ACL visibility. - parent (str): + parent (:class:`str`): Required. Resource name of the tenant under which the company is created. @@ -711,7 +691,6 @@ def list_companies( 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. @@ -723,7 +702,7 @@ def list_companies( sent along with the request as metadata. Returns: - google.cloud.talent_v4beta1.services.company_service.pagers.ListCompaniesPager: + ~.pagers.ListCompaniesPager: The List companies response object. Iterating over this object will yield results and resolve additional pages diff --git a/google/cloud/talent_v4beta1/services/company_service/pagers.py b/google/cloud/talent_v4beta1/services/company_service/pagers.py index d3cf81a7..6b25c9a9 100644 --- a/google/cloud/talent_v4beta1/services/company_service/pagers.py +++ b/google/cloud/talent_v4beta1/services/company_service/pagers.py @@ -25,7 +25,7 @@ class ListCompaniesPager: """A pager for iterating through ``list_companies`` requests. This class thinly wraps an initial - :class:`google.cloud.talent_v4beta1.types.ListCompaniesResponse` object, and + :class:`~.company_service.ListCompaniesResponse` object, and provides an ``__iter__`` method to iterate through its ``companies`` field. @@ -34,7 +34,7 @@ class ListCompaniesPager: through the ``companies`` field on the corresponding responses. - All the usual :class:`google.cloud.talent_v4beta1.types.ListCompaniesResponse` + 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. """ @@ -52,9 +52,9 @@ def __init__( Args: method (Callable): The method that was originally called, and which instantiated this pager. - request (google.cloud.talent_v4beta1.types.ListCompaniesRequest): + request (:class:`~.company_service.ListCompaniesRequest`): The initial request object. - response (google.cloud.talent_v4beta1.types.ListCompaniesResponse): + 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. @@ -87,7 +87,7 @@ class ListCompaniesAsyncPager: """A pager for iterating through ``list_companies`` requests. This class thinly wraps an initial - :class:`google.cloud.talent_v4beta1.types.ListCompaniesResponse` object, and + :class:`~.company_service.ListCompaniesResponse` object, and provides an ``__aiter__`` method to iterate through its ``companies`` field. @@ -96,7 +96,7 @@ class ListCompaniesAsyncPager: through the ``companies`` field on the corresponding responses. - All the usual :class:`google.cloud.talent_v4beta1.types.ListCompaniesResponse` + 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. """ @@ -114,9 +114,9 @@ def __init__( Args: method (Callable): The method that was originally called, and which instantiated this pager. - request (google.cloud.talent_v4beta1.types.ListCompaniesRequest): + request (:class:`~.company_service.ListCompaniesRequest`): The initial request object. - response (google.cloud.talent_v4beta1.types.ListCompaniesResponse): + 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. diff --git a/google/cloud/talent_v4beta1/services/completion/async_client.py b/google/cloud/talent_v4beta1/services/completion/async_client.py index 7472c5f0..40da92eb 100644 --- a/google/cloud/talent_v4beta1/services/completion/async_client.py +++ b/google/cloud/talent_v4beta1/services/completion/async_client.py @@ -70,7 +70,6 @@ class CompletionAsyncClient: CompletionClient.parse_common_location_path ) - from_service_account_info = CompletionClient.from_service_account_info from_service_account_file = CompletionClient.from_service_account_file from_service_account_json = from_service_account_file @@ -148,7 +147,7 @@ async def complete_query( complete search box. Args: - request (:class:`google.cloud.talent_v4beta1.types.CompleteQueryRequest`): + request (:class:`~.completion_service.CompleteQueryRequest`): The request object. Auto-complete parameters. retry (google.api_core.retry.Retry): Designation of what errors, if any, @@ -158,7 +157,7 @@ async def complete_query( sent along with the request as metadata. Returns: - google.cloud.talent_v4beta1.types.CompleteQueryResponse: + ~.completion_service.CompleteQueryResponse: Response of auto-complete query. """ # Create or coerce a protobuf request object. diff --git a/google/cloud/talent_v4beta1/services/completion/client.py b/google/cloud/talent_v4beta1/services/completion/client.py index b704925c..f01febaf 100644 --- a/google/cloud/talent_v4beta1/services/completion/client.py +++ b/google/cloud/talent_v4beta1/services/completion/client.py @@ -108,22 +108,6 @@ def _get_default_mtls_endpoint(api_endpoint): DEFAULT_ENDPOINT ) - @classmethod - def from_service_account_info(cls, info: dict, *args, **kwargs): - """Creates an instance of this client using the provided credentials info. - - Args: - info (dict): The service account private key info. - args: Additional arguments to pass to the constructor. - kwargs: Additional arguments to pass to the constructor. - - Returns: - CompletionClient: The constructed client. - """ - credentials = service_account.Credentials.from_service_account_info(info) - kwargs["credentials"] = credentials - return cls(*args, **kwargs) - @classmethod def from_service_account_file(cls, filename: str, *args, **kwargs): """Creates an instance of this client using the provided credentials @@ -136,7 +120,7 @@ def from_service_account_file(cls, filename: str, *args, **kwargs): kwargs: Additional arguments to pass to the constructor. Returns: - CompletionClient: The constructed client. + {@api.name}: The constructed client. """ credentials = service_account.Credentials.from_service_account_file(filename) kwargs["credentials"] = credentials @@ -244,10 +228,10 @@ def __init__( 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 (Union[str, ~.CompletionTransport]): The transport to use. If set to None, a transport is chosen automatically. - client_options (google.api_core.client_options.ClientOptions): Custom options for the + client_options (client_options_lib.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_ENDPOINT @@ -358,7 +342,7 @@ def complete_query( complete search box. Args: - request (google.cloud.talent_v4beta1.types.CompleteQueryRequest): + request (:class:`~.completion_service.CompleteQueryRequest`): The request object. Auto-complete parameters. retry (google.api_core.retry.Retry): Designation of what errors, if any, @@ -368,7 +352,7 @@ def complete_query( sent along with the request as metadata. Returns: - google.cloud.talent_v4beta1.types.CompleteQueryResponse: + ~.completion_service.CompleteQueryResponse: Response of auto-complete query. """ # Create or coerce a protobuf request object. diff --git a/google/cloud/talent_v4beta1/services/event_service/async_client.py b/google/cloud/talent_v4beta1/services/event_service/async_client.py index c90c5964..553aed17 100644 --- a/google/cloud/talent_v4beta1/services/event_service/async_client.py +++ b/google/cloud/talent_v4beta1/services/event_service/async_client.py @@ -73,7 +73,6 @@ class EventServiceAsyncClient: EventServiceClient.parse_common_location_path ) - from_service_account_info = EventServiceClient.from_service_account_info from_service_account_file = EventServiceClient.from_service_account_file from_service_account_json = from_service_account_file @@ -157,7 +156,7 @@ async def create_client_event( about self service tools. Args: - request (:class:`google.cloud.talent_v4beta1.types.CreateClientEventRequest`): + request (:class:`~.event_service.CreateClientEventRequest`): The request object. The report event request. parent (:class:`str`): Required. Resource name of the tenant under which the @@ -168,15 +167,13 @@ async def create_client_event( 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:`google.cloud.talent_v4beta1.types.ClientEvent`): + 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. @@ -188,7 +185,7 @@ async def create_client_event( sent along with the request as metadata. Returns: - google.cloud.talent_v4beta1.types.ClientEvent: + ~.event.ClientEvent: An event issued when an end user interacts with the application that implements Cloud Talent Solution. diff --git a/google/cloud/talent_v4beta1/services/event_service/client.py b/google/cloud/talent_v4beta1/services/event_service/client.py index c38b8537..21204729 100644 --- a/google/cloud/talent_v4beta1/services/event_service/client.py +++ b/google/cloud/talent_v4beta1/services/event_service/client.py @@ -109,22 +109,6 @@ def _get_default_mtls_endpoint(api_endpoint): DEFAULT_ENDPOINT ) - @classmethod - def from_service_account_info(cls, info: dict, *args, **kwargs): - """Creates an instance of this client using the provided credentials info. - - Args: - info (dict): The service account private key info. - args: Additional arguments to pass to the constructor. - kwargs: Additional arguments to pass to the constructor. - - Returns: - EventServiceClient: The constructed client. - """ - credentials = service_account.Credentials.from_service_account_info(info) - kwargs["credentials"] = credentials - return cls(*args, **kwargs) - @classmethod def from_service_account_file(cls, filename: str, *args, **kwargs): """Creates an instance of this client using the provided credentials @@ -137,7 +121,7 @@ def from_service_account_file(cls, filename: str, *args, **kwargs): kwargs: Additional arguments to pass to the constructor. Returns: - EventServiceClient: The constructed client. + {@api.name}: The constructed client. """ credentials = service_account.Credentials.from_service_account_file(filename) kwargs["credentials"] = credentials @@ -245,10 +229,10 @@ def __init__( 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 (Union[str, ~.EventServiceTransport]): The transport to use. If set to None, a transport is chosen automatically. - client_options (google.api_core.client_options.ClientOptions): Custom options for the + client_options (client_options_lib.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_ENDPOINT @@ -365,9 +349,9 @@ def create_client_event( about self service tools. Args: - request (google.cloud.talent_v4beta1.types.CreateClientEventRequest): + request (:class:`~.event_service.CreateClientEventRequest`): The request object. The report event request. - parent (str): + parent (:class:`str`): Required. Resource name of the tenant under which the event is created. @@ -376,15 +360,13 @@ def create_client_event( 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 (google.cloud.talent_v4beta1.types.ClientEvent): + 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. @@ -396,7 +378,7 @@ def create_client_event( sent along with the request as metadata. Returns: - google.cloud.talent_v4beta1.types.ClientEvent: + ~.event.ClientEvent: An event issued when an end user interacts with the application that implements Cloud Talent Solution. diff --git a/google/cloud/talent_v4beta1/services/job_service/async_client.py b/google/cloud/talent_v4beta1/services/job_service/async_client.py index 0c9d7d91..a5ad40c6 100644 --- a/google/cloud/talent_v4beta1/services/job_service/async_client.py +++ b/google/cloud/talent_v4beta1/services/job_service/async_client.py @@ -80,7 +80,6 @@ class JobServiceAsyncClient: JobServiceClient.parse_common_location_path ) - from_service_account_info = JobServiceClient.from_service_account_info from_service_account_file = JobServiceClient.from_service_account_file from_service_account_json = from_service_account_file @@ -160,7 +159,7 @@ async def create_job( but it may take up to 5 minutes. Args: - request (:class:`google.cloud.talent_v4beta1.types.CreateJobRequest`): + request (:class:`~.job_service.CreateJobRequest`): The request object. Create job request. parent (:class:`str`): Required. The resource name of the tenant under which @@ -171,11 +170,10 @@ async def create_job( 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:`google.cloud.talent_v4beta1.types.Job`): + 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 @@ -188,11 +186,12 @@ async def create_job( sent along with the request as metadata. Returns: - google.cloud.talent_v4beta1.types.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. + ~.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. @@ -248,7 +247,7 @@ async def batch_create_jobs( r"""Begins executing a batch create jobs operation. Args: - request (:class:`google.cloud.talent_v4beta1.types.BatchCreateJobsRequest`): + 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 @@ -259,11 +258,10 @@ async def batch_create_jobs( 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[google.cloud.talent_v4beta1.types.Job]`): + 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 @@ -276,14 +274,18 @@ async def batch_create_jobs( sent along with the request as metadata. Returns: - google.api_core.operation_async.AsyncOperation: + ~.operation_async.AsyncOperation: An object representing a long-running operation. - The result type for the operation will be :class:`google.cloud.talent_v4beta1.types.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. + 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. @@ -348,7 +350,7 @@ async def get_job( recently EXPIRED within the last 90 days. Args: - request (:class:`google.cloud.talent_v4beta1.types.GetJobRequest`): + request (:class:`~.job_service.GetJobRequest`): The request object. Get job request. name (:class:`str`): Required. The resource name of the job to retrieve. @@ -359,7 +361,6 @@ async def get_job( 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. @@ -371,11 +372,12 @@ async def get_job( sent along with the request as metadata. Returns: - google.cloud.talent_v4beta1.types.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. + ~.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. @@ -439,9 +441,9 @@ async def update_job( minutes. Args: - request (:class:`google.cloud.talent_v4beta1.types.UpdateJobRequest`): + request (:class:`~.job_service.UpdateJobRequest`): The request object. Update job request. - job (:class:`google.cloud.talent_v4beta1.types.Job`): + 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 @@ -454,11 +456,12 @@ async def update_job( sent along with the request as metadata. Returns: - google.cloud.talent_v4beta1.types.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. + ~.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. @@ -512,7 +515,7 @@ async def batch_update_jobs( r"""Begins executing a batch update jobs operation. Args: - request (:class:`google.cloud.talent_v4beta1.types.BatchUpdateJobsRequest`): + 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 @@ -523,11 +526,10 @@ async def batch_update_jobs( 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[google.cloud.talent_v4beta1.types.Job]`): + 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 @@ -540,14 +542,18 @@ async def batch_update_jobs( sent along with the request as metadata. Returns: - google.api_core.operation_async.AsyncOperation: + ~.operation_async.AsyncOperation: An object representing a long-running operation. - The result type for the operation will be :class:`google.cloud.talent_v4beta1.types.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. + 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. @@ -613,7 +619,7 @@ async def delete_job( seconds, but it may take up to 5 minutes. Args: - request (:class:`google.cloud.talent_v4beta1.types.DeleteJobRequest`): + request (:class:`~.job_service.DeleteJobRequest`): The request object. Delete job request. name (:class:`str`): Required. The resource name of the job to be deleted. @@ -624,7 +630,6 @@ async def delete_job( 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. @@ -694,7 +699,7 @@ async def batch_delete_jobs( filter. Args: - request (:class:`google.cloud.talent_v4beta1.types.BatchDeleteJobsRequest`): + request (:class:`~.job_service.BatchDeleteJobsRequest`): The request object. Batch delete jobs request. parent (:class:`str`): Required. The resource name of the tenant under which @@ -705,7 +710,6 @@ async def batch_delete_jobs( 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. @@ -721,8 +725,7 @@ async def batch_delete_jobs( - ``requisitionId`` (Required) Sample Query: companyName = "projects/foo/companies/bar" - AND requisitionId = "req-1" - + AND requisitionId = "req-1". This corresponds to the ``filter`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -785,7 +788,7 @@ async def list_jobs( r"""Lists jobs by filter. Args: - request (:class:`google.cloud.talent_v4beta1.types.ListJobsRequest`): + request (:class:`~.job_service.ListJobsRequest`): The request object. List jobs request. parent (:class:`str`): Required. The resource name of the tenant under which @@ -796,7 +799,6 @@ async def list_jobs( 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. @@ -822,8 +824,7 @@ async def list_jobs( requisitionId = "req-1" - companyName = "projects/foo/tenants/bar/companies/baz" AND status = - "EXPIRED" - + "EXPIRED". This corresponds to the ``filter`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -835,7 +836,7 @@ async def list_jobs( sent along with the request as metadata. Returns: - google.cloud.talent_v4beta1.services.job_service.pagers.ListJobsAsyncPager: + ~.pagers.ListJobsAsyncPager: List jobs response. Iterating over this object will yield results and resolve additional pages @@ -913,7 +914,7 @@ async def search_jobs( has permission to search against. Args: - request (:class:`google.cloud.talent_v4beta1.types.SearchJobsRequest`): + request (:class:`~.job_service.SearchJobsRequest`): The request object. The Request body of the `SearchJobs` call. @@ -924,7 +925,7 @@ async def search_jobs( sent along with the request as metadata. Returns: - google.cloud.talent_v4beta1.services.job_service.pagers.SearchJobsAsyncPager: + ~.pagers.SearchJobsAsyncPager: Response for SearchJob method. Iterating over this object will yield results and resolve additional pages @@ -984,7 +985,7 @@ async def search_jobs_for_alert( permission to search against. Args: - request (:class:`google.cloud.talent_v4beta1.types.SearchJobsRequest`): + request (:class:`~.job_service.SearchJobsRequest`): The request object. The Request body of the `SearchJobs` call. @@ -995,7 +996,7 @@ async def search_jobs_for_alert( sent along with the request as metadata. Returns: - google.cloud.talent_v4beta1.services.job_service.pagers.SearchJobsForAlertAsyncPager: + ~.pagers.SearchJobsForAlertAsyncPager: Response for SearchJob method. Iterating over this object will yield results and resolve additional pages diff --git a/google/cloud/talent_v4beta1/services/job_service/client.py b/google/cloud/talent_v4beta1/services/job_service/client.py index ddc96a07..726b75ae 100644 --- a/google/cloud/talent_v4beta1/services/job_service/client.py +++ b/google/cloud/talent_v4beta1/services/job_service/client.py @@ -116,22 +116,6 @@ def _get_default_mtls_endpoint(api_endpoint): DEFAULT_ENDPOINT ) - @classmethod - def from_service_account_info(cls, info: dict, *args, **kwargs): - """Creates an instance of this client using the provided credentials info. - - Args: - info (dict): The service account private key info. - args: Additional arguments to pass to the constructor. - kwargs: Additional arguments to pass to the constructor. - - Returns: - JobServiceClient: The constructed client. - """ - credentials = service_account.Credentials.from_service_account_info(info) - kwargs["credentials"] = credentials - return cls(*args, **kwargs) - @classmethod def from_service_account_file(cls, filename: str, *args, **kwargs): """Creates an instance of this client using the provided credentials @@ -144,7 +128,7 @@ def from_service_account_file(cls, filename: str, *args, **kwargs): kwargs: Additional arguments to pass to the constructor. Returns: - JobServiceClient: The constructed client. + {@api.name}: The constructed client. """ credentials = service_account.Credentials.from_service_account_file(filename) kwargs["credentials"] = credentials @@ -268,10 +252,10 @@ def __init__( 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 (Union[str, ~.JobServiceTransport]): The transport to use. If set to None, a transport is chosen automatically. - client_options (google.api_core.client_options.ClientOptions): Custom options for the + client_options (client_options_lib.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_ENDPOINT @@ -384,9 +368,9 @@ def create_job( but it may take up to 5 minutes. Args: - request (google.cloud.talent_v4beta1.types.CreateJobRequest): + request (:class:`~.job_service.CreateJobRequest`): The request object. Create job request. - parent (str): + parent (:class:`str`): Required. The resource name of the tenant under which the job is created. @@ -395,11 +379,10 @@ def create_job( 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 (google.cloud.talent_v4beta1.types.Job): + 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 @@ -412,11 +395,12 @@ def create_job( sent along with the request as metadata. Returns: - google.cloud.talent_v4beta1.types.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. + ~.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. @@ -473,9 +457,9 @@ def batch_create_jobs( r"""Begins executing a batch create jobs operation. Args: - request (google.cloud.talent_v4beta1.types.BatchCreateJobsRequest): + request (:class:`~.job_service.BatchCreateJobsRequest`): The request object. Request to create a batch of jobs. - parent (str): + parent (:class:`str`): Required. The resource name of the tenant under which the job is created. @@ -484,11 +468,10 @@ def batch_create_jobs( 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 (Sequence[google.cloud.talent_v4beta1.types.Job]): + 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 @@ -501,14 +484,18 @@ def batch_create_jobs( sent along with the request as metadata. Returns: - google.api_core.operation.Operation: + ~.operation.Operation: An object representing a long-running operation. - The result type for the operation will be :class:`google.cloud.talent_v4beta1.types.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. + 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. @@ -574,9 +561,9 @@ def get_job( recently EXPIRED within the last 90 days. Args: - request (google.cloud.talent_v4beta1.types.GetJobRequest): + request (:class:`~.job_service.GetJobRequest`): The request object. Get job request. - name (str): + name (:class:`str`): Required. The resource name of the job to retrieve. The format is @@ -585,7 +572,6 @@ def get_job( 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. @@ -597,11 +583,12 @@ def get_job( sent along with the request as metadata. Returns: - google.cloud.talent_v4beta1.types.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. + ~.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. @@ -658,9 +645,9 @@ def update_job( minutes. Args: - request (google.cloud.talent_v4beta1.types.UpdateJobRequest): + request (:class:`~.job_service.UpdateJobRequest`): The request object. Update job request. - job (google.cloud.talent_v4beta1.types.Job): + 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 @@ -673,11 +660,12 @@ def update_job( sent along with the request as metadata. Returns: - google.cloud.talent_v4beta1.types.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. + ~.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. @@ -732,9 +720,9 @@ def batch_update_jobs( r"""Begins executing a batch update jobs operation. Args: - request (google.cloud.talent_v4beta1.types.BatchUpdateJobsRequest): + request (:class:`~.job_service.BatchUpdateJobsRequest`): The request object. Request to update a batch of jobs. - parent (str): + parent (:class:`str`): Required. The resource name of the tenant under which the job is created. @@ -743,11 +731,10 @@ def batch_update_jobs( 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 (Sequence[google.cloud.talent_v4beta1.types.Job]): + 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 @@ -760,14 +747,18 @@ def batch_update_jobs( sent along with the request as metadata. Returns: - google.api_core.operation.Operation: + ~.operation.Operation: An object representing a long-running operation. - The result type for the operation will be :class:`google.cloud.talent_v4beta1.types.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. + 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. @@ -834,9 +825,9 @@ def delete_job( seconds, but it may take up to 5 minutes. Args: - request (google.cloud.talent_v4beta1.types.DeleteJobRequest): + request (:class:`~.job_service.DeleteJobRequest`): The request object. Delete job request. - name (str): + name (:class:`str`): Required. The resource name of the job to be deleted. The format is @@ -845,7 +836,6 @@ def delete_job( 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. @@ -908,9 +898,9 @@ def batch_delete_jobs( filter. Args: - request (google.cloud.talent_v4beta1.types.BatchDeleteJobsRequest): + request (:class:`~.job_service.BatchDeleteJobsRequest`): The request object. Batch delete jobs request. - parent (str): + parent (:class:`str`): Required. The resource name of the tenant under which the job is created. @@ -919,11 +909,10 @@ def batch_delete_jobs( 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 (str): + filter (:class:`str`): Required. The filter string specifies the jobs to be deleted. @@ -935,8 +924,7 @@ def batch_delete_jobs( - ``requisitionId`` (Required) Sample Query: companyName = "projects/foo/companies/bar" - AND requisitionId = "req-1" - + AND requisitionId = "req-1". This corresponds to the ``filter`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -1000,9 +988,9 @@ def list_jobs( r"""Lists jobs by filter. Args: - request (google.cloud.talent_v4beta1.types.ListJobsRequest): + request (:class:`~.job_service.ListJobsRequest`): The request object. List jobs request. - parent (str): + parent (:class:`str`): Required. The resource name of the tenant under which the job is created. @@ -1011,11 +999,10 @@ def list_jobs( 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 (str): + filter (:class:`str`): Required. The filter string specifies the jobs to be enumerated. @@ -1037,8 +1024,7 @@ def list_jobs( requisitionId = "req-1" - companyName = "projects/foo/tenants/bar/companies/baz" AND status = - "EXPIRED" - + "EXPIRED". This corresponds to the ``filter`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -1050,7 +1036,7 @@ def list_jobs( sent along with the request as metadata. Returns: - google.cloud.talent_v4beta1.services.job_service.pagers.ListJobsPager: + ~.pagers.ListJobsPager: List jobs response. Iterating over this object will yield results and resolve additional pages @@ -1121,7 +1107,7 @@ def search_jobs( has permission to search against. Args: - request (google.cloud.talent_v4beta1.types.SearchJobsRequest): + request (:class:`~.job_service.SearchJobsRequest`): The request object. The Request body of the `SearchJobs` call. @@ -1132,7 +1118,7 @@ def search_jobs( sent along with the request as metadata. Returns: - google.cloud.talent_v4beta1.services.job_service.pagers.SearchJobsPager: + ~.pagers.SearchJobsPager: Response for SearchJob method. Iterating over this object will yield results and resolve additional pages @@ -1193,7 +1179,7 @@ def search_jobs_for_alert( permission to search against. Args: - request (google.cloud.talent_v4beta1.types.SearchJobsRequest): + request (:class:`~.job_service.SearchJobsRequest`): The request object. The Request body of the `SearchJobs` call. @@ -1204,7 +1190,7 @@ def search_jobs_for_alert( sent along with the request as metadata. Returns: - google.cloud.talent_v4beta1.services.job_service.pagers.SearchJobsForAlertPager: + ~.pagers.SearchJobsForAlertPager: Response for SearchJob method. Iterating over this object will yield results and resolve additional pages diff --git a/google/cloud/talent_v4beta1/services/job_service/pagers.py b/google/cloud/talent_v4beta1/services/job_service/pagers.py index 57d6d4c1..fcefff46 100644 --- a/google/cloud/talent_v4beta1/services/job_service/pagers.py +++ b/google/cloud/talent_v4beta1/services/job_service/pagers.py @@ -25,7 +25,7 @@ class ListJobsPager: """A pager for iterating through ``list_jobs`` requests. This class thinly wraps an initial - :class:`google.cloud.talent_v4beta1.types.ListJobsResponse` object, and + :class:`~.job_service.ListJobsResponse` object, and provides an ``__iter__`` method to iterate through its ``jobs`` field. @@ -34,7 +34,7 @@ class ListJobsPager: through the ``jobs`` field on the corresponding responses. - All the usual :class:`google.cloud.talent_v4beta1.types.ListJobsResponse` + 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. """ @@ -52,9 +52,9 @@ def __init__( Args: method (Callable): The method that was originally called, and which instantiated this pager. - request (google.cloud.talent_v4beta1.types.ListJobsRequest): + request (:class:`~.job_service.ListJobsRequest`): The initial request object. - response (google.cloud.talent_v4beta1.types.ListJobsResponse): + 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. @@ -87,7 +87,7 @@ class ListJobsAsyncPager: """A pager for iterating through ``list_jobs`` requests. This class thinly wraps an initial - :class:`google.cloud.talent_v4beta1.types.ListJobsResponse` object, and + :class:`~.job_service.ListJobsResponse` object, and provides an ``__aiter__`` method to iterate through its ``jobs`` field. @@ -96,7 +96,7 @@ class ListJobsAsyncPager: through the ``jobs`` field on the corresponding responses. - All the usual :class:`google.cloud.talent_v4beta1.types.ListJobsResponse` + 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. """ @@ -114,9 +114,9 @@ def __init__( Args: method (Callable): The method that was originally called, and which instantiated this pager. - request (google.cloud.talent_v4beta1.types.ListJobsRequest): + request (:class:`~.job_service.ListJobsRequest`): The initial request object. - response (google.cloud.talent_v4beta1.types.ListJobsResponse): + 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. @@ -153,7 +153,7 @@ class SearchJobsPager: """A pager for iterating through ``search_jobs`` requests. This class thinly wraps an initial - :class:`google.cloud.talent_v4beta1.types.SearchJobsResponse` object, and + :class:`~.job_service.SearchJobsResponse` object, and provides an ``__iter__`` method to iterate through its ``matching_jobs`` field. @@ -162,7 +162,7 @@ class SearchJobsPager: through the ``matching_jobs`` field on the corresponding responses. - All the usual :class:`google.cloud.talent_v4beta1.types.SearchJobsResponse` + 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. """ @@ -180,9 +180,9 @@ def __init__( Args: method (Callable): The method that was originally called, and which instantiated this pager. - request (google.cloud.talent_v4beta1.types.SearchJobsRequest): + request (:class:`~.job_service.SearchJobsRequest`): The initial request object. - response (google.cloud.talent_v4beta1.types.SearchJobsResponse): + 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. @@ -215,7 +215,7 @@ class SearchJobsAsyncPager: """A pager for iterating through ``search_jobs`` requests. This class thinly wraps an initial - :class:`google.cloud.talent_v4beta1.types.SearchJobsResponse` object, and + :class:`~.job_service.SearchJobsResponse` object, and provides an ``__aiter__`` method to iterate through its ``matching_jobs`` field. @@ -224,7 +224,7 @@ class SearchJobsAsyncPager: through the ``matching_jobs`` field on the corresponding responses. - All the usual :class:`google.cloud.talent_v4beta1.types.SearchJobsResponse` + 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. """ @@ -242,9 +242,9 @@ def __init__( Args: method (Callable): The method that was originally called, and which instantiated this pager. - request (google.cloud.talent_v4beta1.types.SearchJobsRequest): + request (:class:`~.job_service.SearchJobsRequest`): The initial request object. - response (google.cloud.talent_v4beta1.types.SearchJobsResponse): + 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. @@ -281,7 +281,7 @@ class SearchJobsForAlertPager: """A pager for iterating through ``search_jobs_for_alert`` requests. This class thinly wraps an initial - :class:`google.cloud.talent_v4beta1.types.SearchJobsResponse` object, and + :class:`~.job_service.SearchJobsResponse` object, and provides an ``__iter__`` method to iterate through its ``matching_jobs`` field. @@ -290,7 +290,7 @@ class SearchJobsForAlertPager: through the ``matching_jobs`` field on the corresponding responses. - All the usual :class:`google.cloud.talent_v4beta1.types.SearchJobsResponse` + 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. """ @@ -308,9 +308,9 @@ def __init__( Args: method (Callable): The method that was originally called, and which instantiated this pager. - request (google.cloud.talent_v4beta1.types.SearchJobsRequest): + request (:class:`~.job_service.SearchJobsRequest`): The initial request object. - response (google.cloud.talent_v4beta1.types.SearchJobsResponse): + 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. @@ -343,7 +343,7 @@ class SearchJobsForAlertAsyncPager: """A pager for iterating through ``search_jobs_for_alert`` requests. This class thinly wraps an initial - :class:`google.cloud.talent_v4beta1.types.SearchJobsResponse` object, and + :class:`~.job_service.SearchJobsResponse` object, and provides an ``__aiter__`` method to iterate through its ``matching_jobs`` field. @@ -352,7 +352,7 @@ class SearchJobsForAlertAsyncPager: through the ``matching_jobs`` field on the corresponding responses. - All the usual :class:`google.cloud.talent_v4beta1.types.SearchJobsResponse` + 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. """ @@ -370,9 +370,9 @@ def __init__( Args: method (Callable): The method that was originally called, and which instantiated this pager. - request (google.cloud.talent_v4beta1.types.SearchJobsRequest): + request (:class:`~.job_service.SearchJobsRequest`): The initial request object. - response (google.cloud.talent_v4beta1.types.SearchJobsResponse): + 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. diff --git a/google/cloud/talent_v4beta1/services/profile_service/async_client.py b/google/cloud/talent_v4beta1/services/profile_service/async_client.py index 5ea23b8a..914e2bf4 100644 --- a/google/cloud/talent_v4beta1/services/profile_service/async_client.py +++ b/google/cloud/talent_v4beta1/services/profile_service/async_client.py @@ -86,7 +86,6 @@ class ProfileServiceAsyncClient: ProfileServiceClient.parse_common_location_path ) - from_service_account_info = ProfileServiceClient.from_service_account_info from_service_account_file = ProfileServiceClient.from_service_account_file from_service_account_json = from_service_account_file @@ -163,7 +162,7 @@ async def list_profiles( r"""Lists profiles by filter. The order is unspecified. Args: - request (:class:`google.cloud.talent_v4beta1.types.ListProfilesRequest`): + request (:class:`~.profile_service.ListProfilesRequest`): The request object. List profiles request. parent (:class:`str`): Required. The resource name of the tenant under which @@ -172,7 +171,6 @@ async def list_profiles( 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. @@ -184,7 +182,7 @@ async def list_profiles( sent along with the request as metadata. Returns: - google.cloud.talent_v4beta1.services.profile_service.pagers.ListProfilesAsyncPager: + ~.pagers.ListProfilesAsyncPager: The List profiles response object. Iterating over this object will yield results and resolve additional pages @@ -256,7 +254,7 @@ async def create_profile( r"""Creates and returns a new profile. Args: - request (:class:`google.cloud.talent_v4beta1.types.CreateProfileRequest`): + request (:class:`~.profile_service.CreateProfileRequest`): The request object. Create profile request. parent (:class:`str`): Required. The name of the tenant this profile belongs @@ -265,11 +263,10 @@ async def create_profile( 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:`google.cloud.talent_v4beta1.types.Profile`): + 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 @@ -282,7 +279,7 @@ async def create_profile( sent along with the request as metadata. Returns: - google.cloud.talent_v4beta1.types.Profile: + ~.gct_profile.Profile: A resource that represents the profile for a job candidate (also referred to as a "single-source @@ -341,7 +338,7 @@ async def get_profile( r"""Gets the specified profile. Args: - request (:class:`google.cloud.talent_v4beta1.types.GetProfileRequest`): + request (:class:`~.profile_service.GetProfileRequest`): The request object. Get profile request. name (:class:`str`): Required. Resource name of the profile to get. @@ -349,7 +346,6 @@ async def get_profile( 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. @@ -361,7 +357,7 @@ async def get_profile( sent along with the request as metadata. Returns: - google.cloud.talent_v4beta1.types.Profile: + ~.profile.Profile: A resource that represents the profile for a job candidate (also referred to as a "single-source @@ -427,9 +423,9 @@ async def update_profile( result. Args: - request (:class:`google.cloud.talent_v4beta1.types.UpdateProfileRequest`): + request (:class:`~.profile_service.UpdateProfileRequest`): The request object. Update profile request - profile (:class:`google.cloud.talent_v4beta1.types.Profile`): + 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 @@ -442,7 +438,7 @@ async def update_profile( sent along with the request as metadata. Returns: - google.cloud.talent_v4beta1.types.Profile: + ~.gct_profile.Profile: A resource that represents the profile for a job candidate (also referred to as a "single-source @@ -503,7 +499,7 @@ async def delete_profile( or assignments associated. Args: - request (:class:`google.cloud.talent_v4beta1.types.DeleteProfileRequest`): + request (:class:`~.profile_service.DeleteProfileRequest`): The request object. Delete profile request. name (:class:`str`): Required. Resource name of the profile to be deleted. @@ -511,7 +507,6 @@ async def delete_profile( 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. @@ -586,7 +581,7 @@ async def search_profiles( for more information. Args: - request (:class:`google.cloud.talent_v4beta1.types.SearchProfilesRequest`): + request (:class:`~.profile_service.SearchProfilesRequest`): The request object. The request body of the `SearchProfiles` call. @@ -597,7 +592,7 @@ async def search_profiles( sent along with the request as metadata. Returns: - google.cloud.talent_v4beta1.services.profile_service.pagers.SearchProfilesAsyncPager: + ~.pagers.SearchProfilesAsyncPager: Response of SearchProfiles method. Iterating over this object will yield results and resolve additional pages diff --git a/google/cloud/talent_v4beta1/services/profile_service/client.py b/google/cloud/talent_v4beta1/services/profile_service/client.py index 6347da06..4cef4bba 100644 --- a/google/cloud/talent_v4beta1/services/profile_service/client.py +++ b/google/cloud/talent_v4beta1/services/profile_service/client.py @@ -118,22 +118,6 @@ def _get_default_mtls_endpoint(api_endpoint): DEFAULT_ENDPOINT ) - @classmethod - def from_service_account_info(cls, info: dict, *args, **kwargs): - """Creates an instance of this client using the provided credentials info. - - Args: - info (dict): The service account private key info. - args: Additional arguments to pass to the constructor. - kwargs: Additional arguments to pass to the constructor. - - Returns: - ProfileServiceClient: The constructed client. - """ - credentials = service_account.Credentials.from_service_account_info(info) - kwargs["credentials"] = credentials - return cls(*args, **kwargs) - @classmethod def from_service_account_file(cls, filename: str, *args, **kwargs): """Creates an instance of this client using the provided credentials @@ -146,7 +130,7 @@ def from_service_account_file(cls, filename: str, *args, **kwargs): kwargs: Additional arguments to pass to the constructor. Returns: - ProfileServiceClient: The constructed client. + {@api.name}: The constructed client. """ credentials = service_account.Credentials.from_service_account_file(filename) kwargs["credentials"] = credentials @@ -267,10 +251,10 @@ def __init__( 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 (Union[str, ~.ProfileServiceTransport]): The transport to use. If set to None, a transport is chosen automatically. - client_options (google.api_core.client_options.ClientOptions): Custom options for the + client_options (client_options_lib.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_ENDPOINT @@ -380,16 +364,15 @@ def list_profiles( r"""Lists profiles by filter. The order is unspecified. Args: - request (google.cloud.talent_v4beta1.types.ListProfilesRequest): + request (:class:`~.profile_service.ListProfilesRequest`): The request object. List profiles request. - parent (str): + 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. @@ -401,7 +384,7 @@ def list_profiles( sent along with the request as metadata. Returns: - google.cloud.talent_v4beta1.services.profile_service.pagers.ListProfilesPager: + ~.pagers.ListProfilesPager: The List profiles response object. Iterating over this object will yield results and resolve additional pages @@ -466,20 +449,19 @@ def create_profile( r"""Creates and returns a new profile. Args: - request (google.cloud.talent_v4beta1.types.CreateProfileRequest): + request (:class:`~.profile_service.CreateProfileRequest`): The request object. Create profile request. - parent (str): + 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 (google.cloud.talent_v4beta1.types.Profile): + 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 @@ -492,7 +474,7 @@ def create_profile( sent along with the request as metadata. Returns: - google.cloud.talent_v4beta1.types.Profile: + ~.gct_profile.Profile: A resource that represents the profile for a job candidate (also referred to as a "single-source @@ -552,15 +534,14 @@ def get_profile( r"""Gets the specified profile. Args: - request (google.cloud.talent_v4beta1.types.GetProfileRequest): + request (:class:`~.profile_service.GetProfileRequest`): The request object. Get profile request. - name (str): + 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. @@ -572,7 +553,7 @@ def get_profile( sent along with the request as metadata. Returns: - google.cloud.talent_v4beta1.types.Profile: + ~.profile.Profile: A resource that represents the profile for a job candidate (also referred to as a "single-source @@ -631,9 +612,9 @@ def update_profile( result. Args: - request (google.cloud.talent_v4beta1.types.UpdateProfileRequest): + request (:class:`~.profile_service.UpdateProfileRequest`): The request object. Update profile request - profile (google.cloud.talent_v4beta1.types.Profile): + 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 @@ -646,7 +627,7 @@ def update_profile( sent along with the request as metadata. Returns: - google.cloud.talent_v4beta1.types.Profile: + ~.gct_profile.Profile: A resource that represents the profile for a job candidate (also referred to as a "single-source @@ -708,15 +689,14 @@ def delete_profile( or assignments associated. Args: - request (google.cloud.talent_v4beta1.types.DeleteProfileRequest): + request (:class:`~.profile_service.DeleteProfileRequest`): The request object. Delete profile request. - name (str): + 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. @@ -784,7 +764,7 @@ def search_profiles( for more information. Args: - request (google.cloud.talent_v4beta1.types.SearchProfilesRequest): + request (:class:`~.profile_service.SearchProfilesRequest`): The request object. The request body of the `SearchProfiles` call. @@ -795,7 +775,7 @@ def search_profiles( sent along with the request as metadata. Returns: - google.cloud.talent_v4beta1.services.profile_service.pagers.SearchProfilesPager: + ~.pagers.SearchProfilesPager: Response of SearchProfiles method. Iterating over this object will yield results and resolve additional pages diff --git a/google/cloud/talent_v4beta1/services/profile_service/pagers.py b/google/cloud/talent_v4beta1/services/profile_service/pagers.py index 29de6067..c2f71326 100644 --- a/google/cloud/talent_v4beta1/services/profile_service/pagers.py +++ b/google/cloud/talent_v4beta1/services/profile_service/pagers.py @@ -26,7 +26,7 @@ class ListProfilesPager: """A pager for iterating through ``list_profiles`` requests. This class thinly wraps an initial - :class:`google.cloud.talent_v4beta1.types.ListProfilesResponse` object, and + :class:`~.profile_service.ListProfilesResponse` object, and provides an ``__iter__`` method to iterate through its ``profiles`` field. @@ -35,7 +35,7 @@ class ListProfilesPager: through the ``profiles`` field on the corresponding responses. - All the usual :class:`google.cloud.talent_v4beta1.types.ListProfilesResponse` + 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. """ @@ -53,9 +53,9 @@ def __init__( Args: method (Callable): The method that was originally called, and which instantiated this pager. - request (google.cloud.talent_v4beta1.types.ListProfilesRequest): + request (:class:`~.profile_service.ListProfilesRequest`): The initial request object. - response (google.cloud.talent_v4beta1.types.ListProfilesResponse): + 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. @@ -88,7 +88,7 @@ class ListProfilesAsyncPager: """A pager for iterating through ``list_profiles`` requests. This class thinly wraps an initial - :class:`google.cloud.talent_v4beta1.types.ListProfilesResponse` object, and + :class:`~.profile_service.ListProfilesResponse` object, and provides an ``__aiter__`` method to iterate through its ``profiles`` field. @@ -97,7 +97,7 @@ class ListProfilesAsyncPager: through the ``profiles`` field on the corresponding responses. - All the usual :class:`google.cloud.talent_v4beta1.types.ListProfilesResponse` + 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. """ @@ -115,9 +115,9 @@ def __init__( Args: method (Callable): The method that was originally called, and which instantiated this pager. - request (google.cloud.talent_v4beta1.types.ListProfilesRequest): + request (:class:`~.profile_service.ListProfilesRequest`): The initial request object. - response (google.cloud.talent_v4beta1.types.ListProfilesResponse): + 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. @@ -154,7 +154,7 @@ class SearchProfilesPager: """A pager for iterating through ``search_profiles`` requests. This class thinly wraps an initial - :class:`google.cloud.talent_v4beta1.types.SearchProfilesResponse` object, and + :class:`~.profile_service.SearchProfilesResponse` object, and provides an ``__iter__`` method to iterate through its ``histogram_query_results`` field. @@ -163,7 +163,7 @@ class SearchProfilesPager: through the ``histogram_query_results`` field on the corresponding responses. - All the usual :class:`google.cloud.talent_v4beta1.types.SearchProfilesResponse` + 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. """ @@ -181,9 +181,9 @@ def __init__( Args: method (Callable): The method that was originally called, and which instantiated this pager. - request (google.cloud.talent_v4beta1.types.SearchProfilesRequest): + request (:class:`~.profile_service.SearchProfilesRequest`): The initial request object. - response (google.cloud.talent_v4beta1.types.SearchProfilesResponse): + 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. @@ -216,7 +216,7 @@ class SearchProfilesAsyncPager: """A pager for iterating through ``search_profiles`` requests. This class thinly wraps an initial - :class:`google.cloud.talent_v4beta1.types.SearchProfilesResponse` object, and + :class:`~.profile_service.SearchProfilesResponse` object, and provides an ``__aiter__`` method to iterate through its ``histogram_query_results`` field. @@ -225,7 +225,7 @@ class SearchProfilesAsyncPager: through the ``histogram_query_results`` field on the corresponding responses. - All the usual :class:`google.cloud.talent_v4beta1.types.SearchProfilesResponse` + 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. """ @@ -243,9 +243,9 @@ def __init__( Args: method (Callable): The method that was originally called, and which instantiated this pager. - request (google.cloud.talent_v4beta1.types.SearchProfilesRequest): + request (:class:`~.profile_service.SearchProfilesRequest`): The initial request object. - response (google.cloud.talent_v4beta1.types.SearchProfilesResponse): + 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. diff --git a/google/cloud/talent_v4beta1/services/tenant_service/async_client.py b/google/cloud/talent_v4beta1/services/tenant_service/async_client.py index 450811a6..be6fce85 100644 --- a/google/cloud/talent_v4beta1/services/tenant_service/async_client.py +++ b/google/cloud/talent_v4beta1/services/tenant_service/async_client.py @@ -80,7 +80,6 @@ class TenantServiceAsyncClient: TenantServiceClient.parse_common_location_path ) - from_service_account_info = TenantServiceClient.from_service_account_info from_service_account_file = TenantServiceClient.from_service_account_file from_service_account_json = from_service_account_file @@ -158,7 +157,7 @@ async def create_tenant( r"""Creates a new tenant entity. Args: - request (:class:`google.cloud.talent_v4beta1.types.CreateTenantRequest`): + request (:class:`~.tenant_service.CreateTenantRequest`): The request object. The Request of the CreateTenant method. parent (:class:`str`): @@ -167,11 +166,10 @@ async def create_tenant( 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:`google.cloud.talent_v4beta1.types.Tenant`): + 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 @@ -184,7 +182,7 @@ async def create_tenant( sent along with the request as metadata. Returns: - google.cloud.talent_v4beta1.types.Tenant: + ~.gct_tenant.Tenant: A Tenant resource represents a tenant in the service. A tenant is a group or entity that shares common access with @@ -246,7 +244,7 @@ async def get_tenant( r"""Retrieves specified tenant. Args: - request (:class:`google.cloud.talent_v4beta1.types.GetTenantRequest`): + request (:class:`~.tenant_service.GetTenantRequest`): The request object. Request for getting a tenant by name. name (:class:`str`): @@ -256,7 +254,6 @@ async def get_tenant( 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. @@ -268,7 +265,7 @@ async def get_tenant( sent along with the request as metadata. Returns: - google.cloud.talent_v4beta1.types.Tenant: + ~.tenant.Tenant: A Tenant resource represents a tenant in the service. A tenant is a group or entity that shares common access with @@ -336,14 +333,13 @@ async def update_tenant( r"""Updates specified tenant. Args: - request (:class:`google.cloud.talent_v4beta1.types.UpdateTenantRequest`): + request (:class:`~.tenant_service.UpdateTenantRequest`): The request object. Request for updating a specified tenant. - tenant (:class:`google.cloud.talent_v4beta1.types.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. @@ -355,7 +351,7 @@ async def update_tenant( sent along with the request as metadata. Returns: - google.cloud.talent_v4beta1.types.Tenant: + ~.gct_tenant.Tenant: A Tenant resource represents a tenant in the service. A tenant is a group or entity that shares common access with @@ -417,7 +413,7 @@ async def delete_tenant( r"""Deletes specified tenant. Args: - request (:class:`google.cloud.talent_v4beta1.types.DeleteTenantRequest`): + 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. @@ -425,7 +421,6 @@ async def delete_tenant( 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. @@ -493,7 +488,7 @@ async def list_tenants( r"""Lists all tenants associated with the project. Args: - request (:class:`google.cloud.talent_v4beta1.types.ListTenantsRequest`): + request (:class:`~.tenant_service.ListTenantsRequest`): The request object. List tenants for which the client has ACL visibility. parent (:class:`str`): @@ -502,7 +497,6 @@ async def list_tenants( 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. @@ -514,7 +508,7 @@ async def list_tenants( sent along with the request as metadata. Returns: - google.cloud.talent_v4beta1.services.tenant_service.pagers.ListTenantsAsyncPager: + ~.pagers.ListTenantsAsyncPager: The List tenants response object. Iterating over this object will yield results and resolve additional pages diff --git a/google/cloud/talent_v4beta1/services/tenant_service/client.py b/google/cloud/talent_v4beta1/services/tenant_service/client.py index 88c5a746..52898cda 100644 --- a/google/cloud/talent_v4beta1/services/tenant_service/client.py +++ b/google/cloud/talent_v4beta1/services/tenant_service/client.py @@ -112,22 +112,6 @@ def _get_default_mtls_endpoint(api_endpoint): DEFAULT_ENDPOINT ) - @classmethod - def from_service_account_info(cls, info: dict, *args, **kwargs): - """Creates an instance of this client using the provided credentials info. - - Args: - info (dict): The service account private key info. - args: Additional arguments to pass to the constructor. - kwargs: Additional arguments to pass to the constructor. - - Returns: - TenantServiceClient: The constructed client. - """ - credentials = service_account.Credentials.from_service_account_info(info) - kwargs["credentials"] = credentials - return cls(*args, **kwargs) - @classmethod def from_service_account_file(cls, filename: str, *args, **kwargs): """Creates an instance of this client using the provided credentials @@ -140,7 +124,7 @@ def from_service_account_file(cls, filename: str, *args, **kwargs): kwargs: Additional arguments to pass to the constructor. Returns: - TenantServiceClient: The constructed client. + {@api.name}: The constructed client. """ credentials = service_account.Credentials.from_service_account_file(filename) kwargs["credentials"] = credentials @@ -245,10 +229,10 @@ def __init__( 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 (Union[str, ~.TenantServiceTransport]): The transport to use. If set to None, a transport is chosen automatically. - client_options (google.api_core.client_options.ClientOptions): Custom options for the + client_options (client_options_lib.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_ENDPOINT @@ -359,20 +343,19 @@ def create_tenant( r"""Creates a new tenant entity. Args: - request (google.cloud.talent_v4beta1.types.CreateTenantRequest): + request (:class:`~.tenant_service.CreateTenantRequest`): The request object. The Request of the CreateTenant method. - parent (str): + 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 (google.cloud.talent_v4beta1.types.Tenant): + 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 @@ -385,7 +368,7 @@ def create_tenant( sent along with the request as metadata. Returns: - google.cloud.talent_v4beta1.types.Tenant: + ~.gct_tenant.Tenant: A Tenant resource represents a tenant in the service. A tenant is a group or entity that shares common access with @@ -448,17 +431,16 @@ def get_tenant( r"""Retrieves specified tenant. Args: - request (google.cloud.talent_v4beta1.types.GetTenantRequest): + request (:class:`~.tenant_service.GetTenantRequest`): The request object. Request for getting a tenant by name. - name (str): + 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. @@ -470,7 +452,7 @@ def get_tenant( sent along with the request as metadata. Returns: - google.cloud.talent_v4beta1.types.Tenant: + ~.tenant.Tenant: A Tenant resource represents a tenant in the service. A tenant is a group or entity that shares common access with @@ -531,14 +513,13 @@ def update_tenant( r"""Updates specified tenant. Args: - request (google.cloud.talent_v4beta1.types.UpdateTenantRequest): + request (:class:`~.tenant_service.UpdateTenantRequest`): The request object. Request for updating a specified tenant. - tenant (google.cloud.talent_v4beta1.types.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. @@ -550,7 +531,7 @@ def update_tenant( sent along with the request as metadata. Returns: - google.cloud.talent_v4beta1.types.Tenant: + ~.gct_tenant.Tenant: A Tenant resource represents a tenant in the service. A tenant is a group or entity that shares common access with @@ -613,15 +594,14 @@ def delete_tenant( r"""Deletes specified tenant. Args: - request (google.cloud.talent_v4beta1.types.DeleteTenantRequest): + request (:class:`~.tenant_service.DeleteTenantRequest`): The request object. Request to delete a tenant. - name (str): + 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. @@ -682,16 +662,15 @@ def list_tenants( r"""Lists all tenants associated with the project. Args: - request (google.cloud.talent_v4beta1.types.ListTenantsRequest): + request (:class:`~.tenant_service.ListTenantsRequest`): The request object. List tenants for which the client has ACL visibility. - parent (str): + 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. @@ -703,7 +682,7 @@ def list_tenants( sent along with the request as metadata. Returns: - google.cloud.talent_v4beta1.services.tenant_service.pagers.ListTenantsPager: + ~.pagers.ListTenantsPager: The List tenants response object. Iterating over this object will yield results and resolve additional pages diff --git a/google/cloud/talent_v4beta1/services/tenant_service/pagers.py b/google/cloud/talent_v4beta1/services/tenant_service/pagers.py index 5adc6788..99dfee65 100644 --- a/google/cloud/talent_v4beta1/services/tenant_service/pagers.py +++ b/google/cloud/talent_v4beta1/services/tenant_service/pagers.py @@ -25,7 +25,7 @@ class ListTenantsPager: """A pager for iterating through ``list_tenants`` requests. This class thinly wraps an initial - :class:`google.cloud.talent_v4beta1.types.ListTenantsResponse` object, and + :class:`~.tenant_service.ListTenantsResponse` object, and provides an ``__iter__`` method to iterate through its ``tenants`` field. @@ -34,7 +34,7 @@ class ListTenantsPager: through the ``tenants`` field on the corresponding responses. - All the usual :class:`google.cloud.talent_v4beta1.types.ListTenantsResponse` + 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. """ @@ -52,9 +52,9 @@ def __init__( Args: method (Callable): The method that was originally called, and which instantiated this pager. - request (google.cloud.talent_v4beta1.types.ListTenantsRequest): + request (:class:`~.tenant_service.ListTenantsRequest`): The initial request object. - response (google.cloud.talent_v4beta1.types.ListTenantsResponse): + 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. @@ -87,7 +87,7 @@ class ListTenantsAsyncPager: """A pager for iterating through ``list_tenants`` requests. This class thinly wraps an initial - :class:`google.cloud.talent_v4beta1.types.ListTenantsResponse` object, and + :class:`~.tenant_service.ListTenantsResponse` object, and provides an ``__aiter__`` method to iterate through its ``tenants`` field. @@ -96,7 +96,7 @@ class ListTenantsAsyncPager: through the ``tenants`` field on the corresponding responses. - All the usual :class:`google.cloud.talent_v4beta1.types.ListTenantsResponse` + 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. """ @@ -114,9 +114,9 @@ def __init__( Args: method (Callable): The method that was originally called, and which instantiated this pager. - request (google.cloud.talent_v4beta1.types.ListTenantsRequest): + request (:class:`~.tenant_service.ListTenantsRequest`): The initial request object. - response (google.cloud.talent_v4beta1.types.ListTenantsResponse): + 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. diff --git a/google/cloud/talent_v4beta1/types/application.py b/google/cloud/talent_v4beta1/types/application.py index 41eda976..c407b4bc 100644 --- a/google/cloud/talent_v4beta1/types/application.py +++ b/google/cloud/talent_v4beta1/types/application.py @@ -69,9 +69,9 @@ class Application(proto.Message): The format is "projects/{project_id}/tenants/{tenant_id}/companies/{company_id}". For example, "projects/foo/tenants/bar/companies/baz". - application_date (google.type.date_pb2.Date): + application_date (~.date.Date): The application date. - stage (google.cloud.talent_v4beta1.types.Application.ApplicationStage): + 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 @@ -79,19 +79,19 @@ class Application(proto.Message): possible status, but instead, represents statuses that would be used to indicate to the ML models good / bad matches. - state (google.cloud.talent_v4beta1.types.Application.ApplicationState): + state (~.application.Application.ApplicationState): The application state. - interviews (Sequence[google.cloud.talent_v4beta1.types.Interview]): + 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 (google.protobuf.wrappers_pb2.BoolValue): + referral (~.wrappers.BoolValue): If the candidate is referred by a employee. - create_time (google.protobuf.timestamp_pb2.Timestamp): + create_time (~.timestamp.Timestamp): Required. Reflects the time that the application was created. - update_time (google.protobuf.timestamp_pb2.Timestamp): + update_time (~.timestamp.Timestamp): The last update timestamp. outcome_notes (str): Free text reason behind the recruitement @@ -99,10 +99,10 @@ class Application(proto.Message): reject, reason for an unsuccessful finish, and so on). Number of characters allowed is 100. - outcome (google.cloud.talent_v4beta1.types.Outcome): + outcome (~.common.Outcome): Outcome positiveness shows how positive the outcome is. - is_match (google.protobuf.wrappers_pb2.BoolValue): + is_match (~.wrappers.BoolValue): Output only. Indicates whether this job application is a match to application related filters. This value is only applicable in diff --git a/google/cloud/talent_v4beta1/types/application_service.py b/google/cloud/talent_v4beta1/types/application_service.py index 81a0bae8..8c906e91 100644 --- a/google/cloud/talent_v4beta1/types/application_service.py +++ b/google/cloud/talent_v4beta1/types/application_service.py @@ -47,7 +47,7 @@ class CreateApplicationRequest(proto.Message): The format is "projects/{project_id}/tenants/{tenant_id}/profiles/{profile_id}". For example, "projects/foo/tenants/bar/profiles/baz". - application (google.cloud.talent_v4beta1.types.Application): + application (~.gct_application.Application): Required. The application to be created. """ @@ -79,10 +79,10 @@ class UpdateApplicationRequest(proto.Message): r"""Request for updating a specified application. Attributes: - application (google.cloud.talent_v4beta1.types.Application): + application (~.gct_application.Application): Required. The application resource to replace the current resource in the system. - update_mask (google.protobuf.field_mask_pb2.FieldMask): + update_mask (~.field_mask.FieldMask): Strongly recommended for the best service experience. If @@ -152,11 +152,11 @@ class ListApplicationsResponse(proto.Message): r"""The List applications response object. Attributes: - applications (Sequence[google.cloud.talent_v4beta1.types.Application]): + applications (Sequence[~.gct_application.Application]): Applications for the current client. next_page_token (str): A token to retrieve the next page of results. - metadata (google.cloud.talent_v4beta1.types.ResponseMetadata): + metadata (~.common.ResponseMetadata): Additional information for the API invocation, such as the request tracking id. """ diff --git a/google/cloud/talent_v4beta1/types/common.py b/google/cloud/talent_v4beta1/types/common.py index c1cdd9b5..61614a0a 100644 --- a/google/cloud/talent_v4beta1/types/common.py +++ b/google/cloud/talent_v4beta1/types/common.py @@ -254,9 +254,9 @@ class TimestampRange(proto.Message): r"""Message representing a period of time between two timestamps. Attributes: - start_time (google.protobuf.timestamp_pb2.Timestamp): + start_time (~.timestamp.Timestamp): Begin of the period (inclusive). - end_time (google.protobuf.timestamp_pb2.Timestamp): + end_time (~.timestamp.Timestamp): End of the period (exclusive). """ @@ -270,7 +270,7 @@ class Location(proto.Message): information. Attributes: - location_type (google.cloud.talent_v4beta1.types.Location.LocationType): + 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 @@ -278,13 +278,13 @@ class Location(proto.Message): [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 (google.type.postal_address_pb2.PostalAddress): + 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 (google.type.latlng_pb2.LatLng): + lat_lng (~.latlng.LatLng): An object representing a latitude/longitude pair. radius_miles (float): @@ -390,7 +390,7 @@ class RequestMetadata(proto.Message): and [user_id][google.cloud.talent.v4beta1.RequestMetadata.user_id] for the best service experience. - device_info (google.cloud.talent_v4beta1.types.DeviceInfo): + device_info (~.common.DeviceInfo): The type of device used by the job seeker at the time of the call to the service. """ @@ -426,7 +426,7 @@ class DeviceInfo(proto.Message): devices. Attributes: - device_type (google.cloud.talent_v4beta1.types.DeviceInfo.DeviceType): + device_type (~.common.DeviceInfo.DeviceType): Type of the device. id (str): A device-specific ID. The ID must be a unique @@ -532,14 +532,14 @@ class CompensationInfo(proto.Message): r"""Job compensation details. Attributes: - entries (Sequence[google.cloud.talent_v4beta1.types.CompensationInfo.CompensationEntry]): + 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 (google.cloud.talent_v4beta1.types.CompensationInfo.CompensationRange): + 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] @@ -549,7 +549,7 @@ class CompensationInfo(proto.Message): See [CompensationEntry][google.cloud.talent.v4beta1.CompensationInfo.CompensationEntry] for explanation on compensation annualization. - annualized_total_compensation_range (google.cloud.talent_v4beta1.types.CompensationInfo.CompensationRange): + 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] @@ -631,25 +631,25 @@ class CompensationEntry(proto.Message): [expected_units_per_year][google.cloud.talent.v4beta1.CompensationInfo.CompensationEntry.expected_units_per_year]. Attributes: - type_ (google.cloud.talent_v4beta1.types.CompensationInfo.CompensationType): + type_ (~.common.CompensationInfo.CompensationType): Compensation type. Default is [CompensationType.COMPENSATION_TYPE_UNSPECIFIED][google.cloud.talent.v4beta1.CompensationInfo.CompensationType.COMPENSATION_TYPE_UNSPECIFIED]. - unit (google.cloud.talent_v4beta1.types.CompensationInfo.CompensationUnit): + 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 (google.type.money_pb2.Money): + amount (~.money.Money): Compensation amount. - range_ (google.cloud.talent_v4beta1.types.CompensationInfo.CompensationRange): + 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 (google.protobuf.wrappers_pb2.DoubleValue): + 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] @@ -693,12 +693,12 @@ class CompensationRange(proto.Message): r"""Compensation range. Attributes: - max_compensation (google.type.money_pb2.Money): + 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 (google.type.money_pb2.Money): + 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 @@ -727,10 +727,10 @@ class Certification(proto.Message): display_name (str): Name of license or certification. Number of characters allowed is 100. - acquire_date (google.type.date_pb2.Date): + acquire_date (~.date.Date): Acquisition date or effective date of license or certification. - expire_date (google.type.date_pb2.Date): + expire_date (~.date.Date): Expiration date of license of certification. authority (str): Authority of license, such as government. @@ -760,9 +760,9 @@ class Skill(proto.Message): For example, "Java", "Python". Number of characters allowed is 100. - last_used_date (google.type.date_pb2.Date): + last_used_date (~.date.Date): The last time this skill was used. - level (google.cloud.talent_v4beta1.types.SkillProficiencyLevel): + level (~.common.SkillProficiencyLevel): Skill proficiency level which indicates how proficient the candidate is at this skill. context (str): @@ -791,9 +791,9 @@ class Interview(proto.Message): r"""Details of an interview. Attributes: - rating (google.cloud.talent_v4beta1.types.Rating): + rating (~.common.Rating): The rating on this interview. - outcome (google.cloud.talent_v4beta1.types.Outcome): + outcome (~.common.Outcome): Required. The overall decision resulting from this interview (positive, negative, nuetral). """ @@ -835,7 +835,7 @@ class BatchOperationMetadata(proto.Message): [google.longrunning.Operation.metadata][google.longrunning.Operation.metadata]. Attributes: - state (google.cloud.talent_v4beta1.types.BatchOperationMetadata.State): + state (~.common.BatchOperationMetadata.State): The state of a long running operation. state_description (str): More detailed information about operation @@ -847,14 +847,14 @@ class BatchOperationMetadata(proto.Message): Count of failed item(s) inside an operation. total_count (int): Count of total item(s) inside an operation. - create_time (google.protobuf.timestamp_pb2.Timestamp): + create_time (~.timestamp.Timestamp): The time when the batch operation is created. - update_time (google.protobuf.timestamp_pb2.Timestamp): + 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 (google.protobuf.timestamp_pb2.Timestamp): + 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``. diff --git a/google/cloud/talent_v4beta1/types/company.py b/google/cloud/talent_v4beta1/types/company.py index ed091608..ac333e29 100644 --- a/google/cloud/talent_v4beta1/types/company.py +++ b/google/cloud/talent_v4beta1/types/company.py @@ -53,7 +53,7 @@ class Company(proto.Message): used to uniquely identify the company. The maximum number of allowed characters is 255. - size (google.cloud.talent_v4beta1.types.CompanySize): + size (~.common.CompanySize): The employer's company size. headquarters_address (str): The street address of the company's main headquarters, which @@ -92,7 +92,7 @@ class Company(proto.Message): 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 (google.cloud.talent_v4beta1.types.Company.DerivedInfo): + derived_info (~.company.Company.DerivedInfo): Output only. Derived details about the company. suspended (bool): @@ -106,7 +106,7 @@ class DerivedInfo(proto.Message): r"""Derived details about the company. Attributes: - headquarters_location (google.cloud.talent_v4beta1.types.Location): + headquarters_location (~.common.Location): A structured headquarters location of the company, resolved from [Company.headquarters_address][google.cloud.talent.v4beta1.Company.headquarters_address] diff --git a/google/cloud/talent_v4beta1/types/company_service.py b/google/cloud/talent_v4beta1/types/company_service.py index ab1de2b8..960ab39c 100644 --- a/google/cloud/talent_v4beta1/types/company_service.py +++ b/google/cloud/talent_v4beta1/types/company_service.py @@ -48,7 +48,7 @@ class CreateCompanyRequest(proto.Message): for example, "projects/foo/tenant/bar". If tenant id is unspecified, a default tenant is created, for example, "projects/foo". - company (google.cloud.talent_v4beta1.types.Company): + company (~.gct_company.Company): Required. The company to be created. """ @@ -80,10 +80,10 @@ class UpdateCompanyRequest(proto.Message): r"""Request for updating a specified company. Attributes: - company (google.cloud.talent_v4beta1.types.Company): + company (~.gct_company.Company): Required. The company resource to replace the current resource in the system. - update_mask (google.protobuf.field_mask_pb2.FieldMask): + update_mask (~.field_mask.FieldMask): Strongly recommended for the best service experience. If @@ -165,11 +165,11 @@ class ListCompaniesResponse(proto.Message): r"""The List companies response object. Attributes: - companies (Sequence[google.cloud.talent_v4beta1.types.Company]): + companies (Sequence[~.gct_company.Company]): Companies for the current client. next_page_token (str): A token to retrieve the next page of results. - metadata (google.cloud.talent_v4beta1.types.ResponseMetadata): + metadata (~.common.ResponseMetadata): Additional information for the API invocation, such as the request tracking id. """ diff --git a/google/cloud/talent_v4beta1/types/completion_service.py b/google/cloud/talent_v4beta1/types/completion_service.py index 1b53f07e..69f4882a 100644 --- a/google/cloud/talent_v4beta1/types/completion_service.py +++ b/google/cloud/talent_v4beta1/types/completion_service.py @@ -63,10 +63,10 @@ class CompleteQueryRequest(proto.Message): If tenant id is unspecified, the default tenant is used, for example, "projects/foo". - scope (google.cloud.talent_v4beta1.types.CompleteQueryRequest.CompletionScope): + scope (~.completion_service.CompleteQueryRequest.CompletionScope): The scope of the completion. The defaults is [CompletionScope.PUBLIC][google.cloud.talent.v4beta1.CompleteQueryRequest.CompletionScope.PUBLIC]. - type_ (google.cloud.talent_v4beta1.types.CompleteQueryRequest.CompletionType): + type_ (~.completion_service.CompleteQueryRequest.CompletionType): The completion topic. The default is [CompletionType.COMBINED][google.cloud.talent.v4beta1.CompleteQueryRequest.CompletionType.COMBINED]. """ @@ -103,10 +103,10 @@ class CompleteQueryResponse(proto.Message): r"""Response of auto-complete query. Attributes: - completion_results (Sequence[google.cloud.talent_v4beta1.types.CompleteQueryResponse.CompletionResult]): + completion_results (Sequence[~.completion_service.CompleteQueryResponse.CompletionResult]): Results of the matching job/company candidates. - metadata (google.cloud.talent_v4beta1.types.ResponseMetadata): + metadata (~.common.ResponseMetadata): Additional information for the API invocation, such as the request tracking id. """ @@ -117,7 +117,7 @@ class CompletionResult(proto.Message): Attributes: suggestion (str): The suggestion for the query. - type_ (google.cloud.talent_v4beta1.types.CompleteQueryRequest.CompletionType): + type_ (~.completion_service.CompleteQueryRequest.CompletionType): The completion topic. image_uri (str): The URI of the company image for diff --git a/google/cloud/talent_v4beta1/types/event.py b/google/cloud/talent_v4beta1/types/event.py index 70cec508..4583b654 100644 --- a/google/cloud/talent_v4beta1/types/event.py +++ b/google/cloud/talent_v4beta1/types/event.py @@ -45,13 +45,13 @@ class ClientEvent(proto.Message): event_id (str): Required. A unique identifier, generated by the client application. - create_time (google.protobuf.timestamp_pb2.Timestamp): + create_time (~.timestamp.Timestamp): Required. The timestamp of the event. - job_event (google.cloud.talent_v4beta1.types.JobEvent): + job_event (~.event.JobEvent): An event issued when a job seeker interacts with the application that implements Cloud Talent Solution. - profile_event (google.cloud.talent_v4beta1.types.ProfileEvent): + profile_event (~.event.ProfileEvent): An event issued when a profile searcher interacts with the application that implements Cloud Talent Solution. @@ -81,7 +81,7 @@ class JobEvent(proto.Message): application that implements Cloud Talent Solution. Attributes: - type_ (google.cloud.talent_v4beta1.types.JobEvent.JobEventType): + type_ (~.event.JobEvent.JobEventType): Required. The type of the event (see [JobEventType][google.cloud.talent.v4beta1.JobEvent.JobEventType]). jobs (Sequence[str]): @@ -139,7 +139,7 @@ class ProfileEvent(proto.Message): application that implements Cloud Talent Solution. Attributes: - type_ (google.cloud.talent_v4beta1.types.ProfileEvent.ProfileEventType): + type_ (~.event.ProfileEvent.ProfileEventType): Required. Type of event. profiles (Sequence[str]): Required. The [profile diff --git a/google/cloud/talent_v4beta1/types/event_service.py b/google/cloud/talent_v4beta1/types/event_service.py index d389c18f..dad4a639 100644 --- a/google/cloud/talent_v4beta1/types/event_service.py +++ b/google/cloud/talent_v4beta1/types/event_service.py @@ -38,7 +38,7 @@ class CreateClientEventRequest(proto.Message): for example, "projects/foo/tenant/bar". If tenant id is unspecified, a default tenant is created, for example, "projects/foo". - client_event (google.cloud.talent_v4beta1.types.ClientEvent): + client_event (~.event.ClientEvent): Required. Events issued when end user interacts with customer's application that uses Cloud Talent Solution. diff --git a/google/cloud/talent_v4beta1/types/filters.py b/google/cloud/talent_v4beta1/types/filters.py index 70f87f90..48d631b4 100644 --- a/google/cloud/talent_v4beta1/types/filters.py +++ b/google/cloud/talent_v4beta1/types/filters.py @@ -90,7 +90,7 @@ class JobQuery(proto.Message): example, "projects/foo/companies/bar". At most 20 company filters are allowed. - location_filters (Sequence[google.cloud.talent_v4beta1.types.LocationFilter]): + location_filters (Sequence[~.filters.LocationFilter]): The location filter specifies geo-regions containing the jobs to search against. See [LocationFilter][google.cloud.talent.v4beta1.LocationFilter] @@ -108,7 +108,7 @@ class JobQuery(proto.Message): locations. At most 5 location filters are allowed. - job_categories (Sequence[google.cloud.talent_v4beta1.types.JobCategory]): + job_categories (Sequence[~.common.JobCategory]): The category filter specifies the categories of jobs to search against. See [JobCategory][google.cloud.talent.v4beta1.JobCategory] for @@ -119,7 +119,7 @@ class JobQuery(proto.Message): If multiple values are specified, jobs from any of the specified categories are searched against. - commute_filter (google.cloud.talent_v4beta1.types.CommuteFilter): + commute_filter (~.filters.CommuteFilter): Allows filtering jobs by commute time with different travel methods (for example, driving or public transit). @@ -143,7 +143,7 @@ class JobQuery(proto.Message): companies. At most 20 company display name filters are allowed. - compensation_filter (google.cloud.talent_v4beta1.types.CompensationFilter): + 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 @@ -182,7 +182,7 @@ class JobQuery(proto.Message): misspelled query, for example, "enginee" is corrected to "engineer". Defaults to false: a spell check is performed. - employment_types (Sequence[google.cloud.talent_v4beta1.types.EmploymentType]): + 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]. @@ -205,7 +205,7 @@ class JobQuery(proto.Message): Languages `__. At most 10 language code filters are allowed. - publish_time_range (google.cloud.talent_v4beta1.types.TimestampRange): + publish_time_range (~.common.TimestampRange): Jobs published within a range specified by this filter are searched against. excluded_jobs (Sequence[str]): @@ -259,7 +259,7 @@ class ProfileQuery(proto.Message): Keywords to match any text fields of profiles. For example, "software engineer in Palo Alto". - location_filters (Sequence[google.cloud.talent_v4beta1.types.LocationFilter]): + location_filters (Sequence[~.filters.LocationFilter]): The location filter specifies geo-regions containing the profiles to search against. @@ -379,7 +379,7 @@ class ProfileQuery(proto.Message): If [LocationFilter.distance_in_miles][google.cloud.talent.v4beta1.LocationFilter.distance_in_miles] is negative, an error is thrown. - job_title_filters (Sequence[google.cloud.talent_v4beta1.types.JobTitleFilter]): + job_title_filters (Sequence[~.filters.JobTitleFilter]): Job title filter specifies job titles of profiles to match on. @@ -396,7 +396,7 @@ class ProfileQuery(proto.Message): For example, search for profiles with a job title "Product Manager". - employer_filters (Sequence[google.cloud.talent_v4beta1.types.EmployerFilter]): + employer_filters (Sequence[~.filters.EmployerFilter]): Employer filter specifies employers of profiles to match on. If an employer filter isn't specified, profiles with any @@ -412,7 +412,7 @@ class ProfileQuery(proto.Message): For example, search for profiles that have working experience at "Google LLC". - education_filters (Sequence[google.cloud.talent_v4beta1.types.EducationFilter]): + education_filters (Sequence[~.filters.EducationFilter]): Education filter specifies education of profiles to match on. @@ -428,7 +428,7 @@ class ProfileQuery(proto.Message): the educations. For example, search for profiles with a master degree. - skill_filters (Sequence[google.cloud.talent_v4beta1.types.SkillFilter]): + 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 @@ -444,7 +444,7 @@ class ProfileQuery(proto.Message): For example, search for profiles that have "Java" and "Python" in skill list. - work_experience_filter (Sequence[google.cloud.talent_v4beta1.types.WorkExperienceFilter]): + work_experience_filter (Sequence[~.filters.WorkExperienceFilter]): Work experience filter specifies the total working experience of profiles to match on. @@ -458,23 +458,23 @@ class ProfileQuery(proto.Message): For example, search for profiles with 10 years of work experience. - time_filters (Sequence[google.cloud.talent_v4beta1.types.TimeFilter]): + 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 (google.protobuf.wrappers_pb2.BoolValue): + hirable_filter (~.wrappers.BoolValue): The hirable filter specifies the profile's hirable status to match on. - application_date_filters (Sequence[google.cloud.talent_v4beta1.types.ApplicationDateFilter]): + application_date_filters (Sequence[~.filters.ApplicationDateFilter]): The application date filters specify application date ranges to match on. - application_outcome_notes_filters (Sequence[google.cloud.talent_v4beta1.types.ApplicationOutcomeNotesFilter]): + 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[google.cloud.talent_v4beta1.types.ApplicationJobFilter]): + application_job_filters (Sequence[~.filters.ApplicationJobFilter]): The application job filters specify the job applied for in the application. custom_attribute_filter (str): @@ -507,7 +507,7 @@ class ProfileQuery(proto.Message): Sample Query: (key1 = "TEST" OR LOWER(key1)="test" OR NOT EMPTY(key1)) - candidate_availability_filter (google.cloud.talent_v4beta1.types.CandidateAvailabilityFilter): + candidate_availability_filter (~.filters.CandidateAvailabilityFilter): Deprecated. Use availability_filters instead. The candidate availability filter which filters based on @@ -528,7 +528,7 @@ class ProfileQuery(proto.Message): signals. Specifically, the intent is NOT to indicate the candidate's potential qualification / interest / close ability for a specific job. - availability_filters (Sequence[google.cloud.talent_v4beta1.types.AvailabilityFilter]): + availability_filters (Sequence[~.filters.AvailabilityFilter]): The availability filter which filters based on [Profile.availability_signals][google.cloud.talent.v4beta1.Profile.availability_signals]. @@ -548,7 +548,7 @@ class ProfileQuery(proto.Message): for a [signal_type][google.cloud.talent.v4beta1.AvailabilityFilter.signal_type], an error is thrown. - person_name_filters (Sequence[google.cloud.talent_v4beta1.types.PersonNameFilter]): + person_name_filters (Sequence[~.filters.PersonNameFilter]): Person name filter specifies person name of profiles to match on. If multiple person name filters are specified, @@ -635,7 +635,7 @@ class LocationFilter(proto.Message): 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 (google.type.latlng_pb2.LatLng): + lat_lng (~.latlng.LatLng): The latitude and longitude of the geographic center to search from. This field is ignored if ``address`` is provided. @@ -644,7 +644,7 @@ class LocationFilter(proto.Message): 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 (google.cloud.talent_v4beta1.types.LocationFilter.TelecommutePreference): + 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. @@ -701,12 +701,12 @@ class CompensationFilter(proto.Message): r"""Filter on job compensation type and amount. Attributes: - type_ (google.cloud.talent_v4beta1.types.CompensationFilter.FilterType): + type_ (~.filters.CompensationFilter.FilterType): Required. Type of filter. - units (Sequence[google.cloud.talent_v4beta1.types.CompensationInfo.CompensationUnit]): + units (Sequence[~.common.CompensationInfo.CompensationUnit]): Required. Specify desired ``base compensation entry's`` [CompensationInfo.CompensationUnit][google.cloud.talent.v4beta1.CompensationInfo.CompensationUnit]. - range_ (google.cloud.talent_v4beta1.types.CompensationInfo.CompensationRange): + range_ (~.common.CompensationInfo.CompensationRange): Compensation range. include_jobs_with_unspecified_compensation_range (bool): If set to true, jobs with unspecified @@ -738,13 +738,13 @@ class CommuteFilter(proto.Message): r"""Parameters needed for commute search. Attributes: - commute_method (google.cloud.talent_v4beta1.types.CommuteMethod): + commute_method (~.common.CommuteMethod): Required. The method of transportation to calculate the commute time for. - start_coordinates (google.type.latlng_pb2.LatLng): + start_coordinates (~.latlng.LatLng): Required. The latitude and longitude of the location to calculate the commute time from. - travel_duration (google.protobuf.duration_pb2.Duration): + 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): @@ -754,10 +754,10 @@ class CommuteFilter(proto.Message): 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 (google.cloud.talent_v4beta1.types.CommuteFilter.RoadTraffic): + road_traffic (~.filters.CommuteFilter.RoadTraffic): Specifies the traffic density to use when calculating commute time. - departure_time (google.type.timeofday_pb2.TimeOfDay): + departure_time (~.timeofday.TimeOfDay): The departure time used to calculate traffic impact, represented as [google.type.TimeOfDay][google.type.TimeOfDay] in local time @@ -831,7 +831,7 @@ class EmployerFilter(proto.Message): employer (str): Required. The name of the employer, for example "Google", "Alphabet". - mode (google.cloud.talent_v4beta1.types.EmployerFilter.EmployerFilterMode): + mode (~.filters.EmployerFilter.EmployerFilterMode): Define set of [EmploymentRecord][google.cloud.talent.v4beta1.EmploymentRecord]s to search against. @@ -872,7 +872,7 @@ class EducationFilter(proto.Message): in [Degree.fields_of_study][google.cloud.talent.v4beta1.Degree.fields_of_study]. For example "Computer Science", "Mathematics". - degree_type (google.cloud.talent_v4beta1.types.DegreeType): + 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 @@ -901,10 +901,10 @@ class WorkExperienceFilter(proto.Message): [max_experience][google.cloud.talent.v4beta1.WorkExperienceFilter.max_experience]. Attributes: - min_experience (google.protobuf.duration_pb2.Duration): + min_experience (~.duration.Duration): The minimum duration of the work experience (inclusive). - max_experience (google.protobuf.duration_pb2.Duration): + max_experience (~.duration.Duration): The maximum duration of the work experience (exclusive). """ @@ -927,11 +927,11 @@ class ApplicationDateFilter(proto.Message): are missing. Attributes: - start_date (google.type.date_pb2.Date): + start_date (~.date.Date): Start date. If it's missing, The API matches profiles with application date not after the end date. - end_date (google.type.date_pb2.Date): + end_date (~.date.Date): End date. If it's missing, The API matches profiles with application date not before the start date. @@ -996,17 +996,17 @@ class TimeFilter(proto.Message): r"""Filter on create timestamp or update timestamp of profiles. Attributes: - start_time (google.protobuf.timestamp_pb2.Timestamp): + 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 (google.protobuf.timestamp_pb2.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 (google.cloud.talent_v4beta1.types.TimeFilter.TimeField): + time_field (~.filters.TimeFilter.TimeField): Specifies which time field to filter profiles. Defaults to @@ -1043,9 +1043,9 @@ class AvailabilityFilter(proto.Message): r"""Filter on availability signals. Attributes: - signal_type (google.cloud.talent_v4beta1.types.AvailabilitySignalType): + signal_type (~.common.AvailabilitySignalType): Required. Type of signal to apply filter on. - range_ (google.cloud.talent_v4beta1.types.TimestampRange): + range_ (~.common.TimestampRange): Required. Range of times to filter candidate signals by. required (bool): diff --git a/google/cloud/talent_v4beta1/types/histogram.py b/google/cloud/talent_v4beta1/types/histogram.py index b809ac0b..6c72e53e 100644 --- a/google/cloud/talent_v4beta1/types/histogram.py +++ b/google/cloud/talent_v4beta1/types/histogram.py @@ -50,7 +50,7 @@ class HistogramQueryResult(proto.Message): Attributes: histogram_query (str): Requested histogram expression. - histogram (Sequence[google.cloud.talent_v4beta1.types.HistogramQueryResult.HistogramEntry]): + 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. diff --git a/google/cloud/talent_v4beta1/types/job.py b/google/cloud/talent_v4beta1/types/job.py index a378bbd5..147fbe55 100644 --- a/google/cloud/talent_v4beta1/types/job.py +++ b/google/cloud/talent_v4beta1/types/job.py @@ -117,15 +117,15 @@ class Job(proto.Message): experience. The maximum number of allowed characters is 500. - application_info (google.cloud.talent_v4beta1.types.Job.ApplicationInfo): + application_info (~.job.Job.ApplicationInfo): Job application information. - job_benefits (Sequence[google.cloud.talent_v4beta1.types.JobBenefit]): + job_benefits (Sequence[~.common.JobBenefit]): The benefits included with the job. - compensation_info (google.cloud.talent_v4beta1.types.CompensationInfo): + 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[google.cloud.talent_v4beta1.types.Job.CustomAttributesEntry]): + 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. @@ -140,7 +140,7 @@ class Job(proto.Message): than 255 characters. For unfilterable ``string_values``, the maximum total size of ``string_values`` across all keys is 50KB. - degree_types (Sequence[google.cloud.talent_v4beta1.types.DegreeType]): + degree_types (Sequence[~.common.DegreeType]): The desired education degrees for the job, such as Bachelors, Masters. department (str): @@ -148,7 +148,7 @@ class Job(proto.Message): company with the open position. The maximum number of allowed characters is 255. - employment_types (Sequence[google.cloud.talent_v4beta1.types.EmploymentType]): + 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 @@ -173,7 +173,7 @@ class Job(proto.Message): is present, detected language code based on [Job.description][google.cloud.talent.v4beta1.Job.description] is assigned, otherwise defaults to 'en_US'. - job_level (google.cloud.talent_v4beta1.types.JobLevel): + job_level (~.common.JobLevel): The experience level associated with the job, such as "Entry Level". promotion_value (int): @@ -208,7 +208,7 @@ class Job(proto.Message): markup tags. The maximum number of allowed characters is 10,000. - posting_region (google.cloud.talent_v4beta1.types.PostingRegion): + posting_region (~.common.PostingRegion): The job [PostingRegion][google.cloud.talent.v4beta1.PostingRegion] (for example, state, country) throughout which the job is @@ -224,7 +224,7 @@ class Job(proto.Message): [Job.addresses][google.cloud.talent.v4beta1.Job.addresses] to the same location level as this field is strongly recommended. - visibility (google.cloud.talent_v4beta1.types.Visibility): + visibility (~.common.Visibility): Deprecated. The job is only visible to the owner. The visibility of the job. @@ -232,21 +232,21 @@ class Job(proto.Message): Defaults to [Visibility.ACCOUNT_ONLY][google.cloud.talent.v4beta1.Visibility.ACCOUNT_ONLY] if not specified. - job_start_time (google.protobuf.timestamp_pb2.Timestamp): + 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 (google.protobuf.timestamp_pb2.Timestamp): + 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 (google.protobuf.timestamp_pb2.Timestamp): + 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 (google.protobuf.timestamp_pb2.Timestamp): + posting_expire_time (~.timestamp.Timestamp): Strongly recommended for the best service experience. The expiration timestamp of the job. After this timestamp, @@ -304,19 +304,19 @@ class Job(proto.Message): 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 (google.protobuf.timestamp_pb2.Timestamp): + posting_create_time (~.timestamp.Timestamp): Output only. The timestamp when this job posting was created. - posting_update_time (google.protobuf.timestamp_pb2.Timestamp): + 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 (google.cloud.talent_v4beta1.types.Job.DerivedInfo): + derived_info (~.job.Job.DerivedInfo): Output only. Derived details about the job posting. - processing_options (google.cloud.talent_v4beta1.types.Job.ProcessingOptions): + processing_options (~.job.Job.ProcessingOptions): Options for job processing. """ @@ -356,7 +356,7 @@ class DerivedInfo(proto.Message): r"""Derived details about the job posting. Attributes: - locations (Sequence[google.cloud.talent_v4beta1.types.Location]): + locations (Sequence[~.common.Location]): Structured locations of the job, resolved from [Job.addresses][google.cloud.talent.v4beta1.Job.addresses]. @@ -364,7 +364,7 @@ class DerivedInfo(proto.Message): are exactly matched to [Job.addresses][google.cloud.talent.v4beta1.Job.addresses] in the same order. - job_categories (Sequence[google.cloud.talent_v4beta1.types.JobCategory]): + 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]. @@ -385,7 +385,7 @@ class ProcessingOptions(proto.Message): 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 (google.cloud.talent_v4beta1.types.HtmlSanitization): + html_sanitization (~.common.HtmlSanitization): Option for job HTML content sanitization. Applied fields are: diff --git a/google/cloud/talent_v4beta1/types/job_service.py b/google/cloud/talent_v4beta1/types/job_service.py index 8ee4d6fa..5cad2836 100644 --- a/google/cloud/talent_v4beta1/types/job_service.py +++ b/google/cloud/talent_v4beta1/types/job_service.py @@ -73,7 +73,7 @@ class CreateJobRequest(proto.Message): For example, "projects/foo/tenant/bar". If tenant id is unspecified a default tenant is created. For example, "projects/foo". - job (google.cloud.talent_v4beta1.types.Job): + job (~.gct_job.Job): Required. The Job to be created. """ @@ -104,9 +104,9 @@ class UpdateJobRequest(proto.Message): r"""Update job request. Attributes: - job (google.cloud.talent_v4beta1.types.Job): + job (~.gct_job.Job): Required. The Job to be updated. - update_mask (google.protobuf.field_mask_pb2.FieldMask): + update_mask (~.field_mask.FieldMask): Strongly recommended for the best service experience. If @@ -221,7 +221,7 @@ class ListJobsRequest(proto.Message): maximum allowed page size is 100. Default is 100 if empty or a number < 1 is specified. - job_view (google.cloud.talent_v4beta1.types.JobView): + 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] @@ -243,13 +243,13 @@ class ListJobsResponse(proto.Message): r"""List jobs response. Attributes: - jobs (Sequence[google.cloud.talent_v4beta1.types.Job]): + 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 (google.cloud.talent_v4beta1.types.ResponseMetadata): + metadata (~.common.ResponseMetadata): Additional information for the API invocation, such as the request tracking id. """ @@ -276,17 +276,17 @@ class SearchJobsRequest(proto.Message): For example, "projects/foo/tenant/bar". If tenant id is unspecified, a default tenant is created. For example, "projects/foo". - search_mode (google.cloud.talent_v4beta1.types.SearchJobsRequest.SearchMode): + 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 (google.cloud.talent_v4beta1.types.RequestMetadata): + 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 (google.cloud.talent_v4beta1.types.JobQuery): + job_query (~.filters.JobQuery): Query used to search against jobs, such as keyword, location filters, etc. enable_broadening (bool): @@ -307,7 +307,7 @@ class SearchJobsRequest(proto.Message): Enabling this flag may adversely impact performance. Defaults to false. - histogram_queries (Sequence[google.cloud.talent_v4beta1.types.HistogramQuery]): + histogram_queries (Sequence[~.histogram.HistogramQuery]): An expression specifies a histogram request against matching jobs. @@ -420,7 +420,7 @@ class SearchJobsRequest(proto.Message): - ``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 (google.cloud.talent_v4beta1.types.JobView): + 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] @@ -512,7 +512,7 @@ class SearchJobsRequest(proto.Message): (37.4 feet). Diversification strategy is still applied unless explicitly disabled in [diversification_level][google.cloud.talent.v4beta1.SearchJobsRequest.diversification_level]. - diversification_level (google.cloud.talent_v4beta1.types.SearchJobsRequest.DiversificationLevel): + 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 @@ -524,7 +524,7 @@ class SearchJobsRequest(proto.Message): Defaults to [DiversificationLevel.SIMPLE][google.cloud.talent.v4beta1.SearchJobsRequest.DiversificationLevel.SIMPLE] if no value is specified. - custom_ranking_info (google.cloud.talent_v4beta1.types.SearchJobsRequest.CustomRankingInfo): + custom_ranking_info (~.job_service.SearchJobsRequest.CustomRankingInfo): Controls over how job documents get ranked on top of existing relevance score (determined by API algorithm). @@ -582,7 +582,7 @@ class CustomRankingInfo(proto.Message): [SearchJobsRequest][google.cloud.talent.v4beta1.SearchJobsRequest]. Attributes: - importance_level (google.cloud.talent_v4beta1.types.SearchJobsRequest.CustomRankingInfo.ImportanceLevel): + 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. @@ -679,17 +679,17 @@ class SearchJobsResponse(proto.Message): r"""Response for SearchJob method. Attributes: - matching_jobs (Sequence[google.cloud.talent_v4beta1.types.SearchJobsResponse.MatchingJob]): + matching_jobs (Sequence[~.job_service.SearchJobsResponse.MatchingJob]): The Job entities that match the specified [SearchJobsRequest][google.cloud.talent.v4beta1.SearchJobsRequest]. - histogram_query_results (Sequence[google.cloud.talent_v4beta1.types.HistogramQueryResult]): + 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[google.cloud.talent_v4beta1.types.Location]): + 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] @@ -708,7 +708,7 @@ class SearchJobsResponse(proto.Message): [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 (google.cloud.talent_v4beta1.types.ResponseMetadata): + metadata (~.common.ResponseMetadata): Additional information for the API invocation, such as the request tracking id. broadened_query_jobs_count (int): @@ -723,7 +723,7 @@ class SearchJobsResponse(proto.Message): broadening) query. If this field is non-zero, subsequent requests with offset after this result set should contain all broadened results. - spell_correction (google.cloud.talent_v4beta1.types.SpellingCorrection): + spell_correction (~.common.SpellingCorrection): The spell checking result, and correction. """ @@ -732,7 +732,7 @@ class MatchingJob(proto.Message): [SearchJobsResponse][google.cloud.talent.v4beta1.SearchJobsResponse]. Attributes: - job (google.cloud.talent_v4beta1.types.Job): + job (~.gct_job.Job): Job resource that matches the specified [SearchJobsRequest][google.cloud.talent.v4beta1.SearchJobsRequest]. job_summary (str): @@ -752,7 +752,7 @@ class MatchingJob(proto.Message): 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 (google.cloud.talent_v4beta1.types.SearchJobsResponse.CommuteInfo): + commute_info (~.job_service.SearchJobsResponse.CommuteInfo): Commute information which is generated based on specified [CommuteFilter][google.cloud.talent.v4beta1.CommuteFilter]. """ @@ -773,10 +773,10 @@ class CommuteInfo(proto.Message): r"""Commute details related to this job. Attributes: - job_location (google.cloud.talent_v4beta1.types.Location): + job_location (~.common.Location): Location used as the destination in the commute calculation. - travel_duration (google.protobuf.duration_pb2.Duration): + 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 @@ -831,7 +831,7 @@ class BatchCreateJobsRequest(proto.Message): For example, "projects/foo/tenant/bar". If tenant id is unspecified, a default tenant is created. For example, "projects/foo". - jobs (Sequence[google.cloud.talent_v4beta1.types.Job]): + jobs (Sequence[~.gct_job.Job]): Required. The jobs to be created. """ @@ -852,9 +852,9 @@ class BatchUpdateJobsRequest(proto.Message): For example, "projects/foo/tenant/bar". If tenant id is unspecified, a default tenant is created. For example, "projects/foo". - jobs (Sequence[google.cloud.talent_v4beta1.types.Job]): + jobs (Sequence[~.gct_job.Job]): Required. The jobs to be updated. - update_mask (google.protobuf.field_mask_pb2.FieldMask): + 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. @@ -897,7 +897,7 @@ class JobOperationResult(proto.Message): in case of success. Attributes: - job_results (Sequence[google.cloud.talent_v4beta1.types.JobOperationResult.JobResult]): + 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. @@ -907,7 +907,7 @@ class JobResult(proto.Message): r"""Mutation result of a job. Attributes: - job (google.cloud.talent_v4beta1.types.Job): + job (~.gct_job.Job): Here [Job][google.cloud.talent.v4beta1.Job] only contains basic information including [name][google.cloud.talent.v4beta1.Job.name], @@ -917,7 +917,7 @@ class JobResult(proto.Message): [requisition_id][google.cloud.talent.v4beta1.Job.requisition_id], use getJob method to retrieve detailed information of the created/updated job. - status (google.rpc.status_pb2.Status): + 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] diff --git a/google/cloud/talent_v4beta1/types/profile.py b/google/cloud/talent_v4beta1/types/profile.py index 33c9a31f..38428498 100644 --- a/google/cloud/talent_v4beta1/types/profile.py +++ b/google/cloud/talent_v4beta1/types/profile.py @@ -95,16 +95,16 @@ class Profile(proto.Message): [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 (google.protobuf.wrappers_pb2.BoolValue): + is_hirable (~.wrappers.BoolValue): Indicates the hirable status of the candidate. - create_time (google.protobuf.timestamp_pb2.Timestamp): + create_time (~.timestamp.Timestamp): The timestamp when the profile was first created at this source. - update_time (google.protobuf.timestamp_pb2.Timestamp): + update_time (~.timestamp.Timestamp): The timestamp when the profile was last updated at this source. - candidate_update_time (google.protobuf.timestamp_pb2.Timestamp): + 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. @@ -130,7 +130,7 @@ class Profile(proto.Message): 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 (google.protobuf.timestamp_pb2.Timestamp): + 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 @@ -139,13 +139,13 @@ class Profile(proto.Message): 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 (google.cloud.talent_v4beta1.types.Resume): + resume (~.profile.Resume): The resume representing this profile. - person_names (Sequence[google.cloud.talent_v4beta1.types.PersonName]): + person_names (Sequence[~.profile.PersonName]): The names of the candidate this profile references. Currently only one person name is supported. - addresses (Sequence[google.cloud.talent_v4beta1.types.Address]): + 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: @@ -183,13 +183,13 @@ class Profile(proto.Message): is CONTACT_INFO_USAGE_UNSPECIFIED and [Address.current][google.cloud.talent.v4beta1.Address.current] is false or not set. - email_addresses (Sequence[google.cloud.talent_v4beta1.types.Email]): + email_addresses (Sequence[~.profile.Email]): The candidate's email addresses. - phone_numbers (Sequence[google.cloud.talent_v4beta1.types.Phone]): + phone_numbers (Sequence[~.profile.Phone]): The candidate's phone number(s). - personal_uris (Sequence[google.cloud.talent_v4beta1.types.PersonalUri]): + personal_uris (Sequence[~.profile.PersonalUri]): The candidate's personal URIs. - additional_contact_info (Sequence[google.cloud.talent_v4beta1.types.AdditionalContactInfo]): + 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], @@ -197,7 +197,7 @@ class Profile(proto.Message): and [personal_uris][google.cloud.talent.v4beta1.Profile.personal_uris]. For example, Hang-out, Skype. - employment_records (Sequence[google.cloud.talent_v4beta1.types.EmploymentRecord]): + 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 @@ -215,7 +215,7 @@ class Profile(proto.Message): inferred from user inputs. The limitation for max number of employment records is 100. - education_records (Sequence[google.cloud.talent_v4beta1.types.EducationRecord]): + 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 @@ -232,25 +232,25 @@ class Profile(proto.Message): inferred from user inputs. The limitation for max number of education records is 100. - skills (Sequence[google.cloud.talent_v4beta1.types.Skill]): + 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[google.cloud.talent_v4beta1.types.Activity]): + 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[google.cloud.talent_v4beta1.types.Publication]): + publications (Sequence[~.profile.Publication]): The publications published by the candidate. The limitation for max number of publications is 50. - patents (Sequence[google.cloud.talent_v4beta1.types.Patent]): + patents (Sequence[~.profile.Patent]): The patents acquired by the candidate. - certifications (Sequence[google.cloud.talent_v4beta1.types.Certification]): + certifications (Sequence[~.common.Certification]): The certifications acquired by the candidate. applications (Sequence[str]): Output only. The resource names of the @@ -258,7 +258,7 @@ class Profile(proto.Message): assignments (Sequence[str]): Output only. The resource names of the candidate's assignments. - custom_attributes (Sequence[google.cloud.talent_v4beta1.types.Profile.CustomAttributesEntry]): + 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 @@ -290,10 +290,10 @@ class Profile(proto.Message): 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[google.cloud.talent_v4beta1.types.AvailabilitySignal]): + availability_signals (Sequence[~.profile.AvailabilitySignal]): Output only. Candidate's availability signals. - derived_addresses (Sequence[google.cloud.talent_v4beta1.types.Location]): + derived_addresses (Sequence[~.common.Location]): Output only. Derived locations of the profile, resolved from [Profile.addresses][google.cloud.talent.v4beta1.Profile.addresses]. @@ -390,12 +390,12 @@ class AvailabilitySignal(proto.Message): r"""Candidate availability signal. Attributes: - type_ (google.cloud.talent_v4beta1.types.AvailabilitySignalType): + type_ (~.common.AvailabilitySignalType): Type of signal. - last_update_time (google.protobuf.timestamp_pb2.Timestamp): + last_update_time (~.timestamp.Timestamp): Timestamp of when the given availability activity last happened. - filter_satisfied (google.protobuf.wrappers_pb2.BoolValue): + filter_satisfied (~.wrappers.BoolValue): Indicates if the [last_update_time][google.cloud.talent.v4beta1.AvailabilitySignal.last_update_time] is within @@ -439,7 +439,7 @@ class Resume(proto.Message): 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 (google.cloud.talent_v4beta1.types.Resume.ResumeType): + resume_type (~.profile.Resume.ResumeType): The format of [structured_resume][google.cloud.talent.v4beta1.Resume.structured_resume]. """ @@ -463,7 +463,7 @@ class PersonName(proto.Message): A string represents a person's full name. For example, "Dr. John Smith". Number of characters allowed is 100. - structured_name (google.cloud.talent_v4beta1.types.PersonName.PersonStructuredName): + structured_name (~.profile.PersonName.PersonStructuredName): A person's name in a structured way (last name, first name, suffix, and so on.) preferred_name (str): @@ -538,7 +538,7 @@ class Address(proto.Message): r"""Resource that represents a address. Attributes: - usage (google.cloud.talent_v4beta1.types.ContactInfoUsage): + usage (~.common.ContactInfoUsage): The usage of the address. For example, SCHOOL, WORK, PERSONAL. unstructured_address (str): @@ -547,10 +547,10 @@ class Address(proto.Message): View, CA 94043", "Sunnyvale, California". Number of characters allowed is 100. - structured_address (google.type.postal_address_pb2.PostalAddress): + structured_address (~.postal_address.PostalAddress): Structured address that contains street address, city, state, country, and so on. - current (google.protobuf.wrappers_pb2.BoolValue): + current (~.wrappers.BoolValue): Indicates if it's the person's current address. """ @@ -570,7 +570,7 @@ class Email(proto.Message): r"""Resource that represents a person's email address. Attributes: - usage (google.cloud.talent_v4beta1.types.ContactInfoUsage): + usage (~.common.ContactInfoUsage): The usage of the email address. For example, SCHOOL, WORK, PERSONAL. email_address (str): @@ -587,10 +587,10 @@ class Phone(proto.Message): r"""Resource that represents a person's telephone number. Attributes: - usage (google.cloud.talent_v4beta1.types.ContactInfoUsage): + usage (~.common.ContactInfoUsage): The usage of the phone. For example, SCHOOL, WORK, PERSONAL. - type_ (google.cloud.talent_v4beta1.types.Phone.PhoneType): + type_ (~.profile.Phone.PhoneType): The phone type. For example, LANDLINE, MOBILE, FAX. number (str): @@ -647,7 +647,7 @@ class AdditionalContactInfo(proto.Message): phone, email, URI and addresses. Attributes: - usage (google.cloud.talent_v4beta1.types.ContactInfoUsage): + usage (~.common.ContactInfoUsage): The usage of this contact method. For example, SCHOOL, WORK, PERSONAL. name (str): @@ -671,9 +671,9 @@ class EmploymentRecord(proto.Message): r"""Resource that represents an employment record of a candidate. Attributes: - start_date (google.type.date_pb2.Date): + start_date (~.date.Date): Start date of the employment. - end_date (google.type.date_pb2.Date): + end_date (~.date.Date): End date of the employment. employer_name (str): The name of the employer @@ -685,7 +685,7 @@ class EmploymentRecord(proto.Message): For example, division, department, client, and so on. Number of characters allowed is 100. - address (google.cloud.talent_v4beta1.types.Address): + address (~.profile.Address): The physical address of the employer. job_title (str): The job title of the employment. @@ -695,11 +695,11 @@ class EmploymentRecord(proto.Message): job_description (str): The description of job content. Number of characters allowed is 100,000. - is_supervisor (google.protobuf.wrappers_pb2.BoolValue): + is_supervisor (~.wrappers.BoolValue): If the jobs is a supervisor position. - is_self_employed (google.protobuf.wrappers_pb2.BoolValue): + is_self_employed (~.wrappers.BoolValue): If this employment is self-employed. - is_current (google.protobuf.wrappers_pb2.BoolValue): + is_current (~.wrappers.BoolValue): If this employment is current. job_title_snippet (str): Output only. The job title snippet shows how the @@ -752,11 +752,11 @@ class EducationRecord(proto.Message): r"""Resource that represents an education record of a candidate. Attributes: - start_date (google.type.date_pb2.Date): + start_date (~.date.Date): The start date of the education. - end_date (google.type.date_pb2.Date): + end_date (~.date.Date): The end date of the education. - expected_graduation_date (google.type.date_pb2.Date): + expected_graduation_date (~.date.Date): The expected graduation date if currently pursuing a degree. school_name (str): @@ -764,7 +764,7 @@ class EducationRecord(proto.Message): For example, "Stanford University", "UC Berkeley", and so on. Number of characters allowed is 250. - address (google.cloud.talent_v4beta1.types.Address): + address (~.profile.Address): The physical address of the education institution. degree_description (str): @@ -772,12 +772,12 @@ class EducationRecord(proto.Message): For example, "Master of Science in Computer Science", "B.S in Math". Number of characters allowed is 100. - structured_degree (google.cloud.talent_v4beta1.types.Degree): + 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 (google.protobuf.wrappers_pb2.BoolValue): + is_current (~.wrappers.BoolValue): If this education is current. school_name_snippet (str): Output only. The school name snippet shows how the @@ -824,7 +824,7 @@ class Degree(proto.Message): candidate. Attributes: - degree_type (google.cloud.talent_v4beta1.types.DegreeType): + degree_type (~.common.DegreeType): ISCED degree type. degree_name (str): Full Degree name. @@ -859,9 +859,9 @@ class Activity(proto.Message): uri (str): Activity URI. Number of characters allowed is 4,000. - create_date (google.type.date_pb2.Date): + create_date (~.date.Date): The first creation date of the activity. - update_date (google.type.date_pb2.Date): + update_date (~.date.Date): The last update date of the activity. team_members (Sequence[str]): A list of team members involved in this @@ -870,7 +870,7 @@ class Activity(proto.Message): The limitation for max number of team members is 50. - skills_used (Sequence[google.cloud.talent_v4beta1.types.Skill]): + skills_used (Sequence[~.common.Skill]): A list of skills used in this activity. The limitation for max number of skills used is 50. @@ -939,7 +939,7 @@ class Publication(proto.Message): publisher (str): The publisher of the journal. Number of characters allowed is 100. - publication_date (google.type.date_pb2.Date): + publication_date (~.date.Date): The publication date. publication_type (str): The publication type. @@ -981,10 +981,10 @@ class Patent(proto.Message): patent_status (str): The status of the patent. Number of characters allowed is 100. - patent_status_date (google.type.date_pb2.Date): + patent_status_date (~.date.Date): The date the last time the status of the patent was checked. - patent_filing_date (google.type.date_pb2.Date): + patent_filing_date (~.date.Date): The date that the patent was filed. patent_office (str): The name of the patent office. @@ -995,7 +995,7 @@ class Patent(proto.Message): patent_description (str): The description of the patent. Number of characters allowed is 100,000. - skills_used (Sequence[google.cloud.talent_v4beta1.types.Skill]): + skills_used (Sequence[~.common.Skill]): The skills used in this patent. """ diff --git a/google/cloud/talent_v4beta1/types/profile_service.py b/google/cloud/talent_v4beta1/types/profile_service.py index c64b7c3d..1214e0ab 100644 --- a/google/cloud/talent_v4beta1/types/profile_service.py +++ b/google/cloud/talent_v4beta1/types/profile_service.py @@ -81,7 +81,7 @@ class ListProfilesRequest(proto.Message): returned, at most 100. Default is 100 unless a positive number smaller than 100 is specified. - read_mask (google.protobuf.field_mask_pb2.FieldMask): + 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. @@ -105,7 +105,7 @@ class ListProfilesResponse(proto.Message): r"""The List profiles response object. Attributes: - profiles (Sequence[google.cloud.talent_v4beta1.types.Profile]): + profiles (Sequence[~.gct_profile.Profile]): Profiles for the specific tenant. next_page_token (str): A token to retrieve the next page of results. @@ -132,7 +132,7 @@ class CreateProfileRequest(proto.Message): The format is "projects/{project_id}/tenants/{tenant_id}". For example, "projects/foo/tenants/bar". - profile (google.cloud.talent_v4beta1.types.Profile): + profile (~.gct_profile.Profile): Required. The profile to be created. """ @@ -160,9 +160,9 @@ class UpdateProfileRequest(proto.Message): r"""Update profile request Attributes: - profile (google.cloud.talent_v4beta1.types.Profile): + profile (~.gct_profile.Profile): Required. Profile to be updated. - update_mask (google.protobuf.field_mask_pb2.FieldMask): + update_mask (~.field_mask.FieldMask): A field mask to specify the profile fields to update. A full update is performed if it is unset. @@ -197,13 +197,13 @@ class SearchProfilesRequest(proto.Message): The format is "projects/{project_id}/tenants/{tenant_id}". For example, "projects/foo/tenants/bar". - request_metadata (google.cloud.talent_v4beta1.types.RequestMetadata): + 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 (google.cloud.talent_v4beta1.types.ProfileQuery): + profile_query (~.filters.ProfileQuery): Search query to execute. See [ProfileQuery][google.cloud.talent.v4beta1.ProfileQuery] for more details. @@ -273,7 +273,7 @@ class SearchProfilesRequest(proto.Message): 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[google.cloud.talent_v4beta1.types.HistogramQuery]): + histogram_queries (Sequence[~.histogram.HistogramQuery]): A list of expressions specifies histogram requests against matching profiles for [SearchProfilesRequest][google.cloud.talent.v4beta1.SearchProfilesRequest]. @@ -463,18 +463,18 @@ class SearchProfilesResponse(proto.Message): An estimation of the number of profiles that match the specified query. This number isn't guaranteed to be accurate. - spell_correction (google.cloud.talent_v4beta1.types.SpellingCorrection): + spell_correction (~.common.SpellingCorrection): The spell checking result, and correction. - metadata (google.cloud.talent_v4beta1.types.ResponseMetadata): + 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[google.cloud.talent_v4beta1.types.HistogramQueryResult]): + 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[google.cloud.talent_v4beta1.types.SummarizedProfile]): + summarized_profiles (Sequence[~.profile_service.SummarizedProfile]): The profile entities that match the specified [SearchProfilesRequest][google.cloud.talent.v4beta1.SearchProfilesRequest]. result_set_id (str): @@ -513,10 +513,10 @@ class SummarizedProfile(proto.Message): [SearchProfilesResponse][google.cloud.talent.v4beta1.SearchProfilesResponse]. Attributes: - profiles (Sequence[google.cloud.talent_v4beta1.types.Profile]): + profiles (Sequence[~.gct_profile.Profile]): A list of profiles that are linked by [Profile.group_id][google.cloud.talent.v4beta1.Profile.group_id]. - summary (google.cloud.talent_v4beta1.types.Profile): + summary (~.gct_profile.Profile): A profile summary shows the profile summary and how the profile matches the search query. diff --git a/google/cloud/talent_v4beta1/types/tenant.py b/google/cloud/talent_v4beta1/types/tenant.py index c399eba2..c7d1974d 100644 --- a/google/cloud/talent_v4beta1/types/tenant.py +++ b/google/cloud/talent_v4beta1/types/tenant.py @@ -43,7 +43,7 @@ class Tenant(proto.Message): Required. Client side tenant identifier, used to uniquely identify the tenant. The maximum number of allowed characters is 255. - usage_type (google.cloud.talent_v4beta1.types.Tenant.DataUsageType): + usage_type (~.tenant.Tenant.DataUsageType): Indicates whether data owned by this tenant may be used to provide product improvements across other tenants. diff --git a/google/cloud/talent_v4beta1/types/tenant_service.py b/google/cloud/talent_v4beta1/types/tenant_service.py index 104c43c7..505da6f7 100644 --- a/google/cloud/talent_v4beta1/types/tenant_service.py +++ b/google/cloud/talent_v4beta1/types/tenant_service.py @@ -46,7 +46,7 @@ class CreateTenantRequest(proto.Message): The format is "projects/{project_id}", for example, "projects/foo". - tenant (google.cloud.talent_v4beta1.types.Tenant): + tenant (~.gct_tenant.Tenant): Required. The tenant to be created. """ @@ -73,10 +73,10 @@ class UpdateTenantRequest(proto.Message): r"""Request for updating a specified tenant. Attributes: - tenant (google.cloud.talent_v4beta1.types.Tenant): + tenant (~.gct_tenant.Tenant): Required. The tenant resource to replace the current resource in the system. - update_mask (google.protobuf.field_mask_pb2.FieldMask): + update_mask (~.field_mask.FieldMask): Strongly recommended for the best service experience. If @@ -139,11 +139,11 @@ class ListTenantsResponse(proto.Message): r"""The List tenants response object. Attributes: - tenants (Sequence[google.cloud.talent_v4beta1.types.Tenant]): + tenants (Sequence[~.gct_tenant.Tenant]): Tenants for the current client. next_page_token (str): A token to retrieve the next page of results. - metadata (google.cloud.talent_v4beta1.types.ResponseMetadata): + metadata (~.common.ResponseMetadata): Additional information for the API invocation, such as the request tracking id. """ diff --git a/synth.metadata b/synth.metadata index f81e6c9e..83804676 100644 --- a/synth.metadata +++ b/synth.metadata @@ -4,15 +4,15 @@ "git": { "name": ".", "remote": "https://github.com/googleapis/python-talent.git", - "sha": "bb632f21c24cdca6094f989657ec6e72d4ffb371" + "sha": "8a53830a77532e25ff0794e9fb5400e4ec01d4f5" } }, { "git": { "name": "googleapis", "remote": "https://github.com/googleapis/googleapis.git", - "sha": "98911d3e77f3d541eaa841252a44905ea4a430ab", - "internalRef": "351618705" + "sha": "8a6f4d9acb1620af2156b42b37b54eae257b7cad", + "internalRef": "348696929" } }, { @@ -51,7 +51,6 @@ } ], "generatedFiles": [ - ".coveragerc", ".flake8", ".github/CONTRIBUTING.md", ".github/ISSUE_TEMPLATE/bug_report.md", @@ -105,21 +104,9 @@ "docs/_templates/layout.html", "docs/conf.py", "docs/multiprocessing.rst", - "docs/talent_v4/company_service.rst", - "docs/talent_v4/completion.rst", - "docs/talent_v4/event_service.rst", - "docs/talent_v4/job_service.rst", "docs/talent_v4/services.rst", - "docs/talent_v4/tenant_service.rst", "docs/talent_v4/types.rst", - "docs/talent_v4beta1/application_service.rst", - "docs/talent_v4beta1/company_service.rst", - "docs/talent_v4beta1/completion.rst", - "docs/talent_v4beta1/event_service.rst", - "docs/talent_v4beta1/job_service.rst", - "docs/talent_v4beta1/profile_service.rst", "docs/talent_v4beta1/services.rst", - "docs/talent_v4beta1/tenant_service.rst", "docs/talent_v4beta1/types.rst", "google/cloud/talent/__init__.py", "google/cloud/talent/py.typed", diff --git a/tests/unit/gapic/talent_v4/test_company_service.py b/tests/unit/gapic/talent_v4/test_company_service.py index d7d07f7c..bcb62811 100644 --- a/tests/unit/gapic/talent_v4/test_company_service.py +++ b/tests/unit/gapic/talent_v4/test_company_service.py @@ -90,21 +90,8 @@ def test__get_default_mtls_endpoint(): ) -def test_company_service_client_from_service_account_info(): - creds = credentials.AnonymousCredentials() - with mock.patch.object( - service_account.Credentials, "from_service_account_info" - ) as factory: - factory.return_value = creds - info = {"valid": True} - client = CompanyServiceClient.from_service_account_info(info) - assert client.transport._credentials == creds - - assert client.transport._host == "jobs.googleapis.com:443" - - @pytest.mark.parametrize( - "client_class", [CompanyServiceClient, CompanyServiceAsyncClient,] + "client_class", [CompanyServiceClient, CompanyServiceAsyncClient] ) def test_company_service_client_from_service_account_file(client_class): creds = credentials.AnonymousCredentials() @@ -123,10 +110,7 @@ def test_company_service_client_from_service_account_file(client_class): def test_company_service_client_get_transport_class(): transport = CompanyServiceClient.get_transport_class() - available_transports = [ - transports.CompanyServiceGrpcTransport, - ] - assert transport in available_transports + assert transport == transports.CompanyServiceGrpcTransport transport = CompanyServiceClient.get_transport_class("grpc") assert transport == transports.CompanyServiceGrpcTransport @@ -1972,7 +1956,7 @@ def test_company_service_host_with_port(): def test_company_service_grpc_transport_channel(): - channel = grpc.secure_channel("http://localhost/", grpc.local_channel_credentials()) + channel = grpc.insecure_channel("http://localhost/") # Check that channel is used if provided. transport = transports.CompanyServiceGrpcTransport( @@ -1984,7 +1968,7 @@ def test_company_service_grpc_transport_channel(): def test_company_service_grpc_asyncio_transport_channel(): - channel = aio.secure_channel("http://localhost/", grpc.local_channel_credentials()) + channel = aio.insecure_channel("http://localhost/") # Check that channel is used if provided. transport = transports.CompanyServiceGrpcAsyncIOTransport( @@ -2009,7 +1993,7 @@ def test_company_service_transport_channel_mtls_with_client_cert_source( "grpc.ssl_channel_credentials", autospec=True ) as grpc_ssl_channel_cred: with mock.patch.object( - transport_class, "create_channel" + transport_class, "create_channel", autospec=True ) as grpc_create_channel: mock_ssl_cred = mock.Mock() grpc_ssl_channel_cred.return_value = mock_ssl_cred @@ -2065,7 +2049,7 @@ def test_company_service_transport_channel_mtls_with_adc(transport_class): ssl_credentials=mock.PropertyMock(return_value=mock_ssl_cred), ): with mock.patch.object( - transport_class, "create_channel" + transport_class, "create_channel", autospec=True ) as grpc_create_channel: mock_grpc_channel = mock.Mock() grpc_create_channel.return_value = mock_grpc_channel diff --git a/tests/unit/gapic/talent_v4/test_completion.py b/tests/unit/gapic/talent_v4/test_completion.py index 23269af7..cafd4bc5 100644 --- a/tests/unit/gapic/talent_v4/test_completion.py +++ b/tests/unit/gapic/talent_v4/test_completion.py @@ -81,20 +81,7 @@ def test__get_default_mtls_endpoint(): assert CompletionClient._get_default_mtls_endpoint(non_googleapi) == non_googleapi -def test_completion_client_from_service_account_info(): - creds = credentials.AnonymousCredentials() - with mock.patch.object( - service_account.Credentials, "from_service_account_info" - ) as factory: - factory.return_value = creds - info = {"valid": True} - client = CompletionClient.from_service_account_info(info) - assert client.transport._credentials == creds - - assert client.transport._host == "jobs.googleapis.com:443" - - -@pytest.mark.parametrize("client_class", [CompletionClient, CompletionAsyncClient,]) +@pytest.mark.parametrize("client_class", [CompletionClient, CompletionAsyncClient]) def test_completion_client_from_service_account_file(client_class): creds = credentials.AnonymousCredentials() with mock.patch.object( @@ -112,10 +99,7 @@ def test_completion_client_from_service_account_file(client_class): def test_completion_client_get_transport_class(): transport = CompletionClient.get_transport_class() - available_transports = [ - transports.CompletionGrpcTransport, - ] - assert transport in available_transports + assert transport == transports.CompletionGrpcTransport transport = CompletionClient.get_transport_class("grpc") assert transport == transports.CompletionGrpcTransport @@ -619,7 +603,7 @@ def test_transport_get_channel(): @pytest.mark.parametrize( "transport_class", - [transports.CompletionGrpcTransport, transports.CompletionGrpcAsyncIOTransport,], + [transports.CompletionGrpcTransport, transports.CompletionGrpcAsyncIOTransport], ) def test_transport_adc(transport_class): # Test default credentials are used if not provided. @@ -745,7 +729,7 @@ def test_completion_host_with_port(): def test_completion_grpc_transport_channel(): - channel = grpc.secure_channel("http://localhost/", grpc.local_channel_credentials()) + channel = grpc.insecure_channel("http://localhost/") # Check that channel is used if provided. transport = transports.CompletionGrpcTransport( @@ -757,7 +741,7 @@ def test_completion_grpc_transport_channel(): def test_completion_grpc_asyncio_transport_channel(): - channel = aio.secure_channel("http://localhost/", grpc.local_channel_credentials()) + channel = aio.insecure_channel("http://localhost/") # Check that channel is used if provided. transport = transports.CompletionGrpcAsyncIOTransport( @@ -777,7 +761,7 @@ def test_completion_transport_channel_mtls_with_client_cert_source(transport_cla "grpc.ssl_channel_credentials", autospec=True ) as grpc_ssl_channel_cred: with mock.patch.object( - transport_class, "create_channel" + transport_class, "create_channel", autospec=True ) as grpc_create_channel: mock_ssl_cred = mock.Mock() grpc_ssl_channel_cred.return_value = mock_ssl_cred @@ -830,7 +814,7 @@ def test_completion_transport_channel_mtls_with_adc(transport_class): ssl_credentials=mock.PropertyMock(return_value=mock_ssl_cred), ): with mock.patch.object( - transport_class, "create_channel" + transport_class, "create_channel", autospec=True ) as grpc_create_channel: mock_grpc_channel = mock.Mock() grpc_create_channel.return_value = mock_grpc_channel diff --git a/tests/unit/gapic/talent_v4/test_event_service.py b/tests/unit/gapic/talent_v4/test_event_service.py index a89e7f2f..dcf80843 100644 --- a/tests/unit/gapic/talent_v4/test_event_service.py +++ b/tests/unit/gapic/talent_v4/test_event_service.py @@ -82,20 +82,7 @@ def test__get_default_mtls_endpoint(): assert EventServiceClient._get_default_mtls_endpoint(non_googleapi) == non_googleapi -def test_event_service_client_from_service_account_info(): - creds = credentials.AnonymousCredentials() - with mock.patch.object( - service_account.Credentials, "from_service_account_info" - ) as factory: - factory.return_value = creds - info = {"valid": True} - client = EventServiceClient.from_service_account_info(info) - assert client.transport._credentials == creds - - assert client.transport._host == "jobs.googleapis.com:443" - - -@pytest.mark.parametrize("client_class", [EventServiceClient, EventServiceAsyncClient,]) +@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( @@ -113,10 +100,7 @@ def test_event_service_client_from_service_account_file(client_class): def test_event_service_client_get_transport_class(): transport = EventServiceClient.get_transport_class() - available_transports = [ - transports.EventServiceGrpcTransport, - ] - assert transport in available_transports + assert transport == transports.EventServiceGrpcTransport transport = EventServiceClient.get_transport_class("grpc") assert transport == transports.EventServiceGrpcTransport @@ -729,10 +713,7 @@ def test_transport_get_channel(): @pytest.mark.parametrize( "transport_class", - [ - transports.EventServiceGrpcTransport, - transports.EventServiceGrpcAsyncIOTransport, - ], + [transports.EventServiceGrpcTransport, transports.EventServiceGrpcAsyncIOTransport], ) def test_transport_adc(transport_class): # Test default credentials are used if not provided. @@ -858,7 +839,7 @@ def test_event_service_host_with_port(): def test_event_service_grpc_transport_channel(): - channel = grpc.secure_channel("http://localhost/", grpc.local_channel_credentials()) + channel = grpc.insecure_channel("http://localhost/") # Check that channel is used if provided. transport = transports.EventServiceGrpcTransport( @@ -870,7 +851,7 @@ def test_event_service_grpc_transport_channel(): def test_event_service_grpc_asyncio_transport_channel(): - channel = aio.secure_channel("http://localhost/", grpc.local_channel_credentials()) + channel = aio.insecure_channel("http://localhost/") # Check that channel is used if provided. transport = transports.EventServiceGrpcAsyncIOTransport( @@ -890,7 +871,7 @@ def test_event_service_transport_channel_mtls_with_client_cert_source(transport_ "grpc.ssl_channel_credentials", autospec=True ) as grpc_ssl_channel_cred: with mock.patch.object( - transport_class, "create_channel" + transport_class, "create_channel", autospec=True ) as grpc_create_channel: mock_ssl_cred = mock.Mock() grpc_ssl_channel_cred.return_value = mock_ssl_cred @@ -943,7 +924,7 @@ def test_event_service_transport_channel_mtls_with_adc(transport_class): ssl_credentials=mock.PropertyMock(return_value=mock_ssl_cred), ): with mock.patch.object( - transport_class, "create_channel" + transport_class, "create_channel", autospec=True ) as grpc_create_channel: mock_grpc_channel = mock.Mock() grpc_create_channel.return_value = mock_grpc_channel diff --git a/tests/unit/gapic/talent_v4/test_job_service.py b/tests/unit/gapic/talent_v4/test_job_service.py index 39a3dfe4..208347d4 100644 --- a/tests/unit/gapic/talent_v4/test_job_service.py +++ b/tests/unit/gapic/talent_v4/test_job_service.py @@ -98,20 +98,7 @@ def test__get_default_mtls_endpoint(): assert JobServiceClient._get_default_mtls_endpoint(non_googleapi) == non_googleapi -def test_job_service_client_from_service_account_info(): - creds = credentials.AnonymousCredentials() - with mock.patch.object( - service_account.Credentials, "from_service_account_info" - ) as factory: - factory.return_value = creds - info = {"valid": True} - client = JobServiceClient.from_service_account_info(info) - assert client.transport._credentials == creds - - assert client.transport._host == "jobs.googleapis.com:443" - - -@pytest.mark.parametrize("client_class", [JobServiceClient, JobServiceAsyncClient,]) +@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( @@ -129,10 +116,7 @@ def test_job_service_client_from_service_account_file(client_class): def test_job_service_client_get_transport_class(): transport = JobServiceClient.get_transport_class() - available_transports = [ - transports.JobServiceGrpcTransport, - ] - assert transport in available_transports + assert transport == transports.JobServiceGrpcTransport transport = JobServiceClient.get_transport_class("grpc") assert transport == transports.JobServiceGrpcTransport @@ -2831,7 +2815,7 @@ def test_transport_get_channel(): @pytest.mark.parametrize( "transport_class", - [transports.JobServiceGrpcTransport, transports.JobServiceGrpcAsyncIOTransport,], + [transports.JobServiceGrpcTransport, transports.JobServiceGrpcAsyncIOTransport], ) def test_transport_adc(transport_class): # Test default credentials are used if not provided. @@ -2973,7 +2957,7 @@ def test_job_service_host_with_port(): def test_job_service_grpc_transport_channel(): - channel = grpc.secure_channel("http://localhost/", grpc.local_channel_credentials()) + channel = grpc.insecure_channel("http://localhost/") # Check that channel is used if provided. transport = transports.JobServiceGrpcTransport( @@ -2985,7 +2969,7 @@ def test_job_service_grpc_transport_channel(): def test_job_service_grpc_asyncio_transport_channel(): - channel = aio.secure_channel("http://localhost/", grpc.local_channel_credentials()) + channel = aio.insecure_channel("http://localhost/") # Check that channel is used if provided. transport = transports.JobServiceGrpcAsyncIOTransport( @@ -3005,7 +2989,7 @@ def test_job_service_transport_channel_mtls_with_client_cert_source(transport_cl "grpc.ssl_channel_credentials", autospec=True ) as grpc_ssl_channel_cred: with mock.patch.object( - transport_class, "create_channel" + transport_class, "create_channel", autospec=True ) as grpc_create_channel: mock_ssl_cred = mock.Mock() grpc_ssl_channel_cred.return_value = mock_ssl_cred @@ -3058,7 +3042,7 @@ def test_job_service_transport_channel_mtls_with_adc(transport_class): ssl_credentials=mock.PropertyMock(return_value=mock_ssl_cred), ): with mock.patch.object( - transport_class, "create_channel" + transport_class, "create_channel", autospec=True ) as grpc_create_channel: mock_grpc_channel = mock.Mock() grpc_create_channel.return_value = mock_grpc_channel diff --git a/tests/unit/gapic/talent_v4/test_tenant_service.py b/tests/unit/gapic/talent_v4/test_tenant_service.py index cfc4edf8..32438832 100644 --- a/tests/unit/gapic/talent_v4/test_tenant_service.py +++ b/tests/unit/gapic/talent_v4/test_tenant_service.py @@ -87,21 +87,8 @@ def test__get_default_mtls_endpoint(): ) -def test_tenant_service_client_from_service_account_info(): - creds = credentials.AnonymousCredentials() - with mock.patch.object( - service_account.Credentials, "from_service_account_info" - ) as factory: - factory.return_value = creds - info = {"valid": True} - client = TenantServiceClient.from_service_account_info(info) - assert client.transport._credentials == creds - - assert client.transport._host == "jobs.googleapis.com:443" - - @pytest.mark.parametrize( - "client_class", [TenantServiceClient, TenantServiceAsyncClient,] + "client_class", [TenantServiceClient, TenantServiceAsyncClient] ) def test_tenant_service_client_from_service_account_file(client_class): creds = credentials.AnonymousCredentials() @@ -120,10 +107,7 @@ def test_tenant_service_client_from_service_account_file(client_class): def test_tenant_service_client_get_transport_class(): transport = TenantServiceClient.get_transport_class() - available_transports = [ - transports.TenantServiceGrpcTransport, - ] - assert transport in available_transports + assert transport == transports.TenantServiceGrpcTransport transport = TenantServiceClient.get_transport_class("grpc") assert transport == transports.TenantServiceGrpcTransport @@ -1747,7 +1731,7 @@ def test_tenant_service_host_with_port(): def test_tenant_service_grpc_transport_channel(): - channel = grpc.secure_channel("http://localhost/", grpc.local_channel_credentials()) + channel = grpc.insecure_channel("http://localhost/") # Check that channel is used if provided. transport = transports.TenantServiceGrpcTransport( @@ -1759,7 +1743,7 @@ def test_tenant_service_grpc_transport_channel(): def test_tenant_service_grpc_asyncio_transport_channel(): - channel = aio.secure_channel("http://localhost/", grpc.local_channel_credentials()) + channel = aio.insecure_channel("http://localhost/") # Check that channel is used if provided. transport = transports.TenantServiceGrpcAsyncIOTransport( @@ -1782,7 +1766,7 @@ def test_tenant_service_transport_channel_mtls_with_client_cert_source(transport "grpc.ssl_channel_credentials", autospec=True ) as grpc_ssl_channel_cred: with mock.patch.object( - transport_class, "create_channel" + transport_class, "create_channel", autospec=True ) as grpc_create_channel: mock_ssl_cred = mock.Mock() grpc_ssl_channel_cred.return_value = mock_ssl_cred @@ -1838,7 +1822,7 @@ def test_tenant_service_transport_channel_mtls_with_adc(transport_class): ssl_credentials=mock.PropertyMock(return_value=mock_ssl_cred), ): with mock.patch.object( - transport_class, "create_channel" + transport_class, "create_channel", autospec=True ) as grpc_create_channel: mock_grpc_channel = mock.Mock() grpc_create_channel.return_value = mock_grpc_channel diff --git a/tests/unit/gapic/talent_v4beta1/test_application_service.py b/tests/unit/gapic/talent_v4beta1/test_application_service.py index e1296286..9504a896 100644 --- a/tests/unit/gapic/talent_v4beta1/test_application_service.py +++ b/tests/unit/gapic/talent_v4beta1/test_application_service.py @@ -96,21 +96,8 @@ def test__get_default_mtls_endpoint(): ) -def test_application_service_client_from_service_account_info(): - creds = credentials.AnonymousCredentials() - with mock.patch.object( - service_account.Credentials, "from_service_account_info" - ) as factory: - factory.return_value = creds - info = {"valid": True} - client = ApplicationServiceClient.from_service_account_info(info) - assert client.transport._credentials == creds - - assert client.transport._host == "jobs.googleapis.com:443" - - @pytest.mark.parametrize( - "client_class", [ApplicationServiceClient, ApplicationServiceAsyncClient,] + "client_class", [ApplicationServiceClient, ApplicationServiceAsyncClient] ) def test_application_service_client_from_service_account_file(client_class): creds = credentials.AnonymousCredentials() @@ -129,10 +116,7 @@ def test_application_service_client_from_service_account_file(client_class): def test_application_service_client_get_transport_class(): transport = ApplicationServiceClient.get_transport_class() - available_transports = [ - transports.ApplicationServiceGrpcTransport, - ] - assert transport in available_transports + assert transport == transports.ApplicationServiceGrpcTransport transport = ApplicationServiceClient.get_transport_class("grpc") assert transport == transports.ApplicationServiceGrpcTransport @@ -2053,7 +2037,7 @@ def test_application_service_host_with_port(): def test_application_service_grpc_transport_channel(): - channel = grpc.secure_channel("http://localhost/", grpc.local_channel_credentials()) + channel = grpc.insecure_channel("http://localhost/") # Check that channel is used if provided. transport = transports.ApplicationServiceGrpcTransport( @@ -2065,7 +2049,7 @@ def test_application_service_grpc_transport_channel(): def test_application_service_grpc_asyncio_transport_channel(): - channel = aio.secure_channel("http://localhost/", grpc.local_channel_credentials()) + channel = aio.insecure_channel("http://localhost/") # Check that channel is used if provided. transport = transports.ApplicationServiceGrpcAsyncIOTransport( @@ -2090,7 +2074,7 @@ def test_application_service_transport_channel_mtls_with_client_cert_source( "grpc.ssl_channel_credentials", autospec=True ) as grpc_ssl_channel_cred: with mock.patch.object( - transport_class, "create_channel" + transport_class, "create_channel", autospec=True ) as grpc_create_channel: mock_ssl_cred = mock.Mock() grpc_ssl_channel_cred.return_value = mock_ssl_cred @@ -2146,7 +2130,7 @@ def test_application_service_transport_channel_mtls_with_adc(transport_class): ssl_credentials=mock.PropertyMock(return_value=mock_ssl_cred), ): with mock.patch.object( - transport_class, "create_channel" + transport_class, "create_channel", autospec=True ) as grpc_create_channel: mock_grpc_channel = mock.Mock() grpc_create_channel.return_value = mock_grpc_channel diff --git a/tests/unit/gapic/talent_v4beta1/test_company_service.py b/tests/unit/gapic/talent_v4beta1/test_company_service.py index 64314350..603a1904 100644 --- a/tests/unit/gapic/talent_v4beta1/test_company_service.py +++ b/tests/unit/gapic/talent_v4beta1/test_company_service.py @@ -92,21 +92,8 @@ def test__get_default_mtls_endpoint(): ) -def test_company_service_client_from_service_account_info(): - creds = credentials.AnonymousCredentials() - with mock.patch.object( - service_account.Credentials, "from_service_account_info" - ) as factory: - factory.return_value = creds - info = {"valid": True} - client = CompanyServiceClient.from_service_account_info(info) - assert client.transport._credentials == creds - - assert client.transport._host == "jobs.googleapis.com:443" - - @pytest.mark.parametrize( - "client_class", [CompanyServiceClient, CompanyServiceAsyncClient,] + "client_class", [CompanyServiceClient, CompanyServiceAsyncClient] ) def test_company_service_client_from_service_account_file(client_class): creds = credentials.AnonymousCredentials() @@ -125,10 +112,7 @@ def test_company_service_client_from_service_account_file(client_class): def test_company_service_client_get_transport_class(): transport = CompanyServiceClient.get_transport_class() - available_transports = [ - transports.CompanyServiceGrpcTransport, - ] - assert transport in available_transports + assert transport == transports.CompanyServiceGrpcTransport transport = CompanyServiceClient.get_transport_class("grpc") assert transport == transports.CompanyServiceGrpcTransport @@ -1964,7 +1948,7 @@ def test_company_service_host_with_port(): def test_company_service_grpc_transport_channel(): - channel = grpc.secure_channel("http://localhost/", grpc.local_channel_credentials()) + channel = grpc.insecure_channel("http://localhost/") # Check that channel is used if provided. transport = transports.CompanyServiceGrpcTransport( @@ -1976,7 +1960,7 @@ def test_company_service_grpc_transport_channel(): def test_company_service_grpc_asyncio_transport_channel(): - channel = aio.secure_channel("http://localhost/", grpc.local_channel_credentials()) + channel = aio.insecure_channel("http://localhost/") # Check that channel is used if provided. transport = transports.CompanyServiceGrpcAsyncIOTransport( @@ -2001,7 +1985,7 @@ def test_company_service_transport_channel_mtls_with_client_cert_source( "grpc.ssl_channel_credentials", autospec=True ) as grpc_ssl_channel_cred: with mock.patch.object( - transport_class, "create_channel" + transport_class, "create_channel", autospec=True ) as grpc_create_channel: mock_ssl_cred = mock.Mock() grpc_ssl_channel_cred.return_value = mock_ssl_cred @@ -2057,7 +2041,7 @@ def test_company_service_transport_channel_mtls_with_adc(transport_class): ssl_credentials=mock.PropertyMock(return_value=mock_ssl_cred), ): with mock.patch.object( - transport_class, "create_channel" + transport_class, "create_channel", autospec=True ) as grpc_create_channel: mock_grpc_channel = mock.Mock() grpc_create_channel.return_value = mock_grpc_channel diff --git a/tests/unit/gapic/talent_v4beta1/test_completion.py b/tests/unit/gapic/talent_v4beta1/test_completion.py index 059d1ba9..b03a7da9 100644 --- a/tests/unit/gapic/talent_v4beta1/test_completion.py +++ b/tests/unit/gapic/talent_v4beta1/test_completion.py @@ -81,20 +81,7 @@ def test__get_default_mtls_endpoint(): assert CompletionClient._get_default_mtls_endpoint(non_googleapi) == non_googleapi -def test_completion_client_from_service_account_info(): - creds = credentials.AnonymousCredentials() - with mock.patch.object( - service_account.Credentials, "from_service_account_info" - ) as factory: - factory.return_value = creds - info = {"valid": True} - client = CompletionClient.from_service_account_info(info) - assert client.transport._credentials == creds - - assert client.transport._host == "jobs.googleapis.com:443" - - -@pytest.mark.parametrize("client_class", [CompletionClient, CompletionAsyncClient,]) +@pytest.mark.parametrize("client_class", [CompletionClient, CompletionAsyncClient]) def test_completion_client_from_service_account_file(client_class): creds = credentials.AnonymousCredentials() with mock.patch.object( @@ -112,10 +99,7 @@ def test_completion_client_from_service_account_file(client_class): def test_completion_client_get_transport_class(): transport = CompletionClient.get_transport_class() - available_transports = [ - transports.CompletionGrpcTransport, - ] - assert transport in available_transports + assert transport == transports.CompletionGrpcTransport transport = CompletionClient.get_transport_class("grpc") assert transport == transports.CompletionGrpcTransport @@ -619,7 +603,7 @@ def test_transport_get_channel(): @pytest.mark.parametrize( "transport_class", - [transports.CompletionGrpcTransport, transports.CompletionGrpcAsyncIOTransport,], + [transports.CompletionGrpcTransport, transports.CompletionGrpcAsyncIOTransport], ) def test_transport_adc(transport_class): # Test default credentials are used if not provided. @@ -745,7 +729,7 @@ def test_completion_host_with_port(): def test_completion_grpc_transport_channel(): - channel = grpc.secure_channel("http://localhost/", grpc.local_channel_credentials()) + channel = grpc.insecure_channel("http://localhost/") # Check that channel is used if provided. transport = transports.CompletionGrpcTransport( @@ -757,7 +741,7 @@ def test_completion_grpc_transport_channel(): def test_completion_grpc_asyncio_transport_channel(): - channel = aio.secure_channel("http://localhost/", grpc.local_channel_credentials()) + channel = aio.insecure_channel("http://localhost/") # Check that channel is used if provided. transport = transports.CompletionGrpcAsyncIOTransport( @@ -777,7 +761,7 @@ def test_completion_transport_channel_mtls_with_client_cert_source(transport_cla "grpc.ssl_channel_credentials", autospec=True ) as grpc_ssl_channel_cred: with mock.patch.object( - transport_class, "create_channel" + transport_class, "create_channel", autospec=True ) as grpc_create_channel: mock_ssl_cred = mock.Mock() grpc_ssl_channel_cred.return_value = mock_ssl_cred @@ -830,7 +814,7 @@ def test_completion_transport_channel_mtls_with_adc(transport_class): ssl_credentials=mock.PropertyMock(return_value=mock_ssl_cred), ): with mock.patch.object( - transport_class, "create_channel" + transport_class, "create_channel", autospec=True ) as grpc_create_channel: mock_grpc_channel = mock.Mock() grpc_create_channel.return_value = 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 index 3695cc12..a5f2b7c0 100644 --- a/tests/unit/gapic/talent_v4beta1/test_event_service.py +++ b/tests/unit/gapic/talent_v4beta1/test_event_service.py @@ -82,20 +82,7 @@ def test__get_default_mtls_endpoint(): assert EventServiceClient._get_default_mtls_endpoint(non_googleapi) == non_googleapi -def test_event_service_client_from_service_account_info(): - creds = credentials.AnonymousCredentials() - with mock.patch.object( - service_account.Credentials, "from_service_account_info" - ) as factory: - factory.return_value = creds - info = {"valid": True} - client = EventServiceClient.from_service_account_info(info) - assert client.transport._credentials == creds - - assert client.transport._host == "jobs.googleapis.com:443" - - -@pytest.mark.parametrize("client_class", [EventServiceClient, EventServiceAsyncClient,]) +@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( @@ -113,10 +100,7 @@ def test_event_service_client_from_service_account_file(client_class): def test_event_service_client_get_transport_class(): transport = EventServiceClient.get_transport_class() - available_transports = [ - transports.EventServiceGrpcTransport, - ] - assert transport in available_transports + assert transport == transports.EventServiceGrpcTransport transport = EventServiceClient.get_transport_class("grpc") assert transport == transports.EventServiceGrpcTransport @@ -729,10 +713,7 @@ def test_transport_get_channel(): @pytest.mark.parametrize( "transport_class", - [ - transports.EventServiceGrpcTransport, - transports.EventServiceGrpcAsyncIOTransport, - ], + [transports.EventServiceGrpcTransport, transports.EventServiceGrpcAsyncIOTransport], ) def test_transport_adc(transport_class): # Test default credentials are used if not provided. @@ -858,7 +839,7 @@ def test_event_service_host_with_port(): def test_event_service_grpc_transport_channel(): - channel = grpc.secure_channel("http://localhost/", grpc.local_channel_credentials()) + channel = grpc.insecure_channel("http://localhost/") # Check that channel is used if provided. transport = transports.EventServiceGrpcTransport( @@ -870,7 +851,7 @@ def test_event_service_grpc_transport_channel(): def test_event_service_grpc_asyncio_transport_channel(): - channel = aio.secure_channel("http://localhost/", grpc.local_channel_credentials()) + channel = aio.insecure_channel("http://localhost/") # Check that channel is used if provided. transport = transports.EventServiceGrpcAsyncIOTransport( @@ -890,7 +871,7 @@ def test_event_service_transport_channel_mtls_with_client_cert_source(transport_ "grpc.ssl_channel_credentials", autospec=True ) as grpc_ssl_channel_cred: with mock.patch.object( - transport_class, "create_channel" + transport_class, "create_channel", autospec=True ) as grpc_create_channel: mock_ssl_cred = mock.Mock() grpc_ssl_channel_cred.return_value = mock_ssl_cred @@ -943,7 +924,7 @@ def test_event_service_transport_channel_mtls_with_adc(transport_class): ssl_credentials=mock.PropertyMock(return_value=mock_ssl_cred), ): with mock.patch.object( - transport_class, "create_channel" + transport_class, "create_channel", autospec=True ) as grpc_create_channel: mock_grpc_channel = mock.Mock() grpc_create_channel.return_value = 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 index 4a239967..43896c99 100644 --- a/tests/unit/gapic/talent_v4beta1/test_job_service.py +++ b/tests/unit/gapic/talent_v4beta1/test_job_service.py @@ -98,20 +98,7 @@ def test__get_default_mtls_endpoint(): assert JobServiceClient._get_default_mtls_endpoint(non_googleapi) == non_googleapi -def test_job_service_client_from_service_account_info(): - creds = credentials.AnonymousCredentials() - with mock.patch.object( - service_account.Credentials, "from_service_account_info" - ) as factory: - factory.return_value = creds - info = {"valid": True} - client = JobServiceClient.from_service_account_info(info) - assert client.transport._credentials == creds - - assert client.transport._host == "jobs.googleapis.com:443" - - -@pytest.mark.parametrize("client_class", [JobServiceClient, JobServiceAsyncClient,]) +@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( @@ -129,10 +116,7 @@ def test_job_service_client_from_service_account_file(client_class): def test_job_service_client_get_transport_class(): transport = JobServiceClient.get_transport_class() - available_transports = [ - transports.JobServiceGrpcTransport, - ] - assert transport in available_transports + assert transport == transports.JobServiceGrpcTransport transport = JobServiceClient.get_transport_class("grpc") assert transport == transports.JobServiceGrpcTransport @@ -3143,7 +3127,7 @@ def test_transport_get_channel(): @pytest.mark.parametrize( "transport_class", - [transports.JobServiceGrpcTransport, transports.JobServiceGrpcAsyncIOTransport,], + [transports.JobServiceGrpcTransport, transports.JobServiceGrpcAsyncIOTransport], ) def test_transport_adc(transport_class): # Test default credentials are used if not provided. @@ -3285,7 +3269,7 @@ def test_job_service_host_with_port(): def test_job_service_grpc_transport_channel(): - channel = grpc.secure_channel("http://localhost/", grpc.local_channel_credentials()) + channel = grpc.insecure_channel("http://localhost/") # Check that channel is used if provided. transport = transports.JobServiceGrpcTransport( @@ -3297,7 +3281,7 @@ def test_job_service_grpc_transport_channel(): def test_job_service_grpc_asyncio_transport_channel(): - channel = aio.secure_channel("http://localhost/", grpc.local_channel_credentials()) + channel = aio.insecure_channel("http://localhost/") # Check that channel is used if provided. transport = transports.JobServiceGrpcAsyncIOTransport( @@ -3317,7 +3301,7 @@ def test_job_service_transport_channel_mtls_with_client_cert_source(transport_cl "grpc.ssl_channel_credentials", autospec=True ) as grpc_ssl_channel_cred: with mock.patch.object( - transport_class, "create_channel" + transport_class, "create_channel", autospec=True ) as grpc_create_channel: mock_ssl_cred = mock.Mock() grpc_ssl_channel_cred.return_value = mock_ssl_cred @@ -3370,7 +3354,7 @@ def test_job_service_transport_channel_mtls_with_adc(transport_class): ssl_credentials=mock.PropertyMock(return_value=mock_ssl_cred), ): with mock.patch.object( - transport_class, "create_channel" + transport_class, "create_channel", autospec=True ) as grpc_create_channel: mock_grpc_channel = mock.Mock() grpc_create_channel.return_value = mock_grpc_channel diff --git a/tests/unit/gapic/talent_v4beta1/test_profile_service.py b/tests/unit/gapic/talent_v4beta1/test_profile_service.py index b85f2de2..136e0be1 100644 --- a/tests/unit/gapic/talent_v4beta1/test_profile_service.py +++ b/tests/unit/gapic/talent_v4beta1/test_profile_service.py @@ -98,21 +98,8 @@ def test__get_default_mtls_endpoint(): ) -def test_profile_service_client_from_service_account_info(): - creds = credentials.AnonymousCredentials() - with mock.patch.object( - service_account.Credentials, "from_service_account_info" - ) as factory: - factory.return_value = creds - info = {"valid": True} - client = ProfileServiceClient.from_service_account_info(info) - assert client.transport._credentials == creds - - assert client.transport._host == "jobs.googleapis.com:443" - - @pytest.mark.parametrize( - "client_class", [ProfileServiceClient, ProfileServiceAsyncClient,] + "client_class", [ProfileServiceClient, ProfileServiceAsyncClient] ) def test_profile_service_client_from_service_account_file(client_class): creds = credentials.AnonymousCredentials() @@ -131,10 +118,7 @@ def test_profile_service_client_from_service_account_file(client_class): def test_profile_service_client_get_transport_class(): transport = ProfileServiceClient.get_transport_class() - available_transports = [ - transports.ProfileServiceGrpcTransport, - ] - assert transport in available_transports + assert transport == transports.ProfileServiceGrpcTransport transport = ProfileServiceClient.get_transport_class("grpc") assert transport == transports.ProfileServiceGrpcTransport @@ -2195,7 +2179,7 @@ def test_profile_service_host_with_port(): def test_profile_service_grpc_transport_channel(): - channel = grpc.secure_channel("http://localhost/", grpc.local_channel_credentials()) + channel = grpc.insecure_channel("http://localhost/") # Check that channel is used if provided. transport = transports.ProfileServiceGrpcTransport( @@ -2207,7 +2191,7 @@ def test_profile_service_grpc_transport_channel(): def test_profile_service_grpc_asyncio_transport_channel(): - channel = aio.secure_channel("http://localhost/", grpc.local_channel_credentials()) + channel = aio.insecure_channel("http://localhost/") # Check that channel is used if provided. transport = transports.ProfileServiceGrpcAsyncIOTransport( @@ -2232,7 +2216,7 @@ def test_profile_service_transport_channel_mtls_with_client_cert_source( "grpc.ssl_channel_credentials", autospec=True ) as grpc_ssl_channel_cred: with mock.patch.object( - transport_class, "create_channel" + transport_class, "create_channel", autospec=True ) as grpc_create_channel: mock_ssl_cred = mock.Mock() grpc_ssl_channel_cred.return_value = mock_ssl_cred @@ -2288,7 +2272,7 @@ def test_profile_service_transport_channel_mtls_with_adc(transport_class): ssl_credentials=mock.PropertyMock(return_value=mock_ssl_cred), ): with mock.patch.object( - transport_class, "create_channel" + transport_class, "create_channel", autospec=True ) as grpc_create_channel: mock_grpc_channel = mock.Mock() grpc_create_channel.return_value = mock_grpc_channel diff --git a/tests/unit/gapic/talent_v4beta1/test_tenant_service.py b/tests/unit/gapic/talent_v4beta1/test_tenant_service.py index 183cbdc6..62a13dd4 100644 --- a/tests/unit/gapic/talent_v4beta1/test_tenant_service.py +++ b/tests/unit/gapic/talent_v4beta1/test_tenant_service.py @@ -87,21 +87,8 @@ def test__get_default_mtls_endpoint(): ) -def test_tenant_service_client_from_service_account_info(): - creds = credentials.AnonymousCredentials() - with mock.patch.object( - service_account.Credentials, "from_service_account_info" - ) as factory: - factory.return_value = creds - info = {"valid": True} - client = TenantServiceClient.from_service_account_info(info) - assert client.transport._credentials == creds - - assert client.transport._host == "jobs.googleapis.com:443" - - @pytest.mark.parametrize( - "client_class", [TenantServiceClient, TenantServiceAsyncClient,] + "client_class", [TenantServiceClient, TenantServiceAsyncClient] ) def test_tenant_service_client_from_service_account_file(client_class): creds = credentials.AnonymousCredentials() @@ -120,10 +107,7 @@ def test_tenant_service_client_from_service_account_file(client_class): def test_tenant_service_client_get_transport_class(): transport = TenantServiceClient.get_transport_class() - available_transports = [ - transports.TenantServiceGrpcTransport, - ] - assert transport in available_transports + assert transport == transports.TenantServiceGrpcTransport transport = TenantServiceClient.get_transport_class("grpc") assert transport == transports.TenantServiceGrpcTransport @@ -1809,7 +1793,7 @@ def test_tenant_service_host_with_port(): def test_tenant_service_grpc_transport_channel(): - channel = grpc.secure_channel("http://localhost/", grpc.local_channel_credentials()) + channel = grpc.insecure_channel("http://localhost/") # Check that channel is used if provided. transport = transports.TenantServiceGrpcTransport( @@ -1821,7 +1805,7 @@ def test_tenant_service_grpc_transport_channel(): def test_tenant_service_grpc_asyncio_transport_channel(): - channel = aio.secure_channel("http://localhost/", grpc.local_channel_credentials()) + channel = aio.insecure_channel("http://localhost/") # Check that channel is used if provided. transport = transports.TenantServiceGrpcAsyncIOTransport( @@ -1844,7 +1828,7 @@ def test_tenant_service_transport_channel_mtls_with_client_cert_source(transport "grpc.ssl_channel_credentials", autospec=True ) as grpc_ssl_channel_cred: with mock.patch.object( - transport_class, "create_channel" + transport_class, "create_channel", autospec=True ) as grpc_create_channel: mock_ssl_cred = mock.Mock() grpc_ssl_channel_cred.return_value = mock_ssl_cred @@ -1900,7 +1884,7 @@ def test_tenant_service_transport_channel_mtls_with_adc(transport_class): ssl_credentials=mock.PropertyMock(return_value=mock_ssl_cred), ): with mock.patch.object( - transport_class, "create_channel" + transport_class, "create_channel", autospec=True ) as grpc_create_channel: mock_grpc_channel = mock.Mock() grpc_create_channel.return_value = mock_grpc_channel From e374d25f71d2b7c5cf5d0c495e8200b5bb69f523 Mon Sep 17 00:00:00 2001 From: yoshi-automation Date: Tue, 23 Mar 2021 18:49:57 -0700 Subject: [PATCH 06/38] chore: upgrade gapic-generator-python to 0.40.5 PiperOrigin-RevId: 354996675 Source-Author: Google APIs Source-Date: Mon Feb 1 12:11:49 2021 -0800 Source-Repo: googleapis/googleapis Source-Sha: 20712b8fe95001b312f62c6c5f33e3e3ec92cfaf Source-Link: https://github.com/googleapis/googleapis/commit/20712b8fe95001b312f62c6c5f33e3e3ec92cfaf --- .coveragerc | 31 +-- .kokoro/test-samples.sh | 8 +- .kokoro/trampoline_v2.sh | 2 +- docs/talent_v4/company_service.rst | 11 + docs/talent_v4/completion.rst | 6 + docs/talent_v4/event_service.rst | 6 + docs/talent_v4/job_service.rst | 11 + docs/talent_v4/services.rst | 22 +- docs/talent_v4/tenant_service.rst | 11 + docs/talent_v4/types.rst | 1 + docs/talent_v4beta1/application_service.rst | 11 + docs/talent_v4beta1/company_service.rst | 11 + docs/talent_v4beta1/completion.rst | 6 + docs/talent_v4beta1/event_service.rst | 6 + docs/talent_v4beta1/job_service.rst | 11 + docs/talent_v4beta1/profile_service.rst | 11 + docs/talent_v4beta1/services.rst | 30 +-- docs/talent_v4beta1/tenant_service.rst | 11 + docs/talent_v4beta1/types.rst | 1 + .../services/company_service/async_client.py | 31 ++- .../services/company_service/client.py | 78 ++++--- .../services/company_service/pagers.py | 16 +- .../company_service/transports/grpc.py | 23 +- .../transports/grpc_asyncio.py | 23 +- .../services/completion/async_client.py | 5 +- .../talent_v4/services/completion/client.py | 44 ++-- .../services/completion/transports/grpc.py | 23 +- .../completion/transports/grpc_asyncio.py | 23 +- .../services/event_service/async_client.py | 9 +- .../services/event_service/client.py | 50 ++-- .../services/event_service/transports/grpc.py | 23 +- .../event_service/transports/grpc_asyncio.py | 23 +- .../services/job_service/async_client.py | 120 +++++----- .../talent_v4/services/job_service/client.py | 177 +++++++------- .../talent_v4/services/job_service/pagers.py | 16 +- .../services/job_service/transports/grpc.py | 23 +- .../job_service/transports/grpc_asyncio.py | 23 +- .../services/tenant_service/async_client.py | 31 ++- .../services/tenant_service/client.py | 78 ++++--- .../services/tenant_service/pagers.py | 16 +- .../tenant_service/transports/grpc.py | 23 +- .../tenant_service/transports/grpc_asyncio.py | 23 +- google/cloud/talent_v4/types/common.py | 42 ++-- google/cloud/talent_v4/types/company.py | 6 +- .../cloud/talent_v4/types/company_service.py | 10 +- .../talent_v4/types/completion_service.py | 10 +- google/cloud/talent_v4/types/event.py | 6 +- google/cloud/talent_v4/types/event_service.py | 2 +- google/cloud/talent_v4/types/filters.py | 32 +-- google/cloud/talent_v4/types/histogram.py | 2 +- google/cloud/talent_v4/types/job.py | 40 ++-- google/cloud/talent_v4/types/job_service.py | 62 ++--- .../cloud/talent_v4/types/tenant_service.py | 10 +- google/cloud/talent_v4beta1/__init__.py | 4 +- .../application_service/async_client.py | 29 ++- .../services/application_service/client.py | 76 ++++--- .../services/application_service/pagers.py | 16 +- .../application_service/transports/grpc.py | 23 +- .../transports/grpc_asyncio.py | 23 +- .../services/company_service/async_client.py | 28 ++- .../services/company_service/client.py | 75 +++--- .../services/company_service/pagers.py | 16 +- .../company_service/transports/grpc.py | 23 +- .../transports/grpc_asyncio.py | 23 +- .../services/completion/async_client.py | 5 +- .../services/completion/client.py | 44 ++-- .../services/completion/transports/grpc.py | 23 +- .../completion/transports/grpc_asyncio.py | 23 +- .../services/event_service/async_client.py | 9 +- .../services/event_service/client.py | 50 ++-- .../services/event_service/transports/grpc.py | 23 +- .../event_service/transports/grpc_asyncio.py | 23 +- .../services/job_service/async_client.py | 113 +++++---- .../services/job_service/client.py | 170 +++++++------- .../services/job_service/pagers.py | 48 ++-- .../services/job_service/transports/grpc.py | 23 +- .../job_service/transports/grpc_asyncio.py | 23 +- .../services/profile_service/async_client.py | 31 +-- .../services/profile_service/client.py | 78 ++++--- .../services/profile_service/pagers.py | 32 +-- .../profile_service/transports/grpc.py | 23 +- .../transports/grpc_asyncio.py | 23 +- .../services/tenant_service/async_client.py | 28 ++- .../services/tenant_service/client.py | 75 +++--- .../services/tenant_service/pagers.py | 16 +- .../tenant_service/transports/grpc.py | 23 +- .../tenant_service/transports/grpc_asyncio.py | 23 +- .../cloud/talent_v4beta1/types/application.py | 18 +- .../types/application_service.py | 10 +- google/cloud/talent_v4beta1/types/common.py | 54 ++--- google/cloud/talent_v4beta1/types/company.py | 6 +- .../talent_v4beta1/types/company_service.py | 10 +- .../types/completion_service.py | 10 +- google/cloud/talent_v4beta1/types/event.py | 10 +- .../talent_v4beta1/types/event_service.py | 2 +- google/cloud/talent_v4beta1/types/filters.py | 82 +++---- .../cloud/talent_v4beta1/types/histogram.py | 2 +- google/cloud/talent_v4beta1/types/job.py | 40 ++-- .../cloud/talent_v4beta1/types/job_service.py | 58 ++--- google/cloud/talent_v4beta1/types/profile.py | 108 ++++----- .../talent_v4beta1/types/profile_service.py | 28 +-- google/cloud/talent_v4beta1/types/tenant.py | 2 +- .../talent_v4beta1/types/tenant_service.py | 10 +- synth.metadata | 19 +- .../gapic/talent_v4/test_company_service.py | 213 ++++++++++------- tests/unit/gapic/talent_v4/test_completion.py | 212 ++++++++++------- .../gapic/talent_v4/test_event_service.py | 215 +++++++++++------- .../unit/gapic/talent_v4/test_job_service.py | 212 ++++++++++------- .../gapic/talent_v4/test_tenant_service.py | 213 ++++++++++------- .../test_application_service.py | 215 +++++++++++------- .../talent_v4beta1/test_company_service.py | 213 ++++++++++------- .../gapic/talent_v4beta1/test_completion.py | 212 ++++++++++------- .../talent_v4beta1/test_event_service.py | 215 +++++++++++------- .../gapic/talent_v4beta1/test_job_service.py | 212 ++++++++++------- .../talent_v4beta1/test_profile_service.py | 213 ++++++++++------- .../talent_v4beta1/test_tenant_service.py | 213 ++++++++++------- 116 files changed, 3404 insertions(+), 2218 deletions(-) create mode 100644 docs/talent_v4/company_service.rst create mode 100644 docs/talent_v4/completion.rst create mode 100644 docs/talent_v4/event_service.rst create mode 100644 docs/talent_v4/job_service.rst create mode 100644 docs/talent_v4/tenant_service.rst create mode 100644 docs/talent_v4beta1/application_service.rst create mode 100644 docs/talent_v4beta1/company_service.rst create mode 100644 docs/talent_v4beta1/completion.rst create mode 100644 docs/talent_v4beta1/event_service.rst create mode 100644 docs/talent_v4beta1/job_service.rst create mode 100644 docs/talent_v4beta1/profile_service.rst create mode 100644 docs/talent_v4beta1/tenant_service.rst diff --git a/.coveragerc b/.coveragerc index dd39c854..8a9e352c 100644 --- a/.coveragerc +++ b/.coveragerc @@ -1,35 +1,18 @@ -# -*- 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. - -# Generated by synthtool. DO NOT EDIT! [run] branch = True [report] fail_under = 100 show_missing = True +omit = + google/cloud/talent/__init__.py exclude_lines = # Re-enable the standard pragma pragma: NO COVER # Ignore debug-only repr def __repr__ - # Ignore abstract methods - raise NotImplementedError -omit = - */gapic/*.py - */proto/*.py - */core/*.py - */site-packages/*.py \ No newline at end of file + # Ignore pkg_resources exceptions. + # This is added at the module level as a safeguard for if someone + # generates the code and tries to run it without pip installing. This + # makes it virtually impossible to test properly. + except pkg_resources.DistributionNotFound diff --git a/.kokoro/test-samples.sh b/.kokoro/test-samples.sh index 71fab05d..4b0afc93 100755 --- a/.kokoro/test-samples.sh +++ b/.kokoro/test-samples.sh @@ -87,11 +87,11 @@ for file in samples/**/requirements.txt; do python3.6 -m nox -s "$RUN_TESTS_SESSION" EXIT=$? - # If this is a periodic build, send the test log to the FlakyBot. - # See https://github.com/googleapis/repo-automation-bots/tree/master/packages/flakybot. + # If this is a periodic build, send the test log to the Build Cop Bot. + # See https://github.com/googleapis/repo-automation-bots/tree/master/packages/buildcop. if [[ $KOKORO_BUILD_ARTIFACTS_SUBDIR = *"periodic"* ]]; then - chmod +x $KOKORO_GFILE_DIR/linux_amd64/flakybot - $KOKORO_GFILE_DIR/linux_amd64/flakybot + chmod +x $KOKORO_GFILE_DIR/linux_amd64/buildcop + $KOKORO_GFILE_DIR/linux_amd64/buildcop fi if [[ $EXIT -ne 0 ]]; then diff --git a/.kokoro/trampoline_v2.sh b/.kokoro/trampoline_v2.sh index 4af6cdc2..719bcd5b 100755 --- a/.kokoro/trampoline_v2.sh +++ b/.kokoro/trampoline_v2.sh @@ -159,7 +159,7 @@ if [[ -n "${KOKORO_BUILD_ID:-}" ]]; then "KOKORO_GITHUB_COMMIT" "KOKORO_GITHUB_PULL_REQUEST_NUMBER" "KOKORO_GITHUB_PULL_REQUEST_COMMIT" - # For FlakyBot + # For Build Cop Bot "KOKORO_GITHUB_COMMIT_URL" "KOKORO_GITHUB_PULL_REQUEST_URL" ) diff --git a/docs/talent_v4/company_service.rst b/docs/talent_v4/company_service.rst new file mode 100644 index 00000000..f850f370 --- /dev/null +++ b/docs/talent_v4/company_service.rst @@ -0,0 +1,11 @@ +CompanyService +-------------------------------- + +.. automodule:: google.cloud.talent_v4.services.company_service + :members: + :inherited-members: + + +.. automodule:: google.cloud.talent_v4.services.company_service.pagers + :members: + :inherited-members: diff --git a/docs/talent_v4/completion.rst b/docs/talent_v4/completion.rst new file mode 100644 index 00000000..3044c5a8 --- /dev/null +++ b/docs/talent_v4/completion.rst @@ -0,0 +1,6 @@ +Completion +---------------------------- + +.. automodule:: google.cloud.talent_v4.services.completion + :members: + :inherited-members: diff --git a/docs/talent_v4/event_service.rst b/docs/talent_v4/event_service.rst new file mode 100644 index 00000000..1c90bae1 --- /dev/null +++ b/docs/talent_v4/event_service.rst @@ -0,0 +1,6 @@ +EventService +------------------------------ + +.. automodule:: google.cloud.talent_v4.services.event_service + :members: + :inherited-members: diff --git a/docs/talent_v4/job_service.rst b/docs/talent_v4/job_service.rst new file mode 100644 index 00000000..28d73f01 --- /dev/null +++ b/docs/talent_v4/job_service.rst @@ -0,0 +1,11 @@ +JobService +---------------------------- + +.. automodule:: google.cloud.talent_v4.services.job_service + :members: + :inherited-members: + + +.. automodule:: google.cloud.talent_v4.services.job_service.pagers + :members: + :inherited-members: diff --git a/docs/talent_v4/services.rst b/docs/talent_v4/services.rst index 5efed8a2..b2eb192c 100644 --- a/docs/talent_v4/services.rst +++ b/docs/talent_v4/services.rst @@ -1,18 +1,10 @@ Services for Google Cloud Talent v4 API ======================================= +.. toctree:: + :maxdepth: 2 -.. automodule:: google.cloud.talent_v4.services.company_service - :members: - :inherited-members: -.. automodule:: google.cloud.talent_v4.services.completion - :members: - :inherited-members: -.. automodule:: google.cloud.talent_v4.services.event_service - :members: - :inherited-members: -.. automodule:: google.cloud.talent_v4.services.job_service - :members: - :inherited-members: -.. automodule:: google.cloud.talent_v4.services.tenant_service - :members: - :inherited-members: + company_service + completion + event_service + job_service + tenant_service diff --git a/docs/talent_v4/tenant_service.rst b/docs/talent_v4/tenant_service.rst new file mode 100644 index 00000000..d38c6bcd --- /dev/null +++ b/docs/talent_v4/tenant_service.rst @@ -0,0 +1,11 @@ +TenantService +------------------------------- + +.. automodule:: google.cloud.talent_v4.services.tenant_service + :members: + :inherited-members: + + +.. automodule:: google.cloud.talent_v4.services.tenant_service.pagers + :members: + :inherited-members: diff --git a/docs/talent_v4/types.rst b/docs/talent_v4/types.rst index 559524b9..9c08edc9 100644 --- a/docs/talent_v4/types.rst +++ b/docs/talent_v4/types.rst @@ -3,4 +3,5 @@ Types for Google Cloud Talent v4 API .. automodule:: google.cloud.talent_v4.types :members: + :undoc-members: :show-inheritance: diff --git a/docs/talent_v4beta1/application_service.rst b/docs/talent_v4beta1/application_service.rst new file mode 100644 index 00000000..6539e8fd --- /dev/null +++ b/docs/talent_v4beta1/application_service.rst @@ -0,0 +1,11 @@ +ApplicationService +------------------------------------ + +.. automodule:: google.cloud.talent_v4beta1.services.application_service + :members: + :inherited-members: + + +.. automodule:: google.cloud.talent_v4beta1.services.application_service.pagers + :members: + :inherited-members: diff --git a/docs/talent_v4beta1/company_service.rst b/docs/talent_v4beta1/company_service.rst new file mode 100644 index 00000000..e2050c75 --- /dev/null +++ b/docs/talent_v4beta1/company_service.rst @@ -0,0 +1,11 @@ +CompanyService +-------------------------------- + +.. automodule:: google.cloud.talent_v4beta1.services.company_service + :members: + :inherited-members: + + +.. automodule:: google.cloud.talent_v4beta1.services.company_service.pagers + :members: + :inherited-members: diff --git a/docs/talent_v4beta1/completion.rst b/docs/talent_v4beta1/completion.rst new file mode 100644 index 00000000..764a23f3 --- /dev/null +++ b/docs/talent_v4beta1/completion.rst @@ -0,0 +1,6 @@ +Completion +---------------------------- + +.. automodule:: google.cloud.talent_v4beta1.services.completion + :members: + :inherited-members: diff --git a/docs/talent_v4beta1/event_service.rst b/docs/talent_v4beta1/event_service.rst new file mode 100644 index 00000000..8e489d4c --- /dev/null +++ b/docs/talent_v4beta1/event_service.rst @@ -0,0 +1,6 @@ +EventService +------------------------------ + +.. automodule:: google.cloud.talent_v4beta1.services.event_service + :members: + :inherited-members: diff --git a/docs/talent_v4beta1/job_service.rst b/docs/talent_v4beta1/job_service.rst new file mode 100644 index 00000000..a78f4f32 --- /dev/null +++ b/docs/talent_v4beta1/job_service.rst @@ -0,0 +1,11 @@ +JobService +---------------------------- + +.. automodule:: google.cloud.talent_v4beta1.services.job_service + :members: + :inherited-members: + + +.. automodule:: google.cloud.talent_v4beta1.services.job_service.pagers + :members: + :inherited-members: diff --git a/docs/talent_v4beta1/profile_service.rst b/docs/talent_v4beta1/profile_service.rst new file mode 100644 index 00000000..e558ed06 --- /dev/null +++ b/docs/talent_v4beta1/profile_service.rst @@ -0,0 +1,11 @@ +ProfileService +-------------------------------- + +.. automodule:: google.cloud.talent_v4beta1.services.profile_service + :members: + :inherited-members: + + +.. automodule:: google.cloud.talent_v4beta1.services.profile_service.pagers + :members: + :inherited-members: diff --git a/docs/talent_v4beta1/services.rst b/docs/talent_v4beta1/services.rst index babbaa4e..019f928f 100644 --- a/docs/talent_v4beta1/services.rst +++ b/docs/talent_v4beta1/services.rst @@ -1,24 +1,12 @@ Services for Google Cloud Talent v4beta1 API ============================================ +.. toctree:: + :maxdepth: 2 -.. 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: + application_service + company_service + completion + event_service + job_service + profile_service + tenant_service diff --git a/docs/talent_v4beta1/tenant_service.rst b/docs/talent_v4beta1/tenant_service.rst new file mode 100644 index 00000000..4de1dcfe --- /dev/null +++ b/docs/talent_v4beta1/tenant_service.rst @@ -0,0 +1,11 @@ +TenantService +------------------------------- + +.. automodule:: google.cloud.talent_v4beta1.services.tenant_service + :members: + :inherited-members: + + +.. automodule:: google.cloud.talent_v4beta1.services.tenant_service.pagers + :members: + :inherited-members: diff --git a/docs/talent_v4beta1/types.rst b/docs/talent_v4beta1/types.rst index 170f4b18..e6abbcac 100644 --- a/docs/talent_v4beta1/types.rst +++ b/docs/talent_v4beta1/types.rst @@ -3,4 +3,5 @@ Types for Google Cloud Talent v4beta1 API .. automodule:: google.cloud.talent_v4beta1.types :members: + :undoc-members: :show-inheritance: diff --git a/google/cloud/talent_v4/services/company_service/async_client.py b/google/cloud/talent_v4/services/company_service/async_client.py index dc84e1fd..ce76dc6c 100644 --- a/google/cloud/talent_v4/services/company_service/async_client.py +++ b/google/cloud/talent_v4/services/company_service/async_client.py @@ -84,6 +84,7 @@ class CompanyServiceAsyncClient: CompanyServiceClient.parse_common_location_path ) + from_service_account_info = CompanyServiceClient.from_service_account_info from_service_account_file = CompanyServiceClient.from_service_account_file from_service_account_json = from_service_account_file @@ -161,7 +162,7 @@ async def create_company( r"""Creates a new company entity. Args: - request (:class:`~.company_service.CreateCompanyRequest`): + request (:class:`google.cloud.talent_v4.types.CreateCompanyRequest`): The request object. The Request of the CreateCompany method. parent (:class:`str`): @@ -171,10 +172,11 @@ async def create_company( 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. - company (:class:`~.gct_company.Company`): + company (:class:`google.cloud.talent_v4.types.Company`): Required. The company to be created. This corresponds to the ``company`` field on the ``request`` instance; if ``request`` is provided, this @@ -187,7 +189,7 @@ async def create_company( sent along with the request as metadata. Returns: - ~.gct_company.Company: + google.cloud.talent_v4.types.Company: A Company resource represents a company in the service. A company is the entity that owns job postings, that is, @@ -248,7 +250,7 @@ async def get_company( r"""Retrieves specified company. Args: - request (:class:`~.company_service.GetCompanyRequest`): + request (:class:`google.cloud.talent_v4.types.GetCompanyRequest`): The request object. Request for getting a company by name. name (:class:`str`): @@ -259,6 +261,7 @@ async def get_company( "projects/{project_id}/tenants/{tenant_id}/companies/{company_id}", for example, "projects/api-test-project/tenants/foo/companies/bar". + This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -270,7 +273,7 @@ async def get_company( sent along with the request as metadata. Returns: - ~.company.Company: + google.cloud.talent_v4.types.Company: A Company resource represents a company in the service. A company is the entity that owns job postings, that is, @@ -338,17 +341,18 @@ async def update_company( r"""Updates specified company. Args: - request (:class:`~.company_service.UpdateCompanyRequest`): + request (:class:`google.cloud.talent_v4.types.UpdateCompanyRequest`): The request object. Request for updating a specified company. - company (:class:`~.gct_company.Company`): + company (:class:`google.cloud.talent_v4.types.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. - update_mask (:class:`~.field_mask.FieldMask`): + update_mask (:class:`google.protobuf.field_mask_pb2.FieldMask`): Strongly recommended for the best service experience. If @@ -360,6 +364,7 @@ async def update_company( A field mask to specify the company fields to be updated. Only top level fields of [Company][google.cloud.talent.v4.Company] are supported. + This corresponds to the ``update_mask`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -371,7 +376,7 @@ async def update_company( sent along with the request as metadata. Returns: - ~.gct_company.Company: + google.cloud.talent_v4.types.Company: A Company resource represents a company in the service. A company is the entity that owns job postings, that is, @@ -436,7 +441,7 @@ async def delete_company( it. Args: - request (:class:`~.company_service.DeleteCompanyRequest`): + request (:class:`google.cloud.talent_v4.types.DeleteCompanyRequest`): The request object. Request to delete a company. name (:class:`str`): Required. The resource name of the company to be @@ -445,6 +450,7 @@ async def delete_company( The format is "projects/{project_id}/tenants/{tenant_id}/companies/{company_id}", for example, "projects/foo/tenants/bar/companies/baz". + This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -512,7 +518,7 @@ async def list_companies( r"""Lists all companies associated with the project. Args: - request (:class:`~.company_service.ListCompaniesRequest`): + request (:class:`google.cloud.talent_v4.types.ListCompaniesRequest`): The request object. List companies for which the client has ACL visibility. parent (:class:`str`): @@ -522,6 +528,7 @@ async def list_companies( 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. @@ -533,7 +540,7 @@ async def list_companies( sent along with the request as metadata. Returns: - ~.pagers.ListCompaniesAsyncPager: + google.cloud.talent_v4.services.company_service.pagers.ListCompaniesAsyncPager: The List companies response object. Iterating over this object will yield results and resolve additional pages diff --git a/google/cloud/talent_v4/services/company_service/client.py b/google/cloud/talent_v4/services/company_service/client.py index 7b32d9b6..10f6d998 100644 --- a/google/cloud/talent_v4/services/company_service/client.py +++ b/google/cloud/talent_v4/services/company_service/client.py @@ -116,6 +116,22 @@ def _get_default_mtls_endpoint(api_endpoint): DEFAULT_ENDPOINT ) + @classmethod + def from_service_account_info(cls, info: dict, *args, **kwargs): + """Creates an instance of this client using the provided credentials info. + + Args: + info (dict): The service account private key info. + args: Additional arguments to pass to the constructor. + kwargs: Additional arguments to pass to the constructor. + + Returns: + CompanyServiceClient: The constructed client. + """ + credentials = service_account.Credentials.from_service_account_info(info) + kwargs["credentials"] = credentials + return cls(*args, **kwargs) + @classmethod def from_service_account_file(cls, filename: str, *args, **kwargs): """Creates an instance of this client using the provided credentials @@ -128,7 +144,7 @@ def from_service_account_file(cls, filename: str, *args, **kwargs): kwargs: Additional arguments to pass to the constructor. Returns: - {@api.name}: The constructed client. + CompanyServiceClient: The constructed client. """ credentials = service_account.Credentials.from_service_account_file(filename) kwargs["credentials"] = credentials @@ -249,10 +265,10 @@ def __init__( 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 (Union[str, CompanyServiceTransport]): The transport to use. If set to None, a transport is chosen automatically. - client_options (client_options_lib.ClientOptions): Custom options for the + client_options (google.api_core.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_ENDPOINT @@ -288,21 +304,17 @@ def __init__( util.strtobool(os.getenv("GOOGLE_API_USE_CLIENT_CERTIFICATE", "false")) ) - ssl_credentials = None + client_cert_source_func = None is_mtls = False if use_client_cert: if client_options.client_cert_source: - import grpc # type: ignore - - cert, key = client_options.client_cert_source() - ssl_credentials = grpc.ssl_channel_credentials( - certificate_chain=cert, private_key=key - ) is_mtls = True + client_cert_source_func = client_options.client_cert_source else: - creds = SslCredentials() - is_mtls = creds.is_mtls - ssl_credentials = creds.ssl_credentials if is_mtls else None + is_mtls = mtls.has_default_client_cert_source() + client_cert_source_func = ( + mtls.default_client_cert_source() if is_mtls else None + ) # Figure out which api endpoint to use. if client_options.api_endpoint is not None: @@ -345,7 +357,7 @@ def __init__( credentials_file=client_options.credentials_file, host=api_endpoint, scopes=client_options.scopes, - ssl_channel_credentials=ssl_credentials, + client_cert_source_for_mtls=client_cert_source_func, quota_project_id=client_options.quota_project_id, client_info=client_info, ) @@ -363,20 +375,21 @@ def create_company( r"""Creates a new company entity. Args: - request (:class:`~.company_service.CreateCompanyRequest`): + request (google.cloud.talent_v4.types.CreateCompanyRequest): The request object. The Request of the CreateCompany method. - parent (:class:`str`): + 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/tenants/bar". + This corresponds to the ``parent`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - company (:class:`~.gct_company.Company`): + company (google.cloud.talent_v4.types.Company): Required. The company to be created. This corresponds to the ``company`` field on the ``request`` instance; if ``request`` is provided, this @@ -389,7 +402,7 @@ def create_company( sent along with the request as metadata. Returns: - ~.gct_company.Company: + google.cloud.talent_v4.types.Company: A Company resource represents a company in the service. A company is the entity that owns job postings, that is, @@ -451,10 +464,10 @@ def get_company( r"""Retrieves specified company. Args: - request (:class:`~.company_service.GetCompanyRequest`): + request (google.cloud.talent_v4.types.GetCompanyRequest): The request object. Request for getting a company by name. - name (:class:`str`): + name (str): Required. The resource name of the company to be retrieved. @@ -462,6 +475,7 @@ def get_company( "projects/{project_id}/tenants/{tenant_id}/companies/{company_id}", for example, "projects/api-test-project/tenants/foo/companies/bar". + This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -473,7 +487,7 @@ def get_company( sent along with the request as metadata. Returns: - ~.company.Company: + google.cloud.talent_v4.types.Company: A Company resource represents a company in the service. A company is the entity that owns job postings, that is, @@ -534,17 +548,18 @@ def update_company( r"""Updates specified company. Args: - request (:class:`~.company_service.UpdateCompanyRequest`): + request (google.cloud.talent_v4.types.UpdateCompanyRequest): The request object. Request for updating a specified company. - company (:class:`~.gct_company.Company`): + company (google.cloud.talent_v4.types.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. - update_mask (:class:`~.field_mask.FieldMask`): + update_mask (google.protobuf.field_mask_pb2.FieldMask): Strongly recommended for the best service experience. If @@ -556,6 +571,7 @@ def update_company( A field mask to specify the company fields to be updated. Only top level fields of [Company][google.cloud.talent.v4.Company] are supported. + This corresponds to the ``update_mask`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -567,7 +583,7 @@ def update_company( sent along with the request as metadata. Returns: - ~.gct_company.Company: + google.cloud.talent_v4.types.Company: A Company resource represents a company in the service. A company is the entity that owns job postings, that is, @@ -633,15 +649,16 @@ def delete_company( it. Args: - request (:class:`~.company_service.DeleteCompanyRequest`): + request (google.cloud.talent_v4.types.DeleteCompanyRequest): The request object. Request to delete a company. - name (:class:`str`): + 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". + This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -702,16 +719,17 @@ def list_companies( r"""Lists all companies associated with the project. Args: - request (:class:`~.company_service.ListCompaniesRequest`): + request (google.cloud.talent_v4.types.ListCompaniesRequest): The request object. List companies for which the client has ACL visibility. - parent (:class:`str`): + 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/tenants/bar". + This corresponds to the ``parent`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -723,7 +741,7 @@ def list_companies( sent along with the request as metadata. Returns: - ~.pagers.ListCompaniesPager: + google.cloud.talent_v4.services.company_service.pagers.ListCompaniesPager: The List companies response object. Iterating over this object will yield results and resolve additional pages diff --git a/google/cloud/talent_v4/services/company_service/pagers.py b/google/cloud/talent_v4/services/company_service/pagers.py index 992c4b53..a9eafc75 100644 --- a/google/cloud/talent_v4/services/company_service/pagers.py +++ b/google/cloud/talent_v4/services/company_service/pagers.py @@ -25,7 +25,7 @@ class ListCompaniesPager: """A pager for iterating through ``list_companies`` requests. This class thinly wraps an initial - :class:`~.company_service.ListCompaniesResponse` object, and + :class:`google.cloud.talent_v4.types.ListCompaniesResponse` object, and provides an ``__iter__`` method to iterate through its ``companies`` field. @@ -34,7 +34,7 @@ class ListCompaniesPager: through the ``companies`` field on the corresponding responses. - All the usual :class:`~.company_service.ListCompaniesResponse` + All the usual :class:`google.cloud.talent_v4.types.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. """ @@ -52,9 +52,9 @@ def __init__( Args: method (Callable): The method that was originally called, and which instantiated this pager. - request (:class:`~.company_service.ListCompaniesRequest`): + request (google.cloud.talent_v4.types.ListCompaniesRequest): The initial request object. - response (:class:`~.company_service.ListCompaniesResponse`): + response (google.cloud.talent_v4.types.ListCompaniesResponse): The initial response object. metadata (Sequence[Tuple[str, str]]): Strings which should be sent along with the request as metadata. @@ -87,7 +87,7 @@ class ListCompaniesAsyncPager: """A pager for iterating through ``list_companies`` requests. This class thinly wraps an initial - :class:`~.company_service.ListCompaniesResponse` object, and + :class:`google.cloud.talent_v4.types.ListCompaniesResponse` object, and provides an ``__aiter__`` method to iterate through its ``companies`` field. @@ -96,7 +96,7 @@ class ListCompaniesAsyncPager: through the ``companies`` field on the corresponding responses. - All the usual :class:`~.company_service.ListCompaniesResponse` + All the usual :class:`google.cloud.talent_v4.types.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. """ @@ -114,9 +114,9 @@ def __init__( Args: method (Callable): The method that was originally called, and which instantiated this pager. - request (:class:`~.company_service.ListCompaniesRequest`): + request (google.cloud.talent_v4.types.ListCompaniesRequest): The initial request object. - response (:class:`~.company_service.ListCompaniesResponse`): + response (google.cloud.talent_v4.types.ListCompaniesResponse): The initial response object. metadata (Sequence[Tuple[str, str]]): Strings which should be sent along with the request as metadata. diff --git a/google/cloud/talent_v4/services/company_service/transports/grpc.py b/google/cloud/talent_v4/services/company_service/transports/grpc.py index 09068973..3825b0cf 100644 --- a/google/cloud/talent_v4/services/company_service/transports/grpc.py +++ b/google/cloud/talent_v4/services/company_service/transports/grpc.py @@ -61,6 +61,7 @@ def __init__( api_mtls_endpoint: str = None, client_cert_source: Callable[[], Tuple[bytes, bytes]] = None, ssl_channel_credentials: grpc.ChannelCredentials = None, + client_cert_source_for_mtls: Callable[[], Tuple[bytes, bytes]] = None, quota_project_id: Optional[str] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, ) -> None: @@ -91,6 +92,10 @@ def __init__( ``api_mtls_endpoint`` is None. ssl_channel_credentials (grpc.ChannelCredentials): SSL credentials for grpc channel. It is ignored if ``channel`` is provided. + client_cert_source_for_mtls (Optional[Callable[[], Tuple[bytes, bytes]]]): + A callback to provide client certificate bytes and private key bytes, + both in PEM format. It is used to configure mutual TLS channel. It is + ignored if ``channel`` or ``ssl_channel_credentials`` is provided. quota_project_id (Optional[str]): An optional project to use for billing and quota. client_info (google.api_core.gapic_v1.client_info.ClientInfo): @@ -107,6 +112,11 @@ def __init__( """ self._ssl_channel_credentials = ssl_channel_credentials + if api_mtls_endpoint: + warnings.warn("api_mtls_endpoint is deprecated", DeprecationWarning) + if client_cert_source: + warnings.warn("client_cert_source is deprecated", DeprecationWarning) + if channel: # Sanity check: Ensure that channel and credentials are not both # provided. @@ -116,11 +126,6 @@ def __init__( self._grpc_channel = channel self._ssl_channel_credentials = None elif api_mtls_endpoint: - warnings.warn( - "api_mtls_endpoint and client_cert_source are deprecated", - DeprecationWarning, - ) - host = ( api_mtls_endpoint if ":" in api_mtls_endpoint @@ -164,12 +169,18 @@ def __init__( scopes=self.AUTH_SCOPES, quota_project_id=quota_project_id ) + if client_cert_source_for_mtls and not ssl_channel_credentials: + cert, key = client_cert_source_for_mtls() + self._ssl_channel_credentials = grpc.ssl_channel_credentials( + certificate_chain=cert, private_key=key + ) + # 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_channel_credentials, + ssl_credentials=self._ssl_channel_credentials, scopes=scopes or self.AUTH_SCOPES, quota_project_id=quota_project_id, options=[ diff --git a/google/cloud/talent_v4/services/company_service/transports/grpc_asyncio.py b/google/cloud/talent_v4/services/company_service/transports/grpc_asyncio.py index fbf3fa4a..58252223 100644 --- a/google/cloud/talent_v4/services/company_service/transports/grpc_asyncio.py +++ b/google/cloud/talent_v4/services/company_service/transports/grpc_asyncio.py @@ -105,6 +105,7 @@ def __init__( api_mtls_endpoint: str = None, client_cert_source: Callable[[], Tuple[bytes, bytes]] = None, ssl_channel_credentials: grpc.ChannelCredentials = None, + client_cert_source_for_mtls: Callable[[], Tuple[bytes, bytes]] = None, quota_project_id=None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, ) -> None: @@ -136,6 +137,10 @@ def __init__( ``api_mtls_endpoint`` is None. ssl_channel_credentials (grpc.ChannelCredentials): SSL credentials for grpc channel. It is ignored if ``channel`` is provided. + client_cert_source_for_mtls (Optional[Callable[[], Tuple[bytes, bytes]]]): + A callback to provide client certificate bytes and private key bytes, + both in PEM format. It is used to configure mutual TLS channel. It is + ignored if ``channel`` or ``ssl_channel_credentials`` is provided. quota_project_id (Optional[str]): An optional project to use for billing and quota. client_info (google.api_core.gapic_v1.client_info.ClientInfo): @@ -152,6 +157,11 @@ def __init__( """ self._ssl_channel_credentials = ssl_channel_credentials + if api_mtls_endpoint: + warnings.warn("api_mtls_endpoint is deprecated", DeprecationWarning) + if client_cert_source: + warnings.warn("client_cert_source is deprecated", DeprecationWarning) + if channel: # Sanity check: Ensure that channel and credentials are not both # provided. @@ -161,11 +171,6 @@ def __init__( self._grpc_channel = channel self._ssl_channel_credentials = None elif api_mtls_endpoint: - warnings.warn( - "api_mtls_endpoint and client_cert_source are deprecated", - DeprecationWarning, - ) - host = ( api_mtls_endpoint if ":" in api_mtls_endpoint @@ -209,12 +214,18 @@ def __init__( scopes=self.AUTH_SCOPES, quota_project_id=quota_project_id ) + if client_cert_source_for_mtls and not ssl_channel_credentials: + cert, key = client_cert_source_for_mtls() + self._ssl_channel_credentials = grpc.ssl_channel_credentials( + certificate_chain=cert, private_key=key + ) + # 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_channel_credentials, + ssl_credentials=self._ssl_channel_credentials, scopes=scopes or self.AUTH_SCOPES, quota_project_id=quota_project_id, options=[ diff --git a/google/cloud/talent_v4/services/completion/async_client.py b/google/cloud/talent_v4/services/completion/async_client.py index 2c91e861..778ebbd2 100644 --- a/google/cloud/talent_v4/services/completion/async_client.py +++ b/google/cloud/talent_v4/services/completion/async_client.py @@ -72,6 +72,7 @@ class CompletionAsyncClient: CompletionClient.parse_common_location_path ) + from_service_account_info = CompletionClient.from_service_account_info from_service_account_file = CompletionClient.from_service_account_file from_service_account_json = from_service_account_file @@ -149,7 +150,7 @@ async def complete_query( complete search box. Args: - request (:class:`~.completion_service.CompleteQueryRequest`): + request (:class:`google.cloud.talent_v4.types.CompleteQueryRequest`): The request object. Auto-complete parameters. retry (google.api_core.retry.Retry): Designation of what errors, if any, @@ -159,7 +160,7 @@ async def complete_query( sent along with the request as metadata. Returns: - ~.completion_service.CompleteQueryResponse: + google.cloud.talent_v4.types.CompleteQueryResponse: Response of auto-complete query. """ # Create or coerce a protobuf request object. diff --git a/google/cloud/talent_v4/services/completion/client.py b/google/cloud/talent_v4/services/completion/client.py index 3d3b0589..6eacd4ca 100644 --- a/google/cloud/talent_v4/services/completion/client.py +++ b/google/cloud/talent_v4/services/completion/client.py @@ -108,6 +108,22 @@ def _get_default_mtls_endpoint(api_endpoint): DEFAULT_ENDPOINT ) + @classmethod + def from_service_account_info(cls, info: dict, *args, **kwargs): + """Creates an instance of this client using the provided credentials info. + + Args: + info (dict): The service account private key info. + args: Additional arguments to pass to the constructor. + kwargs: Additional arguments to pass to the constructor. + + Returns: + CompletionClient: The constructed client. + """ + credentials = service_account.Credentials.from_service_account_info(info) + kwargs["credentials"] = credentials + return cls(*args, **kwargs) + @classmethod def from_service_account_file(cls, filename: str, *args, **kwargs): """Creates an instance of this client using the provided credentials @@ -120,7 +136,7 @@ def from_service_account_file(cls, filename: str, *args, **kwargs): kwargs: Additional arguments to pass to the constructor. Returns: - {@api.name}: The constructed client. + CompletionClient: The constructed client. """ credentials = service_account.Credentials.from_service_account_file(filename) kwargs["credentials"] = credentials @@ -241,10 +257,10 @@ def __init__( 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 (Union[str, CompletionTransport]): The transport to use. If set to None, a transport is chosen automatically. - client_options (client_options_lib.ClientOptions): Custom options for the + client_options (google.api_core.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_ENDPOINT @@ -280,21 +296,17 @@ def __init__( util.strtobool(os.getenv("GOOGLE_API_USE_CLIENT_CERTIFICATE", "false")) ) - ssl_credentials = None + client_cert_source_func = None is_mtls = False if use_client_cert: if client_options.client_cert_source: - import grpc # type: ignore - - cert, key = client_options.client_cert_source() - ssl_credentials = grpc.ssl_channel_credentials( - certificate_chain=cert, private_key=key - ) is_mtls = True + client_cert_source_func = client_options.client_cert_source else: - creds = SslCredentials() - is_mtls = creds.is_mtls - ssl_credentials = creds.ssl_credentials if is_mtls else None + is_mtls = mtls.has_default_client_cert_source() + client_cert_source_func = ( + mtls.default_client_cert_source() if is_mtls else None + ) # Figure out which api endpoint to use. if client_options.api_endpoint is not None: @@ -337,7 +349,7 @@ def __init__( credentials_file=client_options.credentials_file, host=api_endpoint, scopes=client_options.scopes, - ssl_channel_credentials=ssl_credentials, + client_cert_source_for_mtls=client_cert_source_func, quota_project_id=client_options.quota_project_id, client_info=client_info, ) @@ -355,7 +367,7 @@ def complete_query( complete search box. Args: - request (:class:`~.completion_service.CompleteQueryRequest`): + request (google.cloud.talent_v4.types.CompleteQueryRequest): The request object. Auto-complete parameters. retry (google.api_core.retry.Retry): Designation of what errors, if any, @@ -365,7 +377,7 @@ def complete_query( sent along with the request as metadata. Returns: - ~.completion_service.CompleteQueryResponse: + google.cloud.talent_v4.types.CompleteQueryResponse: Response of auto-complete query. """ # Create or coerce a protobuf request object. diff --git a/google/cloud/talent_v4/services/completion/transports/grpc.py b/google/cloud/talent_v4/services/completion/transports/grpc.py index 08fe29d3..c4fea8c9 100644 --- a/google/cloud/talent_v4/services/completion/transports/grpc.py +++ b/google/cloud/talent_v4/services/completion/transports/grpc.py @@ -57,6 +57,7 @@ def __init__( api_mtls_endpoint: str = None, client_cert_source: Callable[[], Tuple[bytes, bytes]] = None, ssl_channel_credentials: grpc.ChannelCredentials = None, + client_cert_source_for_mtls: Callable[[], Tuple[bytes, bytes]] = None, quota_project_id: Optional[str] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, ) -> None: @@ -87,6 +88,10 @@ def __init__( ``api_mtls_endpoint`` is None. ssl_channel_credentials (grpc.ChannelCredentials): SSL credentials for grpc channel. It is ignored if ``channel`` is provided. + client_cert_source_for_mtls (Optional[Callable[[], Tuple[bytes, bytes]]]): + A callback to provide client certificate bytes and private key bytes, + both in PEM format. It is used to configure mutual TLS channel. It is + ignored if ``channel`` or ``ssl_channel_credentials`` is provided. quota_project_id (Optional[str]): An optional project to use for billing and quota. client_info (google.api_core.gapic_v1.client_info.ClientInfo): @@ -103,6 +108,11 @@ def __init__( """ self._ssl_channel_credentials = ssl_channel_credentials + if api_mtls_endpoint: + warnings.warn("api_mtls_endpoint is deprecated", DeprecationWarning) + if client_cert_source: + warnings.warn("client_cert_source is deprecated", DeprecationWarning) + if channel: # Sanity check: Ensure that channel and credentials are not both # provided. @@ -112,11 +122,6 @@ def __init__( self._grpc_channel = channel self._ssl_channel_credentials = None elif api_mtls_endpoint: - warnings.warn( - "api_mtls_endpoint and client_cert_source are deprecated", - DeprecationWarning, - ) - host = ( api_mtls_endpoint if ":" in api_mtls_endpoint @@ -160,12 +165,18 @@ def __init__( scopes=self.AUTH_SCOPES, quota_project_id=quota_project_id ) + if client_cert_source_for_mtls and not ssl_channel_credentials: + cert, key = client_cert_source_for_mtls() + self._ssl_channel_credentials = grpc.ssl_channel_credentials( + certificate_chain=cert, private_key=key + ) + # 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_channel_credentials, + ssl_credentials=self._ssl_channel_credentials, scopes=scopes or self.AUTH_SCOPES, quota_project_id=quota_project_id, options=[ diff --git a/google/cloud/talent_v4/services/completion/transports/grpc_asyncio.py b/google/cloud/talent_v4/services/completion/transports/grpc_asyncio.py index d5a0ef57..55e7b2d2 100644 --- a/google/cloud/talent_v4/services/completion/transports/grpc_asyncio.py +++ b/google/cloud/talent_v4/services/completion/transports/grpc_asyncio.py @@ -101,6 +101,7 @@ def __init__( api_mtls_endpoint: str = None, client_cert_source: Callable[[], Tuple[bytes, bytes]] = None, ssl_channel_credentials: grpc.ChannelCredentials = None, + client_cert_source_for_mtls: Callable[[], Tuple[bytes, bytes]] = None, quota_project_id=None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, ) -> None: @@ -132,6 +133,10 @@ def __init__( ``api_mtls_endpoint`` is None. ssl_channel_credentials (grpc.ChannelCredentials): SSL credentials for grpc channel. It is ignored if ``channel`` is provided. + client_cert_source_for_mtls (Optional[Callable[[], Tuple[bytes, bytes]]]): + A callback to provide client certificate bytes and private key bytes, + both in PEM format. It is used to configure mutual TLS channel. It is + ignored if ``channel`` or ``ssl_channel_credentials`` is provided. quota_project_id (Optional[str]): An optional project to use for billing and quota. client_info (google.api_core.gapic_v1.client_info.ClientInfo): @@ -148,6 +153,11 @@ def __init__( """ self._ssl_channel_credentials = ssl_channel_credentials + if api_mtls_endpoint: + warnings.warn("api_mtls_endpoint is deprecated", DeprecationWarning) + if client_cert_source: + warnings.warn("client_cert_source is deprecated", DeprecationWarning) + if channel: # Sanity check: Ensure that channel and credentials are not both # provided. @@ -157,11 +167,6 @@ def __init__( self._grpc_channel = channel self._ssl_channel_credentials = None elif api_mtls_endpoint: - warnings.warn( - "api_mtls_endpoint and client_cert_source are deprecated", - DeprecationWarning, - ) - host = ( api_mtls_endpoint if ":" in api_mtls_endpoint @@ -205,12 +210,18 @@ def __init__( scopes=self.AUTH_SCOPES, quota_project_id=quota_project_id ) + if client_cert_source_for_mtls and not ssl_channel_credentials: + cert, key = client_cert_source_for_mtls() + self._ssl_channel_credentials = grpc.ssl_channel_credentials( + certificate_chain=cert, private_key=key + ) + # 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_channel_credentials, + ssl_credentials=self._ssl_channel_credentials, scopes=scopes or self.AUTH_SCOPES, quota_project_id=quota_project_id, options=[ diff --git a/google/cloud/talent_v4/services/event_service/async_client.py b/google/cloud/talent_v4/services/event_service/async_client.py index 8a6a6e41..e5c364f0 100644 --- a/google/cloud/talent_v4/services/event_service/async_client.py +++ b/google/cloud/talent_v4/services/event_service/async_client.py @@ -73,6 +73,7 @@ class EventServiceAsyncClient: EventServiceClient.parse_common_location_path ) + from_service_account_info = EventServiceClient.from_service_account_info from_service_account_file = EventServiceClient.from_service_account_file from_service_account_json = from_service_account_file @@ -156,7 +157,7 @@ async def create_client_event( about self service tools. Args: - request (:class:`~.event_service.CreateClientEventRequest`): + request (:class:`google.cloud.talent_v4.types.CreateClientEventRequest`): The request object. The report event request. parent (:class:`str`): Required. Resource name of the tenant under which the @@ -165,13 +166,15 @@ async def create_client_event( 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. - client_event (:class:`~.event.ClientEvent`): + client_event (:class:`google.cloud.talent_v4.types.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. @@ -183,7 +186,7 @@ async def create_client_event( sent along with the request as metadata. Returns: - ~.event.ClientEvent: + google.cloud.talent_v4.types.ClientEvent: An event issued when an end user interacts with the application that implements Cloud Talent Solution. diff --git a/google/cloud/talent_v4/services/event_service/client.py b/google/cloud/talent_v4/services/event_service/client.py index 06f1fd4f..9cae6703 100644 --- a/google/cloud/talent_v4/services/event_service/client.py +++ b/google/cloud/talent_v4/services/event_service/client.py @@ -109,6 +109,22 @@ def _get_default_mtls_endpoint(api_endpoint): DEFAULT_ENDPOINT ) + @classmethod + def from_service_account_info(cls, info: dict, *args, **kwargs): + """Creates an instance of this client using the provided credentials info. + + Args: + info (dict): The service account private key info. + args: Additional arguments to pass to the constructor. + kwargs: Additional arguments to pass to the constructor. + + Returns: + EventServiceClient: The constructed client. + """ + credentials = service_account.Credentials.from_service_account_info(info) + kwargs["credentials"] = credentials + return cls(*args, **kwargs) + @classmethod def from_service_account_file(cls, filename: str, *args, **kwargs): """Creates an instance of this client using the provided credentials @@ -121,7 +137,7 @@ def from_service_account_file(cls, filename: str, *args, **kwargs): kwargs: Additional arguments to pass to the constructor. Returns: - {@api.name}: The constructed client. + EventServiceClient: The constructed client. """ credentials = service_account.Credentials.from_service_account_file(filename) kwargs["credentials"] = credentials @@ -226,10 +242,10 @@ def __init__( 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 (Union[str, EventServiceTransport]): The transport to use. If set to None, a transport is chosen automatically. - client_options (client_options_lib.ClientOptions): Custom options for the + client_options (google.api_core.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_ENDPOINT @@ -265,21 +281,17 @@ def __init__( util.strtobool(os.getenv("GOOGLE_API_USE_CLIENT_CERTIFICATE", "false")) ) - ssl_credentials = None + client_cert_source_func = None is_mtls = False if use_client_cert: if client_options.client_cert_source: - import grpc # type: ignore - - cert, key = client_options.client_cert_source() - ssl_credentials = grpc.ssl_channel_credentials( - certificate_chain=cert, private_key=key - ) is_mtls = True + client_cert_source_func = client_options.client_cert_source else: - creds = SslCredentials() - is_mtls = creds.is_mtls - ssl_credentials = creds.ssl_credentials if is_mtls else None + is_mtls = mtls.has_default_client_cert_source() + client_cert_source_func = ( + mtls.default_client_cert_source() if is_mtls else None + ) # Figure out which api endpoint to use. if client_options.api_endpoint is not None: @@ -322,7 +334,7 @@ def __init__( credentials_file=client_options.credentials_file, host=api_endpoint, scopes=client_options.scopes, - ssl_channel_credentials=ssl_credentials, + client_cert_source_for_mtls=client_cert_source_func, quota_project_id=client_options.quota_project_id, client_info=client_info, ) @@ -346,22 +358,24 @@ def create_client_event( about self service tools. Args: - request (:class:`~.event_service.CreateClientEventRequest`): + request (google.cloud.talent_v4.types.CreateClientEventRequest): The request object. The report event request. - parent (:class:`str`): + 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/tenants/bar". + This corresponds to the ``parent`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - client_event (:class:`~.event.ClientEvent`): + client_event (google.cloud.talent_v4.types.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. @@ -373,7 +387,7 @@ def create_client_event( sent along with the request as metadata. Returns: - ~.event.ClientEvent: + google.cloud.talent_v4.types.ClientEvent: An event issued when an end user interacts with the application that implements Cloud Talent Solution. diff --git a/google/cloud/talent_v4/services/event_service/transports/grpc.py b/google/cloud/talent_v4/services/event_service/transports/grpc.py index c6dfa670..e5616e86 100644 --- a/google/cloud/talent_v4/services/event_service/transports/grpc.py +++ b/google/cloud/talent_v4/services/event_service/transports/grpc.py @@ -58,6 +58,7 @@ def __init__( api_mtls_endpoint: str = None, client_cert_source: Callable[[], Tuple[bytes, bytes]] = None, ssl_channel_credentials: grpc.ChannelCredentials = None, + client_cert_source_for_mtls: Callable[[], Tuple[bytes, bytes]] = None, quota_project_id: Optional[str] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, ) -> None: @@ -88,6 +89,10 @@ def __init__( ``api_mtls_endpoint`` is None. ssl_channel_credentials (grpc.ChannelCredentials): SSL credentials for grpc channel. It is ignored if ``channel`` is provided. + client_cert_source_for_mtls (Optional[Callable[[], Tuple[bytes, bytes]]]): + A callback to provide client certificate bytes and private key bytes, + both in PEM format. It is used to configure mutual TLS channel. It is + ignored if ``channel`` or ``ssl_channel_credentials`` is provided. quota_project_id (Optional[str]): An optional project to use for billing and quota. client_info (google.api_core.gapic_v1.client_info.ClientInfo): @@ -104,6 +109,11 @@ def __init__( """ self._ssl_channel_credentials = ssl_channel_credentials + if api_mtls_endpoint: + warnings.warn("api_mtls_endpoint is deprecated", DeprecationWarning) + if client_cert_source: + warnings.warn("client_cert_source is deprecated", DeprecationWarning) + if channel: # Sanity check: Ensure that channel and credentials are not both # provided. @@ -113,11 +123,6 @@ def __init__( self._grpc_channel = channel self._ssl_channel_credentials = None elif api_mtls_endpoint: - warnings.warn( - "api_mtls_endpoint and client_cert_source are deprecated", - DeprecationWarning, - ) - host = ( api_mtls_endpoint if ":" in api_mtls_endpoint @@ -161,12 +166,18 @@ def __init__( scopes=self.AUTH_SCOPES, quota_project_id=quota_project_id ) + if client_cert_source_for_mtls and not ssl_channel_credentials: + cert, key = client_cert_source_for_mtls() + self._ssl_channel_credentials = grpc.ssl_channel_credentials( + certificate_chain=cert, private_key=key + ) + # 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_channel_credentials, + ssl_credentials=self._ssl_channel_credentials, scopes=scopes or self.AUTH_SCOPES, quota_project_id=quota_project_id, options=[ diff --git a/google/cloud/talent_v4/services/event_service/transports/grpc_asyncio.py b/google/cloud/talent_v4/services/event_service/transports/grpc_asyncio.py index 38de85b0..b2e23888 100644 --- a/google/cloud/talent_v4/services/event_service/transports/grpc_asyncio.py +++ b/google/cloud/talent_v4/services/event_service/transports/grpc_asyncio.py @@ -102,6 +102,7 @@ def __init__( api_mtls_endpoint: str = None, client_cert_source: Callable[[], Tuple[bytes, bytes]] = None, ssl_channel_credentials: grpc.ChannelCredentials = None, + client_cert_source_for_mtls: Callable[[], Tuple[bytes, bytes]] = None, quota_project_id=None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, ) -> None: @@ -133,6 +134,10 @@ def __init__( ``api_mtls_endpoint`` is None. ssl_channel_credentials (grpc.ChannelCredentials): SSL credentials for grpc channel. It is ignored if ``channel`` is provided. + client_cert_source_for_mtls (Optional[Callable[[], Tuple[bytes, bytes]]]): + A callback to provide client certificate bytes and private key bytes, + both in PEM format. It is used to configure mutual TLS channel. It is + ignored if ``channel`` or ``ssl_channel_credentials`` is provided. quota_project_id (Optional[str]): An optional project to use for billing and quota. client_info (google.api_core.gapic_v1.client_info.ClientInfo): @@ -149,6 +154,11 @@ def __init__( """ self._ssl_channel_credentials = ssl_channel_credentials + if api_mtls_endpoint: + warnings.warn("api_mtls_endpoint is deprecated", DeprecationWarning) + if client_cert_source: + warnings.warn("client_cert_source is deprecated", DeprecationWarning) + if channel: # Sanity check: Ensure that channel and credentials are not both # provided. @@ -158,11 +168,6 @@ def __init__( self._grpc_channel = channel self._ssl_channel_credentials = None elif api_mtls_endpoint: - warnings.warn( - "api_mtls_endpoint and client_cert_source are deprecated", - DeprecationWarning, - ) - host = ( api_mtls_endpoint if ":" in api_mtls_endpoint @@ -206,12 +211,18 @@ def __init__( scopes=self.AUTH_SCOPES, quota_project_id=quota_project_id ) + if client_cert_source_for_mtls and not ssl_channel_credentials: + cert, key = client_cert_source_for_mtls() + self._ssl_channel_credentials = grpc.ssl_channel_credentials( + certificate_chain=cert, private_key=key + ) + # 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_channel_credentials, + ssl_credentials=self._ssl_channel_credentials, scopes=scopes or self.AUTH_SCOPES, quota_project_id=quota_project_id, options=[ diff --git a/google/cloud/talent_v4/services/job_service/async_client.py b/google/cloud/talent_v4/services/job_service/async_client.py index ec420503..88e0e7ca 100644 --- a/google/cloud/talent_v4/services/job_service/async_client.py +++ b/google/cloud/talent_v4/services/job_service/async_client.py @@ -84,6 +84,7 @@ class JobServiceAsyncClient: JobServiceClient.parse_common_location_path ) + from_service_account_info = JobServiceClient.from_service_account_info from_service_account_file = JobServiceClient.from_service_account_file from_service_account_json = from_service_account_file @@ -163,7 +164,7 @@ async def create_job( but it may take up to 5 minutes. Args: - request (:class:`~.job_service.CreateJobRequest`): + request (:class:`google.cloud.talent_v4.types.CreateJobRequest`): The request object. Create job request. parent (:class:`str`): Required. The resource name of the tenant under which @@ -172,10 +173,11 @@ async def create_job( 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. - job (:class:`~.gct_job.Job`): + job (:class:`google.cloud.talent_v4.types.Job`): Required. The Job to be created. This corresponds to the ``job`` field on the ``request`` instance; if ``request`` is provided, this @@ -188,11 +190,11 @@ async def create_job( 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.v4.Company], - which is the hiring entity responsible for the job. + google.cloud.talent_v4.types.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.v4.Company], which is + the hiring entity responsible for the job. """ # Create or coerce a protobuf request object. @@ -248,7 +250,7 @@ async def batch_create_jobs( r"""Begins executing a batch create jobs operation. Args: - request (:class:`~.job_service.BatchCreateJobsRequest`): + request (:class:`google.cloud.talent_v4.types.BatchCreateJobsRequest`): The request object. Request to create a batch of jobs. parent (:class:`str`): Required. The resource name of the tenant under which @@ -257,13 +259,15 @@ async def batch_create_jobs( 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. - jobs (:class:`Sequence[~.job.Job]`): + jobs (:class:`Sequence[google.cloud.talent_v4.types.Job]`): Required. The jobs to be created. A maximum of 200 jobs can be created in a batch. + This corresponds to the ``jobs`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -275,16 +279,13 @@ async def batch_create_jobs( sent along with the request as metadata. Returns: - ~.operation_async.AsyncOperation: + google.api_core.operation_async.AsyncOperation: An object representing a long-running operation. - The result type for the operation will be - :class:``~.job_service.BatchCreateJobsResponse``: The - result of - [JobService.BatchCreateJobs][google.cloud.talent.v4.JobService.BatchCreateJobs]. - It's used to replace - [google.longrunning.Operation.response][google.longrunning.Operation.response] - in case of success. + The result type for the operation will be :class:`google.cloud.talent_v4.types.BatchCreateJobsResponse` The result of [JobService.BatchCreateJobs][google.cloud.talent.v4.JobService.BatchCreateJobs]. It's used to + replace + [google.longrunning.Operation.response][google.longrunning.Operation.response] + in case of success. """ # Create or coerce a protobuf request object. @@ -349,7 +350,7 @@ async def get_job( recently EXPIRED within the last 90 days. Args: - request (:class:`~.job_service.GetJobRequest`): + request (:class:`google.cloud.talent_v4.types.GetJobRequest`): The request object. Get job request. name (:class:`str`): Required. The resource name of the job to retrieve. @@ -357,6 +358,7 @@ async def get_job( The format is "projects/{project_id}/tenants/{tenant_id}/jobs/{job_id}". For example, "projects/foo/tenants/bar/jobs/baz". + This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -368,11 +370,11 @@ async def get_job( 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.v4.Company], - which is the hiring entity responsible for the job. + google.cloud.talent_v4.types.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.v4.Company], which is + the hiring entity responsible for the job. """ # Create or coerce a protobuf request object. @@ -437,14 +439,14 @@ async def update_job( minutes. Args: - request (:class:`~.job_service.UpdateJobRequest`): + request (:class:`google.cloud.talent_v4.types.UpdateJobRequest`): The request object. Update job request. - job (:class:`~.gct_job.Job`): + job (:class:`google.cloud.talent_v4.types.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. - update_mask (:class:`~.field_mask.FieldMask`): + update_mask (:class:`google.protobuf.field_mask_pb2.FieldMask`): Strongly recommended for the best service experience. If @@ -456,6 +458,7 @@ async def update_job( A field mask to restrict the fields that are updated. Only top level fields of [Job][google.cloud.talent.v4.Job] are supported. + This corresponds to the ``update_mask`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -467,11 +470,11 @@ async def update_job( 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.v4.Company], - which is the hiring entity responsible for the job. + google.cloud.talent_v4.types.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.v4.Company], which is + the hiring entity responsible for the job. """ # Create or coerce a protobuf request object. @@ -527,7 +530,7 @@ async def batch_update_jobs( r"""Begins executing a batch update jobs operation. Args: - request (:class:`~.job_service.BatchUpdateJobsRequest`): + request (:class:`google.cloud.talent_v4.types.BatchUpdateJobsRequest`): The request object. Request to update a batch of jobs. parent (:class:`str`): Required. The resource name of the tenant under which @@ -536,13 +539,15 @@ async def batch_update_jobs( 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. - jobs (:class:`Sequence[~.job.Job]`): + jobs (:class:`Sequence[google.cloud.talent_v4.types.Job]`): Required. The jobs to be updated. A maximum of 200 jobs can be updated in a batch. + This corresponds to the ``jobs`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -554,16 +559,13 @@ async def batch_update_jobs( sent along with the request as metadata. Returns: - ~.operation_async.AsyncOperation: + google.api_core.operation_async.AsyncOperation: An object representing a long-running operation. - The result type for the operation will be - :class:``~.job_service.BatchUpdateJobsResponse``: The - result of - [JobService.BatchUpdateJobs][google.cloud.talent.v4.JobService.BatchUpdateJobs]. - It's used to replace - [google.longrunning.Operation.response][google.longrunning.Operation.response] - in case of success. + The result type for the operation will be :class:`google.cloud.talent_v4.types.BatchUpdateJobsResponse` The result of [JobService.BatchUpdateJobs][google.cloud.talent.v4.JobService.BatchUpdateJobs]. It's used to + replace + [google.longrunning.Operation.response][google.longrunning.Operation.response] + in case of success. """ # Create or coerce a protobuf request object. @@ -629,7 +631,7 @@ async def delete_job( seconds, but it may take up to 5 minutes. Args: - request (:class:`~.job_service.DeleteJobRequest`): + request (:class:`google.cloud.talent_v4.types.DeleteJobRequest`): The request object. Delete job request. name (:class:`str`): Required. The resource name of the job to be deleted. @@ -637,6 +639,7 @@ async def delete_job( The format is "projects/{project_id}/tenants/{tenant_id}/jobs/{job_id}". For example, "projects/foo/tenants/bar/jobs/baz". + This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -705,7 +708,7 @@ async def batch_delete_jobs( r"""Begins executing a batch delete jobs operation. Args: - request (:class:`~.job_service.BatchDeleteJobsRequest`): + request (:class:`google.cloud.talent_v4.types.BatchDeleteJobsRequest`): The request object. Request to delete a batch of jobs. parent (:class:`str`): Required. The resource name of the tenant under which @@ -717,6 +720,7 @@ async def batch_delete_jobs( The parent of all of the jobs specified in ``names`` must match this field. + This corresponds to the ``parent`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -728,6 +732,7 @@ async def batch_delete_jobs( For example, "projects/foo/tenants/bar/jobs/baz". A maximum of 200 jobs can be deleted in a batch. + This corresponds to the ``names`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -739,16 +744,13 @@ async def batch_delete_jobs( sent along with the request as metadata. Returns: - ~.operation_async.AsyncOperation: + google.api_core.operation_async.AsyncOperation: An object representing a long-running operation. - The result type for the operation will be - :class:``~.job_service.BatchDeleteJobsResponse``: The - result of - [JobService.BatchDeleteJobs][google.cloud.talent.v4.JobService.BatchDeleteJobs]. - It's used to replace - [google.longrunning.Operation.response][google.longrunning.Operation.response] - in case of success. + The result type for the operation will be :class:`google.cloud.talent_v4.types.BatchDeleteJobsResponse` The result of [JobService.BatchDeleteJobs][google.cloud.talent.v4.JobService.BatchDeleteJobs]. It's used to + replace + [google.longrunning.Operation.response][google.longrunning.Operation.response] + in case of success. """ # Create or coerce a protobuf request object. @@ -813,7 +815,7 @@ async def list_jobs( r"""Lists jobs by filter. Args: - request (:class:`~.job_service.ListJobsRequest`): + request (:class:`google.cloud.talent_v4.types.ListJobsRequest`): The request object. List jobs request. parent (:class:`str`): Required. The resource name of the tenant under which @@ -822,6 +824,7 @@ async def list_jobs( 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. @@ -847,7 +850,8 @@ async def list_jobs( requisitionId = "req-1" - companyName = "projects/foo/tenants/bar/companies/baz" AND status = - "EXPIRED". + "EXPIRED" + This corresponds to the ``filter`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -859,7 +863,7 @@ async def list_jobs( sent along with the request as metadata. Returns: - ~.pagers.ListJobsAsyncPager: + google.cloud.talent_v4.services.job_service.pagers.ListJobsAsyncPager: List jobs response. Iterating over this object will yield results and resolve additional pages @@ -937,7 +941,7 @@ async def search_jobs( has permission to search against. Args: - request (:class:`~.job_service.SearchJobsRequest`): + request (:class:`google.cloud.talent_v4.types.SearchJobsRequest`): The request object. The Request body of the `SearchJobs` call. @@ -948,7 +952,7 @@ async def search_jobs( sent along with the request as metadata. Returns: - ~.job_service.SearchJobsResponse: + google.cloud.talent_v4.types.SearchJobsResponse: Response for SearchJob method. """ # Create or coerce a protobuf request object. @@ -998,7 +1002,7 @@ async def search_jobs_for_alert( permission to search against. Args: - request (:class:`~.job_service.SearchJobsRequest`): + request (:class:`google.cloud.talent_v4.types.SearchJobsRequest`): The request object. The Request body of the `SearchJobs` call. @@ -1009,7 +1013,7 @@ async def search_jobs_for_alert( sent along with the request as metadata. Returns: - ~.job_service.SearchJobsResponse: + google.cloud.talent_v4.types.SearchJobsResponse: Response for SearchJob method. """ # Create or coerce a protobuf request object. diff --git a/google/cloud/talent_v4/services/job_service/client.py b/google/cloud/talent_v4/services/job_service/client.py index 0e8ec2b0..0660fe9a 100644 --- a/google/cloud/talent_v4/services/job_service/client.py +++ b/google/cloud/talent_v4/services/job_service/client.py @@ -118,6 +118,22 @@ def _get_default_mtls_endpoint(api_endpoint): DEFAULT_ENDPOINT ) + @classmethod + def from_service_account_info(cls, info: dict, *args, **kwargs): + """Creates an instance of this client using the provided credentials info. + + Args: + info (dict): The service account private key info. + args: Additional arguments to pass to the constructor. + kwargs: Additional arguments to pass to the constructor. + + Returns: + JobServiceClient: The constructed client. + """ + credentials = service_account.Credentials.from_service_account_info(info) + kwargs["credentials"] = credentials + return cls(*args, **kwargs) + @classmethod def from_service_account_file(cls, filename: str, *args, **kwargs): """Creates an instance of this client using the provided credentials @@ -130,7 +146,7 @@ def from_service_account_file(cls, filename: str, *args, **kwargs): kwargs: Additional arguments to pass to the constructor. Returns: - {@api.name}: The constructed client. + JobServiceClient: The constructed client. """ credentials = service_account.Credentials.from_service_account_file(filename) kwargs["credentials"] = credentials @@ -267,10 +283,10 @@ def __init__( 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 (Union[str, JobServiceTransport]): The transport to use. If set to None, a transport is chosen automatically. - client_options (client_options_lib.ClientOptions): Custom options for the + client_options (google.api_core.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_ENDPOINT @@ -306,21 +322,17 @@ def __init__( util.strtobool(os.getenv("GOOGLE_API_USE_CLIENT_CERTIFICATE", "false")) ) - ssl_credentials = None + client_cert_source_func = None is_mtls = False if use_client_cert: if client_options.client_cert_source: - import grpc # type: ignore - - cert, key = client_options.client_cert_source() - ssl_credentials = grpc.ssl_channel_credentials( - certificate_chain=cert, private_key=key - ) is_mtls = True + client_cert_source_func = client_options.client_cert_source else: - creds = SslCredentials() - is_mtls = creds.is_mtls - ssl_credentials = creds.ssl_credentials if is_mtls else None + is_mtls = mtls.has_default_client_cert_source() + client_cert_source_func = ( + mtls.default_client_cert_source() if is_mtls else None + ) # Figure out which api endpoint to use. if client_options.api_endpoint is not None: @@ -363,7 +375,7 @@ def __init__( credentials_file=client_options.credentials_file, host=api_endpoint, scopes=client_options.scopes, - ssl_channel_credentials=ssl_credentials, + client_cert_source_for_mtls=client_cert_source_func, quota_project_id=client_options.quota_project_id, client_info=client_info, ) @@ -383,19 +395,20 @@ def create_job( but it may take up to 5 minutes. Args: - request (:class:`~.job_service.CreateJobRequest`): + request (google.cloud.talent_v4.types.CreateJobRequest): The request object. Create job request. - parent (:class:`str`): + 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/tenants/bar". + This corresponds to the ``parent`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - job (:class:`~.gct_job.Job`): + job (google.cloud.talent_v4.types.Job): Required. The Job to be created. This corresponds to the ``job`` field on the ``request`` instance; if ``request`` is provided, this @@ -408,11 +421,11 @@ def create_job( 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.v4.Company], - which is the hiring entity responsible for the job. + google.cloud.talent_v4.types.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.v4.Company], which is + the hiring entity responsible for the job. """ # Create or coerce a protobuf request object. @@ -469,22 +482,24 @@ def batch_create_jobs( r"""Begins executing a batch create jobs operation. Args: - request (:class:`~.job_service.BatchCreateJobsRequest`): + request (google.cloud.talent_v4.types.BatchCreateJobsRequest): The request object. Request to create a batch of jobs. - parent (:class:`str`): + 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/tenants/bar". + This corresponds to the ``parent`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - jobs (:class:`Sequence[~.job.Job]`): + jobs (Sequence[google.cloud.talent_v4.types.Job]): Required. The jobs to be created. A maximum of 200 jobs can be created in a batch. + This corresponds to the ``jobs`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -496,16 +511,13 @@ def batch_create_jobs( sent along with the request as metadata. Returns: - ~.operation.Operation: + google.api_core.operation.Operation: An object representing a long-running operation. - The result type for the operation will be - :class:``~.job_service.BatchCreateJobsResponse``: The - result of - [JobService.BatchCreateJobs][google.cloud.talent.v4.JobService.BatchCreateJobs]. - It's used to replace - [google.longrunning.Operation.response][google.longrunning.Operation.response] - in case of success. + The result type for the operation will be :class:`google.cloud.talent_v4.types.BatchCreateJobsResponse` The result of [JobService.BatchCreateJobs][google.cloud.talent.v4.JobService.BatchCreateJobs]. It's used to + replace + [google.longrunning.Operation.response][google.longrunning.Operation.response] + in case of success. """ # Create or coerce a protobuf request object. @@ -571,14 +583,15 @@ def get_job( recently EXPIRED within the last 90 days. Args: - request (:class:`~.job_service.GetJobRequest`): + request (google.cloud.talent_v4.types.GetJobRequest): The request object. Get job request. - name (:class:`str`): + 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". + This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -590,11 +603,11 @@ def get_job( 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.v4.Company], - which is the hiring entity responsible for the job. + google.cloud.talent_v4.types.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.v4.Company], which is + the hiring entity responsible for the job. """ # Create or coerce a protobuf request object. @@ -652,14 +665,14 @@ def update_job( minutes. Args: - request (:class:`~.job_service.UpdateJobRequest`): + request (google.cloud.talent_v4.types.UpdateJobRequest): The request object. Update job request. - job (:class:`~.gct_job.Job`): + job (google.cloud.talent_v4.types.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. - update_mask (:class:`~.field_mask.FieldMask`): + update_mask (google.protobuf.field_mask_pb2.FieldMask): Strongly recommended for the best service experience. If @@ -671,6 +684,7 @@ def update_job( A field mask to restrict the fields that are updated. Only top level fields of [Job][google.cloud.talent.v4.Job] are supported. + This corresponds to the ``update_mask`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -682,11 +696,11 @@ def update_job( 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.v4.Company], - which is the hiring entity responsible for the job. + google.cloud.talent_v4.types.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.v4.Company], which is + the hiring entity responsible for the job. """ # Create or coerce a protobuf request object. @@ -743,22 +757,24 @@ def batch_update_jobs( r"""Begins executing a batch update jobs operation. Args: - request (:class:`~.job_service.BatchUpdateJobsRequest`): + request (google.cloud.talent_v4.types.BatchUpdateJobsRequest): The request object. Request to update a batch of jobs. - parent (:class:`str`): + 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/tenants/bar". + This corresponds to the ``parent`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - jobs (:class:`Sequence[~.job.Job]`): + jobs (Sequence[google.cloud.talent_v4.types.Job]): Required. The jobs to be updated. A maximum of 200 jobs can be updated in a batch. + This corresponds to the ``jobs`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -770,16 +786,13 @@ def batch_update_jobs( sent along with the request as metadata. Returns: - ~.operation.Operation: + google.api_core.operation.Operation: An object representing a long-running operation. - The result type for the operation will be - :class:``~.job_service.BatchUpdateJobsResponse``: The - result of - [JobService.BatchUpdateJobs][google.cloud.talent.v4.JobService.BatchUpdateJobs]. - It's used to replace - [google.longrunning.Operation.response][google.longrunning.Operation.response] - in case of success. + The result type for the operation will be :class:`google.cloud.talent_v4.types.BatchUpdateJobsResponse` The result of [JobService.BatchUpdateJobs][google.cloud.talent.v4.JobService.BatchUpdateJobs]. It's used to + replace + [google.longrunning.Operation.response][google.longrunning.Operation.response] + in case of success. """ # Create or coerce a protobuf request object. @@ -846,14 +859,15 @@ def delete_job( seconds, but it may take up to 5 minutes. Args: - request (:class:`~.job_service.DeleteJobRequest`): + request (google.cloud.talent_v4.types.DeleteJobRequest): The request object. Delete job request. - name (:class:`str`): + 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". + This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -915,9 +929,9 @@ def batch_delete_jobs( r"""Begins executing a batch delete jobs operation. Args: - request (:class:`~.job_service.BatchDeleteJobsRequest`): + request (google.cloud.talent_v4.types.BatchDeleteJobsRequest): The request object. Request to delete a batch of jobs. - parent (:class:`str`): + parent (str): Required. The resource name of the tenant under which the job is created. @@ -927,10 +941,11 @@ def batch_delete_jobs( The parent of all of the jobs specified in ``names`` must match this field. + This corresponds to the ``parent`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - names (:class:`Sequence[str]`): + names (Sequence[str]): The names of the jobs to delete. The format is @@ -938,6 +953,7 @@ def batch_delete_jobs( For example, "projects/foo/tenants/bar/jobs/baz". A maximum of 200 jobs can be deleted in a batch. + This corresponds to the ``names`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -949,16 +965,13 @@ def batch_delete_jobs( sent along with the request as metadata. Returns: - ~.operation.Operation: + google.api_core.operation.Operation: An object representing a long-running operation. - The result type for the operation will be - :class:``~.job_service.BatchDeleteJobsResponse``: The - result of - [JobService.BatchDeleteJobs][google.cloud.talent.v4.JobService.BatchDeleteJobs]. - It's used to replace - [google.longrunning.Operation.response][google.longrunning.Operation.response] - in case of success. + The result type for the operation will be :class:`google.cloud.talent_v4.types.BatchDeleteJobsResponse` The result of [JobService.BatchDeleteJobs][google.cloud.talent.v4.JobService.BatchDeleteJobs]. It's used to + replace + [google.longrunning.Operation.response][google.longrunning.Operation.response] + in case of success. """ # Create or coerce a protobuf request object. @@ -1024,19 +1037,20 @@ def list_jobs( r"""Lists jobs by filter. Args: - request (:class:`~.job_service.ListJobsRequest`): + request (google.cloud.talent_v4.types.ListJobsRequest): The request object. List jobs request. - parent (:class:`str`): + 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/tenants/bar". + This corresponds to the ``parent`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - filter (:class:`str`): + filter (str): Required. The filter string specifies the jobs to be enumerated. @@ -1058,7 +1072,8 @@ def list_jobs( requisitionId = "req-1" - companyName = "projects/foo/tenants/bar/companies/baz" AND status = - "EXPIRED". + "EXPIRED" + This corresponds to the ``filter`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -1070,7 +1085,7 @@ def list_jobs( sent along with the request as metadata. Returns: - ~.pagers.ListJobsPager: + google.cloud.talent_v4.services.job_service.pagers.ListJobsPager: List jobs response. Iterating over this object will yield results and resolve additional pages @@ -1141,7 +1156,7 @@ def search_jobs( has permission to search against. Args: - request (:class:`~.job_service.SearchJobsRequest`): + request (google.cloud.talent_v4.types.SearchJobsRequest): The request object. The Request body of the `SearchJobs` call. @@ -1152,7 +1167,7 @@ def search_jobs( sent along with the request as metadata. Returns: - ~.job_service.SearchJobsResponse: + google.cloud.talent_v4.types.SearchJobsResponse: Response for SearchJob method. """ # Create or coerce a protobuf request object. @@ -1203,7 +1218,7 @@ def search_jobs_for_alert( permission to search against. Args: - request (:class:`~.job_service.SearchJobsRequest`): + request (google.cloud.talent_v4.types.SearchJobsRequest): The request object. The Request body of the `SearchJobs` call. @@ -1214,7 +1229,7 @@ def search_jobs_for_alert( sent along with the request as metadata. Returns: - ~.job_service.SearchJobsResponse: + google.cloud.talent_v4.types.SearchJobsResponse: Response for SearchJob method. """ # Create or coerce a protobuf request object. diff --git a/google/cloud/talent_v4/services/job_service/pagers.py b/google/cloud/talent_v4/services/job_service/pagers.py index e759d8e3..15f5218f 100644 --- a/google/cloud/talent_v4/services/job_service/pagers.py +++ b/google/cloud/talent_v4/services/job_service/pagers.py @@ -25,7 +25,7 @@ class ListJobsPager: """A pager for iterating through ``list_jobs`` requests. This class thinly wraps an initial - :class:`~.job_service.ListJobsResponse` object, and + :class:`google.cloud.talent_v4.types.ListJobsResponse` object, and provides an ``__iter__`` method to iterate through its ``jobs`` field. @@ -34,7 +34,7 @@ class ListJobsPager: through the ``jobs`` field on the corresponding responses. - All the usual :class:`~.job_service.ListJobsResponse` + All the usual :class:`google.cloud.talent_v4.types.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. """ @@ -52,9 +52,9 @@ def __init__( Args: method (Callable): The method that was originally called, and which instantiated this pager. - request (:class:`~.job_service.ListJobsRequest`): + request (google.cloud.talent_v4.types.ListJobsRequest): The initial request object. - response (:class:`~.job_service.ListJobsResponse`): + response (google.cloud.talent_v4.types.ListJobsResponse): The initial response object. metadata (Sequence[Tuple[str, str]]): Strings which should be sent along with the request as metadata. @@ -87,7 +87,7 @@ class ListJobsAsyncPager: """A pager for iterating through ``list_jobs`` requests. This class thinly wraps an initial - :class:`~.job_service.ListJobsResponse` object, and + :class:`google.cloud.talent_v4.types.ListJobsResponse` object, and provides an ``__aiter__`` method to iterate through its ``jobs`` field. @@ -96,7 +96,7 @@ class ListJobsAsyncPager: through the ``jobs`` field on the corresponding responses. - All the usual :class:`~.job_service.ListJobsResponse` + All the usual :class:`google.cloud.talent_v4.types.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. """ @@ -114,9 +114,9 @@ def __init__( Args: method (Callable): The method that was originally called, and which instantiated this pager. - request (:class:`~.job_service.ListJobsRequest`): + request (google.cloud.talent_v4.types.ListJobsRequest): The initial request object. - response (:class:`~.job_service.ListJobsResponse`): + response (google.cloud.talent_v4.types.ListJobsResponse): The initial response object. metadata (Sequence[Tuple[str, str]]): Strings which should be sent along with the request as metadata. diff --git a/google/cloud/talent_v4/services/job_service/transports/grpc.py b/google/cloud/talent_v4/services/job_service/transports/grpc.py index 9f8ddd1e..03d4cf1b 100644 --- a/google/cloud/talent_v4/services/job_service/transports/grpc.py +++ b/google/cloud/talent_v4/services/job_service/transports/grpc.py @@ -63,6 +63,7 @@ def __init__( api_mtls_endpoint: str = None, client_cert_source: Callable[[], Tuple[bytes, bytes]] = None, ssl_channel_credentials: grpc.ChannelCredentials = None, + client_cert_source_for_mtls: Callable[[], Tuple[bytes, bytes]] = None, quota_project_id: Optional[str] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, ) -> None: @@ -93,6 +94,10 @@ def __init__( ``api_mtls_endpoint`` is None. ssl_channel_credentials (grpc.ChannelCredentials): SSL credentials for grpc channel. It is ignored if ``channel`` is provided. + client_cert_source_for_mtls (Optional[Callable[[], Tuple[bytes, bytes]]]): + A callback to provide client certificate bytes and private key bytes, + both in PEM format. It is used to configure mutual TLS channel. It is + ignored if ``channel`` or ``ssl_channel_credentials`` is provided. quota_project_id (Optional[str]): An optional project to use for billing and quota. client_info (google.api_core.gapic_v1.client_info.ClientInfo): @@ -109,6 +114,11 @@ def __init__( """ self._ssl_channel_credentials = ssl_channel_credentials + if api_mtls_endpoint: + warnings.warn("api_mtls_endpoint is deprecated", DeprecationWarning) + if client_cert_source: + warnings.warn("client_cert_source is deprecated", DeprecationWarning) + if channel: # Sanity check: Ensure that channel and credentials are not both # provided. @@ -118,11 +128,6 @@ def __init__( self._grpc_channel = channel self._ssl_channel_credentials = None elif api_mtls_endpoint: - warnings.warn( - "api_mtls_endpoint and client_cert_source are deprecated", - DeprecationWarning, - ) - host = ( api_mtls_endpoint if ":" in api_mtls_endpoint @@ -166,12 +171,18 @@ def __init__( scopes=self.AUTH_SCOPES, quota_project_id=quota_project_id ) + if client_cert_source_for_mtls and not ssl_channel_credentials: + cert, key = client_cert_source_for_mtls() + self._ssl_channel_credentials = grpc.ssl_channel_credentials( + certificate_chain=cert, private_key=key + ) + # 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_channel_credentials, + ssl_credentials=self._ssl_channel_credentials, scopes=scopes or self.AUTH_SCOPES, quota_project_id=quota_project_id, options=[ diff --git a/google/cloud/talent_v4/services/job_service/transports/grpc_asyncio.py b/google/cloud/talent_v4/services/job_service/transports/grpc_asyncio.py index 2a50e03c..b0c78c50 100644 --- a/google/cloud/talent_v4/services/job_service/transports/grpc_asyncio.py +++ b/google/cloud/talent_v4/services/job_service/transports/grpc_asyncio.py @@ -107,6 +107,7 @@ def __init__( api_mtls_endpoint: str = None, client_cert_source: Callable[[], Tuple[bytes, bytes]] = None, ssl_channel_credentials: grpc.ChannelCredentials = None, + client_cert_source_for_mtls: Callable[[], Tuple[bytes, bytes]] = None, quota_project_id=None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, ) -> None: @@ -138,6 +139,10 @@ def __init__( ``api_mtls_endpoint`` is None. ssl_channel_credentials (grpc.ChannelCredentials): SSL credentials for grpc channel. It is ignored if ``channel`` is provided. + client_cert_source_for_mtls (Optional[Callable[[], Tuple[bytes, bytes]]]): + A callback to provide client certificate bytes and private key bytes, + both in PEM format. It is used to configure mutual TLS channel. It is + ignored if ``channel`` or ``ssl_channel_credentials`` is provided. quota_project_id (Optional[str]): An optional project to use for billing and quota. client_info (google.api_core.gapic_v1.client_info.ClientInfo): @@ -154,6 +159,11 @@ def __init__( """ self._ssl_channel_credentials = ssl_channel_credentials + if api_mtls_endpoint: + warnings.warn("api_mtls_endpoint is deprecated", DeprecationWarning) + if client_cert_source: + warnings.warn("client_cert_source is deprecated", DeprecationWarning) + if channel: # Sanity check: Ensure that channel and credentials are not both # provided. @@ -163,11 +173,6 @@ def __init__( self._grpc_channel = channel self._ssl_channel_credentials = None elif api_mtls_endpoint: - warnings.warn( - "api_mtls_endpoint and client_cert_source are deprecated", - DeprecationWarning, - ) - host = ( api_mtls_endpoint if ":" in api_mtls_endpoint @@ -211,12 +216,18 @@ def __init__( scopes=self.AUTH_SCOPES, quota_project_id=quota_project_id ) + if client_cert_source_for_mtls and not ssl_channel_credentials: + cert, key = client_cert_source_for_mtls() + self._ssl_channel_credentials = grpc.ssl_channel_credentials( + certificate_chain=cert, private_key=key + ) + # 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_channel_credentials, + ssl_credentials=self._ssl_channel_credentials, scopes=scopes or self.AUTH_SCOPES, quota_project_id=quota_project_id, options=[ diff --git a/google/cloud/talent_v4/services/tenant_service/async_client.py b/google/cloud/talent_v4/services/tenant_service/async_client.py index 07940a99..46170195 100644 --- a/google/cloud/talent_v4/services/tenant_service/async_client.py +++ b/google/cloud/talent_v4/services/tenant_service/async_client.py @@ -81,6 +81,7 @@ class TenantServiceAsyncClient: TenantServiceClient.parse_common_location_path ) + from_service_account_info = TenantServiceClient.from_service_account_info from_service_account_file = TenantServiceClient.from_service_account_file from_service_account_json = from_service_account_file @@ -158,7 +159,7 @@ async def create_tenant( r"""Creates a new tenant entity. Args: - request (:class:`~.tenant_service.CreateTenantRequest`): + request (:class:`google.cloud.talent_v4.types.CreateTenantRequest`): The request object. The Request of the CreateTenant method. parent (:class:`str`): @@ -167,10 +168,11 @@ async def create_tenant( 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`): + tenant (:class:`google.cloud.talent_v4.types.Tenant`): Required. The tenant to be created. This corresponds to the ``tenant`` field on the ``request`` instance; if ``request`` is provided, this @@ -183,7 +185,7 @@ async def create_tenant( sent along with the request as metadata. Returns: - ~.gct_tenant.Tenant: + google.cloud.talent_v4.types.Tenant: A Tenant resource represents a tenant in the service. A tenant is a group or entity that shares common access with @@ -245,7 +247,7 @@ async def get_tenant( r"""Retrieves specified tenant. Args: - request (:class:`~.tenant_service.GetTenantRequest`): + request (:class:`google.cloud.talent_v4.types.GetTenantRequest`): The request object. Request for getting a tenant by name. name (:class:`str`): @@ -255,6 +257,7 @@ async def get_tenant( 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. @@ -266,7 +269,7 @@ async def get_tenant( sent along with the request as metadata. Returns: - ~.tenant.Tenant: + google.cloud.talent_v4.types.Tenant: A Tenant resource represents a tenant in the service. A tenant is a group or entity that shares common access with @@ -335,17 +338,18 @@ async def update_tenant( r"""Updates specified tenant. Args: - request (:class:`~.tenant_service.UpdateTenantRequest`): + request (:class:`google.cloud.talent_v4.types.UpdateTenantRequest`): The request object. Request for updating a specified tenant. - tenant (:class:`~.gct_tenant.Tenant`): + tenant (:class:`google.cloud.talent_v4.types.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. - update_mask (:class:`~.field_mask.FieldMask`): + update_mask (:class:`google.protobuf.field_mask_pb2.FieldMask`): Strongly recommended for the best service experience. If @@ -357,6 +361,7 @@ async def update_tenant( A field mask to specify the tenant fields to be updated. Only top level fields of [Tenant][google.cloud.talent.v4.Tenant] are supported. + This corresponds to the ``update_mask`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -368,7 +373,7 @@ async def update_tenant( sent along with the request as metadata. Returns: - ~.gct_tenant.Tenant: + google.cloud.talent_v4.types.Tenant: A Tenant resource represents a tenant in the service. A tenant is a group or entity that shares common access with @@ -432,7 +437,7 @@ async def delete_tenant( r"""Deletes specified tenant. Args: - request (:class:`~.tenant_service.DeleteTenantRequest`): + request (:class:`google.cloud.talent_v4.types.DeleteTenantRequest`): The request object. Request to delete a tenant. name (:class:`str`): Required. The resource name of the tenant to be deleted. @@ -440,6 +445,7 @@ async def delete_tenant( 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. @@ -507,7 +513,7 @@ async def list_tenants( r"""Lists all tenants associated with the project. Args: - request (:class:`~.tenant_service.ListTenantsRequest`): + request (:class:`google.cloud.talent_v4.types.ListTenantsRequest`): The request object. List tenants for which the client has ACL visibility. parent (:class:`str`): @@ -516,6 +522,7 @@ async def list_tenants( 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. @@ -527,7 +534,7 @@ async def list_tenants( sent along with the request as metadata. Returns: - ~.pagers.ListTenantsAsyncPager: + google.cloud.talent_v4.services.tenant_service.pagers.ListTenantsAsyncPager: The List tenants response object. Iterating over this object will yield results and resolve additional pages diff --git a/google/cloud/talent_v4/services/tenant_service/client.py b/google/cloud/talent_v4/services/tenant_service/client.py index 7492a9c3..ef6d560c 100644 --- a/google/cloud/talent_v4/services/tenant_service/client.py +++ b/google/cloud/talent_v4/services/tenant_service/client.py @@ -113,6 +113,22 @@ def _get_default_mtls_endpoint(api_endpoint): DEFAULT_ENDPOINT ) + @classmethod + def from_service_account_info(cls, info: dict, *args, **kwargs): + """Creates an instance of this client using the provided credentials info. + + Args: + info (dict): The service account private key info. + args: Additional arguments to pass to the constructor. + kwargs: Additional arguments to pass to the constructor. + + Returns: + TenantServiceClient: The constructed client. + """ + credentials = service_account.Credentials.from_service_account_info(info) + kwargs["credentials"] = credentials + return cls(*args, **kwargs) + @classmethod def from_service_account_file(cls, filename: str, *args, **kwargs): """Creates an instance of this client using the provided credentials @@ -125,7 +141,7 @@ def from_service_account_file(cls, filename: str, *args, **kwargs): kwargs: Additional arguments to pass to the constructor. Returns: - {@api.name}: The constructed client. + TenantServiceClient: The constructed client. """ credentials = service_account.Credentials.from_service_account_file(filename) kwargs["credentials"] = credentials @@ -230,10 +246,10 @@ def __init__( 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 (Union[str, TenantServiceTransport]): The transport to use. If set to None, a transport is chosen automatically. - client_options (client_options_lib.ClientOptions): Custom options for the + client_options (google.api_core.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_ENDPOINT @@ -269,21 +285,17 @@ def __init__( util.strtobool(os.getenv("GOOGLE_API_USE_CLIENT_CERTIFICATE", "false")) ) - ssl_credentials = None + client_cert_source_func = None is_mtls = False if use_client_cert: if client_options.client_cert_source: - import grpc # type: ignore - - cert, key = client_options.client_cert_source() - ssl_credentials = grpc.ssl_channel_credentials( - certificate_chain=cert, private_key=key - ) is_mtls = True + client_cert_source_func = client_options.client_cert_source else: - creds = SslCredentials() - is_mtls = creds.is_mtls - ssl_credentials = creds.ssl_credentials if is_mtls else None + is_mtls = mtls.has_default_client_cert_source() + client_cert_source_func = ( + mtls.default_client_cert_source() if is_mtls else None + ) # Figure out which api endpoint to use. if client_options.api_endpoint is not None: @@ -326,7 +338,7 @@ def __init__( credentials_file=client_options.credentials_file, host=api_endpoint, scopes=client_options.scopes, - ssl_channel_credentials=ssl_credentials, + client_cert_source_for_mtls=client_cert_source_func, quota_project_id=client_options.quota_project_id, client_info=client_info, ) @@ -344,19 +356,20 @@ def create_tenant( r"""Creates a new tenant entity. Args: - request (:class:`~.tenant_service.CreateTenantRequest`): + request (google.cloud.talent_v4.types.CreateTenantRequest): The request object. The Request of the CreateTenant method. - parent (:class:`str`): + parent (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`): + tenant (google.cloud.talent_v4.types.Tenant): Required. The tenant to be created. This corresponds to the ``tenant`` field on the ``request`` instance; if ``request`` is provided, this @@ -369,7 +382,7 @@ def create_tenant( sent along with the request as metadata. Returns: - ~.gct_tenant.Tenant: + google.cloud.talent_v4.types.Tenant: A Tenant resource represents a tenant in the service. A tenant is a group or entity that shares common access with @@ -432,16 +445,17 @@ def get_tenant( r"""Retrieves specified tenant. Args: - request (:class:`~.tenant_service.GetTenantRequest`): + request (google.cloud.talent_v4.types.GetTenantRequest): The request object. Request for getting a tenant by name. - name (:class:`str`): + 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". + This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -453,7 +467,7 @@ def get_tenant( sent along with the request as metadata. Returns: - ~.tenant.Tenant: + google.cloud.talent_v4.types.Tenant: A Tenant resource represents a tenant in the service. A tenant is a group or entity that shares common access with @@ -515,17 +529,18 @@ def update_tenant( r"""Updates specified tenant. Args: - request (:class:`~.tenant_service.UpdateTenantRequest`): + request (google.cloud.talent_v4.types.UpdateTenantRequest): The request object. Request for updating a specified tenant. - tenant (:class:`~.gct_tenant.Tenant`): + tenant (google.cloud.talent_v4.types.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. - update_mask (:class:`~.field_mask.FieldMask`): + update_mask (google.protobuf.field_mask_pb2.FieldMask): Strongly recommended for the best service experience. If @@ -537,6 +552,7 @@ def update_tenant( A field mask to specify the tenant fields to be updated. Only top level fields of [Tenant][google.cloud.talent.v4.Tenant] are supported. + This corresponds to the ``update_mask`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -548,7 +564,7 @@ def update_tenant( sent along with the request as metadata. Returns: - ~.gct_tenant.Tenant: + google.cloud.talent_v4.types.Tenant: A Tenant resource represents a tenant in the service. A tenant is a group or entity that shares common access with @@ -613,14 +629,15 @@ def delete_tenant( r"""Deletes specified tenant. Args: - request (:class:`~.tenant_service.DeleteTenantRequest`): + request (google.cloud.talent_v4.types.DeleteTenantRequest): The request object. Request to delete a tenant. - name (:class:`str`): + 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". + This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -681,15 +698,16 @@ def list_tenants( r"""Lists all tenants associated with the project. Args: - request (:class:`~.tenant_service.ListTenantsRequest`): + request (google.cloud.talent_v4.types.ListTenantsRequest): The request object. List tenants for which the client has ACL visibility. - parent (:class:`str`): + parent (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. @@ -701,7 +719,7 @@ def list_tenants( sent along with the request as metadata. Returns: - ~.pagers.ListTenantsPager: + google.cloud.talent_v4.services.tenant_service.pagers.ListTenantsPager: The List tenants response object. Iterating over this object will yield results and resolve additional pages diff --git a/google/cloud/talent_v4/services/tenant_service/pagers.py b/google/cloud/talent_v4/services/tenant_service/pagers.py index d671fdb7..e5df990c 100644 --- a/google/cloud/talent_v4/services/tenant_service/pagers.py +++ b/google/cloud/talent_v4/services/tenant_service/pagers.py @@ -25,7 +25,7 @@ class ListTenantsPager: """A pager for iterating through ``list_tenants`` requests. This class thinly wraps an initial - :class:`~.tenant_service.ListTenantsResponse` object, and + :class:`google.cloud.talent_v4.types.ListTenantsResponse` object, and provides an ``__iter__`` method to iterate through its ``tenants`` field. @@ -34,7 +34,7 @@ class ListTenantsPager: through the ``tenants`` field on the corresponding responses. - All the usual :class:`~.tenant_service.ListTenantsResponse` + All the usual :class:`google.cloud.talent_v4.types.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. """ @@ -52,9 +52,9 @@ def __init__( Args: method (Callable): The method that was originally called, and which instantiated this pager. - request (:class:`~.tenant_service.ListTenantsRequest`): + request (google.cloud.talent_v4.types.ListTenantsRequest): The initial request object. - response (:class:`~.tenant_service.ListTenantsResponse`): + response (google.cloud.talent_v4.types.ListTenantsResponse): The initial response object. metadata (Sequence[Tuple[str, str]]): Strings which should be sent along with the request as metadata. @@ -87,7 +87,7 @@ class ListTenantsAsyncPager: """A pager for iterating through ``list_tenants`` requests. This class thinly wraps an initial - :class:`~.tenant_service.ListTenantsResponse` object, and + :class:`google.cloud.talent_v4.types.ListTenantsResponse` object, and provides an ``__aiter__`` method to iterate through its ``tenants`` field. @@ -96,7 +96,7 @@ class ListTenantsAsyncPager: through the ``tenants`` field on the corresponding responses. - All the usual :class:`~.tenant_service.ListTenantsResponse` + All the usual :class:`google.cloud.talent_v4.types.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. """ @@ -114,9 +114,9 @@ def __init__( Args: method (Callable): The method that was originally called, and which instantiated this pager. - request (:class:`~.tenant_service.ListTenantsRequest`): + request (google.cloud.talent_v4.types.ListTenantsRequest): The initial request object. - response (:class:`~.tenant_service.ListTenantsResponse`): + response (google.cloud.talent_v4.types.ListTenantsResponse): The initial response object. metadata (Sequence[Tuple[str, str]]): Strings which should be sent along with the request as metadata. diff --git a/google/cloud/talent_v4/services/tenant_service/transports/grpc.py b/google/cloud/talent_v4/services/tenant_service/transports/grpc.py index f6ff6185..5810ba35 100644 --- a/google/cloud/talent_v4/services/tenant_service/transports/grpc.py +++ b/google/cloud/talent_v4/services/tenant_service/transports/grpc.py @@ -61,6 +61,7 @@ def __init__( api_mtls_endpoint: str = None, client_cert_source: Callable[[], Tuple[bytes, bytes]] = None, ssl_channel_credentials: grpc.ChannelCredentials = None, + client_cert_source_for_mtls: Callable[[], Tuple[bytes, bytes]] = None, quota_project_id: Optional[str] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, ) -> None: @@ -91,6 +92,10 @@ def __init__( ``api_mtls_endpoint`` is None. ssl_channel_credentials (grpc.ChannelCredentials): SSL credentials for grpc channel. It is ignored if ``channel`` is provided. + client_cert_source_for_mtls (Optional[Callable[[], Tuple[bytes, bytes]]]): + A callback to provide client certificate bytes and private key bytes, + both in PEM format. It is used to configure mutual TLS channel. It is + ignored if ``channel`` or ``ssl_channel_credentials`` is provided. quota_project_id (Optional[str]): An optional project to use for billing and quota. client_info (google.api_core.gapic_v1.client_info.ClientInfo): @@ -107,6 +112,11 @@ def __init__( """ self._ssl_channel_credentials = ssl_channel_credentials + if api_mtls_endpoint: + warnings.warn("api_mtls_endpoint is deprecated", DeprecationWarning) + if client_cert_source: + warnings.warn("client_cert_source is deprecated", DeprecationWarning) + if channel: # Sanity check: Ensure that channel and credentials are not both # provided. @@ -116,11 +126,6 @@ def __init__( self._grpc_channel = channel self._ssl_channel_credentials = None elif api_mtls_endpoint: - warnings.warn( - "api_mtls_endpoint and client_cert_source are deprecated", - DeprecationWarning, - ) - host = ( api_mtls_endpoint if ":" in api_mtls_endpoint @@ -164,12 +169,18 @@ def __init__( scopes=self.AUTH_SCOPES, quota_project_id=quota_project_id ) + if client_cert_source_for_mtls and not ssl_channel_credentials: + cert, key = client_cert_source_for_mtls() + self._ssl_channel_credentials = grpc.ssl_channel_credentials( + certificate_chain=cert, private_key=key + ) + # 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_channel_credentials, + ssl_credentials=self._ssl_channel_credentials, scopes=scopes or self.AUTH_SCOPES, quota_project_id=quota_project_id, options=[ diff --git a/google/cloud/talent_v4/services/tenant_service/transports/grpc_asyncio.py b/google/cloud/talent_v4/services/tenant_service/transports/grpc_asyncio.py index dac79077..25168282 100644 --- a/google/cloud/talent_v4/services/tenant_service/transports/grpc_asyncio.py +++ b/google/cloud/talent_v4/services/tenant_service/transports/grpc_asyncio.py @@ -105,6 +105,7 @@ def __init__( api_mtls_endpoint: str = None, client_cert_source: Callable[[], Tuple[bytes, bytes]] = None, ssl_channel_credentials: grpc.ChannelCredentials = None, + client_cert_source_for_mtls: Callable[[], Tuple[bytes, bytes]] = None, quota_project_id=None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, ) -> None: @@ -136,6 +137,10 @@ def __init__( ``api_mtls_endpoint`` is None. ssl_channel_credentials (grpc.ChannelCredentials): SSL credentials for grpc channel. It is ignored if ``channel`` is provided. + client_cert_source_for_mtls (Optional[Callable[[], Tuple[bytes, bytes]]]): + A callback to provide client certificate bytes and private key bytes, + both in PEM format. It is used to configure mutual TLS channel. It is + ignored if ``channel`` or ``ssl_channel_credentials`` is provided. quota_project_id (Optional[str]): An optional project to use for billing and quota. client_info (google.api_core.gapic_v1.client_info.ClientInfo): @@ -152,6 +157,11 @@ def __init__( """ self._ssl_channel_credentials = ssl_channel_credentials + if api_mtls_endpoint: + warnings.warn("api_mtls_endpoint is deprecated", DeprecationWarning) + if client_cert_source: + warnings.warn("client_cert_source is deprecated", DeprecationWarning) + if channel: # Sanity check: Ensure that channel and credentials are not both # provided. @@ -161,11 +171,6 @@ def __init__( self._grpc_channel = channel self._ssl_channel_credentials = None elif api_mtls_endpoint: - warnings.warn( - "api_mtls_endpoint and client_cert_source are deprecated", - DeprecationWarning, - ) - host = ( api_mtls_endpoint if ":" in api_mtls_endpoint @@ -209,12 +214,18 @@ def __init__( scopes=self.AUTH_SCOPES, quota_project_id=quota_project_id ) + if client_cert_source_for_mtls and not ssl_channel_credentials: + cert, key = client_cert_source_for_mtls() + self._ssl_channel_credentials = grpc.ssl_channel_credentials( + certificate_chain=cert, private_key=key + ) + # 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_channel_credentials, + ssl_credentials=self._ssl_channel_credentials, scopes=scopes or self.AUTH_SCOPES, quota_project_id=quota_project_id, options=[ diff --git a/google/cloud/talent_v4/types/common.py b/google/cloud/talent_v4/types/common.py index 13b73611..90e92333 100644 --- a/google/cloud/talent_v4/types/common.py +++ b/google/cloud/talent_v4/types/common.py @@ -206,9 +206,9 @@ class TimestampRange(proto.Message): r"""Message representing a period of time between two timestamps. Attributes: - start_time (~.timestamp.Timestamp): + start_time (google.protobuf.timestamp_pb2.Timestamp): Begin of the period (inclusive). - end_time (~.timestamp.Timestamp): + end_time (google.protobuf.timestamp_pb2.Timestamp): End of the period (exclusive). """ @@ -222,7 +222,7 @@ class Location(proto.Message): information. Attributes: - location_type (~.common.Location.LocationType): + location_type (google.cloud.talent_v4.types.Location.LocationType): The type of a location, which corresponds to the address lines field of [google.type.PostalAddress][google.type.PostalAddress]. For @@ -230,13 +230,13 @@ class Location(proto.Message): [LocationType.NEIGHBORHOOD][google.cloud.talent.v4.Location.LocationType.NEIGHBORHOOD], and "Kansas City, KS, USA" has a type of [LocationType.LOCALITY][google.cloud.talent.v4.Location.LocationType.LOCALITY]. - postal_address (~.gt_postal_address.PostalAddress): + postal_address (google.type.postal_address_pb2.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): + lat_lng (google.type.latlng_pb2.LatLng): An object representing a latitude/longitude pair. radius_miles (float): @@ -342,7 +342,7 @@ class RequestMetadata(proto.Message): and [user_id][google.cloud.talent.v4.RequestMetadata.user_id] for the best service experience. - device_info (~.common.DeviceInfo): + device_info (google.cloud.talent_v4.types.DeviceInfo): The type of device used by the job seeker at the time of the call to the service. """ @@ -378,7 +378,7 @@ class DeviceInfo(proto.Message): devices. Attributes: - device_type (~.common.DeviceInfo.DeviceType): + device_type (google.cloud.talent_v4.types.DeviceInfo.DeviceType): Type of the device. id (str): A device-specific ID. The ID must be a unique @@ -495,14 +495,14 @@ class CompensationInfo(proto.Message): r"""Job compensation details. Attributes: - entries (Sequence[~.common.CompensationInfo.CompensationEntry]): + entries (Sequence[google.cloud.talent_v4.types.CompensationInfo.CompensationEntry]): Job compensation information. At most one entry can be of type [CompensationInfo.CompensationType.BASE][google.cloud.talent.v4.CompensationInfo.CompensationType.BASE], which is referred as **base compensation entry** for the job. - annualized_base_compensation_range (~.common.CompensationInfo.CompensationRange): + annualized_base_compensation_range (google.cloud.talent_v4.types.CompensationInfo.CompensationRange): Output only. Annualized base compensation range. Computed as base compensation entry's [CompensationEntry.amount][google.cloud.talent.v4.CompensationInfo.CompensationEntry.amount] @@ -512,7 +512,7 @@ class CompensationInfo(proto.Message): See [CompensationEntry][google.cloud.talent.v4.CompensationInfo.CompensationEntry] for explanation on compensation annualization. - annualized_total_compensation_range (~.common.CompensationInfo.CompensationRange): + annualized_total_compensation_range (google.cloud.talent_v4.types.CompensationInfo.CompensationRange): Output only. Annualized total compensation range. Computed as all compensation entries' [CompensationEntry.amount][google.cloud.talent.v4.CompensationInfo.CompensationEntry.amount] @@ -594,25 +594,25 @@ class CompensationEntry(proto.Message): [expected_units_per_year][google.cloud.talent.v4.CompensationInfo.CompensationEntry.expected_units_per_year]. Attributes: - type_ (~.common.CompensationInfo.CompensationType): + type_ (google.cloud.talent_v4.types.CompensationInfo.CompensationType): Compensation type. Default is [CompensationType.COMPENSATION_TYPE_UNSPECIFIED][google.cloud.talent.v4.CompensationInfo.CompensationType.COMPENSATION_TYPE_UNSPECIFIED]. - unit (~.common.CompensationInfo.CompensationUnit): + unit (google.cloud.talent_v4.types.CompensationInfo.CompensationUnit): Frequency of the specified amount. Default is [CompensationUnit.COMPENSATION_UNIT_UNSPECIFIED][google.cloud.talent.v4.CompensationInfo.CompensationUnit.COMPENSATION_UNIT_UNSPECIFIED]. - amount (~.money.Money): + amount (google.type.money_pb2.Money): Compensation amount. - range_ (~.common.CompensationInfo.CompensationRange): + range_ (google.cloud.talent_v4.types.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_units_per_year (google.protobuf.wrappers_pb2.DoubleValue): Expected number of units paid each year. If not specified, when [Job.employment_types][google.cloud.talent.v4.Job.employment_types] @@ -656,12 +656,12 @@ class CompensationRange(proto.Message): r"""Compensation range. Attributes: - max_compensation (~.money.Money): + max_compensation (google.type.money_pb2.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): + min_compensation (google.type.money_pb2.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 @@ -689,7 +689,7 @@ class BatchOperationMetadata(proto.Message): [google.longrunning.Operation.metadata][google.longrunning.Operation.metadata]. Attributes: - state (~.common.BatchOperationMetadata.State): + state (google.cloud.talent_v4.types.BatchOperationMetadata.State): The state of a long running operation. state_description (str): More detailed information about operation @@ -701,14 +701,14 @@ class BatchOperationMetadata(proto.Message): Count of failed item(s) inside an operation. total_count (int): Count of total item(s) inside an operation. - create_time (~.timestamp.Timestamp): + create_time (google.protobuf.timestamp_pb2.Timestamp): The time when the batch operation is created. - update_time (~.timestamp.Timestamp): + update_time (google.protobuf.timestamp_pb2.Timestamp): The time when the batch operation status is updated. The metadata and the [update_time][google.cloud.talent.v4.BatchOperationMetadata.update_time] is refreshed every minute otherwise cached data is returned. - end_time (~.timestamp.Timestamp): + end_time (google.protobuf.timestamp_pb2.Timestamp): The time when the batch operation is finished and [google.longrunning.Operation.done][google.longrunning.Operation.done] is set to ``true``. diff --git a/google/cloud/talent_v4/types/company.py b/google/cloud/talent_v4/types/company.py index 9955928e..84df7fe7 100644 --- a/google/cloud/talent_v4/types/company.py +++ b/google/cloud/talent_v4/types/company.py @@ -48,7 +48,7 @@ class Company(proto.Message): used to uniquely identify the company. The maximum number of allowed characters is 255. - size (~.common.CompanySize): + size (google.cloud.talent_v4.types.CompanySize): The employer's company size. headquarters_address (str): The street address of the company's main headquarters, which @@ -87,7 +87,7 @@ class Company(proto.Message): 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): + derived_info (google.cloud.talent_v4.types.Company.DerivedInfo): Output only. Derived details about the company. suspended (bool): @@ -101,7 +101,7 @@ class DerivedInfo(proto.Message): r"""Derived details about the company. Attributes: - headquarters_location (~.common.Location): + headquarters_location (google.cloud.talent_v4.types.Location): A structured headquarters location of the company, resolved from [Company.headquarters_address][google.cloud.talent.v4.Company.headquarters_address] diff --git a/google/cloud/talent_v4/types/company_service.py b/google/cloud/talent_v4/types/company_service.py index 0e166ef9..c6862175 100644 --- a/google/cloud/talent_v4/types/company_service.py +++ b/google/cloud/talent_v4/types/company_service.py @@ -46,7 +46,7 @@ class CreateCompanyRequest(proto.Message): The format is "projects/{project_id}/tenants/{tenant_id}", for example, "projects/foo/tenants/bar". - company (~.gct_company.Company): + company (google.cloud.talent_v4.types.Company): Required. The company to be created. """ @@ -75,10 +75,10 @@ class UpdateCompanyRequest(proto.Message): r"""Request for updating a specified company. Attributes: - company (~.gct_company.Company): + company (google.cloud.talent_v4.types.Company): Required. The company resource to replace the current resource in the system. - update_mask (~.field_mask.FieldMask): + update_mask (google.protobuf.field_mask_pb2.FieldMask): Strongly recommended for the best service experience. If @@ -153,11 +153,11 @@ class ListCompaniesResponse(proto.Message): r"""The List companies response object. Attributes: - companies (Sequence[~.gct_company.Company]): + companies (Sequence[google.cloud.talent_v4.types.Company]): Companies for the current client. next_page_token (str): A token to retrieve the next page of results. - metadata (~.common.ResponseMetadata): + metadata (google.cloud.talent_v4.types.ResponseMetadata): Additional information for the API invocation, such as the request tracking id. """ diff --git a/google/cloud/talent_v4/types/completion_service.py b/google/cloud/talent_v4/types/completion_service.py index ba2529b2..fe233356 100644 --- a/google/cloud/talent_v4/types/completion_service.py +++ b/google/cloud/talent_v4/types/completion_service.py @@ -57,10 +57,10 @@ class CompleteQueryRequest(proto.Message): The format is "projects/{project_id}/tenants/{tenant_id}/companies/{company_id}", for example, "projects/foo/tenants/bar/companies/baz". - scope (~.completion_service.CompleteQueryRequest.CompletionScope): + scope (google.cloud.talent_v4.types.CompleteQueryRequest.CompletionScope): The scope of the completion. The defaults is [CompletionScope.PUBLIC][google.cloud.talent.v4.CompleteQueryRequest.CompletionScope.PUBLIC]. - type_ (~.completion_service.CompleteQueryRequest.CompletionType): + type_ (google.cloud.talent_v4.types.CompleteQueryRequest.CompletionType): The completion topic. The default is [CompletionType.COMBINED][google.cloud.talent.v4.CompleteQueryRequest.CompletionType.COMBINED]. """ @@ -97,10 +97,10 @@ class CompleteQueryResponse(proto.Message): r"""Response of auto-complete query. Attributes: - completion_results (Sequence[~.completion_service.CompleteQueryResponse.CompletionResult]): + completion_results (Sequence[google.cloud.talent_v4.types.CompleteQueryResponse.CompletionResult]): Results of the matching job/company candidates. - metadata (~.common.ResponseMetadata): + metadata (google.cloud.talent_v4.types.ResponseMetadata): Additional information for the API invocation, such as the request tracking id. """ @@ -111,7 +111,7 @@ class CompletionResult(proto.Message): Attributes: suggestion (str): The suggestion for the query. - type_ (~.completion_service.CompleteQueryRequest.CompletionType): + type_ (google.cloud.talent_v4.types.CompleteQueryRequest.CompletionType): The completion topic. image_uri (str): The URI of the company image for diff --git a/google/cloud/talent_v4/types/event.py b/google/cloud/talent_v4/types/event.py index 8ecb3a87..40ffe6f2 100644 --- a/google/cloud/talent_v4/types/event.py +++ b/google/cloud/talent_v4/types/event.py @@ -44,9 +44,9 @@ class ClientEvent(proto.Message): event_id (str): Required. A unique identifier, generated by the client application. - create_time (~.timestamp.Timestamp): + create_time (google.protobuf.timestamp_pb2.Timestamp): Required. The timestamp of the event. - job_event (~.event.JobEvent): + job_event (google.cloud.talent_v4.types.JobEvent): An event issued when a job seeker interacts with the application that implements Cloud Talent Solution. @@ -72,7 +72,7 @@ class JobEvent(proto.Message): application that implements Cloud Talent Solution. Attributes: - type_ (~.event.JobEvent.JobEventType): + type_ (google.cloud.talent_v4.types.JobEvent.JobEventType): Required. The type of the event (see [JobEventType][google.cloud.talent.v4.JobEvent.JobEventType]). jobs (Sequence[str]): diff --git a/google/cloud/talent_v4/types/event_service.py b/google/cloud/talent_v4/types/event_service.py index 264d2f2d..8a328f9a 100644 --- a/google/cloud/talent_v4/types/event_service.py +++ b/google/cloud/talent_v4/types/event_service.py @@ -36,7 +36,7 @@ class CreateClientEventRequest(proto.Message): The format is "projects/{project_id}/tenants/{tenant_id}", for example, "projects/foo/tenants/bar". - client_event (~.event.ClientEvent): + client_event (google.cloud.talent_v4.types.ClientEvent): Required. Events issued when end user interacts with customer's application that uses Cloud Talent Solution. diff --git a/google/cloud/talent_v4/types/filters.py b/google/cloud/talent_v4/types/filters.py index 62a8aa57..482632fa 100644 --- a/google/cloud/talent_v4/types/filters.py +++ b/google/cloud/talent_v4/types/filters.py @@ -65,7 +65,7 @@ class JobQuery(proto.Message): For example, "projects/foo/tenants/bar/companies/baz". At most 20 company filters are allowed. - location_filters (Sequence[~.filters.LocationFilter]): + location_filters (Sequence[google.cloud.talent_v4.types.LocationFilter]): The location filter specifies geo-regions containing the jobs to search against. See [LocationFilter][google.cloud.talent.v4.LocationFilter] for @@ -83,7 +83,7 @@ class JobQuery(proto.Message): locations. At most 5 location filters are allowed. - job_categories (Sequence[~.common.JobCategory]): + job_categories (Sequence[google.cloud.talent_v4.types.JobCategory]): The category filter specifies the categories of jobs to search against. See [JobCategory][google.cloud.talent.v4.JobCategory] for more @@ -94,7 +94,7 @@ class JobQuery(proto.Message): If multiple values are specified, jobs from any of the specified categories are searched against. - commute_filter (~.filters.CommuteFilter): + commute_filter (google.cloud.talent_v4.types.CommuteFilter): Allows filtering jobs by commute time with different travel methods (for example, driving or public transit). @@ -118,7 +118,7 @@ class JobQuery(proto.Message): companies. At most 20 company display name filters are allowed. - compensation_filter (~.filters.CompensationFilter): + compensation_filter (google.cloud.talent_v4.types.CompensationFilter): This search filter is applied only to [Job.compensation_info][google.cloud.talent.v4.Job.compensation_info]. For example, if the filter is specified as "Hourly job with @@ -157,7 +157,7 @@ class JobQuery(proto.Message): misspelled query, for example, "enginee" is corrected to "engineer". Defaults to false: a spell check is performed. - employment_types (Sequence[~.common.EmploymentType]): + employment_types (Sequence[google.cloud.talent_v4.types.EmploymentType]): The employment type filter specifies the employment type of jobs to search against, such as [EmploymentType.FULL_TIME][google.cloud.talent.v4.EmploymentType.FULL_TIME]. @@ -180,7 +180,7 @@ class JobQuery(proto.Message): Languages `__. At most 10 language code filters are allowed. - publish_time_range (~.common.TimestampRange): + publish_time_range (google.cloud.talent_v4.types.TimestampRange): Jobs published within a range specified by this filter are searched against. excluded_jobs (Sequence[str]): @@ -246,7 +246,7 @@ class LocationFilter(proto.Message): See https://www.unicode.org/cldr/charts/30/supplemental/territory_information.html for details. Example: "CH" for Switzerland. - lat_lng (~.latlng.LatLng): + lat_lng (google.type.latlng_pb2.LatLng): The latitude and longitude of the geographic center to search from. This field is ignored if ``address`` is provided. @@ -255,7 +255,7 @@ class LocationFilter(proto.Message): 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): + telecommute_preference (google.cloud.talent_v4.types.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. @@ -304,12 +304,12 @@ class CompensationFilter(proto.Message): r"""Filter on job compensation type and amount. Attributes: - type_ (~.filters.CompensationFilter.FilterType): + type_ (google.cloud.talent_v4.types.CompensationFilter.FilterType): Required. Type of filter. - units (Sequence[~.common.CompensationInfo.CompensationUnit]): + units (Sequence[google.cloud.talent_v4.types.CompensationInfo.CompensationUnit]): Required. Specify desired ``base compensation entry's`` [CompensationInfo.CompensationUnit][google.cloud.talent.v4.CompensationInfo.CompensationUnit]. - range_ (~.common.CompensationInfo.CompensationRange): + range_ (google.cloud.talent_v4.types.CompensationInfo.CompensationRange): Compensation range. include_jobs_with_unspecified_compensation_range (bool): If set to true, jobs with unspecified @@ -341,13 +341,13 @@ class CommuteFilter(proto.Message): r"""Parameters needed for commute search. Attributes: - commute_method (~.common.CommuteMethod): + commute_method (google.cloud.talent_v4.types.CommuteMethod): Required. The method of transportation to calculate the commute time for. - start_coordinates (~.latlng.LatLng): + start_coordinates (google.type.latlng_pb2.LatLng): Required. The latitude and longitude of the location to calculate the commute time from. - travel_duration (~.duration.Duration): + travel_duration (google.protobuf.duration_pb2.Duration): Required. The maximum travel time in seconds. The maximum allowed value is ``3600s`` (one hour). Format is ``123s``. allow_imprecise_addresses (bool): @@ -357,10 +357,10 @@ class CommuteFilter(proto.Message): 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): + road_traffic (google.cloud.talent_v4.types.CommuteFilter.RoadTraffic): Specifies the traffic density to use when calculating commute time. - departure_time (~.timeofday.TimeOfDay): + departure_time (google.type.timeofday_pb2.TimeOfDay): The departure time used to calculate traffic impact, represented as [google.type.TimeOfDay][google.type.TimeOfDay] in local time diff --git a/google/cloud/talent_v4/types/histogram.py b/google/cloud/talent_v4/types/histogram.py index ac6443df..ec9484c9 100644 --- a/google/cloud/talent_v4/types/histogram.py +++ b/google/cloud/talent_v4/types/histogram.py @@ -48,7 +48,7 @@ class HistogramQueryResult(proto.Message): Attributes: histogram_query (str): Requested histogram expression. - histogram (Sequence[~.gct_histogram.HistogramQueryResult.HistogramEntry]): + histogram (Sequence[google.cloud.talent_v4.types.HistogramQueryResult.HistogramEntry]): A map from the values of the facet associated with distinct values to the number of matching entries with corresponding value. diff --git a/google/cloud/talent_v4/types/job.py b/google/cloud/talent_v4/types/job.py index f1320f94..2bd27c59 100644 --- a/google/cloud/talent_v4/types/job.py +++ b/google/cloud/talent_v4/types/job.py @@ -111,15 +111,15 @@ class Job(proto.Message): experience. The maximum number of allowed characters is 500. - application_info (~.job.Job.ApplicationInfo): + application_info (google.cloud.talent_v4.types.Job.ApplicationInfo): Job application information. - job_benefits (Sequence[~.common.JobBenefit]): + job_benefits (Sequence[google.cloud.talent_v4.types.JobBenefit]): The benefits included with the job. - compensation_info (~.common.CompensationInfo): + compensation_info (google.cloud.talent_v4.types.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]): + custom_attributes (Sequence[google.cloud.talent_v4.types.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. @@ -134,7 +134,7 @@ class Job(proto.Message): than 255 characters. For unfilterable ``string_values``, the maximum total size of ``string_values`` across all keys is 50KB. - degree_types (Sequence[~.common.DegreeType]): + degree_types (Sequence[google.cloud.talent_v4.types.DegreeType]): The desired education degrees for the job, such as Bachelors, Masters. department (str): @@ -142,7 +142,7 @@ class Job(proto.Message): company with the open position. The maximum number of allowed characters is 255. - employment_types (Sequence[~.common.EmploymentType]): + employment_types (Sequence[google.cloud.talent_v4.types.EmploymentType]): The employment type(s) of a job, for example, [full time][google.cloud.talent.v4.EmploymentType.FULL_TIME] or [part @@ -167,7 +167,7 @@ class Job(proto.Message): present, detected language code based on [Job.description][google.cloud.talent.v4.Job.description] is assigned, otherwise defaults to 'en_US'. - job_level (~.common.JobLevel): + job_level (google.cloud.talent_v4.types.JobLevel): The experience level associated with the job, such as "Entry Level". promotion_value (int): @@ -200,7 +200,7 @@ class Job(proto.Message): markup tags. The maximum number of allowed characters is 10,000. - posting_region (~.common.PostingRegion): + posting_region (google.cloud.talent_v4.types.PostingRegion): The job [PostingRegion][google.cloud.talent.v4.PostingRegion] (for example, state, country) throughout which the job is @@ -215,7 +215,7 @@ class Job(proto.Message): setting job [Job.addresses][google.cloud.talent.v4.Job.addresses] to the same location level as this field is strongly recommended. - visibility (~.common.Visibility): + visibility (google.cloud.talent_v4.types.Visibility): Deprecated. The job is only visible to the owner. The visibility of the job. @@ -223,21 +223,21 @@ class Job(proto.Message): Defaults to [Visibility.ACCOUNT_ONLY][google.cloud.talent.v4.Visibility.ACCOUNT_ONLY] if not specified. - job_start_time (~.timestamp.Timestamp): + job_start_time (google.protobuf.timestamp_pb2.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): + job_end_time (google.protobuf.timestamp_pb2.Timestamp): The end timestamp of the job. Typically this field is used for contracting engagements. Invalid timestamps are ignored. - posting_publish_time (~.timestamp.Timestamp): + posting_publish_time (google.protobuf.timestamp_pb2.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): + posting_expire_time (google.protobuf.timestamp_pb2.Timestamp): Strongly recommended for the best service experience. The expiration timestamp of the job. After this timestamp, @@ -295,19 +295,19 @@ class Job(proto.Message): 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): + posting_create_time (google.protobuf.timestamp_pb2.Timestamp): Output only. The timestamp when this job posting was created. - posting_update_time (~.timestamp.Timestamp): + posting_update_time (google.protobuf.timestamp_pb2.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): + derived_info (google.cloud.talent_v4.types.Job.DerivedInfo): Output only. Derived details about the job posting. - processing_options (~.job.Job.ProcessingOptions): + processing_options (google.cloud.talent_v4.types.Job.ProcessingOptions): Options for job processing. """ @@ -347,7 +347,7 @@ class DerivedInfo(proto.Message): r"""Derived details about the job posting. Attributes: - locations (Sequence[~.common.Location]): + locations (Sequence[google.cloud.talent_v4.types.Location]): Structured locations of the job, resolved from [Job.addresses][google.cloud.talent.v4.Job.addresses]. @@ -355,7 +355,7 @@ class DerivedInfo(proto.Message): are exactly matched to [Job.addresses][google.cloud.talent.v4.Job.addresses] in the same order. - job_categories (Sequence[~.common.JobCategory]): + job_categories (Sequence[google.cloud.talent_v4.types.JobCategory]): Job categories derived from [Job.title][google.cloud.talent.v4.Job.title] and [Job.description][google.cloud.talent.v4.Job.description]. @@ -376,7 +376,7 @@ class ProcessingOptions(proto.Message): 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): + html_sanitization (google.cloud.talent_v4.types.HtmlSanitization): Option for job HTML content sanitization. Applied fields are: diff --git a/google/cloud/talent_v4/types/job_service.py b/google/cloud/talent_v4/types/job_service.py index 4b53ed10..78289bbe 100644 --- a/google/cloud/talent_v4/types/job_service.py +++ b/google/cloud/talent_v4/types/job_service.py @@ -74,7 +74,7 @@ class CreateJobRequest(proto.Message): The format is "projects/{project_id}/tenants/{tenant_id}". For example, "projects/foo/tenants/bar". - job (~.gct_job.Job): + job (google.cloud.talent_v4.types.Job): Required. The Job to be created. """ @@ -102,9 +102,9 @@ class UpdateJobRequest(proto.Message): r"""Update job request. Attributes: - job (~.gct_job.Job): + job (google.cloud.talent_v4.types.Job): Required. The Job to be updated. - update_mask (~.field_mask.FieldMask): + update_mask (google.protobuf.field_mask_pb2.FieldMask): Strongly recommended for the best service experience. If @@ -182,7 +182,7 @@ class ListJobsRequest(proto.Message): maximum allowed page size is 100. Default is 100 if empty or a number < 1 is specified. - job_view (~.job_service.JobView): + job_view (google.cloud.talent_v4.types.JobView): The desired job attributes returned for jobs in the search response. Defaults to [JobView.JOB_VIEW_FULL][google.cloud.talent.v4.JobView.JOB_VIEW_FULL] @@ -204,13 +204,13 @@ class ListJobsResponse(proto.Message): r"""List jobs response. Attributes: - jobs (Sequence[~.gct_job.Job]): + jobs (Sequence[google.cloud.talent_v4.types.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): + metadata (google.cloud.talent_v4.types.ResponseMetadata): Additional information for the API invocation, such as the request tracking id. """ @@ -235,17 +235,17 @@ class SearchJobsRequest(proto.Message): The format is "projects/{project_id}/tenants/{tenant_id}". For example, "projects/foo/tenants/bar". - search_mode (~.job_service.SearchJobsRequest.SearchMode): + search_mode (google.cloud.talent_v4.types.SearchJobsRequest.SearchMode): Mode of a search. Defaults to [SearchMode.JOB_SEARCH][google.cloud.talent.v4.SearchJobsRequest.SearchMode.JOB_SEARCH]. - request_metadata (~.common.RequestMetadata): + request_metadata (google.cloud.talent_v4.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. - job_query (~.filters.JobQuery): + job_query (google.cloud.talent_v4.types.JobQuery): Query used to search against jobs, such as keyword, location filters, etc. enable_broadening (bool): @@ -255,7 +255,7 @@ class SearchJobsRequest(proto.Message): results list. Defaults to false. - histogram_queries (Sequence[~.histogram.HistogramQuery]): + histogram_queries (Sequence[google.cloud.talent_v4.types.HistogramQuery]): An expression specifies a histogram request against matching jobs. @@ -368,7 +368,7 @@ class SearchJobsRequest(proto.Message): - ``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): + job_view (google.cloud.talent_v4.types.JobView): The desired job attributes returned for jobs in the search response. Defaults to [JobView.JOB_VIEW_SMALL][google.cloud.talent.v4.JobView.JOB_VIEW_SMALL] @@ -458,7 +458,7 @@ class SearchJobsRequest(proto.Message): (37.4 feet). Diversification strategy is still applied unless explicitly disabled in [diversification_level][google.cloud.talent.v4.SearchJobsRequest.diversification_level]. - diversification_level (~.job_service.SearchJobsRequest.DiversificationLevel): + diversification_level (google.cloud.talent_v4.types.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 @@ -470,7 +470,7 @@ class SearchJobsRequest(proto.Message): Defaults to [DiversificationLevel.SIMPLE][google.cloud.talent.v4.SearchJobsRequest.DiversificationLevel.SIMPLE] if no value is specified. - custom_ranking_info (~.job_service.SearchJobsRequest.CustomRankingInfo): + custom_ranking_info (google.cloud.talent_v4.types.SearchJobsRequest.CustomRankingInfo): Controls over how job documents get ranked on top of existing relevance score (determined by API algorithm). @@ -528,7 +528,7 @@ class CustomRankingInfo(proto.Message): [SearchJobsRequest][google.cloud.talent.v4.SearchJobsRequest]. Attributes: - importance_level (~.job_service.SearchJobsRequest.CustomRankingInfo.ImportanceLevel): + importance_level (google.cloud.talent_v4.types.SearchJobsRequest.CustomRankingInfo.ImportanceLevel): Required. Controls over how important the score of [CustomRankingInfo.ranking_expression][google.cloud.talent.v4.SearchJobsRequest.CustomRankingInfo.ranking_expression] gets applied to job's final ranking position. @@ -623,17 +623,17 @@ class SearchJobsResponse(proto.Message): r"""Response for SearchJob method. Attributes: - matching_jobs (Sequence[~.job_service.SearchJobsResponse.MatchingJob]): + matching_jobs (Sequence[google.cloud.talent_v4.types.SearchJobsResponse.MatchingJob]): The Job entities that match the specified [SearchJobsRequest][google.cloud.talent.v4.SearchJobsRequest]. - histogram_query_results (Sequence[~.histogram.HistogramQueryResult]): + histogram_query_results (Sequence[google.cloud.talent_v4.types.HistogramQueryResult]): The histogram results that match with specified [SearchJobsRequest.histogram_queries][google.cloud.talent.v4.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]): + location_filters (Sequence[google.cloud.talent_v4.types.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.v4.Location.location_type] @@ -644,7 +644,7 @@ class SearchJobsResponse(proto.Message): query. Note: This size is precise only if the total is less than 100,000. - metadata (~.common.ResponseMetadata): + metadata (google.cloud.talent_v4.types.ResponseMetadata): Additional information for the API invocation, such as the request tracking id. broadened_query_jobs_count (int): @@ -659,7 +659,7 @@ class SearchJobsResponse(proto.Message): 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): + spell_correction (google.cloud.talent_v4.types.SpellingCorrection): The spell checking result, and correction. """ @@ -668,7 +668,7 @@ class MatchingJob(proto.Message): [SearchJobsResponse][google.cloud.talent.v4.SearchJobsResponse]. Attributes: - job (~.gct_job.Job): + job (google.cloud.talent_v4.types.Job): Job resource that matches the specified [SearchJobsRequest][google.cloud.talent.v4.SearchJobsRequest]. job_summary (str): @@ -687,7 +687,7 @@ class MatchingJob(proto.Message): 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_info (google.cloud.talent_v4.types.SearchJobsResponse.CommuteInfo): Commute information which is generated based on specified [CommuteFilter][google.cloud.talent.v4.CommuteFilter]. """ @@ -708,10 +708,10 @@ class CommuteInfo(proto.Message): r"""Commute details related to this job. Attributes: - job_location (~.common.Location): + job_location (google.cloud.talent_v4.types.Location): Location used as the destination in the commute calculation. - travel_duration (~.duration.Duration): + travel_duration (google.protobuf.duration_pb2.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 @@ -762,7 +762,7 @@ class BatchCreateJobsRequest(proto.Message): The format is "projects/{project_id}/tenants/{tenant_id}". For example, "projects/foo/tenants/bar". - jobs (Sequence[~.gct_job.Job]): + jobs (Sequence[google.cloud.talent_v4.types.Job]): Required. The jobs to be created. A maximum of 200 jobs can be created in a batch. """ @@ -782,10 +782,10 @@ class BatchUpdateJobsRequest(proto.Message): The format is "projects/{project_id}/tenants/{tenant_id}". For example, "projects/foo/tenants/bar". - jobs (Sequence[~.gct_job.Job]): + jobs (Sequence[google.cloud.talent_v4.types.Job]): Required. The jobs to be updated. A maximum of 200 jobs can be updated in a batch. - update_mask (~.field_mask.FieldMask): + update_mask (google.protobuf.field_mask_pb2.FieldMask): Strongly recommended for the best service experience. Be aware that it will also increase latency when checking the status of a batch operation. @@ -848,7 +848,7 @@ class JobResult(proto.Message): r"""Mutation result of a job from a batch operation. Attributes: - job (~.gct_job.Job): + job (google.cloud.talent_v4.types.Job): Here [Job][google.cloud.talent.v4.Job] only contains basic information including [name][google.cloud.talent.v4.Job.name], @@ -858,7 +858,7 @@ class JobResult(proto.Message): [requisition_id][google.cloud.talent.v4.Job.requisition_id], use getJob method to retrieve detailed information of the created/updated job. - status (~.gr_status.Status): + status (google.rpc.status_pb2.Status): The status of the job processed. This field is populated if the processing of the [job][google.cloud.talent.v4.JobResult.job] fails. @@ -877,7 +877,7 @@ class BatchCreateJobsResponse(proto.Message): in case of success. Attributes: - job_results (Sequence[~.job_service.JobResult]): + job_results (Sequence[google.cloud.talent_v4.types.JobResult]): List of job mutation results from a batch create operation. It can change until operation status is FINISHED, FAILED or CANCELLED. @@ -894,7 +894,7 @@ class BatchUpdateJobsResponse(proto.Message): in case of success. Attributes: - job_results (Sequence[~.job_service.JobResult]): + job_results (Sequence[google.cloud.talent_v4.types.JobResult]): List of job mutation results from a batch update operation. It can change until operation status is FINISHED, FAILED or CANCELLED. @@ -911,7 +911,7 @@ class BatchDeleteJobsResponse(proto.Message): in case of success. Attributes: - job_results (Sequence[~.job_service.JobResult]): + job_results (Sequence[google.cloud.talent_v4.types.JobResult]): List of job mutation results from a batch delete operation. It can change until operation status is FINISHED, FAILED or CANCELLED. diff --git a/google/cloud/talent_v4/types/tenant_service.py b/google/cloud/talent_v4/types/tenant_service.py index 2f77b0d1..be5e4d8d 100644 --- a/google/cloud/talent_v4/types/tenant_service.py +++ b/google/cloud/talent_v4/types/tenant_service.py @@ -46,7 +46,7 @@ class CreateTenantRequest(proto.Message): The format is "projects/{project_id}", for example, "projects/foo". - tenant (~.gct_tenant.Tenant): + tenant (google.cloud.talent_v4.types.Tenant): Required. The tenant to be created. """ @@ -73,10 +73,10 @@ class UpdateTenantRequest(proto.Message): r"""Request for updating a specified tenant. Attributes: - tenant (~.gct_tenant.Tenant): + tenant (google.cloud.talent_v4.types.Tenant): Required. The tenant resource to replace the current resource in the system. - update_mask (~.field_mask.FieldMask): + update_mask (google.protobuf.field_mask_pb2.FieldMask): Strongly recommended for the best service experience. If @@ -139,11 +139,11 @@ class ListTenantsResponse(proto.Message): r"""The List tenants response object. Attributes: - tenants (Sequence[~.gct_tenant.Tenant]): + tenants (Sequence[google.cloud.talent_v4.types.Tenant]): Tenants for the current client. next_page_token (str): A token to retrieve the next page of results. - metadata (~.common.ResponseMetadata): + metadata (google.cloud.talent_v4.types.ResponseMetadata): Additional information for the API invocation, such as the request tracking id. """ diff --git a/google/cloud/talent_v4beta1/__init__.py b/google/cloud/talent_v4beta1/__init__.py index 4743ac58..4bfd0d8b 100644 --- a/google/cloud/talent_v4beta1/__init__.py +++ b/google/cloud/talent_v4beta1/__init__.py @@ -228,7 +228,6 @@ "Profile", "ProfileEvent", "ProfileQuery", - "ProfileServiceClient", "Publication", "Rating", "RequestMetadata", @@ -244,6 +243,7 @@ "SpellingCorrection", "SummarizedProfile", "Tenant", + "TenantServiceClient", "TimeFilter", "TimestampRange", "UpdateApplicationRequest", @@ -253,5 +253,5 @@ "UpdateTenantRequest", "Visibility", "WorkExperienceFilter", - "TenantServiceClient", + "ProfileServiceClient", ) diff --git a/google/cloud/talent_v4beta1/services/application_service/async_client.py b/google/cloud/talent_v4beta1/services/application_service/async_client.py index 8236846b..0d274c27 100644 --- a/google/cloud/talent_v4beta1/services/application_service/async_client.py +++ b/google/cloud/talent_v4beta1/services/application_service/async_client.py @@ -92,6 +92,7 @@ class ApplicationServiceAsyncClient: ApplicationServiceClient.parse_common_location_path ) + from_service_account_info = ApplicationServiceClient.from_service_account_info from_service_account_file = ApplicationServiceClient.from_service_account_file from_service_account_json = from_service_account_file @@ -170,7 +171,7 @@ async def create_application( r"""Creates a new application entity. Args: - request (:class:`~.application_service.CreateApplicationRequest`): + request (:class:`google.cloud.talent_v4beta1.types.CreateApplicationRequest`): The request object. The Request of the CreateApplication method. parent (:class:`str`): @@ -180,12 +181,14 @@ async def create_application( 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`): + application (:class:`google.cloud.talent_v4beta1.types.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. @@ -197,7 +200,7 @@ async def create_application( sent along with the request as metadata. Returns: - ~.gct_application.Application: + google.cloud.talent_v4beta1.types.Application: Resource that represents a job application record of a candidate. @@ -254,7 +257,7 @@ async def get_application( r"""Retrieves specified application. Args: - request (:class:`~.application_service.GetApplicationRequest`): + request (:class:`google.cloud.talent_v4beta1.types.GetApplicationRequest`): The request object. Request for getting a application by name. name (:class:`str`): @@ -265,6 +268,7 @@ async def get_application( "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. @@ -276,7 +280,7 @@ async def get_application( sent along with the request as metadata. Returns: - ~.application.Application: + google.cloud.talent_v4beta1.types.Application: Resource that represents a job application record of a candidate. @@ -339,13 +343,14 @@ async def update_application( r"""Updates specified application. Args: - request (:class:`~.application_service.UpdateApplicationRequest`): + request (:class:`google.cloud.talent_v4beta1.types.UpdateApplicationRequest`): The request object. Request for updating a specified application. - application (:class:`~.gct_application.Application`): + application (:class:`google.cloud.talent_v4beta1.types.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. @@ -357,7 +362,7 @@ async def update_application( sent along with the request as metadata. Returns: - ~.gct_application.Application: + google.cloud.talent_v4beta1.types.Application: Resource that represents a job application record of a candidate. @@ -414,7 +419,7 @@ async def delete_application( r"""Deletes specified application. Args: - request (:class:`~.application_service.DeleteApplicationRequest`): + request (:class:`google.cloud.talent_v4beta1.types.DeleteApplicationRequest`): The request object. Request to delete a application. name (:class:`str`): Required. The resource name of the application to be @@ -424,6 +429,7 @@ async def delete_application( "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. @@ -491,7 +497,7 @@ async def list_applications( r"""Lists all applications associated with the profile. Args: - request (:class:`~.application_service.ListApplicationsRequest`): + request (:class:`google.cloud.talent_v4beta1.types.ListApplicationsRequest`): The request object. List applications for which the client has ACL visibility. parent (:class:`str`): @@ -501,6 +507,7 @@ async def list_applications( 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. @@ -512,7 +519,7 @@ async def list_applications( sent along with the request as metadata. Returns: - ~.pagers.ListApplicationsAsyncPager: + google.cloud.talent_v4beta1.services.application_service.pagers.ListApplicationsAsyncPager: The List applications response object. Iterating over this object will yield diff --git a/google/cloud/talent_v4beta1/services/application_service/client.py b/google/cloud/talent_v4beta1/services/application_service/client.py index b8204de1..f93ebd01 100644 --- a/google/cloud/talent_v4beta1/services/application_service/client.py +++ b/google/cloud/talent_v4beta1/services/application_service/client.py @@ -120,6 +120,22 @@ def _get_default_mtls_endpoint(api_endpoint): DEFAULT_ENDPOINT ) + @classmethod + def from_service_account_info(cls, info: dict, *args, **kwargs): + """Creates an instance of this client using the provided credentials info. + + Args: + info (dict): The service account private key info. + args: Additional arguments to pass to the constructor. + kwargs: Additional arguments to pass to the constructor. + + Returns: + ApplicationServiceClient: The constructed client. + """ + credentials = service_account.Credentials.from_service_account_info(info) + kwargs["credentials"] = credentials + return cls(*args, **kwargs) + @classmethod def from_service_account_file(cls, filename: str, *args, **kwargs): """Creates an instance of this client using the provided credentials @@ -132,7 +148,7 @@ def from_service_account_file(cls, filename: str, *args, **kwargs): kwargs: Additional arguments to pass to the constructor. Returns: - {@api.name}: The constructed client. + ApplicationServiceClient: The constructed client. """ credentials = service_account.Credentials.from_service_account_file(filename) kwargs["credentials"] = credentials @@ -290,10 +306,10 @@ def __init__( 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 (Union[str, ApplicationServiceTransport]): The transport to use. If set to None, a transport is chosen automatically. - client_options (client_options_lib.ClientOptions): Custom options for the + client_options (google.api_core.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_ENDPOINT @@ -329,21 +345,17 @@ def __init__( util.strtobool(os.getenv("GOOGLE_API_USE_CLIENT_CERTIFICATE", "false")) ) - ssl_credentials = None + client_cert_source_func = None is_mtls = False if use_client_cert: if client_options.client_cert_source: - import grpc # type: ignore - - cert, key = client_options.client_cert_source() - ssl_credentials = grpc.ssl_channel_credentials( - certificate_chain=cert, private_key=key - ) is_mtls = True + client_cert_source_func = client_options.client_cert_source else: - creds = SslCredentials() - is_mtls = creds.is_mtls - ssl_credentials = creds.ssl_credentials if is_mtls else None + is_mtls = mtls.has_default_client_cert_source() + client_cert_source_func = ( + mtls.default_client_cert_source() if is_mtls else None + ) # Figure out which api endpoint to use. if client_options.api_endpoint is not None: @@ -386,7 +398,7 @@ def __init__( credentials_file=client_options.credentials_file, host=api_endpoint, scopes=client_options.scopes, - ssl_channel_credentials=ssl_credentials, + client_cert_source_for_mtls=client_cert_source_func, quota_project_id=client_options.quota_project_id, client_info=client_info, ) @@ -404,22 +416,24 @@ def create_application( r"""Creates a new application entity. Args: - request (:class:`~.application_service.CreateApplicationRequest`): + request (google.cloud.talent_v4beta1.types.CreateApplicationRequest): The request object. The Request of the CreateApplication method. - parent (:class:`str`): + 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". + This corresponds to the ``parent`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - application (:class:`~.gct_application.Application`): + application (google.cloud.talent_v4beta1.types.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. @@ -431,7 +445,7 @@ def create_application( sent along with the request as metadata. Returns: - ~.gct_application.Application: + google.cloud.talent_v4beta1.types.Application: Resource that represents a job application record of a candidate. @@ -489,10 +503,10 @@ def get_application( r"""Retrieves specified application. Args: - request (:class:`~.application_service.GetApplicationRequest`): + request (google.cloud.talent_v4beta1.types.GetApplicationRequest): The request object. Request for getting a application by name. - name (:class:`str`): + name (str): Required. The resource name of the application to be retrieved. @@ -500,6 +514,7 @@ def get_application( "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. @@ -511,7 +526,7 @@ def get_application( sent along with the request as metadata. Returns: - ~.application.Application: + google.cloud.talent_v4beta1.types.Application: Resource that represents a job application record of a candidate. @@ -567,13 +582,14 @@ def update_application( r"""Updates specified application. Args: - request (:class:`~.application_service.UpdateApplicationRequest`): + request (google.cloud.talent_v4beta1.types.UpdateApplicationRequest): The request object. Request for updating a specified application. - application (:class:`~.gct_application.Application`): + application (google.cloud.talent_v4beta1.types.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. @@ -585,7 +601,7 @@ def update_application( sent along with the request as metadata. Returns: - ~.gct_application.Application: + google.cloud.talent_v4beta1.types.Application: Resource that represents a job application record of a candidate. @@ -643,9 +659,9 @@ def delete_application( r"""Deletes specified application. Args: - request (:class:`~.application_service.DeleteApplicationRequest`): + request (google.cloud.talent_v4beta1.types.DeleteApplicationRequest): The request object. Request to delete a application. - name (:class:`str`): + name (str): Required. The resource name of the application to be deleted. @@ -653,6 +669,7 @@ def delete_application( "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. @@ -713,16 +730,17 @@ def list_applications( r"""Lists all applications associated with the profile. Args: - request (:class:`~.application_service.ListApplicationsRequest`): + request (google.cloud.talent_v4beta1.types.ListApplicationsRequest): The request object. List applications for which the client has ACL visibility. - parent (:class:`str`): + 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". + This corresponds to the ``parent`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -734,7 +752,7 @@ def list_applications( sent along with the request as metadata. Returns: - ~.pagers.ListApplicationsPager: + google.cloud.talent_v4beta1.services.application_service.pagers.ListApplicationsPager: The List applications response object. Iterating over this object will yield diff --git a/google/cloud/talent_v4beta1/services/application_service/pagers.py b/google/cloud/talent_v4beta1/services/application_service/pagers.py index 0525dae8..12862dc2 100644 --- a/google/cloud/talent_v4beta1/services/application_service/pagers.py +++ b/google/cloud/talent_v4beta1/services/application_service/pagers.py @@ -25,7 +25,7 @@ class ListApplicationsPager: """A pager for iterating through ``list_applications`` requests. This class thinly wraps an initial - :class:`~.application_service.ListApplicationsResponse` object, and + :class:`google.cloud.talent_v4beta1.types.ListApplicationsResponse` object, and provides an ``__iter__`` method to iterate through its ``applications`` field. @@ -34,7 +34,7 @@ class ListApplicationsPager: through the ``applications`` field on the corresponding responses. - All the usual :class:`~.application_service.ListApplicationsResponse` + All the usual :class:`google.cloud.talent_v4beta1.types.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. """ @@ -52,9 +52,9 @@ def __init__( Args: method (Callable): The method that was originally called, and which instantiated this pager. - request (:class:`~.application_service.ListApplicationsRequest`): + request (google.cloud.talent_v4beta1.types.ListApplicationsRequest): The initial request object. - response (:class:`~.application_service.ListApplicationsResponse`): + response (google.cloud.talent_v4beta1.types.ListApplicationsResponse): The initial response object. metadata (Sequence[Tuple[str, str]]): Strings which should be sent along with the request as metadata. @@ -87,7 +87,7 @@ class ListApplicationsAsyncPager: """A pager for iterating through ``list_applications`` requests. This class thinly wraps an initial - :class:`~.application_service.ListApplicationsResponse` object, and + :class:`google.cloud.talent_v4beta1.types.ListApplicationsResponse` object, and provides an ``__aiter__`` method to iterate through its ``applications`` field. @@ -96,7 +96,7 @@ class ListApplicationsAsyncPager: through the ``applications`` field on the corresponding responses. - All the usual :class:`~.application_service.ListApplicationsResponse` + All the usual :class:`google.cloud.talent_v4beta1.types.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. """ @@ -114,9 +114,9 @@ def __init__( Args: method (Callable): The method that was originally called, and which instantiated this pager. - request (:class:`~.application_service.ListApplicationsRequest`): + request (google.cloud.talent_v4beta1.types.ListApplicationsRequest): The initial request object. - response (:class:`~.application_service.ListApplicationsResponse`): + response (google.cloud.talent_v4beta1.types.ListApplicationsResponse): The initial response object. metadata (Sequence[Tuple[str, str]]): Strings which should be sent along with the request as metadata. diff --git a/google/cloud/talent_v4beta1/services/application_service/transports/grpc.py b/google/cloud/talent_v4beta1/services/application_service/transports/grpc.py index 07e17b28..bc852dc5 100644 --- a/google/cloud/talent_v4beta1/services/application_service/transports/grpc.py +++ b/google/cloud/talent_v4beta1/services/application_service/transports/grpc.py @@ -61,6 +61,7 @@ def __init__( api_mtls_endpoint: str = None, client_cert_source: Callable[[], Tuple[bytes, bytes]] = None, ssl_channel_credentials: grpc.ChannelCredentials = None, + client_cert_source_for_mtls: Callable[[], Tuple[bytes, bytes]] = None, quota_project_id: Optional[str] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, ) -> None: @@ -91,6 +92,10 @@ def __init__( ``api_mtls_endpoint`` is None. ssl_channel_credentials (grpc.ChannelCredentials): SSL credentials for grpc channel. It is ignored if ``channel`` is provided. + client_cert_source_for_mtls (Optional[Callable[[], Tuple[bytes, bytes]]]): + A callback to provide client certificate bytes and private key bytes, + both in PEM format. It is used to configure mutual TLS channel. It is + ignored if ``channel`` or ``ssl_channel_credentials`` is provided. quota_project_id (Optional[str]): An optional project to use for billing and quota. client_info (google.api_core.gapic_v1.client_info.ClientInfo): @@ -107,6 +112,11 @@ def __init__( """ self._ssl_channel_credentials = ssl_channel_credentials + if api_mtls_endpoint: + warnings.warn("api_mtls_endpoint is deprecated", DeprecationWarning) + if client_cert_source: + warnings.warn("client_cert_source is deprecated", DeprecationWarning) + if channel: # Sanity check: Ensure that channel and credentials are not both # provided. @@ -116,11 +126,6 @@ def __init__( self._grpc_channel = channel self._ssl_channel_credentials = None elif api_mtls_endpoint: - warnings.warn( - "api_mtls_endpoint and client_cert_source are deprecated", - DeprecationWarning, - ) - host = ( api_mtls_endpoint if ":" in api_mtls_endpoint @@ -164,12 +169,18 @@ def __init__( scopes=self.AUTH_SCOPES, quota_project_id=quota_project_id ) + if client_cert_source_for_mtls and not ssl_channel_credentials: + cert, key = client_cert_source_for_mtls() + self._ssl_channel_credentials = grpc.ssl_channel_credentials( + certificate_chain=cert, private_key=key + ) + # 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_channel_credentials, + ssl_credentials=self._ssl_channel_credentials, scopes=scopes or self.AUTH_SCOPES, quota_project_id=quota_project_id, options=[ 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 index 0727f683..cd7e74d7 100644 --- a/google/cloud/talent_v4beta1/services/application_service/transports/grpc_asyncio.py +++ b/google/cloud/talent_v4beta1/services/application_service/transports/grpc_asyncio.py @@ -105,6 +105,7 @@ def __init__( api_mtls_endpoint: str = None, client_cert_source: Callable[[], Tuple[bytes, bytes]] = None, ssl_channel_credentials: grpc.ChannelCredentials = None, + client_cert_source_for_mtls: Callable[[], Tuple[bytes, bytes]] = None, quota_project_id=None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, ) -> None: @@ -136,6 +137,10 @@ def __init__( ``api_mtls_endpoint`` is None. ssl_channel_credentials (grpc.ChannelCredentials): SSL credentials for grpc channel. It is ignored if ``channel`` is provided. + client_cert_source_for_mtls (Optional[Callable[[], Tuple[bytes, bytes]]]): + A callback to provide client certificate bytes and private key bytes, + both in PEM format. It is used to configure mutual TLS channel. It is + ignored if ``channel`` or ``ssl_channel_credentials`` is provided. quota_project_id (Optional[str]): An optional project to use for billing and quota. client_info (google.api_core.gapic_v1.client_info.ClientInfo): @@ -152,6 +157,11 @@ def __init__( """ self._ssl_channel_credentials = ssl_channel_credentials + if api_mtls_endpoint: + warnings.warn("api_mtls_endpoint is deprecated", DeprecationWarning) + if client_cert_source: + warnings.warn("client_cert_source is deprecated", DeprecationWarning) + if channel: # Sanity check: Ensure that channel and credentials are not both # provided. @@ -161,11 +171,6 @@ def __init__( self._grpc_channel = channel self._ssl_channel_credentials = None elif api_mtls_endpoint: - warnings.warn( - "api_mtls_endpoint and client_cert_source are deprecated", - DeprecationWarning, - ) - host = ( api_mtls_endpoint if ":" in api_mtls_endpoint @@ -209,12 +214,18 @@ def __init__( scopes=self.AUTH_SCOPES, quota_project_id=quota_project_id ) + if client_cert_source_for_mtls and not ssl_channel_credentials: + cert, key = client_cert_source_for_mtls() + self._ssl_channel_credentials = grpc.ssl_channel_credentials( + certificate_chain=cert, private_key=key + ) + # 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_channel_credentials, + ssl_credentials=self._ssl_channel_credentials, scopes=scopes or self.AUTH_SCOPES, quota_project_id=quota_project_id, options=[ diff --git a/google/cloud/talent_v4beta1/services/company_service/async_client.py b/google/cloud/talent_v4beta1/services/company_service/async_client.py index 98c39a8e..e8e29ed0 100644 --- a/google/cloud/talent_v4beta1/services/company_service/async_client.py +++ b/google/cloud/talent_v4beta1/services/company_service/async_client.py @@ -81,6 +81,7 @@ class CompanyServiceAsyncClient: CompanyServiceClient.parse_common_location_path ) + from_service_account_info = CompanyServiceClient.from_service_account_info from_service_account_file = CompanyServiceClient.from_service_account_file from_service_account_json = from_service_account_file @@ -158,7 +159,7 @@ async def create_company( r"""Creates a new company entity. Args: - request (:class:`~.company_service.CreateCompanyRequest`): + request (:class:`google.cloud.talent_v4beta1.types.CreateCompanyRequest`): The request object. The Request of the CreateCompany method. parent (:class:`str`): @@ -170,10 +171,11 @@ async def create_company( 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`): + company (:class:`google.cloud.talent_v4beta1.types.Company`): Required. The company to be created. This corresponds to the ``company`` field on the ``request`` instance; if ``request`` is provided, this @@ -186,7 +188,7 @@ async def create_company( sent along with the request as metadata. Returns: - ~.gct_company.Company: + google.cloud.talent_v4beta1.types.Company: A Company resource represents a company in the service. A company is the entity that owns job postings, that is, @@ -247,7 +249,7 @@ async def get_company( r"""Retrieves specified company. Args: - request (:class:`~.company_service.GetCompanyRequest`): + request (:class:`google.cloud.talent_v4beta1.types.GetCompanyRequest`): The request object. Request for getting a company by name. name (:class:`str`): @@ -261,6 +263,7 @@ async def get_company( 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. @@ -272,7 +275,7 @@ async def get_company( sent along with the request as metadata. Returns: - ~.company.Company: + google.cloud.talent_v4beta1.types.Company: A Company resource represents a company in the service. A company is the entity that owns job postings, that is, @@ -339,13 +342,14 @@ async def update_company( r"""Updates specified company. Args: - request (:class:`~.company_service.UpdateCompanyRequest`): + request (:class:`google.cloud.talent_v4beta1.types.UpdateCompanyRequest`): The request object. Request for updating a specified company. - company (:class:`~.gct_company.Company`): + company (:class:`google.cloud.talent_v4beta1.types.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. @@ -357,7 +361,7 @@ async def update_company( sent along with the request as metadata. Returns: - ~.gct_company.Company: + google.cloud.talent_v4beta1.types.Company: A Company resource represents a company in the service. A company is the entity that owns job postings, that is, @@ -420,7 +424,7 @@ async def delete_company( it. Args: - request (:class:`~.company_service.DeleteCompanyRequest`): + request (:class:`google.cloud.talent_v4beta1.types.DeleteCompanyRequest`): The request object. Request to delete a company. name (:class:`str`): Required. The resource name of the company to be @@ -432,6 +436,7 @@ async def delete_company( 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. @@ -499,7 +504,7 @@ async def list_companies( r"""Lists all companies associated with the project. Args: - request (:class:`~.company_service.ListCompaniesRequest`): + request (:class:`google.cloud.talent_v4beta1.types.ListCompaniesRequest`): The request object. List companies for which the client has ACL visibility. parent (:class:`str`): @@ -512,6 +517,7 @@ async def list_companies( 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. @@ -523,7 +529,7 @@ async def list_companies( sent along with the request as metadata. Returns: - ~.pagers.ListCompaniesAsyncPager: + google.cloud.talent_v4beta1.services.company_service.pagers.ListCompaniesAsyncPager: The List companies response object. Iterating over this object will yield results and resolve additional pages diff --git a/google/cloud/talent_v4beta1/services/company_service/client.py b/google/cloud/talent_v4beta1/services/company_service/client.py index e4638852..aa2572b5 100644 --- a/google/cloud/talent_v4beta1/services/company_service/client.py +++ b/google/cloud/talent_v4beta1/services/company_service/client.py @@ -115,6 +115,22 @@ def _get_default_mtls_endpoint(api_endpoint): DEFAULT_ENDPOINT ) + @classmethod + def from_service_account_info(cls, info: dict, *args, **kwargs): + """Creates an instance of this client using the provided credentials info. + + Args: + info (dict): The service account private key info. + args: Additional arguments to pass to the constructor. + kwargs: Additional arguments to pass to the constructor. + + Returns: + CompanyServiceClient: The constructed client. + """ + credentials = service_account.Credentials.from_service_account_info(info) + kwargs["credentials"] = credentials + return cls(*args, **kwargs) + @classmethod def from_service_account_file(cls, filename: str, *args, **kwargs): """Creates an instance of this client using the provided credentials @@ -127,7 +143,7 @@ def from_service_account_file(cls, filename: str, *args, **kwargs): kwargs: Additional arguments to pass to the constructor. Returns: - {@api.name}: The constructed client. + CompanyServiceClient: The constructed client. """ credentials = service_account.Credentials.from_service_account_file(filename) kwargs["credentials"] = credentials @@ -235,10 +251,10 @@ def __init__( 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 (Union[str, CompanyServiceTransport]): The transport to use. If set to None, a transport is chosen automatically. - client_options (client_options_lib.ClientOptions): Custom options for the + client_options (google.api_core.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_ENDPOINT @@ -274,21 +290,17 @@ def __init__( util.strtobool(os.getenv("GOOGLE_API_USE_CLIENT_CERTIFICATE", "false")) ) - ssl_credentials = None + client_cert_source_func = None is_mtls = False if use_client_cert: if client_options.client_cert_source: - import grpc # type: ignore - - cert, key = client_options.client_cert_source() - ssl_credentials = grpc.ssl_channel_credentials( - certificate_chain=cert, private_key=key - ) is_mtls = True + client_cert_source_func = client_options.client_cert_source else: - creds = SslCredentials() - is_mtls = creds.is_mtls - ssl_credentials = creds.ssl_credentials if is_mtls else None + is_mtls = mtls.has_default_client_cert_source() + client_cert_source_func = ( + mtls.default_client_cert_source() if is_mtls else None + ) # Figure out which api endpoint to use. if client_options.api_endpoint is not None: @@ -331,7 +343,7 @@ def __init__( credentials_file=client_options.credentials_file, host=api_endpoint, scopes=client_options.scopes, - ssl_channel_credentials=ssl_credentials, + client_cert_source_for_mtls=client_cert_source_func, quota_project_id=client_options.quota_project_id, client_info=client_info, ) @@ -349,10 +361,10 @@ def create_company( r"""Creates a new company entity. Args: - request (:class:`~.company_service.CreateCompanyRequest`): + request (google.cloud.talent_v4beta1.types.CreateCompanyRequest): The request object. The Request of the CreateCompany method. - parent (:class:`str`): + parent (str): Required. Resource name of the tenant under which the company is created. @@ -361,10 +373,11 @@ def create_company( 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`): + company (google.cloud.talent_v4beta1.types.Company): Required. The company to be created. This corresponds to the ``company`` field on the ``request`` instance; if ``request`` is provided, this @@ -377,7 +390,7 @@ def create_company( sent along with the request as metadata. Returns: - ~.gct_company.Company: + google.cloud.talent_v4beta1.types.Company: A Company resource represents a company in the service. A company is the entity that owns job postings, that is, @@ -439,10 +452,10 @@ def get_company( r"""Retrieves specified company. Args: - request (:class:`~.company_service.GetCompanyRequest`): + request (google.cloud.talent_v4beta1.types.GetCompanyRequest): The request object. Request for getting a company by name. - name (:class:`str`): + name (str): Required. The resource name of the company to be retrieved. @@ -453,6 +466,7 @@ def get_company( 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. @@ -464,7 +478,7 @@ def get_company( sent along with the request as metadata. Returns: - ~.company.Company: + google.cloud.talent_v4beta1.types.Company: A Company resource represents a company in the service. A company is the entity that owns job postings, that is, @@ -524,13 +538,14 @@ def update_company( r"""Updates specified company. Args: - request (:class:`~.company_service.UpdateCompanyRequest`): + request (google.cloud.talent_v4beta1.types.UpdateCompanyRequest): The request object. Request for updating a specified company. - company (:class:`~.gct_company.Company`): + company (google.cloud.talent_v4beta1.types.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. @@ -542,7 +557,7 @@ def update_company( sent along with the request as metadata. Returns: - ~.gct_company.Company: + google.cloud.talent_v4beta1.types.Company: A Company resource represents a company in the service. A company is the entity that owns job postings, that is, @@ -606,9 +621,9 @@ def delete_company( it. Args: - request (:class:`~.company_service.DeleteCompanyRequest`): + request (google.cloud.talent_v4beta1.types.DeleteCompanyRequest): The request object. Request to delete a company. - name (:class:`str`): + name (str): Required. The resource name of the company to be deleted. @@ -618,6 +633,7 @@ def delete_company( 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. @@ -678,10 +694,10 @@ def list_companies( r"""Lists all companies associated with the project. Args: - request (:class:`~.company_service.ListCompaniesRequest`): + request (google.cloud.talent_v4beta1.types.ListCompaniesRequest): The request object. List companies for which the client has ACL visibility. - parent (:class:`str`): + parent (str): Required. Resource name of the tenant under which the company is created. @@ -691,6 +707,7 @@ def list_companies( 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. @@ -702,7 +719,7 @@ def list_companies( sent along with the request as metadata. Returns: - ~.pagers.ListCompaniesPager: + google.cloud.talent_v4beta1.services.company_service.pagers.ListCompaniesPager: The List companies response object. Iterating over this object will yield results and resolve additional pages diff --git a/google/cloud/talent_v4beta1/services/company_service/pagers.py b/google/cloud/talent_v4beta1/services/company_service/pagers.py index 6b25c9a9..d3cf81a7 100644 --- a/google/cloud/talent_v4beta1/services/company_service/pagers.py +++ b/google/cloud/talent_v4beta1/services/company_service/pagers.py @@ -25,7 +25,7 @@ class ListCompaniesPager: """A pager for iterating through ``list_companies`` requests. This class thinly wraps an initial - :class:`~.company_service.ListCompaniesResponse` object, and + :class:`google.cloud.talent_v4beta1.types.ListCompaniesResponse` object, and provides an ``__iter__`` method to iterate through its ``companies`` field. @@ -34,7 +34,7 @@ class ListCompaniesPager: through the ``companies`` field on the corresponding responses. - All the usual :class:`~.company_service.ListCompaniesResponse` + All the usual :class:`google.cloud.talent_v4beta1.types.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. """ @@ -52,9 +52,9 @@ def __init__( Args: method (Callable): The method that was originally called, and which instantiated this pager. - request (:class:`~.company_service.ListCompaniesRequest`): + request (google.cloud.talent_v4beta1.types.ListCompaniesRequest): The initial request object. - response (:class:`~.company_service.ListCompaniesResponse`): + response (google.cloud.talent_v4beta1.types.ListCompaniesResponse): The initial response object. metadata (Sequence[Tuple[str, str]]): Strings which should be sent along with the request as metadata. @@ -87,7 +87,7 @@ class ListCompaniesAsyncPager: """A pager for iterating through ``list_companies`` requests. This class thinly wraps an initial - :class:`~.company_service.ListCompaniesResponse` object, and + :class:`google.cloud.talent_v4beta1.types.ListCompaniesResponse` object, and provides an ``__aiter__`` method to iterate through its ``companies`` field. @@ -96,7 +96,7 @@ class ListCompaniesAsyncPager: through the ``companies`` field on the corresponding responses. - All the usual :class:`~.company_service.ListCompaniesResponse` + All the usual :class:`google.cloud.talent_v4beta1.types.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. """ @@ -114,9 +114,9 @@ def __init__( Args: method (Callable): The method that was originally called, and which instantiated this pager. - request (:class:`~.company_service.ListCompaniesRequest`): + request (google.cloud.talent_v4beta1.types.ListCompaniesRequest): The initial request object. - response (:class:`~.company_service.ListCompaniesResponse`): + response (google.cloud.talent_v4beta1.types.ListCompaniesResponse): The initial response object. metadata (Sequence[Tuple[str, str]]): Strings which should be sent along with the request as metadata. diff --git a/google/cloud/talent_v4beta1/services/company_service/transports/grpc.py b/google/cloud/talent_v4beta1/services/company_service/transports/grpc.py index 4c833246..1e3badea 100644 --- a/google/cloud/talent_v4beta1/services/company_service/transports/grpc.py +++ b/google/cloud/talent_v4beta1/services/company_service/transports/grpc.py @@ -61,6 +61,7 @@ def __init__( api_mtls_endpoint: str = None, client_cert_source: Callable[[], Tuple[bytes, bytes]] = None, ssl_channel_credentials: grpc.ChannelCredentials = None, + client_cert_source_for_mtls: Callable[[], Tuple[bytes, bytes]] = None, quota_project_id: Optional[str] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, ) -> None: @@ -91,6 +92,10 @@ def __init__( ``api_mtls_endpoint`` is None. ssl_channel_credentials (grpc.ChannelCredentials): SSL credentials for grpc channel. It is ignored if ``channel`` is provided. + client_cert_source_for_mtls (Optional[Callable[[], Tuple[bytes, bytes]]]): + A callback to provide client certificate bytes and private key bytes, + both in PEM format. It is used to configure mutual TLS channel. It is + ignored if ``channel`` or ``ssl_channel_credentials`` is provided. quota_project_id (Optional[str]): An optional project to use for billing and quota. client_info (google.api_core.gapic_v1.client_info.ClientInfo): @@ -107,6 +112,11 @@ def __init__( """ self._ssl_channel_credentials = ssl_channel_credentials + if api_mtls_endpoint: + warnings.warn("api_mtls_endpoint is deprecated", DeprecationWarning) + if client_cert_source: + warnings.warn("client_cert_source is deprecated", DeprecationWarning) + if channel: # Sanity check: Ensure that channel and credentials are not both # provided. @@ -116,11 +126,6 @@ def __init__( self._grpc_channel = channel self._ssl_channel_credentials = None elif api_mtls_endpoint: - warnings.warn( - "api_mtls_endpoint and client_cert_source are deprecated", - DeprecationWarning, - ) - host = ( api_mtls_endpoint if ":" in api_mtls_endpoint @@ -164,12 +169,18 @@ def __init__( scopes=self.AUTH_SCOPES, quota_project_id=quota_project_id ) + if client_cert_source_for_mtls and not ssl_channel_credentials: + cert, key = client_cert_source_for_mtls() + self._ssl_channel_credentials = grpc.ssl_channel_credentials( + certificate_chain=cert, private_key=key + ) + # 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_channel_credentials, + ssl_credentials=self._ssl_channel_credentials, scopes=scopes or self.AUTH_SCOPES, quota_project_id=quota_project_id, options=[ 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 index 79a1d5fd..035237dd 100644 --- a/google/cloud/talent_v4beta1/services/company_service/transports/grpc_asyncio.py +++ b/google/cloud/talent_v4beta1/services/company_service/transports/grpc_asyncio.py @@ -105,6 +105,7 @@ def __init__( api_mtls_endpoint: str = None, client_cert_source: Callable[[], Tuple[bytes, bytes]] = None, ssl_channel_credentials: grpc.ChannelCredentials = None, + client_cert_source_for_mtls: Callable[[], Tuple[bytes, bytes]] = None, quota_project_id=None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, ) -> None: @@ -136,6 +137,10 @@ def __init__( ``api_mtls_endpoint`` is None. ssl_channel_credentials (grpc.ChannelCredentials): SSL credentials for grpc channel. It is ignored if ``channel`` is provided. + client_cert_source_for_mtls (Optional[Callable[[], Tuple[bytes, bytes]]]): + A callback to provide client certificate bytes and private key bytes, + both in PEM format. It is used to configure mutual TLS channel. It is + ignored if ``channel`` or ``ssl_channel_credentials`` is provided. quota_project_id (Optional[str]): An optional project to use for billing and quota. client_info (google.api_core.gapic_v1.client_info.ClientInfo): @@ -152,6 +157,11 @@ def __init__( """ self._ssl_channel_credentials = ssl_channel_credentials + if api_mtls_endpoint: + warnings.warn("api_mtls_endpoint is deprecated", DeprecationWarning) + if client_cert_source: + warnings.warn("client_cert_source is deprecated", DeprecationWarning) + if channel: # Sanity check: Ensure that channel and credentials are not both # provided. @@ -161,11 +171,6 @@ def __init__( self._grpc_channel = channel self._ssl_channel_credentials = None elif api_mtls_endpoint: - warnings.warn( - "api_mtls_endpoint and client_cert_source are deprecated", - DeprecationWarning, - ) - host = ( api_mtls_endpoint if ":" in api_mtls_endpoint @@ -209,12 +214,18 @@ def __init__( scopes=self.AUTH_SCOPES, quota_project_id=quota_project_id ) + if client_cert_source_for_mtls and not ssl_channel_credentials: + cert, key = client_cert_source_for_mtls() + self._ssl_channel_credentials = grpc.ssl_channel_credentials( + certificate_chain=cert, private_key=key + ) + # 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_channel_credentials, + ssl_credentials=self._ssl_channel_credentials, scopes=scopes or self.AUTH_SCOPES, quota_project_id=quota_project_id, options=[ diff --git a/google/cloud/talent_v4beta1/services/completion/async_client.py b/google/cloud/talent_v4beta1/services/completion/async_client.py index 40da92eb..7472c5f0 100644 --- a/google/cloud/talent_v4beta1/services/completion/async_client.py +++ b/google/cloud/talent_v4beta1/services/completion/async_client.py @@ -70,6 +70,7 @@ class CompletionAsyncClient: CompletionClient.parse_common_location_path ) + from_service_account_info = CompletionClient.from_service_account_info from_service_account_file = CompletionClient.from_service_account_file from_service_account_json = from_service_account_file @@ -147,7 +148,7 @@ async def complete_query( complete search box. Args: - request (:class:`~.completion_service.CompleteQueryRequest`): + request (:class:`google.cloud.talent_v4beta1.types.CompleteQueryRequest`): The request object. Auto-complete parameters. retry (google.api_core.retry.Retry): Designation of what errors, if any, @@ -157,7 +158,7 @@ async def complete_query( sent along with the request as metadata. Returns: - ~.completion_service.CompleteQueryResponse: + google.cloud.talent_v4beta1.types.CompleteQueryResponse: Response of auto-complete query. """ # Create or coerce a protobuf request object. diff --git a/google/cloud/talent_v4beta1/services/completion/client.py b/google/cloud/talent_v4beta1/services/completion/client.py index f01febaf..780d7342 100644 --- a/google/cloud/talent_v4beta1/services/completion/client.py +++ b/google/cloud/talent_v4beta1/services/completion/client.py @@ -108,6 +108,22 @@ def _get_default_mtls_endpoint(api_endpoint): DEFAULT_ENDPOINT ) + @classmethod + def from_service_account_info(cls, info: dict, *args, **kwargs): + """Creates an instance of this client using the provided credentials info. + + Args: + info (dict): The service account private key info. + args: Additional arguments to pass to the constructor. + kwargs: Additional arguments to pass to the constructor. + + Returns: + CompletionClient: The constructed client. + """ + credentials = service_account.Credentials.from_service_account_info(info) + kwargs["credentials"] = credentials + return cls(*args, **kwargs) + @classmethod def from_service_account_file(cls, filename: str, *args, **kwargs): """Creates an instance of this client using the provided credentials @@ -120,7 +136,7 @@ def from_service_account_file(cls, filename: str, *args, **kwargs): kwargs: Additional arguments to pass to the constructor. Returns: - {@api.name}: The constructed client. + CompletionClient: The constructed client. """ credentials = service_account.Credentials.from_service_account_file(filename) kwargs["credentials"] = credentials @@ -228,10 +244,10 @@ def __init__( 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 (Union[str, CompletionTransport]): The transport to use. If set to None, a transport is chosen automatically. - client_options (client_options_lib.ClientOptions): Custom options for the + client_options (google.api_core.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_ENDPOINT @@ -267,21 +283,17 @@ def __init__( util.strtobool(os.getenv("GOOGLE_API_USE_CLIENT_CERTIFICATE", "false")) ) - ssl_credentials = None + client_cert_source_func = None is_mtls = False if use_client_cert: if client_options.client_cert_source: - import grpc # type: ignore - - cert, key = client_options.client_cert_source() - ssl_credentials = grpc.ssl_channel_credentials( - certificate_chain=cert, private_key=key - ) is_mtls = True + client_cert_source_func = client_options.client_cert_source else: - creds = SslCredentials() - is_mtls = creds.is_mtls - ssl_credentials = creds.ssl_credentials if is_mtls else None + is_mtls = mtls.has_default_client_cert_source() + client_cert_source_func = ( + mtls.default_client_cert_source() if is_mtls else None + ) # Figure out which api endpoint to use. if client_options.api_endpoint is not None: @@ -324,7 +336,7 @@ def __init__( credentials_file=client_options.credentials_file, host=api_endpoint, scopes=client_options.scopes, - ssl_channel_credentials=ssl_credentials, + client_cert_source_for_mtls=client_cert_source_func, quota_project_id=client_options.quota_project_id, client_info=client_info, ) @@ -342,7 +354,7 @@ def complete_query( complete search box. Args: - request (:class:`~.completion_service.CompleteQueryRequest`): + request (google.cloud.talent_v4beta1.types.CompleteQueryRequest): The request object. Auto-complete parameters. retry (google.api_core.retry.Retry): Designation of what errors, if any, @@ -352,7 +364,7 @@ def complete_query( sent along with the request as metadata. Returns: - ~.completion_service.CompleteQueryResponse: + google.cloud.talent_v4beta1.types.CompleteQueryResponse: Response of auto-complete query. """ # Create or coerce a protobuf request object. diff --git a/google/cloud/talent_v4beta1/services/completion/transports/grpc.py b/google/cloud/talent_v4beta1/services/completion/transports/grpc.py index 086da12a..f47f3bb5 100644 --- a/google/cloud/talent_v4beta1/services/completion/transports/grpc.py +++ b/google/cloud/talent_v4beta1/services/completion/transports/grpc.py @@ -57,6 +57,7 @@ def __init__( api_mtls_endpoint: str = None, client_cert_source: Callable[[], Tuple[bytes, bytes]] = None, ssl_channel_credentials: grpc.ChannelCredentials = None, + client_cert_source_for_mtls: Callable[[], Tuple[bytes, bytes]] = None, quota_project_id: Optional[str] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, ) -> None: @@ -87,6 +88,10 @@ def __init__( ``api_mtls_endpoint`` is None. ssl_channel_credentials (grpc.ChannelCredentials): SSL credentials for grpc channel. It is ignored if ``channel`` is provided. + client_cert_source_for_mtls (Optional[Callable[[], Tuple[bytes, bytes]]]): + A callback to provide client certificate bytes and private key bytes, + both in PEM format. It is used to configure mutual TLS channel. It is + ignored if ``channel`` or ``ssl_channel_credentials`` is provided. quota_project_id (Optional[str]): An optional project to use for billing and quota. client_info (google.api_core.gapic_v1.client_info.ClientInfo): @@ -103,6 +108,11 @@ def __init__( """ self._ssl_channel_credentials = ssl_channel_credentials + if api_mtls_endpoint: + warnings.warn("api_mtls_endpoint is deprecated", DeprecationWarning) + if client_cert_source: + warnings.warn("client_cert_source is deprecated", DeprecationWarning) + if channel: # Sanity check: Ensure that channel and credentials are not both # provided. @@ -112,11 +122,6 @@ def __init__( self._grpc_channel = channel self._ssl_channel_credentials = None elif api_mtls_endpoint: - warnings.warn( - "api_mtls_endpoint and client_cert_source are deprecated", - DeprecationWarning, - ) - host = ( api_mtls_endpoint if ":" in api_mtls_endpoint @@ -160,12 +165,18 @@ def __init__( scopes=self.AUTH_SCOPES, quota_project_id=quota_project_id ) + if client_cert_source_for_mtls and not ssl_channel_credentials: + cert, key = client_cert_source_for_mtls() + self._ssl_channel_credentials = grpc.ssl_channel_credentials( + certificate_chain=cert, private_key=key + ) + # 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_channel_credentials, + ssl_credentials=self._ssl_channel_credentials, scopes=scopes or self.AUTH_SCOPES, quota_project_id=quota_project_id, options=[ diff --git a/google/cloud/talent_v4beta1/services/completion/transports/grpc_asyncio.py b/google/cloud/talent_v4beta1/services/completion/transports/grpc_asyncio.py index fa49dda0..2b0572c5 100644 --- a/google/cloud/talent_v4beta1/services/completion/transports/grpc_asyncio.py +++ b/google/cloud/talent_v4beta1/services/completion/transports/grpc_asyncio.py @@ -101,6 +101,7 @@ def __init__( api_mtls_endpoint: str = None, client_cert_source: Callable[[], Tuple[bytes, bytes]] = None, ssl_channel_credentials: grpc.ChannelCredentials = None, + client_cert_source_for_mtls: Callable[[], Tuple[bytes, bytes]] = None, quota_project_id=None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, ) -> None: @@ -132,6 +133,10 @@ def __init__( ``api_mtls_endpoint`` is None. ssl_channel_credentials (grpc.ChannelCredentials): SSL credentials for grpc channel. It is ignored if ``channel`` is provided. + client_cert_source_for_mtls (Optional[Callable[[], Tuple[bytes, bytes]]]): + A callback to provide client certificate bytes and private key bytes, + both in PEM format. It is used to configure mutual TLS channel. It is + ignored if ``channel`` or ``ssl_channel_credentials`` is provided. quota_project_id (Optional[str]): An optional project to use for billing and quota. client_info (google.api_core.gapic_v1.client_info.ClientInfo): @@ -148,6 +153,11 @@ def __init__( """ self._ssl_channel_credentials = ssl_channel_credentials + if api_mtls_endpoint: + warnings.warn("api_mtls_endpoint is deprecated", DeprecationWarning) + if client_cert_source: + warnings.warn("client_cert_source is deprecated", DeprecationWarning) + if channel: # Sanity check: Ensure that channel and credentials are not both # provided. @@ -157,11 +167,6 @@ def __init__( self._grpc_channel = channel self._ssl_channel_credentials = None elif api_mtls_endpoint: - warnings.warn( - "api_mtls_endpoint and client_cert_source are deprecated", - DeprecationWarning, - ) - host = ( api_mtls_endpoint if ":" in api_mtls_endpoint @@ -205,12 +210,18 @@ def __init__( scopes=self.AUTH_SCOPES, quota_project_id=quota_project_id ) + if client_cert_source_for_mtls and not ssl_channel_credentials: + cert, key = client_cert_source_for_mtls() + self._ssl_channel_credentials = grpc.ssl_channel_credentials( + certificate_chain=cert, private_key=key + ) + # 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_channel_credentials, + ssl_credentials=self._ssl_channel_credentials, scopes=scopes or self.AUTH_SCOPES, quota_project_id=quota_project_id, options=[ diff --git a/google/cloud/talent_v4beta1/services/event_service/async_client.py b/google/cloud/talent_v4beta1/services/event_service/async_client.py index 553aed17..c90c5964 100644 --- a/google/cloud/talent_v4beta1/services/event_service/async_client.py +++ b/google/cloud/talent_v4beta1/services/event_service/async_client.py @@ -73,6 +73,7 @@ class EventServiceAsyncClient: EventServiceClient.parse_common_location_path ) + from_service_account_info = EventServiceClient.from_service_account_info from_service_account_file = EventServiceClient.from_service_account_file from_service_account_json = from_service_account_file @@ -156,7 +157,7 @@ async def create_client_event( about self service tools. Args: - request (:class:`~.event_service.CreateClientEventRequest`): + request (:class:`google.cloud.talent_v4beta1.types.CreateClientEventRequest`): The request object. The report event request. parent (:class:`str`): Required. Resource name of the tenant under which the @@ -167,13 +168,15 @@ async def create_client_event( 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`): + client_event (:class:`google.cloud.talent_v4beta1.types.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. @@ -185,7 +188,7 @@ async def create_client_event( sent along with the request as metadata. Returns: - ~.event.ClientEvent: + google.cloud.talent_v4beta1.types.ClientEvent: An event issued when an end user interacts with the application that implements Cloud Talent Solution. diff --git a/google/cloud/talent_v4beta1/services/event_service/client.py b/google/cloud/talent_v4beta1/services/event_service/client.py index 21204729..b231a98d 100644 --- a/google/cloud/talent_v4beta1/services/event_service/client.py +++ b/google/cloud/talent_v4beta1/services/event_service/client.py @@ -109,6 +109,22 @@ def _get_default_mtls_endpoint(api_endpoint): DEFAULT_ENDPOINT ) + @classmethod + def from_service_account_info(cls, info: dict, *args, **kwargs): + """Creates an instance of this client using the provided credentials info. + + Args: + info (dict): The service account private key info. + args: Additional arguments to pass to the constructor. + kwargs: Additional arguments to pass to the constructor. + + Returns: + EventServiceClient: The constructed client. + """ + credentials = service_account.Credentials.from_service_account_info(info) + kwargs["credentials"] = credentials + return cls(*args, **kwargs) + @classmethod def from_service_account_file(cls, filename: str, *args, **kwargs): """Creates an instance of this client using the provided credentials @@ -121,7 +137,7 @@ def from_service_account_file(cls, filename: str, *args, **kwargs): kwargs: Additional arguments to pass to the constructor. Returns: - {@api.name}: The constructed client. + EventServiceClient: The constructed client. """ credentials = service_account.Credentials.from_service_account_file(filename) kwargs["credentials"] = credentials @@ -229,10 +245,10 @@ def __init__( 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 (Union[str, EventServiceTransport]): The transport to use. If set to None, a transport is chosen automatically. - client_options (client_options_lib.ClientOptions): Custom options for the + client_options (google.api_core.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_ENDPOINT @@ -268,21 +284,17 @@ def __init__( util.strtobool(os.getenv("GOOGLE_API_USE_CLIENT_CERTIFICATE", "false")) ) - ssl_credentials = None + client_cert_source_func = None is_mtls = False if use_client_cert: if client_options.client_cert_source: - import grpc # type: ignore - - cert, key = client_options.client_cert_source() - ssl_credentials = grpc.ssl_channel_credentials( - certificate_chain=cert, private_key=key - ) is_mtls = True + client_cert_source_func = client_options.client_cert_source else: - creds = SslCredentials() - is_mtls = creds.is_mtls - ssl_credentials = creds.ssl_credentials if is_mtls else None + is_mtls = mtls.has_default_client_cert_source() + client_cert_source_func = ( + mtls.default_client_cert_source() if is_mtls else None + ) # Figure out which api endpoint to use. if client_options.api_endpoint is not None: @@ -325,7 +337,7 @@ def __init__( credentials_file=client_options.credentials_file, host=api_endpoint, scopes=client_options.scopes, - ssl_channel_credentials=ssl_credentials, + client_cert_source_for_mtls=client_cert_source_func, quota_project_id=client_options.quota_project_id, client_info=client_info, ) @@ -349,9 +361,9 @@ def create_client_event( about self service tools. Args: - request (:class:`~.event_service.CreateClientEventRequest`): + request (google.cloud.talent_v4beta1.types.CreateClientEventRequest): The request object. The report event request. - parent (:class:`str`): + parent (str): Required. Resource name of the tenant under which the event is created. @@ -360,13 +372,15 @@ def create_client_event( 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`): + client_event (google.cloud.talent_v4beta1.types.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. @@ -378,7 +392,7 @@ def create_client_event( sent along with the request as metadata. Returns: - ~.event.ClientEvent: + google.cloud.talent_v4beta1.types.ClientEvent: An event issued when an end user interacts with the application that implements Cloud Talent Solution. diff --git a/google/cloud/talent_v4beta1/services/event_service/transports/grpc.py b/google/cloud/talent_v4beta1/services/event_service/transports/grpc.py index 5b8edccd..6d1f787e 100644 --- a/google/cloud/talent_v4beta1/services/event_service/transports/grpc.py +++ b/google/cloud/talent_v4beta1/services/event_service/transports/grpc.py @@ -58,6 +58,7 @@ def __init__( api_mtls_endpoint: str = None, client_cert_source: Callable[[], Tuple[bytes, bytes]] = None, ssl_channel_credentials: grpc.ChannelCredentials = None, + client_cert_source_for_mtls: Callable[[], Tuple[bytes, bytes]] = None, quota_project_id: Optional[str] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, ) -> None: @@ -88,6 +89,10 @@ def __init__( ``api_mtls_endpoint`` is None. ssl_channel_credentials (grpc.ChannelCredentials): SSL credentials for grpc channel. It is ignored if ``channel`` is provided. + client_cert_source_for_mtls (Optional[Callable[[], Tuple[bytes, bytes]]]): + A callback to provide client certificate bytes and private key bytes, + both in PEM format. It is used to configure mutual TLS channel. It is + ignored if ``channel`` or ``ssl_channel_credentials`` is provided. quota_project_id (Optional[str]): An optional project to use for billing and quota. client_info (google.api_core.gapic_v1.client_info.ClientInfo): @@ -104,6 +109,11 @@ def __init__( """ self._ssl_channel_credentials = ssl_channel_credentials + if api_mtls_endpoint: + warnings.warn("api_mtls_endpoint is deprecated", DeprecationWarning) + if client_cert_source: + warnings.warn("client_cert_source is deprecated", DeprecationWarning) + if channel: # Sanity check: Ensure that channel and credentials are not both # provided. @@ -113,11 +123,6 @@ def __init__( self._grpc_channel = channel self._ssl_channel_credentials = None elif api_mtls_endpoint: - warnings.warn( - "api_mtls_endpoint and client_cert_source are deprecated", - DeprecationWarning, - ) - host = ( api_mtls_endpoint if ":" in api_mtls_endpoint @@ -161,12 +166,18 @@ def __init__( scopes=self.AUTH_SCOPES, quota_project_id=quota_project_id ) + if client_cert_source_for_mtls and not ssl_channel_credentials: + cert, key = client_cert_source_for_mtls() + self._ssl_channel_credentials = grpc.ssl_channel_credentials( + certificate_chain=cert, private_key=key + ) + # 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_channel_credentials, + ssl_credentials=self._ssl_channel_credentials, scopes=scopes or self.AUTH_SCOPES, quota_project_id=quota_project_id, options=[ 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 index 6a4cbe75..e3864ef5 100644 --- a/google/cloud/talent_v4beta1/services/event_service/transports/grpc_asyncio.py +++ b/google/cloud/talent_v4beta1/services/event_service/transports/grpc_asyncio.py @@ -102,6 +102,7 @@ def __init__( api_mtls_endpoint: str = None, client_cert_source: Callable[[], Tuple[bytes, bytes]] = None, ssl_channel_credentials: grpc.ChannelCredentials = None, + client_cert_source_for_mtls: Callable[[], Tuple[bytes, bytes]] = None, quota_project_id=None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, ) -> None: @@ -133,6 +134,10 @@ def __init__( ``api_mtls_endpoint`` is None. ssl_channel_credentials (grpc.ChannelCredentials): SSL credentials for grpc channel. It is ignored if ``channel`` is provided. + client_cert_source_for_mtls (Optional[Callable[[], Tuple[bytes, bytes]]]): + A callback to provide client certificate bytes and private key bytes, + both in PEM format. It is used to configure mutual TLS channel. It is + ignored if ``channel`` or ``ssl_channel_credentials`` is provided. quota_project_id (Optional[str]): An optional project to use for billing and quota. client_info (google.api_core.gapic_v1.client_info.ClientInfo): @@ -149,6 +154,11 @@ def __init__( """ self._ssl_channel_credentials = ssl_channel_credentials + if api_mtls_endpoint: + warnings.warn("api_mtls_endpoint is deprecated", DeprecationWarning) + if client_cert_source: + warnings.warn("client_cert_source is deprecated", DeprecationWarning) + if channel: # Sanity check: Ensure that channel and credentials are not both # provided. @@ -158,11 +168,6 @@ def __init__( self._grpc_channel = channel self._ssl_channel_credentials = None elif api_mtls_endpoint: - warnings.warn( - "api_mtls_endpoint and client_cert_source are deprecated", - DeprecationWarning, - ) - host = ( api_mtls_endpoint if ":" in api_mtls_endpoint @@ -206,12 +211,18 @@ def __init__( scopes=self.AUTH_SCOPES, quota_project_id=quota_project_id ) + if client_cert_source_for_mtls and not ssl_channel_credentials: + cert, key = client_cert_source_for_mtls() + self._ssl_channel_credentials = grpc.ssl_channel_credentials( + certificate_chain=cert, private_key=key + ) + # 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_channel_credentials, + ssl_credentials=self._ssl_channel_credentials, scopes=scopes or self.AUTH_SCOPES, quota_project_id=quota_project_id, options=[ diff --git a/google/cloud/talent_v4beta1/services/job_service/async_client.py b/google/cloud/talent_v4beta1/services/job_service/async_client.py index a5ad40c6..0c9d7d91 100644 --- a/google/cloud/talent_v4beta1/services/job_service/async_client.py +++ b/google/cloud/talent_v4beta1/services/job_service/async_client.py @@ -80,6 +80,7 @@ class JobServiceAsyncClient: JobServiceClient.parse_common_location_path ) + from_service_account_info = JobServiceClient.from_service_account_info from_service_account_file = JobServiceClient.from_service_account_file from_service_account_json = from_service_account_file @@ -159,7 +160,7 @@ async def create_job( but it may take up to 5 minutes. Args: - request (:class:`~.job_service.CreateJobRequest`): + request (:class:`google.cloud.talent_v4beta1.types.CreateJobRequest`): The request object. Create job request. parent (:class:`str`): Required. The resource name of the tenant under which @@ -170,10 +171,11 @@ async def create_job( 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`): + job (:class:`google.cloud.talent_v4beta1.types.Job`): Required. The Job to be created. This corresponds to the ``job`` field on the ``request`` instance; if ``request`` is provided, this @@ -186,12 +188,11 @@ async def create_job( 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. + google.cloud.talent_v4beta1.types.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. @@ -247,7 +248,7 @@ async def batch_create_jobs( r"""Begins executing a batch create jobs operation. Args: - request (:class:`~.job_service.BatchCreateJobsRequest`): + request (:class:`google.cloud.talent_v4beta1.types.BatchCreateJobsRequest`): The request object. Request to create a batch of jobs. parent (:class:`str`): Required. The resource name of the tenant under which @@ -258,10 +259,11 @@ async def batch_create_jobs( 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]`): + jobs (:class:`Sequence[google.cloud.talent_v4beta1.types.Job]`): Required. The jobs to be created. This corresponds to the ``jobs`` field on the ``request`` instance; if ``request`` is provided, this @@ -274,18 +276,14 @@ async def batch_create_jobs( sent along with the request as metadata. Returns: - ~.operation_async.AsyncOperation: + google.api_core.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. + The result type for the operation will be :class:`google.cloud.talent_v4beta1.types.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. @@ -350,7 +348,7 @@ async def get_job( recently EXPIRED within the last 90 days. Args: - request (:class:`~.job_service.GetJobRequest`): + request (:class:`google.cloud.talent_v4beta1.types.GetJobRequest`): The request object. Get job request. name (:class:`str`): Required. The resource name of the job to retrieve. @@ -361,6 +359,7 @@ async def get_job( 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. @@ -372,12 +371,11 @@ async def get_job( 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. + google.cloud.talent_v4beta1.types.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. @@ -441,9 +439,9 @@ async def update_job( minutes. Args: - request (:class:`~.job_service.UpdateJobRequest`): + request (:class:`google.cloud.talent_v4beta1.types.UpdateJobRequest`): The request object. Update job request. - job (:class:`~.gct_job.Job`): + job (:class:`google.cloud.talent_v4beta1.types.Job`): Required. The Job to be updated. This corresponds to the ``job`` field on the ``request`` instance; if ``request`` is provided, this @@ -456,12 +454,11 @@ async def update_job( 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. + google.cloud.talent_v4beta1.types.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. @@ -515,7 +512,7 @@ async def batch_update_jobs( r"""Begins executing a batch update jobs operation. Args: - request (:class:`~.job_service.BatchUpdateJobsRequest`): + request (:class:`google.cloud.talent_v4beta1.types.BatchUpdateJobsRequest`): The request object. Request to update a batch of jobs. parent (:class:`str`): Required. The resource name of the tenant under which @@ -526,10 +523,11 @@ async def batch_update_jobs( 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]`): + jobs (:class:`Sequence[google.cloud.talent_v4beta1.types.Job]`): Required. The jobs to be updated. This corresponds to the ``jobs`` field on the ``request`` instance; if ``request`` is provided, this @@ -542,18 +540,14 @@ async def batch_update_jobs( sent along with the request as metadata. Returns: - ~.operation_async.AsyncOperation: + google.api_core.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. + The result type for the operation will be :class:`google.cloud.talent_v4beta1.types.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. @@ -619,7 +613,7 @@ async def delete_job( seconds, but it may take up to 5 minutes. Args: - request (:class:`~.job_service.DeleteJobRequest`): + request (:class:`google.cloud.talent_v4beta1.types.DeleteJobRequest`): The request object. Delete job request. name (:class:`str`): Required. The resource name of the job to be deleted. @@ -630,6 +624,7 @@ async def delete_job( 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. @@ -699,7 +694,7 @@ async def batch_delete_jobs( filter. Args: - request (:class:`~.job_service.BatchDeleteJobsRequest`): + request (:class:`google.cloud.talent_v4beta1.types.BatchDeleteJobsRequest`): The request object. Batch delete jobs request. parent (:class:`str`): Required. The resource name of the tenant under which @@ -710,6 +705,7 @@ async def batch_delete_jobs( 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. @@ -725,7 +721,8 @@ async def batch_delete_jobs( - ``requisitionId`` (Required) Sample Query: companyName = "projects/foo/companies/bar" - AND requisitionId = "req-1". + AND requisitionId = "req-1" + This corresponds to the ``filter`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -788,7 +785,7 @@ async def list_jobs( r"""Lists jobs by filter. Args: - request (:class:`~.job_service.ListJobsRequest`): + request (:class:`google.cloud.talent_v4beta1.types.ListJobsRequest`): The request object. List jobs request. parent (:class:`str`): Required. The resource name of the tenant under which @@ -799,6 +796,7 @@ async def list_jobs( 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. @@ -824,7 +822,8 @@ async def list_jobs( requisitionId = "req-1" - companyName = "projects/foo/tenants/bar/companies/baz" AND status = - "EXPIRED". + "EXPIRED" + This corresponds to the ``filter`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -836,7 +835,7 @@ async def list_jobs( sent along with the request as metadata. Returns: - ~.pagers.ListJobsAsyncPager: + google.cloud.talent_v4beta1.services.job_service.pagers.ListJobsAsyncPager: List jobs response. Iterating over this object will yield results and resolve additional pages @@ -914,7 +913,7 @@ async def search_jobs( has permission to search against. Args: - request (:class:`~.job_service.SearchJobsRequest`): + request (:class:`google.cloud.talent_v4beta1.types.SearchJobsRequest`): The request object. The Request body of the `SearchJobs` call. @@ -925,7 +924,7 @@ async def search_jobs( sent along with the request as metadata. Returns: - ~.pagers.SearchJobsAsyncPager: + google.cloud.talent_v4beta1.services.job_service.pagers.SearchJobsAsyncPager: Response for SearchJob method. Iterating over this object will yield results and resolve additional pages @@ -985,7 +984,7 @@ async def search_jobs_for_alert( permission to search against. Args: - request (:class:`~.job_service.SearchJobsRequest`): + request (:class:`google.cloud.talent_v4beta1.types.SearchJobsRequest`): The request object. The Request body of the `SearchJobs` call. @@ -996,7 +995,7 @@ async def search_jobs_for_alert( sent along with the request as metadata. Returns: - ~.pagers.SearchJobsForAlertAsyncPager: + google.cloud.talent_v4beta1.services.job_service.pagers.SearchJobsForAlertAsyncPager: Response for SearchJob method. Iterating over this object will yield results and resolve additional pages diff --git a/google/cloud/talent_v4beta1/services/job_service/client.py b/google/cloud/talent_v4beta1/services/job_service/client.py index 726b75ae..1ef51df9 100644 --- a/google/cloud/talent_v4beta1/services/job_service/client.py +++ b/google/cloud/talent_v4beta1/services/job_service/client.py @@ -116,6 +116,22 @@ def _get_default_mtls_endpoint(api_endpoint): DEFAULT_ENDPOINT ) + @classmethod + def from_service_account_info(cls, info: dict, *args, **kwargs): + """Creates an instance of this client using the provided credentials info. + + Args: + info (dict): The service account private key info. + args: Additional arguments to pass to the constructor. + kwargs: Additional arguments to pass to the constructor. + + Returns: + JobServiceClient: The constructed client. + """ + credentials = service_account.Credentials.from_service_account_info(info) + kwargs["credentials"] = credentials + return cls(*args, **kwargs) + @classmethod def from_service_account_file(cls, filename: str, *args, **kwargs): """Creates an instance of this client using the provided credentials @@ -128,7 +144,7 @@ def from_service_account_file(cls, filename: str, *args, **kwargs): kwargs: Additional arguments to pass to the constructor. Returns: - {@api.name}: The constructed client. + JobServiceClient: The constructed client. """ credentials = service_account.Credentials.from_service_account_file(filename) kwargs["credentials"] = credentials @@ -252,10 +268,10 @@ def __init__( 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 (Union[str, JobServiceTransport]): The transport to use. If set to None, a transport is chosen automatically. - client_options (client_options_lib.ClientOptions): Custom options for the + client_options (google.api_core.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_ENDPOINT @@ -291,21 +307,17 @@ def __init__( util.strtobool(os.getenv("GOOGLE_API_USE_CLIENT_CERTIFICATE", "false")) ) - ssl_credentials = None + client_cert_source_func = None is_mtls = False if use_client_cert: if client_options.client_cert_source: - import grpc # type: ignore - - cert, key = client_options.client_cert_source() - ssl_credentials = grpc.ssl_channel_credentials( - certificate_chain=cert, private_key=key - ) is_mtls = True + client_cert_source_func = client_options.client_cert_source else: - creds = SslCredentials() - is_mtls = creds.is_mtls - ssl_credentials = creds.ssl_credentials if is_mtls else None + is_mtls = mtls.has_default_client_cert_source() + client_cert_source_func = ( + mtls.default_client_cert_source() if is_mtls else None + ) # Figure out which api endpoint to use. if client_options.api_endpoint is not None: @@ -348,7 +360,7 @@ def __init__( credentials_file=client_options.credentials_file, host=api_endpoint, scopes=client_options.scopes, - ssl_channel_credentials=ssl_credentials, + client_cert_source_for_mtls=client_cert_source_func, quota_project_id=client_options.quota_project_id, client_info=client_info, ) @@ -368,9 +380,9 @@ def create_job( but it may take up to 5 minutes. Args: - request (:class:`~.job_service.CreateJobRequest`): + request (google.cloud.talent_v4beta1.types.CreateJobRequest): The request object. Create job request. - parent (:class:`str`): + parent (str): Required. The resource name of the tenant under which the job is created. @@ -379,10 +391,11 @@ def create_job( 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`): + job (google.cloud.talent_v4beta1.types.Job): Required. The Job to be created. This corresponds to the ``job`` field on the ``request`` instance; if ``request`` is provided, this @@ -395,12 +408,11 @@ def create_job( 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. + google.cloud.talent_v4beta1.types.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. @@ -457,9 +469,9 @@ def batch_create_jobs( r"""Begins executing a batch create jobs operation. Args: - request (:class:`~.job_service.BatchCreateJobsRequest`): + request (google.cloud.talent_v4beta1.types.BatchCreateJobsRequest): The request object. Request to create a batch of jobs. - parent (:class:`str`): + parent (str): Required. The resource name of the tenant under which the job is created. @@ -468,10 +480,11 @@ def batch_create_jobs( 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]`): + jobs (Sequence[google.cloud.talent_v4beta1.types.Job]): Required. The jobs to be created. This corresponds to the ``jobs`` field on the ``request`` instance; if ``request`` is provided, this @@ -484,18 +497,14 @@ def batch_create_jobs( sent along with the request as metadata. Returns: - ~.operation.Operation: + google.api_core.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. + The result type for the operation will be :class:`google.cloud.talent_v4beta1.types.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. @@ -561,9 +570,9 @@ def get_job( recently EXPIRED within the last 90 days. Args: - request (:class:`~.job_service.GetJobRequest`): + request (google.cloud.talent_v4beta1.types.GetJobRequest): The request object. Get job request. - name (:class:`str`): + name (str): Required. The resource name of the job to retrieve. The format is @@ -572,6 +581,7 @@ def get_job( 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. @@ -583,12 +593,11 @@ def get_job( 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. + google.cloud.talent_v4beta1.types.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. @@ -645,9 +654,9 @@ def update_job( minutes. Args: - request (:class:`~.job_service.UpdateJobRequest`): + request (google.cloud.talent_v4beta1.types.UpdateJobRequest): The request object. Update job request. - job (:class:`~.gct_job.Job`): + job (google.cloud.talent_v4beta1.types.Job): Required. The Job to be updated. This corresponds to the ``job`` field on the ``request`` instance; if ``request`` is provided, this @@ -660,12 +669,11 @@ def update_job( 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. + google.cloud.talent_v4beta1.types.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. @@ -720,9 +728,9 @@ def batch_update_jobs( r"""Begins executing a batch update jobs operation. Args: - request (:class:`~.job_service.BatchUpdateJobsRequest`): + request (google.cloud.talent_v4beta1.types.BatchUpdateJobsRequest): The request object. Request to update a batch of jobs. - parent (:class:`str`): + parent (str): Required. The resource name of the tenant under which the job is created. @@ -731,10 +739,11 @@ def batch_update_jobs( 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]`): + jobs (Sequence[google.cloud.talent_v4beta1.types.Job]): Required. The jobs to be updated. This corresponds to the ``jobs`` field on the ``request`` instance; if ``request`` is provided, this @@ -747,18 +756,14 @@ def batch_update_jobs( sent along with the request as metadata. Returns: - ~.operation.Operation: + google.api_core.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. + The result type for the operation will be :class:`google.cloud.talent_v4beta1.types.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. @@ -825,9 +830,9 @@ def delete_job( seconds, but it may take up to 5 minutes. Args: - request (:class:`~.job_service.DeleteJobRequest`): + request (google.cloud.talent_v4beta1.types.DeleteJobRequest): The request object. Delete job request. - name (:class:`str`): + name (str): Required. The resource name of the job to be deleted. The format is @@ -836,6 +841,7 @@ def delete_job( 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. @@ -898,9 +904,9 @@ def batch_delete_jobs( filter. Args: - request (:class:`~.job_service.BatchDeleteJobsRequest`): + request (google.cloud.talent_v4beta1.types.BatchDeleteJobsRequest): The request object. Batch delete jobs request. - parent (:class:`str`): + parent (str): Required. The resource name of the tenant under which the job is created. @@ -909,10 +915,11 @@ def batch_delete_jobs( 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`): + filter (str): Required. The filter string specifies the jobs to be deleted. @@ -924,7 +931,8 @@ def batch_delete_jobs( - ``requisitionId`` (Required) Sample Query: companyName = "projects/foo/companies/bar" - AND requisitionId = "req-1". + AND requisitionId = "req-1" + This corresponds to the ``filter`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -988,9 +996,9 @@ def list_jobs( r"""Lists jobs by filter. Args: - request (:class:`~.job_service.ListJobsRequest`): + request (google.cloud.talent_v4beta1.types.ListJobsRequest): The request object. List jobs request. - parent (:class:`str`): + parent (str): Required. The resource name of the tenant under which the job is created. @@ -999,10 +1007,11 @@ def list_jobs( 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`): + filter (str): Required. The filter string specifies the jobs to be enumerated. @@ -1024,7 +1033,8 @@ def list_jobs( requisitionId = "req-1" - companyName = "projects/foo/tenants/bar/companies/baz" AND status = - "EXPIRED". + "EXPIRED" + This corresponds to the ``filter`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -1036,7 +1046,7 @@ def list_jobs( sent along with the request as metadata. Returns: - ~.pagers.ListJobsPager: + google.cloud.talent_v4beta1.services.job_service.pagers.ListJobsPager: List jobs response. Iterating over this object will yield results and resolve additional pages @@ -1107,7 +1117,7 @@ def search_jobs( has permission to search against. Args: - request (:class:`~.job_service.SearchJobsRequest`): + request (google.cloud.talent_v4beta1.types.SearchJobsRequest): The request object. The Request body of the `SearchJobs` call. @@ -1118,7 +1128,7 @@ def search_jobs( sent along with the request as metadata. Returns: - ~.pagers.SearchJobsPager: + google.cloud.talent_v4beta1.services.job_service.pagers.SearchJobsPager: Response for SearchJob method. Iterating over this object will yield results and resolve additional pages @@ -1179,7 +1189,7 @@ def search_jobs_for_alert( permission to search against. Args: - request (:class:`~.job_service.SearchJobsRequest`): + request (google.cloud.talent_v4beta1.types.SearchJobsRequest): The request object. The Request body of the `SearchJobs` call. @@ -1190,7 +1200,7 @@ def search_jobs_for_alert( sent along with the request as metadata. Returns: - ~.pagers.SearchJobsForAlertPager: + google.cloud.talent_v4beta1.services.job_service.pagers.SearchJobsForAlertPager: Response for SearchJob method. Iterating over this object will yield results and resolve additional pages diff --git a/google/cloud/talent_v4beta1/services/job_service/pagers.py b/google/cloud/talent_v4beta1/services/job_service/pagers.py index fcefff46..57d6d4c1 100644 --- a/google/cloud/talent_v4beta1/services/job_service/pagers.py +++ b/google/cloud/talent_v4beta1/services/job_service/pagers.py @@ -25,7 +25,7 @@ class ListJobsPager: """A pager for iterating through ``list_jobs`` requests. This class thinly wraps an initial - :class:`~.job_service.ListJobsResponse` object, and + :class:`google.cloud.talent_v4beta1.types.ListJobsResponse` object, and provides an ``__iter__`` method to iterate through its ``jobs`` field. @@ -34,7 +34,7 @@ class ListJobsPager: through the ``jobs`` field on the corresponding responses. - All the usual :class:`~.job_service.ListJobsResponse` + All the usual :class:`google.cloud.talent_v4beta1.types.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. """ @@ -52,9 +52,9 @@ def __init__( Args: method (Callable): The method that was originally called, and which instantiated this pager. - request (:class:`~.job_service.ListJobsRequest`): + request (google.cloud.talent_v4beta1.types.ListJobsRequest): The initial request object. - response (:class:`~.job_service.ListJobsResponse`): + response (google.cloud.talent_v4beta1.types.ListJobsResponse): The initial response object. metadata (Sequence[Tuple[str, str]]): Strings which should be sent along with the request as metadata. @@ -87,7 +87,7 @@ class ListJobsAsyncPager: """A pager for iterating through ``list_jobs`` requests. This class thinly wraps an initial - :class:`~.job_service.ListJobsResponse` object, and + :class:`google.cloud.talent_v4beta1.types.ListJobsResponse` object, and provides an ``__aiter__`` method to iterate through its ``jobs`` field. @@ -96,7 +96,7 @@ class ListJobsAsyncPager: through the ``jobs`` field on the corresponding responses. - All the usual :class:`~.job_service.ListJobsResponse` + All the usual :class:`google.cloud.talent_v4beta1.types.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. """ @@ -114,9 +114,9 @@ def __init__( Args: method (Callable): The method that was originally called, and which instantiated this pager. - request (:class:`~.job_service.ListJobsRequest`): + request (google.cloud.talent_v4beta1.types.ListJobsRequest): The initial request object. - response (:class:`~.job_service.ListJobsResponse`): + response (google.cloud.talent_v4beta1.types.ListJobsResponse): The initial response object. metadata (Sequence[Tuple[str, str]]): Strings which should be sent along with the request as metadata. @@ -153,7 +153,7 @@ class SearchJobsPager: """A pager for iterating through ``search_jobs`` requests. This class thinly wraps an initial - :class:`~.job_service.SearchJobsResponse` object, and + :class:`google.cloud.talent_v4beta1.types.SearchJobsResponse` object, and provides an ``__iter__`` method to iterate through its ``matching_jobs`` field. @@ -162,7 +162,7 @@ class SearchJobsPager: through the ``matching_jobs`` field on the corresponding responses. - All the usual :class:`~.job_service.SearchJobsResponse` + All the usual :class:`google.cloud.talent_v4beta1.types.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. """ @@ -180,9 +180,9 @@ def __init__( Args: method (Callable): The method that was originally called, and which instantiated this pager. - request (:class:`~.job_service.SearchJobsRequest`): + request (google.cloud.talent_v4beta1.types.SearchJobsRequest): The initial request object. - response (:class:`~.job_service.SearchJobsResponse`): + response (google.cloud.talent_v4beta1.types.SearchJobsResponse): The initial response object. metadata (Sequence[Tuple[str, str]]): Strings which should be sent along with the request as metadata. @@ -215,7 +215,7 @@ class SearchJobsAsyncPager: """A pager for iterating through ``search_jobs`` requests. This class thinly wraps an initial - :class:`~.job_service.SearchJobsResponse` object, and + :class:`google.cloud.talent_v4beta1.types.SearchJobsResponse` object, and provides an ``__aiter__`` method to iterate through its ``matching_jobs`` field. @@ -224,7 +224,7 @@ class SearchJobsAsyncPager: through the ``matching_jobs`` field on the corresponding responses. - All the usual :class:`~.job_service.SearchJobsResponse` + All the usual :class:`google.cloud.talent_v4beta1.types.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. """ @@ -242,9 +242,9 @@ def __init__( Args: method (Callable): The method that was originally called, and which instantiated this pager. - request (:class:`~.job_service.SearchJobsRequest`): + request (google.cloud.talent_v4beta1.types.SearchJobsRequest): The initial request object. - response (:class:`~.job_service.SearchJobsResponse`): + response (google.cloud.talent_v4beta1.types.SearchJobsResponse): The initial response object. metadata (Sequence[Tuple[str, str]]): Strings which should be sent along with the request as metadata. @@ -281,7 +281,7 @@ class SearchJobsForAlertPager: """A pager for iterating through ``search_jobs_for_alert`` requests. This class thinly wraps an initial - :class:`~.job_service.SearchJobsResponse` object, and + :class:`google.cloud.talent_v4beta1.types.SearchJobsResponse` object, and provides an ``__iter__`` method to iterate through its ``matching_jobs`` field. @@ -290,7 +290,7 @@ class SearchJobsForAlertPager: through the ``matching_jobs`` field on the corresponding responses. - All the usual :class:`~.job_service.SearchJobsResponse` + All the usual :class:`google.cloud.talent_v4beta1.types.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. """ @@ -308,9 +308,9 @@ def __init__( Args: method (Callable): The method that was originally called, and which instantiated this pager. - request (:class:`~.job_service.SearchJobsRequest`): + request (google.cloud.talent_v4beta1.types.SearchJobsRequest): The initial request object. - response (:class:`~.job_service.SearchJobsResponse`): + response (google.cloud.talent_v4beta1.types.SearchJobsResponse): The initial response object. metadata (Sequence[Tuple[str, str]]): Strings which should be sent along with the request as metadata. @@ -343,7 +343,7 @@ class SearchJobsForAlertAsyncPager: """A pager for iterating through ``search_jobs_for_alert`` requests. This class thinly wraps an initial - :class:`~.job_service.SearchJobsResponse` object, and + :class:`google.cloud.talent_v4beta1.types.SearchJobsResponse` object, and provides an ``__aiter__`` method to iterate through its ``matching_jobs`` field. @@ -352,7 +352,7 @@ class SearchJobsForAlertAsyncPager: through the ``matching_jobs`` field on the corresponding responses. - All the usual :class:`~.job_service.SearchJobsResponse` + All the usual :class:`google.cloud.talent_v4beta1.types.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. """ @@ -370,9 +370,9 @@ def __init__( Args: method (Callable): The method that was originally called, and which instantiated this pager. - request (:class:`~.job_service.SearchJobsRequest`): + request (google.cloud.talent_v4beta1.types.SearchJobsRequest): The initial request object. - response (:class:`~.job_service.SearchJobsResponse`): + response (google.cloud.talent_v4beta1.types.SearchJobsResponse): The initial response object. metadata (Sequence[Tuple[str, str]]): Strings which should be sent along with the request as metadata. diff --git a/google/cloud/talent_v4beta1/services/job_service/transports/grpc.py b/google/cloud/talent_v4beta1/services/job_service/transports/grpc.py index c3526f6f..5bb5e55e 100644 --- a/google/cloud/talent_v4beta1/services/job_service/transports/grpc.py +++ b/google/cloud/talent_v4beta1/services/job_service/transports/grpc.py @@ -63,6 +63,7 @@ def __init__( api_mtls_endpoint: str = None, client_cert_source: Callable[[], Tuple[bytes, bytes]] = None, ssl_channel_credentials: grpc.ChannelCredentials = None, + client_cert_source_for_mtls: Callable[[], Tuple[bytes, bytes]] = None, quota_project_id: Optional[str] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, ) -> None: @@ -93,6 +94,10 @@ def __init__( ``api_mtls_endpoint`` is None. ssl_channel_credentials (grpc.ChannelCredentials): SSL credentials for grpc channel. It is ignored if ``channel`` is provided. + client_cert_source_for_mtls (Optional[Callable[[], Tuple[bytes, bytes]]]): + A callback to provide client certificate bytes and private key bytes, + both in PEM format. It is used to configure mutual TLS channel. It is + ignored if ``channel`` or ``ssl_channel_credentials`` is provided. quota_project_id (Optional[str]): An optional project to use for billing and quota. client_info (google.api_core.gapic_v1.client_info.ClientInfo): @@ -109,6 +114,11 @@ def __init__( """ self._ssl_channel_credentials = ssl_channel_credentials + if api_mtls_endpoint: + warnings.warn("api_mtls_endpoint is deprecated", DeprecationWarning) + if client_cert_source: + warnings.warn("client_cert_source is deprecated", DeprecationWarning) + if channel: # Sanity check: Ensure that channel and credentials are not both # provided. @@ -118,11 +128,6 @@ def __init__( self._grpc_channel = channel self._ssl_channel_credentials = None elif api_mtls_endpoint: - warnings.warn( - "api_mtls_endpoint and client_cert_source are deprecated", - DeprecationWarning, - ) - host = ( api_mtls_endpoint if ":" in api_mtls_endpoint @@ -166,12 +171,18 @@ def __init__( scopes=self.AUTH_SCOPES, quota_project_id=quota_project_id ) + if client_cert_source_for_mtls and not ssl_channel_credentials: + cert, key = client_cert_source_for_mtls() + self._ssl_channel_credentials = grpc.ssl_channel_credentials( + certificate_chain=cert, private_key=key + ) + # 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_channel_credentials, + ssl_credentials=self._ssl_channel_credentials, scopes=scopes or self.AUTH_SCOPES, quota_project_id=quota_project_id, options=[ 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 index 794df7cf..4372e90e 100644 --- a/google/cloud/talent_v4beta1/services/job_service/transports/grpc_asyncio.py +++ b/google/cloud/talent_v4beta1/services/job_service/transports/grpc_asyncio.py @@ -107,6 +107,7 @@ def __init__( api_mtls_endpoint: str = None, client_cert_source: Callable[[], Tuple[bytes, bytes]] = None, ssl_channel_credentials: grpc.ChannelCredentials = None, + client_cert_source_for_mtls: Callable[[], Tuple[bytes, bytes]] = None, quota_project_id=None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, ) -> None: @@ -138,6 +139,10 @@ def __init__( ``api_mtls_endpoint`` is None. ssl_channel_credentials (grpc.ChannelCredentials): SSL credentials for grpc channel. It is ignored if ``channel`` is provided. + client_cert_source_for_mtls (Optional[Callable[[], Tuple[bytes, bytes]]]): + A callback to provide client certificate bytes and private key bytes, + both in PEM format. It is used to configure mutual TLS channel. It is + ignored if ``channel`` or ``ssl_channel_credentials`` is provided. quota_project_id (Optional[str]): An optional project to use for billing and quota. client_info (google.api_core.gapic_v1.client_info.ClientInfo): @@ -154,6 +159,11 @@ def __init__( """ self._ssl_channel_credentials = ssl_channel_credentials + if api_mtls_endpoint: + warnings.warn("api_mtls_endpoint is deprecated", DeprecationWarning) + if client_cert_source: + warnings.warn("client_cert_source is deprecated", DeprecationWarning) + if channel: # Sanity check: Ensure that channel and credentials are not both # provided. @@ -163,11 +173,6 @@ def __init__( self._grpc_channel = channel self._ssl_channel_credentials = None elif api_mtls_endpoint: - warnings.warn( - "api_mtls_endpoint and client_cert_source are deprecated", - DeprecationWarning, - ) - host = ( api_mtls_endpoint if ":" in api_mtls_endpoint @@ -211,12 +216,18 @@ def __init__( scopes=self.AUTH_SCOPES, quota_project_id=quota_project_id ) + if client_cert_source_for_mtls and not ssl_channel_credentials: + cert, key = client_cert_source_for_mtls() + self._ssl_channel_credentials = grpc.ssl_channel_credentials( + certificate_chain=cert, private_key=key + ) + # 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_channel_credentials, + ssl_credentials=self._ssl_channel_credentials, scopes=scopes or self.AUTH_SCOPES, quota_project_id=quota_project_id, options=[ diff --git a/google/cloud/talent_v4beta1/services/profile_service/async_client.py b/google/cloud/talent_v4beta1/services/profile_service/async_client.py index 914e2bf4..5ea23b8a 100644 --- a/google/cloud/talent_v4beta1/services/profile_service/async_client.py +++ b/google/cloud/talent_v4beta1/services/profile_service/async_client.py @@ -86,6 +86,7 @@ class ProfileServiceAsyncClient: ProfileServiceClient.parse_common_location_path ) + from_service_account_info = ProfileServiceClient.from_service_account_info from_service_account_file = ProfileServiceClient.from_service_account_file from_service_account_json = from_service_account_file @@ -162,7 +163,7 @@ async def list_profiles( r"""Lists profiles by filter. The order is unspecified. Args: - request (:class:`~.profile_service.ListProfilesRequest`): + request (:class:`google.cloud.talent_v4beta1.types.ListProfilesRequest`): The request object. List profiles request. parent (:class:`str`): Required. The resource name of the tenant under which @@ -171,6 +172,7 @@ async def list_profiles( 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. @@ -182,7 +184,7 @@ async def list_profiles( sent along with the request as metadata. Returns: - ~.pagers.ListProfilesAsyncPager: + google.cloud.talent_v4beta1.services.profile_service.pagers.ListProfilesAsyncPager: The List profiles response object. Iterating over this object will yield results and resolve additional pages @@ -254,7 +256,7 @@ async def create_profile( r"""Creates and returns a new profile. Args: - request (:class:`~.profile_service.CreateProfileRequest`): + request (:class:`google.cloud.talent_v4beta1.types.CreateProfileRequest`): The request object. Create profile request. parent (:class:`str`): Required. The name of the tenant this profile belongs @@ -263,10 +265,11 @@ async def create_profile( 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`): + profile (:class:`google.cloud.talent_v4beta1.types.Profile`): Required. The profile to be created. This corresponds to the ``profile`` field on the ``request`` instance; if ``request`` is provided, this @@ -279,7 +282,7 @@ async def create_profile( sent along with the request as metadata. Returns: - ~.gct_profile.Profile: + google.cloud.talent_v4beta1.types.Profile: A resource that represents the profile for a job candidate (also referred to as a "single-source @@ -338,7 +341,7 @@ async def get_profile( r"""Gets the specified profile. Args: - request (:class:`~.profile_service.GetProfileRequest`): + request (:class:`google.cloud.talent_v4beta1.types.GetProfileRequest`): The request object. Get profile request. name (:class:`str`): Required. Resource name of the profile to get. @@ -346,6 +349,7 @@ async def get_profile( 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. @@ -357,7 +361,7 @@ async def get_profile( sent along with the request as metadata. Returns: - ~.profile.Profile: + google.cloud.talent_v4beta1.types.Profile: A resource that represents the profile for a job candidate (also referred to as a "single-source @@ -423,9 +427,9 @@ async def update_profile( result. Args: - request (:class:`~.profile_service.UpdateProfileRequest`): + request (:class:`google.cloud.talent_v4beta1.types.UpdateProfileRequest`): The request object. Update profile request - profile (:class:`~.gct_profile.Profile`): + profile (:class:`google.cloud.talent_v4beta1.types.Profile`): Required. Profile to be updated. This corresponds to the ``profile`` field on the ``request`` instance; if ``request`` is provided, this @@ -438,7 +442,7 @@ async def update_profile( sent along with the request as metadata. Returns: - ~.gct_profile.Profile: + google.cloud.talent_v4beta1.types.Profile: A resource that represents the profile for a job candidate (also referred to as a "single-source @@ -499,7 +503,7 @@ async def delete_profile( or assignments associated. Args: - request (:class:`~.profile_service.DeleteProfileRequest`): + request (:class:`google.cloud.talent_v4beta1.types.DeleteProfileRequest`): The request object. Delete profile request. name (:class:`str`): Required. Resource name of the profile to be deleted. @@ -507,6 +511,7 @@ async def delete_profile( 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. @@ -581,7 +586,7 @@ async def search_profiles( for more information. Args: - request (:class:`~.profile_service.SearchProfilesRequest`): + request (:class:`google.cloud.talent_v4beta1.types.SearchProfilesRequest`): The request object. The request body of the `SearchProfiles` call. @@ -592,7 +597,7 @@ async def search_profiles( sent along with the request as metadata. Returns: - ~.pagers.SearchProfilesAsyncPager: + google.cloud.talent_v4beta1.services.profile_service.pagers.SearchProfilesAsyncPager: Response of SearchProfiles method. Iterating over this object will yield results and resolve additional pages diff --git a/google/cloud/talent_v4beta1/services/profile_service/client.py b/google/cloud/talent_v4beta1/services/profile_service/client.py index 4cef4bba..eb27801d 100644 --- a/google/cloud/talent_v4beta1/services/profile_service/client.py +++ b/google/cloud/talent_v4beta1/services/profile_service/client.py @@ -118,6 +118,22 @@ def _get_default_mtls_endpoint(api_endpoint): DEFAULT_ENDPOINT ) + @classmethod + def from_service_account_info(cls, info: dict, *args, **kwargs): + """Creates an instance of this client using the provided credentials info. + + Args: + info (dict): The service account private key info. + args: Additional arguments to pass to the constructor. + kwargs: Additional arguments to pass to the constructor. + + Returns: + ProfileServiceClient: The constructed client. + """ + credentials = service_account.Credentials.from_service_account_info(info) + kwargs["credentials"] = credentials + return cls(*args, **kwargs) + @classmethod def from_service_account_file(cls, filename: str, *args, **kwargs): """Creates an instance of this client using the provided credentials @@ -130,7 +146,7 @@ def from_service_account_file(cls, filename: str, *args, **kwargs): kwargs: Additional arguments to pass to the constructor. Returns: - {@api.name}: The constructed client. + ProfileServiceClient: The constructed client. """ credentials = service_account.Credentials.from_service_account_file(filename) kwargs["credentials"] = credentials @@ -251,10 +267,10 @@ def __init__( 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 (Union[str, ProfileServiceTransport]): The transport to use. If set to None, a transport is chosen automatically. - client_options (client_options_lib.ClientOptions): Custom options for the + client_options (google.api_core.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_ENDPOINT @@ -290,21 +306,17 @@ def __init__( util.strtobool(os.getenv("GOOGLE_API_USE_CLIENT_CERTIFICATE", "false")) ) - ssl_credentials = None + client_cert_source_func = None is_mtls = False if use_client_cert: if client_options.client_cert_source: - import grpc # type: ignore - - cert, key = client_options.client_cert_source() - ssl_credentials = grpc.ssl_channel_credentials( - certificate_chain=cert, private_key=key - ) is_mtls = True + client_cert_source_func = client_options.client_cert_source else: - creds = SslCredentials() - is_mtls = creds.is_mtls - ssl_credentials = creds.ssl_credentials if is_mtls else None + is_mtls = mtls.has_default_client_cert_source() + client_cert_source_func = ( + mtls.default_client_cert_source() if is_mtls else None + ) # Figure out which api endpoint to use. if client_options.api_endpoint is not None: @@ -347,7 +359,7 @@ def __init__( credentials_file=client_options.credentials_file, host=api_endpoint, scopes=client_options.scopes, - ssl_channel_credentials=ssl_credentials, + client_cert_source_for_mtls=client_cert_source_func, quota_project_id=client_options.quota_project_id, client_info=client_info, ) @@ -364,15 +376,16 @@ def list_profiles( r"""Lists profiles by filter. The order is unspecified. Args: - request (:class:`~.profile_service.ListProfilesRequest`): + request (google.cloud.talent_v4beta1.types.ListProfilesRequest): The request object. List profiles request. - parent (:class:`str`): + 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". + This corresponds to the ``parent`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -384,7 +397,7 @@ def list_profiles( sent along with the request as metadata. Returns: - ~.pagers.ListProfilesPager: + google.cloud.talent_v4beta1.services.profile_service.pagers.ListProfilesPager: The List profiles response object. Iterating over this object will yield results and resolve additional pages @@ -449,19 +462,20 @@ def create_profile( r"""Creates and returns a new profile. Args: - request (:class:`~.profile_service.CreateProfileRequest`): + request (google.cloud.talent_v4beta1.types.CreateProfileRequest): The request object. Create profile request. - parent (:class:`str`): + 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". + This corresponds to the ``parent`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - profile (:class:`~.gct_profile.Profile`): + profile (google.cloud.talent_v4beta1.types.Profile): Required. The profile to be created. This corresponds to the ``profile`` field on the ``request`` instance; if ``request`` is provided, this @@ -474,7 +488,7 @@ def create_profile( sent along with the request as metadata. Returns: - ~.gct_profile.Profile: + google.cloud.talent_v4beta1.types.Profile: A resource that represents the profile for a job candidate (also referred to as a "single-source @@ -534,14 +548,15 @@ def get_profile( r"""Gets the specified profile. Args: - request (:class:`~.profile_service.GetProfileRequest`): + request (google.cloud.talent_v4beta1.types.GetProfileRequest): The request object. Get profile request. - name (:class:`str`): + 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". + This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -553,7 +568,7 @@ def get_profile( sent along with the request as metadata. Returns: - ~.profile.Profile: + google.cloud.talent_v4beta1.types.Profile: A resource that represents the profile for a job candidate (also referred to as a "single-source @@ -612,9 +627,9 @@ def update_profile( result. Args: - request (:class:`~.profile_service.UpdateProfileRequest`): + request (google.cloud.talent_v4beta1.types.UpdateProfileRequest): The request object. Update profile request - profile (:class:`~.gct_profile.Profile`): + profile (google.cloud.talent_v4beta1.types.Profile): Required. Profile to be updated. This corresponds to the ``profile`` field on the ``request`` instance; if ``request`` is provided, this @@ -627,7 +642,7 @@ def update_profile( sent along with the request as metadata. Returns: - ~.gct_profile.Profile: + google.cloud.talent_v4beta1.types.Profile: A resource that represents the profile for a job candidate (also referred to as a "single-source @@ -689,14 +704,15 @@ def delete_profile( or assignments associated. Args: - request (:class:`~.profile_service.DeleteProfileRequest`): + request (google.cloud.talent_v4beta1.types.DeleteProfileRequest): The request object. Delete profile request. - name (:class:`str`): + 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". + This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -764,7 +780,7 @@ def search_profiles( for more information. Args: - request (:class:`~.profile_service.SearchProfilesRequest`): + request (google.cloud.talent_v4beta1.types.SearchProfilesRequest): The request object. The request body of the `SearchProfiles` call. @@ -775,7 +791,7 @@ def search_profiles( sent along with the request as metadata. Returns: - ~.pagers.SearchProfilesPager: + google.cloud.talent_v4beta1.services.profile_service.pagers.SearchProfilesPager: Response of SearchProfiles method. Iterating over this object will yield results and resolve additional pages diff --git a/google/cloud/talent_v4beta1/services/profile_service/pagers.py b/google/cloud/talent_v4beta1/services/profile_service/pagers.py index c2f71326..29de6067 100644 --- a/google/cloud/talent_v4beta1/services/profile_service/pagers.py +++ b/google/cloud/talent_v4beta1/services/profile_service/pagers.py @@ -26,7 +26,7 @@ class ListProfilesPager: """A pager for iterating through ``list_profiles`` requests. This class thinly wraps an initial - :class:`~.profile_service.ListProfilesResponse` object, and + :class:`google.cloud.talent_v4beta1.types.ListProfilesResponse` object, and provides an ``__iter__`` method to iterate through its ``profiles`` field. @@ -35,7 +35,7 @@ class ListProfilesPager: through the ``profiles`` field on the corresponding responses. - All the usual :class:`~.profile_service.ListProfilesResponse` + All the usual :class:`google.cloud.talent_v4beta1.types.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. """ @@ -53,9 +53,9 @@ def __init__( Args: method (Callable): The method that was originally called, and which instantiated this pager. - request (:class:`~.profile_service.ListProfilesRequest`): + request (google.cloud.talent_v4beta1.types.ListProfilesRequest): The initial request object. - response (:class:`~.profile_service.ListProfilesResponse`): + response (google.cloud.talent_v4beta1.types.ListProfilesResponse): The initial response object. metadata (Sequence[Tuple[str, str]]): Strings which should be sent along with the request as metadata. @@ -88,7 +88,7 @@ class ListProfilesAsyncPager: """A pager for iterating through ``list_profiles`` requests. This class thinly wraps an initial - :class:`~.profile_service.ListProfilesResponse` object, and + :class:`google.cloud.talent_v4beta1.types.ListProfilesResponse` object, and provides an ``__aiter__`` method to iterate through its ``profiles`` field. @@ -97,7 +97,7 @@ class ListProfilesAsyncPager: through the ``profiles`` field on the corresponding responses. - All the usual :class:`~.profile_service.ListProfilesResponse` + All the usual :class:`google.cloud.talent_v4beta1.types.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. """ @@ -115,9 +115,9 @@ def __init__( Args: method (Callable): The method that was originally called, and which instantiated this pager. - request (:class:`~.profile_service.ListProfilesRequest`): + request (google.cloud.talent_v4beta1.types.ListProfilesRequest): The initial request object. - response (:class:`~.profile_service.ListProfilesResponse`): + response (google.cloud.talent_v4beta1.types.ListProfilesResponse): The initial response object. metadata (Sequence[Tuple[str, str]]): Strings which should be sent along with the request as metadata. @@ -154,7 +154,7 @@ class SearchProfilesPager: """A pager for iterating through ``search_profiles`` requests. This class thinly wraps an initial - :class:`~.profile_service.SearchProfilesResponse` object, and + :class:`google.cloud.talent_v4beta1.types.SearchProfilesResponse` object, and provides an ``__iter__`` method to iterate through its ``histogram_query_results`` field. @@ -163,7 +163,7 @@ class SearchProfilesPager: through the ``histogram_query_results`` field on the corresponding responses. - All the usual :class:`~.profile_service.SearchProfilesResponse` + All the usual :class:`google.cloud.talent_v4beta1.types.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. """ @@ -181,9 +181,9 @@ def __init__( Args: method (Callable): The method that was originally called, and which instantiated this pager. - request (:class:`~.profile_service.SearchProfilesRequest`): + request (google.cloud.talent_v4beta1.types.SearchProfilesRequest): The initial request object. - response (:class:`~.profile_service.SearchProfilesResponse`): + response (google.cloud.talent_v4beta1.types.SearchProfilesResponse): The initial response object. metadata (Sequence[Tuple[str, str]]): Strings which should be sent along with the request as metadata. @@ -216,7 +216,7 @@ class SearchProfilesAsyncPager: """A pager for iterating through ``search_profiles`` requests. This class thinly wraps an initial - :class:`~.profile_service.SearchProfilesResponse` object, and + :class:`google.cloud.talent_v4beta1.types.SearchProfilesResponse` object, and provides an ``__aiter__`` method to iterate through its ``histogram_query_results`` field. @@ -225,7 +225,7 @@ class SearchProfilesAsyncPager: through the ``histogram_query_results`` field on the corresponding responses. - All the usual :class:`~.profile_service.SearchProfilesResponse` + All the usual :class:`google.cloud.talent_v4beta1.types.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. """ @@ -243,9 +243,9 @@ def __init__( Args: method (Callable): The method that was originally called, and which instantiated this pager. - request (:class:`~.profile_service.SearchProfilesRequest`): + request (google.cloud.talent_v4beta1.types.SearchProfilesRequest): The initial request object. - response (:class:`~.profile_service.SearchProfilesResponse`): + response (google.cloud.talent_v4beta1.types.SearchProfilesResponse): The initial response object. metadata (Sequence[Tuple[str, str]]): Strings which should be sent along with the request as metadata. diff --git a/google/cloud/talent_v4beta1/services/profile_service/transports/grpc.py b/google/cloud/talent_v4beta1/services/profile_service/transports/grpc.py index a0a0da7e..bd7e9231 100644 --- a/google/cloud/talent_v4beta1/services/profile_service/transports/grpc.py +++ b/google/cloud/talent_v4beta1/services/profile_service/transports/grpc.py @@ -61,6 +61,7 @@ def __init__( api_mtls_endpoint: str = None, client_cert_source: Callable[[], Tuple[bytes, bytes]] = None, ssl_channel_credentials: grpc.ChannelCredentials = None, + client_cert_source_for_mtls: Callable[[], Tuple[bytes, bytes]] = None, quota_project_id: Optional[str] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, ) -> None: @@ -91,6 +92,10 @@ def __init__( ``api_mtls_endpoint`` is None. ssl_channel_credentials (grpc.ChannelCredentials): SSL credentials for grpc channel. It is ignored if ``channel`` is provided. + client_cert_source_for_mtls (Optional[Callable[[], Tuple[bytes, bytes]]]): + A callback to provide client certificate bytes and private key bytes, + both in PEM format. It is used to configure mutual TLS channel. It is + ignored if ``channel`` or ``ssl_channel_credentials`` is provided. quota_project_id (Optional[str]): An optional project to use for billing and quota. client_info (google.api_core.gapic_v1.client_info.ClientInfo): @@ -107,6 +112,11 @@ def __init__( """ self._ssl_channel_credentials = ssl_channel_credentials + if api_mtls_endpoint: + warnings.warn("api_mtls_endpoint is deprecated", DeprecationWarning) + if client_cert_source: + warnings.warn("client_cert_source is deprecated", DeprecationWarning) + if channel: # Sanity check: Ensure that channel and credentials are not both # provided. @@ -116,11 +126,6 @@ def __init__( self._grpc_channel = channel self._ssl_channel_credentials = None elif api_mtls_endpoint: - warnings.warn( - "api_mtls_endpoint and client_cert_source are deprecated", - DeprecationWarning, - ) - host = ( api_mtls_endpoint if ":" in api_mtls_endpoint @@ -164,12 +169,18 @@ def __init__( scopes=self.AUTH_SCOPES, quota_project_id=quota_project_id ) + if client_cert_source_for_mtls and not ssl_channel_credentials: + cert, key = client_cert_source_for_mtls() + self._ssl_channel_credentials = grpc.ssl_channel_credentials( + certificate_chain=cert, private_key=key + ) + # 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_channel_credentials, + ssl_credentials=self._ssl_channel_credentials, scopes=scopes or self.AUTH_SCOPES, quota_project_id=quota_project_id, options=[ 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 index 6db1ab4b..99ed219b 100644 --- a/google/cloud/talent_v4beta1/services/profile_service/transports/grpc_asyncio.py +++ b/google/cloud/talent_v4beta1/services/profile_service/transports/grpc_asyncio.py @@ -105,6 +105,7 @@ def __init__( api_mtls_endpoint: str = None, client_cert_source: Callable[[], Tuple[bytes, bytes]] = None, ssl_channel_credentials: grpc.ChannelCredentials = None, + client_cert_source_for_mtls: Callable[[], Tuple[bytes, bytes]] = None, quota_project_id=None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, ) -> None: @@ -136,6 +137,10 @@ def __init__( ``api_mtls_endpoint`` is None. ssl_channel_credentials (grpc.ChannelCredentials): SSL credentials for grpc channel. It is ignored if ``channel`` is provided. + client_cert_source_for_mtls (Optional[Callable[[], Tuple[bytes, bytes]]]): + A callback to provide client certificate bytes and private key bytes, + both in PEM format. It is used to configure mutual TLS channel. It is + ignored if ``channel`` or ``ssl_channel_credentials`` is provided. quota_project_id (Optional[str]): An optional project to use for billing and quota. client_info (google.api_core.gapic_v1.client_info.ClientInfo): @@ -152,6 +157,11 @@ def __init__( """ self._ssl_channel_credentials = ssl_channel_credentials + if api_mtls_endpoint: + warnings.warn("api_mtls_endpoint is deprecated", DeprecationWarning) + if client_cert_source: + warnings.warn("client_cert_source is deprecated", DeprecationWarning) + if channel: # Sanity check: Ensure that channel and credentials are not both # provided. @@ -161,11 +171,6 @@ def __init__( self._grpc_channel = channel self._ssl_channel_credentials = None elif api_mtls_endpoint: - warnings.warn( - "api_mtls_endpoint and client_cert_source are deprecated", - DeprecationWarning, - ) - host = ( api_mtls_endpoint if ":" in api_mtls_endpoint @@ -209,12 +214,18 @@ def __init__( scopes=self.AUTH_SCOPES, quota_project_id=quota_project_id ) + if client_cert_source_for_mtls and not ssl_channel_credentials: + cert, key = client_cert_source_for_mtls() + self._ssl_channel_credentials = grpc.ssl_channel_credentials( + certificate_chain=cert, private_key=key + ) + # 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_channel_credentials, + ssl_credentials=self._ssl_channel_credentials, scopes=scopes or self.AUTH_SCOPES, quota_project_id=quota_project_id, options=[ diff --git a/google/cloud/talent_v4beta1/services/tenant_service/async_client.py b/google/cloud/talent_v4beta1/services/tenant_service/async_client.py index be6fce85..450811a6 100644 --- a/google/cloud/talent_v4beta1/services/tenant_service/async_client.py +++ b/google/cloud/talent_v4beta1/services/tenant_service/async_client.py @@ -80,6 +80,7 @@ class TenantServiceAsyncClient: TenantServiceClient.parse_common_location_path ) + from_service_account_info = TenantServiceClient.from_service_account_info from_service_account_file = TenantServiceClient.from_service_account_file from_service_account_json = from_service_account_file @@ -157,7 +158,7 @@ async def create_tenant( r"""Creates a new tenant entity. Args: - request (:class:`~.tenant_service.CreateTenantRequest`): + request (:class:`google.cloud.talent_v4beta1.types.CreateTenantRequest`): The request object. The Request of the CreateTenant method. parent (:class:`str`): @@ -166,10 +167,11 @@ async def create_tenant( 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`): + tenant (:class:`google.cloud.talent_v4beta1.types.Tenant`): Required. The tenant to be created. This corresponds to the ``tenant`` field on the ``request`` instance; if ``request`` is provided, this @@ -182,7 +184,7 @@ async def create_tenant( sent along with the request as metadata. Returns: - ~.gct_tenant.Tenant: + google.cloud.talent_v4beta1.types.Tenant: A Tenant resource represents a tenant in the service. A tenant is a group or entity that shares common access with @@ -244,7 +246,7 @@ async def get_tenant( r"""Retrieves specified tenant. Args: - request (:class:`~.tenant_service.GetTenantRequest`): + request (:class:`google.cloud.talent_v4beta1.types.GetTenantRequest`): The request object. Request for getting a tenant by name. name (:class:`str`): @@ -254,6 +256,7 @@ async def get_tenant( 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. @@ -265,7 +268,7 @@ async def get_tenant( sent along with the request as metadata. Returns: - ~.tenant.Tenant: + google.cloud.talent_v4beta1.types.Tenant: A Tenant resource represents a tenant in the service. A tenant is a group or entity that shares common access with @@ -333,13 +336,14 @@ async def update_tenant( r"""Updates specified tenant. Args: - request (:class:`~.tenant_service.UpdateTenantRequest`): + request (:class:`google.cloud.talent_v4beta1.types.UpdateTenantRequest`): The request object. Request for updating a specified tenant. - tenant (:class:`~.gct_tenant.Tenant`): + tenant (:class:`google.cloud.talent_v4beta1.types.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. @@ -351,7 +355,7 @@ async def update_tenant( sent along with the request as metadata. Returns: - ~.gct_tenant.Tenant: + google.cloud.talent_v4beta1.types.Tenant: A Tenant resource represents a tenant in the service. A tenant is a group or entity that shares common access with @@ -413,7 +417,7 @@ async def delete_tenant( r"""Deletes specified tenant. Args: - request (:class:`~.tenant_service.DeleteTenantRequest`): + request (:class:`google.cloud.talent_v4beta1.types.DeleteTenantRequest`): The request object. Request to delete a tenant. name (:class:`str`): Required. The resource name of the tenant to be deleted. @@ -421,6 +425,7 @@ async def delete_tenant( 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. @@ -488,7 +493,7 @@ async def list_tenants( r"""Lists all tenants associated with the project. Args: - request (:class:`~.tenant_service.ListTenantsRequest`): + request (:class:`google.cloud.talent_v4beta1.types.ListTenantsRequest`): The request object. List tenants for which the client has ACL visibility. parent (:class:`str`): @@ -497,6 +502,7 @@ async def list_tenants( 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. @@ -508,7 +514,7 @@ async def list_tenants( sent along with the request as metadata. Returns: - ~.pagers.ListTenantsAsyncPager: + google.cloud.talent_v4beta1.services.tenant_service.pagers.ListTenantsAsyncPager: The List tenants response object. Iterating over this object will yield results and resolve additional pages diff --git a/google/cloud/talent_v4beta1/services/tenant_service/client.py b/google/cloud/talent_v4beta1/services/tenant_service/client.py index 52898cda..e0750d74 100644 --- a/google/cloud/talent_v4beta1/services/tenant_service/client.py +++ b/google/cloud/talent_v4beta1/services/tenant_service/client.py @@ -112,6 +112,22 @@ def _get_default_mtls_endpoint(api_endpoint): DEFAULT_ENDPOINT ) + @classmethod + def from_service_account_info(cls, info: dict, *args, **kwargs): + """Creates an instance of this client using the provided credentials info. + + Args: + info (dict): The service account private key info. + args: Additional arguments to pass to the constructor. + kwargs: Additional arguments to pass to the constructor. + + Returns: + TenantServiceClient: The constructed client. + """ + credentials = service_account.Credentials.from_service_account_info(info) + kwargs["credentials"] = credentials + return cls(*args, **kwargs) + @classmethod def from_service_account_file(cls, filename: str, *args, **kwargs): """Creates an instance of this client using the provided credentials @@ -124,7 +140,7 @@ def from_service_account_file(cls, filename: str, *args, **kwargs): kwargs: Additional arguments to pass to the constructor. Returns: - {@api.name}: The constructed client. + TenantServiceClient: The constructed client. """ credentials = service_account.Credentials.from_service_account_file(filename) kwargs["credentials"] = credentials @@ -229,10 +245,10 @@ def __init__( 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 (Union[str, TenantServiceTransport]): The transport to use. If set to None, a transport is chosen automatically. - client_options (client_options_lib.ClientOptions): Custom options for the + client_options (google.api_core.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_ENDPOINT @@ -268,21 +284,17 @@ def __init__( util.strtobool(os.getenv("GOOGLE_API_USE_CLIENT_CERTIFICATE", "false")) ) - ssl_credentials = None + client_cert_source_func = None is_mtls = False if use_client_cert: if client_options.client_cert_source: - import grpc # type: ignore - - cert, key = client_options.client_cert_source() - ssl_credentials = grpc.ssl_channel_credentials( - certificate_chain=cert, private_key=key - ) is_mtls = True + client_cert_source_func = client_options.client_cert_source else: - creds = SslCredentials() - is_mtls = creds.is_mtls - ssl_credentials = creds.ssl_credentials if is_mtls else None + is_mtls = mtls.has_default_client_cert_source() + client_cert_source_func = ( + mtls.default_client_cert_source() if is_mtls else None + ) # Figure out which api endpoint to use. if client_options.api_endpoint is not None: @@ -325,7 +337,7 @@ def __init__( credentials_file=client_options.credentials_file, host=api_endpoint, scopes=client_options.scopes, - ssl_channel_credentials=ssl_credentials, + client_cert_source_for_mtls=client_cert_source_func, quota_project_id=client_options.quota_project_id, client_info=client_info, ) @@ -343,19 +355,20 @@ def create_tenant( r"""Creates a new tenant entity. Args: - request (:class:`~.tenant_service.CreateTenantRequest`): + request (google.cloud.talent_v4beta1.types.CreateTenantRequest): The request object. The Request of the CreateTenant method. - parent (:class:`str`): + parent (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`): + tenant (google.cloud.talent_v4beta1.types.Tenant): Required. The tenant to be created. This corresponds to the ``tenant`` field on the ``request`` instance; if ``request`` is provided, this @@ -368,7 +381,7 @@ def create_tenant( sent along with the request as metadata. Returns: - ~.gct_tenant.Tenant: + google.cloud.talent_v4beta1.types.Tenant: A Tenant resource represents a tenant in the service. A tenant is a group or entity that shares common access with @@ -431,16 +444,17 @@ def get_tenant( r"""Retrieves specified tenant. Args: - request (:class:`~.tenant_service.GetTenantRequest`): + request (google.cloud.talent_v4beta1.types.GetTenantRequest): The request object. Request for getting a tenant by name. - name (:class:`str`): + 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". + This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -452,7 +466,7 @@ def get_tenant( sent along with the request as metadata. Returns: - ~.tenant.Tenant: + google.cloud.talent_v4beta1.types.Tenant: A Tenant resource represents a tenant in the service. A tenant is a group or entity that shares common access with @@ -513,13 +527,14 @@ def update_tenant( r"""Updates specified tenant. Args: - request (:class:`~.tenant_service.UpdateTenantRequest`): + request (google.cloud.talent_v4beta1.types.UpdateTenantRequest): The request object. Request for updating a specified tenant. - tenant (:class:`~.gct_tenant.Tenant`): + tenant (google.cloud.talent_v4beta1.types.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. @@ -531,7 +546,7 @@ def update_tenant( sent along with the request as metadata. Returns: - ~.gct_tenant.Tenant: + google.cloud.talent_v4beta1.types.Tenant: A Tenant resource represents a tenant in the service. A tenant is a group or entity that shares common access with @@ -594,14 +609,15 @@ def delete_tenant( r"""Deletes specified tenant. Args: - request (:class:`~.tenant_service.DeleteTenantRequest`): + request (google.cloud.talent_v4beta1.types.DeleteTenantRequest): The request object. Request to delete a tenant. - name (:class:`str`): + 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". + This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -662,15 +678,16 @@ def list_tenants( r"""Lists all tenants associated with the project. Args: - request (:class:`~.tenant_service.ListTenantsRequest`): + request (google.cloud.talent_v4beta1.types.ListTenantsRequest): The request object. List tenants for which the client has ACL visibility. - parent (:class:`str`): + parent (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. @@ -682,7 +699,7 @@ def list_tenants( sent along with the request as metadata. Returns: - ~.pagers.ListTenantsPager: + google.cloud.talent_v4beta1.services.tenant_service.pagers.ListTenantsPager: The List tenants response object. Iterating over this object will yield results and resolve additional pages diff --git a/google/cloud/talent_v4beta1/services/tenant_service/pagers.py b/google/cloud/talent_v4beta1/services/tenant_service/pagers.py index 99dfee65..5adc6788 100644 --- a/google/cloud/talent_v4beta1/services/tenant_service/pagers.py +++ b/google/cloud/talent_v4beta1/services/tenant_service/pagers.py @@ -25,7 +25,7 @@ class ListTenantsPager: """A pager for iterating through ``list_tenants`` requests. This class thinly wraps an initial - :class:`~.tenant_service.ListTenantsResponse` object, and + :class:`google.cloud.talent_v4beta1.types.ListTenantsResponse` object, and provides an ``__iter__`` method to iterate through its ``tenants`` field. @@ -34,7 +34,7 @@ class ListTenantsPager: through the ``tenants`` field on the corresponding responses. - All the usual :class:`~.tenant_service.ListTenantsResponse` + All the usual :class:`google.cloud.talent_v4beta1.types.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. """ @@ -52,9 +52,9 @@ def __init__( Args: method (Callable): The method that was originally called, and which instantiated this pager. - request (:class:`~.tenant_service.ListTenantsRequest`): + request (google.cloud.talent_v4beta1.types.ListTenantsRequest): The initial request object. - response (:class:`~.tenant_service.ListTenantsResponse`): + response (google.cloud.talent_v4beta1.types.ListTenantsResponse): The initial response object. metadata (Sequence[Tuple[str, str]]): Strings which should be sent along with the request as metadata. @@ -87,7 +87,7 @@ class ListTenantsAsyncPager: """A pager for iterating through ``list_tenants`` requests. This class thinly wraps an initial - :class:`~.tenant_service.ListTenantsResponse` object, and + :class:`google.cloud.talent_v4beta1.types.ListTenantsResponse` object, and provides an ``__aiter__`` method to iterate through its ``tenants`` field. @@ -96,7 +96,7 @@ class ListTenantsAsyncPager: through the ``tenants`` field on the corresponding responses. - All the usual :class:`~.tenant_service.ListTenantsResponse` + All the usual :class:`google.cloud.talent_v4beta1.types.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. """ @@ -114,9 +114,9 @@ def __init__( Args: method (Callable): The method that was originally called, and which instantiated this pager. - request (:class:`~.tenant_service.ListTenantsRequest`): + request (google.cloud.talent_v4beta1.types.ListTenantsRequest): The initial request object. - response (:class:`~.tenant_service.ListTenantsResponse`): + response (google.cloud.talent_v4beta1.types.ListTenantsResponse): The initial response object. metadata (Sequence[Tuple[str, str]]): Strings which should be sent along with the request as metadata. diff --git a/google/cloud/talent_v4beta1/services/tenant_service/transports/grpc.py b/google/cloud/talent_v4beta1/services/tenant_service/transports/grpc.py index eae306f9..84a88116 100644 --- a/google/cloud/talent_v4beta1/services/tenant_service/transports/grpc.py +++ b/google/cloud/talent_v4beta1/services/tenant_service/transports/grpc.py @@ -61,6 +61,7 @@ def __init__( api_mtls_endpoint: str = None, client_cert_source: Callable[[], Tuple[bytes, bytes]] = None, ssl_channel_credentials: grpc.ChannelCredentials = None, + client_cert_source_for_mtls: Callable[[], Tuple[bytes, bytes]] = None, quota_project_id: Optional[str] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, ) -> None: @@ -91,6 +92,10 @@ def __init__( ``api_mtls_endpoint`` is None. ssl_channel_credentials (grpc.ChannelCredentials): SSL credentials for grpc channel. It is ignored if ``channel`` is provided. + client_cert_source_for_mtls (Optional[Callable[[], Tuple[bytes, bytes]]]): + A callback to provide client certificate bytes and private key bytes, + both in PEM format. It is used to configure mutual TLS channel. It is + ignored if ``channel`` or ``ssl_channel_credentials`` is provided. quota_project_id (Optional[str]): An optional project to use for billing and quota. client_info (google.api_core.gapic_v1.client_info.ClientInfo): @@ -107,6 +112,11 @@ def __init__( """ self._ssl_channel_credentials = ssl_channel_credentials + if api_mtls_endpoint: + warnings.warn("api_mtls_endpoint is deprecated", DeprecationWarning) + if client_cert_source: + warnings.warn("client_cert_source is deprecated", DeprecationWarning) + if channel: # Sanity check: Ensure that channel and credentials are not both # provided. @@ -116,11 +126,6 @@ def __init__( self._grpc_channel = channel self._ssl_channel_credentials = None elif api_mtls_endpoint: - warnings.warn( - "api_mtls_endpoint and client_cert_source are deprecated", - DeprecationWarning, - ) - host = ( api_mtls_endpoint if ":" in api_mtls_endpoint @@ -164,12 +169,18 @@ def __init__( scopes=self.AUTH_SCOPES, quota_project_id=quota_project_id ) + if client_cert_source_for_mtls and not ssl_channel_credentials: + cert, key = client_cert_source_for_mtls() + self._ssl_channel_credentials = grpc.ssl_channel_credentials( + certificate_chain=cert, private_key=key + ) + # 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_channel_credentials, + ssl_credentials=self._ssl_channel_credentials, scopes=scopes or self.AUTH_SCOPES, quota_project_id=quota_project_id, options=[ 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 index cec885b2..c371fbdb 100644 --- a/google/cloud/talent_v4beta1/services/tenant_service/transports/grpc_asyncio.py +++ b/google/cloud/talent_v4beta1/services/tenant_service/transports/grpc_asyncio.py @@ -105,6 +105,7 @@ def __init__( api_mtls_endpoint: str = None, client_cert_source: Callable[[], Tuple[bytes, bytes]] = None, ssl_channel_credentials: grpc.ChannelCredentials = None, + client_cert_source_for_mtls: Callable[[], Tuple[bytes, bytes]] = None, quota_project_id=None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, ) -> None: @@ -136,6 +137,10 @@ def __init__( ``api_mtls_endpoint`` is None. ssl_channel_credentials (grpc.ChannelCredentials): SSL credentials for grpc channel. It is ignored if ``channel`` is provided. + client_cert_source_for_mtls (Optional[Callable[[], Tuple[bytes, bytes]]]): + A callback to provide client certificate bytes and private key bytes, + both in PEM format. It is used to configure mutual TLS channel. It is + ignored if ``channel`` or ``ssl_channel_credentials`` is provided. quota_project_id (Optional[str]): An optional project to use for billing and quota. client_info (google.api_core.gapic_v1.client_info.ClientInfo): @@ -152,6 +157,11 @@ def __init__( """ self._ssl_channel_credentials = ssl_channel_credentials + if api_mtls_endpoint: + warnings.warn("api_mtls_endpoint is deprecated", DeprecationWarning) + if client_cert_source: + warnings.warn("client_cert_source is deprecated", DeprecationWarning) + if channel: # Sanity check: Ensure that channel and credentials are not both # provided. @@ -161,11 +171,6 @@ def __init__( self._grpc_channel = channel self._ssl_channel_credentials = None elif api_mtls_endpoint: - warnings.warn( - "api_mtls_endpoint and client_cert_source are deprecated", - DeprecationWarning, - ) - host = ( api_mtls_endpoint if ":" in api_mtls_endpoint @@ -209,12 +214,18 @@ def __init__( scopes=self.AUTH_SCOPES, quota_project_id=quota_project_id ) + if client_cert_source_for_mtls and not ssl_channel_credentials: + cert, key = client_cert_source_for_mtls() + self._ssl_channel_credentials = grpc.ssl_channel_credentials( + certificate_chain=cert, private_key=key + ) + # 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_channel_credentials, + ssl_credentials=self._ssl_channel_credentials, scopes=scopes or self.AUTH_SCOPES, quota_project_id=quota_project_id, options=[ diff --git a/google/cloud/talent_v4beta1/types/application.py b/google/cloud/talent_v4beta1/types/application.py index c407b4bc..41eda976 100644 --- a/google/cloud/talent_v4beta1/types/application.py +++ b/google/cloud/talent_v4beta1/types/application.py @@ -69,9 +69,9 @@ class Application(proto.Message): The format is "projects/{project_id}/tenants/{tenant_id}/companies/{company_id}". For example, "projects/foo/tenants/bar/companies/baz". - application_date (~.date.Date): + application_date (google.type.date_pb2.Date): The application date. - stage (~.application.Application.ApplicationStage): + stage (google.cloud.talent_v4beta1.types.Application.ApplicationStage): Required. What is the most recent stage of the application (that is, new, screen, send cv, hired, finished work)? This field is @@ -79,19 +79,19 @@ class Application(proto.Message): possible status, but instead, represents statuses that would be used to indicate to the ML models good / bad matches. - state (~.application.Application.ApplicationState): + state (google.cloud.talent_v4beta1.types.Application.ApplicationState): The application state. - interviews (Sequence[~.common.Interview]): + interviews (Sequence[google.cloud.talent_v4beta1.types.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): + referral (google.protobuf.wrappers_pb2.BoolValue): If the candidate is referred by a employee. - create_time (~.timestamp.Timestamp): + create_time (google.protobuf.timestamp_pb2.Timestamp): Required. Reflects the time that the application was created. - update_time (~.timestamp.Timestamp): + update_time (google.protobuf.timestamp_pb2.Timestamp): The last update timestamp. outcome_notes (str): Free text reason behind the recruitement @@ -99,10 +99,10 @@ class Application(proto.Message): reject, reason for an unsuccessful finish, and so on). Number of characters allowed is 100. - outcome (~.common.Outcome): + outcome (google.cloud.talent_v4beta1.types.Outcome): Outcome positiveness shows how positive the outcome is. - is_match (~.wrappers.BoolValue): + is_match (google.protobuf.wrappers_pb2.BoolValue): Output only. Indicates whether this job application is a match to application related filters. This value is only applicable in diff --git a/google/cloud/talent_v4beta1/types/application_service.py b/google/cloud/talent_v4beta1/types/application_service.py index 8c906e91..81a0bae8 100644 --- a/google/cloud/talent_v4beta1/types/application_service.py +++ b/google/cloud/talent_v4beta1/types/application_service.py @@ -47,7 +47,7 @@ class CreateApplicationRequest(proto.Message): The format is "projects/{project_id}/tenants/{tenant_id}/profiles/{profile_id}". For example, "projects/foo/tenants/bar/profiles/baz". - application (~.gct_application.Application): + application (google.cloud.talent_v4beta1.types.Application): Required. The application to be created. """ @@ -79,10 +79,10 @@ class UpdateApplicationRequest(proto.Message): r"""Request for updating a specified application. Attributes: - application (~.gct_application.Application): + application (google.cloud.talent_v4beta1.types.Application): Required. The application resource to replace the current resource in the system. - update_mask (~.field_mask.FieldMask): + update_mask (google.protobuf.field_mask_pb2.FieldMask): Strongly recommended for the best service experience. If @@ -152,11 +152,11 @@ class ListApplicationsResponse(proto.Message): r"""The List applications response object. Attributes: - applications (Sequence[~.gct_application.Application]): + applications (Sequence[google.cloud.talent_v4beta1.types.Application]): Applications for the current client. next_page_token (str): A token to retrieve the next page of results. - metadata (~.common.ResponseMetadata): + metadata (google.cloud.talent_v4beta1.types.ResponseMetadata): Additional information for the API invocation, such as the request tracking id. """ diff --git a/google/cloud/talent_v4beta1/types/common.py b/google/cloud/talent_v4beta1/types/common.py index 61614a0a..c1cdd9b5 100644 --- a/google/cloud/talent_v4beta1/types/common.py +++ b/google/cloud/talent_v4beta1/types/common.py @@ -254,9 +254,9 @@ class TimestampRange(proto.Message): r"""Message representing a period of time between two timestamps. Attributes: - start_time (~.timestamp.Timestamp): + start_time (google.protobuf.timestamp_pb2.Timestamp): Begin of the period (inclusive). - end_time (~.timestamp.Timestamp): + end_time (google.protobuf.timestamp_pb2.Timestamp): End of the period (exclusive). """ @@ -270,7 +270,7 @@ class Location(proto.Message): information. Attributes: - location_type (~.common.Location.LocationType): + location_type (google.cloud.talent_v4beta1.types.Location.LocationType): The type of a location, which corresponds to the address lines field of [google.type.PostalAddress][google.type.PostalAddress]. For @@ -278,13 +278,13 @@ class Location(proto.Message): [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 (google.type.postal_address_pb2.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): + lat_lng (google.type.latlng_pb2.LatLng): An object representing a latitude/longitude pair. radius_miles (float): @@ -390,7 +390,7 @@ class RequestMetadata(proto.Message): and [user_id][google.cloud.talent.v4beta1.RequestMetadata.user_id] for the best service experience. - device_info (~.common.DeviceInfo): + device_info (google.cloud.talent_v4beta1.types.DeviceInfo): The type of device used by the job seeker at the time of the call to the service. """ @@ -426,7 +426,7 @@ class DeviceInfo(proto.Message): devices. Attributes: - device_type (~.common.DeviceInfo.DeviceType): + device_type (google.cloud.talent_v4beta1.types.DeviceInfo.DeviceType): Type of the device. id (str): A device-specific ID. The ID must be a unique @@ -532,14 +532,14 @@ class CompensationInfo(proto.Message): r"""Job compensation details. Attributes: - entries (Sequence[~.common.CompensationInfo.CompensationEntry]): + entries (Sequence[google.cloud.talent_v4beta1.types.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): + annualized_base_compensation_range (google.cloud.talent_v4beta1.types.CompensationInfo.CompensationRange): Output only. Annualized base compensation range. Computed as base compensation entry's [CompensationEntry.amount][google.cloud.talent.v4beta1.CompensationInfo.CompensationEntry.amount] @@ -549,7 +549,7 @@ class CompensationInfo(proto.Message): See [CompensationEntry][google.cloud.talent.v4beta1.CompensationInfo.CompensationEntry] for explanation on compensation annualization. - annualized_total_compensation_range (~.common.CompensationInfo.CompensationRange): + annualized_total_compensation_range (google.cloud.talent_v4beta1.types.CompensationInfo.CompensationRange): Output only. Annualized total compensation range. Computed as all compensation entries' [CompensationEntry.amount][google.cloud.talent.v4beta1.CompensationInfo.CompensationEntry.amount] @@ -631,25 +631,25 @@ class CompensationEntry(proto.Message): [expected_units_per_year][google.cloud.talent.v4beta1.CompensationInfo.CompensationEntry.expected_units_per_year]. Attributes: - type_ (~.common.CompensationInfo.CompensationType): + type_ (google.cloud.talent_v4beta1.types.CompensationInfo.CompensationType): Compensation type. Default is [CompensationType.COMPENSATION_TYPE_UNSPECIFIED][google.cloud.talent.v4beta1.CompensationInfo.CompensationType.COMPENSATION_TYPE_UNSPECIFIED]. - unit (~.common.CompensationInfo.CompensationUnit): + unit (google.cloud.talent_v4beta1.types.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): + amount (google.type.money_pb2.Money): Compensation amount. - range_ (~.common.CompensationInfo.CompensationRange): + range_ (google.cloud.talent_v4beta1.types.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_units_per_year (google.protobuf.wrappers_pb2.DoubleValue): Expected number of units paid each year. If not specified, when [Job.employment_types][google.cloud.talent.v4beta1.Job.employment_types] @@ -693,12 +693,12 @@ class CompensationRange(proto.Message): r"""Compensation range. Attributes: - max_compensation (~.money.Money): + max_compensation (google.type.money_pb2.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): + min_compensation (google.type.money_pb2.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 @@ -727,10 +727,10 @@ class Certification(proto.Message): display_name (str): Name of license or certification. Number of characters allowed is 100. - acquire_date (~.date.Date): + acquire_date (google.type.date_pb2.Date): Acquisition date or effective date of license or certification. - expire_date (~.date.Date): + expire_date (google.type.date_pb2.Date): Expiration date of license of certification. authority (str): Authority of license, such as government. @@ -760,9 +760,9 @@ class Skill(proto.Message): For example, "Java", "Python". Number of characters allowed is 100. - last_used_date (~.date.Date): + last_used_date (google.type.date_pb2.Date): The last time this skill was used. - level (~.common.SkillProficiencyLevel): + level (google.cloud.talent_v4beta1.types.SkillProficiencyLevel): Skill proficiency level which indicates how proficient the candidate is at this skill. context (str): @@ -791,9 +791,9 @@ class Interview(proto.Message): r"""Details of an interview. Attributes: - rating (~.common.Rating): + rating (google.cloud.talent_v4beta1.types.Rating): The rating on this interview. - outcome (~.common.Outcome): + outcome (google.cloud.talent_v4beta1.types.Outcome): Required. The overall decision resulting from this interview (positive, negative, nuetral). """ @@ -835,7 +835,7 @@ class BatchOperationMetadata(proto.Message): [google.longrunning.Operation.metadata][google.longrunning.Operation.metadata]. Attributes: - state (~.common.BatchOperationMetadata.State): + state (google.cloud.talent_v4beta1.types.BatchOperationMetadata.State): The state of a long running operation. state_description (str): More detailed information about operation @@ -847,14 +847,14 @@ class BatchOperationMetadata(proto.Message): Count of failed item(s) inside an operation. total_count (int): Count of total item(s) inside an operation. - create_time (~.timestamp.Timestamp): + create_time (google.protobuf.timestamp_pb2.Timestamp): The time when the batch operation is created. - update_time (~.timestamp.Timestamp): + update_time (google.protobuf.timestamp_pb2.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): + end_time (google.protobuf.timestamp_pb2.Timestamp): The time when the batch operation is finished and [google.longrunning.Operation.done][google.longrunning.Operation.done] is set to ``true``. diff --git a/google/cloud/talent_v4beta1/types/company.py b/google/cloud/talent_v4beta1/types/company.py index ac333e29..ed091608 100644 --- a/google/cloud/talent_v4beta1/types/company.py +++ b/google/cloud/talent_v4beta1/types/company.py @@ -53,7 +53,7 @@ class Company(proto.Message): used to uniquely identify the company. The maximum number of allowed characters is 255. - size (~.common.CompanySize): + size (google.cloud.talent_v4beta1.types.CompanySize): The employer's company size. headquarters_address (str): The street address of the company's main headquarters, which @@ -92,7 +92,7 @@ class Company(proto.Message): 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): + derived_info (google.cloud.talent_v4beta1.types.Company.DerivedInfo): Output only. Derived details about the company. suspended (bool): @@ -106,7 +106,7 @@ class DerivedInfo(proto.Message): r"""Derived details about the company. Attributes: - headquarters_location (~.common.Location): + headquarters_location (google.cloud.talent_v4beta1.types.Location): A structured headquarters location of the company, resolved from [Company.headquarters_address][google.cloud.talent.v4beta1.Company.headquarters_address] diff --git a/google/cloud/talent_v4beta1/types/company_service.py b/google/cloud/talent_v4beta1/types/company_service.py index 960ab39c..ab1de2b8 100644 --- a/google/cloud/talent_v4beta1/types/company_service.py +++ b/google/cloud/talent_v4beta1/types/company_service.py @@ -48,7 +48,7 @@ class CreateCompanyRequest(proto.Message): for example, "projects/foo/tenant/bar". If tenant id is unspecified, a default tenant is created, for example, "projects/foo". - company (~.gct_company.Company): + company (google.cloud.talent_v4beta1.types.Company): Required. The company to be created. """ @@ -80,10 +80,10 @@ class UpdateCompanyRequest(proto.Message): r"""Request for updating a specified company. Attributes: - company (~.gct_company.Company): + company (google.cloud.talent_v4beta1.types.Company): Required. The company resource to replace the current resource in the system. - update_mask (~.field_mask.FieldMask): + update_mask (google.protobuf.field_mask_pb2.FieldMask): Strongly recommended for the best service experience. If @@ -165,11 +165,11 @@ class ListCompaniesResponse(proto.Message): r"""The List companies response object. Attributes: - companies (Sequence[~.gct_company.Company]): + companies (Sequence[google.cloud.talent_v4beta1.types.Company]): Companies for the current client. next_page_token (str): A token to retrieve the next page of results. - metadata (~.common.ResponseMetadata): + metadata (google.cloud.talent_v4beta1.types.ResponseMetadata): Additional information for the API invocation, such as the request tracking id. """ diff --git a/google/cloud/talent_v4beta1/types/completion_service.py b/google/cloud/talent_v4beta1/types/completion_service.py index 69f4882a..1b53f07e 100644 --- a/google/cloud/talent_v4beta1/types/completion_service.py +++ b/google/cloud/talent_v4beta1/types/completion_service.py @@ -63,10 +63,10 @@ class CompleteQueryRequest(proto.Message): If tenant id is unspecified, the default tenant is used, for example, "projects/foo". - scope (~.completion_service.CompleteQueryRequest.CompletionScope): + scope (google.cloud.talent_v4beta1.types.CompleteQueryRequest.CompletionScope): The scope of the completion. The defaults is [CompletionScope.PUBLIC][google.cloud.talent.v4beta1.CompleteQueryRequest.CompletionScope.PUBLIC]. - type_ (~.completion_service.CompleteQueryRequest.CompletionType): + type_ (google.cloud.talent_v4beta1.types.CompleteQueryRequest.CompletionType): The completion topic. The default is [CompletionType.COMBINED][google.cloud.talent.v4beta1.CompleteQueryRequest.CompletionType.COMBINED]. """ @@ -103,10 +103,10 @@ class CompleteQueryResponse(proto.Message): r"""Response of auto-complete query. Attributes: - completion_results (Sequence[~.completion_service.CompleteQueryResponse.CompletionResult]): + completion_results (Sequence[google.cloud.talent_v4beta1.types.CompleteQueryResponse.CompletionResult]): Results of the matching job/company candidates. - metadata (~.common.ResponseMetadata): + metadata (google.cloud.talent_v4beta1.types.ResponseMetadata): Additional information for the API invocation, such as the request tracking id. """ @@ -117,7 +117,7 @@ class CompletionResult(proto.Message): Attributes: suggestion (str): The suggestion for the query. - type_ (~.completion_service.CompleteQueryRequest.CompletionType): + type_ (google.cloud.talent_v4beta1.types.CompleteQueryRequest.CompletionType): The completion topic. image_uri (str): The URI of the company image for diff --git a/google/cloud/talent_v4beta1/types/event.py b/google/cloud/talent_v4beta1/types/event.py index 4583b654..70cec508 100644 --- a/google/cloud/talent_v4beta1/types/event.py +++ b/google/cloud/talent_v4beta1/types/event.py @@ -45,13 +45,13 @@ class ClientEvent(proto.Message): event_id (str): Required. A unique identifier, generated by the client application. - create_time (~.timestamp.Timestamp): + create_time (google.protobuf.timestamp_pb2.Timestamp): Required. The timestamp of the event. - job_event (~.event.JobEvent): + job_event (google.cloud.talent_v4beta1.types.JobEvent): An event issued when a job seeker interacts with the application that implements Cloud Talent Solution. - profile_event (~.event.ProfileEvent): + profile_event (google.cloud.talent_v4beta1.types.ProfileEvent): An event issued when a profile searcher interacts with the application that implements Cloud Talent Solution. @@ -81,7 +81,7 @@ class JobEvent(proto.Message): application that implements Cloud Talent Solution. Attributes: - type_ (~.event.JobEvent.JobEventType): + type_ (google.cloud.talent_v4beta1.types.JobEvent.JobEventType): Required. The type of the event (see [JobEventType][google.cloud.talent.v4beta1.JobEvent.JobEventType]). jobs (Sequence[str]): @@ -139,7 +139,7 @@ class ProfileEvent(proto.Message): application that implements Cloud Talent Solution. Attributes: - type_ (~.event.ProfileEvent.ProfileEventType): + type_ (google.cloud.talent_v4beta1.types.ProfileEvent.ProfileEventType): Required. Type of event. profiles (Sequence[str]): Required. The [profile diff --git a/google/cloud/talent_v4beta1/types/event_service.py b/google/cloud/talent_v4beta1/types/event_service.py index dad4a639..d389c18f 100644 --- a/google/cloud/talent_v4beta1/types/event_service.py +++ b/google/cloud/talent_v4beta1/types/event_service.py @@ -38,7 +38,7 @@ class CreateClientEventRequest(proto.Message): for example, "projects/foo/tenant/bar". If tenant id is unspecified, a default tenant is created, for example, "projects/foo". - client_event (~.event.ClientEvent): + client_event (google.cloud.talent_v4beta1.types.ClientEvent): Required. Events issued when end user interacts with customer's application that uses Cloud Talent Solution. diff --git a/google/cloud/talent_v4beta1/types/filters.py b/google/cloud/talent_v4beta1/types/filters.py index 48d631b4..70f87f90 100644 --- a/google/cloud/talent_v4beta1/types/filters.py +++ b/google/cloud/talent_v4beta1/types/filters.py @@ -90,7 +90,7 @@ class JobQuery(proto.Message): example, "projects/foo/companies/bar". At most 20 company filters are allowed. - location_filters (Sequence[~.filters.LocationFilter]): + location_filters (Sequence[google.cloud.talent_v4beta1.types.LocationFilter]): The location filter specifies geo-regions containing the jobs to search against. See [LocationFilter][google.cloud.talent.v4beta1.LocationFilter] @@ -108,7 +108,7 @@ class JobQuery(proto.Message): locations. At most 5 location filters are allowed. - job_categories (Sequence[~.common.JobCategory]): + job_categories (Sequence[google.cloud.talent_v4beta1.types.JobCategory]): The category filter specifies the categories of jobs to search against. See [JobCategory][google.cloud.talent.v4beta1.JobCategory] for @@ -119,7 +119,7 @@ class JobQuery(proto.Message): If multiple values are specified, jobs from any of the specified categories are searched against. - commute_filter (~.filters.CommuteFilter): + commute_filter (google.cloud.talent_v4beta1.types.CommuteFilter): Allows filtering jobs by commute time with different travel methods (for example, driving or public transit). @@ -143,7 +143,7 @@ class JobQuery(proto.Message): companies. At most 20 company display name filters are allowed. - compensation_filter (~.filters.CompensationFilter): + compensation_filter (google.cloud.talent_v4beta1.types.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 @@ -182,7 +182,7 @@ class JobQuery(proto.Message): misspelled query, for example, "enginee" is corrected to "engineer". Defaults to false: a spell check is performed. - employment_types (Sequence[~.common.EmploymentType]): + employment_types (Sequence[google.cloud.talent_v4beta1.types.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]. @@ -205,7 +205,7 @@ class JobQuery(proto.Message): Languages `__. At most 10 language code filters are allowed. - publish_time_range (~.common.TimestampRange): + publish_time_range (google.cloud.talent_v4beta1.types.TimestampRange): Jobs published within a range specified by this filter are searched against. excluded_jobs (Sequence[str]): @@ -259,7 +259,7 @@ class ProfileQuery(proto.Message): Keywords to match any text fields of profiles. For example, "software engineer in Palo Alto". - location_filters (Sequence[~.filters.LocationFilter]): + location_filters (Sequence[google.cloud.talent_v4beta1.types.LocationFilter]): The location filter specifies geo-regions containing the profiles to search against. @@ -379,7 +379,7 @@ class ProfileQuery(proto.Message): 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_filters (Sequence[google.cloud.talent_v4beta1.types.JobTitleFilter]): Job title filter specifies job titles of profiles to match on. @@ -396,7 +396,7 @@ class ProfileQuery(proto.Message): For example, search for profiles with a job title "Product Manager". - employer_filters (Sequence[~.filters.EmployerFilter]): + employer_filters (Sequence[google.cloud.talent_v4beta1.types.EmployerFilter]): Employer filter specifies employers of profiles to match on. If an employer filter isn't specified, profiles with any @@ -412,7 +412,7 @@ class ProfileQuery(proto.Message): For example, search for profiles that have working experience at "Google LLC". - education_filters (Sequence[~.filters.EducationFilter]): + education_filters (Sequence[google.cloud.talent_v4beta1.types.EducationFilter]): Education filter specifies education of profiles to match on. @@ -428,7 +428,7 @@ class ProfileQuery(proto.Message): the educations. For example, search for profiles with a master degree. - skill_filters (Sequence[~.filters.SkillFilter]): + skill_filters (Sequence[google.cloud.talent_v4beta1.types.SkillFilter]): Skill filter specifies skill of profiles to match on. If a skill filter isn't specified, profiles with any skills @@ -444,7 +444,7 @@ class ProfileQuery(proto.Message): For example, search for profiles that have "Java" and "Python" in skill list. - work_experience_filter (Sequence[~.filters.WorkExperienceFilter]): + work_experience_filter (Sequence[google.cloud.talent_v4beta1.types.WorkExperienceFilter]): Work experience filter specifies the total working experience of profiles to match on. @@ -458,23 +458,23 @@ class ProfileQuery(proto.Message): For example, search for profiles with 10 years of work experience. - time_filters (Sequence[~.filters.TimeFilter]): + time_filters (Sequence[google.cloud.talent_v4beta1.types.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): + hirable_filter (google.protobuf.wrappers_pb2.BoolValue): The hirable filter specifies the profile's hirable status to match on. - application_date_filters (Sequence[~.filters.ApplicationDateFilter]): + application_date_filters (Sequence[google.cloud.talent_v4beta1.types.ApplicationDateFilter]): The application date filters specify application date ranges to match on. - application_outcome_notes_filters (Sequence[~.filters.ApplicationOutcomeNotesFilter]): + application_outcome_notes_filters (Sequence[google.cloud.talent_v4beta1.types.ApplicationOutcomeNotesFilter]): The application outcome notes filters specify the notes for the outcome of the job application. - application_job_filters (Sequence[~.filters.ApplicationJobFilter]): + application_job_filters (Sequence[google.cloud.talent_v4beta1.types.ApplicationJobFilter]): The application job filters specify the job applied for in the application. custom_attribute_filter (str): @@ -507,7 +507,7 @@ class ProfileQuery(proto.Message): Sample Query: (key1 = "TEST" OR LOWER(key1)="test" OR NOT EMPTY(key1)) - candidate_availability_filter (~.filters.CandidateAvailabilityFilter): + candidate_availability_filter (google.cloud.talent_v4beta1.types.CandidateAvailabilityFilter): Deprecated. Use availability_filters instead. The candidate availability filter which filters based on @@ -528,7 +528,7 @@ class ProfileQuery(proto.Message): 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]): + availability_filters (Sequence[google.cloud.talent_v4beta1.types.AvailabilityFilter]): The availability filter which filters based on [Profile.availability_signals][google.cloud.talent.v4beta1.Profile.availability_signals]. @@ -548,7 +548,7 @@ class ProfileQuery(proto.Message): for a [signal_type][google.cloud.talent.v4beta1.AvailabilityFilter.signal_type], an error is thrown. - person_name_filters (Sequence[~.filters.PersonNameFilter]): + person_name_filters (Sequence[google.cloud.talent_v4beta1.types.PersonNameFilter]): Person name filter specifies person name of profiles to match on. If multiple person name filters are specified, @@ -635,7 +635,7 @@ class LocationFilter(proto.Message): 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): + lat_lng (google.type.latlng_pb2.LatLng): The latitude and longitude of the geographic center to search from. This field is ignored if ``address`` is provided. @@ -644,7 +644,7 @@ class LocationFilter(proto.Message): 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): + telecommute_preference (google.cloud.talent_v4beta1.types.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. @@ -701,12 +701,12 @@ class CompensationFilter(proto.Message): r"""Filter on job compensation type and amount. Attributes: - type_ (~.filters.CompensationFilter.FilterType): + type_ (google.cloud.talent_v4beta1.types.CompensationFilter.FilterType): Required. Type of filter. - units (Sequence[~.common.CompensationInfo.CompensationUnit]): + units (Sequence[google.cloud.talent_v4beta1.types.CompensationInfo.CompensationUnit]): Required. Specify desired ``base compensation entry's`` [CompensationInfo.CompensationUnit][google.cloud.talent.v4beta1.CompensationInfo.CompensationUnit]. - range_ (~.common.CompensationInfo.CompensationRange): + range_ (google.cloud.talent_v4beta1.types.CompensationInfo.CompensationRange): Compensation range. include_jobs_with_unspecified_compensation_range (bool): If set to true, jobs with unspecified @@ -738,13 +738,13 @@ class CommuteFilter(proto.Message): r"""Parameters needed for commute search. Attributes: - commute_method (~.common.CommuteMethod): + commute_method (google.cloud.talent_v4beta1.types.CommuteMethod): Required. The method of transportation to calculate the commute time for. - start_coordinates (~.latlng.LatLng): + start_coordinates (google.type.latlng_pb2.LatLng): Required. The latitude and longitude of the location to calculate the commute time from. - travel_duration (~.duration.Duration): + travel_duration (google.protobuf.duration_pb2.Duration): Required. The maximum travel time in seconds. The maximum allowed value is ``3600s`` (one hour). Format is ``123s``. allow_imprecise_addresses (bool): @@ -754,10 +754,10 @@ class CommuteFilter(proto.Message): 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): + road_traffic (google.cloud.talent_v4beta1.types.CommuteFilter.RoadTraffic): Specifies the traffic density to use when calculating commute time. - departure_time (~.timeofday.TimeOfDay): + departure_time (google.type.timeofday_pb2.TimeOfDay): The departure time used to calculate traffic impact, represented as [google.type.TimeOfDay][google.type.TimeOfDay] in local time @@ -831,7 +831,7 @@ class EmployerFilter(proto.Message): employer (str): Required. The name of the employer, for example "Google", "Alphabet". - mode (~.filters.EmployerFilter.EmployerFilterMode): + mode (google.cloud.talent_v4beta1.types.EmployerFilter.EmployerFilterMode): Define set of [EmploymentRecord][google.cloud.talent.v4beta1.EmploymentRecord]s to search against. @@ -872,7 +872,7 @@ class EducationFilter(proto.Message): in [Degree.fields_of_study][google.cloud.talent.v4beta1.Degree.fields_of_study]. For example "Computer Science", "Mathematics". - degree_type (~.common.DegreeType): + degree_type (google.cloud.talent_v4beta1.types.DegreeType): Education degree in ISCED code. Each value in degree covers a specific level of education, without any expansion to upper nor lower levels @@ -901,10 +901,10 @@ class WorkExperienceFilter(proto.Message): [max_experience][google.cloud.talent.v4beta1.WorkExperienceFilter.max_experience]. Attributes: - min_experience (~.duration.Duration): + min_experience (google.protobuf.duration_pb2.Duration): The minimum duration of the work experience (inclusive). - max_experience (~.duration.Duration): + max_experience (google.protobuf.duration_pb2.Duration): The maximum duration of the work experience (exclusive). """ @@ -927,11 +927,11 @@ class ApplicationDateFilter(proto.Message): are missing. Attributes: - start_date (~.date.Date): + start_date (google.type.date_pb2.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 (google.type.date_pb2.Date): End date. If it's missing, The API matches profiles with application date not before the start date. @@ -996,17 +996,17 @@ class TimeFilter(proto.Message): r"""Filter on create timestamp or update timestamp of profiles. Attributes: - start_time (~.timestamp.Timestamp): + start_time (google.protobuf.timestamp_pb2.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_time (google.protobuf.timestamp_pb2.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): + time_field (google.cloud.talent_v4beta1.types.TimeFilter.TimeField): Specifies which time field to filter profiles. Defaults to @@ -1043,9 +1043,9 @@ class AvailabilityFilter(proto.Message): r"""Filter on availability signals. Attributes: - signal_type (~.common.AvailabilitySignalType): + signal_type (google.cloud.talent_v4beta1.types.AvailabilitySignalType): Required. Type of signal to apply filter on. - range_ (~.common.TimestampRange): + range_ (google.cloud.talent_v4beta1.types.TimestampRange): Required. Range of times to filter candidate signals by. required (bool): diff --git a/google/cloud/talent_v4beta1/types/histogram.py b/google/cloud/talent_v4beta1/types/histogram.py index 6c72e53e..b809ac0b 100644 --- a/google/cloud/talent_v4beta1/types/histogram.py +++ b/google/cloud/talent_v4beta1/types/histogram.py @@ -50,7 +50,7 @@ class HistogramQueryResult(proto.Message): Attributes: histogram_query (str): Requested histogram expression. - histogram (Sequence[~.gct_histogram.HistogramQueryResult.HistogramEntry]): + histogram (Sequence[google.cloud.talent_v4beta1.types.HistogramQueryResult.HistogramEntry]): A map from the values of the facet associated with distinct values to the number of matching entries with corresponding value. diff --git a/google/cloud/talent_v4beta1/types/job.py b/google/cloud/talent_v4beta1/types/job.py index 147fbe55..a378bbd5 100644 --- a/google/cloud/talent_v4beta1/types/job.py +++ b/google/cloud/talent_v4beta1/types/job.py @@ -117,15 +117,15 @@ class Job(proto.Message): experience. The maximum number of allowed characters is 500. - application_info (~.job.Job.ApplicationInfo): + application_info (google.cloud.talent_v4beta1.types.Job.ApplicationInfo): Job application information. - job_benefits (Sequence[~.common.JobBenefit]): + job_benefits (Sequence[google.cloud.talent_v4beta1.types.JobBenefit]): The benefits included with the job. - compensation_info (~.common.CompensationInfo): + compensation_info (google.cloud.talent_v4beta1.types.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]): + custom_attributes (Sequence[google.cloud.talent_v4beta1.types.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. @@ -140,7 +140,7 @@ class Job(proto.Message): than 255 characters. For unfilterable ``string_values``, the maximum total size of ``string_values`` across all keys is 50KB. - degree_types (Sequence[~.common.DegreeType]): + degree_types (Sequence[google.cloud.talent_v4beta1.types.DegreeType]): The desired education degrees for the job, such as Bachelors, Masters. department (str): @@ -148,7 +148,7 @@ class Job(proto.Message): company with the open position. The maximum number of allowed characters is 255. - employment_types (Sequence[~.common.EmploymentType]): + employment_types (Sequence[google.cloud.talent_v4beta1.types.EmploymentType]): The employment type(s) of a job, for example, [full time][google.cloud.talent.v4beta1.EmploymentType.FULL_TIME] or [part @@ -173,7 +173,7 @@ class Job(proto.Message): 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): + job_level (google.cloud.talent_v4beta1.types.JobLevel): The experience level associated with the job, such as "Entry Level". promotion_value (int): @@ -208,7 +208,7 @@ class Job(proto.Message): markup tags. The maximum number of allowed characters is 10,000. - posting_region (~.common.PostingRegion): + posting_region (google.cloud.talent_v4beta1.types.PostingRegion): The job [PostingRegion][google.cloud.talent.v4beta1.PostingRegion] (for example, state, country) throughout which the job is @@ -224,7 +224,7 @@ class Job(proto.Message): [Job.addresses][google.cloud.talent.v4beta1.Job.addresses] to the same location level as this field is strongly recommended. - visibility (~.common.Visibility): + visibility (google.cloud.talent_v4beta1.types.Visibility): Deprecated. The job is only visible to the owner. The visibility of the job. @@ -232,21 +232,21 @@ class Job(proto.Message): Defaults to [Visibility.ACCOUNT_ONLY][google.cloud.talent.v4beta1.Visibility.ACCOUNT_ONLY] if not specified. - job_start_time (~.timestamp.Timestamp): + job_start_time (google.protobuf.timestamp_pb2.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): + job_end_time (google.protobuf.timestamp_pb2.Timestamp): The end timestamp of the job. Typically this field is used for contracting engagements. Invalid timestamps are ignored. - posting_publish_time (~.timestamp.Timestamp): + posting_publish_time (google.protobuf.timestamp_pb2.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): + posting_expire_time (google.protobuf.timestamp_pb2.Timestamp): Strongly recommended for the best service experience. The expiration timestamp of the job. After this timestamp, @@ -304,19 +304,19 @@ class Job(proto.Message): 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): + posting_create_time (google.protobuf.timestamp_pb2.Timestamp): Output only. The timestamp when this job posting was created. - posting_update_time (~.timestamp.Timestamp): + posting_update_time (google.protobuf.timestamp_pb2.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): + derived_info (google.cloud.talent_v4beta1.types.Job.DerivedInfo): Output only. Derived details about the job posting. - processing_options (~.job.Job.ProcessingOptions): + processing_options (google.cloud.talent_v4beta1.types.Job.ProcessingOptions): Options for job processing. """ @@ -356,7 +356,7 @@ class DerivedInfo(proto.Message): r"""Derived details about the job posting. Attributes: - locations (Sequence[~.common.Location]): + locations (Sequence[google.cloud.talent_v4beta1.types.Location]): Structured locations of the job, resolved from [Job.addresses][google.cloud.talent.v4beta1.Job.addresses]. @@ -364,7 +364,7 @@ class DerivedInfo(proto.Message): are exactly matched to [Job.addresses][google.cloud.talent.v4beta1.Job.addresses] in the same order. - job_categories (Sequence[~.common.JobCategory]): + job_categories (Sequence[google.cloud.talent_v4beta1.types.JobCategory]): Job categories derived from [Job.title][google.cloud.talent.v4beta1.Job.title] and [Job.description][google.cloud.talent.v4beta1.Job.description]. @@ -385,7 +385,7 @@ class ProcessingOptions(proto.Message): 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): + html_sanitization (google.cloud.talent_v4beta1.types.HtmlSanitization): Option for job HTML content sanitization. Applied fields are: diff --git a/google/cloud/talent_v4beta1/types/job_service.py b/google/cloud/talent_v4beta1/types/job_service.py index 5cad2836..8ee4d6fa 100644 --- a/google/cloud/talent_v4beta1/types/job_service.py +++ b/google/cloud/talent_v4beta1/types/job_service.py @@ -73,7 +73,7 @@ class CreateJobRequest(proto.Message): For example, "projects/foo/tenant/bar". If tenant id is unspecified a default tenant is created. For example, "projects/foo". - job (~.gct_job.Job): + job (google.cloud.talent_v4beta1.types.Job): Required. The Job to be created. """ @@ -104,9 +104,9 @@ class UpdateJobRequest(proto.Message): r"""Update job request. Attributes: - job (~.gct_job.Job): + job (google.cloud.talent_v4beta1.types.Job): Required. The Job to be updated. - update_mask (~.field_mask.FieldMask): + update_mask (google.protobuf.field_mask_pb2.FieldMask): Strongly recommended for the best service experience. If @@ -221,7 +221,7 @@ class ListJobsRequest(proto.Message): maximum allowed page size is 100. Default is 100 if empty or a number < 1 is specified. - job_view (~.job_service.JobView): + 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][google.cloud.talent.v4beta1.JobView.JOB_VIEW_FULL] @@ -243,13 +243,13 @@ class ListJobsResponse(proto.Message): r"""List jobs response. Attributes: - jobs (Sequence[~.gct_job.Job]): + jobs (Sequence[google.cloud.talent_v4beta1.types.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): + metadata (google.cloud.talent_v4beta1.types.ResponseMetadata): Additional information for the API invocation, such as the request tracking id. """ @@ -276,17 +276,17 @@ class SearchJobsRequest(proto.Message): 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): + search_mode (google.cloud.talent_v4beta1.types.SearchJobsRequest.SearchMode): Mode of a search. Defaults to [SearchMode.JOB_SEARCH][google.cloud.talent.v4beta1.SearchJobsRequest.SearchMode.JOB_SEARCH]. - request_metadata (~.common.RequestMetadata): + request_metadata (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. - job_query (~.filters.JobQuery): + job_query (google.cloud.talent_v4beta1.types.JobQuery): Query used to search against jobs, such as keyword, location filters, etc. enable_broadening (bool): @@ -307,7 +307,7 @@ class SearchJobsRequest(proto.Message): Enabling this flag may adversely impact performance. Defaults to false. - histogram_queries (Sequence[~.histogram.HistogramQuery]): + histogram_queries (Sequence[google.cloud.talent_v4beta1.types.HistogramQuery]): An expression specifies a histogram request against matching jobs. @@ -420,7 +420,7 @@ class SearchJobsRequest(proto.Message): - ``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): + 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][google.cloud.talent.v4beta1.JobView.JOB_VIEW_SMALL] @@ -512,7 +512,7 @@ class SearchJobsRequest(proto.Message): (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): + diversification_level (google.cloud.talent_v4beta1.types.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 @@ -524,7 +524,7 @@ class SearchJobsRequest(proto.Message): Defaults to [DiversificationLevel.SIMPLE][google.cloud.talent.v4beta1.SearchJobsRequest.DiversificationLevel.SIMPLE] if no value is specified. - custom_ranking_info (~.job_service.SearchJobsRequest.CustomRankingInfo): + custom_ranking_info (google.cloud.talent_v4beta1.types.SearchJobsRequest.CustomRankingInfo): Controls over how job documents get ranked on top of existing relevance score (determined by API algorithm). @@ -582,7 +582,7 @@ class CustomRankingInfo(proto.Message): [SearchJobsRequest][google.cloud.talent.v4beta1.SearchJobsRequest]. Attributes: - importance_level (~.job_service.SearchJobsRequest.CustomRankingInfo.ImportanceLevel): + importance_level (google.cloud.talent_v4beta1.types.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. @@ -679,17 +679,17 @@ class SearchJobsResponse(proto.Message): r"""Response for SearchJob method. Attributes: - matching_jobs (Sequence[~.job_service.SearchJobsResponse.MatchingJob]): + matching_jobs (Sequence[google.cloud.talent_v4beta1.types.SearchJobsResponse.MatchingJob]): The Job entities that match the specified [SearchJobsRequest][google.cloud.talent.v4beta1.SearchJobsRequest]. - histogram_query_results (Sequence[~.histogram.HistogramQueryResult]): + histogram_query_results (Sequence[google.cloud.talent_v4beta1.types.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]): + location_filters (Sequence[google.cloud.talent_v4beta1.types.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] @@ -708,7 +708,7 @@ class SearchJobsResponse(proto.Message): [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): + metadata (google.cloud.talent_v4beta1.types.ResponseMetadata): Additional information for the API invocation, such as the request tracking id. broadened_query_jobs_count (int): @@ -723,7 +723,7 @@ class SearchJobsResponse(proto.Message): 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): + spell_correction (google.cloud.talent_v4beta1.types.SpellingCorrection): The spell checking result, and correction. """ @@ -732,7 +732,7 @@ class MatchingJob(proto.Message): [SearchJobsResponse][google.cloud.talent.v4beta1.SearchJobsResponse]. Attributes: - job (~.gct_job.Job): + job (google.cloud.talent_v4beta1.types.Job): Job resource that matches the specified [SearchJobsRequest][google.cloud.talent.v4beta1.SearchJobsRequest]. job_summary (str): @@ -752,7 +752,7 @@ class MatchingJob(proto.Message): 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_info (google.cloud.talent_v4beta1.types.SearchJobsResponse.CommuteInfo): Commute information which is generated based on specified [CommuteFilter][google.cloud.talent.v4beta1.CommuteFilter]. """ @@ -773,10 +773,10 @@ class CommuteInfo(proto.Message): r"""Commute details related to this job. Attributes: - job_location (~.common.Location): + job_location (google.cloud.talent_v4beta1.types.Location): Location used as the destination in the commute calculation. - travel_duration (~.duration.Duration): + travel_duration (google.protobuf.duration_pb2.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 @@ -831,7 +831,7 @@ class BatchCreateJobsRequest(proto.Message): 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]): + jobs (Sequence[google.cloud.talent_v4beta1.types.Job]): Required. The jobs to be created. """ @@ -852,9 +852,9 @@ class BatchUpdateJobsRequest(proto.Message): 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]): + jobs (Sequence[google.cloud.talent_v4beta1.types.Job]): Required. The jobs to be updated. - update_mask (~.field_mask.FieldMask): + update_mask (google.protobuf.field_mask_pb2.FieldMask): Strongly recommended for the best service experience. Be aware that it will also increase latency when checking the status of a batch operation. @@ -897,7 +897,7 @@ class JobOperationResult(proto.Message): in case of success. Attributes: - job_results (Sequence[~.job_service.JobOperationResult.JobResult]): + job_results (Sequence[google.cloud.talent_v4beta1.types.JobOperationResult.JobResult]): List of job mutation results from a batch mutate operation. It can change until operation status is FINISHED, FAILED or CANCELLED. @@ -907,7 +907,7 @@ class JobResult(proto.Message): r"""Mutation result of a job. Attributes: - job (~.gct_job.Job): + job (google.cloud.talent_v4beta1.types.Job): Here [Job][google.cloud.talent.v4beta1.Job] only contains basic information including [name][google.cloud.talent.v4beta1.Job.name], @@ -917,7 +917,7 @@ class JobResult(proto.Message): [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): + status (google.rpc.status_pb2.Status): The status of the job processed. This field is populated if the processing of the [job][google.cloud.talent.v4beta1.JobOperationResult.JobResult.job] diff --git a/google/cloud/talent_v4beta1/types/profile.py b/google/cloud/talent_v4beta1/types/profile.py index 38428498..33c9a31f 100644 --- a/google/cloud/talent_v4beta1/types/profile.py +++ b/google/cloud/talent_v4beta1/types/profile.py @@ -95,16 +95,16 @@ class Profile(proto.Message): [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): + is_hirable (google.protobuf.wrappers_pb2.BoolValue): Indicates the hirable status of the candidate. - create_time (~.timestamp.Timestamp): + create_time (google.protobuf.timestamp_pb2.Timestamp): The timestamp when the profile was first created at this source. - update_time (~.timestamp.Timestamp): + update_time (google.protobuf.timestamp_pb2.Timestamp): The timestamp when the profile was last updated at this source. - candidate_update_time (~.timestamp.Timestamp): + candidate_update_time (google.protobuf.timestamp_pb2.Timestamp): The timestamp when the profile was last updated as a result of a direct or indirect action by a candidate. @@ -130,7 +130,7 @@ class Profile(proto.Message): 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): + resume_update_time (google.protobuf.timestamp_pb2.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 @@ -139,13 +139,13 @@ class Profile(proto.Message): 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): + resume (google.cloud.talent_v4beta1.types.Resume): The resume representing this profile. - person_names (Sequence[~.profile.PersonName]): + person_names (Sequence[google.cloud.talent_v4beta1.types.PersonName]): The names of the candidate this profile references. Currently only one person name is supported. - addresses (Sequence[~.profile.Address]): + addresses (Sequence[google.cloud.talent_v4beta1.types.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: @@ -183,13 +183,13 @@ class Profile(proto.Message): is CONTACT_INFO_USAGE_UNSPECIFIED and [Address.current][google.cloud.talent.v4beta1.Address.current] is false or not set. - email_addresses (Sequence[~.profile.Email]): + email_addresses (Sequence[google.cloud.talent_v4beta1.types.Email]): The candidate's email addresses. - phone_numbers (Sequence[~.profile.Phone]): + phone_numbers (Sequence[google.cloud.talent_v4beta1.types.Phone]): The candidate's phone number(s). - personal_uris (Sequence[~.profile.PersonalUri]): + personal_uris (Sequence[google.cloud.talent_v4beta1.types.PersonalUri]): The candidate's personal URIs. - additional_contact_info (Sequence[~.profile.AdditionalContactInfo]): + additional_contact_info (Sequence[google.cloud.talent_v4beta1.types.AdditionalContactInfo]): Available contact information besides [addresses][google.cloud.talent.v4beta1.Profile.addresses], [email_addresses][google.cloud.talent.v4beta1.Profile.email_addresses], @@ -197,7 +197,7 @@ class Profile(proto.Message): and [personal_uris][google.cloud.talent.v4beta1.Profile.personal_uris]. For example, Hang-out, Skype. - employment_records (Sequence[~.profile.EmploymentRecord]): + employment_records (Sequence[google.cloud.talent_v4beta1.types.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 @@ -215,7 +215,7 @@ class Profile(proto.Message): inferred from user inputs. The limitation for max number of employment records is 100. - education_records (Sequence[~.profile.EducationRecord]): + education_records (Sequence[google.cloud.talent_v4beta1.types.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 @@ -232,25 +232,25 @@ class Profile(proto.Message): inferred from user inputs. The limitation for max number of education records is 100. - skills (Sequence[~.common.Skill]): + skills (Sequence[google.cloud.talent_v4beta1.types.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]): + activities (Sequence[google.cloud.talent_v4beta1.types.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]): + publications (Sequence[google.cloud.talent_v4beta1.types.Publication]): The publications published by the candidate. The limitation for max number of publications is 50. - patents (Sequence[~.profile.Patent]): + patents (Sequence[google.cloud.talent_v4beta1.types.Patent]): The patents acquired by the candidate. - certifications (Sequence[~.common.Certification]): + certifications (Sequence[google.cloud.talent_v4beta1.types.Certification]): The certifications acquired by the candidate. applications (Sequence[str]): Output only. The resource names of the @@ -258,7 +258,7 @@ class Profile(proto.Message): assignments (Sequence[str]): Output only. The resource names of the candidate's assignments. - custom_attributes (Sequence[~.profile.Profile.CustomAttributesEntry]): + custom_attributes (Sequence[google.cloud.talent_v4beta1.types.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 @@ -290,10 +290,10 @@ class Profile(proto.Message): 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]): + availability_signals (Sequence[google.cloud.talent_v4beta1.types.AvailabilitySignal]): Output only. Candidate's availability signals. - derived_addresses (Sequence[~.common.Location]): + derived_addresses (Sequence[google.cloud.talent_v4beta1.types.Location]): Output only. Derived locations of the profile, resolved from [Profile.addresses][google.cloud.talent.v4beta1.Profile.addresses]. @@ -390,12 +390,12 @@ class AvailabilitySignal(proto.Message): r"""Candidate availability signal. Attributes: - type_ (~.common.AvailabilitySignalType): + type_ (google.cloud.talent_v4beta1.types.AvailabilitySignalType): Type of signal. - last_update_time (~.timestamp.Timestamp): + last_update_time (google.protobuf.timestamp_pb2.Timestamp): Timestamp of when the given availability activity last happened. - filter_satisfied (~.wrappers.BoolValue): + filter_satisfied (google.protobuf.wrappers_pb2.BoolValue): Indicates if the [last_update_time][google.cloud.talent.v4beta1.AvailabilitySignal.last_update_time] is within @@ -439,7 +439,7 @@ class Resume(proto.Message): 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): + resume_type (google.cloud.talent_v4beta1.types.Resume.ResumeType): The format of [structured_resume][google.cloud.talent.v4beta1.Resume.structured_resume]. """ @@ -463,7 +463,7 @@ class PersonName(proto.Message): A string represents a person's full name. For example, "Dr. John Smith". Number of characters allowed is 100. - structured_name (~.profile.PersonName.PersonStructuredName): + structured_name (google.cloud.talent_v4beta1.types.PersonName.PersonStructuredName): A person's name in a structured way (last name, first name, suffix, and so on.) preferred_name (str): @@ -538,7 +538,7 @@ class Address(proto.Message): r"""Resource that represents a address. Attributes: - usage (~.common.ContactInfoUsage): + usage (google.cloud.talent_v4beta1.types.ContactInfoUsage): The usage of the address. For example, SCHOOL, WORK, PERSONAL. unstructured_address (str): @@ -547,10 +547,10 @@ class Address(proto.Message): View, CA 94043", "Sunnyvale, California". Number of characters allowed is 100. - structured_address (~.postal_address.PostalAddress): + structured_address (google.type.postal_address_pb2.PostalAddress): Structured address that contains street address, city, state, country, and so on. - current (~.wrappers.BoolValue): + current (google.protobuf.wrappers_pb2.BoolValue): Indicates if it's the person's current address. """ @@ -570,7 +570,7 @@ class Email(proto.Message): r"""Resource that represents a person's email address. Attributes: - usage (~.common.ContactInfoUsage): + usage (google.cloud.talent_v4beta1.types.ContactInfoUsage): The usage of the email address. For example, SCHOOL, WORK, PERSONAL. email_address (str): @@ -587,10 +587,10 @@ class Phone(proto.Message): r"""Resource that represents a person's telephone number. Attributes: - usage (~.common.ContactInfoUsage): + usage (google.cloud.talent_v4beta1.types.ContactInfoUsage): The usage of the phone. For example, SCHOOL, WORK, PERSONAL. - type_ (~.profile.Phone.PhoneType): + type_ (google.cloud.talent_v4beta1.types.Phone.PhoneType): The phone type. For example, LANDLINE, MOBILE, FAX. number (str): @@ -647,7 +647,7 @@ class AdditionalContactInfo(proto.Message): phone, email, URI and addresses. Attributes: - usage (~.common.ContactInfoUsage): + usage (google.cloud.talent_v4beta1.types.ContactInfoUsage): The usage of this contact method. For example, SCHOOL, WORK, PERSONAL. name (str): @@ -671,9 +671,9 @@ class EmploymentRecord(proto.Message): r"""Resource that represents an employment record of a candidate. Attributes: - start_date (~.date.Date): + start_date (google.type.date_pb2.Date): Start date of the employment. - end_date (~.date.Date): + end_date (google.type.date_pb2.Date): End date of the employment. employer_name (str): The name of the employer @@ -685,7 +685,7 @@ class EmploymentRecord(proto.Message): For example, division, department, client, and so on. Number of characters allowed is 100. - address (~.profile.Address): + address (google.cloud.talent_v4beta1.types.Address): The physical address of the employer. job_title (str): The job title of the employment. @@ -695,11 +695,11 @@ class EmploymentRecord(proto.Message): job_description (str): The description of job content. Number of characters allowed is 100,000. - is_supervisor (~.wrappers.BoolValue): + is_supervisor (google.protobuf.wrappers_pb2.BoolValue): If the jobs is a supervisor position. - is_self_employed (~.wrappers.BoolValue): + is_self_employed (google.protobuf.wrappers_pb2.BoolValue): If this employment is self-employed. - is_current (~.wrappers.BoolValue): + is_current (google.protobuf.wrappers_pb2.BoolValue): If this employment is current. job_title_snippet (str): Output only. The job title snippet shows how the @@ -752,11 +752,11 @@ class EducationRecord(proto.Message): r"""Resource that represents an education record of a candidate. Attributes: - start_date (~.date.Date): + start_date (google.type.date_pb2.Date): The start date of the education. - end_date (~.date.Date): + end_date (google.type.date_pb2.Date): The end date of the education. - expected_graduation_date (~.date.Date): + expected_graduation_date (google.type.date_pb2.Date): The expected graduation date if currently pursuing a degree. school_name (str): @@ -764,7 +764,7 @@ class EducationRecord(proto.Message): For example, "Stanford University", "UC Berkeley", and so on. Number of characters allowed is 250. - address (~.profile.Address): + address (google.cloud.talent_v4beta1.types.Address): The physical address of the education institution. degree_description (str): @@ -772,12 +772,12 @@ class EducationRecord(proto.Message): For example, "Master of Science in Computer Science", "B.S in Math". Number of characters allowed is 100. - structured_degree (~.profile.Degree): + structured_degree (google.cloud.talent_v4beta1.types.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): + is_current (google.protobuf.wrappers_pb2.BoolValue): If this education is current. school_name_snippet (str): Output only. The school name snippet shows how the @@ -824,7 +824,7 @@ class Degree(proto.Message): candidate. Attributes: - degree_type (~.common.DegreeType): + degree_type (google.cloud.talent_v4beta1.types.DegreeType): ISCED degree type. degree_name (str): Full Degree name. @@ -859,9 +859,9 @@ class Activity(proto.Message): uri (str): Activity URI. Number of characters allowed is 4,000. - create_date (~.date.Date): + create_date (google.type.date_pb2.Date): The first creation date of the activity. - update_date (~.date.Date): + update_date (google.type.date_pb2.Date): The last update date of the activity. team_members (Sequence[str]): A list of team members involved in this @@ -870,7 +870,7 @@ class Activity(proto.Message): The limitation for max number of team members is 50. - skills_used (Sequence[~.common.Skill]): + skills_used (Sequence[google.cloud.talent_v4beta1.types.Skill]): A list of skills used in this activity. The limitation for max number of skills used is 50. @@ -939,7 +939,7 @@ class Publication(proto.Message): publisher (str): The publisher of the journal. Number of characters allowed is 100. - publication_date (~.date.Date): + publication_date (google.type.date_pb2.Date): The publication date. publication_type (str): The publication type. @@ -981,10 +981,10 @@ class Patent(proto.Message): patent_status (str): The status of the patent. Number of characters allowed is 100. - patent_status_date (~.date.Date): + patent_status_date (google.type.date_pb2.Date): The date the last time the status of the patent was checked. - patent_filing_date (~.date.Date): + patent_filing_date (google.type.date_pb2.Date): The date that the patent was filed. patent_office (str): The name of the patent office. @@ -995,7 +995,7 @@ class Patent(proto.Message): patent_description (str): The description of the patent. Number of characters allowed is 100,000. - skills_used (Sequence[~.common.Skill]): + skills_used (Sequence[google.cloud.talent_v4beta1.types.Skill]): The skills used in this patent. """ diff --git a/google/cloud/talent_v4beta1/types/profile_service.py b/google/cloud/talent_v4beta1/types/profile_service.py index 1214e0ab..c64b7c3d 100644 --- a/google/cloud/talent_v4beta1/types/profile_service.py +++ b/google/cloud/talent_v4beta1/types/profile_service.py @@ -81,7 +81,7 @@ class ListProfilesRequest(proto.Message): returned, at most 100. Default is 100 unless a positive number smaller than 100 is specified. - read_mask (~.field_mask.FieldMask): + read_mask (google.protobuf.field_mask_pb2.FieldMask): A field mask to specify the profile fields to be listed in response. All fields are listed if it is unset. @@ -105,7 +105,7 @@ class ListProfilesResponse(proto.Message): r"""The List profiles response object. Attributes: - profiles (Sequence[~.gct_profile.Profile]): + profiles (Sequence[google.cloud.talent_v4beta1.types.Profile]): Profiles for the specific tenant. next_page_token (str): A token to retrieve the next page of results. @@ -132,7 +132,7 @@ class CreateProfileRequest(proto.Message): The format is "projects/{project_id}/tenants/{tenant_id}". For example, "projects/foo/tenants/bar". - profile (~.gct_profile.Profile): + profile (google.cloud.talent_v4beta1.types.Profile): Required. The profile to be created. """ @@ -160,9 +160,9 @@ class UpdateProfileRequest(proto.Message): r"""Update profile request Attributes: - profile (~.gct_profile.Profile): + profile (google.cloud.talent_v4beta1.types.Profile): Required. Profile to be updated. - update_mask (~.field_mask.FieldMask): + update_mask (google.protobuf.field_mask_pb2.FieldMask): A field mask to specify the profile fields to update. A full update is performed if it is unset. @@ -197,13 +197,13 @@ class SearchProfilesRequest(proto.Message): The format is "projects/{project_id}/tenants/{tenant_id}". For example, "projects/foo/tenants/bar". - request_metadata (~.common.RequestMetadata): + request_metadata (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. - profile_query (~.filters.ProfileQuery): + profile_query (google.cloud.talent_v4beta1.types.ProfileQuery): Search query to execute. See [ProfileQuery][google.cloud.talent.v4beta1.ProfileQuery] for more details. @@ -273,7 +273,7 @@ class SearchProfilesRequest(proto.Message): 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]): + histogram_queries (Sequence[google.cloud.talent_v4beta1.types.HistogramQuery]): A list of expressions specifies histogram requests against matching profiles for [SearchProfilesRequest][google.cloud.talent.v4beta1.SearchProfilesRequest]. @@ -463,18 +463,18 @@ class SearchProfilesResponse(proto.Message): An estimation of the number of profiles that match the specified query. This number isn't guaranteed to be accurate. - spell_correction (~.common.SpellingCorrection): + spell_correction (google.cloud.talent_v4beta1.types.SpellingCorrection): The spell checking result, and correction. - metadata (~.common.ResponseMetadata): + metadata (google.cloud.talent_v4beta1.types.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]): + histogram_query_results (Sequence[google.cloud.talent_v4beta1.types.HistogramQueryResult]): The histogram results that match with specified [SearchProfilesRequest.histogram_queries][google.cloud.talent.v4beta1.SearchProfilesRequest.histogram_queries]. - summarized_profiles (Sequence[~.profile_service.SummarizedProfile]): + summarized_profiles (Sequence[google.cloud.talent_v4beta1.types.SummarizedProfile]): The profile entities that match the specified [SearchProfilesRequest][google.cloud.talent.v4beta1.SearchProfilesRequest]. result_set_id (str): @@ -513,10 +513,10 @@ class SummarizedProfile(proto.Message): [SearchProfilesResponse][google.cloud.talent.v4beta1.SearchProfilesResponse]. Attributes: - profiles (Sequence[~.gct_profile.Profile]): + profiles (Sequence[google.cloud.talent_v4beta1.types.Profile]): A list of profiles that are linked by [Profile.group_id][google.cloud.talent.v4beta1.Profile.group_id]. - summary (~.gct_profile.Profile): + summary (google.cloud.talent_v4beta1.types.Profile): A profile summary shows the profile summary and how the profile matches the search query. diff --git a/google/cloud/talent_v4beta1/types/tenant.py b/google/cloud/talent_v4beta1/types/tenant.py index c7d1974d..c399eba2 100644 --- a/google/cloud/talent_v4beta1/types/tenant.py +++ b/google/cloud/talent_v4beta1/types/tenant.py @@ -43,7 +43,7 @@ class Tenant(proto.Message): Required. Client side tenant identifier, used to uniquely identify the tenant. The maximum number of allowed characters is 255. - usage_type (~.tenant.Tenant.DataUsageType): + usage_type (google.cloud.talent_v4beta1.types.Tenant.DataUsageType): Indicates whether data owned by this tenant may be used to provide product improvements across other tenants. diff --git a/google/cloud/talent_v4beta1/types/tenant_service.py b/google/cloud/talent_v4beta1/types/tenant_service.py index 505da6f7..104c43c7 100644 --- a/google/cloud/talent_v4beta1/types/tenant_service.py +++ b/google/cloud/talent_v4beta1/types/tenant_service.py @@ -46,7 +46,7 @@ class CreateTenantRequest(proto.Message): The format is "projects/{project_id}", for example, "projects/foo". - tenant (~.gct_tenant.Tenant): + tenant (google.cloud.talent_v4beta1.types.Tenant): Required. The tenant to be created. """ @@ -73,10 +73,10 @@ class UpdateTenantRequest(proto.Message): r"""Request for updating a specified tenant. Attributes: - tenant (~.gct_tenant.Tenant): + tenant (google.cloud.talent_v4beta1.types.Tenant): Required. The tenant resource to replace the current resource in the system. - update_mask (~.field_mask.FieldMask): + update_mask (google.protobuf.field_mask_pb2.FieldMask): Strongly recommended for the best service experience. If @@ -139,11 +139,11 @@ class ListTenantsResponse(proto.Message): r"""The List tenants response object. Attributes: - tenants (Sequence[~.gct_tenant.Tenant]): + tenants (Sequence[google.cloud.talent_v4beta1.types.Tenant]): Tenants for the current client. next_page_token (str): A token to retrieve the next page of results. - metadata (~.common.ResponseMetadata): + metadata (google.cloud.talent_v4beta1.types.ResponseMetadata): Additional information for the API invocation, such as the request tracking id. """ diff --git a/synth.metadata b/synth.metadata index 83804676..0c25566c 100644 --- a/synth.metadata +++ b/synth.metadata @@ -4,15 +4,15 @@ "git": { "name": ".", "remote": "https://github.com/googleapis/python-talent.git", - "sha": "8a53830a77532e25ff0794e9fb5400e4ec01d4f5" + "sha": "bb632f21c24cdca6094f989657ec6e72d4ffb371" } }, { "git": { "name": "googleapis", "remote": "https://github.com/googleapis/googleapis.git", - "sha": "8a6f4d9acb1620af2156b42b37b54eae257b7cad", - "internalRef": "348696929" + "sha": "20712b8fe95001b312f62c6c5f33e3e3ec92cfaf", + "internalRef": "354996675" } }, { @@ -51,6 +51,7 @@ } ], "generatedFiles": [ + ".coveragerc", ".flake8", ".github/CONTRIBUTING.md", ".github/ISSUE_TEMPLATE/bug_report.md", @@ -104,9 +105,21 @@ "docs/_templates/layout.html", "docs/conf.py", "docs/multiprocessing.rst", + "docs/talent_v4/company_service.rst", + "docs/talent_v4/completion.rst", + "docs/talent_v4/event_service.rst", + "docs/talent_v4/job_service.rst", "docs/talent_v4/services.rst", + "docs/talent_v4/tenant_service.rst", "docs/talent_v4/types.rst", + "docs/talent_v4beta1/application_service.rst", + "docs/talent_v4beta1/company_service.rst", + "docs/talent_v4beta1/completion.rst", + "docs/talent_v4beta1/event_service.rst", + "docs/talent_v4beta1/job_service.rst", + "docs/talent_v4beta1/profile_service.rst", "docs/talent_v4beta1/services.rst", + "docs/talent_v4beta1/tenant_service.rst", "docs/talent_v4beta1/types.rst", "google/cloud/talent/__init__.py", "google/cloud/talent/py.typed", diff --git a/tests/unit/gapic/talent_v4/test_company_service.py b/tests/unit/gapic/talent_v4/test_company_service.py index bcb62811..22a6ae9f 100644 --- a/tests/unit/gapic/talent_v4/test_company_service.py +++ b/tests/unit/gapic/talent_v4/test_company_service.py @@ -90,8 +90,21 @@ def test__get_default_mtls_endpoint(): ) +def test_company_service_client_from_service_account_info(): + creds = credentials.AnonymousCredentials() + with mock.patch.object( + service_account.Credentials, "from_service_account_info" + ) as factory: + factory.return_value = creds + info = {"valid": True} + client = CompanyServiceClient.from_service_account_info(info) + assert client.transport._credentials == creds + + assert client.transport._host == "jobs.googleapis.com:443" + + @pytest.mark.parametrize( - "client_class", [CompanyServiceClient, CompanyServiceAsyncClient] + "client_class", [CompanyServiceClient, CompanyServiceAsyncClient,] ) def test_company_service_client_from_service_account_file(client_class): creds = credentials.AnonymousCredentials() @@ -110,7 +123,10 @@ def test_company_service_client_from_service_account_file(client_class): def test_company_service_client_get_transport_class(): transport = CompanyServiceClient.get_transport_class() - assert transport == transports.CompanyServiceGrpcTransport + available_transports = [ + transports.CompanyServiceGrpcTransport, + ] + assert transport in available_transports transport = CompanyServiceClient.get_transport_class("grpc") assert transport == transports.CompanyServiceGrpcTransport @@ -161,7 +177,7 @@ def test_company_service_client_client_options( credentials_file=None, host="squid.clam.whelk", scopes=None, - ssl_channel_credentials=None, + client_cert_source_for_mtls=None, quota_project_id=None, client_info=transports.base.DEFAULT_CLIENT_INFO, ) @@ -177,7 +193,7 @@ def test_company_service_client_client_options( credentials_file=None, host=client.DEFAULT_ENDPOINT, scopes=None, - ssl_channel_credentials=None, + client_cert_source_for_mtls=None, quota_project_id=None, client_info=transports.base.DEFAULT_CLIENT_INFO, ) @@ -193,7 +209,7 @@ def test_company_service_client_client_options( credentials_file=None, host=client.DEFAULT_MTLS_ENDPOINT, scopes=None, - ssl_channel_credentials=None, + client_cert_source_for_mtls=None, quota_project_id=None, client_info=transports.base.DEFAULT_CLIENT_INFO, ) @@ -221,7 +237,7 @@ def test_company_service_client_client_options( credentials_file=None, host=client.DEFAULT_ENDPOINT, scopes=None, - ssl_channel_credentials=None, + client_cert_source_for_mtls=None, quota_project_id="octopus", client_info=transports.base.DEFAULT_CLIENT_INFO, ) @@ -272,29 +288,25 @@ def test_company_service_client_mtls_env_auto( client_cert_source=client_cert_source_callback ) with mock.patch.object(transport_class, "__init__") as patched: - ssl_channel_creds = mock.Mock() - with mock.patch( - "grpc.ssl_channel_credentials", return_value=ssl_channel_creds - ): - patched.return_value = None - client = client_class(client_options=options) + patched.return_value = None + client = client_class(client_options=options) - if use_client_cert_env == "false": - expected_ssl_channel_creds = None - expected_host = client.DEFAULT_ENDPOINT - else: - expected_ssl_channel_creds = ssl_channel_creds - expected_host = client.DEFAULT_MTLS_ENDPOINT + if use_client_cert_env == "false": + expected_client_cert_source = None + expected_host = client.DEFAULT_ENDPOINT + else: + expected_client_cert_source = client_cert_source_callback + expected_host = client.DEFAULT_MTLS_ENDPOINT - patched.assert_called_once_with( - credentials=None, - credentials_file=None, - host=expected_host, - scopes=None, - ssl_channel_credentials=expected_ssl_channel_creds, - quota_project_id=None, - client_info=transports.base.DEFAULT_CLIENT_INFO, - ) + patched.assert_called_once_with( + credentials=None, + credentials_file=None, + host=expected_host, + scopes=None, + client_cert_source_for_mtls=expected_client_cert_source, + quota_project_id=None, + client_info=transports.base.DEFAULT_CLIENT_INFO, + ) # Check the case ADC client cert is provided. Whether client cert is used depends on # GOOGLE_API_USE_CLIENT_CERTIFICATE value. @@ -303,66 +315,53 @@ def test_company_service_client_mtls_env_auto( ): with mock.patch.object(transport_class, "__init__") as patched: with mock.patch( - "google.auth.transport.grpc.SslCredentials.__init__", return_value=None + "google.auth.transport.mtls.has_default_client_cert_source", + return_value=True, ): with mock.patch( - "google.auth.transport.grpc.SslCredentials.is_mtls", - new_callable=mock.PropertyMock, - ) as is_mtls_mock: - with mock.patch( - "google.auth.transport.grpc.SslCredentials.ssl_credentials", - new_callable=mock.PropertyMock, - ) as ssl_credentials_mock: - if use_client_cert_env == "false": - is_mtls_mock.return_value = False - ssl_credentials_mock.return_value = None - expected_host = client.DEFAULT_ENDPOINT - expected_ssl_channel_creds = None - else: - is_mtls_mock.return_value = True - ssl_credentials_mock.return_value = mock.Mock() - expected_host = client.DEFAULT_MTLS_ENDPOINT - expected_ssl_channel_creds = ( - ssl_credentials_mock.return_value - ) - - patched.return_value = None - client = client_class() - patched.assert_called_once_with( - credentials=None, - credentials_file=None, - host=expected_host, - scopes=None, - ssl_channel_credentials=expected_ssl_channel_creds, - quota_project_id=None, - client_info=transports.base.DEFAULT_CLIENT_INFO, - ) + "google.auth.transport.mtls.default_client_cert_source", + return_value=client_cert_source_callback, + ): + if use_client_cert_env == "false": + expected_host = client.DEFAULT_ENDPOINT + expected_client_cert_source = None + else: + expected_host = client.DEFAULT_MTLS_ENDPOINT + expected_client_cert_source = client_cert_source_callback - # Check the case client_cert_source and ADC client cert are not provided. - with mock.patch.dict( - os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": use_client_cert_env} - ): - with mock.patch.object(transport_class, "__init__") as patched: - with mock.patch( - "google.auth.transport.grpc.SslCredentials.__init__", return_value=None - ): - with mock.patch( - "google.auth.transport.grpc.SslCredentials.is_mtls", - new_callable=mock.PropertyMock, - ) as is_mtls_mock: - is_mtls_mock.return_value = False patched.return_value = None client = client_class() patched.assert_called_once_with( credentials=None, credentials_file=None, - host=client.DEFAULT_ENDPOINT, + host=expected_host, scopes=None, - ssl_channel_credentials=None, + client_cert_source_for_mtls=expected_client_cert_source, quota_project_id=None, client_info=transports.base.DEFAULT_CLIENT_INFO, ) + # Check the case client_cert_source and ADC client cert are not provided. + with mock.patch.dict( + os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": use_client_cert_env} + ): + 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, + client_cert_source_for_mtls=None, + quota_project_id=None, + client_info=transports.base.DEFAULT_CLIENT_INFO, + ) + @pytest.mark.parametrize( "client_class,transport_class,transport_name", @@ -388,7 +387,7 @@ def test_company_service_client_client_options_scopes( credentials_file=None, host=client.DEFAULT_ENDPOINT, scopes=["1", "2"], - ssl_channel_credentials=None, + client_cert_source_for_mtls=None, quota_project_id=None, client_info=transports.base.DEFAULT_CLIENT_INFO, ) @@ -418,7 +417,7 @@ def test_company_service_client_client_options_credentials_file( credentials_file="credentials.json", host=client.DEFAULT_ENDPOINT, scopes=None, - ssl_channel_credentials=None, + client_cert_source_for_mtls=None, quota_project_id=None, client_info=transports.base.DEFAULT_CLIENT_INFO, ) @@ -437,7 +436,7 @@ def test_company_service_client_client_options_from_dict(): credentials_file=None, host="squid.clam.whelk", scopes=None, - ssl_channel_credentials=None, + client_cert_source_for_mtls=None, quota_project_id=None, client_info=transports.base.DEFAULT_CLIENT_INFO, ) @@ -1937,6 +1936,54 @@ def test_company_service_transport_auth_adc(): ) +@pytest.mark.parametrize( + "transport_class", + [ + transports.CompanyServiceGrpcTransport, + transports.CompanyServiceGrpcAsyncIOTransport, + ], +) +def test_company_service_grpc_transport_client_cert_source_for_mtls(transport_class): + cred = credentials.AnonymousCredentials() + + # Check ssl_channel_credentials is used if provided. + with mock.patch.object(transport_class, "create_channel") as mock_create_channel: + mock_ssl_channel_creds = mock.Mock() + transport_class( + host="squid.clam.whelk", + credentials=cred, + ssl_channel_credentials=mock_ssl_channel_creds, + ) + mock_create_channel.assert_called_once_with( + "squid.clam.whelk:443", + credentials=cred, + credentials_file=None, + scopes=( + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/jobs", + ), + ssl_credentials=mock_ssl_channel_creds, + quota_project_id=None, + options=[ + ("grpc.max_send_message_length", -1), + ("grpc.max_receive_message_length", -1), + ], + ) + + # Check if ssl_channel_credentials is not provided, then client_cert_source_for_mtls + # is used. + with mock.patch.object(transport_class, "create_channel", return_value=mock.Mock()): + with mock.patch("grpc.ssl_channel_credentials") as mock_ssl_cred: + transport_class( + credentials=cred, + client_cert_source_for_mtls=client_cert_source_callback, + ) + expected_cert, expected_key = client_cert_source_callback() + mock_ssl_cred.assert_called_once_with( + certificate_chain=expected_cert, private_key=expected_key + ) + + def test_company_service_host_no_port(): client = CompanyServiceClient( credentials=credentials.AnonymousCredentials(), @@ -1956,7 +2003,7 @@ def test_company_service_host_with_port(): def test_company_service_grpc_transport_channel(): - channel = grpc.insecure_channel("http://localhost/") + channel = grpc.secure_channel("http://localhost/", grpc.local_channel_credentials()) # Check that channel is used if provided. transport = transports.CompanyServiceGrpcTransport( @@ -1968,7 +2015,7 @@ def test_company_service_grpc_transport_channel(): def test_company_service_grpc_asyncio_transport_channel(): - channel = aio.insecure_channel("http://localhost/") + channel = aio.secure_channel("http://localhost/", grpc.local_channel_credentials()) # Check that channel is used if provided. transport = transports.CompanyServiceGrpcAsyncIOTransport( @@ -1979,6 +2026,8 @@ def test_company_service_grpc_asyncio_transport_channel(): assert transport._ssl_channel_credentials == None +# Remove this test when deprecated arguments (api_mtls_endpoint, client_cert_source) are +# removed from grpc/grpc_asyncio transport constructor. @pytest.mark.parametrize( "transport_class", [ @@ -1993,7 +2042,7 @@ def test_company_service_transport_channel_mtls_with_client_cert_source( "grpc.ssl_channel_credentials", autospec=True ) as grpc_ssl_channel_cred: with mock.patch.object( - transport_class, "create_channel", autospec=True + transport_class, "create_channel" ) as grpc_create_channel: mock_ssl_cred = mock.Mock() grpc_ssl_channel_cred.return_value = mock_ssl_cred @@ -2034,6 +2083,8 @@ def test_company_service_transport_channel_mtls_with_client_cert_source( assert transport._ssl_channel_credentials == mock_ssl_cred +# Remove this test when deprecated arguments (api_mtls_endpoint, client_cert_source) are +# removed from grpc/grpc_asyncio transport constructor. @pytest.mark.parametrize( "transport_class", [ @@ -2049,7 +2100,7 @@ def test_company_service_transport_channel_mtls_with_adc(transport_class): ssl_credentials=mock.PropertyMock(return_value=mock_ssl_cred), ): with mock.patch.object( - transport_class, "create_channel", autospec=True + transport_class, "create_channel" ) as grpc_create_channel: mock_grpc_channel = mock.Mock() grpc_create_channel.return_value = mock_grpc_channel diff --git a/tests/unit/gapic/talent_v4/test_completion.py b/tests/unit/gapic/talent_v4/test_completion.py index cafd4bc5..e9af38f3 100644 --- a/tests/unit/gapic/talent_v4/test_completion.py +++ b/tests/unit/gapic/talent_v4/test_completion.py @@ -81,7 +81,20 @@ def test__get_default_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_info(): + creds = credentials.AnonymousCredentials() + with mock.patch.object( + service_account.Credentials, "from_service_account_info" + ) as factory: + factory.return_value = creds + info = {"valid": True} + client = CompletionClient.from_service_account_info(info) + assert client.transport._credentials == creds + + assert client.transport._host == "jobs.googleapis.com:443" + + +@pytest.mark.parametrize("client_class", [CompletionClient, CompletionAsyncClient,]) def test_completion_client_from_service_account_file(client_class): creds = credentials.AnonymousCredentials() with mock.patch.object( @@ -99,7 +112,10 @@ def test_completion_client_from_service_account_file(client_class): def test_completion_client_get_transport_class(): transport = CompletionClient.get_transport_class() - assert transport == transports.CompletionGrpcTransport + available_transports = [ + transports.CompletionGrpcTransport, + ] + assert transport in available_transports transport = CompletionClient.get_transport_class("grpc") assert transport == transports.CompletionGrpcTransport @@ -148,7 +164,7 @@ def test_completion_client_client_options( credentials_file=None, host="squid.clam.whelk", scopes=None, - ssl_channel_credentials=None, + client_cert_source_for_mtls=None, quota_project_id=None, client_info=transports.base.DEFAULT_CLIENT_INFO, ) @@ -164,7 +180,7 @@ def test_completion_client_client_options( credentials_file=None, host=client.DEFAULT_ENDPOINT, scopes=None, - ssl_channel_credentials=None, + client_cert_source_for_mtls=None, quota_project_id=None, client_info=transports.base.DEFAULT_CLIENT_INFO, ) @@ -180,7 +196,7 @@ def test_completion_client_client_options( credentials_file=None, host=client.DEFAULT_MTLS_ENDPOINT, scopes=None, - ssl_channel_credentials=None, + client_cert_source_for_mtls=None, quota_project_id=None, client_info=transports.base.DEFAULT_CLIENT_INFO, ) @@ -208,7 +224,7 @@ def test_completion_client_client_options( credentials_file=None, host=client.DEFAULT_ENDPOINT, scopes=None, - ssl_channel_credentials=None, + client_cert_source_for_mtls=None, quota_project_id="octopus", client_info=transports.base.DEFAULT_CLIENT_INFO, ) @@ -257,29 +273,25 @@ def test_completion_client_mtls_env_auto( client_cert_source=client_cert_source_callback ) with mock.patch.object(transport_class, "__init__") as patched: - ssl_channel_creds = mock.Mock() - with mock.patch( - "grpc.ssl_channel_credentials", return_value=ssl_channel_creds - ): - patched.return_value = None - client = client_class(client_options=options) + patched.return_value = None + client = client_class(client_options=options) - if use_client_cert_env == "false": - expected_ssl_channel_creds = None - expected_host = client.DEFAULT_ENDPOINT - else: - expected_ssl_channel_creds = ssl_channel_creds - expected_host = client.DEFAULT_MTLS_ENDPOINT + if use_client_cert_env == "false": + expected_client_cert_source = None + expected_host = client.DEFAULT_ENDPOINT + else: + expected_client_cert_source = client_cert_source_callback + expected_host = client.DEFAULT_MTLS_ENDPOINT - patched.assert_called_once_with( - credentials=None, - credentials_file=None, - host=expected_host, - scopes=None, - ssl_channel_credentials=expected_ssl_channel_creds, - quota_project_id=None, - client_info=transports.base.DEFAULT_CLIENT_INFO, - ) + patched.assert_called_once_with( + credentials=None, + credentials_file=None, + host=expected_host, + scopes=None, + client_cert_source_for_mtls=expected_client_cert_source, + quota_project_id=None, + client_info=transports.base.DEFAULT_CLIENT_INFO, + ) # Check the case ADC client cert is provided. Whether client cert is used depends on # GOOGLE_API_USE_CLIENT_CERTIFICATE value. @@ -288,66 +300,53 @@ def test_completion_client_mtls_env_auto( ): with mock.patch.object(transport_class, "__init__") as patched: with mock.patch( - "google.auth.transport.grpc.SslCredentials.__init__", return_value=None + "google.auth.transport.mtls.has_default_client_cert_source", + return_value=True, ): with mock.patch( - "google.auth.transport.grpc.SslCredentials.is_mtls", - new_callable=mock.PropertyMock, - ) as is_mtls_mock: - with mock.patch( - "google.auth.transport.grpc.SslCredentials.ssl_credentials", - new_callable=mock.PropertyMock, - ) as ssl_credentials_mock: - if use_client_cert_env == "false": - is_mtls_mock.return_value = False - ssl_credentials_mock.return_value = None - expected_host = client.DEFAULT_ENDPOINT - expected_ssl_channel_creds = None - else: - is_mtls_mock.return_value = True - ssl_credentials_mock.return_value = mock.Mock() - expected_host = client.DEFAULT_MTLS_ENDPOINT - expected_ssl_channel_creds = ( - ssl_credentials_mock.return_value - ) - - patched.return_value = None - client = client_class() - patched.assert_called_once_with( - credentials=None, - credentials_file=None, - host=expected_host, - scopes=None, - ssl_channel_credentials=expected_ssl_channel_creds, - quota_project_id=None, - client_info=transports.base.DEFAULT_CLIENT_INFO, - ) + "google.auth.transport.mtls.default_client_cert_source", + return_value=client_cert_source_callback, + ): + if use_client_cert_env == "false": + expected_host = client.DEFAULT_ENDPOINT + expected_client_cert_source = None + else: + expected_host = client.DEFAULT_MTLS_ENDPOINT + expected_client_cert_source = client_cert_source_callback - # Check the case client_cert_source and ADC client cert are not provided. - with mock.patch.dict( - os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": use_client_cert_env} - ): - with mock.patch.object(transport_class, "__init__") as patched: - with mock.patch( - "google.auth.transport.grpc.SslCredentials.__init__", return_value=None - ): - with mock.patch( - "google.auth.transport.grpc.SslCredentials.is_mtls", - new_callable=mock.PropertyMock, - ) as is_mtls_mock: - is_mtls_mock.return_value = False patched.return_value = None client = client_class() patched.assert_called_once_with( credentials=None, credentials_file=None, - host=client.DEFAULT_ENDPOINT, + host=expected_host, scopes=None, - ssl_channel_credentials=None, + client_cert_source_for_mtls=expected_client_cert_source, quota_project_id=None, client_info=transports.base.DEFAULT_CLIENT_INFO, ) + # Check the case client_cert_source and ADC client cert are not provided. + with mock.patch.dict( + os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": use_client_cert_env} + ): + 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, + client_cert_source_for_mtls=None, + quota_project_id=None, + client_info=transports.base.DEFAULT_CLIENT_INFO, + ) + @pytest.mark.parametrize( "client_class,transport_class,transport_name", @@ -373,7 +372,7 @@ def test_completion_client_client_options_scopes( credentials_file=None, host=client.DEFAULT_ENDPOINT, scopes=["1", "2"], - ssl_channel_credentials=None, + client_cert_source_for_mtls=None, quota_project_id=None, client_info=transports.base.DEFAULT_CLIENT_INFO, ) @@ -403,7 +402,7 @@ def test_completion_client_client_options_credentials_file( credentials_file="credentials.json", host=client.DEFAULT_ENDPOINT, scopes=None, - ssl_channel_credentials=None, + client_cert_source_for_mtls=None, quota_project_id=None, client_info=transports.base.DEFAULT_CLIENT_INFO, ) @@ -420,7 +419,7 @@ def test_completion_client_client_options_from_dict(): credentials_file=None, host="squid.clam.whelk", scopes=None, - ssl_channel_credentials=None, + client_cert_source_for_mtls=None, quota_project_id=None, client_info=transports.base.DEFAULT_CLIENT_INFO, ) @@ -603,7 +602,7 @@ def test_transport_get_channel(): @pytest.mark.parametrize( "transport_class", - [transports.CompletionGrpcTransport, transports.CompletionGrpcAsyncIOTransport], + [transports.CompletionGrpcTransport, transports.CompletionGrpcAsyncIOTransport,], ) def test_transport_adc(transport_class): # Test default credentials are used if not provided. @@ -710,6 +709,51 @@ def test_completion_transport_auth_adc(): ) +@pytest.mark.parametrize( + "transport_class", + [transports.CompletionGrpcTransport, transports.CompletionGrpcAsyncIOTransport], +) +def test_completion_grpc_transport_client_cert_source_for_mtls(transport_class): + cred = credentials.AnonymousCredentials() + + # Check ssl_channel_credentials is used if provided. + with mock.patch.object(transport_class, "create_channel") as mock_create_channel: + mock_ssl_channel_creds = mock.Mock() + transport_class( + host="squid.clam.whelk", + credentials=cred, + ssl_channel_credentials=mock_ssl_channel_creds, + ) + mock_create_channel.assert_called_once_with( + "squid.clam.whelk:443", + credentials=cred, + credentials_file=None, + scopes=( + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/jobs", + ), + ssl_credentials=mock_ssl_channel_creds, + quota_project_id=None, + options=[ + ("grpc.max_send_message_length", -1), + ("grpc.max_receive_message_length", -1), + ], + ) + + # Check if ssl_channel_credentials is not provided, then client_cert_source_for_mtls + # is used. + with mock.patch.object(transport_class, "create_channel", return_value=mock.Mock()): + with mock.patch("grpc.ssl_channel_credentials") as mock_ssl_cred: + transport_class( + credentials=cred, + client_cert_source_for_mtls=client_cert_source_callback, + ) + expected_cert, expected_key = client_cert_source_callback() + mock_ssl_cred.assert_called_once_with( + certificate_chain=expected_cert, private_key=expected_key + ) + + def test_completion_host_no_port(): client = CompletionClient( credentials=credentials.AnonymousCredentials(), @@ -729,7 +773,7 @@ def test_completion_host_with_port(): def test_completion_grpc_transport_channel(): - channel = grpc.insecure_channel("http://localhost/") + channel = grpc.secure_channel("http://localhost/", grpc.local_channel_credentials()) # Check that channel is used if provided. transport = transports.CompletionGrpcTransport( @@ -741,7 +785,7 @@ def test_completion_grpc_transport_channel(): def test_completion_grpc_asyncio_transport_channel(): - channel = aio.insecure_channel("http://localhost/") + channel = aio.secure_channel("http://localhost/", grpc.local_channel_credentials()) # Check that channel is used if provided. transport = transports.CompletionGrpcAsyncIOTransport( @@ -752,6 +796,8 @@ def test_completion_grpc_asyncio_transport_channel(): assert transport._ssl_channel_credentials == None +# Remove this test when deprecated arguments (api_mtls_endpoint, client_cert_source) are +# removed from grpc/grpc_asyncio transport constructor. @pytest.mark.parametrize( "transport_class", [transports.CompletionGrpcTransport, transports.CompletionGrpcAsyncIOTransport], @@ -761,7 +807,7 @@ def test_completion_transport_channel_mtls_with_client_cert_source(transport_cla "grpc.ssl_channel_credentials", autospec=True ) as grpc_ssl_channel_cred: with mock.patch.object( - transport_class, "create_channel", autospec=True + transport_class, "create_channel" ) as grpc_create_channel: mock_ssl_cred = mock.Mock() grpc_ssl_channel_cred.return_value = mock_ssl_cred @@ -802,6 +848,8 @@ def test_completion_transport_channel_mtls_with_client_cert_source(transport_cla assert transport._ssl_channel_credentials == mock_ssl_cred +# Remove this test when deprecated arguments (api_mtls_endpoint, client_cert_source) are +# removed from grpc/grpc_asyncio transport constructor. @pytest.mark.parametrize( "transport_class", [transports.CompletionGrpcTransport, transports.CompletionGrpcAsyncIOTransport], @@ -814,7 +862,7 @@ def test_completion_transport_channel_mtls_with_adc(transport_class): ssl_credentials=mock.PropertyMock(return_value=mock_ssl_cred), ): with mock.patch.object( - transport_class, "create_channel", autospec=True + transport_class, "create_channel" ) as grpc_create_channel: mock_grpc_channel = mock.Mock() grpc_create_channel.return_value = mock_grpc_channel diff --git a/tests/unit/gapic/talent_v4/test_event_service.py b/tests/unit/gapic/talent_v4/test_event_service.py index dcf80843..c2e721c6 100644 --- a/tests/unit/gapic/talent_v4/test_event_service.py +++ b/tests/unit/gapic/talent_v4/test_event_service.py @@ -82,7 +82,20 @@ def test__get_default_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_info(): + creds = credentials.AnonymousCredentials() + with mock.patch.object( + service_account.Credentials, "from_service_account_info" + ) as factory: + factory.return_value = creds + info = {"valid": True} + client = EventServiceClient.from_service_account_info(info) + assert client.transport._credentials == creds + + assert client.transport._host == "jobs.googleapis.com:443" + + +@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( @@ -100,7 +113,10 @@ def test_event_service_client_from_service_account_file(client_class): def test_event_service_client_get_transport_class(): transport = EventServiceClient.get_transport_class() - assert transport == transports.EventServiceGrpcTransport + available_transports = [ + transports.EventServiceGrpcTransport, + ] + assert transport in available_transports transport = EventServiceClient.get_transport_class("grpc") assert transport == transports.EventServiceGrpcTransport @@ -149,7 +165,7 @@ def test_event_service_client_client_options( credentials_file=None, host="squid.clam.whelk", scopes=None, - ssl_channel_credentials=None, + client_cert_source_for_mtls=None, quota_project_id=None, client_info=transports.base.DEFAULT_CLIENT_INFO, ) @@ -165,7 +181,7 @@ def test_event_service_client_client_options( credentials_file=None, host=client.DEFAULT_ENDPOINT, scopes=None, - ssl_channel_credentials=None, + client_cert_source_for_mtls=None, quota_project_id=None, client_info=transports.base.DEFAULT_CLIENT_INFO, ) @@ -181,7 +197,7 @@ def test_event_service_client_client_options( credentials_file=None, host=client.DEFAULT_MTLS_ENDPOINT, scopes=None, - ssl_channel_credentials=None, + client_cert_source_for_mtls=None, quota_project_id=None, client_info=transports.base.DEFAULT_CLIENT_INFO, ) @@ -209,7 +225,7 @@ def test_event_service_client_client_options( credentials_file=None, host=client.DEFAULT_ENDPOINT, scopes=None, - ssl_channel_credentials=None, + client_cert_source_for_mtls=None, quota_project_id="octopus", client_info=transports.base.DEFAULT_CLIENT_INFO, ) @@ -258,29 +274,25 @@ def test_event_service_client_mtls_env_auto( client_cert_source=client_cert_source_callback ) with mock.patch.object(transport_class, "__init__") as patched: - ssl_channel_creds = mock.Mock() - with mock.patch( - "grpc.ssl_channel_credentials", return_value=ssl_channel_creds - ): - patched.return_value = None - client = client_class(client_options=options) + patched.return_value = None + client = client_class(client_options=options) - if use_client_cert_env == "false": - expected_ssl_channel_creds = None - expected_host = client.DEFAULT_ENDPOINT - else: - expected_ssl_channel_creds = ssl_channel_creds - expected_host = client.DEFAULT_MTLS_ENDPOINT + if use_client_cert_env == "false": + expected_client_cert_source = None + expected_host = client.DEFAULT_ENDPOINT + else: + expected_client_cert_source = client_cert_source_callback + expected_host = client.DEFAULT_MTLS_ENDPOINT - patched.assert_called_once_with( - credentials=None, - credentials_file=None, - host=expected_host, - scopes=None, - ssl_channel_credentials=expected_ssl_channel_creds, - quota_project_id=None, - client_info=transports.base.DEFAULT_CLIENT_INFO, - ) + patched.assert_called_once_with( + credentials=None, + credentials_file=None, + host=expected_host, + scopes=None, + client_cert_source_for_mtls=expected_client_cert_source, + quota_project_id=None, + client_info=transports.base.DEFAULT_CLIENT_INFO, + ) # Check the case ADC client cert is provided. Whether client cert is used depends on # GOOGLE_API_USE_CLIENT_CERTIFICATE value. @@ -289,66 +301,53 @@ def test_event_service_client_mtls_env_auto( ): with mock.patch.object(transport_class, "__init__") as patched: with mock.patch( - "google.auth.transport.grpc.SslCredentials.__init__", return_value=None + "google.auth.transport.mtls.has_default_client_cert_source", + return_value=True, ): with mock.patch( - "google.auth.transport.grpc.SslCredentials.is_mtls", - new_callable=mock.PropertyMock, - ) as is_mtls_mock: - with mock.patch( - "google.auth.transport.grpc.SslCredentials.ssl_credentials", - new_callable=mock.PropertyMock, - ) as ssl_credentials_mock: - if use_client_cert_env == "false": - is_mtls_mock.return_value = False - ssl_credentials_mock.return_value = None - expected_host = client.DEFAULT_ENDPOINT - expected_ssl_channel_creds = None - else: - is_mtls_mock.return_value = True - ssl_credentials_mock.return_value = mock.Mock() - expected_host = client.DEFAULT_MTLS_ENDPOINT - expected_ssl_channel_creds = ( - ssl_credentials_mock.return_value - ) - - patched.return_value = None - client = client_class() - patched.assert_called_once_with( - credentials=None, - credentials_file=None, - host=expected_host, - scopes=None, - ssl_channel_credentials=expected_ssl_channel_creds, - quota_project_id=None, - client_info=transports.base.DEFAULT_CLIENT_INFO, - ) + "google.auth.transport.mtls.default_client_cert_source", + return_value=client_cert_source_callback, + ): + if use_client_cert_env == "false": + expected_host = client.DEFAULT_ENDPOINT + expected_client_cert_source = None + else: + expected_host = client.DEFAULT_MTLS_ENDPOINT + expected_client_cert_source = client_cert_source_callback - # Check the case client_cert_source and ADC client cert are not provided. - with mock.patch.dict( - os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": use_client_cert_env} - ): - with mock.patch.object(transport_class, "__init__") as patched: - with mock.patch( - "google.auth.transport.grpc.SslCredentials.__init__", return_value=None - ): - with mock.patch( - "google.auth.transport.grpc.SslCredentials.is_mtls", - new_callable=mock.PropertyMock, - ) as is_mtls_mock: - is_mtls_mock.return_value = False patched.return_value = None client = client_class() patched.assert_called_once_with( credentials=None, credentials_file=None, - host=client.DEFAULT_ENDPOINT, + host=expected_host, scopes=None, - ssl_channel_credentials=None, + client_cert_source_for_mtls=expected_client_cert_source, quota_project_id=None, client_info=transports.base.DEFAULT_CLIENT_INFO, ) + # Check the case client_cert_source and ADC client cert are not provided. + with mock.patch.dict( + os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": use_client_cert_env} + ): + 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, + client_cert_source_for_mtls=None, + quota_project_id=None, + client_info=transports.base.DEFAULT_CLIENT_INFO, + ) + @pytest.mark.parametrize( "client_class,transport_class,transport_name", @@ -374,7 +373,7 @@ def test_event_service_client_client_options_scopes( credentials_file=None, host=client.DEFAULT_ENDPOINT, scopes=["1", "2"], - ssl_channel_credentials=None, + client_cert_source_for_mtls=None, quota_project_id=None, client_info=transports.base.DEFAULT_CLIENT_INFO, ) @@ -404,7 +403,7 @@ def test_event_service_client_client_options_credentials_file( credentials_file="credentials.json", host=client.DEFAULT_ENDPOINT, scopes=None, - ssl_channel_credentials=None, + client_cert_source_for_mtls=None, quota_project_id=None, client_info=transports.base.DEFAULT_CLIENT_INFO, ) @@ -421,7 +420,7 @@ def test_event_service_client_client_options_from_dict(): credentials_file=None, host="squid.clam.whelk", scopes=None, - ssl_channel_credentials=None, + client_cert_source_for_mtls=None, quota_project_id=None, client_info=transports.base.DEFAULT_CLIENT_INFO, ) @@ -713,7 +712,10 @@ def test_transport_get_channel(): @pytest.mark.parametrize( "transport_class", - [transports.EventServiceGrpcTransport, transports.EventServiceGrpcAsyncIOTransport], + [ + transports.EventServiceGrpcTransport, + transports.EventServiceGrpcAsyncIOTransport, + ], ) def test_transport_adc(transport_class): # Test default credentials are used if not provided. @@ -820,6 +822,51 @@ def test_event_service_transport_auth_adc(): ) +@pytest.mark.parametrize( + "transport_class", + [transports.EventServiceGrpcTransport, transports.EventServiceGrpcAsyncIOTransport], +) +def test_event_service_grpc_transport_client_cert_source_for_mtls(transport_class): + cred = credentials.AnonymousCredentials() + + # Check ssl_channel_credentials is used if provided. + with mock.patch.object(transport_class, "create_channel") as mock_create_channel: + mock_ssl_channel_creds = mock.Mock() + transport_class( + host="squid.clam.whelk", + credentials=cred, + ssl_channel_credentials=mock_ssl_channel_creds, + ) + mock_create_channel.assert_called_once_with( + "squid.clam.whelk:443", + credentials=cred, + credentials_file=None, + scopes=( + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/jobs", + ), + ssl_credentials=mock_ssl_channel_creds, + quota_project_id=None, + options=[ + ("grpc.max_send_message_length", -1), + ("grpc.max_receive_message_length", -1), + ], + ) + + # Check if ssl_channel_credentials is not provided, then client_cert_source_for_mtls + # is used. + with mock.patch.object(transport_class, "create_channel", return_value=mock.Mock()): + with mock.patch("grpc.ssl_channel_credentials") as mock_ssl_cred: + transport_class( + credentials=cred, + client_cert_source_for_mtls=client_cert_source_callback, + ) + expected_cert, expected_key = client_cert_source_callback() + mock_ssl_cred.assert_called_once_with( + certificate_chain=expected_cert, private_key=expected_key + ) + + def test_event_service_host_no_port(): client = EventServiceClient( credentials=credentials.AnonymousCredentials(), @@ -839,7 +886,7 @@ def test_event_service_host_with_port(): def test_event_service_grpc_transport_channel(): - channel = grpc.insecure_channel("http://localhost/") + channel = grpc.secure_channel("http://localhost/", grpc.local_channel_credentials()) # Check that channel is used if provided. transport = transports.EventServiceGrpcTransport( @@ -851,7 +898,7 @@ def test_event_service_grpc_transport_channel(): def test_event_service_grpc_asyncio_transport_channel(): - channel = aio.insecure_channel("http://localhost/") + channel = aio.secure_channel("http://localhost/", grpc.local_channel_credentials()) # Check that channel is used if provided. transport = transports.EventServiceGrpcAsyncIOTransport( @@ -862,6 +909,8 @@ def test_event_service_grpc_asyncio_transport_channel(): assert transport._ssl_channel_credentials == None +# Remove this test when deprecated arguments (api_mtls_endpoint, client_cert_source) are +# removed from grpc/grpc_asyncio transport constructor. @pytest.mark.parametrize( "transport_class", [transports.EventServiceGrpcTransport, transports.EventServiceGrpcAsyncIOTransport], @@ -871,7 +920,7 @@ def test_event_service_transport_channel_mtls_with_client_cert_source(transport_ "grpc.ssl_channel_credentials", autospec=True ) as grpc_ssl_channel_cred: with mock.patch.object( - transport_class, "create_channel", autospec=True + transport_class, "create_channel" ) as grpc_create_channel: mock_ssl_cred = mock.Mock() grpc_ssl_channel_cred.return_value = mock_ssl_cred @@ -912,6 +961,8 @@ def test_event_service_transport_channel_mtls_with_client_cert_source(transport_ assert transport._ssl_channel_credentials == mock_ssl_cred +# Remove this test when deprecated arguments (api_mtls_endpoint, client_cert_source) are +# removed from grpc/grpc_asyncio transport constructor. @pytest.mark.parametrize( "transport_class", [transports.EventServiceGrpcTransport, transports.EventServiceGrpcAsyncIOTransport], @@ -924,7 +975,7 @@ def test_event_service_transport_channel_mtls_with_adc(transport_class): ssl_credentials=mock.PropertyMock(return_value=mock_ssl_cred), ): with mock.patch.object( - transport_class, "create_channel", autospec=True + transport_class, "create_channel" ) as grpc_create_channel: mock_grpc_channel = mock.Mock() grpc_create_channel.return_value = mock_grpc_channel diff --git a/tests/unit/gapic/talent_v4/test_job_service.py b/tests/unit/gapic/talent_v4/test_job_service.py index 208347d4..c50b68c6 100644 --- a/tests/unit/gapic/talent_v4/test_job_service.py +++ b/tests/unit/gapic/talent_v4/test_job_service.py @@ -98,7 +98,20 @@ def test__get_default_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_info(): + creds = credentials.AnonymousCredentials() + with mock.patch.object( + service_account.Credentials, "from_service_account_info" + ) as factory: + factory.return_value = creds + info = {"valid": True} + client = JobServiceClient.from_service_account_info(info) + assert client.transport._credentials == creds + + assert client.transport._host == "jobs.googleapis.com:443" + + +@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( @@ -116,7 +129,10 @@ def test_job_service_client_from_service_account_file(client_class): def test_job_service_client_get_transport_class(): transport = JobServiceClient.get_transport_class() - assert transport == transports.JobServiceGrpcTransport + available_transports = [ + transports.JobServiceGrpcTransport, + ] + assert transport in available_transports transport = JobServiceClient.get_transport_class("grpc") assert transport == transports.JobServiceGrpcTransport @@ -165,7 +181,7 @@ def test_job_service_client_client_options( credentials_file=None, host="squid.clam.whelk", scopes=None, - ssl_channel_credentials=None, + client_cert_source_for_mtls=None, quota_project_id=None, client_info=transports.base.DEFAULT_CLIENT_INFO, ) @@ -181,7 +197,7 @@ def test_job_service_client_client_options( credentials_file=None, host=client.DEFAULT_ENDPOINT, scopes=None, - ssl_channel_credentials=None, + client_cert_source_for_mtls=None, quota_project_id=None, client_info=transports.base.DEFAULT_CLIENT_INFO, ) @@ -197,7 +213,7 @@ def test_job_service_client_client_options( credentials_file=None, host=client.DEFAULT_MTLS_ENDPOINT, scopes=None, - ssl_channel_credentials=None, + client_cert_source_for_mtls=None, quota_project_id=None, client_info=transports.base.DEFAULT_CLIENT_INFO, ) @@ -225,7 +241,7 @@ def test_job_service_client_client_options( credentials_file=None, host=client.DEFAULT_ENDPOINT, scopes=None, - ssl_channel_credentials=None, + client_cert_source_for_mtls=None, quota_project_id="octopus", client_info=transports.base.DEFAULT_CLIENT_INFO, ) @@ -274,29 +290,25 @@ def test_job_service_client_mtls_env_auto( client_cert_source=client_cert_source_callback ) with mock.patch.object(transport_class, "__init__") as patched: - ssl_channel_creds = mock.Mock() - with mock.patch( - "grpc.ssl_channel_credentials", return_value=ssl_channel_creds - ): - patched.return_value = None - client = client_class(client_options=options) + patched.return_value = None + client = client_class(client_options=options) - if use_client_cert_env == "false": - expected_ssl_channel_creds = None - expected_host = client.DEFAULT_ENDPOINT - else: - expected_ssl_channel_creds = ssl_channel_creds - expected_host = client.DEFAULT_MTLS_ENDPOINT + if use_client_cert_env == "false": + expected_client_cert_source = None + expected_host = client.DEFAULT_ENDPOINT + else: + expected_client_cert_source = client_cert_source_callback + expected_host = client.DEFAULT_MTLS_ENDPOINT - patched.assert_called_once_with( - credentials=None, - credentials_file=None, - host=expected_host, - scopes=None, - ssl_channel_credentials=expected_ssl_channel_creds, - quota_project_id=None, - client_info=transports.base.DEFAULT_CLIENT_INFO, - ) + patched.assert_called_once_with( + credentials=None, + credentials_file=None, + host=expected_host, + scopes=None, + client_cert_source_for_mtls=expected_client_cert_source, + quota_project_id=None, + client_info=transports.base.DEFAULT_CLIENT_INFO, + ) # Check the case ADC client cert is provided. Whether client cert is used depends on # GOOGLE_API_USE_CLIENT_CERTIFICATE value. @@ -305,66 +317,53 @@ def test_job_service_client_mtls_env_auto( ): with mock.patch.object(transport_class, "__init__") as patched: with mock.patch( - "google.auth.transport.grpc.SslCredentials.__init__", return_value=None + "google.auth.transport.mtls.has_default_client_cert_source", + return_value=True, ): with mock.patch( - "google.auth.transport.grpc.SslCredentials.is_mtls", - new_callable=mock.PropertyMock, - ) as is_mtls_mock: - with mock.patch( - "google.auth.transport.grpc.SslCredentials.ssl_credentials", - new_callable=mock.PropertyMock, - ) as ssl_credentials_mock: - if use_client_cert_env == "false": - is_mtls_mock.return_value = False - ssl_credentials_mock.return_value = None - expected_host = client.DEFAULT_ENDPOINT - expected_ssl_channel_creds = None - else: - is_mtls_mock.return_value = True - ssl_credentials_mock.return_value = mock.Mock() - expected_host = client.DEFAULT_MTLS_ENDPOINT - expected_ssl_channel_creds = ( - ssl_credentials_mock.return_value - ) - - patched.return_value = None - client = client_class() - patched.assert_called_once_with( - credentials=None, - credentials_file=None, - host=expected_host, - scopes=None, - ssl_channel_credentials=expected_ssl_channel_creds, - quota_project_id=None, - client_info=transports.base.DEFAULT_CLIENT_INFO, - ) + "google.auth.transport.mtls.default_client_cert_source", + return_value=client_cert_source_callback, + ): + if use_client_cert_env == "false": + expected_host = client.DEFAULT_ENDPOINT + expected_client_cert_source = None + else: + expected_host = client.DEFAULT_MTLS_ENDPOINT + expected_client_cert_source = client_cert_source_callback - # Check the case client_cert_source and ADC client cert are not provided. - with mock.patch.dict( - os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": use_client_cert_env} - ): - with mock.patch.object(transport_class, "__init__") as patched: - with mock.patch( - "google.auth.transport.grpc.SslCredentials.__init__", return_value=None - ): - with mock.patch( - "google.auth.transport.grpc.SslCredentials.is_mtls", - new_callable=mock.PropertyMock, - ) as is_mtls_mock: - is_mtls_mock.return_value = False patched.return_value = None client = client_class() patched.assert_called_once_with( credentials=None, credentials_file=None, - host=client.DEFAULT_ENDPOINT, + host=expected_host, scopes=None, - ssl_channel_credentials=None, + client_cert_source_for_mtls=expected_client_cert_source, quota_project_id=None, client_info=transports.base.DEFAULT_CLIENT_INFO, ) + # Check the case client_cert_source and ADC client cert are not provided. + with mock.patch.dict( + os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": use_client_cert_env} + ): + 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, + client_cert_source_for_mtls=None, + quota_project_id=None, + client_info=transports.base.DEFAULT_CLIENT_INFO, + ) + @pytest.mark.parametrize( "client_class,transport_class,transport_name", @@ -390,7 +389,7 @@ def test_job_service_client_client_options_scopes( credentials_file=None, host=client.DEFAULT_ENDPOINT, scopes=["1", "2"], - ssl_channel_credentials=None, + client_cert_source_for_mtls=None, quota_project_id=None, client_info=transports.base.DEFAULT_CLIENT_INFO, ) @@ -420,7 +419,7 @@ def test_job_service_client_client_options_credentials_file( credentials_file="credentials.json", host=client.DEFAULT_ENDPOINT, scopes=None, - ssl_channel_credentials=None, + client_cert_source_for_mtls=None, quota_project_id=None, client_info=transports.base.DEFAULT_CLIENT_INFO, ) @@ -437,7 +436,7 @@ def test_job_service_client_client_options_from_dict(): credentials_file=None, host="squid.clam.whelk", scopes=None, - ssl_channel_credentials=None, + client_cert_source_for_mtls=None, quota_project_id=None, client_info=transports.base.DEFAULT_CLIENT_INFO, ) @@ -2815,7 +2814,7 @@ def test_transport_get_channel(): @pytest.mark.parametrize( "transport_class", - [transports.JobServiceGrpcTransport, transports.JobServiceGrpcAsyncIOTransport], + [transports.JobServiceGrpcTransport, transports.JobServiceGrpcAsyncIOTransport,], ) def test_transport_adc(transport_class): # Test default credentials are used if not provided. @@ -2938,6 +2937,51 @@ def test_job_service_transport_auth_adc(): ) +@pytest.mark.parametrize( + "transport_class", + [transports.JobServiceGrpcTransport, transports.JobServiceGrpcAsyncIOTransport], +) +def test_job_service_grpc_transport_client_cert_source_for_mtls(transport_class): + cred = credentials.AnonymousCredentials() + + # Check ssl_channel_credentials is used if provided. + with mock.patch.object(transport_class, "create_channel") as mock_create_channel: + mock_ssl_channel_creds = mock.Mock() + transport_class( + host="squid.clam.whelk", + credentials=cred, + ssl_channel_credentials=mock_ssl_channel_creds, + ) + mock_create_channel.assert_called_once_with( + "squid.clam.whelk:443", + credentials=cred, + credentials_file=None, + scopes=( + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/jobs", + ), + ssl_credentials=mock_ssl_channel_creds, + quota_project_id=None, + options=[ + ("grpc.max_send_message_length", -1), + ("grpc.max_receive_message_length", -1), + ], + ) + + # Check if ssl_channel_credentials is not provided, then client_cert_source_for_mtls + # is used. + with mock.patch.object(transport_class, "create_channel", return_value=mock.Mock()): + with mock.patch("grpc.ssl_channel_credentials") as mock_ssl_cred: + transport_class( + credentials=cred, + client_cert_source_for_mtls=client_cert_source_callback, + ) + expected_cert, expected_key = client_cert_source_callback() + mock_ssl_cred.assert_called_once_with( + certificate_chain=expected_cert, private_key=expected_key + ) + + def test_job_service_host_no_port(): client = JobServiceClient( credentials=credentials.AnonymousCredentials(), @@ -2957,7 +3001,7 @@ def test_job_service_host_with_port(): def test_job_service_grpc_transport_channel(): - channel = grpc.insecure_channel("http://localhost/") + channel = grpc.secure_channel("http://localhost/", grpc.local_channel_credentials()) # Check that channel is used if provided. transport = transports.JobServiceGrpcTransport( @@ -2969,7 +3013,7 @@ def test_job_service_grpc_transport_channel(): def test_job_service_grpc_asyncio_transport_channel(): - channel = aio.insecure_channel("http://localhost/") + channel = aio.secure_channel("http://localhost/", grpc.local_channel_credentials()) # Check that channel is used if provided. transport = transports.JobServiceGrpcAsyncIOTransport( @@ -2980,6 +3024,8 @@ def test_job_service_grpc_asyncio_transport_channel(): assert transport._ssl_channel_credentials == None +# Remove this test when deprecated arguments (api_mtls_endpoint, client_cert_source) are +# removed from grpc/grpc_asyncio transport constructor. @pytest.mark.parametrize( "transport_class", [transports.JobServiceGrpcTransport, transports.JobServiceGrpcAsyncIOTransport], @@ -2989,7 +3035,7 @@ def test_job_service_transport_channel_mtls_with_client_cert_source(transport_cl "grpc.ssl_channel_credentials", autospec=True ) as grpc_ssl_channel_cred: with mock.patch.object( - transport_class, "create_channel", autospec=True + transport_class, "create_channel" ) as grpc_create_channel: mock_ssl_cred = mock.Mock() grpc_ssl_channel_cred.return_value = mock_ssl_cred @@ -3030,6 +3076,8 @@ def test_job_service_transport_channel_mtls_with_client_cert_source(transport_cl assert transport._ssl_channel_credentials == mock_ssl_cred +# Remove this test when deprecated arguments (api_mtls_endpoint, client_cert_source) are +# removed from grpc/grpc_asyncio transport constructor. @pytest.mark.parametrize( "transport_class", [transports.JobServiceGrpcTransport, transports.JobServiceGrpcAsyncIOTransport], @@ -3042,7 +3090,7 @@ def test_job_service_transport_channel_mtls_with_adc(transport_class): ssl_credentials=mock.PropertyMock(return_value=mock_ssl_cred), ): with mock.patch.object( - transport_class, "create_channel", autospec=True + transport_class, "create_channel" ) as grpc_create_channel: mock_grpc_channel = mock.Mock() grpc_create_channel.return_value = mock_grpc_channel diff --git a/tests/unit/gapic/talent_v4/test_tenant_service.py b/tests/unit/gapic/talent_v4/test_tenant_service.py index 32438832..d95fe4aa 100644 --- a/tests/unit/gapic/talent_v4/test_tenant_service.py +++ b/tests/unit/gapic/talent_v4/test_tenant_service.py @@ -87,8 +87,21 @@ def test__get_default_mtls_endpoint(): ) +def test_tenant_service_client_from_service_account_info(): + creds = credentials.AnonymousCredentials() + with mock.patch.object( + service_account.Credentials, "from_service_account_info" + ) as factory: + factory.return_value = creds + info = {"valid": True} + client = TenantServiceClient.from_service_account_info(info) + assert client.transport._credentials == creds + + assert client.transport._host == "jobs.googleapis.com:443" + + @pytest.mark.parametrize( - "client_class", [TenantServiceClient, TenantServiceAsyncClient] + "client_class", [TenantServiceClient, TenantServiceAsyncClient,] ) def test_tenant_service_client_from_service_account_file(client_class): creds = credentials.AnonymousCredentials() @@ -107,7 +120,10 @@ def test_tenant_service_client_from_service_account_file(client_class): def test_tenant_service_client_get_transport_class(): transport = TenantServiceClient.get_transport_class() - assert transport == transports.TenantServiceGrpcTransport + available_transports = [ + transports.TenantServiceGrpcTransport, + ] + assert transport in available_transports transport = TenantServiceClient.get_transport_class("grpc") assert transport == transports.TenantServiceGrpcTransport @@ -158,7 +174,7 @@ def test_tenant_service_client_client_options( credentials_file=None, host="squid.clam.whelk", scopes=None, - ssl_channel_credentials=None, + client_cert_source_for_mtls=None, quota_project_id=None, client_info=transports.base.DEFAULT_CLIENT_INFO, ) @@ -174,7 +190,7 @@ def test_tenant_service_client_client_options( credentials_file=None, host=client.DEFAULT_ENDPOINT, scopes=None, - ssl_channel_credentials=None, + client_cert_source_for_mtls=None, quota_project_id=None, client_info=transports.base.DEFAULT_CLIENT_INFO, ) @@ -190,7 +206,7 @@ def test_tenant_service_client_client_options( credentials_file=None, host=client.DEFAULT_MTLS_ENDPOINT, scopes=None, - ssl_channel_credentials=None, + client_cert_source_for_mtls=None, quota_project_id=None, client_info=transports.base.DEFAULT_CLIENT_INFO, ) @@ -218,7 +234,7 @@ def test_tenant_service_client_client_options( credentials_file=None, host=client.DEFAULT_ENDPOINT, scopes=None, - ssl_channel_credentials=None, + client_cert_source_for_mtls=None, quota_project_id="octopus", client_info=transports.base.DEFAULT_CLIENT_INFO, ) @@ -269,29 +285,25 @@ def test_tenant_service_client_mtls_env_auto( client_cert_source=client_cert_source_callback ) with mock.patch.object(transport_class, "__init__") as patched: - ssl_channel_creds = mock.Mock() - with mock.patch( - "grpc.ssl_channel_credentials", return_value=ssl_channel_creds - ): - patched.return_value = None - client = client_class(client_options=options) + patched.return_value = None + client = client_class(client_options=options) - if use_client_cert_env == "false": - expected_ssl_channel_creds = None - expected_host = client.DEFAULT_ENDPOINT - else: - expected_ssl_channel_creds = ssl_channel_creds - expected_host = client.DEFAULT_MTLS_ENDPOINT + if use_client_cert_env == "false": + expected_client_cert_source = None + expected_host = client.DEFAULT_ENDPOINT + else: + expected_client_cert_source = client_cert_source_callback + expected_host = client.DEFAULT_MTLS_ENDPOINT - patched.assert_called_once_with( - credentials=None, - credentials_file=None, - host=expected_host, - scopes=None, - ssl_channel_credentials=expected_ssl_channel_creds, - quota_project_id=None, - client_info=transports.base.DEFAULT_CLIENT_INFO, - ) + patched.assert_called_once_with( + credentials=None, + credentials_file=None, + host=expected_host, + scopes=None, + client_cert_source_for_mtls=expected_client_cert_source, + quota_project_id=None, + client_info=transports.base.DEFAULT_CLIENT_INFO, + ) # Check the case ADC client cert is provided. Whether client cert is used depends on # GOOGLE_API_USE_CLIENT_CERTIFICATE value. @@ -300,66 +312,53 @@ def test_tenant_service_client_mtls_env_auto( ): with mock.patch.object(transport_class, "__init__") as patched: with mock.patch( - "google.auth.transport.grpc.SslCredentials.__init__", return_value=None + "google.auth.transport.mtls.has_default_client_cert_source", + return_value=True, ): with mock.patch( - "google.auth.transport.grpc.SslCredentials.is_mtls", - new_callable=mock.PropertyMock, - ) as is_mtls_mock: - with mock.patch( - "google.auth.transport.grpc.SslCredentials.ssl_credentials", - new_callable=mock.PropertyMock, - ) as ssl_credentials_mock: - if use_client_cert_env == "false": - is_mtls_mock.return_value = False - ssl_credentials_mock.return_value = None - expected_host = client.DEFAULT_ENDPOINT - expected_ssl_channel_creds = None - else: - is_mtls_mock.return_value = True - ssl_credentials_mock.return_value = mock.Mock() - expected_host = client.DEFAULT_MTLS_ENDPOINT - expected_ssl_channel_creds = ( - ssl_credentials_mock.return_value - ) - - patched.return_value = None - client = client_class() - patched.assert_called_once_with( - credentials=None, - credentials_file=None, - host=expected_host, - scopes=None, - ssl_channel_credentials=expected_ssl_channel_creds, - quota_project_id=None, - client_info=transports.base.DEFAULT_CLIENT_INFO, - ) + "google.auth.transport.mtls.default_client_cert_source", + return_value=client_cert_source_callback, + ): + if use_client_cert_env == "false": + expected_host = client.DEFAULT_ENDPOINT + expected_client_cert_source = None + else: + expected_host = client.DEFAULT_MTLS_ENDPOINT + expected_client_cert_source = client_cert_source_callback - # Check the case client_cert_source and ADC client cert are not provided. - with mock.patch.dict( - os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": use_client_cert_env} - ): - with mock.patch.object(transport_class, "__init__") as patched: - with mock.patch( - "google.auth.transport.grpc.SslCredentials.__init__", return_value=None - ): - with mock.patch( - "google.auth.transport.grpc.SslCredentials.is_mtls", - new_callable=mock.PropertyMock, - ) as is_mtls_mock: - is_mtls_mock.return_value = False patched.return_value = None client = client_class() patched.assert_called_once_with( credentials=None, credentials_file=None, - host=client.DEFAULT_ENDPOINT, + host=expected_host, scopes=None, - ssl_channel_credentials=None, + client_cert_source_for_mtls=expected_client_cert_source, quota_project_id=None, client_info=transports.base.DEFAULT_CLIENT_INFO, ) + # Check the case client_cert_source and ADC client cert are not provided. + with mock.patch.dict( + os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": use_client_cert_env} + ): + 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, + client_cert_source_for_mtls=None, + quota_project_id=None, + client_info=transports.base.DEFAULT_CLIENT_INFO, + ) + @pytest.mark.parametrize( "client_class,transport_class,transport_name", @@ -385,7 +384,7 @@ def test_tenant_service_client_client_options_scopes( credentials_file=None, host=client.DEFAULT_ENDPOINT, scopes=["1", "2"], - ssl_channel_credentials=None, + client_cert_source_for_mtls=None, quota_project_id=None, client_info=transports.base.DEFAULT_CLIENT_INFO, ) @@ -415,7 +414,7 @@ def test_tenant_service_client_client_options_credentials_file( credentials_file="credentials.json", host=client.DEFAULT_ENDPOINT, scopes=None, - ssl_channel_credentials=None, + client_cert_source_for_mtls=None, quota_project_id=None, client_info=transports.base.DEFAULT_CLIENT_INFO, ) @@ -434,7 +433,7 @@ def test_tenant_service_client_client_options_from_dict(): credentials_file=None, host="squid.clam.whelk", scopes=None, - ssl_channel_credentials=None, + client_cert_source_for_mtls=None, quota_project_id=None, client_info=transports.base.DEFAULT_CLIENT_INFO, ) @@ -1712,6 +1711,54 @@ def test_tenant_service_transport_auth_adc(): ) +@pytest.mark.parametrize( + "transport_class", + [ + transports.TenantServiceGrpcTransport, + transports.TenantServiceGrpcAsyncIOTransport, + ], +) +def test_tenant_service_grpc_transport_client_cert_source_for_mtls(transport_class): + cred = credentials.AnonymousCredentials() + + # Check ssl_channel_credentials is used if provided. + with mock.patch.object(transport_class, "create_channel") as mock_create_channel: + mock_ssl_channel_creds = mock.Mock() + transport_class( + host="squid.clam.whelk", + credentials=cred, + ssl_channel_credentials=mock_ssl_channel_creds, + ) + mock_create_channel.assert_called_once_with( + "squid.clam.whelk:443", + credentials=cred, + credentials_file=None, + scopes=( + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/jobs", + ), + ssl_credentials=mock_ssl_channel_creds, + quota_project_id=None, + options=[ + ("grpc.max_send_message_length", -1), + ("grpc.max_receive_message_length", -1), + ], + ) + + # Check if ssl_channel_credentials is not provided, then client_cert_source_for_mtls + # is used. + with mock.patch.object(transport_class, "create_channel", return_value=mock.Mock()): + with mock.patch("grpc.ssl_channel_credentials") as mock_ssl_cred: + transport_class( + credentials=cred, + client_cert_source_for_mtls=client_cert_source_callback, + ) + expected_cert, expected_key = client_cert_source_callback() + mock_ssl_cred.assert_called_once_with( + certificate_chain=expected_cert, private_key=expected_key + ) + + def test_tenant_service_host_no_port(): client = TenantServiceClient( credentials=credentials.AnonymousCredentials(), @@ -1731,7 +1778,7 @@ def test_tenant_service_host_with_port(): def test_tenant_service_grpc_transport_channel(): - channel = grpc.insecure_channel("http://localhost/") + channel = grpc.secure_channel("http://localhost/", grpc.local_channel_credentials()) # Check that channel is used if provided. transport = transports.TenantServiceGrpcTransport( @@ -1743,7 +1790,7 @@ def test_tenant_service_grpc_transport_channel(): def test_tenant_service_grpc_asyncio_transport_channel(): - channel = aio.insecure_channel("http://localhost/") + channel = aio.secure_channel("http://localhost/", grpc.local_channel_credentials()) # Check that channel is used if provided. transport = transports.TenantServiceGrpcAsyncIOTransport( @@ -1754,6 +1801,8 @@ def test_tenant_service_grpc_asyncio_transport_channel(): assert transport._ssl_channel_credentials == None +# Remove this test when deprecated arguments (api_mtls_endpoint, client_cert_source) are +# removed from grpc/grpc_asyncio transport constructor. @pytest.mark.parametrize( "transport_class", [ @@ -1766,7 +1815,7 @@ def test_tenant_service_transport_channel_mtls_with_client_cert_source(transport "grpc.ssl_channel_credentials", autospec=True ) as grpc_ssl_channel_cred: with mock.patch.object( - transport_class, "create_channel", autospec=True + transport_class, "create_channel" ) as grpc_create_channel: mock_ssl_cred = mock.Mock() grpc_ssl_channel_cred.return_value = mock_ssl_cred @@ -1807,6 +1856,8 @@ def test_tenant_service_transport_channel_mtls_with_client_cert_source(transport assert transport._ssl_channel_credentials == mock_ssl_cred +# Remove this test when deprecated arguments (api_mtls_endpoint, client_cert_source) are +# removed from grpc/grpc_asyncio transport constructor. @pytest.mark.parametrize( "transport_class", [ @@ -1822,7 +1873,7 @@ def test_tenant_service_transport_channel_mtls_with_adc(transport_class): ssl_credentials=mock.PropertyMock(return_value=mock_ssl_cred), ): with mock.patch.object( - transport_class, "create_channel", autospec=True + transport_class, "create_channel" ) as grpc_create_channel: mock_grpc_channel = mock.Mock() grpc_create_channel.return_value = mock_grpc_channel diff --git a/tests/unit/gapic/talent_v4beta1/test_application_service.py b/tests/unit/gapic/talent_v4beta1/test_application_service.py index 9504a896..e0818c5f 100644 --- a/tests/unit/gapic/talent_v4beta1/test_application_service.py +++ b/tests/unit/gapic/talent_v4beta1/test_application_service.py @@ -96,8 +96,21 @@ def test__get_default_mtls_endpoint(): ) +def test_application_service_client_from_service_account_info(): + creds = credentials.AnonymousCredentials() + with mock.patch.object( + service_account.Credentials, "from_service_account_info" + ) as factory: + factory.return_value = creds + info = {"valid": True} + client = ApplicationServiceClient.from_service_account_info(info) + assert client.transport._credentials == creds + + assert client.transport._host == "jobs.googleapis.com:443" + + @pytest.mark.parametrize( - "client_class", [ApplicationServiceClient, ApplicationServiceAsyncClient] + "client_class", [ApplicationServiceClient, ApplicationServiceAsyncClient,] ) def test_application_service_client_from_service_account_file(client_class): creds = credentials.AnonymousCredentials() @@ -116,7 +129,10 @@ def test_application_service_client_from_service_account_file(client_class): def test_application_service_client_get_transport_class(): transport = ApplicationServiceClient.get_transport_class() - assert transport == transports.ApplicationServiceGrpcTransport + available_transports = [ + transports.ApplicationServiceGrpcTransport, + ] + assert transport in available_transports transport = ApplicationServiceClient.get_transport_class("grpc") assert transport == transports.ApplicationServiceGrpcTransport @@ -167,7 +183,7 @@ def test_application_service_client_client_options( credentials_file=None, host="squid.clam.whelk", scopes=None, - ssl_channel_credentials=None, + client_cert_source_for_mtls=None, quota_project_id=None, client_info=transports.base.DEFAULT_CLIENT_INFO, ) @@ -183,7 +199,7 @@ def test_application_service_client_client_options( credentials_file=None, host=client.DEFAULT_ENDPOINT, scopes=None, - ssl_channel_credentials=None, + client_cert_source_for_mtls=None, quota_project_id=None, client_info=transports.base.DEFAULT_CLIENT_INFO, ) @@ -199,7 +215,7 @@ def test_application_service_client_client_options( credentials_file=None, host=client.DEFAULT_MTLS_ENDPOINT, scopes=None, - ssl_channel_credentials=None, + client_cert_source_for_mtls=None, quota_project_id=None, client_info=transports.base.DEFAULT_CLIENT_INFO, ) @@ -227,7 +243,7 @@ def test_application_service_client_client_options( credentials_file=None, host=client.DEFAULT_ENDPOINT, scopes=None, - ssl_channel_credentials=None, + client_cert_source_for_mtls=None, quota_project_id="octopus", client_info=transports.base.DEFAULT_CLIENT_INFO, ) @@ -288,29 +304,25 @@ def test_application_service_client_mtls_env_auto( client_cert_source=client_cert_source_callback ) with mock.patch.object(transport_class, "__init__") as patched: - ssl_channel_creds = mock.Mock() - with mock.patch( - "grpc.ssl_channel_credentials", return_value=ssl_channel_creds - ): - patched.return_value = None - client = client_class(client_options=options) + patched.return_value = None + client = client_class(client_options=options) - if use_client_cert_env == "false": - expected_ssl_channel_creds = None - expected_host = client.DEFAULT_ENDPOINT - else: - expected_ssl_channel_creds = ssl_channel_creds - expected_host = client.DEFAULT_MTLS_ENDPOINT + if use_client_cert_env == "false": + expected_client_cert_source = None + expected_host = client.DEFAULT_ENDPOINT + else: + expected_client_cert_source = client_cert_source_callback + expected_host = client.DEFAULT_MTLS_ENDPOINT - patched.assert_called_once_with( - credentials=None, - credentials_file=None, - host=expected_host, - scopes=None, - ssl_channel_credentials=expected_ssl_channel_creds, - quota_project_id=None, - client_info=transports.base.DEFAULT_CLIENT_INFO, - ) + patched.assert_called_once_with( + credentials=None, + credentials_file=None, + host=expected_host, + scopes=None, + client_cert_source_for_mtls=expected_client_cert_source, + quota_project_id=None, + client_info=transports.base.DEFAULT_CLIENT_INFO, + ) # Check the case ADC client cert is provided. Whether client cert is used depends on # GOOGLE_API_USE_CLIENT_CERTIFICATE value. @@ -319,66 +331,53 @@ def test_application_service_client_mtls_env_auto( ): with mock.patch.object(transport_class, "__init__") as patched: with mock.patch( - "google.auth.transport.grpc.SslCredentials.__init__", return_value=None + "google.auth.transport.mtls.has_default_client_cert_source", + return_value=True, ): with mock.patch( - "google.auth.transport.grpc.SslCredentials.is_mtls", - new_callable=mock.PropertyMock, - ) as is_mtls_mock: - with mock.patch( - "google.auth.transport.grpc.SslCredentials.ssl_credentials", - new_callable=mock.PropertyMock, - ) as ssl_credentials_mock: - if use_client_cert_env == "false": - is_mtls_mock.return_value = False - ssl_credentials_mock.return_value = None - expected_host = client.DEFAULT_ENDPOINT - expected_ssl_channel_creds = None - else: - is_mtls_mock.return_value = True - ssl_credentials_mock.return_value = mock.Mock() - expected_host = client.DEFAULT_MTLS_ENDPOINT - expected_ssl_channel_creds = ( - ssl_credentials_mock.return_value - ) - - patched.return_value = None - client = client_class() - patched.assert_called_once_with( - credentials=None, - credentials_file=None, - host=expected_host, - scopes=None, - ssl_channel_credentials=expected_ssl_channel_creds, - quota_project_id=None, - client_info=transports.base.DEFAULT_CLIENT_INFO, - ) + "google.auth.transport.mtls.default_client_cert_source", + return_value=client_cert_source_callback, + ): + if use_client_cert_env == "false": + expected_host = client.DEFAULT_ENDPOINT + expected_client_cert_source = None + else: + expected_host = client.DEFAULT_MTLS_ENDPOINT + expected_client_cert_source = client_cert_source_callback - # Check the case client_cert_source and ADC client cert are not provided. - with mock.patch.dict( - os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": use_client_cert_env} - ): - with mock.patch.object(transport_class, "__init__") as patched: - with mock.patch( - "google.auth.transport.grpc.SslCredentials.__init__", return_value=None - ): - with mock.patch( - "google.auth.transport.grpc.SslCredentials.is_mtls", - new_callable=mock.PropertyMock, - ) as is_mtls_mock: - is_mtls_mock.return_value = False patched.return_value = None client = client_class() patched.assert_called_once_with( credentials=None, credentials_file=None, - host=client.DEFAULT_ENDPOINT, + host=expected_host, scopes=None, - ssl_channel_credentials=None, + client_cert_source_for_mtls=expected_client_cert_source, quota_project_id=None, client_info=transports.base.DEFAULT_CLIENT_INFO, ) + # Check the case client_cert_source and ADC client cert are not provided. + with mock.patch.dict( + os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": use_client_cert_env} + ): + 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, + client_cert_source_for_mtls=None, + quota_project_id=None, + client_info=transports.base.DEFAULT_CLIENT_INFO, + ) + @pytest.mark.parametrize( "client_class,transport_class,transport_name", @@ -404,7 +403,7 @@ def test_application_service_client_client_options_scopes( credentials_file=None, host=client.DEFAULT_ENDPOINT, scopes=["1", "2"], - ssl_channel_credentials=None, + client_cert_source_for_mtls=None, quota_project_id=None, client_info=transports.base.DEFAULT_CLIENT_INFO, ) @@ -434,7 +433,7 @@ def test_application_service_client_client_options_credentials_file( credentials_file="credentials.json", host=client.DEFAULT_ENDPOINT, scopes=None, - ssl_channel_credentials=None, + client_cert_source_for_mtls=None, quota_project_id=None, client_info=transports.base.DEFAULT_CLIENT_INFO, ) @@ -453,7 +452,7 @@ def test_application_service_client_client_options_from_dict(): credentials_file=None, host="squid.clam.whelk", scopes=None, - ssl_channel_credentials=None, + client_cert_source_for_mtls=None, quota_project_id=None, client_info=transports.base.DEFAULT_CLIENT_INFO, ) @@ -2018,6 +2017,56 @@ def test_application_service_transport_auth_adc(): ) +@pytest.mark.parametrize( + "transport_class", + [ + transports.ApplicationServiceGrpcTransport, + transports.ApplicationServiceGrpcAsyncIOTransport, + ], +) +def test_application_service_grpc_transport_client_cert_source_for_mtls( + transport_class, +): + cred = credentials.AnonymousCredentials() + + # Check ssl_channel_credentials is used if provided. + with mock.patch.object(transport_class, "create_channel") as mock_create_channel: + mock_ssl_channel_creds = mock.Mock() + transport_class( + host="squid.clam.whelk", + credentials=cred, + ssl_channel_credentials=mock_ssl_channel_creds, + ) + mock_create_channel.assert_called_once_with( + "squid.clam.whelk:443", + credentials=cred, + credentials_file=None, + scopes=( + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/jobs", + ), + ssl_credentials=mock_ssl_channel_creds, + quota_project_id=None, + options=[ + ("grpc.max_send_message_length", -1), + ("grpc.max_receive_message_length", -1), + ], + ) + + # Check if ssl_channel_credentials is not provided, then client_cert_source_for_mtls + # is used. + with mock.patch.object(transport_class, "create_channel", return_value=mock.Mock()): + with mock.patch("grpc.ssl_channel_credentials") as mock_ssl_cred: + transport_class( + credentials=cred, + client_cert_source_for_mtls=client_cert_source_callback, + ) + expected_cert, expected_key = client_cert_source_callback() + mock_ssl_cred.assert_called_once_with( + certificate_chain=expected_cert, private_key=expected_key + ) + + def test_application_service_host_no_port(): client = ApplicationServiceClient( credentials=credentials.AnonymousCredentials(), @@ -2037,7 +2086,7 @@ def test_application_service_host_with_port(): def test_application_service_grpc_transport_channel(): - channel = grpc.insecure_channel("http://localhost/") + channel = grpc.secure_channel("http://localhost/", grpc.local_channel_credentials()) # Check that channel is used if provided. transport = transports.ApplicationServiceGrpcTransport( @@ -2049,7 +2098,7 @@ def test_application_service_grpc_transport_channel(): def test_application_service_grpc_asyncio_transport_channel(): - channel = aio.insecure_channel("http://localhost/") + channel = aio.secure_channel("http://localhost/", grpc.local_channel_credentials()) # Check that channel is used if provided. transport = transports.ApplicationServiceGrpcAsyncIOTransport( @@ -2060,6 +2109,8 @@ def test_application_service_grpc_asyncio_transport_channel(): assert transport._ssl_channel_credentials == None +# Remove this test when deprecated arguments (api_mtls_endpoint, client_cert_source) are +# removed from grpc/grpc_asyncio transport constructor. @pytest.mark.parametrize( "transport_class", [ @@ -2074,7 +2125,7 @@ def test_application_service_transport_channel_mtls_with_client_cert_source( "grpc.ssl_channel_credentials", autospec=True ) as grpc_ssl_channel_cred: with mock.patch.object( - transport_class, "create_channel", autospec=True + transport_class, "create_channel" ) as grpc_create_channel: mock_ssl_cred = mock.Mock() grpc_ssl_channel_cred.return_value = mock_ssl_cred @@ -2115,6 +2166,8 @@ def test_application_service_transport_channel_mtls_with_client_cert_source( assert transport._ssl_channel_credentials == mock_ssl_cred +# Remove this test when deprecated arguments (api_mtls_endpoint, client_cert_source) are +# removed from grpc/grpc_asyncio transport constructor. @pytest.mark.parametrize( "transport_class", [ @@ -2130,7 +2183,7 @@ def test_application_service_transport_channel_mtls_with_adc(transport_class): ssl_credentials=mock.PropertyMock(return_value=mock_ssl_cred), ): with mock.patch.object( - transport_class, "create_channel", autospec=True + transport_class, "create_channel" ) as grpc_create_channel: mock_grpc_channel = mock.Mock() grpc_create_channel.return_value = mock_grpc_channel diff --git a/tests/unit/gapic/talent_v4beta1/test_company_service.py b/tests/unit/gapic/talent_v4beta1/test_company_service.py index 603a1904..ff350367 100644 --- a/tests/unit/gapic/talent_v4beta1/test_company_service.py +++ b/tests/unit/gapic/talent_v4beta1/test_company_service.py @@ -92,8 +92,21 @@ def test__get_default_mtls_endpoint(): ) +def test_company_service_client_from_service_account_info(): + creds = credentials.AnonymousCredentials() + with mock.patch.object( + service_account.Credentials, "from_service_account_info" + ) as factory: + factory.return_value = creds + info = {"valid": True} + client = CompanyServiceClient.from_service_account_info(info) + assert client.transport._credentials == creds + + assert client.transport._host == "jobs.googleapis.com:443" + + @pytest.mark.parametrize( - "client_class", [CompanyServiceClient, CompanyServiceAsyncClient] + "client_class", [CompanyServiceClient, CompanyServiceAsyncClient,] ) def test_company_service_client_from_service_account_file(client_class): creds = credentials.AnonymousCredentials() @@ -112,7 +125,10 @@ def test_company_service_client_from_service_account_file(client_class): def test_company_service_client_get_transport_class(): transport = CompanyServiceClient.get_transport_class() - assert transport == transports.CompanyServiceGrpcTransport + available_transports = [ + transports.CompanyServiceGrpcTransport, + ] + assert transport in available_transports transport = CompanyServiceClient.get_transport_class("grpc") assert transport == transports.CompanyServiceGrpcTransport @@ -163,7 +179,7 @@ def test_company_service_client_client_options( credentials_file=None, host="squid.clam.whelk", scopes=None, - ssl_channel_credentials=None, + client_cert_source_for_mtls=None, quota_project_id=None, client_info=transports.base.DEFAULT_CLIENT_INFO, ) @@ -179,7 +195,7 @@ def test_company_service_client_client_options( credentials_file=None, host=client.DEFAULT_ENDPOINT, scopes=None, - ssl_channel_credentials=None, + client_cert_source_for_mtls=None, quota_project_id=None, client_info=transports.base.DEFAULT_CLIENT_INFO, ) @@ -195,7 +211,7 @@ def test_company_service_client_client_options( credentials_file=None, host=client.DEFAULT_MTLS_ENDPOINT, scopes=None, - ssl_channel_credentials=None, + client_cert_source_for_mtls=None, quota_project_id=None, client_info=transports.base.DEFAULT_CLIENT_INFO, ) @@ -223,7 +239,7 @@ def test_company_service_client_client_options( credentials_file=None, host=client.DEFAULT_ENDPOINT, scopes=None, - ssl_channel_credentials=None, + client_cert_source_for_mtls=None, quota_project_id="octopus", client_info=transports.base.DEFAULT_CLIENT_INFO, ) @@ -274,29 +290,25 @@ def test_company_service_client_mtls_env_auto( client_cert_source=client_cert_source_callback ) with mock.patch.object(transport_class, "__init__") as patched: - ssl_channel_creds = mock.Mock() - with mock.patch( - "grpc.ssl_channel_credentials", return_value=ssl_channel_creds - ): - patched.return_value = None - client = client_class(client_options=options) + patched.return_value = None + client = client_class(client_options=options) - if use_client_cert_env == "false": - expected_ssl_channel_creds = None - expected_host = client.DEFAULT_ENDPOINT - else: - expected_ssl_channel_creds = ssl_channel_creds - expected_host = client.DEFAULT_MTLS_ENDPOINT + if use_client_cert_env == "false": + expected_client_cert_source = None + expected_host = client.DEFAULT_ENDPOINT + else: + expected_client_cert_source = client_cert_source_callback + expected_host = client.DEFAULT_MTLS_ENDPOINT - patched.assert_called_once_with( - credentials=None, - credentials_file=None, - host=expected_host, - scopes=None, - ssl_channel_credentials=expected_ssl_channel_creds, - quota_project_id=None, - client_info=transports.base.DEFAULT_CLIENT_INFO, - ) + patched.assert_called_once_with( + credentials=None, + credentials_file=None, + host=expected_host, + scopes=None, + client_cert_source_for_mtls=expected_client_cert_source, + quota_project_id=None, + client_info=transports.base.DEFAULT_CLIENT_INFO, + ) # Check the case ADC client cert is provided. Whether client cert is used depends on # GOOGLE_API_USE_CLIENT_CERTIFICATE value. @@ -305,66 +317,53 @@ def test_company_service_client_mtls_env_auto( ): with mock.patch.object(transport_class, "__init__") as patched: with mock.patch( - "google.auth.transport.grpc.SslCredentials.__init__", return_value=None + "google.auth.transport.mtls.has_default_client_cert_source", + return_value=True, ): with mock.patch( - "google.auth.transport.grpc.SslCredentials.is_mtls", - new_callable=mock.PropertyMock, - ) as is_mtls_mock: - with mock.patch( - "google.auth.transport.grpc.SslCredentials.ssl_credentials", - new_callable=mock.PropertyMock, - ) as ssl_credentials_mock: - if use_client_cert_env == "false": - is_mtls_mock.return_value = False - ssl_credentials_mock.return_value = None - expected_host = client.DEFAULT_ENDPOINT - expected_ssl_channel_creds = None - else: - is_mtls_mock.return_value = True - ssl_credentials_mock.return_value = mock.Mock() - expected_host = client.DEFAULT_MTLS_ENDPOINT - expected_ssl_channel_creds = ( - ssl_credentials_mock.return_value - ) - - patched.return_value = None - client = client_class() - patched.assert_called_once_with( - credentials=None, - credentials_file=None, - host=expected_host, - scopes=None, - ssl_channel_credentials=expected_ssl_channel_creds, - quota_project_id=None, - client_info=transports.base.DEFAULT_CLIENT_INFO, - ) + "google.auth.transport.mtls.default_client_cert_source", + return_value=client_cert_source_callback, + ): + if use_client_cert_env == "false": + expected_host = client.DEFAULT_ENDPOINT + expected_client_cert_source = None + else: + expected_host = client.DEFAULT_MTLS_ENDPOINT + expected_client_cert_source = client_cert_source_callback - # Check the case client_cert_source and ADC client cert are not provided. - with mock.patch.dict( - os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": use_client_cert_env} - ): - with mock.patch.object(transport_class, "__init__") as patched: - with mock.patch( - "google.auth.transport.grpc.SslCredentials.__init__", return_value=None - ): - with mock.patch( - "google.auth.transport.grpc.SslCredentials.is_mtls", - new_callable=mock.PropertyMock, - ) as is_mtls_mock: - is_mtls_mock.return_value = False patched.return_value = None client = client_class() patched.assert_called_once_with( credentials=None, credentials_file=None, - host=client.DEFAULT_ENDPOINT, + host=expected_host, scopes=None, - ssl_channel_credentials=None, + client_cert_source_for_mtls=expected_client_cert_source, quota_project_id=None, client_info=transports.base.DEFAULT_CLIENT_INFO, ) + # Check the case client_cert_source and ADC client cert are not provided. + with mock.patch.dict( + os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": use_client_cert_env} + ): + 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, + client_cert_source_for_mtls=None, + quota_project_id=None, + client_info=transports.base.DEFAULT_CLIENT_INFO, + ) + @pytest.mark.parametrize( "client_class,transport_class,transport_name", @@ -390,7 +389,7 @@ def test_company_service_client_client_options_scopes( credentials_file=None, host=client.DEFAULT_ENDPOINT, scopes=["1", "2"], - ssl_channel_credentials=None, + client_cert_source_for_mtls=None, quota_project_id=None, client_info=transports.base.DEFAULT_CLIENT_INFO, ) @@ -420,7 +419,7 @@ def test_company_service_client_client_options_credentials_file( credentials_file="credentials.json", host=client.DEFAULT_ENDPOINT, scopes=None, - ssl_channel_credentials=None, + client_cert_source_for_mtls=None, quota_project_id=None, client_info=transports.base.DEFAULT_CLIENT_INFO, ) @@ -439,7 +438,7 @@ def test_company_service_client_client_options_from_dict(): credentials_file=None, host="squid.clam.whelk", scopes=None, - ssl_channel_credentials=None, + client_cert_source_for_mtls=None, quota_project_id=None, client_info=transports.base.DEFAULT_CLIENT_INFO, ) @@ -1929,6 +1928,54 @@ def test_company_service_transport_auth_adc(): ) +@pytest.mark.parametrize( + "transport_class", + [ + transports.CompanyServiceGrpcTransport, + transports.CompanyServiceGrpcAsyncIOTransport, + ], +) +def test_company_service_grpc_transport_client_cert_source_for_mtls(transport_class): + cred = credentials.AnonymousCredentials() + + # Check ssl_channel_credentials is used if provided. + with mock.patch.object(transport_class, "create_channel") as mock_create_channel: + mock_ssl_channel_creds = mock.Mock() + transport_class( + host="squid.clam.whelk", + credentials=cred, + ssl_channel_credentials=mock_ssl_channel_creds, + ) + mock_create_channel.assert_called_once_with( + "squid.clam.whelk:443", + credentials=cred, + credentials_file=None, + scopes=( + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/jobs", + ), + ssl_credentials=mock_ssl_channel_creds, + quota_project_id=None, + options=[ + ("grpc.max_send_message_length", -1), + ("grpc.max_receive_message_length", -1), + ], + ) + + # Check if ssl_channel_credentials is not provided, then client_cert_source_for_mtls + # is used. + with mock.patch.object(transport_class, "create_channel", return_value=mock.Mock()): + with mock.patch("grpc.ssl_channel_credentials") as mock_ssl_cred: + transport_class( + credentials=cred, + client_cert_source_for_mtls=client_cert_source_callback, + ) + expected_cert, expected_key = client_cert_source_callback() + mock_ssl_cred.assert_called_once_with( + certificate_chain=expected_cert, private_key=expected_key + ) + + def test_company_service_host_no_port(): client = CompanyServiceClient( credentials=credentials.AnonymousCredentials(), @@ -1948,7 +1995,7 @@ def test_company_service_host_with_port(): def test_company_service_grpc_transport_channel(): - channel = grpc.insecure_channel("http://localhost/") + channel = grpc.secure_channel("http://localhost/", grpc.local_channel_credentials()) # Check that channel is used if provided. transport = transports.CompanyServiceGrpcTransport( @@ -1960,7 +2007,7 @@ def test_company_service_grpc_transport_channel(): def test_company_service_grpc_asyncio_transport_channel(): - channel = aio.insecure_channel("http://localhost/") + channel = aio.secure_channel("http://localhost/", grpc.local_channel_credentials()) # Check that channel is used if provided. transport = transports.CompanyServiceGrpcAsyncIOTransport( @@ -1971,6 +2018,8 @@ def test_company_service_grpc_asyncio_transport_channel(): assert transport._ssl_channel_credentials == None +# Remove this test when deprecated arguments (api_mtls_endpoint, client_cert_source) are +# removed from grpc/grpc_asyncio transport constructor. @pytest.mark.parametrize( "transport_class", [ @@ -1985,7 +2034,7 @@ def test_company_service_transport_channel_mtls_with_client_cert_source( "grpc.ssl_channel_credentials", autospec=True ) as grpc_ssl_channel_cred: with mock.patch.object( - transport_class, "create_channel", autospec=True + transport_class, "create_channel" ) as grpc_create_channel: mock_ssl_cred = mock.Mock() grpc_ssl_channel_cred.return_value = mock_ssl_cred @@ -2026,6 +2075,8 @@ def test_company_service_transport_channel_mtls_with_client_cert_source( assert transport._ssl_channel_credentials == mock_ssl_cred +# Remove this test when deprecated arguments (api_mtls_endpoint, client_cert_source) are +# removed from grpc/grpc_asyncio transport constructor. @pytest.mark.parametrize( "transport_class", [ @@ -2041,7 +2092,7 @@ def test_company_service_transport_channel_mtls_with_adc(transport_class): ssl_credentials=mock.PropertyMock(return_value=mock_ssl_cred), ): with mock.patch.object( - transport_class, "create_channel", autospec=True + transport_class, "create_channel" ) as grpc_create_channel: mock_grpc_channel = mock.Mock() grpc_create_channel.return_value = mock_grpc_channel diff --git a/tests/unit/gapic/talent_v4beta1/test_completion.py b/tests/unit/gapic/talent_v4beta1/test_completion.py index b03a7da9..48259e17 100644 --- a/tests/unit/gapic/talent_v4beta1/test_completion.py +++ b/tests/unit/gapic/talent_v4beta1/test_completion.py @@ -81,7 +81,20 @@ def test__get_default_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_info(): + creds = credentials.AnonymousCredentials() + with mock.patch.object( + service_account.Credentials, "from_service_account_info" + ) as factory: + factory.return_value = creds + info = {"valid": True} + client = CompletionClient.from_service_account_info(info) + assert client.transport._credentials == creds + + assert client.transport._host == "jobs.googleapis.com:443" + + +@pytest.mark.parametrize("client_class", [CompletionClient, CompletionAsyncClient,]) def test_completion_client_from_service_account_file(client_class): creds = credentials.AnonymousCredentials() with mock.patch.object( @@ -99,7 +112,10 @@ def test_completion_client_from_service_account_file(client_class): def test_completion_client_get_transport_class(): transport = CompletionClient.get_transport_class() - assert transport == transports.CompletionGrpcTransport + available_transports = [ + transports.CompletionGrpcTransport, + ] + assert transport in available_transports transport = CompletionClient.get_transport_class("grpc") assert transport == transports.CompletionGrpcTransport @@ -148,7 +164,7 @@ def test_completion_client_client_options( credentials_file=None, host="squid.clam.whelk", scopes=None, - ssl_channel_credentials=None, + client_cert_source_for_mtls=None, quota_project_id=None, client_info=transports.base.DEFAULT_CLIENT_INFO, ) @@ -164,7 +180,7 @@ def test_completion_client_client_options( credentials_file=None, host=client.DEFAULT_ENDPOINT, scopes=None, - ssl_channel_credentials=None, + client_cert_source_for_mtls=None, quota_project_id=None, client_info=transports.base.DEFAULT_CLIENT_INFO, ) @@ -180,7 +196,7 @@ def test_completion_client_client_options( credentials_file=None, host=client.DEFAULT_MTLS_ENDPOINT, scopes=None, - ssl_channel_credentials=None, + client_cert_source_for_mtls=None, quota_project_id=None, client_info=transports.base.DEFAULT_CLIENT_INFO, ) @@ -208,7 +224,7 @@ def test_completion_client_client_options( credentials_file=None, host=client.DEFAULT_ENDPOINT, scopes=None, - ssl_channel_credentials=None, + client_cert_source_for_mtls=None, quota_project_id="octopus", client_info=transports.base.DEFAULT_CLIENT_INFO, ) @@ -257,29 +273,25 @@ def test_completion_client_mtls_env_auto( client_cert_source=client_cert_source_callback ) with mock.patch.object(transport_class, "__init__") as patched: - ssl_channel_creds = mock.Mock() - with mock.patch( - "grpc.ssl_channel_credentials", return_value=ssl_channel_creds - ): - patched.return_value = None - client = client_class(client_options=options) + patched.return_value = None + client = client_class(client_options=options) - if use_client_cert_env == "false": - expected_ssl_channel_creds = None - expected_host = client.DEFAULT_ENDPOINT - else: - expected_ssl_channel_creds = ssl_channel_creds - expected_host = client.DEFAULT_MTLS_ENDPOINT + if use_client_cert_env == "false": + expected_client_cert_source = None + expected_host = client.DEFAULT_ENDPOINT + else: + expected_client_cert_source = client_cert_source_callback + expected_host = client.DEFAULT_MTLS_ENDPOINT - patched.assert_called_once_with( - credentials=None, - credentials_file=None, - host=expected_host, - scopes=None, - ssl_channel_credentials=expected_ssl_channel_creds, - quota_project_id=None, - client_info=transports.base.DEFAULT_CLIENT_INFO, - ) + patched.assert_called_once_with( + credentials=None, + credentials_file=None, + host=expected_host, + scopes=None, + client_cert_source_for_mtls=expected_client_cert_source, + quota_project_id=None, + client_info=transports.base.DEFAULT_CLIENT_INFO, + ) # Check the case ADC client cert is provided. Whether client cert is used depends on # GOOGLE_API_USE_CLIENT_CERTIFICATE value. @@ -288,66 +300,53 @@ def test_completion_client_mtls_env_auto( ): with mock.patch.object(transport_class, "__init__") as patched: with mock.patch( - "google.auth.transport.grpc.SslCredentials.__init__", return_value=None + "google.auth.transport.mtls.has_default_client_cert_source", + return_value=True, ): with mock.patch( - "google.auth.transport.grpc.SslCredentials.is_mtls", - new_callable=mock.PropertyMock, - ) as is_mtls_mock: - with mock.patch( - "google.auth.transport.grpc.SslCredentials.ssl_credentials", - new_callable=mock.PropertyMock, - ) as ssl_credentials_mock: - if use_client_cert_env == "false": - is_mtls_mock.return_value = False - ssl_credentials_mock.return_value = None - expected_host = client.DEFAULT_ENDPOINT - expected_ssl_channel_creds = None - else: - is_mtls_mock.return_value = True - ssl_credentials_mock.return_value = mock.Mock() - expected_host = client.DEFAULT_MTLS_ENDPOINT - expected_ssl_channel_creds = ( - ssl_credentials_mock.return_value - ) - - patched.return_value = None - client = client_class() - patched.assert_called_once_with( - credentials=None, - credentials_file=None, - host=expected_host, - scopes=None, - ssl_channel_credentials=expected_ssl_channel_creds, - quota_project_id=None, - client_info=transports.base.DEFAULT_CLIENT_INFO, - ) + "google.auth.transport.mtls.default_client_cert_source", + return_value=client_cert_source_callback, + ): + if use_client_cert_env == "false": + expected_host = client.DEFAULT_ENDPOINT + expected_client_cert_source = None + else: + expected_host = client.DEFAULT_MTLS_ENDPOINT + expected_client_cert_source = client_cert_source_callback - # Check the case client_cert_source and ADC client cert are not provided. - with mock.patch.dict( - os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": use_client_cert_env} - ): - with mock.patch.object(transport_class, "__init__") as patched: - with mock.patch( - "google.auth.transport.grpc.SslCredentials.__init__", return_value=None - ): - with mock.patch( - "google.auth.transport.grpc.SslCredentials.is_mtls", - new_callable=mock.PropertyMock, - ) as is_mtls_mock: - is_mtls_mock.return_value = False patched.return_value = None client = client_class() patched.assert_called_once_with( credentials=None, credentials_file=None, - host=client.DEFAULT_ENDPOINT, + host=expected_host, scopes=None, - ssl_channel_credentials=None, + client_cert_source_for_mtls=expected_client_cert_source, quota_project_id=None, client_info=transports.base.DEFAULT_CLIENT_INFO, ) + # Check the case client_cert_source and ADC client cert are not provided. + with mock.patch.dict( + os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": use_client_cert_env} + ): + 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, + client_cert_source_for_mtls=None, + quota_project_id=None, + client_info=transports.base.DEFAULT_CLIENT_INFO, + ) + @pytest.mark.parametrize( "client_class,transport_class,transport_name", @@ -373,7 +372,7 @@ def test_completion_client_client_options_scopes( credentials_file=None, host=client.DEFAULT_ENDPOINT, scopes=["1", "2"], - ssl_channel_credentials=None, + client_cert_source_for_mtls=None, quota_project_id=None, client_info=transports.base.DEFAULT_CLIENT_INFO, ) @@ -403,7 +402,7 @@ def test_completion_client_client_options_credentials_file( credentials_file="credentials.json", host=client.DEFAULT_ENDPOINT, scopes=None, - ssl_channel_credentials=None, + client_cert_source_for_mtls=None, quota_project_id=None, client_info=transports.base.DEFAULT_CLIENT_INFO, ) @@ -420,7 +419,7 @@ def test_completion_client_client_options_from_dict(): credentials_file=None, host="squid.clam.whelk", scopes=None, - ssl_channel_credentials=None, + client_cert_source_for_mtls=None, quota_project_id=None, client_info=transports.base.DEFAULT_CLIENT_INFO, ) @@ -603,7 +602,7 @@ def test_transport_get_channel(): @pytest.mark.parametrize( "transport_class", - [transports.CompletionGrpcTransport, transports.CompletionGrpcAsyncIOTransport], + [transports.CompletionGrpcTransport, transports.CompletionGrpcAsyncIOTransport,], ) def test_transport_adc(transport_class): # Test default credentials are used if not provided. @@ -710,6 +709,51 @@ def test_completion_transport_auth_adc(): ) +@pytest.mark.parametrize( + "transport_class", + [transports.CompletionGrpcTransport, transports.CompletionGrpcAsyncIOTransport], +) +def test_completion_grpc_transport_client_cert_source_for_mtls(transport_class): + cred = credentials.AnonymousCredentials() + + # Check ssl_channel_credentials is used if provided. + with mock.patch.object(transport_class, "create_channel") as mock_create_channel: + mock_ssl_channel_creds = mock.Mock() + transport_class( + host="squid.clam.whelk", + credentials=cred, + ssl_channel_credentials=mock_ssl_channel_creds, + ) + mock_create_channel.assert_called_once_with( + "squid.clam.whelk:443", + credentials=cred, + credentials_file=None, + scopes=( + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/jobs", + ), + ssl_credentials=mock_ssl_channel_creds, + quota_project_id=None, + options=[ + ("grpc.max_send_message_length", -1), + ("grpc.max_receive_message_length", -1), + ], + ) + + # Check if ssl_channel_credentials is not provided, then client_cert_source_for_mtls + # is used. + with mock.patch.object(transport_class, "create_channel", return_value=mock.Mock()): + with mock.patch("grpc.ssl_channel_credentials") as mock_ssl_cred: + transport_class( + credentials=cred, + client_cert_source_for_mtls=client_cert_source_callback, + ) + expected_cert, expected_key = client_cert_source_callback() + mock_ssl_cred.assert_called_once_with( + certificate_chain=expected_cert, private_key=expected_key + ) + + def test_completion_host_no_port(): client = CompletionClient( credentials=credentials.AnonymousCredentials(), @@ -729,7 +773,7 @@ def test_completion_host_with_port(): def test_completion_grpc_transport_channel(): - channel = grpc.insecure_channel("http://localhost/") + channel = grpc.secure_channel("http://localhost/", grpc.local_channel_credentials()) # Check that channel is used if provided. transport = transports.CompletionGrpcTransport( @@ -741,7 +785,7 @@ def test_completion_grpc_transport_channel(): def test_completion_grpc_asyncio_transport_channel(): - channel = aio.insecure_channel("http://localhost/") + channel = aio.secure_channel("http://localhost/", grpc.local_channel_credentials()) # Check that channel is used if provided. transport = transports.CompletionGrpcAsyncIOTransport( @@ -752,6 +796,8 @@ def test_completion_grpc_asyncio_transport_channel(): assert transport._ssl_channel_credentials == None +# Remove this test when deprecated arguments (api_mtls_endpoint, client_cert_source) are +# removed from grpc/grpc_asyncio transport constructor. @pytest.mark.parametrize( "transport_class", [transports.CompletionGrpcTransport, transports.CompletionGrpcAsyncIOTransport], @@ -761,7 +807,7 @@ def test_completion_transport_channel_mtls_with_client_cert_source(transport_cla "grpc.ssl_channel_credentials", autospec=True ) as grpc_ssl_channel_cred: with mock.patch.object( - transport_class, "create_channel", autospec=True + transport_class, "create_channel" ) as grpc_create_channel: mock_ssl_cred = mock.Mock() grpc_ssl_channel_cred.return_value = mock_ssl_cred @@ -802,6 +848,8 @@ def test_completion_transport_channel_mtls_with_client_cert_source(transport_cla assert transport._ssl_channel_credentials == mock_ssl_cred +# Remove this test when deprecated arguments (api_mtls_endpoint, client_cert_source) are +# removed from grpc/grpc_asyncio transport constructor. @pytest.mark.parametrize( "transport_class", [transports.CompletionGrpcTransport, transports.CompletionGrpcAsyncIOTransport], @@ -814,7 +862,7 @@ def test_completion_transport_channel_mtls_with_adc(transport_class): ssl_credentials=mock.PropertyMock(return_value=mock_ssl_cred), ): with mock.patch.object( - transport_class, "create_channel", autospec=True + transport_class, "create_channel" ) as grpc_create_channel: mock_grpc_channel = mock.Mock() grpc_create_channel.return_value = 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 index a5f2b7c0..431e712f 100644 --- a/tests/unit/gapic/talent_v4beta1/test_event_service.py +++ b/tests/unit/gapic/talent_v4beta1/test_event_service.py @@ -82,7 +82,20 @@ def test__get_default_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_info(): + creds = credentials.AnonymousCredentials() + with mock.patch.object( + service_account.Credentials, "from_service_account_info" + ) as factory: + factory.return_value = creds + info = {"valid": True} + client = EventServiceClient.from_service_account_info(info) + assert client.transport._credentials == creds + + assert client.transport._host == "jobs.googleapis.com:443" + + +@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( @@ -100,7 +113,10 @@ def test_event_service_client_from_service_account_file(client_class): def test_event_service_client_get_transport_class(): transport = EventServiceClient.get_transport_class() - assert transport == transports.EventServiceGrpcTransport + available_transports = [ + transports.EventServiceGrpcTransport, + ] + assert transport in available_transports transport = EventServiceClient.get_transport_class("grpc") assert transport == transports.EventServiceGrpcTransport @@ -149,7 +165,7 @@ def test_event_service_client_client_options( credentials_file=None, host="squid.clam.whelk", scopes=None, - ssl_channel_credentials=None, + client_cert_source_for_mtls=None, quota_project_id=None, client_info=transports.base.DEFAULT_CLIENT_INFO, ) @@ -165,7 +181,7 @@ def test_event_service_client_client_options( credentials_file=None, host=client.DEFAULT_ENDPOINT, scopes=None, - ssl_channel_credentials=None, + client_cert_source_for_mtls=None, quota_project_id=None, client_info=transports.base.DEFAULT_CLIENT_INFO, ) @@ -181,7 +197,7 @@ def test_event_service_client_client_options( credentials_file=None, host=client.DEFAULT_MTLS_ENDPOINT, scopes=None, - ssl_channel_credentials=None, + client_cert_source_for_mtls=None, quota_project_id=None, client_info=transports.base.DEFAULT_CLIENT_INFO, ) @@ -209,7 +225,7 @@ def test_event_service_client_client_options( credentials_file=None, host=client.DEFAULT_ENDPOINT, scopes=None, - ssl_channel_credentials=None, + client_cert_source_for_mtls=None, quota_project_id="octopus", client_info=transports.base.DEFAULT_CLIENT_INFO, ) @@ -258,29 +274,25 @@ def test_event_service_client_mtls_env_auto( client_cert_source=client_cert_source_callback ) with mock.patch.object(transport_class, "__init__") as patched: - ssl_channel_creds = mock.Mock() - with mock.patch( - "grpc.ssl_channel_credentials", return_value=ssl_channel_creds - ): - patched.return_value = None - client = client_class(client_options=options) + patched.return_value = None + client = client_class(client_options=options) - if use_client_cert_env == "false": - expected_ssl_channel_creds = None - expected_host = client.DEFAULT_ENDPOINT - else: - expected_ssl_channel_creds = ssl_channel_creds - expected_host = client.DEFAULT_MTLS_ENDPOINT + if use_client_cert_env == "false": + expected_client_cert_source = None + expected_host = client.DEFAULT_ENDPOINT + else: + expected_client_cert_source = client_cert_source_callback + expected_host = client.DEFAULT_MTLS_ENDPOINT - patched.assert_called_once_with( - credentials=None, - credentials_file=None, - host=expected_host, - scopes=None, - ssl_channel_credentials=expected_ssl_channel_creds, - quota_project_id=None, - client_info=transports.base.DEFAULT_CLIENT_INFO, - ) + patched.assert_called_once_with( + credentials=None, + credentials_file=None, + host=expected_host, + scopes=None, + client_cert_source_for_mtls=expected_client_cert_source, + quota_project_id=None, + client_info=transports.base.DEFAULT_CLIENT_INFO, + ) # Check the case ADC client cert is provided. Whether client cert is used depends on # GOOGLE_API_USE_CLIENT_CERTIFICATE value. @@ -289,66 +301,53 @@ def test_event_service_client_mtls_env_auto( ): with mock.patch.object(transport_class, "__init__") as patched: with mock.patch( - "google.auth.transport.grpc.SslCredentials.__init__", return_value=None + "google.auth.transport.mtls.has_default_client_cert_source", + return_value=True, ): with mock.patch( - "google.auth.transport.grpc.SslCredentials.is_mtls", - new_callable=mock.PropertyMock, - ) as is_mtls_mock: - with mock.patch( - "google.auth.transport.grpc.SslCredentials.ssl_credentials", - new_callable=mock.PropertyMock, - ) as ssl_credentials_mock: - if use_client_cert_env == "false": - is_mtls_mock.return_value = False - ssl_credentials_mock.return_value = None - expected_host = client.DEFAULT_ENDPOINT - expected_ssl_channel_creds = None - else: - is_mtls_mock.return_value = True - ssl_credentials_mock.return_value = mock.Mock() - expected_host = client.DEFAULT_MTLS_ENDPOINT - expected_ssl_channel_creds = ( - ssl_credentials_mock.return_value - ) - - patched.return_value = None - client = client_class() - patched.assert_called_once_with( - credentials=None, - credentials_file=None, - host=expected_host, - scopes=None, - ssl_channel_credentials=expected_ssl_channel_creds, - quota_project_id=None, - client_info=transports.base.DEFAULT_CLIENT_INFO, - ) + "google.auth.transport.mtls.default_client_cert_source", + return_value=client_cert_source_callback, + ): + if use_client_cert_env == "false": + expected_host = client.DEFAULT_ENDPOINT + expected_client_cert_source = None + else: + expected_host = client.DEFAULT_MTLS_ENDPOINT + expected_client_cert_source = client_cert_source_callback - # Check the case client_cert_source and ADC client cert are not provided. - with mock.patch.dict( - os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": use_client_cert_env} - ): - with mock.patch.object(transport_class, "__init__") as patched: - with mock.patch( - "google.auth.transport.grpc.SslCredentials.__init__", return_value=None - ): - with mock.patch( - "google.auth.transport.grpc.SslCredentials.is_mtls", - new_callable=mock.PropertyMock, - ) as is_mtls_mock: - is_mtls_mock.return_value = False patched.return_value = None client = client_class() patched.assert_called_once_with( credentials=None, credentials_file=None, - host=client.DEFAULT_ENDPOINT, + host=expected_host, scopes=None, - ssl_channel_credentials=None, + client_cert_source_for_mtls=expected_client_cert_source, quota_project_id=None, client_info=transports.base.DEFAULT_CLIENT_INFO, ) + # Check the case client_cert_source and ADC client cert are not provided. + with mock.patch.dict( + os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": use_client_cert_env} + ): + 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, + client_cert_source_for_mtls=None, + quota_project_id=None, + client_info=transports.base.DEFAULT_CLIENT_INFO, + ) + @pytest.mark.parametrize( "client_class,transport_class,transport_name", @@ -374,7 +373,7 @@ def test_event_service_client_client_options_scopes( credentials_file=None, host=client.DEFAULT_ENDPOINT, scopes=["1", "2"], - ssl_channel_credentials=None, + client_cert_source_for_mtls=None, quota_project_id=None, client_info=transports.base.DEFAULT_CLIENT_INFO, ) @@ -404,7 +403,7 @@ def test_event_service_client_client_options_credentials_file( credentials_file="credentials.json", host=client.DEFAULT_ENDPOINT, scopes=None, - ssl_channel_credentials=None, + client_cert_source_for_mtls=None, quota_project_id=None, client_info=transports.base.DEFAULT_CLIENT_INFO, ) @@ -421,7 +420,7 @@ def test_event_service_client_client_options_from_dict(): credentials_file=None, host="squid.clam.whelk", scopes=None, - ssl_channel_credentials=None, + client_cert_source_for_mtls=None, quota_project_id=None, client_info=transports.base.DEFAULT_CLIENT_INFO, ) @@ -713,7 +712,10 @@ def test_transport_get_channel(): @pytest.mark.parametrize( "transport_class", - [transports.EventServiceGrpcTransport, transports.EventServiceGrpcAsyncIOTransport], + [ + transports.EventServiceGrpcTransport, + transports.EventServiceGrpcAsyncIOTransport, + ], ) def test_transport_adc(transport_class): # Test default credentials are used if not provided. @@ -820,6 +822,51 @@ def test_event_service_transport_auth_adc(): ) +@pytest.mark.parametrize( + "transport_class", + [transports.EventServiceGrpcTransport, transports.EventServiceGrpcAsyncIOTransport], +) +def test_event_service_grpc_transport_client_cert_source_for_mtls(transport_class): + cred = credentials.AnonymousCredentials() + + # Check ssl_channel_credentials is used if provided. + with mock.patch.object(transport_class, "create_channel") as mock_create_channel: + mock_ssl_channel_creds = mock.Mock() + transport_class( + host="squid.clam.whelk", + credentials=cred, + ssl_channel_credentials=mock_ssl_channel_creds, + ) + mock_create_channel.assert_called_once_with( + "squid.clam.whelk:443", + credentials=cred, + credentials_file=None, + scopes=( + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/jobs", + ), + ssl_credentials=mock_ssl_channel_creds, + quota_project_id=None, + options=[ + ("grpc.max_send_message_length", -1), + ("grpc.max_receive_message_length", -1), + ], + ) + + # Check if ssl_channel_credentials is not provided, then client_cert_source_for_mtls + # is used. + with mock.patch.object(transport_class, "create_channel", return_value=mock.Mock()): + with mock.patch("grpc.ssl_channel_credentials") as mock_ssl_cred: + transport_class( + credentials=cred, + client_cert_source_for_mtls=client_cert_source_callback, + ) + expected_cert, expected_key = client_cert_source_callback() + mock_ssl_cred.assert_called_once_with( + certificate_chain=expected_cert, private_key=expected_key + ) + + def test_event_service_host_no_port(): client = EventServiceClient( credentials=credentials.AnonymousCredentials(), @@ -839,7 +886,7 @@ def test_event_service_host_with_port(): def test_event_service_grpc_transport_channel(): - channel = grpc.insecure_channel("http://localhost/") + channel = grpc.secure_channel("http://localhost/", grpc.local_channel_credentials()) # Check that channel is used if provided. transport = transports.EventServiceGrpcTransport( @@ -851,7 +898,7 @@ def test_event_service_grpc_transport_channel(): def test_event_service_grpc_asyncio_transport_channel(): - channel = aio.insecure_channel("http://localhost/") + channel = aio.secure_channel("http://localhost/", grpc.local_channel_credentials()) # Check that channel is used if provided. transport = transports.EventServiceGrpcAsyncIOTransport( @@ -862,6 +909,8 @@ def test_event_service_grpc_asyncio_transport_channel(): assert transport._ssl_channel_credentials == None +# Remove this test when deprecated arguments (api_mtls_endpoint, client_cert_source) are +# removed from grpc/grpc_asyncio transport constructor. @pytest.mark.parametrize( "transport_class", [transports.EventServiceGrpcTransport, transports.EventServiceGrpcAsyncIOTransport], @@ -871,7 +920,7 @@ def test_event_service_transport_channel_mtls_with_client_cert_source(transport_ "grpc.ssl_channel_credentials", autospec=True ) as grpc_ssl_channel_cred: with mock.patch.object( - transport_class, "create_channel", autospec=True + transport_class, "create_channel" ) as grpc_create_channel: mock_ssl_cred = mock.Mock() grpc_ssl_channel_cred.return_value = mock_ssl_cred @@ -912,6 +961,8 @@ def test_event_service_transport_channel_mtls_with_client_cert_source(transport_ assert transport._ssl_channel_credentials == mock_ssl_cred +# Remove this test when deprecated arguments (api_mtls_endpoint, client_cert_source) are +# removed from grpc/grpc_asyncio transport constructor. @pytest.mark.parametrize( "transport_class", [transports.EventServiceGrpcTransport, transports.EventServiceGrpcAsyncIOTransport], @@ -924,7 +975,7 @@ def test_event_service_transport_channel_mtls_with_adc(transport_class): ssl_credentials=mock.PropertyMock(return_value=mock_ssl_cred), ): with mock.patch.object( - transport_class, "create_channel", autospec=True + transport_class, "create_channel" ) as grpc_create_channel: mock_grpc_channel = mock.Mock() grpc_create_channel.return_value = 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 index 43896c99..dd978eb7 100644 --- a/tests/unit/gapic/talent_v4beta1/test_job_service.py +++ b/tests/unit/gapic/talent_v4beta1/test_job_service.py @@ -98,7 +98,20 @@ def test__get_default_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_info(): + creds = credentials.AnonymousCredentials() + with mock.patch.object( + service_account.Credentials, "from_service_account_info" + ) as factory: + factory.return_value = creds + info = {"valid": True} + client = JobServiceClient.from_service_account_info(info) + assert client.transport._credentials == creds + + assert client.transport._host == "jobs.googleapis.com:443" + + +@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( @@ -116,7 +129,10 @@ def test_job_service_client_from_service_account_file(client_class): def test_job_service_client_get_transport_class(): transport = JobServiceClient.get_transport_class() - assert transport == transports.JobServiceGrpcTransport + available_transports = [ + transports.JobServiceGrpcTransport, + ] + assert transport in available_transports transport = JobServiceClient.get_transport_class("grpc") assert transport == transports.JobServiceGrpcTransport @@ -165,7 +181,7 @@ def test_job_service_client_client_options( credentials_file=None, host="squid.clam.whelk", scopes=None, - ssl_channel_credentials=None, + client_cert_source_for_mtls=None, quota_project_id=None, client_info=transports.base.DEFAULT_CLIENT_INFO, ) @@ -181,7 +197,7 @@ def test_job_service_client_client_options( credentials_file=None, host=client.DEFAULT_ENDPOINT, scopes=None, - ssl_channel_credentials=None, + client_cert_source_for_mtls=None, quota_project_id=None, client_info=transports.base.DEFAULT_CLIENT_INFO, ) @@ -197,7 +213,7 @@ def test_job_service_client_client_options( credentials_file=None, host=client.DEFAULT_MTLS_ENDPOINT, scopes=None, - ssl_channel_credentials=None, + client_cert_source_for_mtls=None, quota_project_id=None, client_info=transports.base.DEFAULT_CLIENT_INFO, ) @@ -225,7 +241,7 @@ def test_job_service_client_client_options( credentials_file=None, host=client.DEFAULT_ENDPOINT, scopes=None, - ssl_channel_credentials=None, + client_cert_source_for_mtls=None, quota_project_id="octopus", client_info=transports.base.DEFAULT_CLIENT_INFO, ) @@ -274,29 +290,25 @@ def test_job_service_client_mtls_env_auto( client_cert_source=client_cert_source_callback ) with mock.patch.object(transport_class, "__init__") as patched: - ssl_channel_creds = mock.Mock() - with mock.patch( - "grpc.ssl_channel_credentials", return_value=ssl_channel_creds - ): - patched.return_value = None - client = client_class(client_options=options) + patched.return_value = None + client = client_class(client_options=options) - if use_client_cert_env == "false": - expected_ssl_channel_creds = None - expected_host = client.DEFAULT_ENDPOINT - else: - expected_ssl_channel_creds = ssl_channel_creds - expected_host = client.DEFAULT_MTLS_ENDPOINT + if use_client_cert_env == "false": + expected_client_cert_source = None + expected_host = client.DEFAULT_ENDPOINT + else: + expected_client_cert_source = client_cert_source_callback + expected_host = client.DEFAULT_MTLS_ENDPOINT - patched.assert_called_once_with( - credentials=None, - credentials_file=None, - host=expected_host, - scopes=None, - ssl_channel_credentials=expected_ssl_channel_creds, - quota_project_id=None, - client_info=transports.base.DEFAULT_CLIENT_INFO, - ) + patched.assert_called_once_with( + credentials=None, + credentials_file=None, + host=expected_host, + scopes=None, + client_cert_source_for_mtls=expected_client_cert_source, + quota_project_id=None, + client_info=transports.base.DEFAULT_CLIENT_INFO, + ) # Check the case ADC client cert is provided. Whether client cert is used depends on # GOOGLE_API_USE_CLIENT_CERTIFICATE value. @@ -305,66 +317,53 @@ def test_job_service_client_mtls_env_auto( ): with mock.patch.object(transport_class, "__init__") as patched: with mock.patch( - "google.auth.transport.grpc.SslCredentials.__init__", return_value=None + "google.auth.transport.mtls.has_default_client_cert_source", + return_value=True, ): with mock.patch( - "google.auth.transport.grpc.SslCredentials.is_mtls", - new_callable=mock.PropertyMock, - ) as is_mtls_mock: - with mock.patch( - "google.auth.transport.grpc.SslCredentials.ssl_credentials", - new_callable=mock.PropertyMock, - ) as ssl_credentials_mock: - if use_client_cert_env == "false": - is_mtls_mock.return_value = False - ssl_credentials_mock.return_value = None - expected_host = client.DEFAULT_ENDPOINT - expected_ssl_channel_creds = None - else: - is_mtls_mock.return_value = True - ssl_credentials_mock.return_value = mock.Mock() - expected_host = client.DEFAULT_MTLS_ENDPOINT - expected_ssl_channel_creds = ( - ssl_credentials_mock.return_value - ) - - patched.return_value = None - client = client_class() - patched.assert_called_once_with( - credentials=None, - credentials_file=None, - host=expected_host, - scopes=None, - ssl_channel_credentials=expected_ssl_channel_creds, - quota_project_id=None, - client_info=transports.base.DEFAULT_CLIENT_INFO, - ) + "google.auth.transport.mtls.default_client_cert_source", + return_value=client_cert_source_callback, + ): + if use_client_cert_env == "false": + expected_host = client.DEFAULT_ENDPOINT + expected_client_cert_source = None + else: + expected_host = client.DEFAULT_MTLS_ENDPOINT + expected_client_cert_source = client_cert_source_callback - # Check the case client_cert_source and ADC client cert are not provided. - with mock.patch.dict( - os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": use_client_cert_env} - ): - with mock.patch.object(transport_class, "__init__") as patched: - with mock.patch( - "google.auth.transport.grpc.SslCredentials.__init__", return_value=None - ): - with mock.patch( - "google.auth.transport.grpc.SslCredentials.is_mtls", - new_callable=mock.PropertyMock, - ) as is_mtls_mock: - is_mtls_mock.return_value = False patched.return_value = None client = client_class() patched.assert_called_once_with( credentials=None, credentials_file=None, - host=client.DEFAULT_ENDPOINT, + host=expected_host, scopes=None, - ssl_channel_credentials=None, + client_cert_source_for_mtls=expected_client_cert_source, quota_project_id=None, client_info=transports.base.DEFAULT_CLIENT_INFO, ) + # Check the case client_cert_source and ADC client cert are not provided. + with mock.patch.dict( + os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": use_client_cert_env} + ): + 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, + client_cert_source_for_mtls=None, + quota_project_id=None, + client_info=transports.base.DEFAULT_CLIENT_INFO, + ) + @pytest.mark.parametrize( "client_class,transport_class,transport_name", @@ -390,7 +389,7 @@ def test_job_service_client_client_options_scopes( credentials_file=None, host=client.DEFAULT_ENDPOINT, scopes=["1", "2"], - ssl_channel_credentials=None, + client_cert_source_for_mtls=None, quota_project_id=None, client_info=transports.base.DEFAULT_CLIENT_INFO, ) @@ -420,7 +419,7 @@ def test_job_service_client_client_options_credentials_file( credentials_file="credentials.json", host=client.DEFAULT_ENDPOINT, scopes=None, - ssl_channel_credentials=None, + client_cert_source_for_mtls=None, quota_project_id=None, client_info=transports.base.DEFAULT_CLIENT_INFO, ) @@ -437,7 +436,7 @@ def test_job_service_client_client_options_from_dict(): credentials_file=None, host="squid.clam.whelk", scopes=None, - ssl_channel_credentials=None, + client_cert_source_for_mtls=None, quota_project_id=None, client_info=transports.base.DEFAULT_CLIENT_INFO, ) @@ -3127,7 +3126,7 @@ def test_transport_get_channel(): @pytest.mark.parametrize( "transport_class", - [transports.JobServiceGrpcTransport, transports.JobServiceGrpcAsyncIOTransport], + [transports.JobServiceGrpcTransport, transports.JobServiceGrpcAsyncIOTransport,], ) def test_transport_adc(transport_class): # Test default credentials are used if not provided. @@ -3250,6 +3249,51 @@ def test_job_service_transport_auth_adc(): ) +@pytest.mark.parametrize( + "transport_class", + [transports.JobServiceGrpcTransport, transports.JobServiceGrpcAsyncIOTransport], +) +def test_job_service_grpc_transport_client_cert_source_for_mtls(transport_class): + cred = credentials.AnonymousCredentials() + + # Check ssl_channel_credentials is used if provided. + with mock.patch.object(transport_class, "create_channel") as mock_create_channel: + mock_ssl_channel_creds = mock.Mock() + transport_class( + host="squid.clam.whelk", + credentials=cred, + ssl_channel_credentials=mock_ssl_channel_creds, + ) + mock_create_channel.assert_called_once_with( + "squid.clam.whelk:443", + credentials=cred, + credentials_file=None, + scopes=( + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/jobs", + ), + ssl_credentials=mock_ssl_channel_creds, + quota_project_id=None, + options=[ + ("grpc.max_send_message_length", -1), + ("grpc.max_receive_message_length", -1), + ], + ) + + # Check if ssl_channel_credentials is not provided, then client_cert_source_for_mtls + # is used. + with mock.patch.object(transport_class, "create_channel", return_value=mock.Mock()): + with mock.patch("grpc.ssl_channel_credentials") as mock_ssl_cred: + transport_class( + credentials=cred, + client_cert_source_for_mtls=client_cert_source_callback, + ) + expected_cert, expected_key = client_cert_source_callback() + mock_ssl_cred.assert_called_once_with( + certificate_chain=expected_cert, private_key=expected_key + ) + + def test_job_service_host_no_port(): client = JobServiceClient( credentials=credentials.AnonymousCredentials(), @@ -3269,7 +3313,7 @@ def test_job_service_host_with_port(): def test_job_service_grpc_transport_channel(): - channel = grpc.insecure_channel("http://localhost/") + channel = grpc.secure_channel("http://localhost/", grpc.local_channel_credentials()) # Check that channel is used if provided. transport = transports.JobServiceGrpcTransport( @@ -3281,7 +3325,7 @@ def test_job_service_grpc_transport_channel(): def test_job_service_grpc_asyncio_transport_channel(): - channel = aio.insecure_channel("http://localhost/") + channel = aio.secure_channel("http://localhost/", grpc.local_channel_credentials()) # Check that channel is used if provided. transport = transports.JobServiceGrpcAsyncIOTransport( @@ -3292,6 +3336,8 @@ def test_job_service_grpc_asyncio_transport_channel(): assert transport._ssl_channel_credentials == None +# Remove this test when deprecated arguments (api_mtls_endpoint, client_cert_source) are +# removed from grpc/grpc_asyncio transport constructor. @pytest.mark.parametrize( "transport_class", [transports.JobServiceGrpcTransport, transports.JobServiceGrpcAsyncIOTransport], @@ -3301,7 +3347,7 @@ def test_job_service_transport_channel_mtls_with_client_cert_source(transport_cl "grpc.ssl_channel_credentials", autospec=True ) as grpc_ssl_channel_cred: with mock.patch.object( - transport_class, "create_channel", autospec=True + transport_class, "create_channel" ) as grpc_create_channel: mock_ssl_cred = mock.Mock() grpc_ssl_channel_cred.return_value = mock_ssl_cred @@ -3342,6 +3388,8 @@ def test_job_service_transport_channel_mtls_with_client_cert_source(transport_cl assert transport._ssl_channel_credentials == mock_ssl_cred +# Remove this test when deprecated arguments (api_mtls_endpoint, client_cert_source) are +# removed from grpc/grpc_asyncio transport constructor. @pytest.mark.parametrize( "transport_class", [transports.JobServiceGrpcTransport, transports.JobServiceGrpcAsyncIOTransport], @@ -3354,7 +3402,7 @@ def test_job_service_transport_channel_mtls_with_adc(transport_class): ssl_credentials=mock.PropertyMock(return_value=mock_ssl_cred), ): with mock.patch.object( - transport_class, "create_channel", autospec=True + transport_class, "create_channel" ) as grpc_create_channel: mock_grpc_channel = mock.Mock() grpc_create_channel.return_value = mock_grpc_channel diff --git a/tests/unit/gapic/talent_v4beta1/test_profile_service.py b/tests/unit/gapic/talent_v4beta1/test_profile_service.py index 136e0be1..00c94ff7 100644 --- a/tests/unit/gapic/talent_v4beta1/test_profile_service.py +++ b/tests/unit/gapic/talent_v4beta1/test_profile_service.py @@ -98,8 +98,21 @@ def test__get_default_mtls_endpoint(): ) +def test_profile_service_client_from_service_account_info(): + creds = credentials.AnonymousCredentials() + with mock.patch.object( + service_account.Credentials, "from_service_account_info" + ) as factory: + factory.return_value = creds + info = {"valid": True} + client = ProfileServiceClient.from_service_account_info(info) + assert client.transport._credentials == creds + + assert client.transport._host == "jobs.googleapis.com:443" + + @pytest.mark.parametrize( - "client_class", [ProfileServiceClient, ProfileServiceAsyncClient] + "client_class", [ProfileServiceClient, ProfileServiceAsyncClient,] ) def test_profile_service_client_from_service_account_file(client_class): creds = credentials.AnonymousCredentials() @@ -118,7 +131,10 @@ def test_profile_service_client_from_service_account_file(client_class): def test_profile_service_client_get_transport_class(): transport = ProfileServiceClient.get_transport_class() - assert transport == transports.ProfileServiceGrpcTransport + available_transports = [ + transports.ProfileServiceGrpcTransport, + ] + assert transport in available_transports transport = ProfileServiceClient.get_transport_class("grpc") assert transport == transports.ProfileServiceGrpcTransport @@ -169,7 +185,7 @@ def test_profile_service_client_client_options( credentials_file=None, host="squid.clam.whelk", scopes=None, - ssl_channel_credentials=None, + client_cert_source_for_mtls=None, quota_project_id=None, client_info=transports.base.DEFAULT_CLIENT_INFO, ) @@ -185,7 +201,7 @@ def test_profile_service_client_client_options( credentials_file=None, host=client.DEFAULT_ENDPOINT, scopes=None, - ssl_channel_credentials=None, + client_cert_source_for_mtls=None, quota_project_id=None, client_info=transports.base.DEFAULT_CLIENT_INFO, ) @@ -201,7 +217,7 @@ def test_profile_service_client_client_options( credentials_file=None, host=client.DEFAULT_MTLS_ENDPOINT, scopes=None, - ssl_channel_credentials=None, + client_cert_source_for_mtls=None, quota_project_id=None, client_info=transports.base.DEFAULT_CLIENT_INFO, ) @@ -229,7 +245,7 @@ def test_profile_service_client_client_options( credentials_file=None, host=client.DEFAULT_ENDPOINT, scopes=None, - ssl_channel_credentials=None, + client_cert_source_for_mtls=None, quota_project_id="octopus", client_info=transports.base.DEFAULT_CLIENT_INFO, ) @@ -280,29 +296,25 @@ def test_profile_service_client_mtls_env_auto( client_cert_source=client_cert_source_callback ) with mock.patch.object(transport_class, "__init__") as patched: - ssl_channel_creds = mock.Mock() - with mock.patch( - "grpc.ssl_channel_credentials", return_value=ssl_channel_creds - ): - patched.return_value = None - client = client_class(client_options=options) + patched.return_value = None + client = client_class(client_options=options) - if use_client_cert_env == "false": - expected_ssl_channel_creds = None - expected_host = client.DEFAULT_ENDPOINT - else: - expected_ssl_channel_creds = ssl_channel_creds - expected_host = client.DEFAULT_MTLS_ENDPOINT + if use_client_cert_env == "false": + expected_client_cert_source = None + expected_host = client.DEFAULT_ENDPOINT + else: + expected_client_cert_source = client_cert_source_callback + expected_host = client.DEFAULT_MTLS_ENDPOINT - patched.assert_called_once_with( - credentials=None, - credentials_file=None, - host=expected_host, - scopes=None, - ssl_channel_credentials=expected_ssl_channel_creds, - quota_project_id=None, - client_info=transports.base.DEFAULT_CLIENT_INFO, - ) + patched.assert_called_once_with( + credentials=None, + credentials_file=None, + host=expected_host, + scopes=None, + client_cert_source_for_mtls=expected_client_cert_source, + quota_project_id=None, + client_info=transports.base.DEFAULT_CLIENT_INFO, + ) # Check the case ADC client cert is provided. Whether client cert is used depends on # GOOGLE_API_USE_CLIENT_CERTIFICATE value. @@ -311,66 +323,53 @@ def test_profile_service_client_mtls_env_auto( ): with mock.patch.object(transport_class, "__init__") as patched: with mock.patch( - "google.auth.transport.grpc.SslCredentials.__init__", return_value=None + "google.auth.transport.mtls.has_default_client_cert_source", + return_value=True, ): with mock.patch( - "google.auth.transport.grpc.SslCredentials.is_mtls", - new_callable=mock.PropertyMock, - ) as is_mtls_mock: - with mock.patch( - "google.auth.transport.grpc.SslCredentials.ssl_credentials", - new_callable=mock.PropertyMock, - ) as ssl_credentials_mock: - if use_client_cert_env == "false": - is_mtls_mock.return_value = False - ssl_credentials_mock.return_value = None - expected_host = client.DEFAULT_ENDPOINT - expected_ssl_channel_creds = None - else: - is_mtls_mock.return_value = True - ssl_credentials_mock.return_value = mock.Mock() - expected_host = client.DEFAULT_MTLS_ENDPOINT - expected_ssl_channel_creds = ( - ssl_credentials_mock.return_value - ) - - patched.return_value = None - client = client_class() - patched.assert_called_once_with( - credentials=None, - credentials_file=None, - host=expected_host, - scopes=None, - ssl_channel_credentials=expected_ssl_channel_creds, - quota_project_id=None, - client_info=transports.base.DEFAULT_CLIENT_INFO, - ) + "google.auth.transport.mtls.default_client_cert_source", + return_value=client_cert_source_callback, + ): + if use_client_cert_env == "false": + expected_host = client.DEFAULT_ENDPOINT + expected_client_cert_source = None + else: + expected_host = client.DEFAULT_MTLS_ENDPOINT + expected_client_cert_source = client_cert_source_callback - # Check the case client_cert_source and ADC client cert are not provided. - with mock.patch.dict( - os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": use_client_cert_env} - ): - with mock.patch.object(transport_class, "__init__") as patched: - with mock.patch( - "google.auth.transport.grpc.SslCredentials.__init__", return_value=None - ): - with mock.patch( - "google.auth.transport.grpc.SslCredentials.is_mtls", - new_callable=mock.PropertyMock, - ) as is_mtls_mock: - is_mtls_mock.return_value = False patched.return_value = None client = client_class() patched.assert_called_once_with( credentials=None, credentials_file=None, - host=client.DEFAULT_ENDPOINT, + host=expected_host, scopes=None, - ssl_channel_credentials=None, + client_cert_source_for_mtls=expected_client_cert_source, quota_project_id=None, client_info=transports.base.DEFAULT_CLIENT_INFO, ) + # Check the case client_cert_source and ADC client cert are not provided. + with mock.patch.dict( + os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": use_client_cert_env} + ): + 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, + client_cert_source_for_mtls=None, + quota_project_id=None, + client_info=transports.base.DEFAULT_CLIENT_INFO, + ) + @pytest.mark.parametrize( "client_class,transport_class,transport_name", @@ -396,7 +395,7 @@ def test_profile_service_client_client_options_scopes( credentials_file=None, host=client.DEFAULT_ENDPOINT, scopes=["1", "2"], - ssl_channel_credentials=None, + client_cert_source_for_mtls=None, quota_project_id=None, client_info=transports.base.DEFAULT_CLIENT_INFO, ) @@ -426,7 +425,7 @@ def test_profile_service_client_client_options_credentials_file( credentials_file="credentials.json", host=client.DEFAULT_ENDPOINT, scopes=None, - ssl_channel_credentials=None, + client_cert_source_for_mtls=None, quota_project_id=None, client_info=transports.base.DEFAULT_CLIENT_INFO, ) @@ -445,7 +444,7 @@ def test_profile_service_client_client_options_from_dict(): credentials_file=None, host="squid.clam.whelk", scopes=None, - ssl_channel_credentials=None, + client_cert_source_for_mtls=None, quota_project_id=None, client_info=transports.base.DEFAULT_CLIENT_INFO, ) @@ -2160,6 +2159,54 @@ def test_profile_service_transport_auth_adc(): ) +@pytest.mark.parametrize( + "transport_class", + [ + transports.ProfileServiceGrpcTransport, + transports.ProfileServiceGrpcAsyncIOTransport, + ], +) +def test_profile_service_grpc_transport_client_cert_source_for_mtls(transport_class): + cred = credentials.AnonymousCredentials() + + # Check ssl_channel_credentials is used if provided. + with mock.patch.object(transport_class, "create_channel") as mock_create_channel: + mock_ssl_channel_creds = mock.Mock() + transport_class( + host="squid.clam.whelk", + credentials=cred, + ssl_channel_credentials=mock_ssl_channel_creds, + ) + mock_create_channel.assert_called_once_with( + "squid.clam.whelk:443", + credentials=cred, + credentials_file=None, + scopes=( + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/jobs", + ), + ssl_credentials=mock_ssl_channel_creds, + quota_project_id=None, + options=[ + ("grpc.max_send_message_length", -1), + ("grpc.max_receive_message_length", -1), + ], + ) + + # Check if ssl_channel_credentials is not provided, then client_cert_source_for_mtls + # is used. + with mock.patch.object(transport_class, "create_channel", return_value=mock.Mock()): + with mock.patch("grpc.ssl_channel_credentials") as mock_ssl_cred: + transport_class( + credentials=cred, + client_cert_source_for_mtls=client_cert_source_callback, + ) + expected_cert, expected_key = client_cert_source_callback() + mock_ssl_cred.assert_called_once_with( + certificate_chain=expected_cert, private_key=expected_key + ) + + def test_profile_service_host_no_port(): client = ProfileServiceClient( credentials=credentials.AnonymousCredentials(), @@ -2179,7 +2226,7 @@ def test_profile_service_host_with_port(): def test_profile_service_grpc_transport_channel(): - channel = grpc.insecure_channel("http://localhost/") + channel = grpc.secure_channel("http://localhost/", grpc.local_channel_credentials()) # Check that channel is used if provided. transport = transports.ProfileServiceGrpcTransport( @@ -2191,7 +2238,7 @@ def test_profile_service_grpc_transport_channel(): def test_profile_service_grpc_asyncio_transport_channel(): - channel = aio.insecure_channel("http://localhost/") + channel = aio.secure_channel("http://localhost/", grpc.local_channel_credentials()) # Check that channel is used if provided. transport = transports.ProfileServiceGrpcAsyncIOTransport( @@ -2202,6 +2249,8 @@ def test_profile_service_grpc_asyncio_transport_channel(): assert transport._ssl_channel_credentials == None +# Remove this test when deprecated arguments (api_mtls_endpoint, client_cert_source) are +# removed from grpc/grpc_asyncio transport constructor. @pytest.mark.parametrize( "transport_class", [ @@ -2216,7 +2265,7 @@ def test_profile_service_transport_channel_mtls_with_client_cert_source( "grpc.ssl_channel_credentials", autospec=True ) as grpc_ssl_channel_cred: with mock.patch.object( - transport_class, "create_channel", autospec=True + transport_class, "create_channel" ) as grpc_create_channel: mock_ssl_cred = mock.Mock() grpc_ssl_channel_cred.return_value = mock_ssl_cred @@ -2257,6 +2306,8 @@ def test_profile_service_transport_channel_mtls_with_client_cert_source( assert transport._ssl_channel_credentials == mock_ssl_cred +# Remove this test when deprecated arguments (api_mtls_endpoint, client_cert_source) are +# removed from grpc/grpc_asyncio transport constructor. @pytest.mark.parametrize( "transport_class", [ @@ -2272,7 +2323,7 @@ def test_profile_service_transport_channel_mtls_with_adc(transport_class): ssl_credentials=mock.PropertyMock(return_value=mock_ssl_cred), ): with mock.patch.object( - transport_class, "create_channel", autospec=True + transport_class, "create_channel" ) as grpc_create_channel: mock_grpc_channel = mock.Mock() grpc_create_channel.return_value = mock_grpc_channel diff --git a/tests/unit/gapic/talent_v4beta1/test_tenant_service.py b/tests/unit/gapic/talent_v4beta1/test_tenant_service.py index 62a13dd4..af9881de 100644 --- a/tests/unit/gapic/talent_v4beta1/test_tenant_service.py +++ b/tests/unit/gapic/talent_v4beta1/test_tenant_service.py @@ -87,8 +87,21 @@ def test__get_default_mtls_endpoint(): ) +def test_tenant_service_client_from_service_account_info(): + creds = credentials.AnonymousCredentials() + with mock.patch.object( + service_account.Credentials, "from_service_account_info" + ) as factory: + factory.return_value = creds + info = {"valid": True} + client = TenantServiceClient.from_service_account_info(info) + assert client.transport._credentials == creds + + assert client.transport._host == "jobs.googleapis.com:443" + + @pytest.mark.parametrize( - "client_class", [TenantServiceClient, TenantServiceAsyncClient] + "client_class", [TenantServiceClient, TenantServiceAsyncClient,] ) def test_tenant_service_client_from_service_account_file(client_class): creds = credentials.AnonymousCredentials() @@ -107,7 +120,10 @@ def test_tenant_service_client_from_service_account_file(client_class): def test_tenant_service_client_get_transport_class(): transport = TenantServiceClient.get_transport_class() - assert transport == transports.TenantServiceGrpcTransport + available_transports = [ + transports.TenantServiceGrpcTransport, + ] + assert transport in available_transports transport = TenantServiceClient.get_transport_class("grpc") assert transport == transports.TenantServiceGrpcTransport @@ -158,7 +174,7 @@ def test_tenant_service_client_client_options( credentials_file=None, host="squid.clam.whelk", scopes=None, - ssl_channel_credentials=None, + client_cert_source_for_mtls=None, quota_project_id=None, client_info=transports.base.DEFAULT_CLIENT_INFO, ) @@ -174,7 +190,7 @@ def test_tenant_service_client_client_options( credentials_file=None, host=client.DEFAULT_ENDPOINT, scopes=None, - ssl_channel_credentials=None, + client_cert_source_for_mtls=None, quota_project_id=None, client_info=transports.base.DEFAULT_CLIENT_INFO, ) @@ -190,7 +206,7 @@ def test_tenant_service_client_client_options( credentials_file=None, host=client.DEFAULT_MTLS_ENDPOINT, scopes=None, - ssl_channel_credentials=None, + client_cert_source_for_mtls=None, quota_project_id=None, client_info=transports.base.DEFAULT_CLIENT_INFO, ) @@ -218,7 +234,7 @@ def test_tenant_service_client_client_options( credentials_file=None, host=client.DEFAULT_ENDPOINT, scopes=None, - ssl_channel_credentials=None, + client_cert_source_for_mtls=None, quota_project_id="octopus", client_info=transports.base.DEFAULT_CLIENT_INFO, ) @@ -269,29 +285,25 @@ def test_tenant_service_client_mtls_env_auto( client_cert_source=client_cert_source_callback ) with mock.patch.object(transport_class, "__init__") as patched: - ssl_channel_creds = mock.Mock() - with mock.patch( - "grpc.ssl_channel_credentials", return_value=ssl_channel_creds - ): - patched.return_value = None - client = client_class(client_options=options) + patched.return_value = None + client = client_class(client_options=options) - if use_client_cert_env == "false": - expected_ssl_channel_creds = None - expected_host = client.DEFAULT_ENDPOINT - else: - expected_ssl_channel_creds = ssl_channel_creds - expected_host = client.DEFAULT_MTLS_ENDPOINT + if use_client_cert_env == "false": + expected_client_cert_source = None + expected_host = client.DEFAULT_ENDPOINT + else: + expected_client_cert_source = client_cert_source_callback + expected_host = client.DEFAULT_MTLS_ENDPOINT - patched.assert_called_once_with( - credentials=None, - credentials_file=None, - host=expected_host, - scopes=None, - ssl_channel_credentials=expected_ssl_channel_creds, - quota_project_id=None, - client_info=transports.base.DEFAULT_CLIENT_INFO, - ) + patched.assert_called_once_with( + credentials=None, + credentials_file=None, + host=expected_host, + scopes=None, + client_cert_source_for_mtls=expected_client_cert_source, + quota_project_id=None, + client_info=transports.base.DEFAULT_CLIENT_INFO, + ) # Check the case ADC client cert is provided. Whether client cert is used depends on # GOOGLE_API_USE_CLIENT_CERTIFICATE value. @@ -300,66 +312,53 @@ def test_tenant_service_client_mtls_env_auto( ): with mock.patch.object(transport_class, "__init__") as patched: with mock.patch( - "google.auth.transport.grpc.SslCredentials.__init__", return_value=None + "google.auth.transport.mtls.has_default_client_cert_source", + return_value=True, ): with mock.patch( - "google.auth.transport.grpc.SslCredentials.is_mtls", - new_callable=mock.PropertyMock, - ) as is_mtls_mock: - with mock.patch( - "google.auth.transport.grpc.SslCredentials.ssl_credentials", - new_callable=mock.PropertyMock, - ) as ssl_credentials_mock: - if use_client_cert_env == "false": - is_mtls_mock.return_value = False - ssl_credentials_mock.return_value = None - expected_host = client.DEFAULT_ENDPOINT - expected_ssl_channel_creds = None - else: - is_mtls_mock.return_value = True - ssl_credentials_mock.return_value = mock.Mock() - expected_host = client.DEFAULT_MTLS_ENDPOINT - expected_ssl_channel_creds = ( - ssl_credentials_mock.return_value - ) - - patched.return_value = None - client = client_class() - patched.assert_called_once_with( - credentials=None, - credentials_file=None, - host=expected_host, - scopes=None, - ssl_channel_credentials=expected_ssl_channel_creds, - quota_project_id=None, - client_info=transports.base.DEFAULT_CLIENT_INFO, - ) + "google.auth.transport.mtls.default_client_cert_source", + return_value=client_cert_source_callback, + ): + if use_client_cert_env == "false": + expected_host = client.DEFAULT_ENDPOINT + expected_client_cert_source = None + else: + expected_host = client.DEFAULT_MTLS_ENDPOINT + expected_client_cert_source = client_cert_source_callback - # Check the case client_cert_source and ADC client cert are not provided. - with mock.patch.dict( - os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": use_client_cert_env} - ): - with mock.patch.object(transport_class, "__init__") as patched: - with mock.patch( - "google.auth.transport.grpc.SslCredentials.__init__", return_value=None - ): - with mock.patch( - "google.auth.transport.grpc.SslCredentials.is_mtls", - new_callable=mock.PropertyMock, - ) as is_mtls_mock: - is_mtls_mock.return_value = False patched.return_value = None client = client_class() patched.assert_called_once_with( credentials=None, credentials_file=None, - host=client.DEFAULT_ENDPOINT, + host=expected_host, scopes=None, - ssl_channel_credentials=None, + client_cert_source_for_mtls=expected_client_cert_source, quota_project_id=None, client_info=transports.base.DEFAULT_CLIENT_INFO, ) + # Check the case client_cert_source and ADC client cert are not provided. + with mock.patch.dict( + os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": use_client_cert_env} + ): + 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, + client_cert_source_for_mtls=None, + quota_project_id=None, + client_info=transports.base.DEFAULT_CLIENT_INFO, + ) + @pytest.mark.parametrize( "client_class,transport_class,transport_name", @@ -385,7 +384,7 @@ def test_tenant_service_client_client_options_scopes( credentials_file=None, host=client.DEFAULT_ENDPOINT, scopes=["1", "2"], - ssl_channel_credentials=None, + client_cert_source_for_mtls=None, quota_project_id=None, client_info=transports.base.DEFAULT_CLIENT_INFO, ) @@ -415,7 +414,7 @@ def test_tenant_service_client_client_options_credentials_file( credentials_file="credentials.json", host=client.DEFAULT_ENDPOINT, scopes=None, - ssl_channel_credentials=None, + client_cert_source_for_mtls=None, quota_project_id=None, client_info=transports.base.DEFAULT_CLIENT_INFO, ) @@ -434,7 +433,7 @@ def test_tenant_service_client_client_options_from_dict(): credentials_file=None, host="squid.clam.whelk", scopes=None, - ssl_channel_credentials=None, + client_cert_source_for_mtls=None, quota_project_id=None, client_info=transports.base.DEFAULT_CLIENT_INFO, ) @@ -1774,6 +1773,54 @@ def test_tenant_service_transport_auth_adc(): ) +@pytest.mark.parametrize( + "transport_class", + [ + transports.TenantServiceGrpcTransport, + transports.TenantServiceGrpcAsyncIOTransport, + ], +) +def test_tenant_service_grpc_transport_client_cert_source_for_mtls(transport_class): + cred = credentials.AnonymousCredentials() + + # Check ssl_channel_credentials is used if provided. + with mock.patch.object(transport_class, "create_channel") as mock_create_channel: + mock_ssl_channel_creds = mock.Mock() + transport_class( + host="squid.clam.whelk", + credentials=cred, + ssl_channel_credentials=mock_ssl_channel_creds, + ) + mock_create_channel.assert_called_once_with( + "squid.clam.whelk:443", + credentials=cred, + credentials_file=None, + scopes=( + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/jobs", + ), + ssl_credentials=mock_ssl_channel_creds, + quota_project_id=None, + options=[ + ("grpc.max_send_message_length", -1), + ("grpc.max_receive_message_length", -1), + ], + ) + + # Check if ssl_channel_credentials is not provided, then client_cert_source_for_mtls + # is used. + with mock.patch.object(transport_class, "create_channel", return_value=mock.Mock()): + with mock.patch("grpc.ssl_channel_credentials") as mock_ssl_cred: + transport_class( + credentials=cred, + client_cert_source_for_mtls=client_cert_source_callback, + ) + expected_cert, expected_key = client_cert_source_callback() + mock_ssl_cred.assert_called_once_with( + certificate_chain=expected_cert, private_key=expected_key + ) + + def test_tenant_service_host_no_port(): client = TenantServiceClient( credentials=credentials.AnonymousCredentials(), @@ -1793,7 +1840,7 @@ def test_tenant_service_host_with_port(): def test_tenant_service_grpc_transport_channel(): - channel = grpc.insecure_channel("http://localhost/") + channel = grpc.secure_channel("http://localhost/", grpc.local_channel_credentials()) # Check that channel is used if provided. transport = transports.TenantServiceGrpcTransport( @@ -1805,7 +1852,7 @@ def test_tenant_service_grpc_transport_channel(): def test_tenant_service_grpc_asyncio_transport_channel(): - channel = aio.insecure_channel("http://localhost/") + channel = aio.secure_channel("http://localhost/", grpc.local_channel_credentials()) # Check that channel is used if provided. transport = transports.TenantServiceGrpcAsyncIOTransport( @@ -1816,6 +1863,8 @@ def test_tenant_service_grpc_asyncio_transport_channel(): assert transport._ssl_channel_credentials == None +# Remove this test when deprecated arguments (api_mtls_endpoint, client_cert_source) are +# removed from grpc/grpc_asyncio transport constructor. @pytest.mark.parametrize( "transport_class", [ @@ -1828,7 +1877,7 @@ def test_tenant_service_transport_channel_mtls_with_client_cert_source(transport "grpc.ssl_channel_credentials", autospec=True ) as grpc_ssl_channel_cred: with mock.patch.object( - transport_class, "create_channel", autospec=True + transport_class, "create_channel" ) as grpc_create_channel: mock_ssl_cred = mock.Mock() grpc_ssl_channel_cred.return_value = mock_ssl_cred @@ -1869,6 +1918,8 @@ def test_tenant_service_transport_channel_mtls_with_client_cert_source(transport assert transport._ssl_channel_credentials == mock_ssl_cred +# Remove this test when deprecated arguments (api_mtls_endpoint, client_cert_source) are +# removed from grpc/grpc_asyncio transport constructor. @pytest.mark.parametrize( "transport_class", [ @@ -1884,7 +1935,7 @@ def test_tenant_service_transport_channel_mtls_with_adc(transport_class): ssl_credentials=mock.PropertyMock(return_value=mock_ssl_cred), ): with mock.patch.object( - transport_class, "create_channel", autospec=True + transport_class, "create_channel" ) as grpc_create_channel: mock_grpc_channel = mock.Mock() grpc_create_channel.return_value = mock_grpc_channel From fd2ff3cd1255436f6d55ff5ba33b913a5afa8094 Mon Sep 17 00:00:00 2001 From: yoshi-automation Date: Tue, 23 Mar 2021 18:50:36 -0700 Subject: [PATCH 07/38] feat: Add `ErrorReason` enum from `google.api.error_reason` for Google API and minor proto updates. PiperOrigin-RevId: 355218181 Source-Author: Google APIs Source-Date: Tue Feb 2 11:53:01 2021 -0800 Source-Repo: googleapis/googleapis Source-Sha: 2f8d204b9bc1126439565e25a456eaf6435f38f4 Source-Link: https://github.com/googleapis/googleapis/commit/2f8d204b9bc1126439565e25a456eaf6435f38f4 --- google/cloud/talent_v4/__init__.py | 4 ++-- google/cloud/talent_v4beta1/__init__.py | 4 ++-- synth.metadata | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/google/cloud/talent_v4/__init__.py b/google/cloud/talent_v4/__init__.py index 1d4b845e..2f1964fd 100644 --- a/google/cloud/talent_v4/__init__.py +++ b/google/cloud/talent_v4/__init__.py @@ -113,7 +113,6 @@ "DeleteTenantRequest", "DeviceInfo", "EmploymentType", - "EventServiceClient", "GetCompanyRequest", "GetJobRequest", "GetTenantRequest", @@ -127,6 +126,7 @@ "JobLevel", "JobQuery", "JobResult", + "JobServiceClient", "JobView", "ListCompaniesRequest", "ListCompaniesResponse", @@ -149,5 +149,5 @@ "UpdateJobRequest", "UpdateTenantRequest", "Visibility", - "JobServiceClient", + "EventServiceClient", ) diff --git a/google/cloud/talent_v4beta1/__init__.py b/google/cloud/talent_v4beta1/__init__.py index 4bfd0d8b..4743ac58 100644 --- a/google/cloud/talent_v4beta1/__init__.py +++ b/google/cloud/talent_v4beta1/__init__.py @@ -228,6 +228,7 @@ "Profile", "ProfileEvent", "ProfileQuery", + "ProfileServiceClient", "Publication", "Rating", "RequestMetadata", @@ -243,7 +244,6 @@ "SpellingCorrection", "SummarizedProfile", "Tenant", - "TenantServiceClient", "TimeFilter", "TimestampRange", "UpdateApplicationRequest", @@ -253,5 +253,5 @@ "UpdateTenantRequest", "Visibility", "WorkExperienceFilter", - "ProfileServiceClient", + "TenantServiceClient", ) diff --git a/synth.metadata b/synth.metadata index 0c25566c..d4319689 100644 --- a/synth.metadata +++ b/synth.metadata @@ -11,8 +11,8 @@ "git": { "name": "googleapis", "remote": "https://github.com/googleapis/googleapis.git", - "sha": "20712b8fe95001b312f62c6c5f33e3e3ec92cfaf", - "internalRef": "354996675" + "sha": "2f8d204b9bc1126439565e25a456eaf6435f38f4", + "internalRef": "355218181" } }, { From 2655a716b3bfcb5b5f535ddfc55e3e31d532d247 Mon Sep 17 00:00:00 2001 From: yoshi-automation Date: Tue, 23 Mar 2021 18:50:36 -0700 Subject: [PATCH 08/38] chore: remove unused package option from Bazel build in aiplatform, speakerid Committer: @miraleung PiperOrigin-RevId: 355238153 Source-Author: Google APIs Source-Date: Tue Feb 2 13:21:18 2021 -0800 Source-Repo: googleapis/googleapis Source-Sha: acdf818e86e1b67512f2f6c86d37b7e7ff67e212 Source-Link: https://github.com/googleapis/googleapis/commit/acdf818e86e1b67512f2f6c86d37b7e7ff67e212 --- google/cloud/talent_v4/__init__.py | 4 ++-- google/cloud/talent_v4beta1/__init__.py | 4 ++-- synth.metadata | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/google/cloud/talent_v4/__init__.py b/google/cloud/talent_v4/__init__.py index 2f1964fd..5d959d15 100644 --- a/google/cloud/talent_v4/__init__.py +++ b/google/cloud/talent_v4/__init__.py @@ -101,7 +101,6 @@ "CompensationInfo", "CompleteQueryRequest", "CompleteQueryResponse", - "CompletionClient", "CreateClientEventRequest", "CreateCompanyRequest", "CreateJobRequest", @@ -113,6 +112,7 @@ "DeleteTenantRequest", "DeviceInfo", "EmploymentType", + "EventServiceClient", "GetCompanyRequest", "GetJobRequest", "GetTenantRequest", @@ -149,5 +149,5 @@ "UpdateJobRequest", "UpdateTenantRequest", "Visibility", - "EventServiceClient", + "CompletionClient", ) diff --git a/google/cloud/talent_v4beta1/__init__.py b/google/cloud/talent_v4beta1/__init__.py index 4743ac58..c7d0e217 100644 --- a/google/cloud/talent_v4beta1/__init__.py +++ b/google/cloud/talent_v4beta1/__init__.py @@ -157,7 +157,6 @@ "CommuteFilter", "CommuteMethod", "Company", - "CompanyServiceClient", "CompanySize", "CompensationFilter", "CompensationInfo", @@ -244,6 +243,7 @@ "SpellingCorrection", "SummarizedProfile", "Tenant", + "TenantServiceClient", "TimeFilter", "TimestampRange", "UpdateApplicationRequest", @@ -253,5 +253,5 @@ "UpdateTenantRequest", "Visibility", "WorkExperienceFilter", - "TenantServiceClient", + "CompanyServiceClient", ) diff --git a/synth.metadata b/synth.metadata index d4319689..d6610020 100644 --- a/synth.metadata +++ b/synth.metadata @@ -11,8 +11,8 @@ "git": { "name": "googleapis", "remote": "https://github.com/googleapis/googleapis.git", - "sha": "2f8d204b9bc1126439565e25a456eaf6435f38f4", - "internalRef": "355218181" + "sha": "acdf818e86e1b67512f2f6c86d37b7e7ff67e212", + "internalRef": "355238153" } }, { From 51e1dffbefd42d1892b78edbd05dd673c48ca4f6 Mon Sep 17 00:00:00 2001 From: yoshi-automation Date: Tue, 23 Mar 2021 18:51:29 -0700 Subject: [PATCH 09/38] chore(profiler): Set proto namespace to google.cloud PiperOrigin-RevId: 355274209 Source-Author: Google APIs Source-Date: Tue Feb 2 16:07:32 2021 -0800 Source-Repo: googleapis/googleapis Source-Sha: f694606e3e34d0e2a289d655864e225cab9ecb88 Source-Link: https://github.com/googleapis/googleapis/commit/f694606e3e34d0e2a289d655864e225cab9ecb88 --- google/cloud/talent_v4/__init__.py | 4 ++-- google/cloud/talent_v4beta1/__init__.py | 4 ++-- synth.metadata | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/google/cloud/talent_v4/__init__.py b/google/cloud/talent_v4/__init__.py index 5d959d15..2f1964fd 100644 --- a/google/cloud/talent_v4/__init__.py +++ b/google/cloud/talent_v4/__init__.py @@ -101,6 +101,7 @@ "CompensationInfo", "CompleteQueryRequest", "CompleteQueryResponse", + "CompletionClient", "CreateClientEventRequest", "CreateCompanyRequest", "CreateJobRequest", @@ -112,7 +113,6 @@ "DeleteTenantRequest", "DeviceInfo", "EmploymentType", - "EventServiceClient", "GetCompanyRequest", "GetJobRequest", "GetTenantRequest", @@ -149,5 +149,5 @@ "UpdateJobRequest", "UpdateTenantRequest", "Visibility", - "CompletionClient", + "EventServiceClient", ) diff --git a/google/cloud/talent_v4beta1/__init__.py b/google/cloud/talent_v4beta1/__init__.py index c7d0e217..4743ac58 100644 --- a/google/cloud/talent_v4beta1/__init__.py +++ b/google/cloud/talent_v4beta1/__init__.py @@ -157,6 +157,7 @@ "CommuteFilter", "CommuteMethod", "Company", + "CompanyServiceClient", "CompanySize", "CompensationFilter", "CompensationInfo", @@ -243,7 +244,6 @@ "SpellingCorrection", "SummarizedProfile", "Tenant", - "TenantServiceClient", "TimeFilter", "TimestampRange", "UpdateApplicationRequest", @@ -253,5 +253,5 @@ "UpdateTenantRequest", "Visibility", "WorkExperienceFilter", - "CompanyServiceClient", + "TenantServiceClient", ) diff --git a/synth.metadata b/synth.metadata index d6610020..3789b788 100644 --- a/synth.metadata +++ b/synth.metadata @@ -11,8 +11,8 @@ "git": { "name": "googleapis", "remote": "https://github.com/googleapis/googleapis.git", - "sha": "acdf818e86e1b67512f2f6c86d37b7e7ff67e212", - "internalRef": "355238153" + "sha": "f694606e3e34d0e2a289d655864e225cab9ecb88", + "internalRef": "355274209" } }, { From 93ec22e548a49f6cc244f99fcc723481d5133c03 Mon Sep 17 00:00:00 2001 From: yoshi-automation Date: Tue, 23 Mar 2021 18:52:22 -0700 Subject: [PATCH 10/38] chore: remove more unused package options in java_gapic_library rules Committer: @miraleung PiperOrigin-RevId: 355442508 Source-Author: Google APIs Source-Date: Wed Feb 3 11:32:57 2021 -0800 Source-Repo: googleapis/googleapis Source-Sha: e038e2a5b2104dfae83edada1dfb41b319fc363f Source-Link: https://github.com/googleapis/googleapis/commit/e038e2a5b2104dfae83edada1dfb41b319fc363f --- google/cloud/talent_v4/__init__.py | 4 ++-- google/cloud/talent_v4beta1/__init__.py | 4 ++-- synth.metadata | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/google/cloud/talent_v4/__init__.py b/google/cloud/talent_v4/__init__.py index 2f1964fd..5d959d15 100644 --- a/google/cloud/talent_v4/__init__.py +++ b/google/cloud/talent_v4/__init__.py @@ -101,7 +101,6 @@ "CompensationInfo", "CompleteQueryRequest", "CompleteQueryResponse", - "CompletionClient", "CreateClientEventRequest", "CreateCompanyRequest", "CreateJobRequest", @@ -113,6 +112,7 @@ "DeleteTenantRequest", "DeviceInfo", "EmploymentType", + "EventServiceClient", "GetCompanyRequest", "GetJobRequest", "GetTenantRequest", @@ -149,5 +149,5 @@ "UpdateJobRequest", "UpdateTenantRequest", "Visibility", - "EventServiceClient", + "CompletionClient", ) diff --git a/google/cloud/talent_v4beta1/__init__.py b/google/cloud/talent_v4beta1/__init__.py index 4743ac58..b751ef4a 100644 --- a/google/cloud/talent_v4beta1/__init__.py +++ b/google/cloud/talent_v4beta1/__init__.py @@ -203,7 +203,6 @@ "JobLevel", "JobOperationResult", "JobQuery", - "JobServiceClient", "JobTitleFilter", "JobView", "ListApplicationsRequest", @@ -244,6 +243,7 @@ "SpellingCorrection", "SummarizedProfile", "Tenant", + "TenantServiceClient", "TimeFilter", "TimestampRange", "UpdateApplicationRequest", @@ -253,5 +253,5 @@ "UpdateTenantRequest", "Visibility", "WorkExperienceFilter", - "TenantServiceClient", + "JobServiceClient", ) diff --git a/synth.metadata b/synth.metadata index 3789b788..892bdd58 100644 --- a/synth.metadata +++ b/synth.metadata @@ -11,8 +11,8 @@ "git": { "name": "googleapis", "remote": "https://github.com/googleapis/googleapis.git", - "sha": "f694606e3e34d0e2a289d655864e225cab9ecb88", - "internalRef": "355274209" + "sha": "e038e2a5b2104dfae83edada1dfb41b319fc363f", + "internalRef": "355442508" } }, { From 2d63d71311327c1594406883f90230e5a6474ab2 Mon Sep 17 00:00:00 2001 From: yoshi-automation Date: Tue, 23 Mar 2021 18:55:11 -0700 Subject: [PATCH 11/38] chore: change link in comment to absolute PiperOrigin-RevId: 355879798 Source-Author: Google APIs Source-Date: Fri Feb 5 10:35:27 2021 -0800 Source-Repo: googleapis/googleapis Source-Sha: 531abbd70bee00357f64946ed68c38da334b61e6 Source-Link: https://github.com/googleapis/googleapis/commit/531abbd70bee00357f64946ed68c38da334b61e6 --- google/cloud/talent_v4/__init__.py | 4 ++-- google/cloud/talent_v4beta1/__init__.py | 4 ++-- synth.metadata | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/google/cloud/talent_v4/__init__.py b/google/cloud/talent_v4/__init__.py index 5d959d15..2f1964fd 100644 --- a/google/cloud/talent_v4/__init__.py +++ b/google/cloud/talent_v4/__init__.py @@ -101,6 +101,7 @@ "CompensationInfo", "CompleteQueryRequest", "CompleteQueryResponse", + "CompletionClient", "CreateClientEventRequest", "CreateCompanyRequest", "CreateJobRequest", @@ -112,7 +113,6 @@ "DeleteTenantRequest", "DeviceInfo", "EmploymentType", - "EventServiceClient", "GetCompanyRequest", "GetJobRequest", "GetTenantRequest", @@ -149,5 +149,5 @@ "UpdateJobRequest", "UpdateTenantRequest", "Visibility", - "CompletionClient", + "EventServiceClient", ) diff --git a/google/cloud/talent_v4beta1/__init__.py b/google/cloud/talent_v4beta1/__init__.py index b751ef4a..c7d0e217 100644 --- a/google/cloud/talent_v4beta1/__init__.py +++ b/google/cloud/talent_v4beta1/__init__.py @@ -157,7 +157,6 @@ "CommuteFilter", "CommuteMethod", "Company", - "CompanyServiceClient", "CompanySize", "CompensationFilter", "CompensationInfo", @@ -203,6 +202,7 @@ "JobLevel", "JobOperationResult", "JobQuery", + "JobServiceClient", "JobTitleFilter", "JobView", "ListApplicationsRequest", @@ -253,5 +253,5 @@ "UpdateTenantRequest", "Visibility", "WorkExperienceFilter", - "JobServiceClient", + "CompanyServiceClient", ) diff --git a/synth.metadata b/synth.metadata index 892bdd58..e9064ec4 100644 --- a/synth.metadata +++ b/synth.metadata @@ -11,8 +11,8 @@ "git": { "name": "googleapis", "remote": "https://github.com/googleapis/googleapis.git", - "sha": "e038e2a5b2104dfae83edada1dfb41b319fc363f", - "internalRef": "355442508" + "sha": "531abbd70bee00357f64946ed68c38da334b61e6", + "internalRef": "355879798" } }, { From a58676b9f7c2ec466933f8ebf129a34d13978ee8 Mon Sep 17 00:00:00 2001 From: yoshi-automation Date: Tue, 23 Mar 2021 18:56:23 -0700 Subject: [PATCH 12/38] chore: update gapic-generator-python PiperOrigin-RevId: 355923884 Source-Author: Google APIs Source-Date: Fri Feb 5 14:04:52 2021 -0800 Source-Repo: googleapis/googleapis Source-Sha: 5e3dacee19405529b841b53797df799c2383536c Source-Link: https://github.com/googleapis/googleapis/commit/5e3dacee19405529b841b53797df799c2383536c --- google/cloud/talent_v4/__init__.py | 4 ++-- .../talent_v4/services/company_service/pagers.py | 11 ++++++++++- .../talent_v4/services/job_service/client.py | 15 ++++++--------- .../talent_v4/services/job_service/pagers.py | 11 ++++++++++- .../talent_v4/services/tenant_service/pagers.py | 11 ++++++++++- google/cloud/talent_v4beta1/__init__.py | 4 ++-- .../services/application_service/pagers.py | 11 ++++++++++- .../services/company_service/pagers.py | 11 ++++++++++- .../talent_v4beta1/services/job_service/client.py | 10 ++++------ .../talent_v4beta1/services/job_service/pagers.py | 11 ++++++++++- .../services/profile_service/pagers.py | 11 ++++++++++- .../services/tenant_service/pagers.py | 11 ++++++++++- synth.metadata | 4 ++-- 13 files changed, 96 insertions(+), 29 deletions(-) diff --git a/google/cloud/talent_v4/__init__.py b/google/cloud/talent_v4/__init__.py index 2f1964fd..b193e4de 100644 --- a/google/cloud/talent_v4/__init__.py +++ b/google/cloud/talent_v4/__init__.py @@ -113,6 +113,7 @@ "DeleteTenantRequest", "DeviceInfo", "EmploymentType", + "EventServiceClient", "GetCompanyRequest", "GetJobRequest", "GetTenantRequest", @@ -143,11 +144,10 @@ "SearchJobsResponse", "SpellingCorrection", "Tenant", - "TenantServiceClient", "TimestampRange", "UpdateCompanyRequest", "UpdateJobRequest", "UpdateTenantRequest", "Visibility", - "EventServiceClient", + "TenantServiceClient", ) diff --git a/google/cloud/talent_v4/services/company_service/pagers.py b/google/cloud/talent_v4/services/company_service/pagers.py index a9eafc75..beac2a8b 100644 --- a/google/cloud/talent_v4/services/company_service/pagers.py +++ b/google/cloud/talent_v4/services/company_service/pagers.py @@ -15,7 +15,16 @@ # limitations under the License. # -from typing import Any, AsyncIterable, Awaitable, Callable, Iterable, Sequence, Tuple +from typing import ( + Any, + AsyncIterable, + Awaitable, + Callable, + Iterable, + Sequence, + Tuple, + Optional, +) from google.cloud.talent_v4.types import company from google.cloud.talent_v4.types import company_service diff --git a/google/cloud/talent_v4/services/job_service/client.py b/google/cloud/talent_v4/services/job_service/client.py index 0660fe9a..8a43c082 100644 --- a/google/cloud/talent_v4/services/job_service/client.py +++ b/google/cloud/talent_v4/services/job_service/client.py @@ -542,9 +542,8 @@ def batch_create_jobs( if parent is not None: request.parent = parent - - if jobs: - request.jobs.extend(jobs) + if jobs is not None: + request.jobs = jobs # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -817,9 +816,8 @@ def batch_update_jobs( if parent is not None: request.parent = parent - - if jobs: - request.jobs.extend(jobs) + if jobs is not None: + request.jobs = jobs # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -996,9 +994,8 @@ def batch_delete_jobs( if parent is not None: request.parent = parent - - if names: - request.names.extend(names) + if names is not None: + request.names = names # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. diff --git a/google/cloud/talent_v4/services/job_service/pagers.py b/google/cloud/talent_v4/services/job_service/pagers.py index 15f5218f..bbef2c82 100644 --- a/google/cloud/talent_v4/services/job_service/pagers.py +++ b/google/cloud/talent_v4/services/job_service/pagers.py @@ -15,7 +15,16 @@ # limitations under the License. # -from typing import Any, AsyncIterable, Awaitable, Callable, Iterable, Sequence, Tuple +from typing import ( + Any, + AsyncIterable, + Awaitable, + Callable, + Iterable, + Sequence, + Tuple, + Optional, +) from google.cloud.talent_v4.types import job from google.cloud.talent_v4.types import job_service diff --git a/google/cloud/talent_v4/services/tenant_service/pagers.py b/google/cloud/talent_v4/services/tenant_service/pagers.py index e5df990c..91d4a213 100644 --- a/google/cloud/talent_v4/services/tenant_service/pagers.py +++ b/google/cloud/talent_v4/services/tenant_service/pagers.py @@ -15,7 +15,16 @@ # limitations under the License. # -from typing import Any, AsyncIterable, Awaitable, Callable, Iterable, Sequence, Tuple +from typing import ( + Any, + AsyncIterable, + Awaitable, + Callable, + Iterable, + Sequence, + Tuple, + Optional, +) from google.cloud.talent_v4.types import tenant from google.cloud.talent_v4.types import tenant_service diff --git a/google/cloud/talent_v4beta1/__init__.py b/google/cloud/talent_v4beta1/__init__.py index c7d0e217..ea0ffd24 100644 --- a/google/cloud/talent_v4beta1/__init__.py +++ b/google/cloud/talent_v4beta1/__init__.py @@ -157,12 +157,12 @@ "CommuteFilter", "CommuteMethod", "Company", + "CompanyServiceClient", "CompanySize", "CompensationFilter", "CompensationInfo", "CompleteQueryRequest", "CompleteQueryResponse", - "CompletionClient", "ContactInfoUsage", "CreateApplicationRequest", "CreateClientEventRequest", @@ -253,5 +253,5 @@ "UpdateTenantRequest", "Visibility", "WorkExperienceFilter", - "CompanyServiceClient", + "CompletionClient", ) diff --git a/google/cloud/talent_v4beta1/services/application_service/pagers.py b/google/cloud/talent_v4beta1/services/application_service/pagers.py index 12862dc2..1aa9124c 100644 --- a/google/cloud/talent_v4beta1/services/application_service/pagers.py +++ b/google/cloud/talent_v4beta1/services/application_service/pagers.py @@ -15,7 +15,16 @@ # limitations under the License. # -from typing import Any, AsyncIterable, Awaitable, Callable, Iterable, Sequence, Tuple +from typing import ( + Any, + AsyncIterable, + Awaitable, + Callable, + Iterable, + Sequence, + Tuple, + Optional, +) from google.cloud.talent_v4beta1.types import application from google.cloud.talent_v4beta1.types import application_service diff --git a/google/cloud/talent_v4beta1/services/company_service/pagers.py b/google/cloud/talent_v4beta1/services/company_service/pagers.py index d3cf81a7..cb04a126 100644 --- a/google/cloud/talent_v4beta1/services/company_service/pagers.py +++ b/google/cloud/talent_v4beta1/services/company_service/pagers.py @@ -15,7 +15,16 @@ # limitations under the License. # -from typing import Any, AsyncIterable, Awaitable, Callable, Iterable, Sequence, Tuple +from typing import ( + Any, + AsyncIterable, + Awaitable, + Callable, + Iterable, + Sequence, + Tuple, + Optional, +) from google.cloud.talent_v4beta1.types import company from google.cloud.talent_v4beta1.types import company_service diff --git a/google/cloud/talent_v4beta1/services/job_service/client.py b/google/cloud/talent_v4beta1/services/job_service/client.py index 1ef51df9..d044dc14 100644 --- a/google/cloud/talent_v4beta1/services/job_service/client.py +++ b/google/cloud/talent_v4beta1/services/job_service/client.py @@ -529,9 +529,8 @@ def batch_create_jobs( if parent is not None: request.parent = parent - - if jobs: - request.jobs.extend(jobs) + if jobs is not None: + request.jobs = jobs # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -788,9 +787,8 @@ def batch_update_jobs( if parent is not None: request.parent = parent - - if jobs: - request.jobs.extend(jobs) + if jobs is not None: + request.jobs = jobs # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. diff --git a/google/cloud/talent_v4beta1/services/job_service/pagers.py b/google/cloud/talent_v4beta1/services/job_service/pagers.py index 57d6d4c1..47d07398 100644 --- a/google/cloud/talent_v4beta1/services/job_service/pagers.py +++ b/google/cloud/talent_v4beta1/services/job_service/pagers.py @@ -15,7 +15,16 @@ # limitations under the License. # -from typing import Any, AsyncIterable, Awaitable, Callable, Iterable, Sequence, Tuple +from typing import ( + Any, + AsyncIterable, + Awaitable, + Callable, + Iterable, + Sequence, + Tuple, + Optional, +) from google.cloud.talent_v4beta1.types import job from google.cloud.talent_v4beta1.types import job_service diff --git a/google/cloud/talent_v4beta1/services/profile_service/pagers.py b/google/cloud/talent_v4beta1/services/profile_service/pagers.py index 29de6067..1793730e 100644 --- a/google/cloud/talent_v4beta1/services/profile_service/pagers.py +++ b/google/cloud/talent_v4beta1/services/profile_service/pagers.py @@ -15,7 +15,16 @@ # limitations under the License. # -from typing import Any, AsyncIterable, Awaitable, Callable, Iterable, Sequence, Tuple +from typing import ( + Any, + AsyncIterable, + Awaitable, + Callable, + Iterable, + Sequence, + Tuple, + Optional, +) from google.cloud.talent_v4beta1.types import histogram from google.cloud.talent_v4beta1.types import profile diff --git a/google/cloud/talent_v4beta1/services/tenant_service/pagers.py b/google/cloud/talent_v4beta1/services/tenant_service/pagers.py index 5adc6788..5d402971 100644 --- a/google/cloud/talent_v4beta1/services/tenant_service/pagers.py +++ b/google/cloud/talent_v4beta1/services/tenant_service/pagers.py @@ -15,7 +15,16 @@ # limitations under the License. # -from typing import Any, AsyncIterable, Awaitable, Callable, Iterable, Sequence, Tuple +from typing import ( + Any, + AsyncIterable, + Awaitable, + Callable, + Iterable, + Sequence, + Tuple, + Optional, +) from google.cloud.talent_v4beta1.types import tenant from google.cloud.talent_v4beta1.types import tenant_service diff --git a/synth.metadata b/synth.metadata index e9064ec4..235b89a8 100644 --- a/synth.metadata +++ b/synth.metadata @@ -11,8 +11,8 @@ "git": { "name": "googleapis", "remote": "https://github.com/googleapis/googleapis.git", - "sha": "531abbd70bee00357f64946ed68c38da334b61e6", - "internalRef": "355879798" + "sha": "5e3dacee19405529b841b53797df799c2383536c", + "internalRef": "355923884" } }, { From cbfdf6e99a77071eb27e5024b12fbd9385126e90 Mon Sep 17 00:00:00 2001 From: yoshi-automation Date: Tue, 23 Mar 2021 18:56:50 -0700 Subject: [PATCH 13/38] feat: generate sample code in the Java microgenerator Committer: @miraleung PiperOrigin-RevId: 356341083 Source-Author: Google APIs Source-Date: Mon Feb 8 13:33:28 2021 -0800 Source-Repo: googleapis/googleapis Source-Sha: 8d8c008e56f1af31d57f75561e0f1848ffb29eeb Source-Link: https://github.com/googleapis/googleapis/commit/8d8c008e56f1af31d57f75561e0f1848ffb29eeb --- google/cloud/talent_v4/__init__.py | 4 ++-- google/cloud/talent_v4beta1/__init__.py | 4 ++-- synth.metadata | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/google/cloud/talent_v4/__init__.py b/google/cloud/talent_v4/__init__.py index b193e4de..5d959d15 100644 --- a/google/cloud/talent_v4/__init__.py +++ b/google/cloud/talent_v4/__init__.py @@ -101,7 +101,6 @@ "CompensationInfo", "CompleteQueryRequest", "CompleteQueryResponse", - "CompletionClient", "CreateClientEventRequest", "CreateCompanyRequest", "CreateJobRequest", @@ -144,10 +143,11 @@ "SearchJobsResponse", "SpellingCorrection", "Tenant", + "TenantServiceClient", "TimestampRange", "UpdateCompanyRequest", "UpdateJobRequest", "UpdateTenantRequest", "Visibility", - "TenantServiceClient", + "CompletionClient", ) diff --git a/google/cloud/talent_v4beta1/__init__.py b/google/cloud/talent_v4beta1/__init__.py index ea0ffd24..b751ef4a 100644 --- a/google/cloud/talent_v4beta1/__init__.py +++ b/google/cloud/talent_v4beta1/__init__.py @@ -163,6 +163,7 @@ "CompensationInfo", "CompleteQueryRequest", "CompleteQueryResponse", + "CompletionClient", "ContactInfoUsage", "CreateApplicationRequest", "CreateClientEventRequest", @@ -202,7 +203,6 @@ "JobLevel", "JobOperationResult", "JobQuery", - "JobServiceClient", "JobTitleFilter", "JobView", "ListApplicationsRequest", @@ -253,5 +253,5 @@ "UpdateTenantRequest", "Visibility", "WorkExperienceFilter", - "CompletionClient", + "JobServiceClient", ) diff --git a/synth.metadata b/synth.metadata index 235b89a8..86a2a514 100644 --- a/synth.metadata +++ b/synth.metadata @@ -11,8 +11,8 @@ "git": { "name": "googleapis", "remote": "https://github.com/googleapis/googleapis.git", - "sha": "5e3dacee19405529b841b53797df799c2383536c", - "internalRef": "355923884" + "sha": "8d8c008e56f1af31d57f75561e0f1848ffb29eeb", + "internalRef": "356341083" } }, { From a884aabe1fcef6124fbd8fd420b5088508a49f96 Mon Sep 17 00:00:00 2001 From: yoshi-automation Date: Tue, 23 Mar 2021 18:59:05 -0700 Subject: [PATCH 14/38] docs: Update rules for currency_code in budget_amount. PiperOrigin-RevId: 356991675 Source-Author: Google APIs Source-Date: Thu Feb 11 09:28:51 2021 -0800 Source-Repo: googleapis/googleapis Source-Sha: dd89b0cc1bffc39d1fb5c91c6c2bb3532f237792 Source-Link: https://github.com/googleapis/googleapis/commit/dd89b0cc1bffc39d1fb5c91c6c2bb3532f237792 --- google/cloud/talent_v4/__init__.py | 4 ++-- google/cloud/talent_v4beta1/__init__.py | 4 ++-- synth.metadata | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/google/cloud/talent_v4/__init__.py b/google/cloud/talent_v4/__init__.py index 5d959d15..1d4b845e 100644 --- a/google/cloud/talent_v4/__init__.py +++ b/google/cloud/talent_v4/__init__.py @@ -101,6 +101,7 @@ "CompensationInfo", "CompleteQueryRequest", "CompleteQueryResponse", + "CompletionClient", "CreateClientEventRequest", "CreateCompanyRequest", "CreateJobRequest", @@ -126,7 +127,6 @@ "JobLevel", "JobQuery", "JobResult", - "JobServiceClient", "JobView", "ListCompaniesRequest", "ListCompaniesResponse", @@ -149,5 +149,5 @@ "UpdateJobRequest", "UpdateTenantRequest", "Visibility", - "CompletionClient", + "JobServiceClient", ) diff --git a/google/cloud/talent_v4beta1/__init__.py b/google/cloud/talent_v4beta1/__init__.py index b751ef4a..c7d0e217 100644 --- a/google/cloud/talent_v4beta1/__init__.py +++ b/google/cloud/talent_v4beta1/__init__.py @@ -157,7 +157,6 @@ "CommuteFilter", "CommuteMethod", "Company", - "CompanyServiceClient", "CompanySize", "CompensationFilter", "CompensationInfo", @@ -203,6 +202,7 @@ "JobLevel", "JobOperationResult", "JobQuery", + "JobServiceClient", "JobTitleFilter", "JobView", "ListApplicationsRequest", @@ -253,5 +253,5 @@ "UpdateTenantRequest", "Visibility", "WorkExperienceFilter", - "JobServiceClient", + "CompanyServiceClient", ) diff --git a/synth.metadata b/synth.metadata index 86a2a514..e536bfd0 100644 --- a/synth.metadata +++ b/synth.metadata @@ -11,8 +11,8 @@ "git": { "name": "googleapis", "remote": "https://github.com/googleapis/googleapis.git", - "sha": "8d8c008e56f1af31d57f75561e0f1848ffb29eeb", - "internalRef": "356341083" + "sha": "dd89b0cc1bffc39d1fb5c91c6c2bb3532f237792", + "internalRef": "356991675" } }, { From d0e0991fc22d0b7cbedab2baba6db308ddaec364 Mon Sep 17 00:00:00 2001 From: yoshi-automation Date: Tue, 23 Mar 2021 19:00:09 -0700 Subject: [PATCH 15/38] chore: Operations proto comment cleanup Committer: @miraleung PiperOrigin-RevId: 357075713 Source-Author: Google APIs Source-Date: Thu Feb 11 15:50:21 2021 -0800 Source-Repo: googleapis/googleapis Source-Sha: c059c46957b0eb83078e61b4a5170c3d09ea96e6 Source-Link: https://github.com/googleapis/googleapis/commit/c059c46957b0eb83078e61b4a5170c3d09ea96e6 --- google/cloud/talent_v4/__init__.py | 4 ++-- google/cloud/talent_v4beta1/__init__.py | 4 ++-- synth.metadata | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/google/cloud/talent_v4/__init__.py b/google/cloud/talent_v4/__init__.py index 1d4b845e..5d959d15 100644 --- a/google/cloud/talent_v4/__init__.py +++ b/google/cloud/talent_v4/__init__.py @@ -101,7 +101,6 @@ "CompensationInfo", "CompleteQueryRequest", "CompleteQueryResponse", - "CompletionClient", "CreateClientEventRequest", "CreateCompanyRequest", "CreateJobRequest", @@ -127,6 +126,7 @@ "JobLevel", "JobQuery", "JobResult", + "JobServiceClient", "JobView", "ListCompaniesRequest", "ListCompaniesResponse", @@ -149,5 +149,5 @@ "UpdateJobRequest", "UpdateTenantRequest", "Visibility", - "JobServiceClient", + "CompletionClient", ) diff --git a/google/cloud/talent_v4beta1/__init__.py b/google/cloud/talent_v4beta1/__init__.py index c7d0e217..ea0ffd24 100644 --- a/google/cloud/talent_v4beta1/__init__.py +++ b/google/cloud/talent_v4beta1/__init__.py @@ -157,12 +157,12 @@ "CommuteFilter", "CommuteMethod", "Company", + "CompanyServiceClient", "CompanySize", "CompensationFilter", "CompensationInfo", "CompleteQueryRequest", "CompleteQueryResponse", - "CompletionClient", "ContactInfoUsage", "CreateApplicationRequest", "CreateClientEventRequest", @@ -253,5 +253,5 @@ "UpdateTenantRequest", "Visibility", "WorkExperienceFilter", - "CompanyServiceClient", + "CompletionClient", ) diff --git a/synth.metadata b/synth.metadata index e536bfd0..6b3b4e40 100644 --- a/synth.metadata +++ b/synth.metadata @@ -11,8 +11,8 @@ "git": { "name": "googleapis", "remote": "https://github.com/googleapis/googleapis.git", - "sha": "dd89b0cc1bffc39d1fb5c91c6c2bb3532f237792", - "internalRef": "356991675" + "sha": "c059c46957b0eb83078e61b4a5170c3d09ea96e6", + "internalRef": "357075713" } }, { From b37c70e73be564044fd7410ea5aaa45dd78192a3 Mon Sep 17 00:00:00 2001 From: yoshi-automation Date: Tue, 23 Mar 2021 19:01:05 -0700 Subject: [PATCH 16/38] feat: Update Membership API v1beta1 proto PiperOrigin-RevId: 357242088 Source-Author: Google APIs Source-Date: Fri Feb 12 12:12:12 2021 -0800 Source-Repo: googleapis/googleapis Source-Sha: 1b2ab49ed6df31252afdede55280f97e1a745962 Source-Link: https://github.com/googleapis/googleapis/commit/1b2ab49ed6df31252afdede55280f97e1a745962 --- google/cloud/talent_v4/__init__.py | 4 ++-- google/cloud/talent_v4beta1/__init__.py | 4 ++-- synth.metadata | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/google/cloud/talent_v4/__init__.py b/google/cloud/talent_v4/__init__.py index 5d959d15..1d4b845e 100644 --- a/google/cloud/talent_v4/__init__.py +++ b/google/cloud/talent_v4/__init__.py @@ -101,6 +101,7 @@ "CompensationInfo", "CompleteQueryRequest", "CompleteQueryResponse", + "CompletionClient", "CreateClientEventRequest", "CreateCompanyRequest", "CreateJobRequest", @@ -126,7 +127,6 @@ "JobLevel", "JobQuery", "JobResult", - "JobServiceClient", "JobView", "ListCompaniesRequest", "ListCompaniesResponse", @@ -149,5 +149,5 @@ "UpdateJobRequest", "UpdateTenantRequest", "Visibility", - "CompletionClient", + "JobServiceClient", ) diff --git a/google/cloud/talent_v4beta1/__init__.py b/google/cloud/talent_v4beta1/__init__.py index ea0ffd24..4743ac58 100644 --- a/google/cloud/talent_v4beta1/__init__.py +++ b/google/cloud/talent_v4beta1/__init__.py @@ -163,6 +163,7 @@ "CompensationInfo", "CompleteQueryRequest", "CompleteQueryResponse", + "CompletionClient", "ContactInfoUsage", "CreateApplicationRequest", "CreateClientEventRequest", @@ -243,7 +244,6 @@ "SpellingCorrection", "SummarizedProfile", "Tenant", - "TenantServiceClient", "TimeFilter", "TimestampRange", "UpdateApplicationRequest", @@ -253,5 +253,5 @@ "UpdateTenantRequest", "Visibility", "WorkExperienceFilter", - "CompletionClient", + "TenantServiceClient", ) diff --git a/synth.metadata b/synth.metadata index 6b3b4e40..d555c536 100644 --- a/synth.metadata +++ b/synth.metadata @@ -11,8 +11,8 @@ "git": { "name": "googleapis", "remote": "https://github.com/googleapis/googleapis.git", - "sha": "c059c46957b0eb83078e61b4a5170c3d09ea96e6", - "internalRef": "357075713" + "sha": "1b2ab49ed6df31252afdede55280f97e1a745962", + "internalRef": "357242088" } }, { From 0c35bee54078ee195f9e5dfbb9568a70d54a4d3f Mon Sep 17 00:00:00 2001 From: yoshi-automation Date: Tue, 23 Mar 2021 19:02:27 -0700 Subject: [PATCH 17/38] chore(bazel): update Go microgenerator to v0.18.1 Changes include: - adding GapicMetadata generation - renaming plugin flag `gapic-service-config` -> `api-service-config` (still supports the old one, but it is undocumented) - normal updates to dependencies PiperOrigin-RevId: 357260962 Source-Author: Google APIs Source-Date: Fri Feb 12 13:48:15 2021 -0800 Source-Repo: googleapis/googleapis Source-Sha: 178d16d9f99ee85ffa65dff304f40324c35d0668 Source-Link: https://github.com/googleapis/googleapis/commit/178d16d9f99ee85ffa65dff304f40324c35d0668 --- google/cloud/talent_v4/__init__.py | 4 ++-- google/cloud/talent_v4beta1/__init__.py | 4 ++-- synth.metadata | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/google/cloud/talent_v4/__init__.py b/google/cloud/talent_v4/__init__.py index 1d4b845e..5d959d15 100644 --- a/google/cloud/talent_v4/__init__.py +++ b/google/cloud/talent_v4/__init__.py @@ -101,7 +101,6 @@ "CompensationInfo", "CompleteQueryRequest", "CompleteQueryResponse", - "CompletionClient", "CreateClientEventRequest", "CreateCompanyRequest", "CreateJobRequest", @@ -127,6 +126,7 @@ "JobLevel", "JobQuery", "JobResult", + "JobServiceClient", "JobView", "ListCompaniesRequest", "ListCompaniesResponse", @@ -149,5 +149,5 @@ "UpdateJobRequest", "UpdateTenantRequest", "Visibility", - "JobServiceClient", + "CompletionClient", ) diff --git a/google/cloud/talent_v4beta1/__init__.py b/google/cloud/talent_v4beta1/__init__.py index 4743ac58..ea0ffd24 100644 --- a/google/cloud/talent_v4beta1/__init__.py +++ b/google/cloud/talent_v4beta1/__init__.py @@ -163,7 +163,6 @@ "CompensationInfo", "CompleteQueryRequest", "CompleteQueryResponse", - "CompletionClient", "ContactInfoUsage", "CreateApplicationRequest", "CreateClientEventRequest", @@ -244,6 +243,7 @@ "SpellingCorrection", "SummarizedProfile", "Tenant", + "TenantServiceClient", "TimeFilter", "TimestampRange", "UpdateApplicationRequest", @@ -253,5 +253,5 @@ "UpdateTenantRequest", "Visibility", "WorkExperienceFilter", - "TenantServiceClient", + "CompletionClient", ) diff --git a/synth.metadata b/synth.metadata index d555c536..0a5fa25f 100644 --- a/synth.metadata +++ b/synth.metadata @@ -11,8 +11,8 @@ "git": { "name": "googleapis", "remote": "https://github.com/googleapis/googleapis.git", - "sha": "1b2ab49ed6df31252afdede55280f97e1a745962", - "internalRef": "357242088" + "sha": "178d16d9f99ee85ffa65dff304f40324c35d0668", + "internalRef": "357260962" } }, { From 05c3a69b5026135fad29a5794c5a3f357a7d6486 Mon Sep 17 00:00:00 2001 From: yoshi-automation Date: Tue, 23 Mar 2021 19:03:48 -0700 Subject: [PATCH 18/38] feat: Add csharp_proto_libraries for google/type. Committer: @damonkey2 PiperOrigin-RevId: 357809969 Source-Author: Google APIs Source-Date: Tue Feb 16 14:50:30 2021 -0800 Source-Repo: googleapis/googleapis Source-Sha: 67233f5990d35911567c18ce2f76fc0967961aca Source-Link: https://github.com/googleapis/googleapis/commit/67233f5990d35911567c18ce2f76fc0967961aca --- google/cloud/talent_v4/__init__.py | 4 ++-- google/cloud/talent_v4beta1/__init__.py | 4 ++-- synth.metadata | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/google/cloud/talent_v4/__init__.py b/google/cloud/talent_v4/__init__.py index 5d959d15..9bf1bf95 100644 --- a/google/cloud/talent_v4/__init__.py +++ b/google/cloud/talent_v4/__init__.py @@ -95,12 +95,12 @@ "CommuteFilter", "CommuteMethod", "Company", - "CompanyServiceClient", "CompanySize", "CompensationFilter", "CompensationInfo", "CompleteQueryRequest", "CompleteQueryResponse", + "CompletionClient", "CreateClientEventRequest", "CreateCompanyRequest", "CreateJobRequest", @@ -149,5 +149,5 @@ "UpdateJobRequest", "UpdateTenantRequest", "Visibility", - "CompletionClient", + "CompanyServiceClient", ) diff --git a/google/cloud/talent_v4beta1/__init__.py b/google/cloud/talent_v4beta1/__init__.py index ea0ffd24..e486a156 100644 --- a/google/cloud/talent_v4beta1/__init__.py +++ b/google/cloud/talent_v4beta1/__init__.py @@ -163,6 +163,7 @@ "CompensationInfo", "CompleteQueryRequest", "CompleteQueryResponse", + "CompletionClient", "ContactInfoUsage", "CreateApplicationRequest", "CreateClientEventRequest", @@ -185,7 +186,6 @@ "EmployerFilter", "EmploymentRecord", "EmploymentType", - "EventServiceClient", "GetApplicationRequest", "GetCompanyRequest", "GetJobRequest", @@ -253,5 +253,5 @@ "UpdateTenantRequest", "Visibility", "WorkExperienceFilter", - "CompletionClient", + "EventServiceClient", ) diff --git a/synth.metadata b/synth.metadata index 0a5fa25f..59609937 100644 --- a/synth.metadata +++ b/synth.metadata @@ -11,8 +11,8 @@ "git": { "name": "googleapis", "remote": "https://github.com/googleapis/googleapis.git", - "sha": "178d16d9f99ee85ffa65dff304f40324c35d0668", - "internalRef": "357260962" + "sha": "67233f5990d35911567c18ce2f76fc0967961aca", + "internalRef": "357809969" } }, { From 725ab52893b4ea5394112c4d729fa466a200969a Mon Sep 17 00:00:00 2001 From: yoshi-automation Date: Tue, 23 Mar 2021 19:11:19 -0700 Subject: [PATCH 19/38] feat: Update documentai/v1beta3 protos PiperOrigin-RevId: 357825340 Source-Author: Google APIs Source-Date: Tue Feb 16 16:03:56 2021 -0800 Source-Repo: googleapis/googleapis Source-Sha: 1f68cd0c02d6925e97aa5bbb153d70a70554dab0 Source-Link: https://github.com/googleapis/googleapis/commit/1f68cd0c02d6925e97aa5bbb153d70a70554dab0 --- google/cloud/talent_v4/__init__.py | 4 ++-- google/cloud/talent_v4beta1/__init__.py | 4 ++-- synth.metadata | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/google/cloud/talent_v4/__init__.py b/google/cloud/talent_v4/__init__.py index 9bf1bf95..1d4b845e 100644 --- a/google/cloud/talent_v4/__init__.py +++ b/google/cloud/talent_v4/__init__.py @@ -95,6 +95,7 @@ "CommuteFilter", "CommuteMethod", "Company", + "CompanyServiceClient", "CompanySize", "CompensationFilter", "CompensationInfo", @@ -126,7 +127,6 @@ "JobLevel", "JobQuery", "JobResult", - "JobServiceClient", "JobView", "ListCompaniesRequest", "ListCompaniesResponse", @@ -149,5 +149,5 @@ "UpdateJobRequest", "UpdateTenantRequest", "Visibility", - "CompanyServiceClient", + "JobServiceClient", ) diff --git a/google/cloud/talent_v4beta1/__init__.py b/google/cloud/talent_v4beta1/__init__.py index e486a156..b751ef4a 100644 --- a/google/cloud/talent_v4beta1/__init__.py +++ b/google/cloud/talent_v4beta1/__init__.py @@ -186,6 +186,7 @@ "EmployerFilter", "EmploymentRecord", "EmploymentType", + "EventServiceClient", "GetApplicationRequest", "GetCompanyRequest", "GetJobRequest", @@ -202,7 +203,6 @@ "JobLevel", "JobOperationResult", "JobQuery", - "JobServiceClient", "JobTitleFilter", "JobView", "ListApplicationsRequest", @@ -253,5 +253,5 @@ "UpdateTenantRequest", "Visibility", "WorkExperienceFilter", - "EventServiceClient", + "JobServiceClient", ) diff --git a/synth.metadata b/synth.metadata index 59609937..fa026c56 100644 --- a/synth.metadata +++ b/synth.metadata @@ -11,8 +11,8 @@ "git": { "name": "googleapis", "remote": "https://github.com/googleapis/googleapis.git", - "sha": "67233f5990d35911567c18ce2f76fc0967961aca", - "internalRef": "357809969" + "sha": "1f68cd0c02d6925e97aa5bbb153d70a70554dab0", + "internalRef": "357825340" } }, { From 17019795c175281f71269852166f18a2101af826 Mon Sep 17 00:00:00 2001 From: yoshi-automation Date: Tue, 23 Mar 2021 19:18:11 -0700 Subject: [PATCH 20/38] fix: Use rules_gapic to v0.5.0. Fixes handling parameters with spaces. Committer: @alexander-fenster PiperOrigin-RevId: 359364666 Source-Author: Google APIs Source-Date: Wed Feb 24 14:01:05 2021 -0800 Source-Repo: googleapis/googleapis Source-Sha: c06bbe28cc7287a55bf7926ee48da2565854de7f Source-Link: https://github.com/googleapis/googleapis/commit/c06bbe28cc7287a55bf7926ee48da2565854de7f --- google/cloud/talent_v4beta1/__init__.py | 4 ++-- synth.metadata | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/google/cloud/talent_v4beta1/__init__.py b/google/cloud/talent_v4beta1/__init__.py index b751ef4a..4743ac58 100644 --- a/google/cloud/talent_v4beta1/__init__.py +++ b/google/cloud/talent_v4beta1/__init__.py @@ -203,6 +203,7 @@ "JobLevel", "JobOperationResult", "JobQuery", + "JobServiceClient", "JobTitleFilter", "JobView", "ListApplicationsRequest", @@ -243,7 +244,6 @@ "SpellingCorrection", "SummarizedProfile", "Tenant", - "TenantServiceClient", "TimeFilter", "TimestampRange", "UpdateApplicationRequest", @@ -253,5 +253,5 @@ "UpdateTenantRequest", "Visibility", "WorkExperienceFilter", - "JobServiceClient", + "TenantServiceClient", ) diff --git a/synth.metadata b/synth.metadata index fa026c56..ed0959f8 100644 --- a/synth.metadata +++ b/synth.metadata @@ -11,8 +11,8 @@ "git": { "name": "googleapis", "remote": "https://github.com/googleapis/googleapis.git", - "sha": "1f68cd0c02d6925e97aa5bbb153d70a70554dab0", - "internalRef": "357825340" + "sha": "c06bbe28cc7287a55bf7926ee48da2565854de7f", + "internalRef": "359364666" } }, { From b791c77275b7c490a5c0784bd5a00fd42c133e64 Mon Sep 17 00:00:00 2001 From: yoshi-automation Date: Tue, 23 Mar 2021 19:18:38 -0700 Subject: [PATCH 21/38] chore: update gapic-generator-python to 0.40.11 PiperOrigin-RevId: 359562873 Source-Author: Google APIs Source-Date: Thu Feb 25 10:52:32 2021 -0800 Source-Repo: googleapis/googleapis Source-Sha: 07932bb995e7dc91b43620ea8402c6668c7d102c Source-Link: https://github.com/googleapis/googleapis/commit/07932bb995e7dc91b43620ea8402c6668c7d102c --- google/cloud/talent_v4/__init__.py | 4 +- .../services/company_service/async_client.py | 32 +++- .../services/completion/async_client.py | 32 +++- .../services/event_service/async_client.py | 32 +++- .../services/job_service/async_client.py | 32 +++- .../services/tenant_service/async_client.py | 32 +++- google/cloud/talent_v4beta1/__init__.py | 4 +- .../application_service/async_client.py | 32 +++- .../services/company_service/async_client.py | 32 +++- .../services/completion/async_client.py | 32 +++- .../services/event_service/async_client.py | 32 +++- .../services/job_service/async_client.py | 32 +++- .../services/profile_service/async_client.py | 32 +++- .../services/tenant_service/async_client.py | 32 +++- synth.metadata | 5 +- talent-v4beta1-py.tar.gz | 0 tests/unit/gapic/talent_v4/__init__.py | 15 ++ .../gapic/talent_v4/test_company_service.py | 90 ++++++++- tests/unit/gapic/talent_v4/test_completion.py | 24 ++- .../gapic/talent_v4/test_event_service.py | 26 ++- .../unit/gapic/talent_v4/test_job_service.py | 176 +++++++++++++++++- .../gapic/talent_v4/test_tenant_service.py | 90 ++++++++- tests/unit/gapic/talent_v4beta1/__init__.py | 15 ++ .../test_application_service.py | 98 +++++++++- .../talent_v4beta1/test_company_service.py | 90 ++++++++- .../gapic/talent_v4beta1/test_completion.py | 24 ++- .../talent_v4beta1/test_event_service.py | 26 ++- .../gapic/talent_v4beta1/test_job_service.py | 176 +++++++++++++++++- .../talent_v4beta1/test_profile_service.py | 106 ++++++++++- .../talent_v4beta1/test_tenant_service.py | 90 ++++++++- 30 files changed, 1389 insertions(+), 54 deletions(-) create mode 100644 talent-v4beta1-py.tar.gz diff --git a/google/cloud/talent_v4/__init__.py b/google/cloud/talent_v4/__init__.py index 1d4b845e..b193e4de 100644 --- a/google/cloud/talent_v4/__init__.py +++ b/google/cloud/talent_v4/__init__.py @@ -127,6 +127,7 @@ "JobLevel", "JobQuery", "JobResult", + "JobServiceClient", "JobView", "ListCompaniesRequest", "ListCompaniesResponse", @@ -143,11 +144,10 @@ "SearchJobsResponse", "SpellingCorrection", "Tenant", - "TenantServiceClient", "TimestampRange", "UpdateCompanyRequest", "UpdateJobRequest", "UpdateTenantRequest", "Visibility", - "JobServiceClient", + "TenantServiceClient", ) diff --git a/google/cloud/talent_v4/services/company_service/async_client.py b/google/cloud/talent_v4/services/company_service/async_client.py index ce76dc6c..8cef405a 100644 --- a/google/cloud/talent_v4/services/company_service/async_client.py +++ b/google/cloud/talent_v4/services/company_service/async_client.py @@ -84,8 +84,36 @@ class CompanyServiceAsyncClient: CompanyServiceClient.parse_common_location_path ) - from_service_account_info = CompanyServiceClient.from_service_account_info - from_service_account_file = CompanyServiceClient.from_service_account_file + @classmethod + def from_service_account_info(cls, info: dict, *args, **kwargs): + """Creates an instance of this client using the provided credentials info. + + Args: + info (dict): The service account private key info. + args: Additional arguments to pass to the constructor. + kwargs: Additional arguments to pass to the constructor. + + Returns: + CompanyServiceAsyncClient: The constructed client. + """ + return CompanyServiceClient.from_service_account_info.__func__(CompanyServiceAsyncClient, info, *args, **kwargs) # type: ignore + + @classmethod + def from_service_account_file(cls, filename: str, *args, **kwargs): + """Creates an instance of this client using the provided credentials + file. + + Args: + filename (str): The path to the service account private key json + file. + args: Additional arguments to pass to the constructor. + kwargs: Additional arguments to pass to the constructor. + + Returns: + CompanyServiceAsyncClient: The constructed client. + """ + return CompanyServiceClient.from_service_account_file.__func__(CompanyServiceAsyncClient, filename, *args, **kwargs) # type: ignore + from_service_account_json = from_service_account_file @property diff --git a/google/cloud/talent_v4/services/completion/async_client.py b/google/cloud/talent_v4/services/completion/async_client.py index 778ebbd2..35e17862 100644 --- a/google/cloud/talent_v4/services/completion/async_client.py +++ b/google/cloud/talent_v4/services/completion/async_client.py @@ -72,8 +72,36 @@ class CompletionAsyncClient: CompletionClient.parse_common_location_path ) - from_service_account_info = CompletionClient.from_service_account_info - from_service_account_file = CompletionClient.from_service_account_file + @classmethod + def from_service_account_info(cls, info: dict, *args, **kwargs): + """Creates an instance of this client using the provided credentials info. + + Args: + info (dict): The service account private key info. + args: Additional arguments to pass to the constructor. + kwargs: Additional arguments to pass to the constructor. + + Returns: + CompletionAsyncClient: The constructed client. + """ + return CompletionClient.from_service_account_info.__func__(CompletionAsyncClient, info, *args, **kwargs) # type: ignore + + @classmethod + def from_service_account_file(cls, filename: str, *args, **kwargs): + """Creates an instance of this client using the provided credentials + file. + + Args: + filename (str): The path to the service account private key json + file. + args: Additional arguments to pass to the constructor. + kwargs: Additional arguments to pass to the constructor. + + Returns: + CompletionAsyncClient: The constructed client. + """ + return CompletionClient.from_service_account_file.__func__(CompletionAsyncClient, filename, *args, **kwargs) # type: ignore + from_service_account_json = from_service_account_file @property diff --git a/google/cloud/talent_v4/services/event_service/async_client.py b/google/cloud/talent_v4/services/event_service/async_client.py index e5c364f0..c6237025 100644 --- a/google/cloud/talent_v4/services/event_service/async_client.py +++ b/google/cloud/talent_v4/services/event_service/async_client.py @@ -73,8 +73,36 @@ class EventServiceAsyncClient: EventServiceClient.parse_common_location_path ) - from_service_account_info = EventServiceClient.from_service_account_info - from_service_account_file = EventServiceClient.from_service_account_file + @classmethod + def from_service_account_info(cls, info: dict, *args, **kwargs): + """Creates an instance of this client using the provided credentials info. + + Args: + info (dict): The service account private key info. + args: Additional arguments to pass to the constructor. + kwargs: Additional arguments to pass to the constructor. + + Returns: + EventServiceAsyncClient: The constructed client. + """ + return EventServiceClient.from_service_account_info.__func__(EventServiceAsyncClient, info, *args, **kwargs) # type: ignore + + @classmethod + def from_service_account_file(cls, filename: str, *args, **kwargs): + """Creates an instance of this client using the provided credentials + file. + + Args: + filename (str): The path to the service account private key json + file. + args: Additional arguments to pass to the constructor. + kwargs: Additional arguments to pass to the constructor. + + Returns: + EventServiceAsyncClient: The constructed client. + """ + return EventServiceClient.from_service_account_file.__func__(EventServiceAsyncClient, filename, *args, **kwargs) # type: ignore + from_service_account_json = from_service_account_file @property diff --git a/google/cloud/talent_v4/services/job_service/async_client.py b/google/cloud/talent_v4/services/job_service/async_client.py index 88e0e7ca..1ccef521 100644 --- a/google/cloud/talent_v4/services/job_service/async_client.py +++ b/google/cloud/talent_v4/services/job_service/async_client.py @@ -84,8 +84,36 @@ class JobServiceAsyncClient: JobServiceClient.parse_common_location_path ) - from_service_account_info = JobServiceClient.from_service_account_info - from_service_account_file = JobServiceClient.from_service_account_file + @classmethod + def from_service_account_info(cls, info: dict, *args, **kwargs): + """Creates an instance of this client using the provided credentials info. + + Args: + info (dict): The service account private key info. + args: Additional arguments to pass to the constructor. + kwargs: Additional arguments to pass to the constructor. + + Returns: + JobServiceAsyncClient: The constructed client. + """ + return JobServiceClient.from_service_account_info.__func__(JobServiceAsyncClient, info, *args, **kwargs) # type: ignore + + @classmethod + def from_service_account_file(cls, filename: str, *args, **kwargs): + """Creates an instance of this client using the provided credentials + file. + + Args: + filename (str): The path to the service account private key json + file. + args: Additional arguments to pass to the constructor. + kwargs: Additional arguments to pass to the constructor. + + Returns: + JobServiceAsyncClient: The constructed client. + """ + return JobServiceClient.from_service_account_file.__func__(JobServiceAsyncClient, filename, *args, **kwargs) # type: ignore + from_service_account_json = from_service_account_file @property diff --git a/google/cloud/talent_v4/services/tenant_service/async_client.py b/google/cloud/talent_v4/services/tenant_service/async_client.py index 46170195..548d95f1 100644 --- a/google/cloud/talent_v4/services/tenant_service/async_client.py +++ b/google/cloud/talent_v4/services/tenant_service/async_client.py @@ -81,8 +81,36 @@ class TenantServiceAsyncClient: TenantServiceClient.parse_common_location_path ) - from_service_account_info = TenantServiceClient.from_service_account_info - from_service_account_file = TenantServiceClient.from_service_account_file + @classmethod + def from_service_account_info(cls, info: dict, *args, **kwargs): + """Creates an instance of this client using the provided credentials info. + + Args: + info (dict): The service account private key info. + args: Additional arguments to pass to the constructor. + kwargs: Additional arguments to pass to the constructor. + + Returns: + TenantServiceAsyncClient: The constructed client. + """ + return TenantServiceClient.from_service_account_info.__func__(TenantServiceAsyncClient, info, *args, **kwargs) # type: ignore + + @classmethod + def from_service_account_file(cls, filename: str, *args, **kwargs): + """Creates an instance of this client using the provided credentials + file. + + Args: + filename (str): The path to the service account private key json + file. + args: Additional arguments to pass to the constructor. + kwargs: Additional arguments to pass to the constructor. + + Returns: + TenantServiceAsyncClient: The constructed client. + """ + return TenantServiceClient.from_service_account_file.__func__(TenantServiceAsyncClient, filename, *args, **kwargs) # type: ignore + from_service_account_json = from_service_account_file @property diff --git a/google/cloud/talent_v4beta1/__init__.py b/google/cloud/talent_v4beta1/__init__.py index 4743ac58..c7d0e217 100644 --- a/google/cloud/talent_v4beta1/__init__.py +++ b/google/cloud/talent_v4beta1/__init__.py @@ -157,7 +157,6 @@ "CommuteFilter", "CommuteMethod", "Company", - "CompanyServiceClient", "CompanySize", "CompensationFilter", "CompensationInfo", @@ -244,6 +243,7 @@ "SpellingCorrection", "SummarizedProfile", "Tenant", + "TenantServiceClient", "TimeFilter", "TimestampRange", "UpdateApplicationRequest", @@ -253,5 +253,5 @@ "UpdateTenantRequest", "Visibility", "WorkExperienceFilter", - "TenantServiceClient", + "CompanyServiceClient", ) diff --git a/google/cloud/talent_v4beta1/services/application_service/async_client.py b/google/cloud/talent_v4beta1/services/application_service/async_client.py index 0d274c27..c08bc95b 100644 --- a/google/cloud/talent_v4beta1/services/application_service/async_client.py +++ b/google/cloud/talent_v4beta1/services/application_service/async_client.py @@ -92,8 +92,36 @@ class ApplicationServiceAsyncClient: ApplicationServiceClient.parse_common_location_path ) - from_service_account_info = ApplicationServiceClient.from_service_account_info - from_service_account_file = ApplicationServiceClient.from_service_account_file + @classmethod + def from_service_account_info(cls, info: dict, *args, **kwargs): + """Creates an instance of this client using the provided credentials info. + + Args: + info (dict): The service account private key info. + args: Additional arguments to pass to the constructor. + kwargs: Additional arguments to pass to the constructor. + + Returns: + ApplicationServiceAsyncClient: The constructed client. + """ + return ApplicationServiceClient.from_service_account_info.__func__(ApplicationServiceAsyncClient, info, *args, **kwargs) # type: ignore + + @classmethod + def from_service_account_file(cls, filename: str, *args, **kwargs): + """Creates an instance of this client using the provided credentials + file. + + Args: + filename (str): The path to the service account private key json + file. + args: Additional arguments to pass to the constructor. + kwargs: Additional arguments to pass to the constructor. + + Returns: + ApplicationServiceAsyncClient: The constructed client. + """ + return ApplicationServiceClient.from_service_account_file.__func__(ApplicationServiceAsyncClient, filename, *args, **kwargs) # type: ignore + from_service_account_json = from_service_account_file @property diff --git a/google/cloud/talent_v4beta1/services/company_service/async_client.py b/google/cloud/talent_v4beta1/services/company_service/async_client.py index e8e29ed0..9490431f 100644 --- a/google/cloud/talent_v4beta1/services/company_service/async_client.py +++ b/google/cloud/talent_v4beta1/services/company_service/async_client.py @@ -81,8 +81,36 @@ class CompanyServiceAsyncClient: CompanyServiceClient.parse_common_location_path ) - from_service_account_info = CompanyServiceClient.from_service_account_info - from_service_account_file = CompanyServiceClient.from_service_account_file + @classmethod + def from_service_account_info(cls, info: dict, *args, **kwargs): + """Creates an instance of this client using the provided credentials info. + + Args: + info (dict): The service account private key info. + args: Additional arguments to pass to the constructor. + kwargs: Additional arguments to pass to the constructor. + + Returns: + CompanyServiceAsyncClient: The constructed client. + """ + return CompanyServiceClient.from_service_account_info.__func__(CompanyServiceAsyncClient, info, *args, **kwargs) # type: ignore + + @classmethod + def from_service_account_file(cls, filename: str, *args, **kwargs): + """Creates an instance of this client using the provided credentials + file. + + Args: + filename (str): The path to the service account private key json + file. + args: Additional arguments to pass to the constructor. + kwargs: Additional arguments to pass to the constructor. + + Returns: + CompanyServiceAsyncClient: The constructed client. + """ + return CompanyServiceClient.from_service_account_file.__func__(CompanyServiceAsyncClient, filename, *args, **kwargs) # type: ignore + from_service_account_json = from_service_account_file @property diff --git a/google/cloud/talent_v4beta1/services/completion/async_client.py b/google/cloud/talent_v4beta1/services/completion/async_client.py index 7472c5f0..bad09034 100644 --- a/google/cloud/talent_v4beta1/services/completion/async_client.py +++ b/google/cloud/talent_v4beta1/services/completion/async_client.py @@ -70,8 +70,36 @@ class CompletionAsyncClient: CompletionClient.parse_common_location_path ) - from_service_account_info = CompletionClient.from_service_account_info - from_service_account_file = CompletionClient.from_service_account_file + @classmethod + def from_service_account_info(cls, info: dict, *args, **kwargs): + """Creates an instance of this client using the provided credentials info. + + Args: + info (dict): The service account private key info. + args: Additional arguments to pass to the constructor. + kwargs: Additional arguments to pass to the constructor. + + Returns: + CompletionAsyncClient: The constructed client. + """ + return CompletionClient.from_service_account_info.__func__(CompletionAsyncClient, info, *args, **kwargs) # type: ignore + + @classmethod + def from_service_account_file(cls, filename: str, *args, **kwargs): + """Creates an instance of this client using the provided credentials + file. + + Args: + filename (str): The path to the service account private key json + file. + args: Additional arguments to pass to the constructor. + kwargs: Additional arguments to pass to the constructor. + + Returns: + CompletionAsyncClient: The constructed client. + """ + return CompletionClient.from_service_account_file.__func__(CompletionAsyncClient, filename, *args, **kwargs) # type: ignore + from_service_account_json = from_service_account_file @property diff --git a/google/cloud/talent_v4beta1/services/event_service/async_client.py b/google/cloud/talent_v4beta1/services/event_service/async_client.py index c90c5964..4bddf1e1 100644 --- a/google/cloud/talent_v4beta1/services/event_service/async_client.py +++ b/google/cloud/talent_v4beta1/services/event_service/async_client.py @@ -73,8 +73,36 @@ class EventServiceAsyncClient: EventServiceClient.parse_common_location_path ) - from_service_account_info = EventServiceClient.from_service_account_info - from_service_account_file = EventServiceClient.from_service_account_file + @classmethod + def from_service_account_info(cls, info: dict, *args, **kwargs): + """Creates an instance of this client using the provided credentials info. + + Args: + info (dict): The service account private key info. + args: Additional arguments to pass to the constructor. + kwargs: Additional arguments to pass to the constructor. + + Returns: + EventServiceAsyncClient: The constructed client. + """ + return EventServiceClient.from_service_account_info.__func__(EventServiceAsyncClient, info, *args, **kwargs) # type: ignore + + @classmethod + def from_service_account_file(cls, filename: str, *args, **kwargs): + """Creates an instance of this client using the provided credentials + file. + + Args: + filename (str): The path to the service account private key json + file. + args: Additional arguments to pass to the constructor. + kwargs: Additional arguments to pass to the constructor. + + Returns: + EventServiceAsyncClient: The constructed client. + """ + return EventServiceClient.from_service_account_file.__func__(EventServiceAsyncClient, filename, *args, **kwargs) # type: ignore + from_service_account_json = from_service_account_file @property diff --git a/google/cloud/talent_v4beta1/services/job_service/async_client.py b/google/cloud/talent_v4beta1/services/job_service/async_client.py index 0c9d7d91..e36f73dd 100644 --- a/google/cloud/talent_v4beta1/services/job_service/async_client.py +++ b/google/cloud/talent_v4beta1/services/job_service/async_client.py @@ -80,8 +80,36 @@ class JobServiceAsyncClient: JobServiceClient.parse_common_location_path ) - from_service_account_info = JobServiceClient.from_service_account_info - from_service_account_file = JobServiceClient.from_service_account_file + @classmethod + def from_service_account_info(cls, info: dict, *args, **kwargs): + """Creates an instance of this client using the provided credentials info. + + Args: + info (dict): The service account private key info. + args: Additional arguments to pass to the constructor. + kwargs: Additional arguments to pass to the constructor. + + Returns: + JobServiceAsyncClient: The constructed client. + """ + return JobServiceClient.from_service_account_info.__func__(JobServiceAsyncClient, info, *args, **kwargs) # type: ignore + + @classmethod + def from_service_account_file(cls, filename: str, *args, **kwargs): + """Creates an instance of this client using the provided credentials + file. + + Args: + filename (str): The path to the service account private key json + file. + args: Additional arguments to pass to the constructor. + kwargs: Additional arguments to pass to the constructor. + + Returns: + JobServiceAsyncClient: The constructed client. + """ + return JobServiceClient.from_service_account_file.__func__(JobServiceAsyncClient, filename, *args, **kwargs) # type: ignore + from_service_account_json = from_service_account_file @property diff --git a/google/cloud/talent_v4beta1/services/profile_service/async_client.py b/google/cloud/talent_v4beta1/services/profile_service/async_client.py index 5ea23b8a..151dde21 100644 --- a/google/cloud/talent_v4beta1/services/profile_service/async_client.py +++ b/google/cloud/talent_v4beta1/services/profile_service/async_client.py @@ -86,8 +86,36 @@ class ProfileServiceAsyncClient: ProfileServiceClient.parse_common_location_path ) - from_service_account_info = ProfileServiceClient.from_service_account_info - from_service_account_file = ProfileServiceClient.from_service_account_file + @classmethod + def from_service_account_info(cls, info: dict, *args, **kwargs): + """Creates an instance of this client using the provided credentials info. + + Args: + info (dict): The service account private key info. + args: Additional arguments to pass to the constructor. + kwargs: Additional arguments to pass to the constructor. + + Returns: + ProfileServiceAsyncClient: The constructed client. + """ + return ProfileServiceClient.from_service_account_info.__func__(ProfileServiceAsyncClient, info, *args, **kwargs) # type: ignore + + @classmethod + def from_service_account_file(cls, filename: str, *args, **kwargs): + """Creates an instance of this client using the provided credentials + file. + + Args: + filename (str): The path to the service account private key json + file. + args: Additional arguments to pass to the constructor. + kwargs: Additional arguments to pass to the constructor. + + Returns: + ProfileServiceAsyncClient: The constructed client. + """ + return ProfileServiceClient.from_service_account_file.__func__(ProfileServiceAsyncClient, filename, *args, **kwargs) # type: ignore + from_service_account_json = from_service_account_file @property diff --git a/google/cloud/talent_v4beta1/services/tenant_service/async_client.py b/google/cloud/talent_v4beta1/services/tenant_service/async_client.py index 450811a6..6920c35b 100644 --- a/google/cloud/talent_v4beta1/services/tenant_service/async_client.py +++ b/google/cloud/talent_v4beta1/services/tenant_service/async_client.py @@ -80,8 +80,36 @@ class TenantServiceAsyncClient: TenantServiceClient.parse_common_location_path ) - from_service_account_info = TenantServiceClient.from_service_account_info - from_service_account_file = TenantServiceClient.from_service_account_file + @classmethod + def from_service_account_info(cls, info: dict, *args, **kwargs): + """Creates an instance of this client using the provided credentials info. + + Args: + info (dict): The service account private key info. + args: Additional arguments to pass to the constructor. + kwargs: Additional arguments to pass to the constructor. + + Returns: + TenantServiceAsyncClient: The constructed client. + """ + return TenantServiceClient.from_service_account_info.__func__(TenantServiceAsyncClient, info, *args, **kwargs) # type: ignore + + @classmethod + def from_service_account_file(cls, filename: str, *args, **kwargs): + """Creates an instance of this client using the provided credentials + file. + + Args: + filename (str): The path to the service account private key json + file. + args: Additional arguments to pass to the constructor. + kwargs: Additional arguments to pass to the constructor. + + Returns: + TenantServiceAsyncClient: The constructed client. + """ + return TenantServiceClient.from_service_account_file.__func__(TenantServiceAsyncClient, filename, *args, **kwargs) # type: ignore + from_service_account_json = from_service_account_file @property diff --git a/synth.metadata b/synth.metadata index ed0959f8..98db1733 100644 --- a/synth.metadata +++ b/synth.metadata @@ -11,8 +11,8 @@ "git": { "name": "googleapis", "remote": "https://github.com/googleapis/googleapis.git", - "sha": "c06bbe28cc7287a55bf7926ee48da2565854de7f", - "internalRef": "359364666" + "sha": "07932bb995e7dc91b43620ea8402c6668c7d102c", + "internalRef": "359562873" } }, { @@ -297,6 +297,7 @@ "scripts/readme-gen/templates/install_deps.tmpl.rst", "scripts/readme-gen/templates/install_portaudio.tmpl.rst", "setup.cfg", + "talent-v4beta1-py.tar.gz", "testing/.gitignore", "tests/unit/gapic/talent_v4/__init__.py", "tests/unit/gapic/talent_v4/test_company_service.py", diff --git a/talent-v4beta1-py.tar.gz b/talent-v4beta1-py.tar.gz new file mode 100644 index 00000000..e69de29b diff --git a/tests/unit/gapic/talent_v4/__init__.py b/tests/unit/gapic/talent_v4/__init__.py index 8b137891..42ffdf2b 100644 --- a/tests/unit/gapic/talent_v4/__init__.py +++ b/tests/unit/gapic/talent_v4/__init__.py @@ -1 +1,16 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# diff --git a/tests/unit/gapic/talent_v4/test_company_service.py b/tests/unit/gapic/talent_v4/test_company_service.py index 22a6ae9f..eaa1a863 100644 --- a/tests/unit/gapic/talent_v4/test_company_service.py +++ b/tests/unit/gapic/talent_v4/test_company_service.py @@ -90,15 +90,19 @@ def test__get_default_mtls_endpoint(): ) -def test_company_service_client_from_service_account_info(): +@pytest.mark.parametrize( + "client_class", [CompanyServiceClient, CompanyServiceAsyncClient,] +) +def test_company_service_client_from_service_account_info(client_class): creds = credentials.AnonymousCredentials() with mock.patch.object( service_account.Credentials, "from_service_account_info" ) as factory: factory.return_value = creds info = {"valid": True} - client = CompanyServiceClient.from_service_account_info(info) + client = client_class.from_service_account_info(info) assert client.transport._credentials == creds + assert isinstance(client, client_class) assert client.transport._host == "jobs.googleapis.com:443" @@ -114,9 +118,11 @@ def test_company_service_client_from_service_account_file(client_class): factory.return_value = creds client = client_class.from_service_account_file("dummy/file/path.json") assert client.transport._credentials == creds + assert isinstance(client, client_class) client = client_class.from_service_account_json("dummy/file/path.json") assert client.transport._credentials == creds + assert isinstance(client, client_class) assert client.transport._host == "jobs.googleapis.com:443" @@ -516,6 +522,22 @@ def test_create_company_from_dict(): test_create_company(request_type=dict) +def test_create_company_empty_call(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = CompanyServiceClient( + credentials=credentials.AnonymousCredentials(), transport="grpc", + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.create_company), "__call__") as call: + client.create_company() + call.assert_called() + _, args, _ = call.mock_calls[0] + + assert args[0] == company_service.CreateCompanyRequest() + + @pytest.mark.asyncio async def test_create_company_async( transport: str = "grpc_asyncio", request_type=company_service.CreateCompanyRequest @@ -793,6 +815,22 @@ def test_get_company_from_dict(): test_get_company(request_type=dict) +def test_get_company_empty_call(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = CompanyServiceClient( + credentials=credentials.AnonymousCredentials(), transport="grpc", + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.get_company), "__call__") as call: + client.get_company() + call.assert_called() + _, args, _ = call.mock_calls[0] + + assert args[0] == company_service.GetCompanyRequest() + + @pytest.mark.asyncio async def test_get_company_async( transport: str = "grpc_asyncio", request_type=company_service.GetCompanyRequest @@ -1058,6 +1096,22 @@ def test_update_company_from_dict(): test_update_company(request_type=dict) +def test_update_company_empty_call(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = CompanyServiceClient( + credentials=credentials.AnonymousCredentials(), transport="grpc", + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.update_company), "__call__") as call: + client.update_company() + call.assert_called() + _, args, _ = call.mock_calls[0] + + assert args[0] == company_service.UpdateCompanyRequest() + + @pytest.mark.asyncio async def test_update_company_async( transport: str = "grpc_asyncio", request_type=company_service.UpdateCompanyRequest @@ -1299,6 +1353,22 @@ def test_delete_company_from_dict(): test_delete_company(request_type=dict) +def test_delete_company_empty_call(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = CompanyServiceClient( + credentials=credentials.AnonymousCredentials(), transport="grpc", + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.delete_company), "__call__") as call: + client.delete_company() + call.assert_called() + _, args, _ = call.mock_calls[0] + + assert args[0] == company_service.DeleteCompanyRequest() + + @pytest.mark.asyncio async def test_delete_company_async( transport: str = "grpc_asyncio", request_type=company_service.DeleteCompanyRequest @@ -1484,6 +1554,22 @@ def test_list_companies_from_dict(): test_list_companies(request_type=dict) +def test_list_companies_empty_call(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = CompanyServiceClient( + credentials=credentials.AnonymousCredentials(), transport="grpc", + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.list_companies), "__call__") as call: + client.list_companies() + call.assert_called() + _, args, _ = call.mock_calls[0] + + assert args[0] == company_service.ListCompaniesRequest() + + @pytest.mark.asyncio async def test_list_companies_async( transport: str = "grpc_asyncio", request_type=company_service.ListCompaniesRequest diff --git a/tests/unit/gapic/talent_v4/test_completion.py b/tests/unit/gapic/talent_v4/test_completion.py index e9af38f3..e4ed8c02 100644 --- a/tests/unit/gapic/talent_v4/test_completion.py +++ b/tests/unit/gapic/talent_v4/test_completion.py @@ -81,15 +81,17 @@ def test__get_default_mtls_endpoint(): assert CompletionClient._get_default_mtls_endpoint(non_googleapi) == non_googleapi -def test_completion_client_from_service_account_info(): +@pytest.mark.parametrize("client_class", [CompletionClient, CompletionAsyncClient,]) +def test_completion_client_from_service_account_info(client_class): creds = credentials.AnonymousCredentials() with mock.patch.object( service_account.Credentials, "from_service_account_info" ) as factory: factory.return_value = creds info = {"valid": True} - client = CompletionClient.from_service_account_info(info) + client = client_class.from_service_account_info(info) assert client.transport._credentials == creds + assert isinstance(client, client_class) assert client.transport._host == "jobs.googleapis.com:443" @@ -103,9 +105,11 @@ def test_completion_client_from_service_account_file(client_class): factory.return_value = creds client = client_class.from_service_account_file("dummy/file/path.json") assert client.transport._credentials == creds + assert isinstance(client, client_class) client = client_class.from_service_account_json("dummy/file/path.json") assert client.transport._credentials == creds + assert isinstance(client, client_class) assert client.transport._host == "jobs.googleapis.com:443" @@ -458,6 +462,22 @@ def test_complete_query_from_dict(): test_complete_query(request_type=dict) +def test_complete_query_empty_call(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = CompletionClient( + credentials=credentials.AnonymousCredentials(), transport="grpc", + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.complete_query), "__call__") as call: + client.complete_query() + call.assert_called() + _, args, _ = call.mock_calls[0] + + assert args[0] == completion_service.CompleteQueryRequest() + + @pytest.mark.asyncio async def test_complete_query_async( transport: str = "grpc_asyncio", diff --git a/tests/unit/gapic/talent_v4/test_event_service.py b/tests/unit/gapic/talent_v4/test_event_service.py index c2e721c6..e28dd92b 100644 --- a/tests/unit/gapic/talent_v4/test_event_service.py +++ b/tests/unit/gapic/talent_v4/test_event_service.py @@ -82,15 +82,17 @@ def test__get_default_mtls_endpoint(): assert EventServiceClient._get_default_mtls_endpoint(non_googleapi) == non_googleapi -def test_event_service_client_from_service_account_info(): +@pytest.mark.parametrize("client_class", [EventServiceClient, EventServiceAsyncClient,]) +def test_event_service_client_from_service_account_info(client_class): creds = credentials.AnonymousCredentials() with mock.patch.object( service_account.Credentials, "from_service_account_info" ) as factory: factory.return_value = creds info = {"valid": True} - client = EventServiceClient.from_service_account_info(info) + client = client_class.from_service_account_info(info) assert client.transport._credentials == creds + assert isinstance(client, client_class) assert client.transport._host == "jobs.googleapis.com:443" @@ -104,9 +106,11 @@ def test_event_service_client_from_service_account_file(client_class): factory.return_value = creds client = client_class.from_service_account_file("dummy/file/path.json") assert client.transport._credentials == creds + assert isinstance(client, client_class) client = client_class.from_service_account_json("dummy/file/path.json") assert client.transport._credentials == creds + assert isinstance(client, client_class) assert client.transport._host == "jobs.googleapis.com:443" @@ -472,6 +476,24 @@ def test_create_client_event_from_dict(): test_create_client_event(request_type=dict) +def test_create_client_event_empty_call(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = EventServiceClient( + credentials=credentials.AnonymousCredentials(), transport="grpc", + ) + + # 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: + client.create_client_event() + call.assert_called() + _, args, _ = call.mock_calls[0] + + assert args[0] == event_service.CreateClientEventRequest() + + @pytest.mark.asyncio async def test_create_client_event_async( transport: str = "grpc_asyncio", request_type=event_service.CreateClientEventRequest diff --git a/tests/unit/gapic/talent_v4/test_job_service.py b/tests/unit/gapic/talent_v4/test_job_service.py index c50b68c6..d0254e33 100644 --- a/tests/unit/gapic/talent_v4/test_job_service.py +++ b/tests/unit/gapic/talent_v4/test_job_service.py @@ -98,15 +98,17 @@ def test__get_default_mtls_endpoint(): assert JobServiceClient._get_default_mtls_endpoint(non_googleapi) == non_googleapi -def test_job_service_client_from_service_account_info(): +@pytest.mark.parametrize("client_class", [JobServiceClient, JobServiceAsyncClient,]) +def test_job_service_client_from_service_account_info(client_class): creds = credentials.AnonymousCredentials() with mock.patch.object( service_account.Credentials, "from_service_account_info" ) as factory: factory.return_value = creds info = {"valid": True} - client = JobServiceClient.from_service_account_info(info) + client = client_class.from_service_account_info(info) assert client.transport._credentials == creds + assert isinstance(client, client_class) assert client.transport._host == "jobs.googleapis.com:443" @@ -120,9 +122,11 @@ def test_job_service_client_from_service_account_file(client_class): factory.return_value = creds client = client_class.from_service_account_file("dummy/file/path.json") assert client.transport._credentials == creds + assert isinstance(client, client_class) client = client_class.from_service_account_json("dummy/file/path.json") assert client.transport._credentials == creds + assert isinstance(client, client_class) assert client.transport._host == "jobs.googleapis.com:443" @@ -531,6 +535,22 @@ def test_create_job_from_dict(): test_create_job(request_type=dict) +def test_create_job_empty_call(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = JobServiceClient( + credentials=credentials.AnonymousCredentials(), transport="grpc", + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.create_job), "__call__") as call: + client.create_job() + call.assert_called() + _, args, _ = call.mock_calls[0] + + assert args[0] == job_service.CreateJobRequest() + + @pytest.mark.asyncio async def test_create_job_async( transport: str = "grpc_asyncio", request_type=job_service.CreateJobRequest @@ -785,6 +805,24 @@ def test_batch_create_jobs_from_dict(): test_batch_create_jobs(request_type=dict) +def test_batch_create_jobs_empty_call(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = JobServiceClient( + credentials=credentials.AnonymousCredentials(), transport="grpc", + ) + + # 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: + client.batch_create_jobs() + call.assert_called() + _, args, _ = call.mock_calls[0] + + assert args[0] == job_service.BatchCreateJobsRequest() + + @pytest.mark.asyncio async def test_batch_create_jobs_async( transport: str = "grpc_asyncio", request_type=job_service.BatchCreateJobsRequest @@ -1050,6 +1088,22 @@ def test_get_job_from_dict(): test_get_job(request_type=dict) +def test_get_job_empty_call(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = JobServiceClient( + credentials=credentials.AnonymousCredentials(), transport="grpc", + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.get_job), "__call__") as call: + client.get_job() + call.assert_called() + _, args, _ = call.mock_calls[0] + + assert args[0] == job_service.GetJobRequest() + + @pytest.mark.asyncio async def test_get_job_async( transport: str = "grpc_asyncio", request_type=job_service.GetJobRequest @@ -1347,6 +1401,22 @@ def test_update_job_from_dict(): test_update_job(request_type=dict) +def test_update_job_empty_call(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = JobServiceClient( + credentials=credentials.AnonymousCredentials(), transport="grpc", + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.update_job), "__call__") as call: + client.update_job() + call.assert_called() + _, args, _ = call.mock_calls[0] + + assert args[0] == job_service.UpdateJobRequest() + + @pytest.mark.asyncio async def test_update_job_async( transport: str = "grpc_asyncio", request_type=job_service.UpdateJobRequest @@ -1603,6 +1673,24 @@ def test_batch_update_jobs_from_dict(): test_batch_update_jobs(request_type=dict) +def test_batch_update_jobs_empty_call(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = JobServiceClient( + credentials=credentials.AnonymousCredentials(), transport="grpc", + ) + + # 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: + client.batch_update_jobs() + call.assert_called() + _, args, _ = call.mock_calls[0] + + assert args[0] == job_service.BatchUpdateJobsRequest() + + @pytest.mark.asyncio async def test_batch_update_jobs_async( transport: str = "grpc_asyncio", request_type=job_service.BatchUpdateJobsRequest @@ -1809,6 +1897,22 @@ def test_delete_job_from_dict(): test_delete_job(request_type=dict) +def test_delete_job_empty_call(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = JobServiceClient( + credentials=credentials.AnonymousCredentials(), transport="grpc", + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.delete_job), "__call__") as call: + client.delete_job() + call.assert_called() + _, args, _ = call.mock_calls[0] + + assert args[0] == job_service.DeleteJobRequest() + + @pytest.mark.asyncio async def test_delete_job_async( transport: str = "grpc_asyncio", request_type=job_service.DeleteJobRequest @@ -1991,6 +2095,24 @@ def test_batch_delete_jobs_from_dict(): test_batch_delete_jobs(request_type=dict) +def test_batch_delete_jobs_empty_call(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = JobServiceClient( + credentials=credentials.AnonymousCredentials(), transport="grpc", + ) + + # 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: + client.batch_delete_jobs() + call.assert_called() + _, args, _ = call.mock_calls[0] + + assert args[0] == job_service.BatchDeleteJobsRequest() + + @pytest.mark.asyncio async def test_batch_delete_jobs_async( transport: str = "grpc_asyncio", request_type=job_service.BatchDeleteJobsRequest @@ -2202,6 +2324,22 @@ def test_list_jobs_from_dict(): test_list_jobs(request_type=dict) +def test_list_jobs_empty_call(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = JobServiceClient( + credentials=credentials.AnonymousCredentials(), transport="grpc", + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.list_jobs), "__call__") as call: + client.list_jobs() + call.assert_called() + _, args, _ = call.mock_calls[0] + + assert args[0] == job_service.ListJobsRequest() + + @pytest.mark.asyncio async def test_list_jobs_async( transport: str = "grpc_asyncio", request_type=job_service.ListJobsRequest @@ -2511,6 +2649,22 @@ def test_search_jobs_from_dict(): test_search_jobs(request_type=dict) +def test_search_jobs_empty_call(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = JobServiceClient( + credentials=credentials.AnonymousCredentials(), transport="grpc", + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.search_jobs), "__call__") as call: + client.search_jobs() + call.assert_called() + _, args, _ = call.mock_calls[0] + + assert args[0] == job_service.SearchJobsRequest() + + @pytest.mark.asyncio async def test_search_jobs_async( transport: str = "grpc_asyncio", request_type=job_service.SearchJobsRequest @@ -2655,6 +2809,24 @@ def test_search_jobs_for_alert_from_dict(): test_search_jobs_for_alert(request_type=dict) +def test_search_jobs_for_alert_empty_call(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = JobServiceClient( + credentials=credentials.AnonymousCredentials(), transport="grpc", + ) + + # 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: + client.search_jobs_for_alert() + call.assert_called() + _, args, _ = call.mock_calls[0] + + assert args[0] == job_service.SearchJobsRequest() + + @pytest.mark.asyncio async def test_search_jobs_for_alert_async( transport: str = "grpc_asyncio", request_type=job_service.SearchJobsRequest diff --git a/tests/unit/gapic/talent_v4/test_tenant_service.py b/tests/unit/gapic/talent_v4/test_tenant_service.py index d95fe4aa..64e5cbbb 100644 --- a/tests/unit/gapic/talent_v4/test_tenant_service.py +++ b/tests/unit/gapic/talent_v4/test_tenant_service.py @@ -87,15 +87,19 @@ def test__get_default_mtls_endpoint(): ) -def test_tenant_service_client_from_service_account_info(): +@pytest.mark.parametrize( + "client_class", [TenantServiceClient, TenantServiceAsyncClient,] +) +def test_tenant_service_client_from_service_account_info(client_class): creds = credentials.AnonymousCredentials() with mock.patch.object( service_account.Credentials, "from_service_account_info" ) as factory: factory.return_value = creds info = {"valid": True} - client = TenantServiceClient.from_service_account_info(info) + client = client_class.from_service_account_info(info) assert client.transport._credentials == creds + assert isinstance(client, client_class) assert client.transport._host == "jobs.googleapis.com:443" @@ -111,9 +115,11 @@ def test_tenant_service_client_from_service_account_file(client_class): factory.return_value = creds client = client_class.from_service_account_file("dummy/file/path.json") assert client.transport._credentials == creds + assert isinstance(client, client_class) client = client_class.from_service_account_json("dummy/file/path.json") assert client.transport._credentials == creds + assert isinstance(client, client_class) assert client.transport._host == "jobs.googleapis.com:443" @@ -478,6 +484,22 @@ def test_create_tenant_from_dict(): test_create_tenant(request_type=dict) +def test_create_tenant_empty_call(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = TenantServiceClient( + credentials=credentials.AnonymousCredentials(), transport="grpc", + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.create_tenant), "__call__") as call: + client.create_tenant() + call.assert_called() + _, args, _ = call.mock_calls[0] + + assert args[0] == tenant_service.CreateTenantRequest() + + @pytest.mark.asyncio async def test_create_tenant_async( transport: str = "grpc_asyncio", request_type=tenant_service.CreateTenantRequest @@ -683,6 +705,22 @@ def test_get_tenant_from_dict(): test_get_tenant(request_type=dict) +def test_get_tenant_empty_call(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = TenantServiceClient( + credentials=credentials.AnonymousCredentials(), transport="grpc", + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.get_tenant), "__call__") as call: + client.get_tenant() + call.assert_called() + _, args, _ = call.mock_calls[0] + + assert args[0] == tenant_service.GetTenantRequest() + + @pytest.mark.asyncio async def test_get_tenant_async( transport: str = "grpc_asyncio", request_type=tenant_service.GetTenantRequest @@ -876,6 +914,22 @@ def test_update_tenant_from_dict(): test_update_tenant(request_type=dict) +def test_update_tenant_empty_call(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = TenantServiceClient( + credentials=credentials.AnonymousCredentials(), transport="grpc", + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.update_tenant), "__call__") as call: + client.update_tenant() + call.assert_called() + _, args, _ = call.mock_calls[0] + + assert args[0] == tenant_service.UpdateTenantRequest() + + @pytest.mark.asyncio async def test_update_tenant_async( transport: str = "grpc_asyncio", request_type=tenant_service.UpdateTenantRequest @@ -1076,6 +1130,22 @@ def test_delete_tenant_from_dict(): test_delete_tenant(request_type=dict) +def test_delete_tenant_empty_call(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = TenantServiceClient( + credentials=credentials.AnonymousCredentials(), transport="grpc", + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.delete_tenant), "__call__") as call: + client.delete_tenant() + call.assert_called() + _, args, _ = call.mock_calls[0] + + assert args[0] == tenant_service.DeleteTenantRequest() + + @pytest.mark.asyncio async def test_delete_tenant_async( transport: str = "grpc_asyncio", request_type=tenant_service.DeleteTenantRequest @@ -1261,6 +1331,22 @@ def test_list_tenants_from_dict(): test_list_tenants(request_type=dict) +def test_list_tenants_empty_call(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = TenantServiceClient( + credentials=credentials.AnonymousCredentials(), transport="grpc", + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.list_tenants), "__call__") as call: + client.list_tenants() + call.assert_called() + _, args, _ = call.mock_calls[0] + + assert args[0] == tenant_service.ListTenantsRequest() + + @pytest.mark.asyncio async def test_list_tenants_async( transport: str = "grpc_asyncio", request_type=tenant_service.ListTenantsRequest diff --git a/tests/unit/gapic/talent_v4beta1/__init__.py b/tests/unit/gapic/talent_v4beta1/__init__.py index 8b137891..42ffdf2b 100644 --- a/tests/unit/gapic/talent_v4beta1/__init__.py +++ b/tests/unit/gapic/talent_v4beta1/__init__.py @@ -1 +1,16 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# diff --git a/tests/unit/gapic/talent_v4beta1/test_application_service.py b/tests/unit/gapic/talent_v4beta1/test_application_service.py index e0818c5f..68c75313 100644 --- a/tests/unit/gapic/talent_v4beta1/test_application_service.py +++ b/tests/unit/gapic/talent_v4beta1/test_application_service.py @@ -96,15 +96,19 @@ def test__get_default_mtls_endpoint(): ) -def test_application_service_client_from_service_account_info(): +@pytest.mark.parametrize( + "client_class", [ApplicationServiceClient, ApplicationServiceAsyncClient,] +) +def test_application_service_client_from_service_account_info(client_class): creds = credentials.AnonymousCredentials() with mock.patch.object( service_account.Credentials, "from_service_account_info" ) as factory: factory.return_value = creds info = {"valid": True} - client = ApplicationServiceClient.from_service_account_info(info) + client = client_class.from_service_account_info(info) assert client.transport._credentials == creds + assert isinstance(client, client_class) assert client.transport._host == "jobs.googleapis.com:443" @@ -120,9 +124,11 @@ def test_application_service_client_from_service_account_file(client_class): factory.return_value = creds client = client_class.from_service_account_file("dummy/file/path.json") assert client.transport._credentials == creds + assert isinstance(client, client_class) client = client_class.from_service_account_json("dummy/file/path.json") assert client.transport._credentials == creds + assert isinstance(client, client_class) assert client.transport._host == "jobs.googleapis.com:443" @@ -524,6 +530,24 @@ def test_create_application_from_dict(): test_create_application(request_type=dict) +def test_create_application_empty_call(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = ApplicationServiceClient( + credentials=credentials.AnonymousCredentials(), transport="grpc", + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.create_application), "__call__" + ) as call: + client.create_application() + call.assert_called() + _, args, _ = call.mock_calls[0] + + assert args[0] == application_service.CreateApplicationRequest() + + @pytest.mark.asyncio async def test_create_application_async( transport: str = "grpc_asyncio", @@ -804,6 +828,22 @@ def test_get_application_from_dict(): test_get_application(request_type=dict) +def test_get_application_empty_call(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = ApplicationServiceClient( + credentials=credentials.AnonymousCredentials(), transport="grpc", + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.get_application), "__call__") as call: + client.get_application() + call.assert_called() + _, args, _ = call.mock_calls[0] + + assert args[0] == application_service.GetApplicationRequest() + + @pytest.mark.asyncio async def test_get_application_async( transport: str = "grpc_asyncio", @@ -1062,6 +1102,24 @@ def test_update_application_from_dict(): test_update_application(request_type=dict) +def test_update_application_empty_call(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = ApplicationServiceClient( + credentials=credentials.AnonymousCredentials(), transport="grpc", + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.update_application), "__call__" + ) as call: + client.update_application() + call.assert_called() + _, args, _ = call.mock_calls[0] + + assert args[0] == application_service.UpdateApplicationRequest() + + @pytest.mark.asyncio async def test_update_application_async( transport: str = "grpc_asyncio", @@ -1308,6 +1366,24 @@ def test_delete_application_from_dict(): test_delete_application(request_type=dict) +def test_delete_application_empty_call(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = ApplicationServiceClient( + credentials=credentials.AnonymousCredentials(), transport="grpc", + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.delete_application), "__call__" + ) as call: + client.delete_application() + call.assert_called() + _, args, _ = call.mock_calls[0] + + assert args[0] == application_service.DeleteApplicationRequest() + + @pytest.mark.asyncio async def test_delete_application_async( transport: str = "grpc_asyncio", @@ -1512,6 +1588,24 @@ def test_list_applications_from_dict(): test_list_applications(request_type=dict) +def test_list_applications_empty_call(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = ApplicationServiceClient( + credentials=credentials.AnonymousCredentials(), transport="grpc", + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_applications), "__call__" + ) as call: + client.list_applications() + call.assert_called() + _, args, _ = call.mock_calls[0] + + assert args[0] == application_service.ListApplicationsRequest() + + @pytest.mark.asyncio async def test_list_applications_async( transport: str = "grpc_asyncio", diff --git a/tests/unit/gapic/talent_v4beta1/test_company_service.py b/tests/unit/gapic/talent_v4beta1/test_company_service.py index ff350367..973e425a 100644 --- a/tests/unit/gapic/talent_v4beta1/test_company_service.py +++ b/tests/unit/gapic/talent_v4beta1/test_company_service.py @@ -92,15 +92,19 @@ def test__get_default_mtls_endpoint(): ) -def test_company_service_client_from_service_account_info(): +@pytest.mark.parametrize( + "client_class", [CompanyServiceClient, CompanyServiceAsyncClient,] +) +def test_company_service_client_from_service_account_info(client_class): creds = credentials.AnonymousCredentials() with mock.patch.object( service_account.Credentials, "from_service_account_info" ) as factory: factory.return_value = creds info = {"valid": True} - client = CompanyServiceClient.from_service_account_info(info) + client = client_class.from_service_account_info(info) assert client.transport._credentials == creds + assert isinstance(client, client_class) assert client.transport._host == "jobs.googleapis.com:443" @@ -116,9 +120,11 @@ def test_company_service_client_from_service_account_file(client_class): factory.return_value = creds client = client_class.from_service_account_file("dummy/file/path.json") assert client.transport._credentials == creds + assert isinstance(client, client_class) client = client_class.from_service_account_json("dummy/file/path.json") assert client.transport._credentials == creds + assert isinstance(client, client_class) assert client.transport._host == "jobs.googleapis.com:443" @@ -518,6 +524,22 @@ def test_create_company_from_dict(): test_create_company(request_type=dict) +def test_create_company_empty_call(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = CompanyServiceClient( + credentials=credentials.AnonymousCredentials(), transport="grpc", + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.create_company), "__call__") as call: + client.create_company() + call.assert_called() + _, args, _ = call.mock_calls[0] + + assert args[0] == company_service.CreateCompanyRequest() + + @pytest.mark.asyncio async def test_create_company_async( transport: str = "grpc_asyncio", request_type=company_service.CreateCompanyRequest @@ -795,6 +817,22 @@ def test_get_company_from_dict(): test_get_company(request_type=dict) +def test_get_company_empty_call(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = CompanyServiceClient( + credentials=credentials.AnonymousCredentials(), transport="grpc", + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.get_company), "__call__") as call: + client.get_company() + call.assert_called() + _, args, _ = call.mock_calls[0] + + assert args[0] == company_service.GetCompanyRequest() + + @pytest.mark.asyncio async def test_get_company_async( transport: str = "grpc_asyncio", request_type=company_service.GetCompanyRequest @@ -1060,6 +1098,22 @@ def test_update_company_from_dict(): test_update_company(request_type=dict) +def test_update_company_empty_call(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = CompanyServiceClient( + credentials=credentials.AnonymousCredentials(), transport="grpc", + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.update_company), "__call__") as call: + client.update_company() + call.assert_called() + _, args, _ = call.mock_calls[0] + + assert args[0] == company_service.UpdateCompanyRequest() + + @pytest.mark.asyncio async def test_update_company_async( transport: str = "grpc_asyncio", request_type=company_service.UpdateCompanyRequest @@ -1291,6 +1345,22 @@ def test_delete_company_from_dict(): test_delete_company(request_type=dict) +def test_delete_company_empty_call(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = CompanyServiceClient( + credentials=credentials.AnonymousCredentials(), transport="grpc", + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.delete_company), "__call__") as call: + client.delete_company() + call.assert_called() + _, args, _ = call.mock_calls[0] + + assert args[0] == company_service.DeleteCompanyRequest() + + @pytest.mark.asyncio async def test_delete_company_async( transport: str = "grpc_asyncio", request_type=company_service.DeleteCompanyRequest @@ -1476,6 +1546,22 @@ def test_list_companies_from_dict(): test_list_companies(request_type=dict) +def test_list_companies_empty_call(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = CompanyServiceClient( + credentials=credentials.AnonymousCredentials(), transport="grpc", + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.list_companies), "__call__") as call: + client.list_companies() + call.assert_called() + _, args, _ = call.mock_calls[0] + + assert args[0] == company_service.ListCompaniesRequest() + + @pytest.mark.asyncio async def test_list_companies_async( transport: str = "grpc_asyncio", request_type=company_service.ListCompaniesRequest diff --git a/tests/unit/gapic/talent_v4beta1/test_completion.py b/tests/unit/gapic/talent_v4beta1/test_completion.py index 48259e17..48f3e828 100644 --- a/tests/unit/gapic/talent_v4beta1/test_completion.py +++ b/tests/unit/gapic/talent_v4beta1/test_completion.py @@ -81,15 +81,17 @@ def test__get_default_mtls_endpoint(): assert CompletionClient._get_default_mtls_endpoint(non_googleapi) == non_googleapi -def test_completion_client_from_service_account_info(): +@pytest.mark.parametrize("client_class", [CompletionClient, CompletionAsyncClient,]) +def test_completion_client_from_service_account_info(client_class): creds = credentials.AnonymousCredentials() with mock.patch.object( service_account.Credentials, "from_service_account_info" ) as factory: factory.return_value = creds info = {"valid": True} - client = CompletionClient.from_service_account_info(info) + client = client_class.from_service_account_info(info) assert client.transport._credentials == creds + assert isinstance(client, client_class) assert client.transport._host == "jobs.googleapis.com:443" @@ -103,9 +105,11 @@ def test_completion_client_from_service_account_file(client_class): factory.return_value = creds client = client_class.from_service_account_file("dummy/file/path.json") assert client.transport._credentials == creds + assert isinstance(client, client_class) client = client_class.from_service_account_json("dummy/file/path.json") assert client.transport._credentials == creds + assert isinstance(client, client_class) assert client.transport._host == "jobs.googleapis.com:443" @@ -458,6 +462,22 @@ def test_complete_query_from_dict(): test_complete_query(request_type=dict) +def test_complete_query_empty_call(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = CompletionClient( + credentials=credentials.AnonymousCredentials(), transport="grpc", + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.complete_query), "__call__") as call: + client.complete_query() + call.assert_called() + _, args, _ = call.mock_calls[0] + + assert args[0] == completion_service.CompleteQueryRequest() + + @pytest.mark.asyncio async def test_complete_query_async( transport: str = "grpc_asyncio", diff --git a/tests/unit/gapic/talent_v4beta1/test_event_service.py b/tests/unit/gapic/talent_v4beta1/test_event_service.py index 431e712f..16e25afe 100644 --- a/tests/unit/gapic/talent_v4beta1/test_event_service.py +++ b/tests/unit/gapic/talent_v4beta1/test_event_service.py @@ -82,15 +82,17 @@ def test__get_default_mtls_endpoint(): assert EventServiceClient._get_default_mtls_endpoint(non_googleapi) == non_googleapi -def test_event_service_client_from_service_account_info(): +@pytest.mark.parametrize("client_class", [EventServiceClient, EventServiceAsyncClient,]) +def test_event_service_client_from_service_account_info(client_class): creds = credentials.AnonymousCredentials() with mock.patch.object( service_account.Credentials, "from_service_account_info" ) as factory: factory.return_value = creds info = {"valid": True} - client = EventServiceClient.from_service_account_info(info) + client = client_class.from_service_account_info(info) assert client.transport._credentials == creds + assert isinstance(client, client_class) assert client.transport._host == "jobs.googleapis.com:443" @@ -104,9 +106,11 @@ def test_event_service_client_from_service_account_file(client_class): factory.return_value = creds client = client_class.from_service_account_file("dummy/file/path.json") assert client.transport._credentials == creds + assert isinstance(client, client_class) client = client_class.from_service_account_json("dummy/file/path.json") assert client.transport._credentials == creds + assert isinstance(client, client_class) assert client.transport._host == "jobs.googleapis.com:443" @@ -472,6 +476,24 @@ def test_create_client_event_from_dict(): test_create_client_event(request_type=dict) +def test_create_client_event_empty_call(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = EventServiceClient( + credentials=credentials.AnonymousCredentials(), transport="grpc", + ) + + # 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: + client.create_client_event() + call.assert_called() + _, args, _ = call.mock_calls[0] + + assert args[0] == event_service.CreateClientEventRequest() + + @pytest.mark.asyncio async def test_create_client_event_async( transport: str = "grpc_asyncio", request_type=event_service.CreateClientEventRequest diff --git a/tests/unit/gapic/talent_v4beta1/test_job_service.py b/tests/unit/gapic/talent_v4beta1/test_job_service.py index dd978eb7..db29e42b 100644 --- a/tests/unit/gapic/talent_v4beta1/test_job_service.py +++ b/tests/unit/gapic/talent_v4beta1/test_job_service.py @@ -98,15 +98,17 @@ def test__get_default_mtls_endpoint(): assert JobServiceClient._get_default_mtls_endpoint(non_googleapi) == non_googleapi -def test_job_service_client_from_service_account_info(): +@pytest.mark.parametrize("client_class", [JobServiceClient, JobServiceAsyncClient,]) +def test_job_service_client_from_service_account_info(client_class): creds = credentials.AnonymousCredentials() with mock.patch.object( service_account.Credentials, "from_service_account_info" ) as factory: factory.return_value = creds info = {"valid": True} - client = JobServiceClient.from_service_account_info(info) + client = client_class.from_service_account_info(info) assert client.transport._credentials == creds + assert isinstance(client, client_class) assert client.transport._host == "jobs.googleapis.com:443" @@ -120,9 +122,11 @@ def test_job_service_client_from_service_account_file(client_class): factory.return_value = creds client = client_class.from_service_account_file("dummy/file/path.json") assert client.transport._credentials == creds + assert isinstance(client, client_class) client = client_class.from_service_account_json("dummy/file/path.json") assert client.transport._credentials == creds + assert isinstance(client, client_class) assert client.transport._host == "jobs.googleapis.com:443" @@ -531,6 +535,22 @@ def test_create_job_from_dict(): test_create_job(request_type=dict) +def test_create_job_empty_call(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = JobServiceClient( + credentials=credentials.AnonymousCredentials(), transport="grpc", + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.create_job), "__call__") as call: + client.create_job() + call.assert_called() + _, args, _ = call.mock_calls[0] + + assert args[0] == job_service.CreateJobRequest() + + @pytest.mark.asyncio async def test_create_job_async( transport: str = "grpc_asyncio", request_type=job_service.CreateJobRequest @@ -785,6 +805,24 @@ def test_batch_create_jobs_from_dict(): test_batch_create_jobs(request_type=dict) +def test_batch_create_jobs_empty_call(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = JobServiceClient( + credentials=credentials.AnonymousCredentials(), transport="grpc", + ) + + # 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: + client.batch_create_jobs() + call.assert_called() + _, args, _ = call.mock_calls[0] + + assert args[0] == job_service.BatchCreateJobsRequest() + + @pytest.mark.asyncio async def test_batch_create_jobs_async( transport: str = "grpc_asyncio", request_type=job_service.BatchCreateJobsRequest @@ -1050,6 +1088,22 @@ def test_get_job_from_dict(): test_get_job(request_type=dict) +def test_get_job_empty_call(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = JobServiceClient( + credentials=credentials.AnonymousCredentials(), transport="grpc", + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.get_job), "__call__") as call: + client.get_job() + call.assert_called() + _, args, _ = call.mock_calls[0] + + assert args[0] == job_service.GetJobRequest() + + @pytest.mark.asyncio async def test_get_job_async( transport: str = "grpc_asyncio", request_type=job_service.GetJobRequest @@ -1347,6 +1401,22 @@ def test_update_job_from_dict(): test_update_job(request_type=dict) +def test_update_job_empty_call(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = JobServiceClient( + credentials=credentials.AnonymousCredentials(), transport="grpc", + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.update_job), "__call__") as call: + client.update_job() + call.assert_called() + _, args, _ = call.mock_calls[0] + + assert args[0] == job_service.UpdateJobRequest() + + @pytest.mark.asyncio async def test_update_job_async( transport: str = "grpc_asyncio", request_type=job_service.UpdateJobRequest @@ -1589,6 +1659,24 @@ def test_batch_update_jobs_from_dict(): test_batch_update_jobs(request_type=dict) +def test_batch_update_jobs_empty_call(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = JobServiceClient( + credentials=credentials.AnonymousCredentials(), transport="grpc", + ) + + # 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: + client.batch_update_jobs() + call.assert_called() + _, args, _ = call.mock_calls[0] + + assert args[0] == job_service.BatchUpdateJobsRequest() + + @pytest.mark.asyncio async def test_batch_update_jobs_async( transport: str = "grpc_asyncio", request_type=job_service.BatchUpdateJobsRequest @@ -1795,6 +1883,22 @@ def test_delete_job_from_dict(): test_delete_job(request_type=dict) +def test_delete_job_empty_call(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = JobServiceClient( + credentials=credentials.AnonymousCredentials(), transport="grpc", + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.delete_job), "__call__") as call: + client.delete_job() + call.assert_called() + _, args, _ = call.mock_calls[0] + + assert args[0] == job_service.DeleteJobRequest() + + @pytest.mark.asyncio async def test_delete_job_async( transport: str = "grpc_asyncio", request_type=job_service.DeleteJobRequest @@ -1977,6 +2081,24 @@ def test_batch_delete_jobs_from_dict(): test_batch_delete_jobs(request_type=dict) +def test_batch_delete_jobs_empty_call(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = JobServiceClient( + credentials=credentials.AnonymousCredentials(), transport="grpc", + ) + + # 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: + client.batch_delete_jobs() + call.assert_called() + _, args, _ = call.mock_calls[0] + + assert args[0] == job_service.BatchDeleteJobsRequest() + + @pytest.mark.asyncio async def test_batch_delete_jobs_async( transport: str = "grpc_asyncio", request_type=job_service.BatchDeleteJobsRequest @@ -2182,6 +2304,22 @@ def test_list_jobs_from_dict(): test_list_jobs(request_type=dict) +def test_list_jobs_empty_call(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = JobServiceClient( + credentials=credentials.AnonymousCredentials(), transport="grpc", + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.list_jobs), "__call__") as call: + client.list_jobs() + call.assert_called() + _, args, _ = call.mock_calls[0] + + assert args[0] == job_service.ListJobsRequest() + + @pytest.mark.asyncio async def test_list_jobs_async( transport: str = "grpc_asyncio", request_type=job_service.ListJobsRequest @@ -2492,6 +2630,22 @@ def test_search_jobs_from_dict(): test_search_jobs(request_type=dict) +def test_search_jobs_empty_call(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = JobServiceClient( + credentials=credentials.AnonymousCredentials(), transport="grpc", + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.search_jobs), "__call__") as call: + client.search_jobs() + call.assert_called() + _, args, _ = call.mock_calls[0] + + assert args[0] == job_service.SearchJobsRequest() + + @pytest.mark.asyncio async def test_search_jobs_async( transport: str = "grpc_asyncio", request_type=job_service.SearchJobsRequest @@ -2798,6 +2952,24 @@ def test_search_jobs_for_alert_from_dict(): test_search_jobs_for_alert(request_type=dict) +def test_search_jobs_for_alert_empty_call(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = JobServiceClient( + credentials=credentials.AnonymousCredentials(), transport="grpc", + ) + + # 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: + client.search_jobs_for_alert() + call.assert_called() + _, args, _ = call.mock_calls[0] + + assert args[0] == job_service.SearchJobsRequest() + + @pytest.mark.asyncio async def test_search_jobs_for_alert_async( transport: str = "grpc_asyncio", request_type=job_service.SearchJobsRequest diff --git a/tests/unit/gapic/talent_v4beta1/test_profile_service.py b/tests/unit/gapic/talent_v4beta1/test_profile_service.py index 00c94ff7..843a00c4 100644 --- a/tests/unit/gapic/talent_v4beta1/test_profile_service.py +++ b/tests/unit/gapic/talent_v4beta1/test_profile_service.py @@ -98,15 +98,19 @@ def test__get_default_mtls_endpoint(): ) -def test_profile_service_client_from_service_account_info(): +@pytest.mark.parametrize( + "client_class", [ProfileServiceClient, ProfileServiceAsyncClient,] +) +def test_profile_service_client_from_service_account_info(client_class): creds = credentials.AnonymousCredentials() with mock.patch.object( service_account.Credentials, "from_service_account_info" ) as factory: factory.return_value = creds info = {"valid": True} - client = ProfileServiceClient.from_service_account_info(info) + client = client_class.from_service_account_info(info) assert client.transport._credentials == creds + assert isinstance(client, client_class) assert client.transport._host == "jobs.googleapis.com:443" @@ -122,9 +126,11 @@ def test_profile_service_client_from_service_account_file(client_class): factory.return_value = creds client = client_class.from_service_account_file("dummy/file/path.json") assert client.transport._credentials == creds + assert isinstance(client, client_class) client = client_class.from_service_account_json("dummy/file/path.json") assert client.transport._credentials == creds + assert isinstance(client, client_class) assert client.transport._host == "jobs.googleapis.com:443" @@ -487,6 +493,22 @@ def test_list_profiles_from_dict(): test_list_profiles(request_type=dict) +def test_list_profiles_empty_call(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = ProfileServiceClient( + credentials=credentials.AnonymousCredentials(), transport="grpc", + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.list_profiles), "__call__") as call: + client.list_profiles() + call.assert_called() + _, args, _ = call.mock_calls[0] + + assert args[0] == profile_service.ListProfilesRequest() + + @pytest.mark.asyncio async def test_list_profiles_async( transport: str = "grpc_asyncio", request_type=profile_service.ListProfilesRequest @@ -828,6 +850,22 @@ def test_create_profile_from_dict(): test_create_profile(request_type=dict) +def test_create_profile_empty_call(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = ProfileServiceClient( + credentials=credentials.AnonymousCredentials(), transport="grpc", + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.create_profile), "__call__") as call: + client.create_profile() + call.assert_called() + _, args, _ = call.mock_calls[0] + + assert args[0] == profile_service.CreateProfileRequest() + + @pytest.mark.asyncio async def test_create_profile_async( transport: str = "grpc_asyncio", request_type=profile_service.CreateProfileRequest @@ -1079,6 +1117,22 @@ def test_get_profile_from_dict(): test_get_profile(request_type=dict) +def test_get_profile_empty_call(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = ProfileServiceClient( + credentials=credentials.AnonymousCredentials(), transport="grpc", + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.get_profile), "__call__") as call: + client.get_profile() + call.assert_called() + _, args, _ = call.mock_calls[0] + + assert args[0] == profile_service.GetProfileRequest() + + @pytest.mark.asyncio async def test_get_profile_async( transport: str = "grpc_asyncio", request_type=profile_service.GetProfileRequest @@ -1318,6 +1372,22 @@ def test_update_profile_from_dict(): test_update_profile(request_type=dict) +def test_update_profile_empty_call(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = ProfileServiceClient( + credentials=credentials.AnonymousCredentials(), transport="grpc", + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.update_profile), "__call__") as call: + client.update_profile() + call.assert_called() + _, args, _ = call.mock_calls[0] + + assert args[0] == profile_service.UpdateProfileRequest() + + @pytest.mark.asyncio async def test_update_profile_async( transport: str = "grpc_asyncio", request_type=profile_service.UpdateProfileRequest @@ -1536,6 +1606,22 @@ def test_delete_profile_from_dict(): test_delete_profile(request_type=dict) +def test_delete_profile_empty_call(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = ProfileServiceClient( + credentials=credentials.AnonymousCredentials(), transport="grpc", + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.delete_profile), "__call__") as call: + client.delete_profile() + call.assert_called() + _, args, _ = call.mock_calls[0] + + assert args[0] == profile_service.DeleteProfileRequest() + + @pytest.mark.asyncio async def test_delete_profile_async( transport: str = "grpc_asyncio", request_type=profile_service.DeleteProfileRequest @@ -1727,6 +1813,22 @@ def test_search_profiles_from_dict(): test_search_profiles(request_type=dict) +def test_search_profiles_empty_call(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = ProfileServiceClient( + credentials=credentials.AnonymousCredentials(), transport="grpc", + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.search_profiles), "__call__") as call: + client.search_profiles() + call.assert_called() + _, args, _ = call.mock_calls[0] + + assert args[0] == profile_service.SearchProfilesRequest() + + @pytest.mark.asyncio async def test_search_profiles_async( transport: str = "grpc_asyncio", request_type=profile_service.SearchProfilesRequest diff --git a/tests/unit/gapic/talent_v4beta1/test_tenant_service.py b/tests/unit/gapic/talent_v4beta1/test_tenant_service.py index af9881de..e4e6acc6 100644 --- a/tests/unit/gapic/talent_v4beta1/test_tenant_service.py +++ b/tests/unit/gapic/talent_v4beta1/test_tenant_service.py @@ -87,15 +87,19 @@ def test__get_default_mtls_endpoint(): ) -def test_tenant_service_client_from_service_account_info(): +@pytest.mark.parametrize( + "client_class", [TenantServiceClient, TenantServiceAsyncClient,] +) +def test_tenant_service_client_from_service_account_info(client_class): creds = credentials.AnonymousCredentials() with mock.patch.object( service_account.Credentials, "from_service_account_info" ) as factory: factory.return_value = creds info = {"valid": True} - client = TenantServiceClient.from_service_account_info(info) + client = client_class.from_service_account_info(info) assert client.transport._credentials == creds + assert isinstance(client, client_class) assert client.transport._host == "jobs.googleapis.com:443" @@ -111,9 +115,11 @@ def test_tenant_service_client_from_service_account_file(client_class): factory.return_value = creds client = client_class.from_service_account_file("dummy/file/path.json") assert client.transport._credentials == creds + assert isinstance(client, client_class) client = client_class.from_service_account_json("dummy/file/path.json") assert client.transport._credentials == creds + assert isinstance(client, client_class) assert client.transport._host == "jobs.googleapis.com:443" @@ -489,6 +495,22 @@ def test_create_tenant_from_dict(): test_create_tenant(request_type=dict) +def test_create_tenant_empty_call(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = TenantServiceClient( + credentials=credentials.AnonymousCredentials(), transport="grpc", + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.create_tenant), "__call__") as call: + client.create_tenant() + call.assert_called() + _, args, _ = call.mock_calls[0] + + assert args[0] == tenant_service.CreateTenantRequest() + + @pytest.mark.asyncio async def test_create_tenant_async( transport: str = "grpc_asyncio", request_type=tenant_service.CreateTenantRequest @@ -718,6 +740,22 @@ def test_get_tenant_from_dict(): test_get_tenant(request_type=dict) +def test_get_tenant_empty_call(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = TenantServiceClient( + credentials=credentials.AnonymousCredentials(), transport="grpc", + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.get_tenant), "__call__") as call: + client.get_tenant() + call.assert_called() + _, args, _ = call.mock_calls[0] + + assert args[0] == tenant_service.GetTenantRequest() + + @pytest.mark.asyncio async def test_get_tenant_async( transport: str = "grpc_asyncio", request_type=tenant_service.GetTenantRequest @@ -935,6 +973,22 @@ def test_update_tenant_from_dict(): test_update_tenant(request_type=dict) +def test_update_tenant_empty_call(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = TenantServiceClient( + credentials=credentials.AnonymousCredentials(), transport="grpc", + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.update_tenant), "__call__") as call: + client.update_tenant() + call.assert_called() + _, args, _ = call.mock_calls[0] + + assert args[0] == tenant_service.UpdateTenantRequest() + + @pytest.mark.asyncio async def test_update_tenant_async( transport: str = "grpc_asyncio", request_type=tenant_service.UpdateTenantRequest @@ -1138,6 +1192,22 @@ def test_delete_tenant_from_dict(): test_delete_tenant(request_type=dict) +def test_delete_tenant_empty_call(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = TenantServiceClient( + credentials=credentials.AnonymousCredentials(), transport="grpc", + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.delete_tenant), "__call__") as call: + client.delete_tenant() + call.assert_called() + _, args, _ = call.mock_calls[0] + + assert args[0] == tenant_service.DeleteTenantRequest() + + @pytest.mark.asyncio async def test_delete_tenant_async( transport: str = "grpc_asyncio", request_type=tenant_service.DeleteTenantRequest @@ -1323,6 +1393,22 @@ def test_list_tenants_from_dict(): test_list_tenants(request_type=dict) +def test_list_tenants_empty_call(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = TenantServiceClient( + credentials=credentials.AnonymousCredentials(), transport="grpc", + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.list_tenants), "__call__") as call: + client.list_tenants() + call.assert_called() + _, args, _ = call.mock_calls[0] + + assert args[0] == tenant_service.ListTenantsRequest() + + @pytest.mark.asyncio async def test_list_tenants_async( transport: str = "grpc_asyncio", request_type=tenant_service.ListTenantsRequest From e38bfbb9cdc2ee812c2ad34bfce4237d3b5dc660 Mon Sep 17 00:00:00 2001 From: yoshi-automation Date: Tue, 23 Mar 2021 19:24:01 -0700 Subject: [PATCH 22/38] chore: migrate example/library retry configs, fix C#/PHP/Ruby GAPICs Committer: @miraleung PiperOrigin-RevId: 359640308 Source-Author: Google APIs Source-Date: Thu Feb 25 16:23:52 2021 -0800 Source-Repo: googleapis/googleapis Source-Sha: 5428e91738f376955cd1066f0e389d241cc7d35b Source-Link: https://github.com/googleapis/googleapis/commit/5428e91738f376955cd1066f0e389d241cc7d35b --- google/cloud/talent_v4/__init__.py | 4 ++-- google/cloud/talent_v4beta1/__init__.py | 4 ++-- synth.metadata | 5 ++--- talent-v4beta1-py.tar.gz | 0 4 files changed, 6 insertions(+), 7 deletions(-) delete mode 100644 talent-v4beta1-py.tar.gz diff --git a/google/cloud/talent_v4/__init__.py b/google/cloud/talent_v4/__init__.py index b193e4de..2f1964fd 100644 --- a/google/cloud/talent_v4/__init__.py +++ b/google/cloud/talent_v4/__init__.py @@ -113,7 +113,6 @@ "DeleteTenantRequest", "DeviceInfo", "EmploymentType", - "EventServiceClient", "GetCompanyRequest", "GetJobRequest", "GetTenantRequest", @@ -144,10 +143,11 @@ "SearchJobsResponse", "SpellingCorrection", "Tenant", + "TenantServiceClient", "TimestampRange", "UpdateCompanyRequest", "UpdateJobRequest", "UpdateTenantRequest", "Visibility", - "TenantServiceClient", + "EventServiceClient", ) diff --git a/google/cloud/talent_v4beta1/__init__.py b/google/cloud/talent_v4beta1/__init__.py index c7d0e217..4bfd0d8b 100644 --- a/google/cloud/talent_v4beta1/__init__.py +++ b/google/cloud/talent_v4beta1/__init__.py @@ -157,6 +157,7 @@ "CommuteFilter", "CommuteMethod", "Company", + "CompanyServiceClient", "CompanySize", "CompensationFilter", "CompensationInfo", @@ -227,7 +228,6 @@ "Profile", "ProfileEvent", "ProfileQuery", - "ProfileServiceClient", "Publication", "Rating", "RequestMetadata", @@ -253,5 +253,5 @@ "UpdateTenantRequest", "Visibility", "WorkExperienceFilter", - "CompanyServiceClient", + "ProfileServiceClient", ) diff --git a/synth.metadata b/synth.metadata index 98db1733..26c142b6 100644 --- a/synth.metadata +++ b/synth.metadata @@ -11,8 +11,8 @@ "git": { "name": "googleapis", "remote": "https://github.com/googleapis/googleapis.git", - "sha": "07932bb995e7dc91b43620ea8402c6668c7d102c", - "internalRef": "359562873" + "sha": "5428e91738f376955cd1066f0e389d241cc7d35b", + "internalRef": "359640308" } }, { @@ -297,7 +297,6 @@ "scripts/readme-gen/templates/install_deps.tmpl.rst", "scripts/readme-gen/templates/install_portaudio.tmpl.rst", "setup.cfg", - "talent-v4beta1-py.tar.gz", "testing/.gitignore", "tests/unit/gapic/talent_v4/__init__.py", "tests/unit/gapic/talent_v4/test_company_service.py", diff --git a/talent-v4beta1-py.tar.gz b/talent-v4beta1-py.tar.gz deleted file mode 100644 index e69de29b..00000000 From 9572a1ebbcf867b092d6ff24bddeb6c1afad693f Mon Sep 17 00:00:00 2001 From: yoshi-automation Date: Tue, 23 Mar 2021 19:24:29 -0700 Subject: [PATCH 23/38] chore: update protobuf v3.15.3 This release makes --experimental_allow_proto3_optional no longer necessary. PiperOrigin-RevId: 359781040 Source-Author: Google APIs Source-Date: Fri Feb 26 09:59:49 2021 -0800 Source-Repo: googleapis/googleapis Source-Sha: f6dd7e47620566925a4b3f1ce029e74e1b2f2516 Source-Link: https://github.com/googleapis/googleapis/commit/f6dd7e47620566925a4b3f1ce029e74e1b2f2516 --- google/cloud/talent_v4beta1/__init__.py | 4 ++-- synth.metadata | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/google/cloud/talent_v4beta1/__init__.py b/google/cloud/talent_v4beta1/__init__.py index 4bfd0d8b..ea0ffd24 100644 --- a/google/cloud/talent_v4beta1/__init__.py +++ b/google/cloud/talent_v4beta1/__init__.py @@ -163,7 +163,6 @@ "CompensationInfo", "CompleteQueryRequest", "CompleteQueryResponse", - "CompletionClient", "ContactInfoUsage", "CreateApplicationRequest", "CreateClientEventRequest", @@ -228,6 +227,7 @@ "Profile", "ProfileEvent", "ProfileQuery", + "ProfileServiceClient", "Publication", "Rating", "RequestMetadata", @@ -253,5 +253,5 @@ "UpdateTenantRequest", "Visibility", "WorkExperienceFilter", - "ProfileServiceClient", + "CompletionClient", ) diff --git a/synth.metadata b/synth.metadata index 26c142b6..846a647a 100644 --- a/synth.metadata +++ b/synth.metadata @@ -11,8 +11,8 @@ "git": { "name": "googleapis", "remote": "https://github.com/googleapis/googleapis.git", - "sha": "5428e91738f376955cd1066f0e389d241cc7d35b", - "internalRef": "359640308" + "sha": "f6dd7e47620566925a4b3f1ce029e74e1b2f2516", + "internalRef": "359781040" } }, { From 4cdd4ac2ec50dbda3b925d5b2b5d24a1a4e57c31 Mon Sep 17 00:00:00 2001 From: yoshi-automation Date: Tue, 23 Mar 2021 19:27:22 -0700 Subject: [PATCH 24/38] fix: Update to PHP micro-generator beta02; fixes some bazel build issues. PiperOrigin-RevId: 359844338 Source-Author: Google APIs Source-Date: Fri Feb 26 14:51:50 2021 -0800 Source-Repo: googleapis/googleapis Source-Sha: 9adc11e84218d5e234392e7fe81676e778895525 Source-Link: https://github.com/googleapis/googleapis/commit/9adc11e84218d5e234392e7fe81676e778895525 --- google/cloud/talent_v4/__init__.py | 4 ++-- google/cloud/talent_v4beta1/__init__.py | 4 ++-- synth.metadata | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/google/cloud/talent_v4/__init__.py b/google/cloud/talent_v4/__init__.py index 2f1964fd..b193e4de 100644 --- a/google/cloud/talent_v4/__init__.py +++ b/google/cloud/talent_v4/__init__.py @@ -113,6 +113,7 @@ "DeleteTenantRequest", "DeviceInfo", "EmploymentType", + "EventServiceClient", "GetCompanyRequest", "GetJobRequest", "GetTenantRequest", @@ -143,11 +144,10 @@ "SearchJobsResponse", "SpellingCorrection", "Tenant", - "TenantServiceClient", "TimestampRange", "UpdateCompanyRequest", "UpdateJobRequest", "UpdateTenantRequest", "Visibility", - "EventServiceClient", + "TenantServiceClient", ) diff --git a/google/cloud/talent_v4beta1/__init__.py b/google/cloud/talent_v4beta1/__init__.py index ea0ffd24..e486a156 100644 --- a/google/cloud/talent_v4beta1/__init__.py +++ b/google/cloud/talent_v4beta1/__init__.py @@ -163,6 +163,7 @@ "CompensationInfo", "CompleteQueryRequest", "CompleteQueryResponse", + "CompletionClient", "ContactInfoUsage", "CreateApplicationRequest", "CreateClientEventRequest", @@ -185,7 +186,6 @@ "EmployerFilter", "EmploymentRecord", "EmploymentType", - "EventServiceClient", "GetApplicationRequest", "GetCompanyRequest", "GetJobRequest", @@ -253,5 +253,5 @@ "UpdateTenantRequest", "Visibility", "WorkExperienceFilter", - "CompletionClient", + "EventServiceClient", ) diff --git a/synth.metadata b/synth.metadata index 846a647a..73428dfd 100644 --- a/synth.metadata +++ b/synth.metadata @@ -11,8 +11,8 @@ "git": { "name": "googleapis", "remote": "https://github.com/googleapis/googleapis.git", - "sha": "f6dd7e47620566925a4b3f1ce029e74e1b2f2516", - "internalRef": "359781040" + "sha": "9adc11e84218d5e234392e7fe81676e778895525", + "internalRef": "359844338" } }, { From 9e96a02cb5bdf05b564699c87343dd3a41ca7a4d Mon Sep 17 00:00:00 2001 From: yoshi-automation Date: Tue, 23 Mar 2021 19:28:19 -0700 Subject: [PATCH 25/38] chore: remove py GAPICv2 targets for googleads Committer: @aohren PiperOrigin-RevId: 360168947 Source-Author: Google APIs Source-Date: Mon Mar 1 06:01:45 2021 -0800 Source-Repo: googleapis/googleapis Source-Sha: 84c93a27a5077a4f7c5d057a418e70c2a94a21ca Source-Link: https://github.com/googleapis/googleapis/commit/84c93a27a5077a4f7c5d057a418e70c2a94a21ca --- google/cloud/talent_v4beta1/__init__.py | 4 ++-- synth.metadata | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/google/cloud/talent_v4beta1/__init__.py b/google/cloud/talent_v4beta1/__init__.py index e486a156..4743ac58 100644 --- a/google/cloud/talent_v4beta1/__init__.py +++ b/google/cloud/talent_v4beta1/__init__.py @@ -186,6 +186,7 @@ "EmployerFilter", "EmploymentRecord", "EmploymentType", + "EventServiceClient", "GetApplicationRequest", "GetCompanyRequest", "GetJobRequest", @@ -243,7 +244,6 @@ "SpellingCorrection", "SummarizedProfile", "Tenant", - "TenantServiceClient", "TimeFilter", "TimestampRange", "UpdateApplicationRequest", @@ -253,5 +253,5 @@ "UpdateTenantRequest", "Visibility", "WorkExperienceFilter", - "EventServiceClient", + "TenantServiceClient", ) diff --git a/synth.metadata b/synth.metadata index 73428dfd..db6e46bf 100644 --- a/synth.metadata +++ b/synth.metadata @@ -11,8 +11,8 @@ "git": { "name": "googleapis", "remote": "https://github.com/googleapis/googleapis.git", - "sha": "9adc11e84218d5e234392e7fe81676e778895525", - "internalRef": "359844338" + "sha": "84c93a27a5077a4f7c5d057a418e70c2a94a21ca", + "internalRef": "360168947" } }, { From c7ce5546a842c2187ceda7fbdfee661859420a09 Mon Sep 17 00:00:00 2001 From: yoshi-automation Date: Tue, 23 Mar 2021 19:30:08 -0700 Subject: [PATCH 26/38] feat: publish documentai/v1 protos PiperOrigin-RevId: 360214832 Source-Author: Google APIs Source-Date: Mon Mar 1 09:59:41 2021 -0800 Source-Repo: googleapis/googleapis Source-Sha: be7020ff106658f75d50e14693b13d822d910325 Source-Link: https://github.com/googleapis/googleapis/commit/be7020ff106658f75d50e14693b13d822d910325 --- google/cloud/talent_v4beta1/__init__.py | 4 ++-- synth.metadata | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/google/cloud/talent_v4beta1/__init__.py b/google/cloud/talent_v4beta1/__init__.py index 4743ac58..e486a156 100644 --- a/google/cloud/talent_v4beta1/__init__.py +++ b/google/cloud/talent_v4beta1/__init__.py @@ -186,7 +186,6 @@ "EmployerFilter", "EmploymentRecord", "EmploymentType", - "EventServiceClient", "GetApplicationRequest", "GetCompanyRequest", "GetJobRequest", @@ -244,6 +243,7 @@ "SpellingCorrection", "SummarizedProfile", "Tenant", + "TenantServiceClient", "TimeFilter", "TimestampRange", "UpdateApplicationRequest", @@ -253,5 +253,5 @@ "UpdateTenantRequest", "Visibility", "WorkExperienceFilter", - "TenantServiceClient", + "EventServiceClient", ) diff --git a/synth.metadata b/synth.metadata index db6e46bf..18881850 100644 --- a/synth.metadata +++ b/synth.metadata @@ -11,8 +11,8 @@ "git": { "name": "googleapis", "remote": "https://github.com/googleapis/googleapis.git", - "sha": "84c93a27a5077a4f7c5d057a418e70c2a94a21ca", - "internalRef": "360168947" + "sha": "be7020ff106658f75d50e14693b13d822d910325", + "internalRef": "360214832" } }, { From 7bf03fb02d51ee1628f93d4331d0b0d59f0556ca Mon Sep 17 00:00:00 2001 From: yoshi-automation Date: Tue, 23 Mar 2021 19:32:00 -0700 Subject: [PATCH 27/38] feat: Add CCAI API PiperOrigin-RevId: 361003369 Source-Author: Google APIs Source-Date: Thu Mar 4 14:23:03 2021 -0800 Source-Repo: googleapis/googleapis Source-Sha: 369e98ef9cbae3fcbd9623ba084af51e54ddec65 Source-Link: https://github.com/googleapis/googleapis/commit/369e98ef9cbae3fcbd9623ba084af51e54ddec65 --- google/cloud/talent_v4/__init__.py | 4 ++-- google/cloud/talent_v4beta1/__init__.py | 4 ++-- synth.metadata | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/google/cloud/talent_v4/__init__.py b/google/cloud/talent_v4/__init__.py index b193e4de..9bf1bf95 100644 --- a/google/cloud/talent_v4/__init__.py +++ b/google/cloud/talent_v4/__init__.py @@ -95,7 +95,6 @@ "CommuteFilter", "CommuteMethod", "Company", - "CompanyServiceClient", "CompanySize", "CompensationFilter", "CompensationInfo", @@ -144,10 +143,11 @@ "SearchJobsResponse", "SpellingCorrection", "Tenant", + "TenantServiceClient", "TimestampRange", "UpdateCompanyRequest", "UpdateJobRequest", "UpdateTenantRequest", "Visibility", - "TenantServiceClient", + "CompanyServiceClient", ) diff --git a/google/cloud/talent_v4beta1/__init__.py b/google/cloud/talent_v4beta1/__init__.py index e486a156..4bfd0d8b 100644 --- a/google/cloud/talent_v4beta1/__init__.py +++ b/google/cloud/talent_v4beta1/__init__.py @@ -186,6 +186,7 @@ "EmployerFilter", "EmploymentRecord", "EmploymentType", + "EventServiceClient", "GetApplicationRequest", "GetCompanyRequest", "GetJobRequest", @@ -227,7 +228,6 @@ "Profile", "ProfileEvent", "ProfileQuery", - "ProfileServiceClient", "Publication", "Rating", "RequestMetadata", @@ -253,5 +253,5 @@ "UpdateTenantRequest", "Visibility", "WorkExperienceFilter", - "EventServiceClient", + "ProfileServiceClient", ) diff --git a/synth.metadata b/synth.metadata index 18881850..0a434daa 100644 --- a/synth.metadata +++ b/synth.metadata @@ -11,8 +11,8 @@ "git": { "name": "googleapis", "remote": "https://github.com/googleapis/googleapis.git", - "sha": "be7020ff106658f75d50e14693b13d822d910325", - "internalRef": "360214832" + "sha": "369e98ef9cbae3fcbd9623ba084af51e54ddec65", + "internalRef": "361003369" } }, { From 03fcf315c1dc2904313ff5c722742acff4fa2c35 Mon Sep 17 00:00:00 2001 From: yoshi-automation Date: Tue, 23 Mar 2021 19:35:39 -0700 Subject: [PATCH 28/38] chore: set python target name to google-analytics-data-v1beta-py for consistency with v1alpha PiperOrigin-RevId: 361024282 Source-Author: Google APIs Source-Date: Thu Mar 4 16:06:09 2021 -0800 Source-Repo: googleapis/googleapis Source-Sha: 83f48fa4ea05f00fb8cfef3897d1de719fb9ca12 Source-Link: https://github.com/googleapis/googleapis/commit/83f48fa4ea05f00fb8cfef3897d1de719fb9ca12 --- google/cloud/talent_v4/__init__.py | 4 ++-- google/cloud/talent_v4beta1/__init__.py | 4 ++-- synth.metadata | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/google/cloud/talent_v4/__init__.py b/google/cloud/talent_v4/__init__.py index 9bf1bf95..b193e4de 100644 --- a/google/cloud/talent_v4/__init__.py +++ b/google/cloud/talent_v4/__init__.py @@ -95,6 +95,7 @@ "CommuteFilter", "CommuteMethod", "Company", + "CompanyServiceClient", "CompanySize", "CompensationFilter", "CompensationInfo", @@ -143,11 +144,10 @@ "SearchJobsResponse", "SpellingCorrection", "Tenant", - "TenantServiceClient", "TimestampRange", "UpdateCompanyRequest", "UpdateJobRequest", "UpdateTenantRequest", "Visibility", - "CompanyServiceClient", + "TenantServiceClient", ) diff --git a/google/cloud/talent_v4beta1/__init__.py b/google/cloud/talent_v4beta1/__init__.py index 4bfd0d8b..e486a156 100644 --- a/google/cloud/talent_v4beta1/__init__.py +++ b/google/cloud/talent_v4beta1/__init__.py @@ -186,7 +186,6 @@ "EmployerFilter", "EmploymentRecord", "EmploymentType", - "EventServiceClient", "GetApplicationRequest", "GetCompanyRequest", "GetJobRequest", @@ -228,6 +227,7 @@ "Profile", "ProfileEvent", "ProfileQuery", + "ProfileServiceClient", "Publication", "Rating", "RequestMetadata", @@ -253,5 +253,5 @@ "UpdateTenantRequest", "Visibility", "WorkExperienceFilter", - "ProfileServiceClient", + "EventServiceClient", ) diff --git a/synth.metadata b/synth.metadata index 0a434daa..70481f0f 100644 --- a/synth.metadata +++ b/synth.metadata @@ -11,8 +11,8 @@ "git": { "name": "googleapis", "remote": "https://github.com/googleapis/googleapis.git", - "sha": "369e98ef9cbae3fcbd9623ba084af51e54ddec65", - "internalRef": "361003369" + "sha": "83f48fa4ea05f00fb8cfef3897d1de719fb9ca12", + "internalRef": "361024282" } }, { From d47b9df193282ec32187f085ced85d26689b3b45 Mon Sep 17 00:00:00 2001 From: yoshi-automation Date: Tue, 23 Mar 2021 19:37:26 -0700 Subject: [PATCH 29/38] chore: upgrade gapic-generator-python to 0.42.2 PiperOrigin-RevId: 361662015 Source-Author: Google APIs Source-Date: Mon Mar 8 14:47:18 2021 -0800 Source-Repo: googleapis/googleapis Source-Sha: 28a591963253d52ce3a25a918cafbdd9928de8cf Source-Link: https://github.com/googleapis/googleapis/commit/28a591963253d52ce3a25a918cafbdd9928de8cf --- google/cloud/talent_v4/__init__.py | 4 +- google/cloud/talent_v4/types/__init__.py | 96 +++---- google/cloud/talent_v4beta1/__init__.py | 4 +- google/cloud/talent_v4beta1/types/__init__.py | 252 +++++++++--------- synth.metadata | 4 +- 5 files changed, 180 insertions(+), 180 deletions(-) diff --git a/google/cloud/talent_v4/__init__.py b/google/cloud/talent_v4/__init__.py index b193e4de..9bf1bf95 100644 --- a/google/cloud/talent_v4/__init__.py +++ b/google/cloud/talent_v4/__init__.py @@ -95,7 +95,6 @@ "CommuteFilter", "CommuteMethod", "Company", - "CompanyServiceClient", "CompanySize", "CompensationFilter", "CompensationInfo", @@ -144,10 +143,11 @@ "SearchJobsResponse", "SpellingCorrection", "Tenant", + "TenantServiceClient", "TimestampRange", "UpdateCompanyRequest", "UpdateJobRequest", "UpdateTenantRequest", "Visibility", - "TenantServiceClient", + "CompanyServiceClient", ) diff --git a/google/cloud/talent_v4/types/__init__.py b/google/cloud/talent_v4/types/__init__.py index faf71c78..29719f84 100644 --- a/google/cloud/talent_v4/types/__init__.py +++ b/google/cloud/talent_v4/types/__init__.py @@ -16,34 +16,34 @@ # from .common import ( - TimestampRange, + BatchOperationMetadata, + CompensationInfo, + CustomAttribute, + DeviceInfo, Location, RequestMetadata, ResponseMetadata, - DeviceInfo, - CustomAttribute, SpellingCorrection, - CompensationInfo, - BatchOperationMetadata, + TimestampRange, + CommuteMethod, CompanySize, - JobBenefit, DegreeType, EmploymentType, - JobLevel, + HtmlSanitization, + JobBenefit, JobCategory, + JobLevel, PostingRegion, Visibility, - HtmlSanitization, - CommuteMethod, ) from .company import Company from .company_service import ( CreateCompanyRequest, - GetCompanyRequest, - UpdateCompanyRequest, DeleteCompanyRequest, + GetCompanyRequest, ListCompaniesRequest, ListCompaniesResponse, + UpdateCompanyRequest, ) from .completion_service import ( CompleteQueryRequest, @@ -55,10 +55,10 @@ ) from .event_service import CreateClientEventRequest from .filters import ( + CommuteFilter, + CompensationFilter, JobQuery, LocationFilter, - CompensationFilter, - CommuteFilter, ) from .histogram import ( HistogramQuery, @@ -66,93 +66,93 @@ ) from .job import Job from .job_service import ( + BatchCreateJobsRequest, + BatchCreateJobsResponse, + BatchDeleteJobsRequest, + BatchDeleteJobsResponse, + BatchUpdateJobsRequest, + BatchUpdateJobsResponse, CreateJobRequest, - GetJobRequest, - UpdateJobRequest, DeleteJobRequest, + GetJobRequest, + JobResult, ListJobsRequest, ListJobsResponse, SearchJobsRequest, SearchJobsResponse, - BatchCreateJobsRequest, - BatchUpdateJobsRequest, - BatchDeleteJobsRequest, - JobResult, - BatchCreateJobsResponse, - BatchUpdateJobsResponse, - BatchDeleteJobsResponse, + UpdateJobRequest, JobView, ) from .tenant import Tenant from .tenant_service import ( CreateTenantRequest, - GetTenantRequest, - UpdateTenantRequest, DeleteTenantRequest, + GetTenantRequest, ListTenantsRequest, ListTenantsResponse, + UpdateTenantRequest, ) __all__ = ( - "TimestampRange", + "BatchOperationMetadata", + "CompensationInfo", + "CustomAttribute", + "DeviceInfo", "Location", "RequestMetadata", "ResponseMetadata", - "DeviceInfo", - "CustomAttribute", "SpellingCorrection", - "CompensationInfo", - "BatchOperationMetadata", + "TimestampRange", + "CommuteMethod", "CompanySize", - "JobBenefit", "DegreeType", "EmploymentType", - "JobLevel", + "HtmlSanitization", + "JobBenefit", "JobCategory", + "JobLevel", "PostingRegion", "Visibility", - "HtmlSanitization", - "CommuteMethod", "Company", "CreateCompanyRequest", - "GetCompanyRequest", - "UpdateCompanyRequest", "DeleteCompanyRequest", + "GetCompanyRequest", "ListCompaniesRequest", "ListCompaniesResponse", + "UpdateCompanyRequest", "CompleteQueryRequest", "CompleteQueryResponse", "ClientEvent", "JobEvent", "CreateClientEventRequest", + "CommuteFilter", + "CompensationFilter", "JobQuery", "LocationFilter", - "CompensationFilter", - "CommuteFilter", "HistogramQuery", "HistogramQueryResult", "Job", + "BatchCreateJobsRequest", + "BatchCreateJobsResponse", + "BatchDeleteJobsRequest", + "BatchDeleteJobsResponse", + "BatchUpdateJobsRequest", + "BatchUpdateJobsResponse", "CreateJobRequest", - "GetJobRequest", - "UpdateJobRequest", "DeleteJobRequest", + "GetJobRequest", + "JobResult", "ListJobsRequest", "ListJobsResponse", "SearchJobsRequest", "SearchJobsResponse", - "BatchCreateJobsRequest", - "BatchUpdateJobsRequest", - "BatchDeleteJobsRequest", - "JobResult", - "BatchCreateJobsResponse", - "BatchUpdateJobsResponse", - "BatchDeleteJobsResponse", + "UpdateJobRequest", "JobView", "Tenant", "CreateTenantRequest", - "GetTenantRequest", - "UpdateTenantRequest", "DeleteTenantRequest", + "GetTenantRequest", "ListTenantsRequest", "ListTenantsResponse", + "UpdateTenantRequest", ) diff --git a/google/cloud/talent_v4beta1/__init__.py b/google/cloud/talent_v4beta1/__init__.py index e486a156..ea0ffd24 100644 --- a/google/cloud/talent_v4beta1/__init__.py +++ b/google/cloud/talent_v4beta1/__init__.py @@ -163,7 +163,6 @@ "CompensationInfo", "CompleteQueryRequest", "CompleteQueryResponse", - "CompletionClient", "ContactInfoUsage", "CreateApplicationRequest", "CreateClientEventRequest", @@ -186,6 +185,7 @@ "EmployerFilter", "EmploymentRecord", "EmploymentType", + "EventServiceClient", "GetApplicationRequest", "GetCompanyRequest", "GetJobRequest", @@ -253,5 +253,5 @@ "UpdateTenantRequest", "Visibility", "WorkExperienceFilter", - "EventServiceClient", + "CompletionClient", ) diff --git a/google/cloud/talent_v4beta1/types/__init__.py b/google/cloud/talent_v4beta1/types/__init__.py index 3d326265..98bf50a7 100644 --- a/google/cloud/talent_v4beta1/types/__init__.py +++ b/google/cloud/talent_v4beta1/types/__init__.py @@ -15,52 +15,52 @@ # limitations under the License. # +from .application import Application +from .application_service import ( + CreateApplicationRequest, + DeleteApplicationRequest, + GetApplicationRequest, + ListApplicationsRequest, + ListApplicationsResponse, + UpdateApplicationRequest, +) from .common import ( - TimestampRange, + BatchOperationMetadata, + Certification, + CompensationInfo, + CustomAttribute, + DeviceInfo, + Interview, Location, + Rating, RequestMetadata, ResponseMetadata, - DeviceInfo, - CustomAttribute, - SpellingCorrection, - CompensationInfo, - Certification, Skill, - Interview, - Rating, - BatchOperationMetadata, + SpellingCorrection, + TimestampRange, + AvailabilitySignalType, + CommuteMethod, CompanySize, - JobBenefit, + ContactInfoUsage, DegreeType, EmploymentType, - JobLevel, + HtmlSanitization, + JobBenefit, JobCategory, + JobLevel, + Outcome, PostingRegion, - Visibility, - ContactInfoUsage, - HtmlSanitization, - CommuteMethod, SkillProficiencyLevel, - Outcome, - AvailabilitySignalType, -) -from .application import Application -from .application_service import ( - CreateApplicationRequest, - GetApplicationRequest, - UpdateApplicationRequest, - DeleteApplicationRequest, - ListApplicationsRequest, - ListApplicationsResponse, + Visibility, ) from .company import Company from .company_service import ( CreateCompanyRequest, - GetCompanyRequest, - UpdateCompanyRequest, DeleteCompanyRequest, + GetCompanyRequest, ListCompaniesRequest, ListCompaniesResponse, + UpdateCompanyRequest, ) from .completion_service import ( CompleteQueryRequest, @@ -73,23 +73,23 @@ ) from .event_service import CreateClientEventRequest from .filters import ( - JobQuery, - ProfileQuery, - LocationFilter, - CompensationFilter, - CommuteFilter, - JobTitleFilter, - SkillFilter, - EmployerFilter, - EducationFilter, - WorkExperienceFilter, ApplicationDateFilter, - ApplicationOutcomeNotesFilter, ApplicationJobFilter, - TimeFilter, - CandidateAvailabilityFilter, + ApplicationOutcomeNotesFilter, AvailabilityFilter, + CandidateAvailabilityFilter, + CommuteFilter, + CompensationFilter, + EducationFilter, + EmployerFilter, + JobQuery, + JobTitleFilter, + LocationFilter, PersonNameFilter, + ProfileQuery, + SkillFilter, + TimeFilter, + WorkExperienceFilter, ) from .histogram import ( HistogramQuery, @@ -97,168 +97,168 @@ ) from .job import Job from .job_service import ( + BatchCreateJobsRequest, + BatchDeleteJobsRequest, + BatchUpdateJobsRequest, CreateJobRequest, - GetJobRequest, - UpdateJobRequest, DeleteJobRequest, - BatchDeleteJobsRequest, + GetJobRequest, + JobOperationResult, ListJobsRequest, ListJobsResponse, SearchJobsRequest, SearchJobsResponse, - BatchCreateJobsRequest, - BatchUpdateJobsRequest, - JobOperationResult, + UpdateJobRequest, JobView, ) from .profile import ( - Profile, - AvailabilitySignal, - Resume, - PersonName, + Activity, + AdditionalContactInfo, Address, + AvailabilitySignal, + Degree, + EducationRecord, Email, - Phone, - PersonalUri, - AdditionalContactInfo, EmploymentRecord, - EducationRecord, - Degree, - Activity, - Publication, Patent, + PersonalUri, + PersonName, + Phone, + Profile, + Publication, + Resume, ) from .profile_service import ( - ListProfilesRequest, - ListProfilesResponse, CreateProfileRequest, - GetProfileRequest, - UpdateProfileRequest, DeleteProfileRequest, + GetProfileRequest, + ListProfilesRequest, + ListProfilesResponse, SearchProfilesRequest, SearchProfilesResponse, SummarizedProfile, + UpdateProfileRequest, ) from .tenant import Tenant from .tenant_service import ( CreateTenantRequest, - GetTenantRequest, - UpdateTenantRequest, DeleteTenantRequest, + GetTenantRequest, ListTenantsRequest, ListTenantsResponse, + UpdateTenantRequest, ) __all__ = ( - "TimestampRange", + "Application", + "CreateApplicationRequest", + "DeleteApplicationRequest", + "GetApplicationRequest", + "ListApplicationsRequest", + "ListApplicationsResponse", + "UpdateApplicationRequest", + "BatchOperationMetadata", + "Certification", + "CompensationInfo", + "CustomAttribute", + "DeviceInfo", + "Interview", "Location", + "Rating", "RequestMetadata", "ResponseMetadata", - "DeviceInfo", - "CustomAttribute", - "SpellingCorrection", - "CompensationInfo", - "Certification", "Skill", - "Interview", - "Rating", - "BatchOperationMetadata", + "SpellingCorrection", + "TimestampRange", + "AvailabilitySignalType", + "CommuteMethod", "CompanySize", - "JobBenefit", + "ContactInfoUsage", "DegreeType", "EmploymentType", - "JobLevel", + "HtmlSanitization", + "JobBenefit", "JobCategory", + "JobLevel", + "Outcome", "PostingRegion", - "Visibility", - "ContactInfoUsage", - "HtmlSanitization", - "CommuteMethod", "SkillProficiencyLevel", - "Outcome", - "AvailabilitySignalType", - "Application", - "CreateApplicationRequest", - "GetApplicationRequest", - "UpdateApplicationRequest", - "DeleteApplicationRequest", - "ListApplicationsRequest", - "ListApplicationsResponse", + "Visibility", "Company", "CreateCompanyRequest", - "GetCompanyRequest", - "UpdateCompanyRequest", "DeleteCompanyRequest", + "GetCompanyRequest", "ListCompaniesRequest", "ListCompaniesResponse", + "UpdateCompanyRequest", "CompleteQueryRequest", "CompleteQueryResponse", "ClientEvent", "JobEvent", "ProfileEvent", "CreateClientEventRequest", - "JobQuery", - "ProfileQuery", - "LocationFilter", - "CompensationFilter", - "CommuteFilter", - "JobTitleFilter", - "SkillFilter", - "EmployerFilter", - "EducationFilter", - "WorkExperienceFilter", "ApplicationDateFilter", - "ApplicationOutcomeNotesFilter", "ApplicationJobFilter", - "TimeFilter", - "CandidateAvailabilityFilter", + "ApplicationOutcomeNotesFilter", "AvailabilityFilter", + "CandidateAvailabilityFilter", + "CommuteFilter", + "CompensationFilter", + "EducationFilter", + "EmployerFilter", + "JobQuery", + "JobTitleFilter", + "LocationFilter", "PersonNameFilter", + "ProfileQuery", + "SkillFilter", + "TimeFilter", + "WorkExperienceFilter", "HistogramQuery", "HistogramQueryResult", "Job", + "BatchCreateJobsRequest", + "BatchDeleteJobsRequest", + "BatchUpdateJobsRequest", "CreateJobRequest", - "GetJobRequest", - "UpdateJobRequest", "DeleteJobRequest", - "BatchDeleteJobsRequest", + "GetJobRequest", + "JobOperationResult", "ListJobsRequest", "ListJobsResponse", "SearchJobsRequest", "SearchJobsResponse", - "BatchCreateJobsRequest", - "BatchUpdateJobsRequest", - "JobOperationResult", + "UpdateJobRequest", "JobView", - "Profile", - "AvailabilitySignal", - "Resume", - "PersonName", + "Activity", + "AdditionalContactInfo", "Address", + "AvailabilitySignal", + "Degree", + "EducationRecord", "Email", - "Phone", - "PersonalUri", - "AdditionalContactInfo", "EmploymentRecord", - "EducationRecord", - "Degree", - "Activity", - "Publication", "Patent", - "ListProfilesRequest", - "ListProfilesResponse", + "PersonalUri", + "PersonName", + "Phone", + "Profile", + "Publication", + "Resume", "CreateProfileRequest", - "GetProfileRequest", - "UpdateProfileRequest", "DeleteProfileRequest", + "GetProfileRequest", + "ListProfilesRequest", + "ListProfilesResponse", "SearchProfilesRequest", "SearchProfilesResponse", "SummarizedProfile", + "UpdateProfileRequest", "Tenant", "CreateTenantRequest", - "GetTenantRequest", - "UpdateTenantRequest", "DeleteTenantRequest", + "GetTenantRequest", "ListTenantsRequest", "ListTenantsResponse", + "UpdateTenantRequest", ) diff --git a/synth.metadata b/synth.metadata index 70481f0f..8e51cd5e 100644 --- a/synth.metadata +++ b/synth.metadata @@ -11,8 +11,8 @@ "git": { "name": "googleapis", "remote": "https://github.com/googleapis/googleapis.git", - "sha": "83f48fa4ea05f00fb8cfef3897d1de719fb9ca12", - "internalRef": "361024282" + "sha": "28a591963253d52ce3a25a918cafbdd9928de8cf", + "internalRef": "361662015" } }, { From c0d76258d55415cc9d1650e15fb0546d84bb01ff Mon Sep 17 00:00:00 2001 From: yoshi-automation Date: Tue, 23 Mar 2021 19:37:56 -0700 Subject: [PATCH 30/38] feat: added support for release channels when creating service PiperOrigin-RevId: 361819751 Source-Author: Google APIs Source-Date: Tue Mar 9 08:51:11 2021 -0800 Source-Repo: googleapis/googleapis Source-Sha: cd6119f83636cf9c0d2bee86db7456dc49c56c47 Source-Link: https://github.com/googleapis/googleapis/commit/cd6119f83636cf9c0d2bee86db7456dc49c56c47 --- google/cloud/talent_v4/__init__.py | 4 ++-- google/cloud/talent_v4beta1/__init__.py | 4 ++-- synth.metadata | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/google/cloud/talent_v4/__init__.py b/google/cloud/talent_v4/__init__.py index 9bf1bf95..2f1964fd 100644 --- a/google/cloud/talent_v4/__init__.py +++ b/google/cloud/talent_v4/__init__.py @@ -95,6 +95,7 @@ "CommuteFilter", "CommuteMethod", "Company", + "CompanyServiceClient", "CompanySize", "CompensationFilter", "CompensationInfo", @@ -112,7 +113,6 @@ "DeleteTenantRequest", "DeviceInfo", "EmploymentType", - "EventServiceClient", "GetCompanyRequest", "GetJobRequest", "GetTenantRequest", @@ -149,5 +149,5 @@ "UpdateJobRequest", "UpdateTenantRequest", "Visibility", - "CompanyServiceClient", + "EventServiceClient", ) diff --git a/google/cloud/talent_v4beta1/__init__.py b/google/cloud/talent_v4beta1/__init__.py index ea0ffd24..e486a156 100644 --- a/google/cloud/talent_v4beta1/__init__.py +++ b/google/cloud/talent_v4beta1/__init__.py @@ -163,6 +163,7 @@ "CompensationInfo", "CompleteQueryRequest", "CompleteQueryResponse", + "CompletionClient", "ContactInfoUsage", "CreateApplicationRequest", "CreateClientEventRequest", @@ -185,7 +186,6 @@ "EmployerFilter", "EmploymentRecord", "EmploymentType", - "EventServiceClient", "GetApplicationRequest", "GetCompanyRequest", "GetJobRequest", @@ -253,5 +253,5 @@ "UpdateTenantRequest", "Visibility", "WorkExperienceFilter", - "CompletionClient", + "EventServiceClient", ) diff --git a/synth.metadata b/synth.metadata index 8e51cd5e..2dd48620 100644 --- a/synth.metadata +++ b/synth.metadata @@ -11,8 +11,8 @@ "git": { "name": "googleapis", "remote": "https://github.com/googleapis/googleapis.git", - "sha": "28a591963253d52ce3a25a918cafbdd9928de8cf", - "internalRef": "361662015" + "sha": "cd6119f83636cf9c0d2bee86db7456dc49c56c47", + "internalRef": "361819751" } }, { From 1717c384869aac48d5b5d98c0fa3254b8ab42fe0 Mon Sep 17 00:00:00 2001 From: yoshi-automation Date: Tue, 23 Mar 2021 19:40:16 -0700 Subject: [PATCH 31/38] chore: Use correct markdown for code block PiperOrigin-RevId: 363012458 Source-Author: Google APIs Source-Date: Mon Mar 15 13:08:38 2021 -0700 Source-Repo: googleapis/googleapis Source-Sha: e1654206ff59f3a2a226828f9c9f354c253b36e4 Source-Link: https://github.com/googleapis/googleapis/commit/e1654206ff59f3a2a226828f9c9f354c253b36e4 --- google/cloud/talent_v4/__init__.py | 4 ++-- google/cloud/talent_v4beta1/__init__.py | 4 ++-- synth.metadata | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/google/cloud/talent_v4/__init__.py b/google/cloud/talent_v4/__init__.py index 2f1964fd..9bf1bf95 100644 --- a/google/cloud/talent_v4/__init__.py +++ b/google/cloud/talent_v4/__init__.py @@ -95,7 +95,6 @@ "CommuteFilter", "CommuteMethod", "Company", - "CompanyServiceClient", "CompanySize", "CompensationFilter", "CompensationInfo", @@ -113,6 +112,7 @@ "DeleteTenantRequest", "DeviceInfo", "EmploymentType", + "EventServiceClient", "GetCompanyRequest", "GetJobRequest", "GetTenantRequest", @@ -149,5 +149,5 @@ "UpdateJobRequest", "UpdateTenantRequest", "Visibility", - "EventServiceClient", + "CompanyServiceClient", ) diff --git a/google/cloud/talent_v4beta1/__init__.py b/google/cloud/talent_v4beta1/__init__.py index e486a156..ea0ffd24 100644 --- a/google/cloud/talent_v4beta1/__init__.py +++ b/google/cloud/talent_v4beta1/__init__.py @@ -163,7 +163,6 @@ "CompensationInfo", "CompleteQueryRequest", "CompleteQueryResponse", - "CompletionClient", "ContactInfoUsage", "CreateApplicationRequest", "CreateClientEventRequest", @@ -186,6 +185,7 @@ "EmployerFilter", "EmploymentRecord", "EmploymentType", + "EventServiceClient", "GetApplicationRequest", "GetCompanyRequest", "GetJobRequest", @@ -253,5 +253,5 @@ "UpdateTenantRequest", "Visibility", "WorkExperienceFilter", - "EventServiceClient", + "CompletionClient", ) diff --git a/synth.metadata b/synth.metadata index 2dd48620..4be369c0 100644 --- a/synth.metadata +++ b/synth.metadata @@ -11,8 +11,8 @@ "git": { "name": "googleapis", "remote": "https://github.com/googleapis/googleapis.git", - "sha": "cd6119f83636cf9c0d2bee86db7456dc49c56c47", - "internalRef": "361819751" + "sha": "e1654206ff59f3a2a226828f9c9f354c253b36e4", + "internalRef": "363012458" } }, { From 1af62787b7904b586f182054df546e91534ba90a Mon Sep 17 00:00:00 2001 From: yoshi-automation Date: Tue, 23 Mar 2021 19:42:46 -0700 Subject: [PATCH 32/38] feat: added v3beta1 proto for online and batch document translation PiperOrigin-RevId: 364358156 Source-Author: Google APIs Source-Date: Mon Mar 22 10:55:28 2021 -0700 Source-Repo: googleapis/googleapis Source-Sha: d6b4fb337caf6eccb606728ef727ac76364a4f14 Source-Link: https://github.com/googleapis/googleapis/commit/d6b4fb337caf6eccb606728ef727ac76364a4f14 --- google/cloud/talent_v4/__init__.py | 4 ++-- google/cloud/talent_v4beta1/__init__.py | 4 ++-- synth.metadata | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/google/cloud/talent_v4/__init__.py b/google/cloud/talent_v4/__init__.py index 9bf1bf95..5d959d15 100644 --- a/google/cloud/talent_v4/__init__.py +++ b/google/cloud/talent_v4/__init__.py @@ -95,12 +95,12 @@ "CommuteFilter", "CommuteMethod", "Company", + "CompanyServiceClient", "CompanySize", "CompensationFilter", "CompensationInfo", "CompleteQueryRequest", "CompleteQueryResponse", - "CompletionClient", "CreateClientEventRequest", "CreateCompanyRequest", "CreateJobRequest", @@ -149,5 +149,5 @@ "UpdateJobRequest", "UpdateTenantRequest", "Visibility", - "CompanyServiceClient", + "CompletionClient", ) diff --git a/google/cloud/talent_v4beta1/__init__.py b/google/cloud/talent_v4beta1/__init__.py index ea0ffd24..b751ef4a 100644 --- a/google/cloud/talent_v4beta1/__init__.py +++ b/google/cloud/talent_v4beta1/__init__.py @@ -163,6 +163,7 @@ "CompensationInfo", "CompleteQueryRequest", "CompleteQueryResponse", + "CompletionClient", "ContactInfoUsage", "CreateApplicationRequest", "CreateClientEventRequest", @@ -202,7 +203,6 @@ "JobLevel", "JobOperationResult", "JobQuery", - "JobServiceClient", "JobTitleFilter", "JobView", "ListApplicationsRequest", @@ -253,5 +253,5 @@ "UpdateTenantRequest", "Visibility", "WorkExperienceFilter", - "CompletionClient", + "JobServiceClient", ) diff --git a/synth.metadata b/synth.metadata index 4be369c0..19a3d8e9 100644 --- a/synth.metadata +++ b/synth.metadata @@ -11,8 +11,8 @@ "git": { "name": "googleapis", "remote": "https://github.com/googleapis/googleapis.git", - "sha": "e1654206ff59f3a2a226828f9c9f354c253b36e4", - "internalRef": "363012458" + "sha": "d6b4fb337caf6eccb606728ef727ac76364a4f14", + "internalRef": "364358156" } }, { From 28c773bb704f2910415c4039ebd2eb68f0669eb7 Mon Sep 17 00:00:00 2001 From: yoshi-automation Date: Tue, 23 Mar 2021 19:43:32 -0700 Subject: [PATCH 33/38] chore: upgrade gapic-generator-python to 0.43.1 PiperOrigin-RevId: 364411656 Source-Author: Google APIs Source-Date: Mon Mar 22 14:40:22 2021 -0700 Source-Repo: googleapis/googleapis Source-Sha: 149a3a84c29c9b8189576c7442ccb6dcf6a8f95b Source-Link: https://github.com/googleapis/googleapis/commit/149a3a84c29c9b8189576c7442ccb6dcf6a8f95b --- google/cloud/talent_v4/__init__.py | 4 +- .../services/company_service/async_client.py | 3 + .../company_service/transports/base.py | 21 ++-- .../company_service/transports/grpc.py | 101 ++++++---------- .../transports/grpc_asyncio.py | 109 +++++++---------- .../services/completion/async_client.py | 1 + .../services/completion/transports/base.py | 19 +-- .../services/completion/transports/grpc.py | 101 ++++++---------- .../completion/transports/grpc_asyncio.py | 109 +++++++---------- .../services/event_service/transports/base.py | 18 +-- .../services/event_service/transports/grpc.py | 101 ++++++---------- .../event_service/transports/grpc_asyncio.py | 109 +++++++---------- .../services/job_service/async_client.py | 3 + .../services/job_service/transports/base.py | 21 ++-- .../services/job_service/transports/grpc.py | 103 ++++++---------- .../job_service/transports/grpc_asyncio.py | 111 +++++++----------- .../services/tenant_service/async_client.py | 3 + .../tenant_service/transports/base.py | 21 ++-- .../tenant_service/transports/grpc.py | 101 ++++++---------- .../tenant_service/transports/grpc_asyncio.py | 109 +++++++---------- google/cloud/talent_v4/types/common.py | 1 + google/cloud/talent_v4beta1/__init__.py | 4 +- .../application_service/async_client.py | 3 + .../application_service/transports/base.py | 21 ++-- .../application_service/transports/grpc.py | 101 ++++++---------- .../transports/grpc_asyncio.py | 109 +++++++---------- .../services/company_service/async_client.py | 3 + .../company_service/transports/base.py | 21 ++-- .../company_service/transports/grpc.py | 101 ++++++---------- .../transports/grpc_asyncio.py | 109 +++++++---------- .../services/completion/async_client.py | 1 + .../services/completion/transports/base.py | 19 +-- .../services/completion/transports/grpc.py | 101 ++++++---------- .../completion/transports/grpc_asyncio.py | 109 +++++++---------- .../services/event_service/transports/base.py | 18 +-- .../services/event_service/transports/grpc.py | 101 ++++++---------- .../event_service/transports/grpc_asyncio.py | 109 +++++++---------- .../services/job_service/async_client.py | 3 + .../services/job_service/transports/base.py | 21 ++-- .../services/job_service/transports/grpc.py | 103 ++++++---------- .../job_service/transports/grpc_asyncio.py | 111 +++++++----------- .../services/profile_service/async_client.py | 3 + .../profile_service/transports/base.py | 21 ++-- .../profile_service/transports/grpc.py | 101 ++++++---------- .../transports/grpc_asyncio.py | 109 +++++++---------- .../services/tenant_service/async_client.py | 3 + .../tenant_service/transports/base.py | 21 ++-- .../tenant_service/transports/grpc.py | 101 ++++++---------- .../tenant_service/transports/grpc_asyncio.py | 109 +++++++---------- google/cloud/talent_v4beta1/types/common.py | 1 + synth.metadata | 4 +- 51 files changed, 1108 insertions(+), 1702 deletions(-) diff --git a/google/cloud/talent_v4/__init__.py b/google/cloud/talent_v4/__init__.py index 5d959d15..b193e4de 100644 --- a/google/cloud/talent_v4/__init__.py +++ b/google/cloud/talent_v4/__init__.py @@ -101,6 +101,7 @@ "CompensationInfo", "CompleteQueryRequest", "CompleteQueryResponse", + "CompletionClient", "CreateClientEventRequest", "CreateCompanyRequest", "CreateJobRequest", @@ -143,11 +144,10 @@ "SearchJobsResponse", "SpellingCorrection", "Tenant", - "TenantServiceClient", "TimestampRange", "UpdateCompanyRequest", "UpdateJobRequest", "UpdateTenantRequest", "Visibility", - "CompletionClient", + "TenantServiceClient", ) diff --git a/google/cloud/talent_v4/services/company_service/async_client.py b/google/cloud/talent_v4/services/company_service/async_client.py index 8cef405a..dbb65fa2 100644 --- a/google/cloud/talent_v4/services/company_service/async_client.py +++ b/google/cloud/talent_v4/services/company_service/async_client.py @@ -339,6 +339,7 @@ async def get_company( predicate=retries.if_exception_type( exceptions.DeadlineExceeded, exceptions.ServiceUnavailable, ), + deadline=30.0, ), default_timeout=30.0, client_info=DEFAULT_CLIENT_INFO, @@ -518,6 +519,7 @@ async def delete_company( predicate=retries.if_exception_type( exceptions.DeadlineExceeded, exceptions.ServiceUnavailable, ), + deadline=30.0, ), default_timeout=30.0, client_info=DEFAULT_CLIENT_INFO, @@ -604,6 +606,7 @@ async def list_companies( predicate=retries.if_exception_type( exceptions.DeadlineExceeded, exceptions.ServiceUnavailable, ), + deadline=30.0, ), default_timeout=30.0, client_info=DEFAULT_CLIENT_INFO, diff --git a/google/cloud/talent_v4/services/company_service/transports/base.py b/google/cloud/talent_v4/services/company_service/transports/base.py index 587ed0c6..ccaaff88 100644 --- a/google/cloud/talent_v4/services/company_service/transports/base.py +++ b/google/cloud/talent_v4/services/company_service/transports/base.py @@ -73,10 +73,10 @@ def __init__( scope (Optional[Sequence[str]]): A list of scopes. quota_project_id (Optional[str]): An optional project to use for billing and quota. - 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 + 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. """ # Save the hostname. Default to port 443 (HTTPS) if none is specified. @@ -84,6 +84,9 @@ def __init__( host += ":443" self._host = host + # Save the scopes. + self._scopes = scopes or self.AUTH_SCOPES + # If no credentials are provided, then determine the appropriate # defaults. if credentials and credentials_file: @@ -93,20 +96,17 @@ def __init__( if credentials_file is not None: credentials, _ = auth.load_credentials_from_file( - credentials_file, scopes=scopes, quota_project_id=quota_project_id + credentials_file, scopes=self._scopes, quota_project_id=quota_project_id ) elif credentials is None: credentials, _ = auth.default( - scopes=scopes, quota_project_id=quota_project_id + scopes=self._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(client_info) - def _prep_wrapped_messages(self, client_info): # Precompute the wrapped methods. self._wrapped_methods = { @@ -122,6 +122,7 @@ def _prep_wrapped_messages(self, client_info): predicate=retries.if_exception_type( exceptions.DeadlineExceeded, exceptions.ServiceUnavailable, ), + deadline=30.0, ), default_timeout=30.0, client_info=client_info, @@ -138,6 +139,7 @@ def _prep_wrapped_messages(self, client_info): predicate=retries.if_exception_type( exceptions.DeadlineExceeded, exceptions.ServiceUnavailable, ), + deadline=30.0, ), default_timeout=30.0, client_info=client_info, @@ -151,6 +153,7 @@ def _prep_wrapped_messages(self, client_info): predicate=retries.if_exception_type( exceptions.DeadlineExceeded, exceptions.ServiceUnavailable, ), + deadline=30.0, ), default_timeout=30.0, client_info=client_info, diff --git a/google/cloud/talent_v4/services/company_service/transports/grpc.py b/google/cloud/talent_v4/services/company_service/transports/grpc.py index 3825b0cf..fe1e7dd2 100644 --- a/google/cloud/talent_v4/services/company_service/transports/grpc.py +++ b/google/cloud/talent_v4/services/company_service/transports/grpc.py @@ -110,7 +110,9 @@ def __init__( google.api_core.exceptions.DuplicateCredentialArgs: If both ``credentials`` and ``credentials_file`` are passed. """ + self._grpc_channel = None self._ssl_channel_credentials = ssl_channel_credentials + self._stubs: Dict[str, Callable] = {} if api_mtls_endpoint: warnings.warn("api_mtls_endpoint is deprecated", DeprecationWarning) @@ -118,70 +120,50 @@ def __init__( warnings.warn("client_cert_source is deprecated", DeprecationWarning) if channel: - # Sanity check: Ensure that channel and credentials are not both - # provided. + # Ignore credentials if a channel was passed. credentials = False - # If a channel was explicitly provided, set it. self._grpc_channel = channel self._ssl_channel_credentials = None - 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, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - self._ssl_channel_credentials = ssl_credentials else: - host = host if ":" in host else host + ":443" + if api_mtls_endpoint: + host = api_mtls_endpoint + + # Create SSL credentials with client_cert_source or application + # default SSL credentials. + if client_cert_source: + cert, key = client_cert_source() + self._ssl_channel_credentials = grpc.ssl_channel_credentials( + certificate_chain=cert, private_key=key + ) + else: + self._ssl_channel_credentials = SslCredentials().ssl_credentials - if credentials is None: - credentials, _ = auth.default( - scopes=self.AUTH_SCOPES, quota_project_id=quota_project_id - ) + else: + if client_cert_source_for_mtls and not ssl_channel_credentials: + cert, key = client_cert_source_for_mtls() + self._ssl_channel_credentials = grpc.ssl_channel_credentials( + certificate_chain=cert, private_key=key + ) - if client_cert_source_for_mtls and not ssl_channel_credentials: - cert, key = client_cert_source_for_mtls() - self._ssl_channel_credentials = grpc.ssl_channel_credentials( - certificate_chain=cert, private_key=key - ) + # The base transport sets the host, credentials and scopes + super().__init__( + host=host, + credentials=credentials, + credentials_file=credentials_file, + scopes=scopes, + quota_project_id=quota_project_id, + client_info=client_info, + ) - # create a new channel. The provided one is ignored. + if not self._grpc_channel: self._grpc_channel = type(self).create_channel( - host, - credentials=credentials, + self._host, + credentials=self._credentials, credentials_file=credentials_file, + scopes=self._scopes, ssl_credentials=self._ssl_channel_credentials, - scopes=scopes or self.AUTH_SCOPES, quota_project_id=quota_project_id, options=[ ("grpc.max_send_message_length", -1), @@ -189,17 +171,8 @@ def __init__( ], ) - 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, - client_info=client_info, - ) + # Wrap messages. This must be done after self._grpc_channel exists + self._prep_wrapped_messages(client_info) @classmethod def create_channel( @@ -213,7 +186,7 @@ def create_channel( ) -> grpc.Channel: """Create and return a gRPC channel object. Args: - address (Optional[str]): The host for the channel to use. + host (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 diff --git a/google/cloud/talent_v4/services/company_service/transports/grpc_asyncio.py b/google/cloud/talent_v4/services/company_service/transports/grpc_asyncio.py index 58252223..0643fff5 100644 --- a/google/cloud/talent_v4/services/company_service/transports/grpc_asyncio.py +++ b/google/cloud/talent_v4/services/company_service/transports/grpc_asyncio.py @@ -65,7 +65,7 @@ def create_channel( ) -> aio.Channel: """Create and return a gRPC AsyncIO channel object. Args: - address (Optional[str]): The host for the channel to use. + host (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 @@ -143,10 +143,10 @@ def __init__( ignored if ``channel`` or ``ssl_channel_credentials`` is provided. quota_project_id (Optional[str]): An optional project to use for billing and quota. - 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 + 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. Raises: @@ -155,7 +155,9 @@ def __init__( google.api_core.exceptions.DuplicateCredentialArgs: If both ``credentials`` and ``credentials_file`` are passed. """ + self._grpc_channel = None self._ssl_channel_credentials = ssl_channel_credentials + self._stubs: Dict[str, Callable] = {} if api_mtls_endpoint: warnings.warn("api_mtls_endpoint is deprecated", DeprecationWarning) @@ -163,70 +165,50 @@ def __init__( warnings.warn("client_cert_source is deprecated", DeprecationWarning) if channel: - # Sanity check: Ensure that channel and credentials are not both - # provided. + # Ignore credentials if a channel was passed. credentials = False - # If a channel was explicitly provided, set it. self._grpc_channel = channel self._ssl_channel_credentials = None - 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, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - self._ssl_channel_credentials = ssl_credentials else: - host = host if ":" in host else host + ":443" + if api_mtls_endpoint: + host = api_mtls_endpoint + + # Create SSL credentials with client_cert_source or application + # default SSL credentials. + if client_cert_source: + cert, key = client_cert_source() + self._ssl_channel_credentials = grpc.ssl_channel_credentials( + certificate_chain=cert, private_key=key + ) + else: + self._ssl_channel_credentials = SslCredentials().ssl_credentials - if credentials is None: - credentials, _ = auth.default( - scopes=self.AUTH_SCOPES, quota_project_id=quota_project_id - ) + else: + if client_cert_source_for_mtls and not ssl_channel_credentials: + cert, key = client_cert_source_for_mtls() + self._ssl_channel_credentials = grpc.ssl_channel_credentials( + certificate_chain=cert, private_key=key + ) - if client_cert_source_for_mtls and not ssl_channel_credentials: - cert, key = client_cert_source_for_mtls() - self._ssl_channel_credentials = grpc.ssl_channel_credentials( - certificate_chain=cert, private_key=key - ) + # The base transport sets the host, credentials and scopes + super().__init__( + host=host, + credentials=credentials, + credentials_file=credentials_file, + scopes=scopes, + quota_project_id=quota_project_id, + client_info=client_info, + ) - # create a new channel. The provided one is ignored. + if not self._grpc_channel: self._grpc_channel = type(self).create_channel( - host, - credentials=credentials, + self._host, + credentials=self._credentials, credentials_file=credentials_file, + scopes=self._scopes, ssl_credentials=self._ssl_channel_credentials, - scopes=scopes or self.AUTH_SCOPES, quota_project_id=quota_project_id, options=[ ("grpc.max_send_message_length", -1), @@ -234,17 +216,8 @@ def __init__( ], ) - # 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, - client_info=client_info, - ) - - self._stubs = {} + # Wrap messages. This must be done after self._grpc_channel exists + self._prep_wrapped_messages(client_info) @property def grpc_channel(self) -> aio.Channel: diff --git a/google/cloud/talent_v4/services/completion/async_client.py b/google/cloud/talent_v4/services/completion/async_client.py index 35e17862..16c1c698 100644 --- a/google/cloud/talent_v4/services/completion/async_client.py +++ b/google/cloud/talent_v4/services/completion/async_client.py @@ -206,6 +206,7 @@ async def complete_query( predicate=retries.if_exception_type( exceptions.DeadlineExceeded, exceptions.ServiceUnavailable, ), + deadline=30.0, ), default_timeout=30.0, client_info=DEFAULT_CLIENT_INFO, diff --git a/google/cloud/talent_v4/services/completion/transports/base.py b/google/cloud/talent_v4/services/completion/transports/base.py index efb1e327..e8fdb64a 100644 --- a/google/cloud/talent_v4/services/completion/transports/base.py +++ b/google/cloud/talent_v4/services/completion/transports/base.py @@ -70,10 +70,10 @@ def __init__( scope (Optional[Sequence[str]]): A list of scopes. quota_project_id (Optional[str]): An optional project to use for billing and quota. - 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 + 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. """ # Save the hostname. Default to port 443 (HTTPS) if none is specified. @@ -81,6 +81,9 @@ def __init__( host += ":443" self._host = host + # Save the scopes. + self._scopes = scopes or self.AUTH_SCOPES + # If no credentials are provided, then determine the appropriate # defaults. if credentials and credentials_file: @@ -90,20 +93,17 @@ def __init__( if credentials_file is not None: credentials, _ = auth.load_credentials_from_file( - credentials_file, scopes=scopes, quota_project_id=quota_project_id + credentials_file, scopes=self._scopes, quota_project_id=quota_project_id ) elif credentials is None: credentials, _ = auth.default( - scopes=scopes, quota_project_id=quota_project_id + scopes=self._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(client_info) - def _prep_wrapped_messages(self, client_info): # Precompute the wrapped methods. self._wrapped_methods = { @@ -116,6 +116,7 @@ def _prep_wrapped_messages(self, client_info): predicate=retries.if_exception_type( exceptions.DeadlineExceeded, exceptions.ServiceUnavailable, ), + deadline=30.0, ), default_timeout=30.0, client_info=client_info, diff --git a/google/cloud/talent_v4/services/completion/transports/grpc.py b/google/cloud/talent_v4/services/completion/transports/grpc.py index c4fea8c9..7732a1dc 100644 --- a/google/cloud/talent_v4/services/completion/transports/grpc.py +++ b/google/cloud/talent_v4/services/completion/transports/grpc.py @@ -106,7 +106,9 @@ def __init__( google.api_core.exceptions.DuplicateCredentialArgs: If both ``credentials`` and ``credentials_file`` are passed. """ + self._grpc_channel = None self._ssl_channel_credentials = ssl_channel_credentials + self._stubs: Dict[str, Callable] = {} if api_mtls_endpoint: warnings.warn("api_mtls_endpoint is deprecated", DeprecationWarning) @@ -114,70 +116,50 @@ def __init__( warnings.warn("client_cert_source is deprecated", DeprecationWarning) if channel: - # Sanity check: Ensure that channel and credentials are not both - # provided. + # Ignore credentials if a channel was passed. credentials = False - # If a channel was explicitly provided, set it. self._grpc_channel = channel self._ssl_channel_credentials = None - 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, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - self._ssl_channel_credentials = ssl_credentials else: - host = host if ":" in host else host + ":443" + if api_mtls_endpoint: + host = api_mtls_endpoint + + # Create SSL credentials with client_cert_source or application + # default SSL credentials. + if client_cert_source: + cert, key = client_cert_source() + self._ssl_channel_credentials = grpc.ssl_channel_credentials( + certificate_chain=cert, private_key=key + ) + else: + self._ssl_channel_credentials = SslCredentials().ssl_credentials - if credentials is None: - credentials, _ = auth.default( - scopes=self.AUTH_SCOPES, quota_project_id=quota_project_id - ) + else: + if client_cert_source_for_mtls and not ssl_channel_credentials: + cert, key = client_cert_source_for_mtls() + self._ssl_channel_credentials = grpc.ssl_channel_credentials( + certificate_chain=cert, private_key=key + ) - if client_cert_source_for_mtls and not ssl_channel_credentials: - cert, key = client_cert_source_for_mtls() - self._ssl_channel_credentials = grpc.ssl_channel_credentials( - certificate_chain=cert, private_key=key - ) + # The base transport sets the host, credentials and scopes + super().__init__( + host=host, + credentials=credentials, + credentials_file=credentials_file, + scopes=scopes, + quota_project_id=quota_project_id, + client_info=client_info, + ) - # create a new channel. The provided one is ignored. + if not self._grpc_channel: self._grpc_channel = type(self).create_channel( - host, - credentials=credentials, + self._host, + credentials=self._credentials, credentials_file=credentials_file, + scopes=self._scopes, ssl_credentials=self._ssl_channel_credentials, - scopes=scopes or self.AUTH_SCOPES, quota_project_id=quota_project_id, options=[ ("grpc.max_send_message_length", -1), @@ -185,17 +167,8 @@ def __init__( ], ) - 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, - client_info=client_info, - ) + # Wrap messages. This must be done after self._grpc_channel exists + self._prep_wrapped_messages(client_info) @classmethod def create_channel( @@ -209,7 +182,7 @@ def create_channel( ) -> grpc.Channel: """Create and return a gRPC channel object. Args: - address (Optional[str]): The host for the channel to use. + host (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 diff --git a/google/cloud/talent_v4/services/completion/transports/grpc_asyncio.py b/google/cloud/talent_v4/services/completion/transports/grpc_asyncio.py index 55e7b2d2..d23bd831 100644 --- a/google/cloud/talent_v4/services/completion/transports/grpc_asyncio.py +++ b/google/cloud/talent_v4/services/completion/transports/grpc_asyncio.py @@ -61,7 +61,7 @@ def create_channel( ) -> aio.Channel: """Create and return a gRPC AsyncIO channel object. Args: - address (Optional[str]): The host for the channel to use. + host (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 @@ -139,10 +139,10 @@ def __init__( ignored if ``channel`` or ``ssl_channel_credentials`` is provided. quota_project_id (Optional[str]): An optional project to use for billing and quota. - 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 + 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. Raises: @@ -151,7 +151,9 @@ def __init__( google.api_core.exceptions.DuplicateCredentialArgs: If both ``credentials`` and ``credentials_file`` are passed. """ + self._grpc_channel = None self._ssl_channel_credentials = ssl_channel_credentials + self._stubs: Dict[str, Callable] = {} if api_mtls_endpoint: warnings.warn("api_mtls_endpoint is deprecated", DeprecationWarning) @@ -159,70 +161,50 @@ def __init__( warnings.warn("client_cert_source is deprecated", DeprecationWarning) if channel: - # Sanity check: Ensure that channel and credentials are not both - # provided. + # Ignore credentials if a channel was passed. credentials = False - # If a channel was explicitly provided, set it. self._grpc_channel = channel self._ssl_channel_credentials = None - 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, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - self._ssl_channel_credentials = ssl_credentials else: - host = host if ":" in host else host + ":443" + if api_mtls_endpoint: + host = api_mtls_endpoint + + # Create SSL credentials with client_cert_source or application + # default SSL credentials. + if client_cert_source: + cert, key = client_cert_source() + self._ssl_channel_credentials = grpc.ssl_channel_credentials( + certificate_chain=cert, private_key=key + ) + else: + self._ssl_channel_credentials = SslCredentials().ssl_credentials - if credentials is None: - credentials, _ = auth.default( - scopes=self.AUTH_SCOPES, quota_project_id=quota_project_id - ) + else: + if client_cert_source_for_mtls and not ssl_channel_credentials: + cert, key = client_cert_source_for_mtls() + self._ssl_channel_credentials = grpc.ssl_channel_credentials( + certificate_chain=cert, private_key=key + ) - if client_cert_source_for_mtls and not ssl_channel_credentials: - cert, key = client_cert_source_for_mtls() - self._ssl_channel_credentials = grpc.ssl_channel_credentials( - certificate_chain=cert, private_key=key - ) + # The base transport sets the host, credentials and scopes + super().__init__( + host=host, + credentials=credentials, + credentials_file=credentials_file, + scopes=scopes, + quota_project_id=quota_project_id, + client_info=client_info, + ) - # create a new channel. The provided one is ignored. + if not self._grpc_channel: self._grpc_channel = type(self).create_channel( - host, - credentials=credentials, + self._host, + credentials=self._credentials, credentials_file=credentials_file, + scopes=self._scopes, ssl_credentials=self._ssl_channel_credentials, - scopes=scopes or self.AUTH_SCOPES, quota_project_id=quota_project_id, options=[ ("grpc.max_send_message_length", -1), @@ -230,17 +212,8 @@ def __init__( ], ) - # 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, - client_info=client_info, - ) - - self._stubs = {} + # Wrap messages. This must be done after self._grpc_channel exists + self._prep_wrapped_messages(client_info) @property def grpc_channel(self) -> aio.Channel: diff --git a/google/cloud/talent_v4/services/event_service/transports/base.py b/google/cloud/talent_v4/services/event_service/transports/base.py index 88f54bbc..5f0f004d 100644 --- a/google/cloud/talent_v4/services/event_service/transports/base.py +++ b/google/cloud/talent_v4/services/event_service/transports/base.py @@ -71,10 +71,10 @@ def __init__( scope (Optional[Sequence[str]]): A list of scopes. quota_project_id (Optional[str]): An optional project to use for billing and quota. - 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 + 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. """ # Save the hostname. Default to port 443 (HTTPS) if none is specified. @@ -82,6 +82,9 @@ def __init__( host += ":443" self._host = host + # Save the scopes. + self._scopes = scopes or self.AUTH_SCOPES + # If no credentials are provided, then determine the appropriate # defaults. if credentials and credentials_file: @@ -91,20 +94,17 @@ def __init__( if credentials_file is not None: credentials, _ = auth.load_credentials_from_file( - credentials_file, scopes=scopes, quota_project_id=quota_project_id + credentials_file, scopes=self._scopes, quota_project_id=quota_project_id ) elif credentials is None: credentials, _ = auth.default( - scopes=scopes, quota_project_id=quota_project_id + scopes=self._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(client_info) - def _prep_wrapped_messages(self, client_info): # Precompute the wrapped methods. self._wrapped_methods = { diff --git a/google/cloud/talent_v4/services/event_service/transports/grpc.py b/google/cloud/talent_v4/services/event_service/transports/grpc.py index e5616e86..05c80ebc 100644 --- a/google/cloud/talent_v4/services/event_service/transports/grpc.py +++ b/google/cloud/talent_v4/services/event_service/transports/grpc.py @@ -107,7 +107,9 @@ def __init__( google.api_core.exceptions.DuplicateCredentialArgs: If both ``credentials`` and ``credentials_file`` are passed. """ + self._grpc_channel = None self._ssl_channel_credentials = ssl_channel_credentials + self._stubs: Dict[str, Callable] = {} if api_mtls_endpoint: warnings.warn("api_mtls_endpoint is deprecated", DeprecationWarning) @@ -115,70 +117,50 @@ def __init__( warnings.warn("client_cert_source is deprecated", DeprecationWarning) if channel: - # Sanity check: Ensure that channel and credentials are not both - # provided. + # Ignore credentials if a channel was passed. credentials = False - # If a channel was explicitly provided, set it. self._grpc_channel = channel self._ssl_channel_credentials = None - 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, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - self._ssl_channel_credentials = ssl_credentials else: - host = host if ":" in host else host + ":443" + if api_mtls_endpoint: + host = api_mtls_endpoint + + # Create SSL credentials with client_cert_source or application + # default SSL credentials. + if client_cert_source: + cert, key = client_cert_source() + self._ssl_channel_credentials = grpc.ssl_channel_credentials( + certificate_chain=cert, private_key=key + ) + else: + self._ssl_channel_credentials = SslCredentials().ssl_credentials - if credentials is None: - credentials, _ = auth.default( - scopes=self.AUTH_SCOPES, quota_project_id=quota_project_id - ) + else: + if client_cert_source_for_mtls and not ssl_channel_credentials: + cert, key = client_cert_source_for_mtls() + self._ssl_channel_credentials = grpc.ssl_channel_credentials( + certificate_chain=cert, private_key=key + ) - if client_cert_source_for_mtls and not ssl_channel_credentials: - cert, key = client_cert_source_for_mtls() - self._ssl_channel_credentials = grpc.ssl_channel_credentials( - certificate_chain=cert, private_key=key - ) + # The base transport sets the host, credentials and scopes + super().__init__( + host=host, + credentials=credentials, + credentials_file=credentials_file, + scopes=scopes, + quota_project_id=quota_project_id, + client_info=client_info, + ) - # create a new channel. The provided one is ignored. + if not self._grpc_channel: self._grpc_channel = type(self).create_channel( - host, - credentials=credentials, + self._host, + credentials=self._credentials, credentials_file=credentials_file, + scopes=self._scopes, ssl_credentials=self._ssl_channel_credentials, - scopes=scopes or self.AUTH_SCOPES, quota_project_id=quota_project_id, options=[ ("grpc.max_send_message_length", -1), @@ -186,17 +168,8 @@ def __init__( ], ) - 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, - client_info=client_info, - ) + # Wrap messages. This must be done after self._grpc_channel exists + self._prep_wrapped_messages(client_info) @classmethod def create_channel( @@ -210,7 +183,7 @@ def create_channel( ) -> grpc.Channel: """Create and return a gRPC channel object. Args: - address (Optional[str]): The host for the channel to use. + host (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 diff --git a/google/cloud/talent_v4/services/event_service/transports/grpc_asyncio.py b/google/cloud/talent_v4/services/event_service/transports/grpc_asyncio.py index b2e23888..302f0083 100644 --- a/google/cloud/talent_v4/services/event_service/transports/grpc_asyncio.py +++ b/google/cloud/talent_v4/services/event_service/transports/grpc_asyncio.py @@ -62,7 +62,7 @@ def create_channel( ) -> aio.Channel: """Create and return a gRPC AsyncIO channel object. Args: - address (Optional[str]): The host for the channel to use. + host (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 @@ -140,10 +140,10 @@ def __init__( ignored if ``channel`` or ``ssl_channel_credentials`` is provided. quota_project_id (Optional[str]): An optional project to use for billing and quota. - 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 + 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. Raises: @@ -152,7 +152,9 @@ def __init__( google.api_core.exceptions.DuplicateCredentialArgs: If both ``credentials`` and ``credentials_file`` are passed. """ + self._grpc_channel = None self._ssl_channel_credentials = ssl_channel_credentials + self._stubs: Dict[str, Callable] = {} if api_mtls_endpoint: warnings.warn("api_mtls_endpoint is deprecated", DeprecationWarning) @@ -160,70 +162,50 @@ def __init__( warnings.warn("client_cert_source is deprecated", DeprecationWarning) if channel: - # Sanity check: Ensure that channel and credentials are not both - # provided. + # Ignore credentials if a channel was passed. credentials = False - # If a channel was explicitly provided, set it. self._grpc_channel = channel self._ssl_channel_credentials = None - 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, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - self._ssl_channel_credentials = ssl_credentials else: - host = host if ":" in host else host + ":443" + if api_mtls_endpoint: + host = api_mtls_endpoint + + # Create SSL credentials with client_cert_source or application + # default SSL credentials. + if client_cert_source: + cert, key = client_cert_source() + self._ssl_channel_credentials = grpc.ssl_channel_credentials( + certificate_chain=cert, private_key=key + ) + else: + self._ssl_channel_credentials = SslCredentials().ssl_credentials - if credentials is None: - credentials, _ = auth.default( - scopes=self.AUTH_SCOPES, quota_project_id=quota_project_id - ) + else: + if client_cert_source_for_mtls and not ssl_channel_credentials: + cert, key = client_cert_source_for_mtls() + self._ssl_channel_credentials = grpc.ssl_channel_credentials( + certificate_chain=cert, private_key=key + ) - if client_cert_source_for_mtls and not ssl_channel_credentials: - cert, key = client_cert_source_for_mtls() - self._ssl_channel_credentials = grpc.ssl_channel_credentials( - certificate_chain=cert, private_key=key - ) + # The base transport sets the host, credentials and scopes + super().__init__( + host=host, + credentials=credentials, + credentials_file=credentials_file, + scopes=scopes, + quota_project_id=quota_project_id, + client_info=client_info, + ) - # create a new channel. The provided one is ignored. + if not self._grpc_channel: self._grpc_channel = type(self).create_channel( - host, - credentials=credentials, + self._host, + credentials=self._credentials, credentials_file=credentials_file, + scopes=self._scopes, ssl_credentials=self._ssl_channel_credentials, - scopes=scopes or self.AUTH_SCOPES, quota_project_id=quota_project_id, options=[ ("grpc.max_send_message_length", -1), @@ -231,17 +213,8 @@ def __init__( ], ) - # 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, - client_info=client_info, - ) - - self._stubs = {} + # Wrap messages. This must be done after self._grpc_channel exists + self._prep_wrapped_messages(client_info) @property def grpc_channel(self) -> aio.Channel: diff --git a/google/cloud/talent_v4/services/job_service/async_client.py b/google/cloud/talent_v4/services/job_service/async_client.py index 1ccef521..06bee535 100644 --- a/google/cloud/talent_v4/services/job_service/async_client.py +++ b/google/cloud/talent_v4/services/job_service/async_client.py @@ -434,6 +434,7 @@ async def get_job( predicate=retries.if_exception_type( exceptions.DeadlineExceeded, exceptions.ServiceUnavailable, ), + deadline=30.0, ), default_timeout=30.0, client_info=DEFAULT_CLIENT_INFO, @@ -707,6 +708,7 @@ async def delete_job( predicate=retries.if_exception_type( exceptions.DeadlineExceeded, exceptions.ServiceUnavailable, ), + deadline=30.0, ), default_timeout=30.0, client_info=DEFAULT_CLIENT_INFO, @@ -929,6 +931,7 @@ async def list_jobs( predicate=retries.if_exception_type( exceptions.DeadlineExceeded, exceptions.ServiceUnavailable, ), + deadline=30.0, ), default_timeout=30.0, client_info=DEFAULT_CLIENT_INFO, diff --git a/google/cloud/talent_v4/services/job_service/transports/base.py b/google/cloud/talent_v4/services/job_service/transports/base.py index 37a4781f..97429e5b 100644 --- a/google/cloud/talent_v4/services/job_service/transports/base.py +++ b/google/cloud/talent_v4/services/job_service/transports/base.py @@ -75,10 +75,10 @@ def __init__( scope (Optional[Sequence[str]]): A list of scopes. quota_project_id (Optional[str]): An optional project to use for billing and quota. - 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 + 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. """ # Save the hostname. Default to port 443 (HTTPS) if none is specified. @@ -86,6 +86,9 @@ def __init__( host += ":443" self._host = host + # Save the scopes. + self._scopes = scopes or self.AUTH_SCOPES + # If no credentials are provided, then determine the appropriate # defaults. if credentials and credentials_file: @@ -95,20 +98,17 @@ def __init__( if credentials_file is not None: credentials, _ = auth.load_credentials_from_file( - credentials_file, scopes=scopes, quota_project_id=quota_project_id + credentials_file, scopes=self._scopes, quota_project_id=quota_project_id ) elif credentials is None: credentials, _ = auth.default( - scopes=scopes, quota_project_id=quota_project_id + scopes=self._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(client_info) - def _prep_wrapped_messages(self, client_info): # Precompute the wrapped methods. self._wrapped_methods = { @@ -127,6 +127,7 @@ def _prep_wrapped_messages(self, client_info): predicate=retries.if_exception_type( exceptions.DeadlineExceeded, exceptions.ServiceUnavailable, ), + deadline=30.0, ), default_timeout=30.0, client_info=client_info, @@ -146,6 +147,7 @@ def _prep_wrapped_messages(self, client_info): predicate=retries.if_exception_type( exceptions.DeadlineExceeded, exceptions.ServiceUnavailable, ), + deadline=30.0, ), default_timeout=30.0, client_info=client_info, @@ -162,6 +164,7 @@ def _prep_wrapped_messages(self, client_info): predicate=retries.if_exception_type( exceptions.DeadlineExceeded, exceptions.ServiceUnavailable, ), + deadline=30.0, ), default_timeout=30.0, client_info=client_info, diff --git a/google/cloud/talent_v4/services/job_service/transports/grpc.py b/google/cloud/talent_v4/services/job_service/transports/grpc.py index 03d4cf1b..d80e73f4 100644 --- a/google/cloud/talent_v4/services/job_service/transports/grpc.py +++ b/google/cloud/talent_v4/services/job_service/transports/grpc.py @@ -112,7 +112,10 @@ def __init__( google.api_core.exceptions.DuplicateCredentialArgs: If both ``credentials`` and ``credentials_file`` are passed. """ + self._grpc_channel = None self._ssl_channel_credentials = ssl_channel_credentials + self._stubs: Dict[str, Callable] = {} + self._operations_client = None if api_mtls_endpoint: warnings.warn("api_mtls_endpoint is deprecated", DeprecationWarning) @@ -120,70 +123,50 @@ def __init__( warnings.warn("client_cert_source is deprecated", DeprecationWarning) if channel: - # Sanity check: Ensure that channel and credentials are not both - # provided. + # Ignore credentials if a channel was passed. credentials = False - # If a channel was explicitly provided, set it. self._grpc_channel = channel self._ssl_channel_credentials = None - 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, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - self._ssl_channel_credentials = ssl_credentials else: - host = host if ":" in host else host + ":443" + if api_mtls_endpoint: + host = api_mtls_endpoint + + # Create SSL credentials with client_cert_source or application + # default SSL credentials. + if client_cert_source: + cert, key = client_cert_source() + self._ssl_channel_credentials = grpc.ssl_channel_credentials( + certificate_chain=cert, private_key=key + ) + else: + self._ssl_channel_credentials = SslCredentials().ssl_credentials - if credentials is None: - credentials, _ = auth.default( - scopes=self.AUTH_SCOPES, quota_project_id=quota_project_id - ) + else: + if client_cert_source_for_mtls and not ssl_channel_credentials: + cert, key = client_cert_source_for_mtls() + self._ssl_channel_credentials = grpc.ssl_channel_credentials( + certificate_chain=cert, private_key=key + ) - if client_cert_source_for_mtls and not ssl_channel_credentials: - cert, key = client_cert_source_for_mtls() - self._ssl_channel_credentials = grpc.ssl_channel_credentials( - certificate_chain=cert, private_key=key - ) + # The base transport sets the host, credentials and scopes + super().__init__( + host=host, + credentials=credentials, + credentials_file=credentials_file, + scopes=scopes, + quota_project_id=quota_project_id, + client_info=client_info, + ) - # create a new channel. The provided one is ignored. + if not self._grpc_channel: self._grpc_channel = type(self).create_channel( - host, - credentials=credentials, + self._host, + credentials=self._credentials, credentials_file=credentials_file, + scopes=self._scopes, ssl_credentials=self._ssl_channel_credentials, - scopes=scopes or self.AUTH_SCOPES, quota_project_id=quota_project_id, options=[ ("grpc.max_send_message_length", -1), @@ -191,18 +174,8 @@ def __init__( ], ) - self._stubs = {} # type: Dict[str, Callable] - self._operations_client = None - - # 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, - client_info=client_info, - ) + # Wrap messages. This must be done after self._grpc_channel exists + self._prep_wrapped_messages(client_info) @classmethod def create_channel( @@ -216,7 +189,7 @@ def create_channel( ) -> grpc.Channel: """Create and return a gRPC channel object. Args: - address (Optional[str]): The host for the channel to use. + host (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 diff --git a/google/cloud/talent_v4/services/job_service/transports/grpc_asyncio.py b/google/cloud/talent_v4/services/job_service/transports/grpc_asyncio.py index b0c78c50..599527c8 100644 --- a/google/cloud/talent_v4/services/job_service/transports/grpc_asyncio.py +++ b/google/cloud/talent_v4/services/job_service/transports/grpc_asyncio.py @@ -67,7 +67,7 @@ def create_channel( ) -> aio.Channel: """Create and return a gRPC AsyncIO channel object. Args: - address (Optional[str]): The host for the channel to use. + host (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 @@ -145,10 +145,10 @@ def __init__( ignored if ``channel`` or ``ssl_channel_credentials`` is provided. quota_project_id (Optional[str]): An optional project to use for billing and quota. - 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 + 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. Raises: @@ -157,7 +157,10 @@ def __init__( google.api_core.exceptions.DuplicateCredentialArgs: If both ``credentials`` and ``credentials_file`` are passed. """ + self._grpc_channel = None self._ssl_channel_credentials = ssl_channel_credentials + self._stubs: Dict[str, Callable] = {} + self._operations_client = None if api_mtls_endpoint: warnings.warn("api_mtls_endpoint is deprecated", DeprecationWarning) @@ -165,70 +168,50 @@ def __init__( warnings.warn("client_cert_source is deprecated", DeprecationWarning) if channel: - # Sanity check: Ensure that channel and credentials are not both - # provided. + # Ignore credentials if a channel was passed. credentials = False - # If a channel was explicitly provided, set it. self._grpc_channel = channel self._ssl_channel_credentials = None - 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, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - self._ssl_channel_credentials = ssl_credentials else: - host = host if ":" in host else host + ":443" + if api_mtls_endpoint: + host = api_mtls_endpoint + + # Create SSL credentials with client_cert_source or application + # default SSL credentials. + if client_cert_source: + cert, key = client_cert_source() + self._ssl_channel_credentials = grpc.ssl_channel_credentials( + certificate_chain=cert, private_key=key + ) + else: + self._ssl_channel_credentials = SslCredentials().ssl_credentials - if credentials is None: - credentials, _ = auth.default( - scopes=self.AUTH_SCOPES, quota_project_id=quota_project_id - ) + else: + if client_cert_source_for_mtls and not ssl_channel_credentials: + cert, key = client_cert_source_for_mtls() + self._ssl_channel_credentials = grpc.ssl_channel_credentials( + certificate_chain=cert, private_key=key + ) - if client_cert_source_for_mtls and not ssl_channel_credentials: - cert, key = client_cert_source_for_mtls() - self._ssl_channel_credentials = grpc.ssl_channel_credentials( - certificate_chain=cert, private_key=key - ) + # The base transport sets the host, credentials and scopes + super().__init__( + host=host, + credentials=credentials, + credentials_file=credentials_file, + scopes=scopes, + quota_project_id=quota_project_id, + client_info=client_info, + ) - # create a new channel. The provided one is ignored. + if not self._grpc_channel: self._grpc_channel = type(self).create_channel( - host, - credentials=credentials, + self._host, + credentials=self._credentials, credentials_file=credentials_file, + scopes=self._scopes, ssl_credentials=self._ssl_channel_credentials, - scopes=scopes or self.AUTH_SCOPES, quota_project_id=quota_project_id, options=[ ("grpc.max_send_message_length", -1), @@ -236,18 +219,8 @@ def __init__( ], ) - # 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, - client_info=client_info, - ) - - self._stubs = {} - self._operations_client = None + # Wrap messages. This must be done after self._grpc_channel exists + self._prep_wrapped_messages(client_info) @property def grpc_channel(self) -> aio.Channel: diff --git a/google/cloud/talent_v4/services/tenant_service/async_client.py b/google/cloud/talent_v4/services/tenant_service/async_client.py index 548d95f1..51ebcab7 100644 --- a/google/cloud/talent_v4/services/tenant_service/async_client.py +++ b/google/cloud/talent_v4/services/tenant_service/async_client.py @@ -336,6 +336,7 @@ async def get_tenant( predicate=retries.if_exception_type( exceptions.DeadlineExceeded, exceptions.ServiceUnavailable, ), + deadline=30.0, ), default_timeout=30.0, client_info=DEFAULT_CLIENT_INFO, @@ -513,6 +514,7 @@ async def delete_tenant( predicate=retries.if_exception_type( exceptions.DeadlineExceeded, exceptions.ServiceUnavailable, ), + deadline=30.0, ), default_timeout=30.0, client_info=DEFAULT_CLIENT_INFO, @@ -598,6 +600,7 @@ async def list_tenants( predicate=retries.if_exception_type( exceptions.DeadlineExceeded, exceptions.ServiceUnavailable, ), + deadline=30.0, ), default_timeout=30.0, client_info=DEFAULT_CLIENT_INFO, diff --git a/google/cloud/talent_v4/services/tenant_service/transports/base.py b/google/cloud/talent_v4/services/tenant_service/transports/base.py index dee8e4f0..c921d237 100644 --- a/google/cloud/talent_v4/services/tenant_service/transports/base.py +++ b/google/cloud/talent_v4/services/tenant_service/transports/base.py @@ -73,10 +73,10 @@ def __init__( scope (Optional[Sequence[str]]): A list of scopes. quota_project_id (Optional[str]): An optional project to use for billing and quota. - 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 + 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. """ # Save the hostname. Default to port 443 (HTTPS) if none is specified. @@ -84,6 +84,9 @@ def __init__( host += ":443" self._host = host + # Save the scopes. + self._scopes = scopes or self.AUTH_SCOPES + # If no credentials are provided, then determine the appropriate # defaults. if credentials and credentials_file: @@ -93,20 +96,17 @@ def __init__( if credentials_file is not None: credentials, _ = auth.load_credentials_from_file( - credentials_file, scopes=scopes, quota_project_id=quota_project_id + credentials_file, scopes=self._scopes, quota_project_id=quota_project_id ) elif credentials is None: credentials, _ = auth.default( - scopes=scopes, quota_project_id=quota_project_id + scopes=self._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(client_info) - def _prep_wrapped_messages(self, client_info): # Precompute the wrapped methods. self._wrapped_methods = { @@ -122,6 +122,7 @@ def _prep_wrapped_messages(self, client_info): predicate=retries.if_exception_type( exceptions.DeadlineExceeded, exceptions.ServiceUnavailable, ), + deadline=30.0, ), default_timeout=30.0, client_info=client_info, @@ -138,6 +139,7 @@ def _prep_wrapped_messages(self, client_info): predicate=retries.if_exception_type( exceptions.DeadlineExceeded, exceptions.ServiceUnavailable, ), + deadline=30.0, ), default_timeout=30.0, client_info=client_info, @@ -151,6 +153,7 @@ def _prep_wrapped_messages(self, client_info): predicate=retries.if_exception_type( exceptions.DeadlineExceeded, exceptions.ServiceUnavailable, ), + deadline=30.0, ), default_timeout=30.0, client_info=client_info, diff --git a/google/cloud/talent_v4/services/tenant_service/transports/grpc.py b/google/cloud/talent_v4/services/tenant_service/transports/grpc.py index 5810ba35..d837f65e 100644 --- a/google/cloud/talent_v4/services/tenant_service/transports/grpc.py +++ b/google/cloud/talent_v4/services/tenant_service/transports/grpc.py @@ -110,7 +110,9 @@ def __init__( google.api_core.exceptions.DuplicateCredentialArgs: If both ``credentials`` and ``credentials_file`` are passed. """ + self._grpc_channel = None self._ssl_channel_credentials = ssl_channel_credentials + self._stubs: Dict[str, Callable] = {} if api_mtls_endpoint: warnings.warn("api_mtls_endpoint is deprecated", DeprecationWarning) @@ -118,70 +120,50 @@ def __init__( warnings.warn("client_cert_source is deprecated", DeprecationWarning) if channel: - # Sanity check: Ensure that channel and credentials are not both - # provided. + # Ignore credentials if a channel was passed. credentials = False - # If a channel was explicitly provided, set it. self._grpc_channel = channel self._ssl_channel_credentials = None - 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, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - self._ssl_channel_credentials = ssl_credentials else: - host = host if ":" in host else host + ":443" + if api_mtls_endpoint: + host = api_mtls_endpoint + + # Create SSL credentials with client_cert_source or application + # default SSL credentials. + if client_cert_source: + cert, key = client_cert_source() + self._ssl_channel_credentials = grpc.ssl_channel_credentials( + certificate_chain=cert, private_key=key + ) + else: + self._ssl_channel_credentials = SslCredentials().ssl_credentials - if credentials is None: - credentials, _ = auth.default( - scopes=self.AUTH_SCOPES, quota_project_id=quota_project_id - ) + else: + if client_cert_source_for_mtls and not ssl_channel_credentials: + cert, key = client_cert_source_for_mtls() + self._ssl_channel_credentials = grpc.ssl_channel_credentials( + certificate_chain=cert, private_key=key + ) - if client_cert_source_for_mtls and not ssl_channel_credentials: - cert, key = client_cert_source_for_mtls() - self._ssl_channel_credentials = grpc.ssl_channel_credentials( - certificate_chain=cert, private_key=key - ) + # The base transport sets the host, credentials and scopes + super().__init__( + host=host, + credentials=credentials, + credentials_file=credentials_file, + scopes=scopes, + quota_project_id=quota_project_id, + client_info=client_info, + ) - # create a new channel. The provided one is ignored. + if not self._grpc_channel: self._grpc_channel = type(self).create_channel( - host, - credentials=credentials, + self._host, + credentials=self._credentials, credentials_file=credentials_file, + scopes=self._scopes, ssl_credentials=self._ssl_channel_credentials, - scopes=scopes or self.AUTH_SCOPES, quota_project_id=quota_project_id, options=[ ("grpc.max_send_message_length", -1), @@ -189,17 +171,8 @@ def __init__( ], ) - 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, - client_info=client_info, - ) + # Wrap messages. This must be done after self._grpc_channel exists + self._prep_wrapped_messages(client_info) @classmethod def create_channel( @@ -213,7 +186,7 @@ def create_channel( ) -> grpc.Channel: """Create and return a gRPC channel object. Args: - address (Optional[str]): The host for the channel to use. + host (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 diff --git a/google/cloud/talent_v4/services/tenant_service/transports/grpc_asyncio.py b/google/cloud/talent_v4/services/tenant_service/transports/grpc_asyncio.py index 25168282..072a50dc 100644 --- a/google/cloud/talent_v4/services/tenant_service/transports/grpc_asyncio.py +++ b/google/cloud/talent_v4/services/tenant_service/transports/grpc_asyncio.py @@ -65,7 +65,7 @@ def create_channel( ) -> aio.Channel: """Create and return a gRPC AsyncIO channel object. Args: - address (Optional[str]): The host for the channel to use. + host (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 @@ -143,10 +143,10 @@ def __init__( ignored if ``channel`` or ``ssl_channel_credentials`` is provided. quota_project_id (Optional[str]): An optional project to use for billing and quota. - 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 + 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. Raises: @@ -155,7 +155,9 @@ def __init__( google.api_core.exceptions.DuplicateCredentialArgs: If both ``credentials`` and ``credentials_file`` are passed. """ + self._grpc_channel = None self._ssl_channel_credentials = ssl_channel_credentials + self._stubs: Dict[str, Callable] = {} if api_mtls_endpoint: warnings.warn("api_mtls_endpoint is deprecated", DeprecationWarning) @@ -163,70 +165,50 @@ def __init__( warnings.warn("client_cert_source is deprecated", DeprecationWarning) if channel: - # Sanity check: Ensure that channel and credentials are not both - # provided. + # Ignore credentials if a channel was passed. credentials = False - # If a channel was explicitly provided, set it. self._grpc_channel = channel self._ssl_channel_credentials = None - 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, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - self._ssl_channel_credentials = ssl_credentials else: - host = host if ":" in host else host + ":443" + if api_mtls_endpoint: + host = api_mtls_endpoint + + # Create SSL credentials with client_cert_source or application + # default SSL credentials. + if client_cert_source: + cert, key = client_cert_source() + self._ssl_channel_credentials = grpc.ssl_channel_credentials( + certificate_chain=cert, private_key=key + ) + else: + self._ssl_channel_credentials = SslCredentials().ssl_credentials - if credentials is None: - credentials, _ = auth.default( - scopes=self.AUTH_SCOPES, quota_project_id=quota_project_id - ) + else: + if client_cert_source_for_mtls and not ssl_channel_credentials: + cert, key = client_cert_source_for_mtls() + self._ssl_channel_credentials = grpc.ssl_channel_credentials( + certificate_chain=cert, private_key=key + ) - if client_cert_source_for_mtls and not ssl_channel_credentials: - cert, key = client_cert_source_for_mtls() - self._ssl_channel_credentials = grpc.ssl_channel_credentials( - certificate_chain=cert, private_key=key - ) + # The base transport sets the host, credentials and scopes + super().__init__( + host=host, + credentials=credentials, + credentials_file=credentials_file, + scopes=scopes, + quota_project_id=quota_project_id, + client_info=client_info, + ) - # create a new channel. The provided one is ignored. + if not self._grpc_channel: self._grpc_channel = type(self).create_channel( - host, - credentials=credentials, + self._host, + credentials=self._credentials, credentials_file=credentials_file, + scopes=self._scopes, ssl_credentials=self._ssl_channel_credentials, - scopes=scopes or self.AUTH_SCOPES, quota_project_id=quota_project_id, options=[ ("grpc.max_send_message_length", -1), @@ -234,17 +216,8 @@ def __init__( ], ) - # 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, - client_info=client_info, - ) - - self._stubs = {} + # Wrap messages. This must be done after self._grpc_channel exists + self._prep_wrapped_messages(client_info) @property def grpc_channel(self) -> aio.Channel: diff --git a/google/cloud/talent_v4/types/common.py b/google/cloud/talent_v4/types/common.py index 90e92333..6acd7469 100644 --- a/google/cloud/talent_v4/types/common.py +++ b/google/cloud/talent_v4/types/common.py @@ -178,6 +178,7 @@ 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. """ + _pb_options = {"deprecated": True} VISIBILITY_UNSPECIFIED = 0 ACCOUNT_ONLY = 1 SHARED_WITH_GOOGLE = 2 diff --git a/google/cloud/talent_v4beta1/__init__.py b/google/cloud/talent_v4beta1/__init__.py index b751ef4a..9494115b 100644 --- a/google/cloud/talent_v4beta1/__init__.py +++ b/google/cloud/talent_v4beta1/__init__.py @@ -143,7 +143,6 @@ "ApplicationDateFilter", "ApplicationJobFilter", "ApplicationOutcomeNotesFilter", - "ApplicationServiceClient", "AvailabilityFilter", "AvailabilitySignal", "AvailabilitySignalType", @@ -203,6 +202,7 @@ "JobLevel", "JobOperationResult", "JobQuery", + "JobServiceClient", "JobTitleFilter", "JobView", "ListApplicationsRequest", @@ -253,5 +253,5 @@ "UpdateTenantRequest", "Visibility", "WorkExperienceFilter", - "JobServiceClient", + "ApplicationServiceClient", ) diff --git a/google/cloud/talent_v4beta1/services/application_service/async_client.py b/google/cloud/talent_v4beta1/services/application_service/async_client.py index c08bc95b..6c6bb683 100644 --- a/google/cloud/talent_v4beta1/services/application_service/async_client.py +++ b/google/cloud/talent_v4beta1/services/application_service/async_client.py @@ -342,6 +342,7 @@ async def get_application( predicate=retries.if_exception_type( exceptions.DeadlineExceeded, exceptions.ServiceUnavailable, ), + deadline=30.0, ), default_timeout=30.0, client_info=DEFAULT_CLIENT_INFO, @@ -497,6 +498,7 @@ async def delete_application( predicate=retries.if_exception_type( exceptions.DeadlineExceeded, exceptions.ServiceUnavailable, ), + deadline=30.0, ), default_timeout=30.0, client_info=DEFAULT_CLIENT_INFO, @@ -584,6 +586,7 @@ async def list_applications( predicate=retries.if_exception_type( exceptions.DeadlineExceeded, exceptions.ServiceUnavailable, ), + deadline=30.0, ), default_timeout=30.0, client_info=DEFAULT_CLIENT_INFO, diff --git a/google/cloud/talent_v4beta1/services/application_service/transports/base.py b/google/cloud/talent_v4beta1/services/application_service/transports/base.py index 83ba6405..9667920d 100644 --- a/google/cloud/talent_v4beta1/services/application_service/transports/base.py +++ b/google/cloud/talent_v4beta1/services/application_service/transports/base.py @@ -73,10 +73,10 @@ def __init__( scope (Optional[Sequence[str]]): A list of scopes. quota_project_id (Optional[str]): An optional project to use for billing and quota. - 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 + 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. """ # Save the hostname. Default to port 443 (HTTPS) if none is specified. @@ -84,6 +84,9 @@ def __init__( host += ":443" self._host = host + # Save the scopes. + self._scopes = scopes or self.AUTH_SCOPES + # If no credentials are provided, then determine the appropriate # defaults. if credentials and credentials_file: @@ -93,20 +96,17 @@ def __init__( if credentials_file is not None: credentials, _ = auth.load_credentials_from_file( - credentials_file, scopes=scopes, quota_project_id=quota_project_id + credentials_file, scopes=self._scopes, quota_project_id=quota_project_id ) elif credentials is None: credentials, _ = auth.default( - scopes=scopes, quota_project_id=quota_project_id + scopes=self._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(client_info) - def _prep_wrapped_messages(self, client_info): # Precompute the wrapped methods. self._wrapped_methods = { @@ -122,6 +122,7 @@ def _prep_wrapped_messages(self, client_info): predicate=retries.if_exception_type( exceptions.DeadlineExceeded, exceptions.ServiceUnavailable, ), + deadline=30.0, ), default_timeout=30.0, client_info=client_info, @@ -138,6 +139,7 @@ def _prep_wrapped_messages(self, client_info): predicate=retries.if_exception_type( exceptions.DeadlineExceeded, exceptions.ServiceUnavailable, ), + deadline=30.0, ), default_timeout=30.0, client_info=client_info, @@ -151,6 +153,7 @@ def _prep_wrapped_messages(self, client_info): predicate=retries.if_exception_type( exceptions.DeadlineExceeded, exceptions.ServiceUnavailable, ), + deadline=30.0, ), default_timeout=30.0, client_info=client_info, diff --git a/google/cloud/talent_v4beta1/services/application_service/transports/grpc.py b/google/cloud/talent_v4beta1/services/application_service/transports/grpc.py index bc852dc5..e47f721b 100644 --- a/google/cloud/talent_v4beta1/services/application_service/transports/grpc.py +++ b/google/cloud/talent_v4beta1/services/application_service/transports/grpc.py @@ -110,7 +110,9 @@ def __init__( google.api_core.exceptions.DuplicateCredentialArgs: If both ``credentials`` and ``credentials_file`` are passed. """ + self._grpc_channel = None self._ssl_channel_credentials = ssl_channel_credentials + self._stubs: Dict[str, Callable] = {} if api_mtls_endpoint: warnings.warn("api_mtls_endpoint is deprecated", DeprecationWarning) @@ -118,70 +120,50 @@ def __init__( warnings.warn("client_cert_source is deprecated", DeprecationWarning) if channel: - # Sanity check: Ensure that channel and credentials are not both - # provided. + # Ignore credentials if a channel was passed. credentials = False - # If a channel was explicitly provided, set it. self._grpc_channel = channel self._ssl_channel_credentials = None - 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, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - self._ssl_channel_credentials = ssl_credentials else: - host = host if ":" in host else host + ":443" + if api_mtls_endpoint: + host = api_mtls_endpoint + + # Create SSL credentials with client_cert_source or application + # default SSL credentials. + if client_cert_source: + cert, key = client_cert_source() + self._ssl_channel_credentials = grpc.ssl_channel_credentials( + certificate_chain=cert, private_key=key + ) + else: + self._ssl_channel_credentials = SslCredentials().ssl_credentials - if credentials is None: - credentials, _ = auth.default( - scopes=self.AUTH_SCOPES, quota_project_id=quota_project_id - ) + else: + if client_cert_source_for_mtls and not ssl_channel_credentials: + cert, key = client_cert_source_for_mtls() + self._ssl_channel_credentials = grpc.ssl_channel_credentials( + certificate_chain=cert, private_key=key + ) - if client_cert_source_for_mtls and not ssl_channel_credentials: - cert, key = client_cert_source_for_mtls() - self._ssl_channel_credentials = grpc.ssl_channel_credentials( - certificate_chain=cert, private_key=key - ) + # The base transport sets the host, credentials and scopes + super().__init__( + host=host, + credentials=credentials, + credentials_file=credentials_file, + scopes=scopes, + quota_project_id=quota_project_id, + client_info=client_info, + ) - # create a new channel. The provided one is ignored. + if not self._grpc_channel: self._grpc_channel = type(self).create_channel( - host, - credentials=credentials, + self._host, + credentials=self._credentials, credentials_file=credentials_file, + scopes=self._scopes, ssl_credentials=self._ssl_channel_credentials, - scopes=scopes or self.AUTH_SCOPES, quota_project_id=quota_project_id, options=[ ("grpc.max_send_message_length", -1), @@ -189,17 +171,8 @@ def __init__( ], ) - 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, - client_info=client_info, - ) + # Wrap messages. This must be done after self._grpc_channel exists + self._prep_wrapped_messages(client_info) @classmethod def create_channel( @@ -213,7 +186,7 @@ def create_channel( ) -> grpc.Channel: """Create and return a gRPC channel object. Args: - address (Optional[str]): The host for the channel to use. + host (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 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 index cd7e74d7..95164149 100644 --- a/google/cloud/talent_v4beta1/services/application_service/transports/grpc_asyncio.py +++ b/google/cloud/talent_v4beta1/services/application_service/transports/grpc_asyncio.py @@ -65,7 +65,7 @@ def create_channel( ) -> aio.Channel: """Create and return a gRPC AsyncIO channel object. Args: - address (Optional[str]): The host for the channel to use. + host (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 @@ -143,10 +143,10 @@ def __init__( ignored if ``channel`` or ``ssl_channel_credentials`` is provided. quota_project_id (Optional[str]): An optional project to use for billing and quota. - 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 + 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. Raises: @@ -155,7 +155,9 @@ def __init__( google.api_core.exceptions.DuplicateCredentialArgs: If both ``credentials`` and ``credentials_file`` are passed. """ + self._grpc_channel = None self._ssl_channel_credentials = ssl_channel_credentials + self._stubs: Dict[str, Callable] = {} if api_mtls_endpoint: warnings.warn("api_mtls_endpoint is deprecated", DeprecationWarning) @@ -163,70 +165,50 @@ def __init__( warnings.warn("client_cert_source is deprecated", DeprecationWarning) if channel: - # Sanity check: Ensure that channel and credentials are not both - # provided. + # Ignore credentials if a channel was passed. credentials = False - # If a channel was explicitly provided, set it. self._grpc_channel = channel self._ssl_channel_credentials = None - 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, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - self._ssl_channel_credentials = ssl_credentials else: - host = host if ":" in host else host + ":443" + if api_mtls_endpoint: + host = api_mtls_endpoint + + # Create SSL credentials with client_cert_source or application + # default SSL credentials. + if client_cert_source: + cert, key = client_cert_source() + self._ssl_channel_credentials = grpc.ssl_channel_credentials( + certificate_chain=cert, private_key=key + ) + else: + self._ssl_channel_credentials = SslCredentials().ssl_credentials - if credentials is None: - credentials, _ = auth.default( - scopes=self.AUTH_SCOPES, quota_project_id=quota_project_id - ) + else: + if client_cert_source_for_mtls and not ssl_channel_credentials: + cert, key = client_cert_source_for_mtls() + self._ssl_channel_credentials = grpc.ssl_channel_credentials( + certificate_chain=cert, private_key=key + ) - if client_cert_source_for_mtls and not ssl_channel_credentials: - cert, key = client_cert_source_for_mtls() - self._ssl_channel_credentials = grpc.ssl_channel_credentials( - certificate_chain=cert, private_key=key - ) + # The base transport sets the host, credentials and scopes + super().__init__( + host=host, + credentials=credentials, + credentials_file=credentials_file, + scopes=scopes, + quota_project_id=quota_project_id, + client_info=client_info, + ) - # create a new channel. The provided one is ignored. + if not self._grpc_channel: self._grpc_channel = type(self).create_channel( - host, - credentials=credentials, + self._host, + credentials=self._credentials, credentials_file=credentials_file, + scopes=self._scopes, ssl_credentials=self._ssl_channel_credentials, - scopes=scopes or self.AUTH_SCOPES, quota_project_id=quota_project_id, options=[ ("grpc.max_send_message_length", -1), @@ -234,17 +216,8 @@ def __init__( ], ) - # 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, - client_info=client_info, - ) - - self._stubs = {} + # Wrap messages. This must be done after self._grpc_channel exists + self._prep_wrapped_messages(client_info) @property def grpc_channel(self) -> aio.Channel: diff --git a/google/cloud/talent_v4beta1/services/company_service/async_client.py b/google/cloud/talent_v4beta1/services/company_service/async_client.py index 9490431f..30a4dfff 100644 --- a/google/cloud/talent_v4beta1/services/company_service/async_client.py +++ b/google/cloud/talent_v4beta1/services/company_service/async_client.py @@ -341,6 +341,7 @@ async def get_company( predicate=retries.if_exception_type( exceptions.DeadlineExceeded, exceptions.ServiceUnavailable, ), + deadline=30.0, ), default_timeout=30.0, client_info=DEFAULT_CLIENT_INFO, @@ -504,6 +505,7 @@ async def delete_company( predicate=retries.if_exception_type( exceptions.DeadlineExceeded, exceptions.ServiceUnavailable, ), + deadline=30.0, ), default_timeout=30.0, client_info=DEFAULT_CLIENT_INFO, @@ -593,6 +595,7 @@ async def list_companies( predicate=retries.if_exception_type( exceptions.DeadlineExceeded, exceptions.ServiceUnavailable, ), + deadline=30.0, ), default_timeout=30.0, client_info=DEFAULT_CLIENT_INFO, diff --git a/google/cloud/talent_v4beta1/services/company_service/transports/base.py b/google/cloud/talent_v4beta1/services/company_service/transports/base.py index 39fb541b..e4af061a 100644 --- a/google/cloud/talent_v4beta1/services/company_service/transports/base.py +++ b/google/cloud/talent_v4beta1/services/company_service/transports/base.py @@ -73,10 +73,10 @@ def __init__( scope (Optional[Sequence[str]]): A list of scopes. quota_project_id (Optional[str]): An optional project to use for billing and quota. - 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 + 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. """ # Save the hostname. Default to port 443 (HTTPS) if none is specified. @@ -84,6 +84,9 @@ def __init__( host += ":443" self._host = host + # Save the scopes. + self._scopes = scopes or self.AUTH_SCOPES + # If no credentials are provided, then determine the appropriate # defaults. if credentials and credentials_file: @@ -93,20 +96,17 @@ def __init__( if credentials_file is not None: credentials, _ = auth.load_credentials_from_file( - credentials_file, scopes=scopes, quota_project_id=quota_project_id + credentials_file, scopes=self._scopes, quota_project_id=quota_project_id ) elif credentials is None: credentials, _ = auth.default( - scopes=scopes, quota_project_id=quota_project_id + scopes=self._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(client_info) - def _prep_wrapped_messages(self, client_info): # Precompute the wrapped methods. self._wrapped_methods = { @@ -122,6 +122,7 @@ def _prep_wrapped_messages(self, client_info): predicate=retries.if_exception_type( exceptions.DeadlineExceeded, exceptions.ServiceUnavailable, ), + deadline=30.0, ), default_timeout=30.0, client_info=client_info, @@ -138,6 +139,7 @@ def _prep_wrapped_messages(self, client_info): predicate=retries.if_exception_type( exceptions.DeadlineExceeded, exceptions.ServiceUnavailable, ), + deadline=30.0, ), default_timeout=30.0, client_info=client_info, @@ -151,6 +153,7 @@ def _prep_wrapped_messages(self, client_info): predicate=retries.if_exception_type( exceptions.DeadlineExceeded, exceptions.ServiceUnavailable, ), + deadline=30.0, ), default_timeout=30.0, client_info=client_info, diff --git a/google/cloud/talent_v4beta1/services/company_service/transports/grpc.py b/google/cloud/talent_v4beta1/services/company_service/transports/grpc.py index 1e3badea..b1d479f5 100644 --- a/google/cloud/talent_v4beta1/services/company_service/transports/grpc.py +++ b/google/cloud/talent_v4beta1/services/company_service/transports/grpc.py @@ -110,7 +110,9 @@ def __init__( google.api_core.exceptions.DuplicateCredentialArgs: If both ``credentials`` and ``credentials_file`` are passed. """ + self._grpc_channel = None self._ssl_channel_credentials = ssl_channel_credentials + self._stubs: Dict[str, Callable] = {} if api_mtls_endpoint: warnings.warn("api_mtls_endpoint is deprecated", DeprecationWarning) @@ -118,70 +120,50 @@ def __init__( warnings.warn("client_cert_source is deprecated", DeprecationWarning) if channel: - # Sanity check: Ensure that channel and credentials are not both - # provided. + # Ignore credentials if a channel was passed. credentials = False - # If a channel was explicitly provided, set it. self._grpc_channel = channel self._ssl_channel_credentials = None - 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, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - self._ssl_channel_credentials = ssl_credentials else: - host = host if ":" in host else host + ":443" + if api_mtls_endpoint: + host = api_mtls_endpoint + + # Create SSL credentials with client_cert_source or application + # default SSL credentials. + if client_cert_source: + cert, key = client_cert_source() + self._ssl_channel_credentials = grpc.ssl_channel_credentials( + certificate_chain=cert, private_key=key + ) + else: + self._ssl_channel_credentials = SslCredentials().ssl_credentials - if credentials is None: - credentials, _ = auth.default( - scopes=self.AUTH_SCOPES, quota_project_id=quota_project_id - ) + else: + if client_cert_source_for_mtls and not ssl_channel_credentials: + cert, key = client_cert_source_for_mtls() + self._ssl_channel_credentials = grpc.ssl_channel_credentials( + certificate_chain=cert, private_key=key + ) - if client_cert_source_for_mtls and not ssl_channel_credentials: - cert, key = client_cert_source_for_mtls() - self._ssl_channel_credentials = grpc.ssl_channel_credentials( - certificate_chain=cert, private_key=key - ) + # The base transport sets the host, credentials and scopes + super().__init__( + host=host, + credentials=credentials, + credentials_file=credentials_file, + scopes=scopes, + quota_project_id=quota_project_id, + client_info=client_info, + ) - # create a new channel. The provided one is ignored. + if not self._grpc_channel: self._grpc_channel = type(self).create_channel( - host, - credentials=credentials, + self._host, + credentials=self._credentials, credentials_file=credentials_file, + scopes=self._scopes, ssl_credentials=self._ssl_channel_credentials, - scopes=scopes or self.AUTH_SCOPES, quota_project_id=quota_project_id, options=[ ("grpc.max_send_message_length", -1), @@ -189,17 +171,8 @@ def __init__( ], ) - 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, - client_info=client_info, - ) + # Wrap messages. This must be done after self._grpc_channel exists + self._prep_wrapped_messages(client_info) @classmethod def create_channel( @@ -213,7 +186,7 @@ def create_channel( ) -> grpc.Channel: """Create and return a gRPC channel object. Args: - address (Optional[str]): The host for the channel to use. + host (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 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 index 035237dd..70bdce4b 100644 --- a/google/cloud/talent_v4beta1/services/company_service/transports/grpc_asyncio.py +++ b/google/cloud/talent_v4beta1/services/company_service/transports/grpc_asyncio.py @@ -65,7 +65,7 @@ def create_channel( ) -> aio.Channel: """Create and return a gRPC AsyncIO channel object. Args: - address (Optional[str]): The host for the channel to use. + host (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 @@ -143,10 +143,10 @@ def __init__( ignored if ``channel`` or ``ssl_channel_credentials`` is provided. quota_project_id (Optional[str]): An optional project to use for billing and quota. - 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 + 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. Raises: @@ -155,7 +155,9 @@ def __init__( google.api_core.exceptions.DuplicateCredentialArgs: If both ``credentials`` and ``credentials_file`` are passed. """ + self._grpc_channel = None self._ssl_channel_credentials = ssl_channel_credentials + self._stubs: Dict[str, Callable] = {} if api_mtls_endpoint: warnings.warn("api_mtls_endpoint is deprecated", DeprecationWarning) @@ -163,70 +165,50 @@ def __init__( warnings.warn("client_cert_source is deprecated", DeprecationWarning) if channel: - # Sanity check: Ensure that channel and credentials are not both - # provided. + # Ignore credentials if a channel was passed. credentials = False - # If a channel was explicitly provided, set it. self._grpc_channel = channel self._ssl_channel_credentials = None - 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, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - self._ssl_channel_credentials = ssl_credentials else: - host = host if ":" in host else host + ":443" + if api_mtls_endpoint: + host = api_mtls_endpoint + + # Create SSL credentials with client_cert_source or application + # default SSL credentials. + if client_cert_source: + cert, key = client_cert_source() + self._ssl_channel_credentials = grpc.ssl_channel_credentials( + certificate_chain=cert, private_key=key + ) + else: + self._ssl_channel_credentials = SslCredentials().ssl_credentials - if credentials is None: - credentials, _ = auth.default( - scopes=self.AUTH_SCOPES, quota_project_id=quota_project_id - ) + else: + if client_cert_source_for_mtls and not ssl_channel_credentials: + cert, key = client_cert_source_for_mtls() + self._ssl_channel_credentials = grpc.ssl_channel_credentials( + certificate_chain=cert, private_key=key + ) - if client_cert_source_for_mtls and not ssl_channel_credentials: - cert, key = client_cert_source_for_mtls() - self._ssl_channel_credentials = grpc.ssl_channel_credentials( - certificate_chain=cert, private_key=key - ) + # The base transport sets the host, credentials and scopes + super().__init__( + host=host, + credentials=credentials, + credentials_file=credentials_file, + scopes=scopes, + quota_project_id=quota_project_id, + client_info=client_info, + ) - # create a new channel. The provided one is ignored. + if not self._grpc_channel: self._grpc_channel = type(self).create_channel( - host, - credentials=credentials, + self._host, + credentials=self._credentials, credentials_file=credentials_file, + scopes=self._scopes, ssl_credentials=self._ssl_channel_credentials, - scopes=scopes or self.AUTH_SCOPES, quota_project_id=quota_project_id, options=[ ("grpc.max_send_message_length", -1), @@ -234,17 +216,8 @@ def __init__( ], ) - # 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, - client_info=client_info, - ) - - self._stubs = {} + # Wrap messages. This must be done after self._grpc_channel exists + self._prep_wrapped_messages(client_info) @property def grpc_channel(self) -> aio.Channel: diff --git a/google/cloud/talent_v4beta1/services/completion/async_client.py b/google/cloud/talent_v4beta1/services/completion/async_client.py index bad09034..194a7b7e 100644 --- a/google/cloud/talent_v4beta1/services/completion/async_client.py +++ b/google/cloud/talent_v4beta1/services/completion/async_client.py @@ -204,6 +204,7 @@ async def complete_query( predicate=retries.if_exception_type( exceptions.DeadlineExceeded, exceptions.ServiceUnavailable, ), + deadline=30.0, ), default_timeout=30.0, client_info=DEFAULT_CLIENT_INFO, diff --git a/google/cloud/talent_v4beta1/services/completion/transports/base.py b/google/cloud/talent_v4beta1/services/completion/transports/base.py index 95e41990..fb7aaee0 100644 --- a/google/cloud/talent_v4beta1/services/completion/transports/base.py +++ b/google/cloud/talent_v4beta1/services/completion/transports/base.py @@ -70,10 +70,10 @@ def __init__( scope (Optional[Sequence[str]]): A list of scopes. quota_project_id (Optional[str]): An optional project to use for billing and quota. - 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 + 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. """ # Save the hostname. Default to port 443 (HTTPS) if none is specified. @@ -81,6 +81,9 @@ def __init__( host += ":443" self._host = host + # Save the scopes. + self._scopes = scopes or self.AUTH_SCOPES + # If no credentials are provided, then determine the appropriate # defaults. if credentials and credentials_file: @@ -90,20 +93,17 @@ def __init__( if credentials_file is not None: credentials, _ = auth.load_credentials_from_file( - credentials_file, scopes=scopes, quota_project_id=quota_project_id + credentials_file, scopes=self._scopes, quota_project_id=quota_project_id ) elif credentials is None: credentials, _ = auth.default( - scopes=scopes, quota_project_id=quota_project_id + scopes=self._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(client_info) - def _prep_wrapped_messages(self, client_info): # Precompute the wrapped methods. self._wrapped_methods = { @@ -116,6 +116,7 @@ def _prep_wrapped_messages(self, client_info): predicate=retries.if_exception_type( exceptions.DeadlineExceeded, exceptions.ServiceUnavailable, ), + deadline=30.0, ), default_timeout=30.0, client_info=client_info, diff --git a/google/cloud/talent_v4beta1/services/completion/transports/grpc.py b/google/cloud/talent_v4beta1/services/completion/transports/grpc.py index f47f3bb5..164a4e5d 100644 --- a/google/cloud/talent_v4beta1/services/completion/transports/grpc.py +++ b/google/cloud/talent_v4beta1/services/completion/transports/grpc.py @@ -106,7 +106,9 @@ def __init__( google.api_core.exceptions.DuplicateCredentialArgs: If both ``credentials`` and ``credentials_file`` are passed. """ + self._grpc_channel = None self._ssl_channel_credentials = ssl_channel_credentials + self._stubs: Dict[str, Callable] = {} if api_mtls_endpoint: warnings.warn("api_mtls_endpoint is deprecated", DeprecationWarning) @@ -114,70 +116,50 @@ def __init__( warnings.warn("client_cert_source is deprecated", DeprecationWarning) if channel: - # Sanity check: Ensure that channel and credentials are not both - # provided. + # Ignore credentials if a channel was passed. credentials = False - # If a channel was explicitly provided, set it. self._grpc_channel = channel self._ssl_channel_credentials = None - 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, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - self._ssl_channel_credentials = ssl_credentials else: - host = host if ":" in host else host + ":443" + if api_mtls_endpoint: + host = api_mtls_endpoint + + # Create SSL credentials with client_cert_source or application + # default SSL credentials. + if client_cert_source: + cert, key = client_cert_source() + self._ssl_channel_credentials = grpc.ssl_channel_credentials( + certificate_chain=cert, private_key=key + ) + else: + self._ssl_channel_credentials = SslCredentials().ssl_credentials - if credentials is None: - credentials, _ = auth.default( - scopes=self.AUTH_SCOPES, quota_project_id=quota_project_id - ) + else: + if client_cert_source_for_mtls and not ssl_channel_credentials: + cert, key = client_cert_source_for_mtls() + self._ssl_channel_credentials = grpc.ssl_channel_credentials( + certificate_chain=cert, private_key=key + ) - if client_cert_source_for_mtls and not ssl_channel_credentials: - cert, key = client_cert_source_for_mtls() - self._ssl_channel_credentials = grpc.ssl_channel_credentials( - certificate_chain=cert, private_key=key - ) + # The base transport sets the host, credentials and scopes + super().__init__( + host=host, + credentials=credentials, + credentials_file=credentials_file, + scopes=scopes, + quota_project_id=quota_project_id, + client_info=client_info, + ) - # create a new channel. The provided one is ignored. + if not self._grpc_channel: self._grpc_channel = type(self).create_channel( - host, - credentials=credentials, + self._host, + credentials=self._credentials, credentials_file=credentials_file, + scopes=self._scopes, ssl_credentials=self._ssl_channel_credentials, - scopes=scopes or self.AUTH_SCOPES, quota_project_id=quota_project_id, options=[ ("grpc.max_send_message_length", -1), @@ -185,17 +167,8 @@ def __init__( ], ) - 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, - client_info=client_info, - ) + # Wrap messages. This must be done after self._grpc_channel exists + self._prep_wrapped_messages(client_info) @classmethod def create_channel( @@ -209,7 +182,7 @@ def create_channel( ) -> grpc.Channel: """Create and return a gRPC channel object. Args: - address (Optional[str]): The host for the channel to use. + host (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 diff --git a/google/cloud/talent_v4beta1/services/completion/transports/grpc_asyncio.py b/google/cloud/talent_v4beta1/services/completion/transports/grpc_asyncio.py index 2b0572c5..88a6a731 100644 --- a/google/cloud/talent_v4beta1/services/completion/transports/grpc_asyncio.py +++ b/google/cloud/talent_v4beta1/services/completion/transports/grpc_asyncio.py @@ -61,7 +61,7 @@ def create_channel( ) -> aio.Channel: """Create and return a gRPC AsyncIO channel object. Args: - address (Optional[str]): The host for the channel to use. + host (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 @@ -139,10 +139,10 @@ def __init__( ignored if ``channel`` or ``ssl_channel_credentials`` is provided. quota_project_id (Optional[str]): An optional project to use for billing and quota. - 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 + 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. Raises: @@ -151,7 +151,9 @@ def __init__( google.api_core.exceptions.DuplicateCredentialArgs: If both ``credentials`` and ``credentials_file`` are passed. """ + self._grpc_channel = None self._ssl_channel_credentials = ssl_channel_credentials + self._stubs: Dict[str, Callable] = {} if api_mtls_endpoint: warnings.warn("api_mtls_endpoint is deprecated", DeprecationWarning) @@ -159,70 +161,50 @@ def __init__( warnings.warn("client_cert_source is deprecated", DeprecationWarning) if channel: - # Sanity check: Ensure that channel and credentials are not both - # provided. + # Ignore credentials if a channel was passed. credentials = False - # If a channel was explicitly provided, set it. self._grpc_channel = channel self._ssl_channel_credentials = None - 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, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - self._ssl_channel_credentials = ssl_credentials else: - host = host if ":" in host else host + ":443" + if api_mtls_endpoint: + host = api_mtls_endpoint + + # Create SSL credentials with client_cert_source or application + # default SSL credentials. + if client_cert_source: + cert, key = client_cert_source() + self._ssl_channel_credentials = grpc.ssl_channel_credentials( + certificate_chain=cert, private_key=key + ) + else: + self._ssl_channel_credentials = SslCredentials().ssl_credentials - if credentials is None: - credentials, _ = auth.default( - scopes=self.AUTH_SCOPES, quota_project_id=quota_project_id - ) + else: + if client_cert_source_for_mtls and not ssl_channel_credentials: + cert, key = client_cert_source_for_mtls() + self._ssl_channel_credentials = grpc.ssl_channel_credentials( + certificate_chain=cert, private_key=key + ) - if client_cert_source_for_mtls and not ssl_channel_credentials: - cert, key = client_cert_source_for_mtls() - self._ssl_channel_credentials = grpc.ssl_channel_credentials( - certificate_chain=cert, private_key=key - ) + # The base transport sets the host, credentials and scopes + super().__init__( + host=host, + credentials=credentials, + credentials_file=credentials_file, + scopes=scopes, + quota_project_id=quota_project_id, + client_info=client_info, + ) - # create a new channel. The provided one is ignored. + if not self._grpc_channel: self._grpc_channel = type(self).create_channel( - host, - credentials=credentials, + self._host, + credentials=self._credentials, credentials_file=credentials_file, + scopes=self._scopes, ssl_credentials=self._ssl_channel_credentials, - scopes=scopes or self.AUTH_SCOPES, quota_project_id=quota_project_id, options=[ ("grpc.max_send_message_length", -1), @@ -230,17 +212,8 @@ def __init__( ], ) - # 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, - client_info=client_info, - ) - - self._stubs = {} + # Wrap messages. This must be done after self._grpc_channel exists + self._prep_wrapped_messages(client_info) @property def grpc_channel(self) -> aio.Channel: diff --git a/google/cloud/talent_v4beta1/services/event_service/transports/base.py b/google/cloud/talent_v4beta1/services/event_service/transports/base.py index cd643c9d..0fdd167b 100644 --- a/google/cloud/talent_v4beta1/services/event_service/transports/base.py +++ b/google/cloud/talent_v4beta1/services/event_service/transports/base.py @@ -71,10 +71,10 @@ def __init__( scope (Optional[Sequence[str]]): A list of scopes. quota_project_id (Optional[str]): An optional project to use for billing and quota. - 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 + 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. """ # Save the hostname. Default to port 443 (HTTPS) if none is specified. @@ -82,6 +82,9 @@ def __init__( host += ":443" self._host = host + # Save the scopes. + self._scopes = scopes or self.AUTH_SCOPES + # If no credentials are provided, then determine the appropriate # defaults. if credentials and credentials_file: @@ -91,20 +94,17 @@ def __init__( if credentials_file is not None: credentials, _ = auth.load_credentials_from_file( - credentials_file, scopes=scopes, quota_project_id=quota_project_id + credentials_file, scopes=self._scopes, quota_project_id=quota_project_id ) elif credentials is None: credentials, _ = auth.default( - scopes=scopes, quota_project_id=quota_project_id + scopes=self._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(client_info) - def _prep_wrapped_messages(self, client_info): # Precompute the wrapped methods. self._wrapped_methods = { diff --git a/google/cloud/talent_v4beta1/services/event_service/transports/grpc.py b/google/cloud/talent_v4beta1/services/event_service/transports/grpc.py index 6d1f787e..18186207 100644 --- a/google/cloud/talent_v4beta1/services/event_service/transports/grpc.py +++ b/google/cloud/talent_v4beta1/services/event_service/transports/grpc.py @@ -107,7 +107,9 @@ def __init__( google.api_core.exceptions.DuplicateCredentialArgs: If both ``credentials`` and ``credentials_file`` are passed. """ + self._grpc_channel = None self._ssl_channel_credentials = ssl_channel_credentials + self._stubs: Dict[str, Callable] = {} if api_mtls_endpoint: warnings.warn("api_mtls_endpoint is deprecated", DeprecationWarning) @@ -115,70 +117,50 @@ def __init__( warnings.warn("client_cert_source is deprecated", DeprecationWarning) if channel: - # Sanity check: Ensure that channel and credentials are not both - # provided. + # Ignore credentials if a channel was passed. credentials = False - # If a channel was explicitly provided, set it. self._grpc_channel = channel self._ssl_channel_credentials = None - 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, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - self._ssl_channel_credentials = ssl_credentials else: - host = host if ":" in host else host + ":443" + if api_mtls_endpoint: + host = api_mtls_endpoint + + # Create SSL credentials with client_cert_source or application + # default SSL credentials. + if client_cert_source: + cert, key = client_cert_source() + self._ssl_channel_credentials = grpc.ssl_channel_credentials( + certificate_chain=cert, private_key=key + ) + else: + self._ssl_channel_credentials = SslCredentials().ssl_credentials - if credentials is None: - credentials, _ = auth.default( - scopes=self.AUTH_SCOPES, quota_project_id=quota_project_id - ) + else: + if client_cert_source_for_mtls and not ssl_channel_credentials: + cert, key = client_cert_source_for_mtls() + self._ssl_channel_credentials = grpc.ssl_channel_credentials( + certificate_chain=cert, private_key=key + ) - if client_cert_source_for_mtls and not ssl_channel_credentials: - cert, key = client_cert_source_for_mtls() - self._ssl_channel_credentials = grpc.ssl_channel_credentials( - certificate_chain=cert, private_key=key - ) + # The base transport sets the host, credentials and scopes + super().__init__( + host=host, + credentials=credentials, + credentials_file=credentials_file, + scopes=scopes, + quota_project_id=quota_project_id, + client_info=client_info, + ) - # create a new channel. The provided one is ignored. + if not self._grpc_channel: self._grpc_channel = type(self).create_channel( - host, - credentials=credentials, + self._host, + credentials=self._credentials, credentials_file=credentials_file, + scopes=self._scopes, ssl_credentials=self._ssl_channel_credentials, - scopes=scopes or self.AUTH_SCOPES, quota_project_id=quota_project_id, options=[ ("grpc.max_send_message_length", -1), @@ -186,17 +168,8 @@ def __init__( ], ) - 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, - client_info=client_info, - ) + # Wrap messages. This must be done after self._grpc_channel exists + self._prep_wrapped_messages(client_info) @classmethod def create_channel( @@ -210,7 +183,7 @@ def create_channel( ) -> grpc.Channel: """Create and return a gRPC channel object. Args: - address (Optional[str]): The host for the channel to use. + host (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 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 index e3864ef5..687b2763 100644 --- a/google/cloud/talent_v4beta1/services/event_service/transports/grpc_asyncio.py +++ b/google/cloud/talent_v4beta1/services/event_service/transports/grpc_asyncio.py @@ -62,7 +62,7 @@ def create_channel( ) -> aio.Channel: """Create and return a gRPC AsyncIO channel object. Args: - address (Optional[str]): The host for the channel to use. + host (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 @@ -140,10 +140,10 @@ def __init__( ignored if ``channel`` or ``ssl_channel_credentials`` is provided. quota_project_id (Optional[str]): An optional project to use for billing and quota. - 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 + 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. Raises: @@ -152,7 +152,9 @@ def __init__( google.api_core.exceptions.DuplicateCredentialArgs: If both ``credentials`` and ``credentials_file`` are passed. """ + self._grpc_channel = None self._ssl_channel_credentials = ssl_channel_credentials + self._stubs: Dict[str, Callable] = {} if api_mtls_endpoint: warnings.warn("api_mtls_endpoint is deprecated", DeprecationWarning) @@ -160,70 +162,50 @@ def __init__( warnings.warn("client_cert_source is deprecated", DeprecationWarning) if channel: - # Sanity check: Ensure that channel and credentials are not both - # provided. + # Ignore credentials if a channel was passed. credentials = False - # If a channel was explicitly provided, set it. self._grpc_channel = channel self._ssl_channel_credentials = None - 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, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - self._ssl_channel_credentials = ssl_credentials else: - host = host if ":" in host else host + ":443" + if api_mtls_endpoint: + host = api_mtls_endpoint + + # Create SSL credentials with client_cert_source or application + # default SSL credentials. + if client_cert_source: + cert, key = client_cert_source() + self._ssl_channel_credentials = grpc.ssl_channel_credentials( + certificate_chain=cert, private_key=key + ) + else: + self._ssl_channel_credentials = SslCredentials().ssl_credentials - if credentials is None: - credentials, _ = auth.default( - scopes=self.AUTH_SCOPES, quota_project_id=quota_project_id - ) + else: + if client_cert_source_for_mtls and not ssl_channel_credentials: + cert, key = client_cert_source_for_mtls() + self._ssl_channel_credentials = grpc.ssl_channel_credentials( + certificate_chain=cert, private_key=key + ) - if client_cert_source_for_mtls and not ssl_channel_credentials: - cert, key = client_cert_source_for_mtls() - self._ssl_channel_credentials = grpc.ssl_channel_credentials( - certificate_chain=cert, private_key=key - ) + # The base transport sets the host, credentials and scopes + super().__init__( + host=host, + credentials=credentials, + credentials_file=credentials_file, + scopes=scopes, + quota_project_id=quota_project_id, + client_info=client_info, + ) - # create a new channel. The provided one is ignored. + if not self._grpc_channel: self._grpc_channel = type(self).create_channel( - host, - credentials=credentials, + self._host, + credentials=self._credentials, credentials_file=credentials_file, + scopes=self._scopes, ssl_credentials=self._ssl_channel_credentials, - scopes=scopes or self.AUTH_SCOPES, quota_project_id=quota_project_id, options=[ ("grpc.max_send_message_length", -1), @@ -231,17 +213,8 @@ def __init__( ], ) - # 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, - client_info=client_info, - ) - - self._stubs = {} + # Wrap messages. This must be done after self._grpc_channel exists + self._prep_wrapped_messages(client_info) @property def grpc_channel(self) -> aio.Channel: diff --git a/google/cloud/talent_v4beta1/services/job_service/async_client.py b/google/cloud/talent_v4beta1/services/job_service/async_client.py index e36f73dd..9f758a33 100644 --- a/google/cloud/talent_v4beta1/services/job_service/async_client.py +++ b/google/cloud/talent_v4beta1/services/job_service/async_client.py @@ -435,6 +435,7 @@ async def get_job( predicate=retries.if_exception_type( exceptions.DeadlineExceeded, exceptions.ServiceUnavailable, ), + deadline=30.0, ), default_timeout=30.0, client_info=DEFAULT_CLIENT_INFO, @@ -692,6 +693,7 @@ async def delete_job( predicate=retries.if_exception_type( exceptions.DeadlineExceeded, exceptions.ServiceUnavailable, ), + deadline=30.0, ), default_timeout=30.0, client_info=DEFAULT_CLIENT_INFO, @@ -901,6 +903,7 @@ async def list_jobs( predicate=retries.if_exception_type( exceptions.DeadlineExceeded, exceptions.ServiceUnavailable, ), + deadline=30.0, ), default_timeout=30.0, client_info=DEFAULT_CLIENT_INFO, diff --git a/google/cloud/talent_v4beta1/services/job_service/transports/base.py b/google/cloud/talent_v4beta1/services/job_service/transports/base.py index ffef5f17..5cb1997b 100644 --- a/google/cloud/talent_v4beta1/services/job_service/transports/base.py +++ b/google/cloud/talent_v4beta1/services/job_service/transports/base.py @@ -75,10 +75,10 @@ def __init__( scope (Optional[Sequence[str]]): A list of scopes. quota_project_id (Optional[str]): An optional project to use for billing and quota. - 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 + 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. """ # Save the hostname. Default to port 443 (HTTPS) if none is specified. @@ -86,6 +86,9 @@ def __init__( host += ":443" self._host = host + # Save the scopes. + self._scopes = scopes or self.AUTH_SCOPES + # If no credentials are provided, then determine the appropriate # defaults. if credentials and credentials_file: @@ -95,20 +98,17 @@ def __init__( if credentials_file is not None: credentials, _ = auth.load_credentials_from_file( - credentials_file, scopes=scopes, quota_project_id=quota_project_id + credentials_file, scopes=self._scopes, quota_project_id=quota_project_id ) elif credentials is None: credentials, _ = auth.default( - scopes=scopes, quota_project_id=quota_project_id + scopes=self._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(client_info) - def _prep_wrapped_messages(self, client_info): # Precompute the wrapped methods. self._wrapped_methods = { @@ -127,6 +127,7 @@ def _prep_wrapped_messages(self, client_info): predicate=retries.if_exception_type( exceptions.DeadlineExceeded, exceptions.ServiceUnavailable, ), + deadline=30.0, ), default_timeout=30.0, client_info=client_info, @@ -146,6 +147,7 @@ def _prep_wrapped_messages(self, client_info): predicate=retries.if_exception_type( exceptions.DeadlineExceeded, exceptions.ServiceUnavailable, ), + deadline=30.0, ), default_timeout=30.0, client_info=client_info, @@ -162,6 +164,7 @@ def _prep_wrapped_messages(self, client_info): predicate=retries.if_exception_type( exceptions.DeadlineExceeded, exceptions.ServiceUnavailable, ), + deadline=30.0, ), default_timeout=30.0, client_info=client_info, diff --git a/google/cloud/talent_v4beta1/services/job_service/transports/grpc.py b/google/cloud/talent_v4beta1/services/job_service/transports/grpc.py index 5bb5e55e..188b42a6 100644 --- a/google/cloud/talent_v4beta1/services/job_service/transports/grpc.py +++ b/google/cloud/talent_v4beta1/services/job_service/transports/grpc.py @@ -112,7 +112,10 @@ def __init__( google.api_core.exceptions.DuplicateCredentialArgs: If both ``credentials`` and ``credentials_file`` are passed. """ + self._grpc_channel = None self._ssl_channel_credentials = ssl_channel_credentials + self._stubs: Dict[str, Callable] = {} + self._operations_client = None if api_mtls_endpoint: warnings.warn("api_mtls_endpoint is deprecated", DeprecationWarning) @@ -120,70 +123,50 @@ def __init__( warnings.warn("client_cert_source is deprecated", DeprecationWarning) if channel: - # Sanity check: Ensure that channel and credentials are not both - # provided. + # Ignore credentials if a channel was passed. credentials = False - # If a channel was explicitly provided, set it. self._grpc_channel = channel self._ssl_channel_credentials = None - 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, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - self._ssl_channel_credentials = ssl_credentials else: - host = host if ":" in host else host + ":443" + if api_mtls_endpoint: + host = api_mtls_endpoint + + # Create SSL credentials with client_cert_source or application + # default SSL credentials. + if client_cert_source: + cert, key = client_cert_source() + self._ssl_channel_credentials = grpc.ssl_channel_credentials( + certificate_chain=cert, private_key=key + ) + else: + self._ssl_channel_credentials = SslCredentials().ssl_credentials - if credentials is None: - credentials, _ = auth.default( - scopes=self.AUTH_SCOPES, quota_project_id=quota_project_id - ) + else: + if client_cert_source_for_mtls and not ssl_channel_credentials: + cert, key = client_cert_source_for_mtls() + self._ssl_channel_credentials = grpc.ssl_channel_credentials( + certificate_chain=cert, private_key=key + ) - if client_cert_source_for_mtls and not ssl_channel_credentials: - cert, key = client_cert_source_for_mtls() - self._ssl_channel_credentials = grpc.ssl_channel_credentials( - certificate_chain=cert, private_key=key - ) + # The base transport sets the host, credentials and scopes + super().__init__( + host=host, + credentials=credentials, + credentials_file=credentials_file, + scopes=scopes, + quota_project_id=quota_project_id, + client_info=client_info, + ) - # create a new channel. The provided one is ignored. + if not self._grpc_channel: self._grpc_channel = type(self).create_channel( - host, - credentials=credentials, + self._host, + credentials=self._credentials, credentials_file=credentials_file, + scopes=self._scopes, ssl_credentials=self._ssl_channel_credentials, - scopes=scopes or self.AUTH_SCOPES, quota_project_id=quota_project_id, options=[ ("grpc.max_send_message_length", -1), @@ -191,18 +174,8 @@ def __init__( ], ) - self._stubs = {} # type: Dict[str, Callable] - self._operations_client = None - - # 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, - client_info=client_info, - ) + # Wrap messages. This must be done after self._grpc_channel exists + self._prep_wrapped_messages(client_info) @classmethod def create_channel( @@ -216,7 +189,7 @@ def create_channel( ) -> grpc.Channel: """Create and return a gRPC channel object. Args: - address (Optional[str]): The host for the channel to use. + host (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 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 index 4372e90e..4896073b 100644 --- a/google/cloud/talent_v4beta1/services/job_service/transports/grpc_asyncio.py +++ b/google/cloud/talent_v4beta1/services/job_service/transports/grpc_asyncio.py @@ -67,7 +67,7 @@ def create_channel( ) -> aio.Channel: """Create and return a gRPC AsyncIO channel object. Args: - address (Optional[str]): The host for the channel to use. + host (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 @@ -145,10 +145,10 @@ def __init__( ignored if ``channel`` or ``ssl_channel_credentials`` is provided. quota_project_id (Optional[str]): An optional project to use for billing and quota. - 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 + 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. Raises: @@ -157,7 +157,10 @@ def __init__( google.api_core.exceptions.DuplicateCredentialArgs: If both ``credentials`` and ``credentials_file`` are passed. """ + self._grpc_channel = None self._ssl_channel_credentials = ssl_channel_credentials + self._stubs: Dict[str, Callable] = {} + self._operations_client = None if api_mtls_endpoint: warnings.warn("api_mtls_endpoint is deprecated", DeprecationWarning) @@ -165,70 +168,50 @@ def __init__( warnings.warn("client_cert_source is deprecated", DeprecationWarning) if channel: - # Sanity check: Ensure that channel and credentials are not both - # provided. + # Ignore credentials if a channel was passed. credentials = False - # If a channel was explicitly provided, set it. self._grpc_channel = channel self._ssl_channel_credentials = None - 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, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - self._ssl_channel_credentials = ssl_credentials else: - host = host if ":" in host else host + ":443" + if api_mtls_endpoint: + host = api_mtls_endpoint + + # Create SSL credentials with client_cert_source or application + # default SSL credentials. + if client_cert_source: + cert, key = client_cert_source() + self._ssl_channel_credentials = grpc.ssl_channel_credentials( + certificate_chain=cert, private_key=key + ) + else: + self._ssl_channel_credentials = SslCredentials().ssl_credentials - if credentials is None: - credentials, _ = auth.default( - scopes=self.AUTH_SCOPES, quota_project_id=quota_project_id - ) + else: + if client_cert_source_for_mtls and not ssl_channel_credentials: + cert, key = client_cert_source_for_mtls() + self._ssl_channel_credentials = grpc.ssl_channel_credentials( + certificate_chain=cert, private_key=key + ) - if client_cert_source_for_mtls and not ssl_channel_credentials: - cert, key = client_cert_source_for_mtls() - self._ssl_channel_credentials = grpc.ssl_channel_credentials( - certificate_chain=cert, private_key=key - ) + # The base transport sets the host, credentials and scopes + super().__init__( + host=host, + credentials=credentials, + credentials_file=credentials_file, + scopes=scopes, + quota_project_id=quota_project_id, + client_info=client_info, + ) - # create a new channel. The provided one is ignored. + if not self._grpc_channel: self._grpc_channel = type(self).create_channel( - host, - credentials=credentials, + self._host, + credentials=self._credentials, credentials_file=credentials_file, + scopes=self._scopes, ssl_credentials=self._ssl_channel_credentials, - scopes=scopes or self.AUTH_SCOPES, quota_project_id=quota_project_id, options=[ ("grpc.max_send_message_length", -1), @@ -236,18 +219,8 @@ def __init__( ], ) - # 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, - client_info=client_info, - ) - - self._stubs = {} - self._operations_client = None + # Wrap messages. This must be done after self._grpc_channel exists + self._prep_wrapped_messages(client_info) @property def grpc_channel(self) -> aio.Channel: diff --git a/google/cloud/talent_v4beta1/services/profile_service/async_client.py b/google/cloud/talent_v4beta1/services/profile_service/async_client.py index 151dde21..7c581cb8 100644 --- a/google/cloud/talent_v4beta1/services/profile_service/async_client.py +++ b/google/cloud/talent_v4beta1/services/profile_service/async_client.py @@ -248,6 +248,7 @@ async def list_profiles( predicate=retries.if_exception_type( exceptions.DeadlineExceeded, exceptions.ServiceUnavailable, ), + deadline=30.0, ), default_timeout=30.0, client_info=DEFAULT_CLIENT_INFO, @@ -425,6 +426,7 @@ async def get_profile( predicate=retries.if_exception_type( exceptions.DeadlineExceeded, exceptions.ServiceUnavailable, ), + deadline=30.0, ), default_timeout=30.0, client_info=DEFAULT_CLIENT_INFO, @@ -579,6 +581,7 @@ async def delete_profile( predicate=retries.if_exception_type( exceptions.DeadlineExceeded, exceptions.ServiceUnavailable, ), + deadline=30.0, ), default_timeout=30.0, client_info=DEFAULT_CLIENT_INFO, diff --git a/google/cloud/talent_v4beta1/services/profile_service/transports/base.py b/google/cloud/talent_v4beta1/services/profile_service/transports/base.py index dbd36ea2..3a1c0f76 100644 --- a/google/cloud/talent_v4beta1/services/profile_service/transports/base.py +++ b/google/cloud/talent_v4beta1/services/profile_service/transports/base.py @@ -73,10 +73,10 @@ def __init__( scope (Optional[Sequence[str]]): A list of scopes. quota_project_id (Optional[str]): An optional project to use for billing and quota. - 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 + 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. """ # Save the hostname. Default to port 443 (HTTPS) if none is specified. @@ -84,6 +84,9 @@ def __init__( host += ":443" self._host = host + # Save the scopes. + self._scopes = scopes or self.AUTH_SCOPES + # If no credentials are provided, then determine the appropriate # defaults. if credentials and credentials_file: @@ -93,20 +96,17 @@ def __init__( if credentials_file is not None: credentials, _ = auth.load_credentials_from_file( - credentials_file, scopes=scopes, quota_project_id=quota_project_id + credentials_file, scopes=self._scopes, quota_project_id=quota_project_id ) elif credentials is None: credentials, _ = auth.default( - scopes=scopes, quota_project_id=quota_project_id + scopes=self._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(client_info) - def _prep_wrapped_messages(self, client_info): # Precompute the wrapped methods. self._wrapped_methods = { @@ -119,6 +119,7 @@ def _prep_wrapped_messages(self, client_info): predicate=retries.if_exception_type( exceptions.DeadlineExceeded, exceptions.ServiceUnavailable, ), + deadline=30.0, ), default_timeout=30.0, client_info=client_info, @@ -135,6 +136,7 @@ def _prep_wrapped_messages(self, client_info): predicate=retries.if_exception_type( exceptions.DeadlineExceeded, exceptions.ServiceUnavailable, ), + deadline=30.0, ), default_timeout=30.0, client_info=client_info, @@ -151,6 +153,7 @@ def _prep_wrapped_messages(self, client_info): predicate=retries.if_exception_type( exceptions.DeadlineExceeded, exceptions.ServiceUnavailable, ), + deadline=30.0, ), default_timeout=30.0, client_info=client_info, diff --git a/google/cloud/talent_v4beta1/services/profile_service/transports/grpc.py b/google/cloud/talent_v4beta1/services/profile_service/transports/grpc.py index bd7e9231..a3dbfe39 100644 --- a/google/cloud/talent_v4beta1/services/profile_service/transports/grpc.py +++ b/google/cloud/talent_v4beta1/services/profile_service/transports/grpc.py @@ -110,7 +110,9 @@ def __init__( google.api_core.exceptions.DuplicateCredentialArgs: If both ``credentials`` and ``credentials_file`` are passed. """ + self._grpc_channel = None self._ssl_channel_credentials = ssl_channel_credentials + self._stubs: Dict[str, Callable] = {} if api_mtls_endpoint: warnings.warn("api_mtls_endpoint is deprecated", DeprecationWarning) @@ -118,70 +120,50 @@ def __init__( warnings.warn("client_cert_source is deprecated", DeprecationWarning) if channel: - # Sanity check: Ensure that channel and credentials are not both - # provided. + # Ignore credentials if a channel was passed. credentials = False - # If a channel was explicitly provided, set it. self._grpc_channel = channel self._ssl_channel_credentials = None - 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, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - self._ssl_channel_credentials = ssl_credentials else: - host = host if ":" in host else host + ":443" + if api_mtls_endpoint: + host = api_mtls_endpoint + + # Create SSL credentials with client_cert_source or application + # default SSL credentials. + if client_cert_source: + cert, key = client_cert_source() + self._ssl_channel_credentials = grpc.ssl_channel_credentials( + certificate_chain=cert, private_key=key + ) + else: + self._ssl_channel_credentials = SslCredentials().ssl_credentials - if credentials is None: - credentials, _ = auth.default( - scopes=self.AUTH_SCOPES, quota_project_id=quota_project_id - ) + else: + if client_cert_source_for_mtls and not ssl_channel_credentials: + cert, key = client_cert_source_for_mtls() + self._ssl_channel_credentials = grpc.ssl_channel_credentials( + certificate_chain=cert, private_key=key + ) - if client_cert_source_for_mtls and not ssl_channel_credentials: - cert, key = client_cert_source_for_mtls() - self._ssl_channel_credentials = grpc.ssl_channel_credentials( - certificate_chain=cert, private_key=key - ) + # The base transport sets the host, credentials and scopes + super().__init__( + host=host, + credentials=credentials, + credentials_file=credentials_file, + scopes=scopes, + quota_project_id=quota_project_id, + client_info=client_info, + ) - # create a new channel. The provided one is ignored. + if not self._grpc_channel: self._grpc_channel = type(self).create_channel( - host, - credentials=credentials, + self._host, + credentials=self._credentials, credentials_file=credentials_file, + scopes=self._scopes, ssl_credentials=self._ssl_channel_credentials, - scopes=scopes or self.AUTH_SCOPES, quota_project_id=quota_project_id, options=[ ("grpc.max_send_message_length", -1), @@ -189,17 +171,8 @@ def __init__( ], ) - 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, - client_info=client_info, - ) + # Wrap messages. This must be done after self._grpc_channel exists + self._prep_wrapped_messages(client_info) @classmethod def create_channel( @@ -213,7 +186,7 @@ def create_channel( ) -> grpc.Channel: """Create and return a gRPC channel object. Args: - address (Optional[str]): The host for the channel to use. + host (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 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 index 99ed219b..9c405dac 100644 --- a/google/cloud/talent_v4beta1/services/profile_service/transports/grpc_asyncio.py +++ b/google/cloud/talent_v4beta1/services/profile_service/transports/grpc_asyncio.py @@ -65,7 +65,7 @@ def create_channel( ) -> aio.Channel: """Create and return a gRPC AsyncIO channel object. Args: - address (Optional[str]): The host for the channel to use. + host (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 @@ -143,10 +143,10 @@ def __init__( ignored if ``channel`` or ``ssl_channel_credentials`` is provided. quota_project_id (Optional[str]): An optional project to use for billing and quota. - 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 + 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. Raises: @@ -155,7 +155,9 @@ def __init__( google.api_core.exceptions.DuplicateCredentialArgs: If both ``credentials`` and ``credentials_file`` are passed. """ + self._grpc_channel = None self._ssl_channel_credentials = ssl_channel_credentials + self._stubs: Dict[str, Callable] = {} if api_mtls_endpoint: warnings.warn("api_mtls_endpoint is deprecated", DeprecationWarning) @@ -163,70 +165,50 @@ def __init__( warnings.warn("client_cert_source is deprecated", DeprecationWarning) if channel: - # Sanity check: Ensure that channel and credentials are not both - # provided. + # Ignore credentials if a channel was passed. credentials = False - # If a channel was explicitly provided, set it. self._grpc_channel = channel self._ssl_channel_credentials = None - 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, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - self._ssl_channel_credentials = ssl_credentials else: - host = host if ":" in host else host + ":443" + if api_mtls_endpoint: + host = api_mtls_endpoint + + # Create SSL credentials with client_cert_source or application + # default SSL credentials. + if client_cert_source: + cert, key = client_cert_source() + self._ssl_channel_credentials = grpc.ssl_channel_credentials( + certificate_chain=cert, private_key=key + ) + else: + self._ssl_channel_credentials = SslCredentials().ssl_credentials - if credentials is None: - credentials, _ = auth.default( - scopes=self.AUTH_SCOPES, quota_project_id=quota_project_id - ) + else: + if client_cert_source_for_mtls and not ssl_channel_credentials: + cert, key = client_cert_source_for_mtls() + self._ssl_channel_credentials = grpc.ssl_channel_credentials( + certificate_chain=cert, private_key=key + ) - if client_cert_source_for_mtls and not ssl_channel_credentials: - cert, key = client_cert_source_for_mtls() - self._ssl_channel_credentials = grpc.ssl_channel_credentials( - certificate_chain=cert, private_key=key - ) + # The base transport sets the host, credentials and scopes + super().__init__( + host=host, + credentials=credentials, + credentials_file=credentials_file, + scopes=scopes, + quota_project_id=quota_project_id, + client_info=client_info, + ) - # create a new channel. The provided one is ignored. + if not self._grpc_channel: self._grpc_channel = type(self).create_channel( - host, - credentials=credentials, + self._host, + credentials=self._credentials, credentials_file=credentials_file, + scopes=self._scopes, ssl_credentials=self._ssl_channel_credentials, - scopes=scopes or self.AUTH_SCOPES, quota_project_id=quota_project_id, options=[ ("grpc.max_send_message_length", -1), @@ -234,17 +216,8 @@ def __init__( ], ) - # 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, - client_info=client_info, - ) - - self._stubs = {} + # Wrap messages. This must be done after self._grpc_channel exists + self._prep_wrapped_messages(client_info) @property def grpc_channel(self) -> aio.Channel: diff --git a/google/cloud/talent_v4beta1/services/tenant_service/async_client.py b/google/cloud/talent_v4beta1/services/tenant_service/async_client.py index 6920c35b..047dffe9 100644 --- a/google/cloud/talent_v4beta1/services/tenant_service/async_client.py +++ b/google/cloud/talent_v4beta1/services/tenant_service/async_client.py @@ -335,6 +335,7 @@ async def get_tenant( predicate=retries.if_exception_type( exceptions.DeadlineExceeded, exceptions.ServiceUnavailable, ), + deadline=30.0, ), default_timeout=30.0, client_info=DEFAULT_CLIENT_INFO, @@ -493,6 +494,7 @@ async def delete_tenant( predicate=retries.if_exception_type( exceptions.DeadlineExceeded, exceptions.ServiceUnavailable, ), + deadline=30.0, ), default_timeout=30.0, client_info=DEFAULT_CLIENT_INFO, @@ -578,6 +580,7 @@ async def list_tenants( predicate=retries.if_exception_type( exceptions.DeadlineExceeded, exceptions.ServiceUnavailable, ), + deadline=30.0, ), default_timeout=30.0, client_info=DEFAULT_CLIENT_INFO, diff --git a/google/cloud/talent_v4beta1/services/tenant_service/transports/base.py b/google/cloud/talent_v4beta1/services/tenant_service/transports/base.py index b0f77c0d..73ae1b06 100644 --- a/google/cloud/talent_v4beta1/services/tenant_service/transports/base.py +++ b/google/cloud/talent_v4beta1/services/tenant_service/transports/base.py @@ -73,10 +73,10 @@ def __init__( scope (Optional[Sequence[str]]): A list of scopes. quota_project_id (Optional[str]): An optional project to use for billing and quota. - 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 + 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. """ # Save the hostname. Default to port 443 (HTTPS) if none is specified. @@ -84,6 +84,9 @@ def __init__( host += ":443" self._host = host + # Save the scopes. + self._scopes = scopes or self.AUTH_SCOPES + # If no credentials are provided, then determine the appropriate # defaults. if credentials and credentials_file: @@ -93,20 +96,17 @@ def __init__( if credentials_file is not None: credentials, _ = auth.load_credentials_from_file( - credentials_file, scopes=scopes, quota_project_id=quota_project_id + credentials_file, scopes=self._scopes, quota_project_id=quota_project_id ) elif credentials is None: credentials, _ = auth.default( - scopes=scopes, quota_project_id=quota_project_id + scopes=self._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(client_info) - def _prep_wrapped_messages(self, client_info): # Precompute the wrapped methods. self._wrapped_methods = { @@ -122,6 +122,7 @@ def _prep_wrapped_messages(self, client_info): predicate=retries.if_exception_type( exceptions.DeadlineExceeded, exceptions.ServiceUnavailable, ), + deadline=30.0, ), default_timeout=30.0, client_info=client_info, @@ -138,6 +139,7 @@ def _prep_wrapped_messages(self, client_info): predicate=retries.if_exception_type( exceptions.DeadlineExceeded, exceptions.ServiceUnavailable, ), + deadline=30.0, ), default_timeout=30.0, client_info=client_info, @@ -151,6 +153,7 @@ def _prep_wrapped_messages(self, client_info): predicate=retries.if_exception_type( exceptions.DeadlineExceeded, exceptions.ServiceUnavailable, ), + deadline=30.0, ), default_timeout=30.0, client_info=client_info, diff --git a/google/cloud/talent_v4beta1/services/tenant_service/transports/grpc.py b/google/cloud/talent_v4beta1/services/tenant_service/transports/grpc.py index 84a88116..f187b6c1 100644 --- a/google/cloud/talent_v4beta1/services/tenant_service/transports/grpc.py +++ b/google/cloud/talent_v4beta1/services/tenant_service/transports/grpc.py @@ -110,7 +110,9 @@ def __init__( google.api_core.exceptions.DuplicateCredentialArgs: If both ``credentials`` and ``credentials_file`` are passed. """ + self._grpc_channel = None self._ssl_channel_credentials = ssl_channel_credentials + self._stubs: Dict[str, Callable] = {} if api_mtls_endpoint: warnings.warn("api_mtls_endpoint is deprecated", DeprecationWarning) @@ -118,70 +120,50 @@ def __init__( warnings.warn("client_cert_source is deprecated", DeprecationWarning) if channel: - # Sanity check: Ensure that channel and credentials are not both - # provided. + # Ignore credentials if a channel was passed. credentials = False - # If a channel was explicitly provided, set it. self._grpc_channel = channel self._ssl_channel_credentials = None - 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, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - self._ssl_channel_credentials = ssl_credentials else: - host = host if ":" in host else host + ":443" + if api_mtls_endpoint: + host = api_mtls_endpoint + + # Create SSL credentials with client_cert_source or application + # default SSL credentials. + if client_cert_source: + cert, key = client_cert_source() + self._ssl_channel_credentials = grpc.ssl_channel_credentials( + certificate_chain=cert, private_key=key + ) + else: + self._ssl_channel_credentials = SslCredentials().ssl_credentials - if credentials is None: - credentials, _ = auth.default( - scopes=self.AUTH_SCOPES, quota_project_id=quota_project_id - ) + else: + if client_cert_source_for_mtls and not ssl_channel_credentials: + cert, key = client_cert_source_for_mtls() + self._ssl_channel_credentials = grpc.ssl_channel_credentials( + certificate_chain=cert, private_key=key + ) - if client_cert_source_for_mtls and not ssl_channel_credentials: - cert, key = client_cert_source_for_mtls() - self._ssl_channel_credentials = grpc.ssl_channel_credentials( - certificate_chain=cert, private_key=key - ) + # The base transport sets the host, credentials and scopes + super().__init__( + host=host, + credentials=credentials, + credentials_file=credentials_file, + scopes=scopes, + quota_project_id=quota_project_id, + client_info=client_info, + ) - # create a new channel. The provided one is ignored. + if not self._grpc_channel: self._grpc_channel = type(self).create_channel( - host, - credentials=credentials, + self._host, + credentials=self._credentials, credentials_file=credentials_file, + scopes=self._scopes, ssl_credentials=self._ssl_channel_credentials, - scopes=scopes or self.AUTH_SCOPES, quota_project_id=quota_project_id, options=[ ("grpc.max_send_message_length", -1), @@ -189,17 +171,8 @@ def __init__( ], ) - 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, - client_info=client_info, - ) + # Wrap messages. This must be done after self._grpc_channel exists + self._prep_wrapped_messages(client_info) @classmethod def create_channel( @@ -213,7 +186,7 @@ def create_channel( ) -> grpc.Channel: """Create and return a gRPC channel object. Args: - address (Optional[str]): The host for the channel to use. + host (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 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 index c371fbdb..59aa7ff4 100644 --- a/google/cloud/talent_v4beta1/services/tenant_service/transports/grpc_asyncio.py +++ b/google/cloud/talent_v4beta1/services/tenant_service/transports/grpc_asyncio.py @@ -65,7 +65,7 @@ def create_channel( ) -> aio.Channel: """Create and return a gRPC AsyncIO channel object. Args: - address (Optional[str]): The host for the channel to use. + host (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 @@ -143,10 +143,10 @@ def __init__( ignored if ``channel`` or ``ssl_channel_credentials`` is provided. quota_project_id (Optional[str]): An optional project to use for billing and quota. - 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 + 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. Raises: @@ -155,7 +155,9 @@ def __init__( google.api_core.exceptions.DuplicateCredentialArgs: If both ``credentials`` and ``credentials_file`` are passed. """ + self._grpc_channel = None self._ssl_channel_credentials = ssl_channel_credentials + self._stubs: Dict[str, Callable] = {} if api_mtls_endpoint: warnings.warn("api_mtls_endpoint is deprecated", DeprecationWarning) @@ -163,70 +165,50 @@ def __init__( warnings.warn("client_cert_source is deprecated", DeprecationWarning) if channel: - # Sanity check: Ensure that channel and credentials are not both - # provided. + # Ignore credentials if a channel was passed. credentials = False - # If a channel was explicitly provided, set it. self._grpc_channel = channel self._ssl_channel_credentials = None - 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, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - self._ssl_channel_credentials = ssl_credentials else: - host = host if ":" in host else host + ":443" + if api_mtls_endpoint: + host = api_mtls_endpoint + + # Create SSL credentials with client_cert_source or application + # default SSL credentials. + if client_cert_source: + cert, key = client_cert_source() + self._ssl_channel_credentials = grpc.ssl_channel_credentials( + certificate_chain=cert, private_key=key + ) + else: + self._ssl_channel_credentials = SslCredentials().ssl_credentials - if credentials is None: - credentials, _ = auth.default( - scopes=self.AUTH_SCOPES, quota_project_id=quota_project_id - ) + else: + if client_cert_source_for_mtls and not ssl_channel_credentials: + cert, key = client_cert_source_for_mtls() + self._ssl_channel_credentials = grpc.ssl_channel_credentials( + certificate_chain=cert, private_key=key + ) - if client_cert_source_for_mtls and not ssl_channel_credentials: - cert, key = client_cert_source_for_mtls() - self._ssl_channel_credentials = grpc.ssl_channel_credentials( - certificate_chain=cert, private_key=key - ) + # The base transport sets the host, credentials and scopes + super().__init__( + host=host, + credentials=credentials, + credentials_file=credentials_file, + scopes=scopes, + quota_project_id=quota_project_id, + client_info=client_info, + ) - # create a new channel. The provided one is ignored. + if not self._grpc_channel: self._grpc_channel = type(self).create_channel( - host, - credentials=credentials, + self._host, + credentials=self._credentials, credentials_file=credentials_file, + scopes=self._scopes, ssl_credentials=self._ssl_channel_credentials, - scopes=scopes or self.AUTH_SCOPES, quota_project_id=quota_project_id, options=[ ("grpc.max_send_message_length", -1), @@ -234,17 +216,8 @@ def __init__( ], ) - # 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, - client_info=client_info, - ) - - self._stubs = {} + # Wrap messages. This must be done after self._grpc_channel exists + self._prep_wrapped_messages(client_info) @property def grpc_channel(self) -> aio.Channel: diff --git a/google/cloud/talent_v4beta1/types/common.py b/google/cloud/talent_v4beta1/types/common.py index c1cdd9b5..3d6d81ba 100644 --- a/google/cloud/talent_v4beta1/types/common.py +++ b/google/cloud/talent_v4beta1/types/common.py @@ -187,6 +187,7 @@ 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. """ + _pb_options = {"deprecated": True} VISIBILITY_UNSPECIFIED = 0 ACCOUNT_ONLY = 1 SHARED_WITH_GOOGLE = 2 diff --git a/synth.metadata b/synth.metadata index 19a3d8e9..d54f256e 100644 --- a/synth.metadata +++ b/synth.metadata @@ -11,8 +11,8 @@ "git": { "name": "googleapis", "remote": "https://github.com/googleapis/googleapis.git", - "sha": "d6b4fb337caf6eccb606728ef727ac76364a4f14", - "internalRef": "364358156" + "sha": "149a3a84c29c9b8189576c7442ccb6dcf6a8f95b", + "internalRef": "364411656" } }, { From c34bb81974395d1e8f4cf0207036b92d428d4971 Mon Sep 17 00:00:00 2001 From: yoshi-automation Date: Tue, 23 Mar 2021 19:43:32 -0700 Subject: [PATCH 34/38] feat: Added support for Monitoring Query Language: https://cloud.google.com/monitoring/mql feat: Added support for units in the MetricService feat: Added total_size to the response of ListAlertPolicies. fix: Un-deprecated cluster_istio for service monitoring. feat: Added IstioCanonicalService for service monitoring. feat: Added creation and mutation records to notification channels. feat: Added support for querying metrics for folders and organizations. fix: Extended the default deadline for UpdateGroup to 180s. feat: Added support for secondary aggregation when querying metrics. PiperOrigin-RevId: 364422694 Source-Author: Google APIs Source-Date: Mon Mar 22 15:30:13 2021 -0700 Source-Repo: googleapis/googleapis Source-Sha: 2124b6251e56e2ec8dd5c47e7d3815d7d5841880 Source-Link: https://github.com/googleapis/googleapis/commit/2124b6251e56e2ec8dd5c47e7d3815d7d5841880 --- google/cloud/talent_v4/__init__.py | 4 ++-- google/cloud/talent_v4beta1/__init__.py | 4 ++-- synth.metadata | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/google/cloud/talent_v4/__init__.py b/google/cloud/talent_v4/__init__.py index b193e4de..5d959d15 100644 --- a/google/cloud/talent_v4/__init__.py +++ b/google/cloud/talent_v4/__init__.py @@ -101,7 +101,6 @@ "CompensationInfo", "CompleteQueryRequest", "CompleteQueryResponse", - "CompletionClient", "CreateClientEventRequest", "CreateCompanyRequest", "CreateJobRequest", @@ -144,10 +143,11 @@ "SearchJobsResponse", "SpellingCorrection", "Tenant", + "TenantServiceClient", "TimestampRange", "UpdateCompanyRequest", "UpdateJobRequest", "UpdateTenantRequest", "Visibility", - "TenantServiceClient", + "CompletionClient", ) diff --git a/google/cloud/talent_v4beta1/__init__.py b/google/cloud/talent_v4beta1/__init__.py index 9494115b..b751ef4a 100644 --- a/google/cloud/talent_v4beta1/__init__.py +++ b/google/cloud/talent_v4beta1/__init__.py @@ -143,6 +143,7 @@ "ApplicationDateFilter", "ApplicationJobFilter", "ApplicationOutcomeNotesFilter", + "ApplicationServiceClient", "AvailabilityFilter", "AvailabilitySignal", "AvailabilitySignalType", @@ -202,7 +203,6 @@ "JobLevel", "JobOperationResult", "JobQuery", - "JobServiceClient", "JobTitleFilter", "JobView", "ListApplicationsRequest", @@ -253,5 +253,5 @@ "UpdateTenantRequest", "Visibility", "WorkExperienceFilter", - "ApplicationServiceClient", + "JobServiceClient", ) diff --git a/synth.metadata b/synth.metadata index d54f256e..317de19f 100644 --- a/synth.metadata +++ b/synth.metadata @@ -11,8 +11,8 @@ "git": { "name": "googleapis", "remote": "https://github.com/googleapis/googleapis.git", - "sha": "149a3a84c29c9b8189576c7442ccb6dcf6a8f95b", - "internalRef": "364411656" + "sha": "2124b6251e56e2ec8dd5c47e7d3815d7d5841880", + "internalRef": "364422694" } }, { From d427e64f3fbc47bbc985c657e056e236dcde5e1f Mon Sep 17 00:00:00 2001 From: yoshi-automation Date: Tue, 23 Mar 2021 19:44:26 -0700 Subject: [PATCH 35/38] feat: add RPC Priority request options PiperOrigin-RevId: 364449524 Source-Author: Google APIs Source-Date: Mon Mar 22 17:39:37 2021 -0700 Source-Repo: googleapis/googleapis Source-Sha: 6598bb829c9e9a534be674649ffd1b4671a821f9 Source-Link: https://github.com/googleapis/googleapis/commit/6598bb829c9e9a534be674649ffd1b4671a821f9 --- google/cloud/talent_v4/__init__.py | 4 ++-- google/cloud/talent_v4beta1/__init__.py | 4 ++-- synth.metadata | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/google/cloud/talent_v4/__init__.py b/google/cloud/talent_v4/__init__.py index 5d959d15..b193e4de 100644 --- a/google/cloud/talent_v4/__init__.py +++ b/google/cloud/talent_v4/__init__.py @@ -101,6 +101,7 @@ "CompensationInfo", "CompleteQueryRequest", "CompleteQueryResponse", + "CompletionClient", "CreateClientEventRequest", "CreateCompanyRequest", "CreateJobRequest", @@ -143,11 +144,10 @@ "SearchJobsResponse", "SpellingCorrection", "Tenant", - "TenantServiceClient", "TimestampRange", "UpdateCompanyRequest", "UpdateJobRequest", "UpdateTenantRequest", "Visibility", - "CompletionClient", + "TenantServiceClient", ) diff --git a/google/cloud/talent_v4beta1/__init__.py b/google/cloud/talent_v4beta1/__init__.py index b751ef4a..9494115b 100644 --- a/google/cloud/talent_v4beta1/__init__.py +++ b/google/cloud/talent_v4beta1/__init__.py @@ -143,7 +143,6 @@ "ApplicationDateFilter", "ApplicationJobFilter", "ApplicationOutcomeNotesFilter", - "ApplicationServiceClient", "AvailabilityFilter", "AvailabilitySignal", "AvailabilitySignalType", @@ -203,6 +202,7 @@ "JobLevel", "JobOperationResult", "JobQuery", + "JobServiceClient", "JobTitleFilter", "JobView", "ListApplicationsRequest", @@ -253,5 +253,5 @@ "UpdateTenantRequest", "Visibility", "WorkExperienceFilter", - "JobServiceClient", + "ApplicationServiceClient", ) diff --git a/synth.metadata b/synth.metadata index 317de19f..08b2328b 100644 --- a/synth.metadata +++ b/synth.metadata @@ -11,8 +11,8 @@ "git": { "name": "googleapis", "remote": "https://github.com/googleapis/googleapis.git", - "sha": "2124b6251e56e2ec8dd5c47e7d3815d7d5841880", - "internalRef": "364422694" + "sha": "6598bb829c9e9a534be674649ffd1b4671a821f9", + "internalRef": "364449524" } }, { From 7e3cc914ac1163abca7002146189c49ed7a816b0 Mon Sep 17 00:00:00 2001 From: yoshi-automation Date: Tue, 23 Mar 2021 19:45:19 -0700 Subject: [PATCH 36/38] build: use latest commit for gapic-generator-ruby. (Fixes error in gapic metadata generation.) Committer: @virost PiperOrigin-RevId: 364687773 Source-Author: Google APIs Source-Date: Tue Mar 23 17:51:18 2021 -0700 Source-Repo: googleapis/googleapis Source-Sha: 321ac4be7cffd9eca44a131d8ba900ce718b99af Source-Link: https://github.com/googleapis/googleapis/commit/321ac4be7cffd9eca44a131d8ba900ce718b99af --- google/cloud/talent_v4/__init__.py | 4 ++-- synth.metadata | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/google/cloud/talent_v4/__init__.py b/google/cloud/talent_v4/__init__.py index b193e4de..5d959d15 100644 --- a/google/cloud/talent_v4/__init__.py +++ b/google/cloud/talent_v4/__init__.py @@ -101,7 +101,6 @@ "CompensationInfo", "CompleteQueryRequest", "CompleteQueryResponse", - "CompletionClient", "CreateClientEventRequest", "CreateCompanyRequest", "CreateJobRequest", @@ -144,10 +143,11 @@ "SearchJobsResponse", "SpellingCorrection", "Tenant", + "TenantServiceClient", "TimestampRange", "UpdateCompanyRequest", "UpdateJobRequest", "UpdateTenantRequest", "Visibility", - "TenantServiceClient", + "CompletionClient", ) diff --git a/synth.metadata b/synth.metadata index 08b2328b..9d2acc2b 100644 --- a/synth.metadata +++ b/synth.metadata @@ -11,8 +11,8 @@ "git": { "name": "googleapis", "remote": "https://github.com/googleapis/googleapis.git", - "sha": "6598bb829c9e9a534be674649ffd1b4671a821f9", - "internalRef": "364449524" + "sha": "321ac4be7cffd9eca44a131d8ba900ce718b99af", + "internalRef": "364687773" } }, { From 8a12124259ca87c5064fabe9f058ed966eea2d56 Mon Sep 17 00:00:00 2001 From: Bu Sun Kim Date: Tue, 30 Mar 2021 16:15:23 +0000 Subject: [PATCH 37/38] chore: regen --- .github/header-checker-lint.yml | 15 ++ .gitignore | 4 +- .kokoro/build.sh | 26 +- .kokoro/docs/docs-presubmit.cfg | 11 + .kokoro/samples/python3.6/periodic-head.cfg | 11 + .kokoro/samples/python3.7/periodic-head.cfg | 11 + .kokoro/samples/python3.8/periodic-head.cfg | 11 + .kokoro/test-samples-against-head.sh | 28 ++ .kokoro/test-samples-impl.sh | 102 ++++++++ .kokoro/test-samples.sh | 96 ++----- .kokoro/trampoline_v2.sh | 2 +- .pre-commit-config.yaml | 2 +- .trampolinerc | 1 + CONTRIBUTING.rst | 22 +- MANIFEST.in | 4 +- UPGRADING.md | 6 +- google/cloud/talent_v4/__init__.py | 4 +- google/cloud/talent_v4beta1/__init__.py | 4 +- noxfile.py | 59 ++++- renovate.json | 3 +- samples/snippets/noxfile.py | 2 +- setup.py | 7 +- synth.metadata | 275 +------------------- synth.py | 2 +- testing/constraints-3.6.txt | 5 +- 25 files changed, 321 insertions(+), 392 deletions(-) create mode 100644 .github/header-checker-lint.yml create mode 100644 .kokoro/samples/python3.6/periodic-head.cfg create mode 100644 .kokoro/samples/python3.7/periodic-head.cfg create mode 100644 .kokoro/samples/python3.8/periodic-head.cfg create mode 100755 .kokoro/test-samples-against-head.sh create mode 100755 .kokoro/test-samples-impl.sh diff --git a/.github/header-checker-lint.yml b/.github/header-checker-lint.yml new file mode 100644 index 00000000..fc281c05 --- /dev/null +++ b/.github/header-checker-lint.yml @@ -0,0 +1,15 @@ +{"allowedCopyrightHolders": ["Google LLC"], + "allowedLicenses": ["Apache-2.0", "MIT", "BSD-3"], + "ignoreFiles": ["**/requirements.txt", "**/requirements-test.txt"], + "sourceFileExtensions": [ + "ts", + "js", + "java", + "sh", + "Dockerfile", + "yaml", + "py", + "html", + "txt" + ] +} \ No newline at end of file diff --git a/.gitignore b/.gitignore index b9daa52f..b4243ced 100644 --- a/.gitignore +++ b/.gitignore @@ -50,8 +50,10 @@ docs.metadata # Virtual environment env/ + +# Test logs coverage.xml -sponge_log.xml +*sponge_log.xml # System test environment variables. system_tests/local_test_setup diff --git a/.kokoro/build.sh b/.kokoro/build.sh index 291a09e9..6e491f98 100755 --- a/.kokoro/build.sh +++ b/.kokoro/build.sh @@ -15,7 +15,11 @@ set -eo pipefail -cd github/python-talent +if [[ -z "${PROJECT_ROOT:-}" ]]; then + PROJECT_ROOT="github/python-talent" +fi + +cd "${PROJECT_ROOT}" # Disable buffering, so that the logs stream through. export PYTHONUNBUFFERED=1 @@ -30,16 +34,26 @@ export GOOGLE_APPLICATION_CREDENTIALS=${KOKORO_GFILE_DIR}/service-account.json export PROJECT_ID=$(cat "${KOKORO_GFILE_DIR}/project-id.json") # Remove old nox -python3.6 -m pip uninstall --yes --quiet nox-automation +python3 -m pip uninstall --yes --quiet nox-automation # Install nox -python3.6 -m pip install --upgrade --quiet nox -python3.6 -m nox --version +python3 -m pip install --upgrade --quiet nox +python3 -m nox --version + +# If this is a continuous build, send the test log to the FlakyBot. +# See https://github.com/googleapis/repo-automation-bots/tree/master/packages/flakybot. +if [[ $KOKORO_BUILD_ARTIFACTS_SUBDIR = *"continuous"* ]]; then + cleanup() { + chmod +x $KOKORO_GFILE_DIR/linux_amd64/flakybot + $KOKORO_GFILE_DIR/linux_amd64/flakybot + } + trap cleanup EXIT HUP +fi # If NOX_SESSION is set, it only runs the specified session, # otherwise run all the sessions. if [[ -n "${NOX_SESSION:-}" ]]; then - python3.6 -m nox -s "${NOX_SESSION:-}" + python3 -m nox -s ${NOX_SESSION:-} else - python3.6 -m nox + python3 -m nox fi diff --git a/.kokoro/docs/docs-presubmit.cfg b/.kokoro/docs/docs-presubmit.cfg index 11181078..d5bb31d6 100644 --- a/.kokoro/docs/docs-presubmit.cfg +++ b/.kokoro/docs/docs-presubmit.cfg @@ -15,3 +15,14 @@ env_vars: { key: "TRAMPOLINE_IMAGE_UPLOAD" value: "false" } + +env_vars: { + key: "TRAMPOLINE_BUILD_FILE" + value: "github/python-talent/.kokoro/build.sh" +} + +# Only run this nox session. +env_vars: { + key: "NOX_SESSION" + value: "docs docfx" +} diff --git a/.kokoro/samples/python3.6/periodic-head.cfg b/.kokoro/samples/python3.6/periodic-head.cfg new file mode 100644 index 00000000..f9cfcd33 --- /dev/null +++ b/.kokoro/samples/python3.6/periodic-head.cfg @@ -0,0 +1,11 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +env_vars: { + key: "INSTALL_LIBRARY_FROM_SOURCE" + value: "True" +} + +env_vars: { + key: "TRAMPOLINE_BUILD_FILE" + value: "github/python-pubsub/.kokoro/test-samples-against-head.sh" +} diff --git a/.kokoro/samples/python3.7/periodic-head.cfg b/.kokoro/samples/python3.7/periodic-head.cfg new file mode 100644 index 00000000..f9cfcd33 --- /dev/null +++ b/.kokoro/samples/python3.7/periodic-head.cfg @@ -0,0 +1,11 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +env_vars: { + key: "INSTALL_LIBRARY_FROM_SOURCE" + value: "True" +} + +env_vars: { + key: "TRAMPOLINE_BUILD_FILE" + value: "github/python-pubsub/.kokoro/test-samples-against-head.sh" +} diff --git a/.kokoro/samples/python3.8/periodic-head.cfg b/.kokoro/samples/python3.8/periodic-head.cfg new file mode 100644 index 00000000..f9cfcd33 --- /dev/null +++ b/.kokoro/samples/python3.8/periodic-head.cfg @@ -0,0 +1,11 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +env_vars: { + key: "INSTALL_LIBRARY_FROM_SOURCE" + value: "True" +} + +env_vars: { + key: "TRAMPOLINE_BUILD_FILE" + value: "github/python-pubsub/.kokoro/test-samples-against-head.sh" +} diff --git a/.kokoro/test-samples-against-head.sh b/.kokoro/test-samples-against-head.sh new file mode 100755 index 00000000..ecd01578 --- /dev/null +++ b/.kokoro/test-samples-against-head.sh @@ -0,0 +1,28 @@ +#!/bin/bash +# 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. + +# A customized test runner for samples. +# +# For periodic builds, you can specify this file for testing against head. + +# `-e` enables the script to automatically fail when a command fails +# `-o pipefail` sets the exit code to the rightmost comment to exit with a non-zero +set -eo pipefail +# Enables `**` to include files nested inside sub-folders +shopt -s globstar + +cd github/python-talent + +exec .kokoro/test-samples-impl.sh diff --git a/.kokoro/test-samples-impl.sh b/.kokoro/test-samples-impl.sh new file mode 100755 index 00000000..cf5de74c --- /dev/null +++ b/.kokoro/test-samples-impl.sh @@ -0,0 +1,102 @@ +#!/bin/bash +# Copyright 2021 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. + + +# `-e` enables the script to automatically fail when a command fails +# `-o pipefail` sets the exit code to the rightmost comment to exit with a non-zero +set -eo pipefail +# Enables `**` to include files nested inside sub-folders +shopt -s globstar + +# Exit early if samples directory doesn't exist +if [ ! -d "./samples" ]; then + echo "No tests run. `./samples` not found" + exit 0 +fi + +# Disable buffering, so that the logs stream through. +export PYTHONUNBUFFERED=1 + +# Debug: show build environment +env | grep KOKORO + +# Install nox +python3.6 -m pip install --upgrade --quiet nox + +# Use secrets acessor service account to get secrets +if [[ -f "${KOKORO_GFILE_DIR}/secrets_viewer_service_account.json" ]]; then + gcloud auth activate-service-account \ + --key-file="${KOKORO_GFILE_DIR}/secrets_viewer_service_account.json" \ + --project="cloud-devrel-kokoro-resources" +fi + +# This script will create 3 files: +# - testing/test-env.sh +# - testing/service-account.json +# - testing/client-secrets.json +./scripts/decrypt-secrets.sh + +source ./testing/test-env.sh +export GOOGLE_APPLICATION_CREDENTIALS=$(pwd)/testing/service-account.json + +# For cloud-run session, we activate the service account for gcloud sdk. +gcloud auth activate-service-account \ + --key-file "${GOOGLE_APPLICATION_CREDENTIALS}" + +export GOOGLE_CLIENT_SECRETS=$(pwd)/testing/client-secrets.json + +echo -e "\n******************** TESTING PROJECTS ********************" + +# Switch to 'fail at end' to allow all tests to complete before exiting. +set +e +# Use RTN to return a non-zero value if the test fails. +RTN=0 +ROOT=$(pwd) +# Find all requirements.txt in the samples directory (may break on whitespace). +for file in samples/**/requirements.txt; do + cd "$ROOT" + # Navigate to the project folder. + file=$(dirname "$file") + cd "$file" + + echo "------------------------------------------------------------" + echo "- testing $file" + echo "------------------------------------------------------------" + + # Use nox to execute the tests for the project. + python3.6 -m nox -s "$RUN_TESTS_SESSION" + EXIT=$? + + # If this is a periodic build, send the test log to the FlakyBot. + # See https://github.com/googleapis/repo-automation-bots/tree/master/packages/flakybot. + if [[ $KOKORO_BUILD_ARTIFACTS_SUBDIR = *"periodic"* ]]; then + chmod +x $KOKORO_GFILE_DIR/linux_amd64/flakybot + $KOKORO_GFILE_DIR/linux_amd64/flakybot + fi + + if [[ $EXIT -ne 0 ]]; then + RTN=1 + echo -e "\n Testing failed: Nox returned a non-zero exit code. \n" + else + echo -e "\n Testing completed.\n" + fi + +done +cd "$ROOT" + +# Workaround for Kokoro permissions issue: delete secrets +rm testing/{test-env.sh,client-secrets.json,service-account.json} + +exit "$RTN" diff --git a/.kokoro/test-samples.sh b/.kokoro/test-samples.sh index 4b0afc93..09ba8e25 100755 --- a/.kokoro/test-samples.sh +++ b/.kokoro/test-samples.sh @@ -13,6 +13,10 @@ # See the License for the specific language governing permissions and # limitations under the License. +# The default test runner for samples. +# +# For periodic builds, we rewinds the repo to the latest release, and +# run test-samples-impl.sh. # `-e` enables the script to automatically fail when a command fails # `-o pipefail` sets the exit code to the rightmost comment to exit with a non-zero @@ -24,87 +28,19 @@ cd github/python-talent # Run periodic samples tests at latest release if [[ $KOKORO_BUILD_ARTIFACTS_SUBDIR = *"periodic"* ]]; then + # preserving the test runner implementation. + cp .kokoro/test-samples-impl.sh "${TMPDIR}/test-samples-impl.sh" + echo "--- IMPORTANT IMPORTANT IMPORTANT ---" + echo "Now we rewind the repo back to the latest release..." LATEST_RELEASE=$(git describe --abbrev=0 --tags) git checkout $LATEST_RELEASE -fi - -# Exit early if samples directory doesn't exist -if [ ! -d "./samples" ]; then - echo "No tests run. `./samples` not found" - exit 0 -fi - -# Disable buffering, so that the logs stream through. -export PYTHONUNBUFFERED=1 - -# Debug: show build environment -env | grep KOKORO - -# Install nox -python3.6 -m pip install --upgrade --quiet nox - -# Use secrets acessor service account to get secrets -if [[ -f "${KOKORO_GFILE_DIR}/secrets_viewer_service_account.json" ]]; then - gcloud auth activate-service-account \ - --key-file="${KOKORO_GFILE_DIR}/secrets_viewer_service_account.json" \ - --project="cloud-devrel-kokoro-resources" -fi - -# This script will create 3 files: -# - testing/test-env.sh -# - testing/service-account.json -# - testing/client-secrets.json -./scripts/decrypt-secrets.sh - -source ./testing/test-env.sh -export GOOGLE_APPLICATION_CREDENTIALS=$(pwd)/testing/service-account.json - -# For cloud-run session, we activate the service account for gcloud sdk. -gcloud auth activate-service-account \ - --key-file "${GOOGLE_APPLICATION_CREDENTIALS}" - -export GOOGLE_CLIENT_SECRETS=$(pwd)/testing/client-secrets.json - -echo -e "\n******************** TESTING PROJECTS ********************" - -# Switch to 'fail at end' to allow all tests to complete before exiting. -set +e -# Use RTN to return a non-zero value if the test fails. -RTN=0 -ROOT=$(pwd) -# Find all requirements.txt in the samples directory (may break on whitespace). -for file in samples/**/requirements.txt; do - cd "$ROOT" - # Navigate to the project folder. - file=$(dirname "$file") - cd "$file" - - echo "------------------------------------------------------------" - echo "- testing $file" - echo "------------------------------------------------------------" - - # Use nox to execute the tests for the project. - python3.6 -m nox -s "$RUN_TESTS_SESSION" - EXIT=$? - - # If this is a periodic build, send the test log to the Build Cop Bot. - # See https://github.com/googleapis/repo-automation-bots/tree/master/packages/buildcop. - if [[ $KOKORO_BUILD_ARTIFACTS_SUBDIR = *"periodic"* ]]; then - chmod +x $KOKORO_GFILE_DIR/linux_amd64/buildcop - $KOKORO_GFILE_DIR/linux_amd64/buildcop + echo "The current head is: " + echo $(git rev-parse --verify HEAD) + echo "--- IMPORTANT IMPORTANT IMPORTANT ---" + # move back the test runner implementation if there's no file. + if [ ! -f .kokoro/test-samples-impl.sh ]; then + cp "${TMPDIR}/test-samples-impl.sh" .kokoro/test-samples-impl.sh fi +fi - if [[ $EXIT -ne 0 ]]; then - RTN=1 - echo -e "\n Testing failed: Nox returned a non-zero exit code. \n" - else - echo -e "\n Testing completed.\n" - fi - -done -cd "$ROOT" - -# Workaround for Kokoro permissions issue: delete secrets -rm testing/{test-env.sh,client-secrets.json,service-account.json} - -exit "$RTN" +exec .kokoro/test-samples-impl.sh diff --git a/.kokoro/trampoline_v2.sh b/.kokoro/trampoline_v2.sh index 719bcd5b..4af6cdc2 100755 --- a/.kokoro/trampoline_v2.sh +++ b/.kokoro/trampoline_v2.sh @@ -159,7 +159,7 @@ if [[ -n "${KOKORO_BUILD_ID:-}" ]]; then "KOKORO_GITHUB_COMMIT" "KOKORO_GITHUB_PULL_REQUEST_NUMBER" "KOKORO_GITHUB_PULL_REQUEST_COMMIT" - # For Build Cop Bot + # For FlakyBot "KOKORO_GITHUB_COMMIT_URL" "KOKORO_GITHUB_PULL_REQUEST_URL" ) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index a9024b15..32302e48 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -12,6 +12,6 @@ repos: hooks: - id: black - repo: https://gitlab.com/pycqa/flake8 - rev: 3.8.4 + rev: 3.9.0 hooks: - id: flake8 diff --git a/.trampolinerc b/.trampolinerc index 995ee291..383b6ec8 100644 --- a/.trampolinerc +++ b/.trampolinerc @@ -24,6 +24,7 @@ required_envvars+=( pass_down_envvars+=( "STAGING_BUCKET" "V2_STAGING_BUCKET" + "NOX_SESSION" ) # Prevent unintentional override on the default image. diff --git a/CONTRIBUTING.rst b/CONTRIBUTING.rst index 12046067..89f4d56d 100644 --- a/CONTRIBUTING.rst +++ b/CONTRIBUTING.rst @@ -70,9 +70,14 @@ We use `nox `__ to instrument our tests. - To test your changes, run unit tests with ``nox``:: $ nox -s unit-2.7 - $ nox -s unit-3.7 + $ nox -s unit-3.8 $ ... +- Args to pytest can be passed through the nox command separated by a `--`. For + example, to run a single test:: + + $ nox -s unit-3.8 -- -k + .. note:: The unit tests and system tests are described in the @@ -93,8 +98,12 @@ On Debian/Ubuntu:: ************ Coding Style ************ +- We use the automatic code formatter ``black``. You can run it using + the nox session ``blacken``. This will eliminate many lint errors. Run via:: + + $ nox -s blacken -- PEP8 compliance, with exceptions defined in the linter configuration. +- PEP8 compliance is required, with exceptions defined in the linter configuration. If you have ``nox`` installed, you can test that you have not introduced any non-compliant code via:: @@ -133,13 +142,18 @@ Running System Tests - To run system tests, you can execute:: - $ nox -s system-3.7 + # Run all system tests + $ nox -s system-3.8 $ nox -s system-2.7 + # Run a single system test + $ nox -s system-3.8 -- -k + + .. note:: System tests are only configured to run under Python 2.7 and - Python 3.7. For expediency, we do not run them in older versions + Python 3.8. For expediency, we do not run them in older versions of Python 3. This alone will not run the tests. You'll need to change some local diff --git a/MANIFEST.in b/MANIFEST.in index e9e29d12..e783f4c6 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -16,10 +16,10 @@ # Generated by synthtool. DO NOT EDIT! include README.rst LICENSE -recursive-include google *.json *.proto +recursive-include google *.json *.proto py.typed recursive-include tests * global-exclude *.py[co] global-exclude __pycache__ # Exclude scripts for samples readmegen -prune scripts/readme-gen \ No newline at end of file +prune scripts/readme-gen diff --git a/UPGRADING.md b/UPGRADING.md index 9a5a84b4..60dcddc5 100644 --- a/UPGRADING.md +++ b/UPGRADING.md @@ -13,9 +13,9 @@ The 1.0.0 release requires Python 3.6+. > **WARNING**: Breaking change Methods expect request objects. We provide a script that will convert most common use cases. -* Install the library +* Install the library with `libcst.` ```py -python3 -m pip install google-cloud-talent +python3 -m pip install google-cloud-talent[libcst] ``` * The scripts `fixup_talent_v4beta1_keywords.py` shipped with the library. It expects @@ -155,4 +155,4 @@ request = talent_v4.SearchJobsRequest( ) for response_item in client.search_jobs(request=request).matching_jobs: # ... -``` \ No newline at end of file +``` diff --git a/google/cloud/talent_v4/__init__.py b/google/cloud/talent_v4/__init__.py index 5d959d15..b193e4de 100644 --- a/google/cloud/talent_v4/__init__.py +++ b/google/cloud/talent_v4/__init__.py @@ -101,6 +101,7 @@ "CompensationInfo", "CompleteQueryRequest", "CompleteQueryResponse", + "CompletionClient", "CreateClientEventRequest", "CreateCompanyRequest", "CreateJobRequest", @@ -143,11 +144,10 @@ "SearchJobsResponse", "SpellingCorrection", "Tenant", - "TenantServiceClient", "TimestampRange", "UpdateCompanyRequest", "UpdateJobRequest", "UpdateTenantRequest", "Visibility", - "CompletionClient", + "TenantServiceClient", ) diff --git a/google/cloud/talent_v4beta1/__init__.py b/google/cloud/talent_v4beta1/__init__.py index 9494115b..4743ac58 100644 --- a/google/cloud/talent_v4beta1/__init__.py +++ b/google/cloud/talent_v4beta1/__init__.py @@ -143,6 +143,7 @@ "ApplicationDateFilter", "ApplicationJobFilter", "ApplicationOutcomeNotesFilter", + "ApplicationServiceClient", "AvailabilityFilter", "AvailabilitySignal", "AvailabilitySignalType", @@ -243,7 +244,6 @@ "SpellingCorrection", "SummarizedProfile", "Tenant", - "TenantServiceClient", "TimeFilter", "TimestampRange", "UpdateApplicationRequest", @@ -253,5 +253,5 @@ "UpdateTenantRequest", "Visibility", "WorkExperienceFilter", - "ApplicationServiceClient", + "TenantServiceClient", ) diff --git a/noxfile.py b/noxfile.py index 41eeb037..186246f0 100644 --- a/noxfile.py +++ b/noxfile.py @@ -18,6 +18,7 @@ from __future__ import absolute_import import os +import pathlib import shutil import nox @@ -30,6 +31,22 @@ SYSTEM_TEST_PYTHON_VERSIONS = ["3.8"] UNIT_TEST_PYTHON_VERSIONS = ["3.6", "3.7", "3.8", "3.9"] +CURRENT_DIRECTORY = pathlib.Path(__file__).parent.absolute() + +# 'docfx' is excluded since it only needs to run in 'docs-presubmit' +nox.options.sessions = [ + "unit", + "system", + "cover", + "lint", + "lint_setup_py", + "blacken", + "docs", +] + +# Error if a python version is missing +nox.options.error_on_missing_interpreters = True + @nox.session(python=DEFAULT_PYTHON_VERSION) def lint(session): @@ -70,17 +87,21 @@ 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", + constraints_path = str( + CURRENT_DIRECTORY / "testing" / f"constraints-{session.python}.txt" ) - session.install("-e", ".") + session.install("asyncmock", "pytest-asyncio", "-c", constraints_path) + + session.install("mock", "pytest", "pytest-cov", "-c", constraints_path) + + session.install("-e", ".", "-c", constraints_path) # Run py.test against the unit tests. session.run( "py.test", "--quiet", + f"--junitxml=unit_{session.python}_sponge_log.xml", "--cov=google/cloud", "--cov=tests/unit", "--cov-append", @@ -101,6 +122,9 @@ def unit(session): @nox.session(python=SYSTEM_TEST_PYTHON_VERSIONS) def system(session): """Run the system test suite.""" + constraints_path = str( + CURRENT_DIRECTORY / "testing" / f"constraints-{session.python}.txt" + ) system_test_path = os.path.join("tests", "system.py") system_test_folder_path = os.path.join("tests", "system") @@ -110,6 +134,9 @@ def system(session): # Sanity check: Only run tests if the environment variable is set. if not os.environ.get("GOOGLE_APPLICATION_CREDENTIALS", ""): session.skip("Credentials must be set via environment variable") + # Install pyopenssl for mTLS testing. + if os.environ.get("GOOGLE_API_USE_CLIENT_CERTIFICATE", "false") == "true": + session.install("pyopenssl") system_test_exists = os.path.exists(system_test_path) system_test_folder_exists = os.path.exists(system_test_folder_path) @@ -122,16 +149,26 @@ def system(session): # Install all test dependencies, then install this package into the # virtualenv's dist-packages. - session.install( - "mock", "pytest", "google-cloud-testutils", - ) - session.install("-e", ".") + session.install("mock", "pytest", "google-cloud-testutils", "-c", constraints_path) + session.install("-e", ".", "-c", constraints_path) # Run py.test against the system tests. if system_test_exists: - session.run("py.test", "--quiet", system_test_path, *session.posargs) + session.run( + "py.test", + "--quiet", + f"--junitxml=system_{session.python}_sponge_log.xml", + system_test_path, + *session.posargs, + ) if system_test_folder_exists: - session.run("py.test", "--quiet", system_test_folder_path, *session.posargs) + session.run( + "py.test", + "--quiet", + f"--junitxml=system_{session.python}_sponge_log.xml", + system_test_folder_path, + *session.posargs, + ) @nox.session(python=DEFAULT_PYTHON_VERSION) @@ -142,7 +179,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=99") + session.run("coverage", "report", "--show-missing", "--fail-under=998") session.run("coverage", "erase") diff --git a/renovate.json b/renovate.json index 4fa94931..f08bc22c 100644 --- a/renovate.json +++ b/renovate.json @@ -1,5 +1,6 @@ { "extends": [ "config:base", ":preserveSemverRanges" - ] + ], + "ignorePaths": [".pre-commit-config.yaml"] } diff --git a/samples/snippets/noxfile.py b/samples/snippets/noxfile.py index bca0522e..97bf7da8 100644 --- a/samples/snippets/noxfile.py +++ b/samples/snippets/noxfile.py @@ -85,7 +85,7 @@ def get_pytest_env_vars() -> Dict[str, str]: # DO NOT EDIT - automatically generated. # All versions used to tested samples. -ALL_VERSIONS = ["2.7", "3.6", "3.7", "3.8"] +ALL_VERSIONS = ["2.7", "3.6", "3.7", "3.8", "3.9"] # Any default versions that should be ignored. IGNORED_VERSIONS = TEST_CONFIG['ignored_versions'] diff --git a/setup.py b/setup.py index 6cd77735..1dc00641 100644 --- a/setup.py +++ b/setup.py @@ -29,11 +29,10 @@ # 'Development Status :: 5 - Production/Stable' release_status = "Development Status :: 4 - Beta" dependencies = [ - "google-api-core[grpc] >= 1.22.0, < 2.0.0dev", - "proto-plus >= 1.4.0", - "libcst >= 0.2.5", + "google-api-core[grpc] >= 1.22.2, < 2.0.0dev", + "proto-plus >= 1.15.0", ] -extras = {} +extras = {"libcst": "libcst >= 0.2.5"} # Setup boilerplate below this line. diff --git a/synth.metadata b/synth.metadata index 9d2acc2b..d9f852ba 100644 --- a/synth.metadata +++ b/synth.metadata @@ -3,30 +3,30 @@ { "git": { "name": ".", - "remote": "https://github.com/googleapis/python-talent.git", - "sha": "bb632f21c24cdca6094f989657ec6e72d4ffb371" + "remote": "git@github.com:googleapis/python-talent", + "sha": "7e3cc914ac1163abca7002146189c49ed7a816b0" } }, { "git": { "name": "googleapis", "remote": "https://github.com/googleapis/googleapis.git", - "sha": "321ac4be7cffd9eca44a131d8ba900ce718b99af", - "internalRef": "364687773" + "sha": "c539b9b08b3366ee00c0ec1950f4df711552a269", + "internalRef": "365759522" } }, { "git": { "name": "synthtool", "remote": "https://github.com/googleapis/synthtool.git", - "sha": "41a4e56982620d3edcf110d76f4fcdfdec471ac8" + "sha": "572ef8f70edd9041f5bcfa71511aed6aecfc2098" } }, { "git": { "name": "synthtool", "remote": "https://github.com/googleapis/synthtool.git", - "sha": "41a4e56982620d3edcf110d76f4fcdfdec471ac8" + "sha": "572ef8f70edd9041f5bcfa71511aed6aecfc2098" } } ], @@ -49,268 +49,5 @@ "generator": "bazel" } } - ], - "generatedFiles": [ - ".coveragerc", - ".flake8", - ".github/CONTRIBUTING.md", - ".github/ISSUE_TEMPLATE/bug_report.md", - ".github/ISSUE_TEMPLATE/feature_request.md", - ".github/ISSUE_TEMPLATE/support_request.md", - ".github/PULL_REQUEST_TEMPLATE.md", - ".github/release-please.yml", - ".github/snippet-bot.yml", - ".gitignore", - ".kokoro/build.sh", - ".kokoro/continuous/common.cfg", - ".kokoro/continuous/continuous.cfg", - ".kokoro/docker/docs/Dockerfile", - ".kokoro/docker/docs/fetch_gpg_keys.sh", - ".kokoro/docs/common.cfg", - ".kokoro/docs/docs-presubmit.cfg", - ".kokoro/docs/docs.cfg", - ".kokoro/populate-secrets.sh", - ".kokoro/presubmit/common.cfg", - ".kokoro/presubmit/presubmit.cfg", - ".kokoro/publish-docs.sh", - ".kokoro/release.sh", - ".kokoro/release/common.cfg", - ".kokoro/release/release.cfg", - ".kokoro/samples/lint/common.cfg", - ".kokoro/samples/lint/continuous.cfg", - ".kokoro/samples/lint/periodic.cfg", - ".kokoro/samples/lint/presubmit.cfg", - ".kokoro/samples/python3.6/common.cfg", - ".kokoro/samples/python3.6/continuous.cfg", - ".kokoro/samples/python3.6/periodic.cfg", - ".kokoro/samples/python3.6/presubmit.cfg", - ".kokoro/samples/python3.7/common.cfg", - ".kokoro/samples/python3.7/continuous.cfg", - ".kokoro/samples/python3.7/periodic.cfg", - ".kokoro/samples/python3.7/presubmit.cfg", - ".kokoro/samples/python3.8/common.cfg", - ".kokoro/samples/python3.8/continuous.cfg", - ".kokoro/samples/python3.8/periodic.cfg", - ".kokoro/samples/python3.8/presubmit.cfg", - ".kokoro/test-samples.sh", - ".kokoro/trampoline.sh", - ".kokoro/trampoline_v2.sh", - ".pre-commit-config.yaml", - ".trampolinerc", - "CODE_OF_CONDUCT.md", - "CONTRIBUTING.rst", - "LICENSE", - "MANIFEST.in", - "docs/_static/custom.css", - "docs/_templates/layout.html", - "docs/conf.py", - "docs/multiprocessing.rst", - "docs/talent_v4/company_service.rst", - "docs/talent_v4/completion.rst", - "docs/talent_v4/event_service.rst", - "docs/talent_v4/job_service.rst", - "docs/talent_v4/services.rst", - "docs/talent_v4/tenant_service.rst", - "docs/talent_v4/types.rst", - "docs/talent_v4beta1/application_service.rst", - "docs/talent_v4beta1/company_service.rst", - "docs/talent_v4beta1/completion.rst", - "docs/talent_v4beta1/event_service.rst", - "docs/talent_v4beta1/job_service.rst", - "docs/talent_v4beta1/profile_service.rst", - "docs/talent_v4beta1/services.rst", - "docs/talent_v4beta1/tenant_service.rst", - "docs/talent_v4beta1/types.rst", - "google/cloud/talent/__init__.py", - "google/cloud/talent/py.typed", - "google/cloud/talent_v4/__init__.py", - "google/cloud/talent_v4/proto/common.proto", - "google/cloud/talent_v4/proto/company.proto", - "google/cloud/talent_v4/proto/company_service.proto", - "google/cloud/talent_v4/proto/completion_service.proto", - "google/cloud/talent_v4/proto/event.proto", - "google/cloud/talent_v4/proto/event_service.proto", - "google/cloud/talent_v4/proto/filters.proto", - "google/cloud/talent_v4/proto/histogram.proto", - "google/cloud/talent_v4/proto/job.proto", - "google/cloud/talent_v4/proto/job_service.proto", - "google/cloud/talent_v4/proto/tenant.proto", - "google/cloud/talent_v4/proto/tenant_service.proto", - "google/cloud/talent_v4/py.typed", - "google/cloud/talent_v4/services/__init__.py", - "google/cloud/talent_v4/services/company_service/__init__.py", - "google/cloud/talent_v4/services/company_service/async_client.py", - "google/cloud/talent_v4/services/company_service/client.py", - "google/cloud/talent_v4/services/company_service/pagers.py", - "google/cloud/talent_v4/services/company_service/transports/__init__.py", - "google/cloud/talent_v4/services/company_service/transports/base.py", - "google/cloud/talent_v4/services/company_service/transports/grpc.py", - "google/cloud/talent_v4/services/company_service/transports/grpc_asyncio.py", - "google/cloud/talent_v4/services/completion/__init__.py", - "google/cloud/talent_v4/services/completion/async_client.py", - "google/cloud/talent_v4/services/completion/client.py", - "google/cloud/talent_v4/services/completion/transports/__init__.py", - "google/cloud/talent_v4/services/completion/transports/base.py", - "google/cloud/talent_v4/services/completion/transports/grpc.py", - "google/cloud/talent_v4/services/completion/transports/grpc_asyncio.py", - "google/cloud/talent_v4/services/event_service/__init__.py", - "google/cloud/talent_v4/services/event_service/async_client.py", - "google/cloud/talent_v4/services/event_service/client.py", - "google/cloud/talent_v4/services/event_service/transports/__init__.py", - "google/cloud/talent_v4/services/event_service/transports/base.py", - "google/cloud/talent_v4/services/event_service/transports/grpc.py", - "google/cloud/talent_v4/services/event_service/transports/grpc_asyncio.py", - "google/cloud/talent_v4/services/job_service/__init__.py", - "google/cloud/talent_v4/services/job_service/async_client.py", - "google/cloud/talent_v4/services/job_service/client.py", - "google/cloud/talent_v4/services/job_service/pagers.py", - "google/cloud/talent_v4/services/job_service/transports/__init__.py", - "google/cloud/talent_v4/services/job_service/transports/base.py", - "google/cloud/talent_v4/services/job_service/transports/grpc.py", - "google/cloud/talent_v4/services/job_service/transports/grpc_asyncio.py", - "google/cloud/talent_v4/services/tenant_service/__init__.py", - "google/cloud/talent_v4/services/tenant_service/async_client.py", - "google/cloud/talent_v4/services/tenant_service/client.py", - "google/cloud/talent_v4/services/tenant_service/pagers.py", - "google/cloud/talent_v4/services/tenant_service/transports/__init__.py", - "google/cloud/talent_v4/services/tenant_service/transports/base.py", - "google/cloud/talent_v4/services/tenant_service/transports/grpc.py", - "google/cloud/talent_v4/services/tenant_service/transports/grpc_asyncio.py", - "google/cloud/talent_v4/types/__init__.py", - "google/cloud/talent_v4/types/common.py", - "google/cloud/talent_v4/types/company.py", - "google/cloud/talent_v4/types/company_service.py", - "google/cloud/talent_v4/types/completion_service.py", - "google/cloud/talent_v4/types/event.py", - "google/cloud/talent_v4/types/event_service.py", - "google/cloud/talent_v4/types/filters.py", - "google/cloud/talent_v4/types/histogram.py", - "google/cloud/talent_v4/types/job.py", - "google/cloud/talent_v4/types/job_service.py", - "google/cloud/talent_v4/types/tenant.py", - "google/cloud/talent_v4/types/tenant_service.py", - "google/cloud/talent_v4beta1/__init__.py", - "google/cloud/talent_v4beta1/proto/application.proto", - "google/cloud/talent_v4beta1/proto/application_service.proto", - "google/cloud/talent_v4beta1/proto/batch.proto", - "google/cloud/talent_v4beta1/proto/common.proto", - "google/cloud/talent_v4beta1/proto/company.proto", - "google/cloud/talent_v4beta1/proto/company_service.proto", - "google/cloud/talent_v4beta1/proto/completion_service.proto", - "google/cloud/talent_v4beta1/proto/event.proto", - "google/cloud/talent_v4beta1/proto/event_service.proto", - "google/cloud/talent_v4beta1/proto/filters.proto", - "google/cloud/talent_v4beta1/proto/histogram.proto", - "google/cloud/talent_v4beta1/proto/job.proto", - "google/cloud/talent_v4beta1/proto/job_service.proto", - "google/cloud/talent_v4beta1/proto/profile.proto", - "google/cloud/talent_v4beta1/proto/profile_service.proto", - "google/cloud/talent_v4beta1/proto/tenant.proto", - "google/cloud/talent_v4beta1/proto/tenant_service.proto", - "google/cloud/talent_v4beta1/py.typed", - "google/cloud/talent_v4beta1/services/__init__.py", - "google/cloud/talent_v4beta1/services/application_service/__init__.py", - "google/cloud/talent_v4beta1/services/application_service/async_client.py", - "google/cloud/talent_v4beta1/services/application_service/client.py", - "google/cloud/talent_v4beta1/services/application_service/pagers.py", - "google/cloud/talent_v4beta1/services/application_service/transports/__init__.py", - "google/cloud/talent_v4beta1/services/application_service/transports/base.py", - "google/cloud/talent_v4beta1/services/application_service/transports/grpc.py", - "google/cloud/talent_v4beta1/services/application_service/transports/grpc_asyncio.py", - "google/cloud/talent_v4beta1/services/company_service/__init__.py", - "google/cloud/talent_v4beta1/services/company_service/async_client.py", - "google/cloud/talent_v4beta1/services/company_service/client.py", - "google/cloud/talent_v4beta1/services/company_service/pagers.py", - "google/cloud/talent_v4beta1/services/company_service/transports/__init__.py", - "google/cloud/talent_v4beta1/services/company_service/transports/base.py", - "google/cloud/talent_v4beta1/services/company_service/transports/grpc.py", - "google/cloud/talent_v4beta1/services/company_service/transports/grpc_asyncio.py", - "google/cloud/talent_v4beta1/services/completion/__init__.py", - "google/cloud/talent_v4beta1/services/completion/async_client.py", - "google/cloud/talent_v4beta1/services/completion/client.py", - "google/cloud/talent_v4beta1/services/completion/transports/__init__.py", - "google/cloud/talent_v4beta1/services/completion/transports/base.py", - "google/cloud/talent_v4beta1/services/completion/transports/grpc.py", - "google/cloud/talent_v4beta1/services/completion/transports/grpc_asyncio.py", - "google/cloud/talent_v4beta1/services/event_service/__init__.py", - "google/cloud/talent_v4beta1/services/event_service/async_client.py", - "google/cloud/talent_v4beta1/services/event_service/client.py", - "google/cloud/talent_v4beta1/services/event_service/transports/__init__.py", - "google/cloud/talent_v4beta1/services/event_service/transports/base.py", - "google/cloud/talent_v4beta1/services/event_service/transports/grpc.py", - "google/cloud/talent_v4beta1/services/event_service/transports/grpc_asyncio.py", - "google/cloud/talent_v4beta1/services/job_service/__init__.py", - "google/cloud/talent_v4beta1/services/job_service/async_client.py", - "google/cloud/talent_v4beta1/services/job_service/client.py", - "google/cloud/talent_v4beta1/services/job_service/pagers.py", - "google/cloud/talent_v4beta1/services/job_service/transports/__init__.py", - "google/cloud/talent_v4beta1/services/job_service/transports/base.py", - "google/cloud/talent_v4beta1/services/job_service/transports/grpc.py", - "google/cloud/talent_v4beta1/services/job_service/transports/grpc_asyncio.py", - "google/cloud/talent_v4beta1/services/profile_service/__init__.py", - "google/cloud/talent_v4beta1/services/profile_service/async_client.py", - "google/cloud/talent_v4beta1/services/profile_service/client.py", - "google/cloud/talent_v4beta1/services/profile_service/pagers.py", - "google/cloud/talent_v4beta1/services/profile_service/transports/__init__.py", - "google/cloud/talent_v4beta1/services/profile_service/transports/base.py", - "google/cloud/talent_v4beta1/services/profile_service/transports/grpc.py", - "google/cloud/talent_v4beta1/services/profile_service/transports/grpc_asyncio.py", - "google/cloud/talent_v4beta1/services/tenant_service/__init__.py", - "google/cloud/talent_v4beta1/services/tenant_service/async_client.py", - "google/cloud/talent_v4beta1/services/tenant_service/client.py", - "google/cloud/talent_v4beta1/services/tenant_service/pagers.py", - "google/cloud/talent_v4beta1/services/tenant_service/transports/__init__.py", - "google/cloud/talent_v4beta1/services/tenant_service/transports/base.py", - "google/cloud/talent_v4beta1/services/tenant_service/transports/grpc.py", - "google/cloud/talent_v4beta1/services/tenant_service/transports/grpc_asyncio.py", - "google/cloud/talent_v4beta1/types/__init__.py", - "google/cloud/talent_v4beta1/types/application.py", - "google/cloud/talent_v4beta1/types/application_service.py", - "google/cloud/talent_v4beta1/types/batch.py", - "google/cloud/talent_v4beta1/types/common.py", - "google/cloud/talent_v4beta1/types/company.py", - "google/cloud/talent_v4beta1/types/company_service.py", - "google/cloud/talent_v4beta1/types/completion_service.py", - "google/cloud/talent_v4beta1/types/event.py", - "google/cloud/talent_v4beta1/types/event_service.py", - "google/cloud/talent_v4beta1/types/filters.py", - "google/cloud/talent_v4beta1/types/histogram.py", - "google/cloud/talent_v4beta1/types/job.py", - "google/cloud/talent_v4beta1/types/job_service.py", - "google/cloud/talent_v4beta1/types/profile.py", - "google/cloud/talent_v4beta1/types/profile_service.py", - "google/cloud/talent_v4beta1/types/tenant.py", - "google/cloud/talent_v4beta1/types/tenant_service.py", - "mypy.ini", - "noxfile.py", - "renovate.json", - "samples/AUTHORING_GUIDE.md", - "samples/CONTRIBUTING.md", - "samples/snippets/noxfile.py", - "scripts/decrypt-secrets.sh", - "scripts/fixup_talent_v4_keywords.py", - "scripts/fixup_talent_v4beta1_keywords.py", - "scripts/readme-gen/readme_gen.py", - "scripts/readme-gen/templates/README.tmpl.rst", - "scripts/readme-gen/templates/auth.tmpl.rst", - "scripts/readme-gen/templates/auth_api_key.tmpl.rst", - "scripts/readme-gen/templates/install_deps.tmpl.rst", - "scripts/readme-gen/templates/install_portaudio.tmpl.rst", - "setup.cfg", - "testing/.gitignore", - "tests/unit/gapic/talent_v4/__init__.py", - "tests/unit/gapic/talent_v4/test_company_service.py", - "tests/unit/gapic/talent_v4/test_completion.py", - "tests/unit/gapic/talent_v4/test_event_service.py", - "tests/unit/gapic/talent_v4/test_job_service.py", - "tests/unit/gapic/talent_v4/test_tenant_service.py", - "tests/unit/gapic/talent_v4beta1/__init__.py", - "tests/unit/gapic/talent_v4beta1/test_application_service.py", - "tests/unit/gapic/talent_v4beta1/test_company_service.py", - "tests/unit/gapic/talent_v4beta1/test_completion.py", - "tests/unit/gapic/talent_v4beta1/test_event_service.py", - "tests/unit/gapic/talent_v4beta1/test_job_service.py", - "tests/unit/gapic/talent_v4beta1/test_profile_service.py", - "tests/unit/gapic/talent_v4beta1/test_tenant_service.py" ] } \ No newline at end of file diff --git a/synth.py b/synth.py index bc3d5083..a8573b62 100644 --- a/synth.py +++ b/synth.py @@ -48,7 +48,7 @@ templated_files = common.py_library( samples=True, # set to True only if there are samples microgenerator=True, - cov_level=99, + cov_level=98, ) s.move(templated_files, excludes=[".coveragerc"]) # microgenerator has a good .coveragerc file diff --git a/testing/constraints-3.6.txt b/testing/constraints-3.6.txt index 2923be13..cc205f2a 100644 --- a/testing/constraints-3.6.txt +++ b/testing/constraints-3.6.txt @@ -5,6 +5,5 @@ # # e.g., if setup.py has "foo >= 1.14.0, < 2.0.0dev", # Then this file should have foo==1.14.0 -google-api-core==1.22.0 -proto-plus==1.4.0 -libcst==0.2.5 \ No newline at end of file +google-api-core==1.22.2 +proto-plus==1.15.0 From dd94ca7eb427d3e30195a82a544962bd6090c250 Mon Sep 17 00:00:00 2001 From: Bu Sun Kim Date: Tue, 30 Mar 2021 19:24:35 +0000 Subject: [PATCH 38/38] chore: fix cov_level --- noxfile.py | 2 +- synth.metadata | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/noxfile.py b/noxfile.py index 186246f0..d2747a77 100644 --- a/noxfile.py +++ b/noxfile.py @@ -179,7 +179,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=998") + session.run("coverage", "report", "--show-missing", "--fail-under=98") session.run("coverage", "erase") diff --git a/synth.metadata b/synth.metadata index d9f852ba..7fbfc295 100644 --- a/synth.metadata +++ b/synth.metadata @@ -4,15 +4,15 @@ "git": { "name": ".", "remote": "git@github.com:googleapis/python-talent", - "sha": "7e3cc914ac1163abca7002146189c49ed7a816b0" + "sha": "8a12124259ca87c5064fabe9f058ed966eea2d56" } }, { "git": { "name": "googleapis", "remote": "https://github.com/googleapis/googleapis.git", - "sha": "c539b9b08b3366ee00c0ec1950f4df711552a269", - "internalRef": "365759522" + "sha": "ef705a6d9fd6dcd8f0b13e012cb284332734785b", + "internalRef": "365856330" } }, {