diff --git a/packages/google-cloud-bigquery-reservation/.github/snippet-bot.yml b/packages/google-cloud-bigquery-reservation/.github/snippet-bot.yml new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/packages/google-cloud-bigquery-reservation/google/cloud/bigquery/reservation_v1/services/reservation_service/async_client.py b/packages/google-cloud-bigquery-reservation/google/cloud/bigquery/reservation_v1/services/reservation_service/async_client.py index 5c96bd259007..403779fac8bf 100644 --- a/packages/google-cloud-bigquery-reservation/google/cloud/bigquery/reservation_v1/services/reservation_service/async_client.py +++ b/packages/google-cloud-bigquery-reservation/google/cloud/bigquery/reservation_v1/services/reservation_service/async_client.py @@ -65,15 +65,22 @@ class ReservationServiceAsyncClient: DEFAULT_ENDPOINT = ReservationServiceClient.DEFAULT_ENDPOINT DEFAULT_MTLS_ENDPOINT = ReservationServiceClient.DEFAULT_MTLS_ENDPOINT + assignment_path = staticmethod(ReservationServiceClient.assignment_path) + parse_assignment_path = staticmethod(ReservationServiceClient.parse_assignment_path) bi_reservation_path = staticmethod(ReservationServiceClient.bi_reservation_path) - + parse_bi_reservation_path = staticmethod( + ReservationServiceClient.parse_bi_reservation_path + ) capacity_commitment_path = staticmethod( ReservationServiceClient.capacity_commitment_path ) - - assignment_path = staticmethod(ReservationServiceClient.assignment_path) - + parse_capacity_commitment_path = staticmethod( + ReservationServiceClient.parse_capacity_commitment_path + ) reservation_path = staticmethod(ReservationServiceClient.reservation_path) + parse_reservation_path = staticmethod( + ReservationServiceClient.parse_reservation_path + ) from_service_account_file = ReservationServiceClient.from_service_account_file from_service_account_json = from_service_account_file diff --git a/packages/google-cloud-bigquery-reservation/google/cloud/bigquery/reservation_v1/services/reservation_service/transports/base.py b/packages/google-cloud-bigquery-reservation/google/cloud/bigquery/reservation_v1/services/reservation_service/transports/base.py index abc9d35d0f9c..f0140e1d0fa3 100644 --- a/packages/google-cloud-bigquery-reservation/google/cloud/bigquery/reservation_v1/services/reservation_service/transports/base.py +++ b/packages/google-cloud-bigquery-reservation/google/cloud/bigquery/reservation_v1/services/reservation_service/transports/base.py @@ -19,7 +19,7 @@ import typing import pkg_resources -from google import auth +from google import auth # type: ignore from google.api_core import exceptions # type: ignore from google.api_core import gapic_v1 # type: ignore from google.api_core import retry as retries # type: ignore diff --git a/packages/google-cloud-bigquery-reservation/synth.metadata b/packages/google-cloud-bigquery-reservation/synth.metadata index d4a93d9afd2c..fc0781311dc5 100644 --- a/packages/google-cloud-bigquery-reservation/synth.metadata +++ b/packages/google-cloud-bigquery-reservation/synth.metadata @@ -4,7 +4,7 @@ "git": { "name": ".", "remote": "https://github.com/googleapis/python-bigquery-reservation.git", - "sha": "50c85777ae70735fb06c8a7a1b0d6a82a28766c3" + "sha": "1136cae5bf131f9e6aa54aa081416f7f0848eba1" } }, { @@ -19,14 +19,14 @@ "git": { "name": "synthtool", "remote": "https://github.com/googleapis/synthtool.git", - "sha": "d3049e66447b44dc10579e461d5e08e0e3838edd" + "sha": "d91dd8aac77f7a9c5506c238038a26fa4f9e361e" } }, { "git": { "name": "synthtool", "remote": "https://github.com/googleapis/synthtool.git", - "sha": "d3049e66447b44dc10579e461d5e08e0e3838edd" + "sha": "d91dd8aac77f7a9c5506c238038a26fa4f9e361e" } } ], @@ -40,5 +40,91 @@ "generator": "gapic-generator-python" } } + ], + "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/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", + ".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/reservation_v1/services.rst", + "docs/reservation_v1/types.rst", + "google/cloud/bigquery/reservation/__init__.py", + "google/cloud/bigquery/reservation/py.typed", + "google/cloud/bigquery/reservation_v1/__init__.py", + "google/cloud/bigquery/reservation_v1/py.typed", + "google/cloud/bigquery/reservation_v1/services/__init__.py", + "google/cloud/bigquery/reservation_v1/services/reservation_service/__init__.py", + "google/cloud/bigquery/reservation_v1/services/reservation_service/async_client.py", + "google/cloud/bigquery/reservation_v1/services/reservation_service/client.py", + "google/cloud/bigquery/reservation_v1/services/reservation_service/pagers.py", + "google/cloud/bigquery/reservation_v1/services/reservation_service/transports/__init__.py", + "google/cloud/bigquery/reservation_v1/services/reservation_service/transports/base.py", + "google/cloud/bigquery/reservation_v1/services/reservation_service/transports/grpc.py", + "google/cloud/bigquery/reservation_v1/services/reservation_service/transports/grpc_asyncio.py", + "google/cloud/bigquery/reservation_v1/types/__init__.py", + "google/cloud/bigquery/reservation_v1/types/reservation.py", + "mypy.ini", + "noxfile.py", + "renovate.json", + "scripts/decrypt-secrets.sh", + "scripts/fixup_reservation_v1_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/reservation_v1/__init__.py", + "tests/unit/gapic/reservation_v1/test_reservation_service.py" ] } \ No newline at end of file diff --git a/packages/google-cloud-bigquery-reservation/tests/unit/gapic/reservation_v1/test_reservation_service.py b/packages/google-cloud-bigquery-reservation/tests/unit/gapic/reservation_v1/test_reservation_service.py index 86e693c4502d..5193a70a3d2e 100644 --- a/packages/google-cloud-bigquery-reservation/tests/unit/gapic/reservation_v1/test_reservation_service.py +++ b/packages/google-cloud-bigquery-reservation/tests/unit/gapic/reservation_v1/test_reservation_service.py @@ -883,8 +883,8 @@ def test_list_reservations_pages(): RuntimeError, ) pages = list(client.list_reservations(request={}).pages) - for page, token in zip(pages, ["abc", "def", "ghi", ""]): - assert page.raw_page.next_page_token == token + for page_, token in zip(pages, ["abc", "def", "ghi", ""]): + assert page_.raw_page.next_page_token == token @pytest.mark.asyncio @@ -964,10 +964,10 @@ async def test_list_reservations_async_pages(): RuntimeError, ) pages = [] - async for page in (await client.list_reservations(request={})).pages: - pages.append(page) - for page, token in zip(pages, ["abc", "def", "ghi", ""]): - assert page.raw_page.next_page_token == token + async for page_ in (await client.list_reservations(request={})).pages: + pages.append(page_) + for page_, token in zip(pages, ["abc", "def", "ghi", ""]): + assert page_.raw_page.next_page_token == token def test_get_reservation( @@ -2130,8 +2130,8 @@ def test_list_capacity_commitments_pages(): RuntimeError, ) pages = list(client.list_capacity_commitments(request={}).pages) - for page, token in zip(pages, ["abc", "def", "ghi", ""]): - assert page.raw_page.next_page_token == token + for page_, token in zip(pages, ["abc", "def", "ghi", ""]): + assert page_.raw_page.next_page_token == token @pytest.mark.asyncio @@ -2219,10 +2219,10 @@ async def test_list_capacity_commitments_async_pages(): RuntimeError, ) pages = [] - async for page in (await client.list_capacity_commitments(request={})).pages: - pages.append(page) - for page, token in zip(pages, ["abc", "def", "ghi", ""]): - assert page.raw_page.next_page_token == token + async for page_ in (await client.list_capacity_commitments(request={})).pages: + pages.append(page_) + for page_, token in zip(pages, ["abc", "def", "ghi", ""]): + assert page_.raw_page.next_page_token == token def test_get_capacity_commitment( @@ -3857,8 +3857,8 @@ def test_list_assignments_pages(): RuntimeError, ) pages = list(client.list_assignments(request={}).pages) - for page, token in zip(pages, ["abc", "def", "ghi", ""]): - assert page.raw_page.next_page_token == token + for page_, token in zip(pages, ["abc", "def", "ghi", ""]): + assert page_.raw_page.next_page_token == token @pytest.mark.asyncio @@ -3934,10 +3934,10 @@ async def test_list_assignments_async_pages(): RuntimeError, ) pages = [] - async for page in (await client.list_assignments(request={})).pages: - pages.append(page) - for page, token in zip(pages, ["abc", "def", "ghi", ""]): - assert page.raw_page.next_page_token == token + async for page_ in (await client.list_assignments(request={})).pages: + pages.append(page_) + for page_, token in zip(pages, ["abc", "def", "ghi", ""]): + assert page_.raw_page.next_page_token == token def test_delete_assignment( @@ -4419,8 +4419,8 @@ def test_search_assignments_pages(): RuntimeError, ) pages = list(client.search_assignments(request={}).pages) - for page, token in zip(pages, ["abc", "def", "ghi", ""]): - assert page.raw_page.next_page_token == token + for page_, token in zip(pages, ["abc", "def", "ghi", ""]): + assert page_.raw_page.next_page_token == token @pytest.mark.asyncio @@ -4500,10 +4500,10 @@ async def test_search_assignments_async_pages(): RuntimeError, ) pages = [] - async for page in (await client.search_assignments(request={})).pages: - pages.append(page) - for page, token in zip(pages, ["abc", "def", "ghi", ""]): - assert page.raw_page.next_page_token == token + async for page_ in (await client.search_assignments(request={})).pages: + pages.append(page_) + for page_, token in zip(pages, ["abc", "def", "ghi", ""]): + assert page_.raw_page.next_page_token == token def test_move_assignment( @@ -5535,6 +5535,38 @@ def test_reservation_service_grpc_asyncio_transport_channel_mtls_with_adc( assert transport.grpc_channel == mock_grpc_channel +def test_assignment_path(): + project = "squid" + location = "clam" + reservation = "whelk" + assignment = "octopus" + + expected = "projects/{project}/locations/{location}/reservations/{reservation}/assignments/{assignment}".format( + project=project, + location=location, + reservation=reservation, + assignment=assignment, + ) + actual = ReservationServiceClient.assignment_path( + project, location, reservation, assignment + ) + assert expected == actual + + +def test_parse_assignment_path(): + expected = { + "project": "oyster", + "location": "nudibranch", + "reservation": "cuttlefish", + "assignment": "mussel", + } + path = ReservationServiceClient.assignment_path(**expected) + + # Check that the path construction is reversible. + actual = ReservationServiceClient.parse_assignment_path(path) + assert expected == actual + + def test_bi_reservation_path(): project = "squid" location = "clam" @@ -5585,38 +5617,6 @@ def test_parse_capacity_commitment_path(): assert expected == actual -def test_assignment_path(): - project = "squid" - location = "clam" - reservation = "whelk" - assignment = "octopus" - - expected = "projects/{project}/locations/{location}/reservations/{reservation}/assignments/{assignment}".format( - project=project, - location=location, - reservation=reservation, - assignment=assignment, - ) - actual = ReservationServiceClient.assignment_path( - project, location, reservation, assignment - ) - assert expected == actual - - -def test_parse_assignment_path(): - expected = { - "project": "oyster", - "location": "nudibranch", - "reservation": "cuttlefish", - "assignment": "mussel", - } - path = ReservationServiceClient.assignment_path(**expected) - - # Check that the path construction is reversible. - actual = ReservationServiceClient.parse_assignment_path(path) - assert expected == actual - - def test_reservation_path(): project = "squid" location = "clam"