From a7959ae82a443f721ccb125695c59806d55e1c27 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Sat, 26 Nov 2022 07:02:01 -0500 Subject: [PATCH] chore: Update gapic-generator-python to v1.6.1 (#246) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * chore: update to gapic-generator-python 1.5.0 feat: add support for `google.cloud..__version__` PiperOrigin-RevId: 484665853 Source-Link: https://github.com/googleapis/googleapis/commit/8eb249a19db926c2fbc4ecf1dc09c0e521a88b22 Source-Link: https://github.com/googleapis/googleapis-gen/commit/c8aa327b5f478865fc3fd91e3c2768e54e26ad44 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiYzhhYTMyN2I1ZjQ3ODg2NWZjM2ZkOTFlM2MyNzY4ZTU0ZTI2YWQ0NCJ9 * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * update version in gapic_version.py * add .release-please-manifest.json with correct version * add owlbot.py to exclude generated gapic_version.py * set manifest to true in .github/release-please.yml * add release-please-config.json * chore: Update to gapic-generator-python 1.6.0 feat(python): Add typing to proto.Message based class attributes feat(python): Snippetgen handling of repeated enum field PiperOrigin-RevId: 487326846 Source-Link: https://github.com/googleapis/googleapis/commit/da380c77bb87ba0f752baf07605dd1db30e1f7e1 Source-Link: https://github.com/googleapis/googleapis-gen/commit/61ef5762ee6731a0cbbfea22fd0eecee51ab1c8e Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiNjFlZjU3NjJlZTY3MzFhMGNiYmZlYTIyZmQwZWVjZWU1MWFiMWM4ZSJ9 * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * feat: new APIs added to reflect updates to the filestore service - Add ENTERPRISE Tier - Add snapshot APIs: RevertInstance, ListSnapshots, CreateSnapshot, DeleteSnapshot, UpdateSnapshot - Add multi-share APIs: ListShares, GetShare, CreateShare, DeleteShare, UpdateShare - Add ConnectMode to NetworkConfig (for Private Service Access support) - New status codes (SUSPENDED/SUSPENDING, REVERTING/RESUMING) - Add SuspensionReason (for KMS related suspension) - Add new fields to Instance information: max_capacity_gb, capacity_step_size_gb, max_share_count, capacity_gb, multi_share_enabled PiperOrigin-RevId: 487492758 Source-Link: https://github.com/googleapis/googleapis/commit/5be5981f50322cf0c7388595e0f31ac5d0693469 Source-Link: https://github.com/googleapis/googleapis-gen/commit/ab0e217f560cc2c1afc11441c2eab6b6950efd2b Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiYWIwZTIxN2Y1NjBjYzJjMWFmYzExNDQxYzJlYWI2YjY5NTBlZmQyYiJ9 * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * update path to snippet metadata json * chore: Update gapic-generator-python to v1.6.1 PiperOrigin-RevId: 488036204 Source-Link: https://github.com/googleapis/googleapis/commit/08f275f5c1c0d99056e1cb68376323414459ee19 Source-Link: https://github.com/googleapis/googleapis-gen/commit/555c0945e60649e38739ae64bc45719cdf72178f Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiNTU1YzA5NDVlNjA2NDllMzg3MzlhZTY0YmM0NTcxOWNkZjcyMTc4ZiJ9 * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md Co-authored-by: Owl Bot Co-authored-by: Anthonios Partheniou --- .../.github/release-please.yml | 1 + .../.release-please-manifest.json | 3 + .../docs/websecurityscanner_v1/types.rst | 1 - .../docs/websecurityscanner_v1alpha/types.rst | 1 - .../docs/websecurityscanner_v1beta/types.rst | 1 - .../cloud/websecurityscanner/__init__.py | 4 + .../cloud/websecurityscanner/gapic_version.py | 16 ++ .../cloud/websecurityscanner_v1/__init__.py | 4 + .../web_security_scanner/async_client.py | 108 ++++++++------ .../services/web_security_scanner/client.py | 88 +++++++---- .../web_security_scanner/transports/base.py | 2 +- .../web_security_scanner/transports/grpc.py | 20 +-- .../transports/grpc_asyncio.py | 16 +- .../types/crawled_url.py | 8 +- .../websecurityscanner_v1/types/finding.py | 38 ++--- .../types/finding_addon.py | 50 ++++--- .../types/finding_type_stats.py | 6 +- .../types/scan_config.py | 56 +++---- .../types/scan_config_error.py | 6 +- .../websecurityscanner_v1/types/scan_run.py | 28 ++-- .../types/scan_run_error_trace.py | 8 +- .../types/scan_run_log.py | 18 ++- .../types/scan_run_warning_trace.py | 4 +- .../types/web_security_scanner.py | 80 +++++----- .../websecurityscanner_v1alpha/__init__.py | 4 + .../web_security_scanner/async_client.py | 140 ++++++++++-------- .../services/web_security_scanner/client.py | 120 +++++++++------ .../web_security_scanner/transports/base.py | 2 +- .../web_security_scanner/transports/grpc.py | 20 +-- .../transports/grpc_asyncio.py | 16 +- .../types/crawled_url.py | 8 +- .../types/finding.py | 32 ++-- .../types/finding_addon.py | 36 ++--- .../types/finding_type_stats.py | 6 +- .../types/scan_config.py | 46 +++--- .../types/scan_run.py | 20 +-- .../types/web_security_scanner.py | 80 +++++----- .../websecurityscanner_v1beta/__init__.py | 4 + .../web_security_scanner/async_client.py | 140 ++++++++++-------- .../services/web_security_scanner/client.py | 120 +++++++++------ .../web_security_scanner/transports/base.py | 2 +- .../web_security_scanner/transports/grpc.py | 20 +-- .../transports/grpc_asyncio.py | 16 +- .../types/crawled_url.py | 8 +- .../types/finding.py | 34 +++-- .../types/finding_addon.py | 42 +++--- .../types/finding_type_stats.py | 6 +- .../types/scan_config.py | 50 ++++--- .../types/scan_config_error.py | 6 +- .../types/scan_run.py | 28 ++-- .../types/scan_run_error_trace.py | 8 +- .../types/scan_run_warning_trace.py | 4 +- .../types/web_security_scanner.py | 80 +++++----- .../google-cloud-websecurityscanner/owlbot.py | 56 +++++++ .../release-please-config.json | 33 +++++ ...a_google.cloud.websecurityscanner.v1.json} | 3 +- ...gle.cloud.websecurityscanner.v1alpha.json} | 3 +- ...ogle.cloud.websecurityscanner.v1beta.json} | 3 +- .../google-cloud-websecurityscanner/setup.py | 58 ++++---- .../testing/constraints-3.10.txt | 6 + .../testing/constraints-3.11.txt | 6 + .../testing/constraints-3.7.txt | 9 +- .../testing/constraints-3.8.txt | 6 + .../testing/constraints-3.9.txt | 6 + 64 files changed, 1108 insertions(+), 746 deletions(-) create mode 100644 packages/google-cloud-websecurityscanner/.release-please-manifest.json create mode 100644 packages/google-cloud-websecurityscanner/google/cloud/websecurityscanner/gapic_version.py create mode 100644 packages/google-cloud-websecurityscanner/owlbot.py create mode 100644 packages/google-cloud-websecurityscanner/release-please-config.json rename packages/google-cloud-websecurityscanner/samples/generated_samples/{snippet_metadata_websecurityscanner_v1.json => snippet_metadata_google.cloud.websecurityscanner.v1.json} (99%) rename packages/google-cloud-websecurityscanner/samples/generated_samples/{snippet_metadata_websecurityscanner_v1alpha.json => snippet_metadata_google.cloud.websecurityscanner.v1alpha.json} (99%) rename packages/google-cloud-websecurityscanner/samples/generated_samples/{snippet_metadata_websecurityscanner_v1beta.json => snippet_metadata_google.cloud.websecurityscanner.v1beta.json} (99%) diff --git a/packages/google-cloud-websecurityscanner/.github/release-please.yml b/packages/google-cloud-websecurityscanner/.github/release-please.yml index 6def37a84c98..e9a4f0085128 100644 --- a/packages/google-cloud-websecurityscanner/.github/release-please.yml +++ b/packages/google-cloud-websecurityscanner/.github/release-please.yml @@ -1,5 +1,6 @@ releaseType: python handleGHRelease: true +manifest: true # NOTE: this section is generated by synthtool.languages.python # See https://github.com/googleapis/synthtool/blob/master/synthtool/languages/python.py branches: diff --git a/packages/google-cloud-websecurityscanner/.release-please-manifest.json b/packages/google-cloud-websecurityscanner/.release-please-manifest.json new file mode 100644 index 000000000000..00cbbb6d2cab --- /dev/null +++ b/packages/google-cloud-websecurityscanner/.release-please-manifest.json @@ -0,0 +1,3 @@ +{ + ".": "1.9.2" +} diff --git a/packages/google-cloud-websecurityscanner/docs/websecurityscanner_v1/types.rst b/packages/google-cloud-websecurityscanner/docs/websecurityscanner_v1/types.rst index aadd7873e18e..ad00a256c35d 100644 --- a/packages/google-cloud-websecurityscanner/docs/websecurityscanner_v1/types.rst +++ b/packages/google-cloud-websecurityscanner/docs/websecurityscanner_v1/types.rst @@ -3,5 +3,4 @@ Types for Google Cloud Websecurityscanner v1 API .. automodule:: google.cloud.websecurityscanner_v1.types :members: - :undoc-members: :show-inheritance: diff --git a/packages/google-cloud-websecurityscanner/docs/websecurityscanner_v1alpha/types.rst b/packages/google-cloud-websecurityscanner/docs/websecurityscanner_v1alpha/types.rst index 0f6d569631ea..a465d17792b3 100644 --- a/packages/google-cloud-websecurityscanner/docs/websecurityscanner_v1alpha/types.rst +++ b/packages/google-cloud-websecurityscanner/docs/websecurityscanner_v1alpha/types.rst @@ -3,5 +3,4 @@ Types for Google Cloud Websecurityscanner v1alpha API .. automodule:: google.cloud.websecurityscanner_v1alpha.types :members: - :undoc-members: :show-inheritance: diff --git a/packages/google-cloud-websecurityscanner/docs/websecurityscanner_v1beta/types.rst b/packages/google-cloud-websecurityscanner/docs/websecurityscanner_v1beta/types.rst index 0a1ff8f7ad5a..531b92bae980 100644 --- a/packages/google-cloud-websecurityscanner/docs/websecurityscanner_v1beta/types.rst +++ b/packages/google-cloud-websecurityscanner/docs/websecurityscanner_v1beta/types.rst @@ -3,5 +3,4 @@ Types for Google Cloud Websecurityscanner v1beta API .. automodule:: google.cloud.websecurityscanner_v1beta.types :members: - :undoc-members: :show-inheritance: diff --git a/packages/google-cloud-websecurityscanner/google/cloud/websecurityscanner/__init__.py b/packages/google-cloud-websecurityscanner/google/cloud/websecurityscanner/__init__.py index 36645b659c4d..4e329d18ae5c 100644 --- a/packages/google-cloud-websecurityscanner/google/cloud/websecurityscanner/__init__.py +++ b/packages/google-cloud-websecurityscanner/google/cloud/websecurityscanner/__init__.py @@ -13,6 +13,10 @@ # See the License for the specific language governing permissions and # limitations under the License. # +from google.cloud.websecurityscanner import gapic_version as package_version + +__version__ = package_version.__version__ + from google.cloud.websecurityscanner_v1.services.web_security_scanner.async_client import ( WebSecurityScannerAsyncClient, diff --git a/packages/google-cloud-websecurityscanner/google/cloud/websecurityscanner/gapic_version.py b/packages/google-cloud-websecurityscanner/google/cloud/websecurityscanner/gapic_version.py new file mode 100644 index 000000000000..ab4e0f59eb91 --- /dev/null +++ b/packages/google-cloud-websecurityscanner/google/cloud/websecurityscanner/gapic_version.py @@ -0,0 +1,16 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 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. +# +__version__ = "1.9.2" # {x-release-please-version} diff --git a/packages/google-cloud-websecurityscanner/google/cloud/websecurityscanner_v1/__init__.py b/packages/google-cloud-websecurityscanner/google/cloud/websecurityscanner_v1/__init__.py index 17624b438a35..e92b2ca27741 100644 --- a/packages/google-cloud-websecurityscanner/google/cloud/websecurityscanner_v1/__init__.py +++ b/packages/google-cloud-websecurityscanner/google/cloud/websecurityscanner_v1/__init__.py @@ -13,6 +13,10 @@ # See the License for the specific language governing permissions and # limitations under the License. # +from google.cloud.websecurityscanner import gapic_version as package_version + +__version__ = package_version.__version__ + from .services.web_security_scanner import ( WebSecurityScannerAsyncClient, diff --git a/packages/google-cloud-websecurityscanner/google/cloud/websecurityscanner_v1/services/web_security_scanner/async_client.py b/packages/google-cloud-websecurityscanner/google/cloud/websecurityscanner_v1/services/web_security_scanner/async_client.py index 722bbd78223d..10fdc44dc974 100644 --- a/packages/google-cloud-websecurityscanner/google/cloud/websecurityscanner_v1/services/web_security_scanner/async_client.py +++ b/packages/google-cloud-websecurityscanner/google/cloud/websecurityscanner_v1/services/web_security_scanner/async_client.py @@ -16,7 +16,17 @@ from collections import OrderedDict import functools import re -from typing import Dict, Mapping, Optional, Sequence, Tuple, Type, Union +from typing import ( + Dict, + Mapping, + MutableMapping, + MutableSequence, + Optional, + Sequence, + Tuple, + Type, + Union, +) from google.api_core import exceptions as core_exceptions from google.api_core import gapic_v1 @@ -176,9 +186,9 @@ def transport(self) -> WebSecurityScannerTransport: def __init__( self, *, - credentials: ga_credentials.Credentials = None, + credentials: Optional[ga_credentials.Credentials] = None, transport: Union[str, WebSecurityScannerTransport] = "grpc_asyncio", - client_options: ClientOptions = None, + client_options: Optional[ClientOptions] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, ) -> None: """Instantiates the web security scanner client. @@ -222,10 +232,12 @@ def __init__( async def create_scan_config( self, - request: Union[web_security_scanner.CreateScanConfigRequest, dict] = None, + request: Optional[ + Union[web_security_scanner.CreateScanConfigRequest, dict] + ] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> scan_config.ScanConfig: r"""Creates a new ScanConfig. @@ -256,7 +268,7 @@ async def sample_create_scan_config(): print(response) Args: - request (Union[google.cloud.websecurityscanner_v1.types.CreateScanConfigRequest, dict]): + request (Optional[Union[google.cloud.websecurityscanner_v1.types.CreateScanConfigRequest, dict]]): The request object. Request for the `CreateScanConfig` method. retry (google.api_core.retry.Retry): Designation of what errors, if any, @@ -301,10 +313,12 @@ async def sample_create_scan_config(): async def delete_scan_config( self, - request: Union[web_security_scanner.DeleteScanConfigRequest, dict] = None, + request: Optional[ + Union[web_security_scanner.DeleteScanConfigRequest, dict] + ] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> None: r"""Deletes an existing ScanConfig and its child @@ -333,7 +347,7 @@ async def sample_delete_scan_config(): await client.delete_scan_config(request=request) Args: - request (Union[google.cloud.websecurityscanner_v1.types.DeleteScanConfigRequest, dict]): + request (Optional[Union[google.cloud.websecurityscanner_v1.types.DeleteScanConfigRequest, dict]]): The request object. Request for the `DeleteScanConfig` method. retry (google.api_core.retry.Retry): Designation of what errors, if any, @@ -379,10 +393,12 @@ async def sample_delete_scan_config(): async def get_scan_config( self, - request: Union[web_security_scanner.GetScanConfigRequest, dict] = None, + request: Optional[ + Union[web_security_scanner.GetScanConfigRequest, dict] + ] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> scan_config.ScanConfig: r"""Gets a ScanConfig. @@ -413,7 +429,7 @@ async def sample_get_scan_config(): print(response) Args: - request (Union[google.cloud.websecurityscanner_v1.types.GetScanConfigRequest, dict]): + request (Optional[Union[google.cloud.websecurityscanner_v1.types.GetScanConfigRequest, dict]]): The request object. Request for the `GetScanConfig` method. retry (google.api_core.retry.Retry): Designation of what errors, if any, @@ -468,10 +484,12 @@ async def sample_get_scan_config(): async def list_scan_configs( self, - request: Union[web_security_scanner.ListScanConfigsRequest, dict] = None, + request: Optional[ + Union[web_security_scanner.ListScanConfigsRequest, dict] + ] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> pagers.ListScanConfigsAsyncPager: r"""Lists ScanConfigs under a given project. @@ -503,7 +521,7 @@ async def sample_list_scan_configs(): print(response) Args: - request (Union[google.cloud.websecurityscanner_v1.types.ListScanConfigsRequest, dict]): + request (Optional[Union[google.cloud.websecurityscanner_v1.types.ListScanConfigsRequest, dict]]): The request object. Request for the `ListScanConfigs` method. retry (google.api_core.retry.Retry): Designation of what errors, if any, @@ -569,10 +587,12 @@ async def sample_list_scan_configs(): async def update_scan_config( self, - request: Union[web_security_scanner.UpdateScanConfigRequest, dict] = None, + request: Optional[ + Union[web_security_scanner.UpdateScanConfigRequest, dict] + ] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> scan_config.ScanConfig: r"""Updates a ScanConfig. This method support partial @@ -604,7 +624,7 @@ async def sample_update_scan_config(): print(response) Args: - request (Union[google.cloud.websecurityscanner_v1.types.UpdateScanConfigRequest, dict]): + request (Optional[Union[google.cloud.websecurityscanner_v1.types.UpdateScanConfigRequest, dict]]): The request object. Request for the `UpdateScanConfigRequest` method. retry (google.api_core.retry.Retry): Designation of what errors, if any, @@ -651,10 +671,10 @@ async def sample_update_scan_config(): async def start_scan_run( self, - request: Union[web_security_scanner.StartScanRunRequest, dict] = None, + request: Optional[Union[web_security_scanner.StartScanRunRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> scan_run.ScanRun: r"""Start a ScanRun according to the given ScanConfig. @@ -685,7 +705,7 @@ async def sample_start_scan_run(): print(response) Args: - request (Union[google.cloud.websecurityscanner_v1.types.StartScanRunRequest, dict]): + request (Optional[Union[google.cloud.websecurityscanner_v1.types.StartScanRunRequest, dict]]): The request object. Request for the `StartScanRun` method. retry (google.api_core.retry.Retry): Designation of what errors, if any, @@ -731,10 +751,10 @@ async def sample_start_scan_run(): async def get_scan_run( self, - request: Union[web_security_scanner.GetScanRunRequest, dict] = None, + request: Optional[Union[web_security_scanner.GetScanRunRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> scan_run.ScanRun: r"""Gets a ScanRun. @@ -765,7 +785,7 @@ async def sample_get_scan_run(): print(response) Args: - request (Union[google.cloud.websecurityscanner_v1.types.GetScanRunRequest, dict]): + request (Optional[Union[google.cloud.websecurityscanner_v1.types.GetScanRunRequest, dict]]): The request object. Request for the `GetScanRun` method. retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. @@ -820,10 +840,10 @@ async def sample_get_scan_run(): async def list_scan_runs( self, - request: Union[web_security_scanner.ListScanRunsRequest, dict] = None, + request: Optional[Union[web_security_scanner.ListScanRunsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> pagers.ListScanRunsAsyncPager: r"""Lists ScanRuns under a given ScanConfig, in @@ -856,7 +876,7 @@ async def sample_list_scan_runs(): print(response) Args: - request (Union[google.cloud.websecurityscanner_v1.types.ListScanRunsRequest, dict]): + request (Optional[Union[google.cloud.websecurityscanner_v1.types.ListScanRunsRequest, dict]]): The request object. Request for the `ListScanRuns` method. retry (google.api_core.retry.Retry): Designation of what errors, if any, @@ -922,10 +942,10 @@ async def sample_list_scan_runs(): async def stop_scan_run( self, - request: Union[web_security_scanner.StopScanRunRequest, dict] = None, + request: Optional[Union[web_security_scanner.StopScanRunRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> scan_run.ScanRun: r"""Stops a ScanRun. The stopped ScanRun is returned. @@ -956,7 +976,7 @@ async def sample_stop_scan_run(): print(response) Args: - request (Union[google.cloud.websecurityscanner_v1.types.StopScanRunRequest, dict]): + request (Optional[Union[google.cloud.websecurityscanner_v1.types.StopScanRunRequest, dict]]): The request object. Request for the `StopScanRun` method. retry (google.api_core.retry.Retry): Designation of what errors, if any, @@ -1002,10 +1022,12 @@ async def sample_stop_scan_run(): async def list_crawled_urls( self, - request: Union[web_security_scanner.ListCrawledUrlsRequest, dict] = None, + request: Optional[ + Union[web_security_scanner.ListCrawledUrlsRequest, dict] + ] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> pagers.ListCrawledUrlsAsyncPager: r"""List CrawledUrls under a given ScanRun. @@ -1037,7 +1059,7 @@ async def sample_list_crawled_urls(): print(response) Args: - request (Union[google.cloud.websecurityscanner_v1.types.ListCrawledUrlsRequest, dict]): + request (Optional[Union[google.cloud.websecurityscanner_v1.types.ListCrawledUrlsRequest, dict]]): The request object. Request for the `ListCrawledUrls` method. retry (google.api_core.retry.Retry): Designation of what errors, if any, @@ -1103,10 +1125,10 @@ async def sample_list_crawled_urls(): async def get_finding( self, - request: Union[web_security_scanner.GetFindingRequest, dict] = None, + request: Optional[Union[web_security_scanner.GetFindingRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> finding.Finding: r"""Gets a Finding. @@ -1137,7 +1159,7 @@ async def sample_get_finding(): print(response) Args: - request (Union[google.cloud.websecurityscanner_v1.types.GetFindingRequest, dict]): + request (Optional[Union[google.cloud.websecurityscanner_v1.types.GetFindingRequest, dict]]): The request object. Request for the `GetFinding` method. retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. @@ -1192,10 +1214,10 @@ async def sample_get_finding(): async def list_findings( self, - request: Union[web_security_scanner.ListFindingsRequest, dict] = None, + request: Optional[Union[web_security_scanner.ListFindingsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> pagers.ListFindingsAsyncPager: r"""List Findings under a given ScanRun. @@ -1227,7 +1249,7 @@ async def sample_list_findings(): print(response) Args: - request (Union[google.cloud.websecurityscanner_v1.types.ListFindingsRequest, dict]): + request (Optional[Union[google.cloud.websecurityscanner_v1.types.ListFindingsRequest, dict]]): The request object. Request for the `ListFindings` method. retry (google.api_core.retry.Retry): Designation of what errors, if any, @@ -1293,10 +1315,12 @@ async def sample_list_findings(): async def list_finding_type_stats( self, - request: Union[web_security_scanner.ListFindingTypeStatsRequest, dict] = None, + request: Optional[ + Union[web_security_scanner.ListFindingTypeStatsRequest, dict] + ] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> web_security_scanner.ListFindingTypeStatsResponse: r"""List all FindingTypeStats under a given ScanRun. @@ -1327,7 +1351,7 @@ async def sample_list_finding_type_stats(): print(response) Args: - request (Union[google.cloud.websecurityscanner_v1.types.ListFindingTypeStatsRequest, dict]): + request (Optional[Union[google.cloud.websecurityscanner_v1.types.ListFindingTypeStatsRequest, dict]]): The request object. Request for the `ListFindingTypeStats` method. retry (google.api_core.retry.Retry): Designation of what errors, if any, diff --git a/packages/google-cloud-websecurityscanner/google/cloud/websecurityscanner_v1/services/web_security_scanner/client.py b/packages/google-cloud-websecurityscanner/google/cloud/websecurityscanner_v1/services/web_security_scanner/client.py index 19767ab6812b..11afe1e68e46 100644 --- a/packages/google-cloud-websecurityscanner/google/cloud/websecurityscanner_v1/services/web_security_scanner/client.py +++ b/packages/google-cloud-websecurityscanner/google/cloud/websecurityscanner_v1/services/web_security_scanner/client.py @@ -16,7 +16,18 @@ from collections import OrderedDict import os import re -from typing import Dict, Mapping, Optional, Sequence, Tuple, Type, Union +from typing import ( + Dict, + Mapping, + MutableMapping, + MutableSequence, + Optional, + Sequence, + Tuple, + Type, + Union, + cast, +) from google.api_core import client_options as client_options_lib from google.api_core import exceptions as core_exceptions @@ -70,7 +81,7 @@ class WebSecurityScannerClientMeta(type): def get_transport_class( cls, - label: str = None, + label: Optional[str] = None, ) -> Type[WebSecurityScannerTransport]: """Returns an appropriate transport class. @@ -351,8 +362,8 @@ def __init__( self, *, credentials: Optional[ga_credentials.Credentials] = None, - transport: Union[str, WebSecurityScannerTransport, None] = None, - client_options: Optional[client_options_lib.ClientOptions] = None, + transport: Optional[Union[str, WebSecurityScannerTransport]] = None, + client_options: Optional[Union[client_options_lib.ClientOptions, dict]] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, ) -> None: """Instantiates the web security scanner client. @@ -366,7 +377,7 @@ def __init__( transport (Union[str, WebSecurityScannerTransport]): 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 (Optional[Union[google.api_core.client_options.ClientOptions, dict]]): 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 @@ -396,6 +407,7 @@ def __init__( client_options = client_options_lib.from_dict(client_options) if client_options is None: client_options = client_options_lib.ClientOptions() + client_options = cast(client_options_lib.ClientOptions, client_options) api_endpoint, client_cert_source_func = self.get_mtls_endpoint_and_cert_source( client_options @@ -448,10 +460,12 @@ def __init__( def create_scan_config( self, - request: Union[web_security_scanner.CreateScanConfigRequest, dict] = None, + request: Optional[ + Union[web_security_scanner.CreateScanConfigRequest, dict] + ] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> scan_config.ScanConfig: r"""Creates a new ScanConfig. @@ -528,10 +542,12 @@ def sample_create_scan_config(): def delete_scan_config( self, - request: Union[web_security_scanner.DeleteScanConfigRequest, dict] = None, + request: Optional[ + Union[web_security_scanner.DeleteScanConfigRequest, dict] + ] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> None: r"""Deletes an existing ScanConfig and its child @@ -597,10 +613,12 @@ def sample_delete_scan_config(): def get_scan_config( self, - request: Union[web_security_scanner.GetScanConfigRequest, dict] = None, + request: Optional[ + Union[web_security_scanner.GetScanConfigRequest, dict] + ] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> scan_config.ScanConfig: r"""Gets a ScanConfig. @@ -677,10 +695,12 @@ def sample_get_scan_config(): def list_scan_configs( self, - request: Union[web_security_scanner.ListScanConfigsRequest, dict] = None, + request: Optional[ + Union[web_security_scanner.ListScanConfigsRequest, dict] + ] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> pagers.ListScanConfigsPager: r"""Lists ScanConfigs under a given project. @@ -769,10 +789,12 @@ def sample_list_scan_configs(): def update_scan_config( self, - request: Union[web_security_scanner.UpdateScanConfigRequest, dict] = None, + request: Optional[ + Union[web_security_scanner.UpdateScanConfigRequest, dict] + ] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> scan_config.ScanConfig: r"""Updates a ScanConfig. This method support partial @@ -852,10 +874,10 @@ def sample_update_scan_config(): def start_scan_run( self, - request: Union[web_security_scanner.StartScanRunRequest, dict] = None, + request: Optional[Union[web_security_scanner.StartScanRunRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> scan_run.ScanRun: r"""Start a ScanRun according to the given ScanConfig. @@ -933,10 +955,10 @@ def sample_start_scan_run(): def get_scan_run( self, - request: Union[web_security_scanner.GetScanRunRequest, dict] = None, + request: Optional[Union[web_security_scanner.GetScanRunRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> scan_run.ScanRun: r"""Gets a ScanRun. @@ -1013,10 +1035,10 @@ def sample_get_scan_run(): def list_scan_runs( self, - request: Union[web_security_scanner.ListScanRunsRequest, dict] = None, + request: Optional[Union[web_security_scanner.ListScanRunsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> pagers.ListScanRunsPager: r"""Lists ScanRuns under a given ScanConfig, in @@ -1106,10 +1128,10 @@ def sample_list_scan_runs(): def stop_scan_run( self, - request: Union[web_security_scanner.StopScanRunRequest, dict] = None, + request: Optional[Union[web_security_scanner.StopScanRunRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> scan_run.ScanRun: r"""Stops a ScanRun. The stopped ScanRun is returned. @@ -1187,10 +1209,12 @@ def sample_stop_scan_run(): def list_crawled_urls( self, - request: Union[web_security_scanner.ListCrawledUrlsRequest, dict] = None, + request: Optional[ + Union[web_security_scanner.ListCrawledUrlsRequest, dict] + ] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> pagers.ListCrawledUrlsPager: r"""List CrawledUrls under a given ScanRun. @@ -1279,10 +1303,10 @@ def sample_list_crawled_urls(): def get_finding( self, - request: Union[web_security_scanner.GetFindingRequest, dict] = None, + request: Optional[Union[web_security_scanner.GetFindingRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> finding.Finding: r"""Gets a Finding. @@ -1359,10 +1383,10 @@ def sample_get_finding(): def list_findings( self, - request: Union[web_security_scanner.ListFindingsRequest, dict] = None, + request: Optional[Union[web_security_scanner.ListFindingsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> pagers.ListFindingsPager: r"""List Findings under a given ScanRun. @@ -1451,10 +1475,12 @@ def sample_list_findings(): def list_finding_type_stats( self, - request: Union[web_security_scanner.ListFindingTypeStatsRequest, dict] = None, + request: Optional[ + Union[web_security_scanner.ListFindingTypeStatsRequest, dict] + ] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> web_security_scanner.ListFindingTypeStatsResponse: r"""List all FindingTypeStats under a given ScanRun. diff --git a/packages/google-cloud-websecurityscanner/google/cloud/websecurityscanner_v1/services/web_security_scanner/transports/base.py b/packages/google-cloud-websecurityscanner/google/cloud/websecurityscanner_v1/services/web_security_scanner/transports/base.py index c749af64ea2b..56d5e15a01ce 100644 --- a/packages/google-cloud-websecurityscanner/google/cloud/websecurityscanner_v1/services/web_security_scanner/transports/base.py +++ b/packages/google-cloud-websecurityscanner/google/cloud/websecurityscanner_v1/services/web_security_scanner/transports/base.py @@ -54,7 +54,7 @@ def __init__( self, *, host: str = DEFAULT_HOST, - credentials: ga_credentials.Credentials = None, + credentials: Optional[ga_credentials.Credentials] = None, credentials_file: Optional[str] = None, scopes: Optional[Sequence[str]] = None, quota_project_id: Optional[str] = None, diff --git a/packages/google-cloud-websecurityscanner/google/cloud/websecurityscanner_v1/services/web_security_scanner/transports/grpc.py b/packages/google-cloud-websecurityscanner/google/cloud/websecurityscanner_v1/services/web_security_scanner/transports/grpc.py index c83af4344e3b..8162969c0f74 100644 --- a/packages/google-cloud-websecurityscanner/google/cloud/websecurityscanner_v1/services/web_security_scanner/transports/grpc.py +++ b/packages/google-cloud-websecurityscanner/google/cloud/websecurityscanner_v1/services/web_security_scanner/transports/grpc.py @@ -55,14 +55,14 @@ def __init__( self, *, host: str = "websecurityscanner.googleapis.com", - credentials: ga_credentials.Credentials = None, - credentials_file: str = None, - scopes: Sequence[str] = None, - channel: grpc.Channel = None, - api_mtls_endpoint: str = None, - client_cert_source: Callable[[], Tuple[bytes, bytes]] = None, - ssl_channel_credentials: grpc.ChannelCredentials = None, - client_cert_source_for_mtls: Callable[[], Tuple[bytes, bytes]] = None, + credentials: Optional[ga_credentials.Credentials] = None, + credentials_file: Optional[str] = None, + scopes: Optional[Sequence[str]] = None, + channel: Optional[grpc.Channel] = None, + api_mtls_endpoint: Optional[str] = None, + client_cert_source: Optional[Callable[[], Tuple[bytes, bytes]]] = None, + ssl_channel_credentials: Optional[grpc.ChannelCredentials] = None, + client_cert_source_for_mtls: Optional[Callable[[], Tuple[bytes, bytes]]] = None, quota_project_id: Optional[str] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, always_use_jwt_access: Optional[bool] = False, @@ -189,8 +189,8 @@ def __init__( def create_channel( cls, host: str = "websecurityscanner.googleapis.com", - credentials: ga_credentials.Credentials = None, - credentials_file: str = None, + credentials: Optional[ga_credentials.Credentials] = None, + credentials_file: Optional[str] = None, scopes: Optional[Sequence[str]] = None, quota_project_id: Optional[str] = None, **kwargs, diff --git a/packages/google-cloud-websecurityscanner/google/cloud/websecurityscanner_v1/services/web_security_scanner/transports/grpc_asyncio.py b/packages/google-cloud-websecurityscanner/google/cloud/websecurityscanner_v1/services/web_security_scanner/transports/grpc_asyncio.py index 3ae9fd26dc71..b0379475f8c9 100644 --- a/packages/google-cloud-websecurityscanner/google/cloud/websecurityscanner_v1/services/web_security_scanner/transports/grpc_asyncio.py +++ b/packages/google-cloud-websecurityscanner/google/cloud/websecurityscanner_v1/services/web_security_scanner/transports/grpc_asyncio.py @@ -57,7 +57,7 @@ class WebSecurityScannerGrpcAsyncIOTransport(WebSecurityScannerTransport): def create_channel( cls, host: str = "websecurityscanner.googleapis.com", - credentials: ga_credentials.Credentials = None, + credentials: Optional[ga_credentials.Credentials] = None, credentials_file: Optional[str] = None, scopes: Optional[Sequence[str]] = None, quota_project_id: Optional[str] = None, @@ -100,15 +100,15 @@ def __init__( self, *, host: str = "websecurityscanner.googleapis.com", - credentials: ga_credentials.Credentials = None, + credentials: Optional[ga_credentials.Credentials] = None, credentials_file: Optional[str] = None, scopes: Optional[Sequence[str]] = None, - channel: aio.Channel = None, - api_mtls_endpoint: str = None, - client_cert_source: Callable[[], Tuple[bytes, bytes]] = None, - ssl_channel_credentials: grpc.ChannelCredentials = None, - client_cert_source_for_mtls: Callable[[], Tuple[bytes, bytes]] = None, - quota_project_id=None, + channel: Optional[aio.Channel] = None, + api_mtls_endpoint: Optional[str] = None, + client_cert_source: Optional[Callable[[], Tuple[bytes, bytes]]] = None, + ssl_channel_credentials: Optional[grpc.ChannelCredentials] = None, + client_cert_source_for_mtls: Optional[Callable[[], Tuple[bytes, bytes]]] = None, + quota_project_id: Optional[str] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, always_use_jwt_access: Optional[bool] = False, api_audience: Optional[str] = None, diff --git a/packages/google-cloud-websecurityscanner/google/cloud/websecurityscanner_v1/types/crawled_url.py b/packages/google-cloud-websecurityscanner/google/cloud/websecurityscanner_v1/types/crawled_url.py index 0f7cc4e882bc..ac7e984dacb1 100644 --- a/packages/google-cloud-websecurityscanner/google/cloud/websecurityscanner_v1/types/crawled_url.py +++ b/packages/google-cloud-websecurityscanner/google/cloud/websecurityscanner_v1/types/crawled_url.py @@ -13,6 +13,8 @@ # See the License for the specific language governing permissions and # limitations under the License. # +from typing import MutableMapping, MutableSequence + import proto # type: ignore __protobuf__ = proto.module( @@ -40,15 +42,15 @@ class CrawledUrl(proto.Message): used to visit the URL. """ - http_method = proto.Field( + http_method: str = proto.Field( proto.STRING, number=1, ) - url = proto.Field( + url: str = proto.Field( proto.STRING, number=2, ) - body = proto.Field( + body: str = proto.Field( proto.STRING, number=3, ) diff --git a/packages/google-cloud-websecurityscanner/google/cloud/websecurityscanner_v1/types/finding.py b/packages/google-cloud-websecurityscanner/google/cloud/websecurityscanner_v1/types/finding.py index 4497340e293f..dffd7ed30114 100644 --- a/packages/google-cloud-websecurityscanner/google/cloud/websecurityscanner_v1/types/finding.py +++ b/packages/google-cloud-websecurityscanner/google/cloud/websecurityscanner_v1/types/finding.py @@ -13,6 +13,8 @@ # See the License for the specific language governing permissions and # limitations under the License. # +from typing import MutableMapping, MutableSequence + import proto # type: ignore from google.cloud.websecurityscanner_v1.types import finding_addon @@ -106,82 +108,82 @@ class Severity(proto.Enum): MEDIUM = 3 LOW = 4 - name = proto.Field( + name: str = proto.Field( proto.STRING, number=1, ) - finding_type = proto.Field( + finding_type: str = proto.Field( proto.STRING, number=2, ) - severity = proto.Field( + severity: Severity = proto.Field( proto.ENUM, number=17, enum=Severity, ) - http_method = proto.Field( + http_method: str = proto.Field( proto.STRING, number=3, ) - fuzzed_url = proto.Field( + fuzzed_url: str = proto.Field( proto.STRING, number=4, ) - body = proto.Field( + body: str = proto.Field( proto.STRING, number=5, ) - description = proto.Field( + description: str = proto.Field( proto.STRING, number=6, ) - reproduction_url = proto.Field( + reproduction_url: str = proto.Field( proto.STRING, number=7, ) - frame_url = proto.Field( + frame_url: str = proto.Field( proto.STRING, number=8, ) - final_url = proto.Field( + final_url: str = proto.Field( proto.STRING, number=9, ) - tracking_id = proto.Field( + tracking_id: str = proto.Field( proto.STRING, number=10, ) - form = proto.Field( + form: finding_addon.Form = proto.Field( proto.MESSAGE, number=16, message=finding_addon.Form, ) - outdated_library = proto.Field( + outdated_library: finding_addon.OutdatedLibrary = proto.Field( proto.MESSAGE, number=11, message=finding_addon.OutdatedLibrary, ) - violating_resource = proto.Field( + violating_resource: finding_addon.ViolatingResource = proto.Field( proto.MESSAGE, number=12, message=finding_addon.ViolatingResource, ) - vulnerable_headers = proto.Field( + vulnerable_headers: finding_addon.VulnerableHeaders = proto.Field( proto.MESSAGE, number=15, message=finding_addon.VulnerableHeaders, ) - vulnerable_parameters = proto.Field( + vulnerable_parameters: finding_addon.VulnerableParameters = proto.Field( proto.MESSAGE, number=13, message=finding_addon.VulnerableParameters, ) - xss = proto.Field( + xss: finding_addon.Xss = proto.Field( proto.MESSAGE, number=14, message=finding_addon.Xss, ) - xxe = proto.Field( + xxe: finding_addon.Xxe = proto.Field( proto.MESSAGE, number=18, message=finding_addon.Xxe, diff --git a/packages/google-cloud-websecurityscanner/google/cloud/websecurityscanner_v1/types/finding_addon.py b/packages/google-cloud-websecurityscanner/google/cloud/websecurityscanner_v1/types/finding_addon.py index 3ea82900946c..a7f569069105 100644 --- a/packages/google-cloud-websecurityscanner/google/cloud/websecurityscanner_v1/types/finding_addon.py +++ b/packages/google-cloud-websecurityscanner/google/cloud/websecurityscanner_v1/types/finding_addon.py @@ -13,6 +13,8 @@ # See the License for the specific language governing permissions and # limitations under the License. # +from typing import MutableMapping, MutableSequence + import proto # type: ignore __protobuf__ = proto.module( @@ -36,16 +38,16 @@ class Form(proto.Message): action_uri (str): ! The URI where to send the form when it's submitted. - fields (Sequence[str]): + fields (MutableSequence[str]): ! The names of form fields related to the vulnerability. """ - action_uri = proto.Field( + action_uri: str = proto.Field( proto.STRING, number=1, ) - fields = proto.RepeatedField( + fields: MutableSequence[str] = proto.RepeatedField( proto.STRING, number=2, ) @@ -59,20 +61,20 @@ class OutdatedLibrary(proto.Message): The name of the outdated library. version (str): The version number. - learn_more_urls (Sequence[str]): + learn_more_urls (MutableSequence[str]): URLs to learn more information about the vulnerabilities in the library. """ - library_name = proto.Field( + library_name: str = proto.Field( proto.STRING, number=1, ) - version = proto.Field( + version: str = proto.Field( proto.STRING, number=2, ) - learn_more_urls = proto.RepeatedField( + learn_more_urls: MutableSequence[str] = proto.RepeatedField( proto.STRING, number=3, ) @@ -89,11 +91,11 @@ class ViolatingResource(proto.Message): URL of this violating resource. """ - content_type = proto.Field( + content_type: str = proto.Field( proto.STRING, number=1, ) - resource_url = proto.Field( + resource_url: str = proto.Field( proto.STRING, number=2, ) @@ -103,11 +105,11 @@ class VulnerableParameters(proto.Message): r"""Information about vulnerable request parameters. Attributes: - parameter_names (Sequence[str]): + parameter_names (MutableSequence[str]): The vulnerable parameter names. """ - parameter_names = proto.RepeatedField( + parameter_names: MutableSequence[str] = proto.RepeatedField( proto.STRING, number=1, ) @@ -117,9 +119,9 @@ class VulnerableHeaders(proto.Message): r"""Information about vulnerable or missing HTTP Headers. Attributes: - headers (Sequence[google.cloud.websecurityscanner_v1.types.VulnerableHeaders.Header]): + headers (MutableSequence[google.cloud.websecurityscanner_v1.types.VulnerableHeaders.Header]): List of vulnerable headers. - missing_headers (Sequence[google.cloud.websecurityscanner_v1.types.VulnerableHeaders.Header]): + missing_headers (MutableSequence[google.cloud.websecurityscanner_v1.types.VulnerableHeaders.Header]): List of missing headers. """ @@ -133,21 +135,21 @@ class Header(proto.Message): Header value. """ - name = proto.Field( + name: str = proto.Field( proto.STRING, number=1, ) - value = proto.Field( + value: str = proto.Field( proto.STRING, number=2, ) - headers = proto.RepeatedField( + headers: MutableSequence[Header] = proto.RepeatedField( proto.MESSAGE, number=1, message=Header, ) - missing_headers = proto.RepeatedField( + missing_headers: MutableSequence[Header] = proto.RepeatedField( proto.MESSAGE, number=2, message=Header, @@ -158,7 +160,7 @@ class Xss(proto.Message): r"""Information reported for an XSS. Attributes: - stack_traces (Sequence[str]): + stack_traces (MutableSequence[str]): Stack traces leading to the point where the XSS occurred. error_message (str): @@ -191,20 +193,20 @@ class AttackVector(proto.Enum): SAME_ORIGIN = 14 USER_CONTROLLABLE_URL = 15 - stack_traces = proto.RepeatedField( + stack_traces: MutableSequence[str] = proto.RepeatedField( proto.STRING, number=1, ) - error_message = proto.Field( + error_message: str = proto.Field( proto.STRING, number=2, ) - attack_vector = proto.Field( + attack_vector: AttackVector = proto.Field( proto.ENUM, number=3, enum=AttackVector, ) - stored_xss_seeding_url = proto.Field( + stored_xss_seeding_url: str = proto.Field( proto.STRING, number=4, ) @@ -228,11 +230,11 @@ class Location(proto.Enum): LOCATION_UNSPECIFIED = 0 COMPLETE_REQUEST_BODY = 1 - payload_value = proto.Field( + payload_value: str = proto.Field( proto.STRING, number=1, ) - payload_location = proto.Field( + payload_location: Location = proto.Field( proto.ENUM, number=2, enum=Location, diff --git a/packages/google-cloud-websecurityscanner/google/cloud/websecurityscanner_v1/types/finding_type_stats.py b/packages/google-cloud-websecurityscanner/google/cloud/websecurityscanner_v1/types/finding_type_stats.py index 2f6c21c112fd..83e501981150 100644 --- a/packages/google-cloud-websecurityscanner/google/cloud/websecurityscanner_v1/types/finding_type_stats.py +++ b/packages/google-cloud-websecurityscanner/google/cloud/websecurityscanner_v1/types/finding_type_stats.py @@ -13,6 +13,8 @@ # See the License for the specific language governing permissions and # limitations under the License. # +from typing import MutableMapping, MutableSequence + import proto # type: ignore __protobuf__ = proto.module( @@ -36,11 +38,11 @@ class FindingTypeStats(proto.Message): to this finding type. """ - finding_type = proto.Field( + finding_type: str = proto.Field( proto.STRING, number=1, ) - finding_count = proto.Field( + finding_count: int = proto.Field( proto.INT32, number=2, ) diff --git a/packages/google-cloud-websecurityscanner/google/cloud/websecurityscanner_v1/types/scan_config.py b/packages/google-cloud-websecurityscanner/google/cloud/websecurityscanner_v1/types/scan_config.py index 41eec3874041..88708eb38467 100644 --- a/packages/google-cloud-websecurityscanner/google/cloud/websecurityscanner_v1/types/scan_config.py +++ b/packages/google-cloud-websecurityscanner/google/cloud/websecurityscanner_v1/types/scan_config.py @@ -13,6 +13,8 @@ # See the License for the specific language governing permissions and # limitations under the License. # +from typing import MutableMapping, MutableSequence + from google.protobuf import timestamp_pb2 # type: ignore import proto # type: ignore @@ -42,7 +44,7 @@ class ScanConfig(proto.Message): to 20 inclusively. If the field is unspecified or its value is set 0, server will default to 15. Other values outside of [5, 20] range will be rejected with INVALID_ARGUMENT error. - starting_urls (Sequence[str]): + starting_urls (MutableSequence[str]): Required. The starting URLs from which the scanner finds site pages. authentication (google.cloud.websecurityscanner_v1.types.ScanConfig.Authentication): @@ -51,7 +53,7 @@ class ScanConfig(proto.Message): configuration during scanning. user_agent (google.cloud.websecurityscanner_v1.types.ScanConfig.UserAgent): The user agent used during scanning. - blacklist_patterns (Sequence[str]): + blacklist_patterns (MutableSequence[str]): The excluded URL patterns as described in https://cloud.google.com/security-command-center/docs/how-to-use-web-security-scanner#excluding_urls schedule (google.cloud.websecurityscanner_v1.types.ScanConfig.Schedule): @@ -140,11 +142,11 @@ class GoogleAccount(proto.Message): included in audit logs. """ - username = proto.Field( + username: str = proto.Field( proto.STRING, number=1, ) - password = proto.Field( + password: str = proto.Field( proto.STRING, number=2, ) @@ -166,15 +168,15 @@ class CustomAccount(proto.Message): Required. The login form URL of the website. """ - username = proto.Field( + username: str = proto.Field( proto.STRING, number=1, ) - password = proto.Field( + password: str = proto.Field( proto.STRING, number=2, ) - login_url = proto.Field( + login_url: str = proto.Field( proto.STRING, number=3, ) @@ -207,31 +209,31 @@ class IapTestServiceAccountInfo(proto.Message): (IAP). """ - target_audience_client_id = proto.Field( + target_audience_client_id: str = proto.Field( proto.STRING, number=1, ) - iap_test_service_account_info = proto.Field( + iap_test_service_account_info: "ScanConfig.Authentication.IapCredential.IapTestServiceAccountInfo" = proto.Field( proto.MESSAGE, number=1, oneof="iap_credentials", message="ScanConfig.Authentication.IapCredential.IapTestServiceAccountInfo", ) - google_account = proto.Field( + google_account: "ScanConfig.Authentication.GoogleAccount" = proto.Field( proto.MESSAGE, number=1, oneof="authentication", message="ScanConfig.Authentication.GoogleAccount", ) - custom_account = proto.Field( + custom_account: "ScanConfig.Authentication.CustomAccount" = proto.Field( proto.MESSAGE, number=2, oneof="authentication", message="ScanConfig.Authentication.CustomAccount", ) - iap_credential = proto.Field( + iap_credential: "ScanConfig.Authentication.IapCredential" = proto.Field( proto.MESSAGE, number=4, oneof="authentication", @@ -253,70 +255,70 @@ class Schedule(proto.Message): executions in days. """ - schedule_time = proto.Field( + schedule_time: timestamp_pb2.Timestamp = proto.Field( proto.MESSAGE, number=1, message=timestamp_pb2.Timestamp, ) - interval_duration_days = proto.Field( + interval_duration_days: int = proto.Field( proto.INT32, number=2, ) - name = proto.Field( + name: str = proto.Field( proto.STRING, number=1, ) - display_name = proto.Field( + display_name: str = proto.Field( proto.STRING, number=2, ) - max_qps = proto.Field( + max_qps: int = proto.Field( proto.INT32, number=3, ) - starting_urls = proto.RepeatedField( + starting_urls: MutableSequence[str] = proto.RepeatedField( proto.STRING, number=4, ) - authentication = proto.Field( + authentication: Authentication = proto.Field( proto.MESSAGE, number=5, message=Authentication, ) - user_agent = proto.Field( + user_agent: UserAgent = proto.Field( proto.ENUM, number=6, enum=UserAgent, ) - blacklist_patterns = proto.RepeatedField( + blacklist_patterns: MutableSequence[str] = proto.RepeatedField( proto.STRING, number=7, ) - schedule = proto.Field( + schedule: Schedule = proto.Field( proto.MESSAGE, number=8, message=Schedule, ) - export_to_security_command_center = proto.Field( + export_to_security_command_center: ExportToSecurityCommandCenter = proto.Field( proto.ENUM, number=10, enum=ExportToSecurityCommandCenter, ) - risk_level = proto.Field( + risk_level: RiskLevel = proto.Field( proto.ENUM, number=12, enum=RiskLevel, ) - managed_scan = proto.Field( + managed_scan: bool = proto.Field( proto.BOOL, number=13, ) - static_ip_scan = proto.Field( + static_ip_scan: bool = proto.Field( proto.BOOL, number=14, ) - ignore_http_status_errors = proto.Field( + ignore_http_status_errors: bool = proto.Field( proto.BOOL, number=15, ) diff --git a/packages/google-cloud-websecurityscanner/google/cloud/websecurityscanner_v1/types/scan_config_error.py b/packages/google-cloud-websecurityscanner/google/cloud/websecurityscanner_v1/types/scan_config_error.py index ad35d79b3a6d..7ef764143fae 100644 --- a/packages/google-cloud-websecurityscanner/google/cloud/websecurityscanner_v1/types/scan_config_error.py +++ b/packages/google-cloud-websecurityscanner/google/cloud/websecurityscanner_v1/types/scan_config_error.py @@ -13,6 +13,8 @@ # See the License for the specific language governing permissions and # limitations under the License. # +from typing import MutableMapping, MutableSequence + import proto # type: ignore __protobuf__ = proto.module( @@ -89,12 +91,12 @@ class Code(proto.Enum): UNSUPPORTED_FINDING_TYPE = 41 UNSUPPORTED_URL_SCHEME = 42 - code = proto.Field( + code: Code = proto.Field( proto.ENUM, number=1, enum=Code, ) - field_name = proto.Field( + field_name: str = proto.Field( proto.STRING, number=2, ) diff --git a/packages/google-cloud-websecurityscanner/google/cloud/websecurityscanner_v1/types/scan_run.py b/packages/google-cloud-websecurityscanner/google/cloud/websecurityscanner_v1/types/scan_run.py index 0e5bb0c3ad60..0937c83fb615 100644 --- a/packages/google-cloud-websecurityscanner/google/cloud/websecurityscanner_v1/types/scan_run.py +++ b/packages/google-cloud-websecurityscanner/google/cloud/websecurityscanner_v1/types/scan_run.py @@ -13,6 +13,8 @@ # See the License for the specific language governing permissions and # limitations under the License. # +from typing import MutableMapping, MutableSequence + from google.protobuf import timestamp_pb2 # type: ignore import proto # type: ignore @@ -79,7 +81,7 @@ class ScanRun(proto.Message): Output only. If result_state is an ERROR, this field provides the primary reason for scan's termination and more details, if such are available. - warning_traces (Sequence[google.cloud.websecurityscanner_v1.types.ScanRunWarningTrace]): + warning_traces (MutableSequence[google.cloud.websecurityscanner_v1.types.ScanRunWarningTrace]): Output only. A list of warnings, if such are encountered during this scan run. """ @@ -98,52 +100,54 @@ class ResultState(proto.Enum): ERROR = 2 KILLED = 3 - name = proto.Field( + name: str = proto.Field( proto.STRING, number=1, ) - execution_state = proto.Field( + execution_state: ExecutionState = proto.Field( proto.ENUM, number=2, enum=ExecutionState, ) - result_state = proto.Field( + result_state: ResultState = proto.Field( proto.ENUM, number=3, enum=ResultState, ) - start_time = proto.Field( + start_time: timestamp_pb2.Timestamp = proto.Field( proto.MESSAGE, number=4, message=timestamp_pb2.Timestamp, ) - end_time = proto.Field( + end_time: timestamp_pb2.Timestamp = proto.Field( proto.MESSAGE, number=5, message=timestamp_pb2.Timestamp, ) - urls_crawled_count = proto.Field( + urls_crawled_count: int = proto.Field( proto.INT64, number=6, ) - urls_tested_count = proto.Field( + urls_tested_count: int = proto.Field( proto.INT64, number=7, ) - has_vulnerabilities = proto.Field( + has_vulnerabilities: bool = proto.Field( proto.BOOL, number=8, ) - progress_percent = proto.Field( + progress_percent: int = proto.Field( proto.INT32, number=9, ) - error_trace = proto.Field( + error_trace: scan_run_error_trace.ScanRunErrorTrace = proto.Field( proto.MESSAGE, number=10, message=scan_run_error_trace.ScanRunErrorTrace, ) - warning_traces = proto.RepeatedField( + warning_traces: MutableSequence[ + scan_run_warning_trace.ScanRunWarningTrace + ] = proto.RepeatedField( proto.MESSAGE, number=11, message=scan_run_warning_trace.ScanRunWarningTrace, diff --git a/packages/google-cloud-websecurityscanner/google/cloud/websecurityscanner_v1/types/scan_run_error_trace.py b/packages/google-cloud-websecurityscanner/google/cloud/websecurityscanner_v1/types/scan_run_error_trace.py index b71b80532725..e0e5f89606c3 100644 --- a/packages/google-cloud-websecurityscanner/google/cloud/websecurityscanner_v1/types/scan_run_error_trace.py +++ b/packages/google-cloud-websecurityscanner/google/cloud/websecurityscanner_v1/types/scan_run_error_trace.py @@ -13,6 +13,8 @@ # See the License for the specific language governing permissions and # limitations under the License. # +from typing import MutableMapping, MutableSequence + import proto # type: ignore from google.cloud.websecurityscanner_v1.types import ( @@ -59,17 +61,17 @@ class Code(proto.Enum): TOO_MANY_REDIRECTS = 5 TOO_MANY_HTTP_ERRORS = 6 - code = proto.Field( + code: Code = proto.Field( proto.ENUM, number=1, enum=Code, ) - scan_config_error = proto.Field( + scan_config_error: gcw_scan_config_error.ScanConfigError = proto.Field( proto.MESSAGE, number=2, message=gcw_scan_config_error.ScanConfigError, ) - most_common_http_error_code = proto.Field( + most_common_http_error_code: int = proto.Field( proto.INT32, number=3, ) diff --git a/packages/google-cloud-websecurityscanner/google/cloud/websecurityscanner_v1/types/scan_run_log.py b/packages/google-cloud-websecurityscanner/google/cloud/websecurityscanner_v1/types/scan_run_log.py index f7adce2fbfe9..97fda845b8d6 100644 --- a/packages/google-cloud-websecurityscanner/google/cloud/websecurityscanner_v1/types/scan_run_log.py +++ b/packages/google-cloud-websecurityscanner/google/cloud/websecurityscanner_v1/types/scan_run_log.py @@ -13,6 +13,8 @@ # See the License for the specific language governing permissions and # limitations under the License. # +from typing import MutableMapping, MutableSequence + import proto # type: ignore from google.cloud.websecurityscanner_v1.types import scan_run, scan_run_error_trace @@ -52,37 +54,37 @@ class ScanRunLog(proto.Message): """ - summary = proto.Field( + summary: str = proto.Field( proto.STRING, number=1, ) - name = proto.Field( + name: str = proto.Field( proto.STRING, number=2, ) - execution_state = proto.Field( + execution_state: scan_run.ScanRun.ExecutionState = proto.Field( proto.ENUM, number=3, enum=scan_run.ScanRun.ExecutionState, ) - result_state = proto.Field( + result_state: scan_run.ScanRun.ResultState = proto.Field( proto.ENUM, number=4, enum=scan_run.ScanRun.ResultState, ) - urls_crawled_count = proto.Field( + urls_crawled_count: int = proto.Field( proto.INT64, number=5, ) - urls_tested_count = proto.Field( + urls_tested_count: int = proto.Field( proto.INT64, number=6, ) - has_findings = proto.Field( + has_findings: bool = proto.Field( proto.BOOL, number=7, ) - error_trace = proto.Field( + error_trace: scan_run_error_trace.ScanRunErrorTrace = proto.Field( proto.MESSAGE, number=8, message=scan_run_error_trace.ScanRunErrorTrace, diff --git a/packages/google-cloud-websecurityscanner/google/cloud/websecurityscanner_v1/types/scan_run_warning_trace.py b/packages/google-cloud-websecurityscanner/google/cloud/websecurityscanner_v1/types/scan_run_warning_trace.py index 72b650478750..2efab2cd1b80 100644 --- a/packages/google-cloud-websecurityscanner/google/cloud/websecurityscanner_v1/types/scan_run_warning_trace.py +++ b/packages/google-cloud-websecurityscanner/google/cloud/websecurityscanner_v1/types/scan_run_warning_trace.py @@ -13,6 +13,8 @@ # See the License for the specific language governing permissions and # limitations under the License. # +from typing import MutableMapping, MutableSequence + import proto # type: ignore __protobuf__ = proto.module( @@ -46,7 +48,7 @@ class Code(proto.Enum): BLOCKED_BY_IAP = 4 NO_STARTING_URL_FOUND_FOR_MANAGED_SCAN = 5 - code = proto.Field( + code: Code = proto.Field( proto.ENUM, number=1, enum=Code, diff --git a/packages/google-cloud-websecurityscanner/google/cloud/websecurityscanner_v1/types/web_security_scanner.py b/packages/google-cloud-websecurityscanner/google/cloud/websecurityscanner_v1/types/web_security_scanner.py index 52dc4b136611..eb21f643ac41 100644 --- a/packages/google-cloud-websecurityscanner/google/cloud/websecurityscanner_v1/types/web_security_scanner.py +++ b/packages/google-cloud-websecurityscanner/google/cloud/websecurityscanner_v1/types/web_security_scanner.py @@ -13,6 +13,8 @@ # See the License for the specific language governing permissions and # limitations under the License. # +from typing import MutableMapping, MutableSequence + from google.protobuf import field_mask_pb2 # type: ignore import proto # type: ignore @@ -61,11 +63,11 @@ class CreateScanConfigRequest(proto.Message): Required. The ScanConfig to be created. """ - parent = proto.Field( + parent: str = proto.Field( proto.STRING, number=1, ) - scan_config = proto.Field( + scan_config: gcw_scan_config.ScanConfig = proto.Field( proto.MESSAGE, number=2, message=gcw_scan_config.ScanConfig, @@ -82,7 +84,7 @@ class DeleteScanConfigRequest(proto.Message): 'projects/{projectId}/scanConfigs/{scanConfigId}'. """ - name = proto.Field( + name: str = proto.Field( proto.STRING, number=1, ) @@ -98,7 +100,7 @@ class GetScanConfigRequest(proto.Message): 'projects/{projectId}/scanConfigs/{scanConfigId}'. """ - name = proto.Field( + name: str = proto.Field( proto.STRING, number=1, ) @@ -124,15 +126,15 @@ class ListScanConfigsRequest(proto.Message): reasonable value. """ - parent = proto.Field( + parent: str = proto.Field( proto.STRING, number=1, ) - page_token = proto.Field( + page_token: str = proto.Field( proto.STRING, number=2, ) - page_size = proto.Field( + page_size: int = proto.Field( proto.INT32, number=3, ) @@ -153,12 +155,12 @@ class UpdateScanConfigRequest(proto.Message): https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#fieldmask """ - scan_config = proto.Field( + scan_config: gcw_scan_config.ScanConfig = proto.Field( proto.MESSAGE, number=2, message=gcw_scan_config.ScanConfig, ) - update_mask = proto.Field( + update_mask: field_mask_pb2.FieldMask = proto.Field( proto.MESSAGE, number=3, message=field_mask_pb2.FieldMask, @@ -169,7 +171,7 @@ class ListScanConfigsResponse(proto.Message): r"""Response for the ``ListScanConfigs`` method. Attributes: - scan_configs (Sequence[google.cloud.websecurityscanner_v1.types.ScanConfig]): + scan_configs (MutableSequence[google.cloud.websecurityscanner_v1.types.ScanConfig]): The list of ScanConfigs returned. next_page_token (str): Token to retrieve the next page of results, @@ -181,12 +183,12 @@ class ListScanConfigsResponse(proto.Message): def raw_page(self): return self - scan_configs = proto.RepeatedField( + scan_configs: MutableSequence[gcw_scan_config.ScanConfig] = proto.RepeatedField( proto.MESSAGE, number=1, message=gcw_scan_config.ScanConfig, ) - next_page_token = proto.Field( + next_page_token: str = proto.Field( proto.STRING, number=2, ) @@ -202,7 +204,7 @@ class StartScanRunRequest(proto.Message): 'projects/{projectId}/scanConfigs/{scanConfigId}'. """ - name = proto.Field( + name: str = proto.Field( proto.STRING, number=1, ) @@ -218,7 +220,7 @@ class GetScanRunRequest(proto.Message): 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. """ - name = proto.Field( + name: str = proto.Field( proto.STRING, number=1, ) @@ -244,15 +246,15 @@ class ListScanRunsRequest(proto.Message): reasonable value. """ - parent = proto.Field( + parent: str = proto.Field( proto.STRING, number=1, ) - page_token = proto.Field( + page_token: str = proto.Field( proto.STRING, number=2, ) - page_size = proto.Field( + page_size: int = proto.Field( proto.INT32, number=3, ) @@ -262,7 +264,7 @@ class ListScanRunsResponse(proto.Message): r"""Response for the ``ListScanRuns`` method. Attributes: - scan_runs (Sequence[google.cloud.websecurityscanner_v1.types.ScanRun]): + scan_runs (MutableSequence[google.cloud.websecurityscanner_v1.types.ScanRun]): The list of ScanRuns returned. next_page_token (str): Token to retrieve the next page of results, @@ -274,12 +276,12 @@ class ListScanRunsResponse(proto.Message): def raw_page(self): return self - scan_runs = proto.RepeatedField( + scan_runs: MutableSequence[scan_run.ScanRun] = proto.RepeatedField( proto.MESSAGE, number=1, message=scan_run.ScanRun, ) - next_page_token = proto.Field( + next_page_token: str = proto.Field( proto.STRING, number=2, ) @@ -295,7 +297,7 @@ class StopScanRunRequest(proto.Message): 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. """ - name = proto.Field( + name: str = proto.Field( proto.STRING, number=1, ) @@ -321,15 +323,15 @@ class ListCrawledUrlsRequest(proto.Message): reasonable value. """ - parent = proto.Field( + parent: str = proto.Field( proto.STRING, number=1, ) - page_token = proto.Field( + page_token: str = proto.Field( proto.STRING, number=2, ) - page_size = proto.Field( + page_size: int = proto.Field( proto.INT32, number=3, ) @@ -339,7 +341,7 @@ class ListCrawledUrlsResponse(proto.Message): r"""Response for the ``ListCrawledUrls`` method. Attributes: - crawled_urls (Sequence[google.cloud.websecurityscanner_v1.types.CrawledUrl]): + crawled_urls (MutableSequence[google.cloud.websecurityscanner_v1.types.CrawledUrl]): The list of CrawledUrls returned. next_page_token (str): Token to retrieve the next page of results, @@ -351,12 +353,12 @@ class ListCrawledUrlsResponse(proto.Message): def raw_page(self): return self - crawled_urls = proto.RepeatedField( + crawled_urls: MutableSequence[crawled_url.CrawledUrl] = proto.RepeatedField( proto.MESSAGE, number=1, message=crawled_url.CrawledUrl, ) - next_page_token = proto.Field( + next_page_token: str = proto.Field( proto.STRING, number=2, ) @@ -372,7 +374,7 @@ class GetFindingRequest(proto.Message): 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}/findings/{findingId}'. """ - name = proto.Field( + name: str = proto.Field( proto.STRING, number=1, ) @@ -401,19 +403,19 @@ class ListFindingsRequest(proto.Message): reasonable value. """ - parent = proto.Field( + parent: str = proto.Field( proto.STRING, number=1, ) - filter = proto.Field( + filter: str = proto.Field( proto.STRING, number=2, ) - page_token = proto.Field( + page_token: str = proto.Field( proto.STRING, number=3, ) - page_size = proto.Field( + page_size: int = proto.Field( proto.INT32, number=4, ) @@ -423,7 +425,7 @@ class ListFindingsResponse(proto.Message): r"""Response for the ``ListFindings`` method. Attributes: - findings (Sequence[google.cloud.websecurityscanner_v1.types.Finding]): + findings (MutableSequence[google.cloud.websecurityscanner_v1.types.Finding]): The list of Findings returned. next_page_token (str): Token to retrieve the next page of results, @@ -435,12 +437,12 @@ class ListFindingsResponse(proto.Message): def raw_page(self): return self - findings = proto.RepeatedField( + findings: MutableSequence[finding.Finding] = proto.RepeatedField( proto.MESSAGE, number=1, message=finding.Finding, ) - next_page_token = proto.Field( + next_page_token: str = proto.Field( proto.STRING, number=2, ) @@ -456,7 +458,7 @@ class ListFindingTypeStatsRequest(proto.Message): 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. """ - parent = proto.Field( + parent: str = proto.Field( proto.STRING, number=1, ) @@ -466,11 +468,13 @@ class ListFindingTypeStatsResponse(proto.Message): r"""Response for the ``ListFindingTypeStats`` method. Attributes: - finding_type_stats (Sequence[google.cloud.websecurityscanner_v1.types.FindingTypeStats]): + finding_type_stats (MutableSequence[google.cloud.websecurityscanner_v1.types.FindingTypeStats]): The list of FindingTypeStats returned. """ - finding_type_stats = proto.RepeatedField( + finding_type_stats: MutableSequence[ + gcw_finding_type_stats.FindingTypeStats + ] = proto.RepeatedField( proto.MESSAGE, number=1, message=gcw_finding_type_stats.FindingTypeStats, diff --git a/packages/google-cloud-websecurityscanner/google/cloud/websecurityscanner_v1alpha/__init__.py b/packages/google-cloud-websecurityscanner/google/cloud/websecurityscanner_v1alpha/__init__.py index 33579e58230f..14e88bb3b462 100644 --- a/packages/google-cloud-websecurityscanner/google/cloud/websecurityscanner_v1alpha/__init__.py +++ b/packages/google-cloud-websecurityscanner/google/cloud/websecurityscanner_v1alpha/__init__.py @@ -13,6 +13,10 @@ # See the License for the specific language governing permissions and # limitations under the License. # +from google.cloud.websecurityscanner import gapic_version as package_version + +__version__ = package_version.__version__ + from .services.web_security_scanner import ( WebSecurityScannerAsyncClient, diff --git a/packages/google-cloud-websecurityscanner/google/cloud/websecurityscanner_v1alpha/services/web_security_scanner/async_client.py b/packages/google-cloud-websecurityscanner/google/cloud/websecurityscanner_v1alpha/services/web_security_scanner/async_client.py index 7048a46d98a9..de67c55f62fa 100644 --- a/packages/google-cloud-websecurityscanner/google/cloud/websecurityscanner_v1alpha/services/web_security_scanner/async_client.py +++ b/packages/google-cloud-websecurityscanner/google/cloud/websecurityscanner_v1alpha/services/web_security_scanner/async_client.py @@ -16,7 +16,17 @@ from collections import OrderedDict import functools import re -from typing import Dict, Mapping, Optional, Sequence, Tuple, Type, Union +from typing import ( + Dict, + Mapping, + MutableMapping, + MutableSequence, + Optional, + Sequence, + Tuple, + Type, + Union, +) from google.api_core import exceptions as core_exceptions from google.api_core import gapic_v1 @@ -181,9 +191,9 @@ def transport(self) -> WebSecurityScannerTransport: def __init__( self, *, - credentials: ga_credentials.Credentials = None, + credentials: Optional[ga_credentials.Credentials] = None, transport: Union[str, WebSecurityScannerTransport] = "grpc_asyncio", - client_options: ClientOptions = None, + client_options: Optional[ClientOptions] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, ) -> None: """Instantiates the web security scanner client. @@ -227,12 +237,14 @@ def __init__( async def create_scan_config( self, - request: Union[web_security_scanner.CreateScanConfigRequest, dict] = None, + request: Optional[ + Union[web_security_scanner.CreateScanConfigRequest, dict] + ] = None, *, - parent: str = None, - scan_config: gcw_scan_config.ScanConfig = None, + parent: Optional[str] = None, + scan_config: Optional[gcw_scan_config.ScanConfig] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> gcw_scan_config.ScanConfig: r"""Creates a new ScanConfig. @@ -269,7 +281,7 @@ async def sample_create_scan_config(): print(response) Args: - request (Union[google.cloud.websecurityscanner_v1alpha.types.CreateScanConfigRequest, dict]): + request (Optional[Union[google.cloud.websecurityscanner_v1alpha.types.CreateScanConfigRequest, dict]]): The request object. Request for the `CreateScanConfig` method. parent (:class:`str`): @@ -347,11 +359,13 @@ async def sample_create_scan_config(): async def delete_scan_config( self, - request: Union[web_security_scanner.DeleteScanConfigRequest, dict] = None, + request: Optional[ + Union[web_security_scanner.DeleteScanConfigRequest, dict] + ] = None, *, - name: str = None, + name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> None: r"""Deletes an existing ScanConfig and its child @@ -381,7 +395,7 @@ async def sample_delete_scan_config(): await client.delete_scan_config(request=request) Args: - request (Union[google.cloud.websecurityscanner_v1alpha.types.DeleteScanConfigRequest, dict]): + request (Optional[Union[google.cloud.websecurityscanner_v1alpha.types.DeleteScanConfigRequest, dict]]): The request object. Request for the `DeleteScanConfig` method. name (:class:`str`): @@ -450,11 +464,13 @@ async def sample_delete_scan_config(): async def get_scan_config( self, - request: Union[web_security_scanner.GetScanConfigRequest, dict] = None, + request: Optional[ + Union[web_security_scanner.GetScanConfigRequest, dict] + ] = None, *, - name: str = None, + name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> scan_config.ScanConfig: r"""Gets a ScanConfig. @@ -486,7 +502,7 @@ async def sample_get_scan_config(): print(response) Args: - request (Union[google.cloud.websecurityscanner_v1alpha.types.GetScanConfigRequest, dict]): + request (Optional[Union[google.cloud.websecurityscanner_v1alpha.types.GetScanConfigRequest, dict]]): The request object. Request for the `GetScanConfig` method. name (:class:`str`): @@ -565,11 +581,13 @@ async def sample_get_scan_config(): async def list_scan_configs( self, - request: Union[web_security_scanner.ListScanConfigsRequest, dict] = None, + request: Optional[ + Union[web_security_scanner.ListScanConfigsRequest, dict] + ] = None, *, - parent: str = None, + parent: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> pagers.ListScanConfigsAsyncPager: r"""Lists ScanConfigs under a given project. @@ -602,7 +620,7 @@ async def sample_list_scan_configs(): print(response) Args: - request (Union[google.cloud.websecurityscanner_v1alpha.types.ListScanConfigsRequest, dict]): + request (Optional[Union[google.cloud.websecurityscanner_v1alpha.types.ListScanConfigsRequest, dict]]): The request object. Request for the `ListScanConfigs` method. parent (:class:`str`): @@ -690,12 +708,14 @@ async def sample_list_scan_configs(): async def update_scan_config( self, - request: Union[web_security_scanner.UpdateScanConfigRequest, dict] = None, + request: Optional[ + Union[web_security_scanner.UpdateScanConfigRequest, dict] + ] = None, *, - scan_config: gcw_scan_config.ScanConfig = None, - update_mask: field_mask_pb2.FieldMask = None, + scan_config: Optional[gcw_scan_config.ScanConfig] = None, + update_mask: Optional[field_mask_pb2.FieldMask] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> gcw_scan_config.ScanConfig: r"""Updates a ScanConfig. This method support partial @@ -732,7 +752,7 @@ async def sample_update_scan_config(): print(response) Args: - request (Union[google.cloud.websecurityscanner_v1alpha.types.UpdateScanConfigRequest, dict]): + request (Optional[Union[google.cloud.websecurityscanner_v1alpha.types.UpdateScanConfigRequest, dict]]): The request object. Request for the `UpdateScanConfigRequest` method. scan_config (:class:`google.cloud.websecurityscanner_v1alpha.types.ScanConfig`): @@ -814,11 +834,11 @@ async def sample_update_scan_config(): async def start_scan_run( self, - request: Union[web_security_scanner.StartScanRunRequest, dict] = None, + request: Optional[Union[web_security_scanner.StartScanRunRequest, dict]] = None, *, - name: str = None, + name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> scan_run.ScanRun: r"""Start a ScanRun according to the given ScanConfig. @@ -850,7 +870,7 @@ async def sample_start_scan_run(): print(response) Args: - request (Union[google.cloud.websecurityscanner_v1alpha.types.StartScanRunRequest, dict]): + request (Optional[Union[google.cloud.websecurityscanner_v1alpha.types.StartScanRunRequest, dict]]): The request object. Request for the `StartScanRun` method. name (:class:`str`): @@ -918,11 +938,11 @@ async def sample_start_scan_run(): async def get_scan_run( self, - request: Union[web_security_scanner.GetScanRunRequest, dict] = None, + request: Optional[Union[web_security_scanner.GetScanRunRequest, dict]] = None, *, - name: str = None, + name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> scan_run.ScanRun: r"""Gets a ScanRun. @@ -954,7 +974,7 @@ async def sample_get_scan_run(): print(response) Args: - request (Union[google.cloud.websecurityscanner_v1alpha.types.GetScanRunRequest, dict]): + request (Optional[Union[google.cloud.websecurityscanner_v1alpha.types.GetScanRunRequest, dict]]): The request object. Request for the `GetScanRun` method. name (:class:`str`): Required. The resource name of the @@ -1031,11 +1051,11 @@ async def sample_get_scan_run(): async def list_scan_runs( self, - request: Union[web_security_scanner.ListScanRunsRequest, dict] = None, + request: Optional[Union[web_security_scanner.ListScanRunsRequest, dict]] = None, *, - parent: str = None, + parent: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> pagers.ListScanRunsAsyncPager: r"""Lists ScanRuns under a given ScanConfig, in @@ -1069,7 +1089,7 @@ async def sample_list_scan_runs(): print(response) Args: - request (Union[google.cloud.websecurityscanner_v1alpha.types.ListScanRunsRequest, dict]): + request (Optional[Union[google.cloud.websecurityscanner_v1alpha.types.ListScanRunsRequest, dict]]): The request object. Request for the `ListScanRuns` method. parent (:class:`str`): @@ -1158,11 +1178,11 @@ async def sample_list_scan_runs(): async def stop_scan_run( self, - request: Union[web_security_scanner.StopScanRunRequest, dict] = None, + request: Optional[Union[web_security_scanner.StopScanRunRequest, dict]] = None, *, - name: str = None, + name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> scan_run.ScanRun: r"""Stops a ScanRun. The stopped ScanRun is returned. @@ -1194,7 +1214,7 @@ async def sample_stop_scan_run(): print(response) Args: - request (Union[google.cloud.websecurityscanner_v1alpha.types.StopScanRunRequest, dict]): + request (Optional[Union[google.cloud.websecurityscanner_v1alpha.types.StopScanRunRequest, dict]]): The request object. Request for the `StopScanRun` method. name (:class:`str`): @@ -1262,11 +1282,13 @@ async def sample_stop_scan_run(): async def list_crawled_urls( self, - request: Union[web_security_scanner.ListCrawledUrlsRequest, dict] = None, + request: Optional[ + Union[web_security_scanner.ListCrawledUrlsRequest, dict] + ] = None, *, - parent: str = None, + parent: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> pagers.ListCrawledUrlsAsyncPager: r"""List CrawledUrls under a given ScanRun. @@ -1299,7 +1321,7 @@ async def sample_list_crawled_urls(): print(response) Args: - request (Union[google.cloud.websecurityscanner_v1alpha.types.ListCrawledUrlsRequest, dict]): + request (Optional[Union[google.cloud.websecurityscanner_v1alpha.types.ListCrawledUrlsRequest, dict]]): The request object. Request for the `ListCrawledUrls` method. parent (:class:`str`): @@ -1388,11 +1410,11 @@ async def sample_list_crawled_urls(): async def get_finding( self, - request: Union[web_security_scanner.GetFindingRequest, dict] = None, + request: Optional[Union[web_security_scanner.GetFindingRequest, dict]] = None, *, - name: str = None, + name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> finding.Finding: r"""Gets a Finding. @@ -1424,7 +1446,7 @@ async def sample_get_finding(): print(response) Args: - request (Union[google.cloud.websecurityscanner_v1alpha.types.GetFindingRequest, dict]): + request (Optional[Union[google.cloud.websecurityscanner_v1alpha.types.GetFindingRequest, dict]]): The request object. Request for the `GetFinding` method. name (:class:`str`): Required. The resource name of the @@ -1502,12 +1524,12 @@ async def sample_get_finding(): async def list_findings( self, - request: Union[web_security_scanner.ListFindingsRequest, dict] = None, + request: Optional[Union[web_security_scanner.ListFindingsRequest, dict]] = None, *, - parent: str = None, - filter: str = None, + parent: Optional[str] = None, + filter: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> pagers.ListFindingsAsyncPager: r"""List Findings under a given ScanRun. @@ -1541,7 +1563,7 @@ async def sample_list_findings(): print(response) Args: - request (Union[google.cloud.websecurityscanner_v1alpha.types.ListFindingsRequest, dict]): + request (Optional[Union[google.cloud.websecurityscanner_v1alpha.types.ListFindingsRequest, dict]]): The request object. Request for the `ListFindings` method. parent (:class:`str`): @@ -1640,11 +1662,13 @@ async def sample_list_findings(): async def list_finding_type_stats( self, - request: Union[web_security_scanner.ListFindingTypeStatsRequest, dict] = None, + request: Optional[ + Union[web_security_scanner.ListFindingTypeStatsRequest, dict] + ] = None, *, - parent: str = None, + parent: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> web_security_scanner.ListFindingTypeStatsResponse: r"""List all FindingTypeStats under a given ScanRun. @@ -1676,7 +1700,7 @@ async def sample_list_finding_type_stats(): print(response) Args: - request (Union[google.cloud.websecurityscanner_v1alpha.types.ListFindingTypeStatsRequest, dict]): + request (Optional[Union[google.cloud.websecurityscanner_v1alpha.types.ListFindingTypeStatsRequest, dict]]): The request object. Request for the `ListFindingTypeStats` method. parent (:class:`str`): diff --git a/packages/google-cloud-websecurityscanner/google/cloud/websecurityscanner_v1alpha/services/web_security_scanner/client.py b/packages/google-cloud-websecurityscanner/google/cloud/websecurityscanner_v1alpha/services/web_security_scanner/client.py index e9d8c429c49f..25b14e242ae3 100644 --- a/packages/google-cloud-websecurityscanner/google/cloud/websecurityscanner_v1alpha/services/web_security_scanner/client.py +++ b/packages/google-cloud-websecurityscanner/google/cloud/websecurityscanner_v1alpha/services/web_security_scanner/client.py @@ -16,7 +16,18 @@ from collections import OrderedDict import os import re -from typing import Dict, Mapping, Optional, Sequence, Tuple, Type, Union +from typing import ( + Dict, + Mapping, + MutableMapping, + MutableSequence, + Optional, + Sequence, + Tuple, + Type, + Union, + cast, +) from google.api_core import client_options as client_options_lib from google.api_core import exceptions as core_exceptions @@ -69,7 +80,7 @@ class WebSecurityScannerClientMeta(type): def get_transport_class( cls, - label: str = None, + label: Optional[str] = None, ) -> Type[WebSecurityScannerTransport]: """Returns an appropriate transport class. @@ -393,8 +404,8 @@ def __init__( self, *, credentials: Optional[ga_credentials.Credentials] = None, - transport: Union[str, WebSecurityScannerTransport, None] = None, - client_options: Optional[client_options_lib.ClientOptions] = None, + transport: Optional[Union[str, WebSecurityScannerTransport]] = None, + client_options: Optional[Union[client_options_lib.ClientOptions, dict]] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, ) -> None: """Instantiates the web security scanner client. @@ -408,7 +419,7 @@ def __init__( transport (Union[str, WebSecurityScannerTransport]): 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 (Optional[Union[google.api_core.client_options.ClientOptions, dict]]): 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 @@ -438,6 +449,7 @@ def __init__( client_options = client_options_lib.from_dict(client_options) if client_options is None: client_options = client_options_lib.ClientOptions() + client_options = cast(client_options_lib.ClientOptions, client_options) api_endpoint, client_cert_source_func = self.get_mtls_endpoint_and_cert_source( client_options @@ -490,12 +502,14 @@ def __init__( def create_scan_config( self, - request: Union[web_security_scanner.CreateScanConfigRequest, dict] = None, + request: Optional[ + Union[web_security_scanner.CreateScanConfigRequest, dict] + ] = None, *, - parent: str = None, - scan_config: gcw_scan_config.ScanConfig = None, + parent: Optional[str] = None, + scan_config: Optional[gcw_scan_config.ScanConfig] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> gcw_scan_config.ScanConfig: r"""Creates a new ScanConfig. @@ -610,11 +624,13 @@ def sample_create_scan_config(): def delete_scan_config( self, - request: Union[web_security_scanner.DeleteScanConfigRequest, dict] = None, + request: Optional[ + Union[web_security_scanner.DeleteScanConfigRequest, dict] + ] = None, *, - name: str = None, + name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> None: r"""Deletes an existing ScanConfig and its child @@ -703,11 +719,13 @@ def sample_delete_scan_config(): def get_scan_config( self, - request: Union[web_security_scanner.GetScanConfigRequest, dict] = None, + request: Optional[ + Union[web_security_scanner.GetScanConfigRequest, dict] + ] = None, *, - name: str = None, + name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> scan_config.ScanConfig: r"""Gets a ScanConfig. @@ -808,11 +826,13 @@ def sample_get_scan_config(): def list_scan_configs( self, - request: Union[web_security_scanner.ListScanConfigsRequest, dict] = None, + request: Optional[ + Union[web_security_scanner.ListScanConfigsRequest, dict] + ] = None, *, - parent: str = None, + parent: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> pagers.ListScanConfigsPager: r"""Lists ScanConfigs under a given project. @@ -923,12 +943,14 @@ def sample_list_scan_configs(): def update_scan_config( self, - request: Union[web_security_scanner.UpdateScanConfigRequest, dict] = None, + request: Optional[ + Union[web_security_scanner.UpdateScanConfigRequest, dict] + ] = None, *, - scan_config: gcw_scan_config.ScanConfig = None, - update_mask: field_mask_pb2.FieldMask = None, + scan_config: Optional[gcw_scan_config.ScanConfig] = None, + update_mask: Optional[field_mask_pb2.FieldMask] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> gcw_scan_config.ScanConfig: r"""Updates a ScanConfig. This method support partial @@ -1047,11 +1069,11 @@ def sample_update_scan_config(): def start_scan_run( self, - request: Union[web_security_scanner.StartScanRunRequest, dict] = None, + request: Optional[Union[web_security_scanner.StartScanRunRequest, dict]] = None, *, - name: str = None, + name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> scan_run.ScanRun: r"""Start a ScanRun according to the given ScanConfig. @@ -1151,11 +1173,11 @@ def sample_start_scan_run(): def get_scan_run( self, - request: Union[web_security_scanner.GetScanRunRequest, dict] = None, + request: Optional[Union[web_security_scanner.GetScanRunRequest, dict]] = None, *, - name: str = None, + name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> scan_run.ScanRun: r"""Gets a ScanRun. @@ -1254,11 +1276,11 @@ def sample_get_scan_run(): def list_scan_runs( self, - request: Union[web_security_scanner.ListScanRunsRequest, dict] = None, + request: Optional[Union[web_security_scanner.ListScanRunsRequest, dict]] = None, *, - parent: str = None, + parent: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> pagers.ListScanRunsPager: r"""Lists ScanRuns under a given ScanConfig, in @@ -1371,11 +1393,11 @@ def sample_list_scan_runs(): def stop_scan_run( self, - request: Union[web_security_scanner.StopScanRunRequest, dict] = None, + request: Optional[Union[web_security_scanner.StopScanRunRequest, dict]] = None, *, - name: str = None, + name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> scan_run.ScanRun: r"""Stops a ScanRun. The stopped ScanRun is returned. @@ -1475,11 +1497,13 @@ def sample_stop_scan_run(): def list_crawled_urls( self, - request: Union[web_security_scanner.ListCrawledUrlsRequest, dict] = None, + request: Optional[ + Union[web_security_scanner.ListCrawledUrlsRequest, dict] + ] = None, *, - parent: str = None, + parent: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> pagers.ListCrawledUrlsPager: r"""List CrawledUrls under a given ScanRun. @@ -1591,11 +1615,11 @@ def sample_list_crawled_urls(): def get_finding( self, - request: Union[web_security_scanner.GetFindingRequest, dict] = None, + request: Optional[Union[web_security_scanner.GetFindingRequest, dict]] = None, *, - name: str = None, + name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> finding.Finding: r"""Gets a Finding. @@ -1695,12 +1719,12 @@ def sample_get_finding(): def list_findings( self, - request: Union[web_security_scanner.ListFindingsRequest, dict] = None, + request: Optional[Union[web_security_scanner.ListFindingsRequest, dict]] = None, *, - parent: str = None, - filter: str = None, + parent: Optional[str] = None, + filter: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> pagers.ListFindingsPager: r"""List Findings under a given ScanRun. @@ -1823,11 +1847,13 @@ def sample_list_findings(): def list_finding_type_stats( self, - request: Union[web_security_scanner.ListFindingTypeStatsRequest, dict] = None, + request: Optional[ + Union[web_security_scanner.ListFindingTypeStatsRequest, dict] + ] = None, *, - parent: str = None, + parent: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> web_security_scanner.ListFindingTypeStatsResponse: r"""List all FindingTypeStats under a given ScanRun. diff --git a/packages/google-cloud-websecurityscanner/google/cloud/websecurityscanner_v1alpha/services/web_security_scanner/transports/base.py b/packages/google-cloud-websecurityscanner/google/cloud/websecurityscanner_v1alpha/services/web_security_scanner/transports/base.py index bce3259623da..681c007580a5 100644 --- a/packages/google-cloud-websecurityscanner/google/cloud/websecurityscanner_v1alpha/services/web_security_scanner/transports/base.py +++ b/packages/google-cloud-websecurityscanner/google/cloud/websecurityscanner_v1alpha/services/web_security_scanner/transports/base.py @@ -52,7 +52,7 @@ def __init__( self, *, host: str = DEFAULT_HOST, - credentials: ga_credentials.Credentials = None, + credentials: Optional[ga_credentials.Credentials] = None, credentials_file: Optional[str] = None, scopes: Optional[Sequence[str]] = None, quota_project_id: Optional[str] = None, diff --git a/packages/google-cloud-websecurityscanner/google/cloud/websecurityscanner_v1alpha/services/web_security_scanner/transports/grpc.py b/packages/google-cloud-websecurityscanner/google/cloud/websecurityscanner_v1alpha/services/web_security_scanner/transports/grpc.py index 1e618296c4e6..7c860985328b 100644 --- a/packages/google-cloud-websecurityscanner/google/cloud/websecurityscanner_v1alpha/services/web_security_scanner/transports/grpc.py +++ b/packages/google-cloud-websecurityscanner/google/cloud/websecurityscanner_v1alpha/services/web_security_scanner/transports/grpc.py @@ -53,14 +53,14 @@ def __init__( self, *, host: str = "websecurityscanner.googleapis.com", - credentials: ga_credentials.Credentials = None, - credentials_file: str = None, - scopes: Sequence[str] = None, - channel: grpc.Channel = None, - api_mtls_endpoint: str = None, - client_cert_source: Callable[[], Tuple[bytes, bytes]] = None, - ssl_channel_credentials: grpc.ChannelCredentials = None, - client_cert_source_for_mtls: Callable[[], Tuple[bytes, bytes]] = None, + credentials: Optional[ga_credentials.Credentials] = None, + credentials_file: Optional[str] = None, + scopes: Optional[Sequence[str]] = None, + channel: Optional[grpc.Channel] = None, + api_mtls_endpoint: Optional[str] = None, + client_cert_source: Optional[Callable[[], Tuple[bytes, bytes]]] = None, + ssl_channel_credentials: Optional[grpc.ChannelCredentials] = None, + client_cert_source_for_mtls: Optional[Callable[[], Tuple[bytes, bytes]]] = None, quota_project_id: Optional[str] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, always_use_jwt_access: Optional[bool] = False, @@ -187,8 +187,8 @@ def __init__( def create_channel( cls, host: str = "websecurityscanner.googleapis.com", - credentials: ga_credentials.Credentials = None, - credentials_file: str = None, + credentials: Optional[ga_credentials.Credentials] = None, + credentials_file: Optional[str] = None, scopes: Optional[Sequence[str]] = None, quota_project_id: Optional[str] = None, **kwargs, diff --git a/packages/google-cloud-websecurityscanner/google/cloud/websecurityscanner_v1alpha/services/web_security_scanner/transports/grpc_asyncio.py b/packages/google-cloud-websecurityscanner/google/cloud/websecurityscanner_v1alpha/services/web_security_scanner/transports/grpc_asyncio.py index 46b9bb8c7587..e47e09d4ed94 100644 --- a/packages/google-cloud-websecurityscanner/google/cloud/websecurityscanner_v1alpha/services/web_security_scanner/transports/grpc_asyncio.py +++ b/packages/google-cloud-websecurityscanner/google/cloud/websecurityscanner_v1alpha/services/web_security_scanner/transports/grpc_asyncio.py @@ -55,7 +55,7 @@ class WebSecurityScannerGrpcAsyncIOTransport(WebSecurityScannerTransport): def create_channel( cls, host: str = "websecurityscanner.googleapis.com", - credentials: ga_credentials.Credentials = None, + credentials: Optional[ga_credentials.Credentials] = None, credentials_file: Optional[str] = None, scopes: Optional[Sequence[str]] = None, quota_project_id: Optional[str] = None, @@ -98,15 +98,15 @@ def __init__( self, *, host: str = "websecurityscanner.googleapis.com", - credentials: ga_credentials.Credentials = None, + credentials: Optional[ga_credentials.Credentials] = None, credentials_file: Optional[str] = None, scopes: Optional[Sequence[str]] = None, - channel: aio.Channel = None, - api_mtls_endpoint: str = None, - client_cert_source: Callable[[], Tuple[bytes, bytes]] = None, - ssl_channel_credentials: grpc.ChannelCredentials = None, - client_cert_source_for_mtls: Callable[[], Tuple[bytes, bytes]] = None, - quota_project_id=None, + channel: Optional[aio.Channel] = None, + api_mtls_endpoint: Optional[str] = None, + client_cert_source: Optional[Callable[[], Tuple[bytes, bytes]]] = None, + ssl_channel_credentials: Optional[grpc.ChannelCredentials] = None, + client_cert_source_for_mtls: Optional[Callable[[], Tuple[bytes, bytes]]] = None, + quota_project_id: Optional[str] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, always_use_jwt_access: Optional[bool] = False, api_audience: Optional[str] = None, diff --git a/packages/google-cloud-websecurityscanner/google/cloud/websecurityscanner_v1alpha/types/crawled_url.py b/packages/google-cloud-websecurityscanner/google/cloud/websecurityscanner_v1alpha/types/crawled_url.py index 796e94fa7868..adaef1146014 100644 --- a/packages/google-cloud-websecurityscanner/google/cloud/websecurityscanner_v1alpha/types/crawled_url.py +++ b/packages/google-cloud-websecurityscanner/google/cloud/websecurityscanner_v1alpha/types/crawled_url.py @@ -13,6 +13,8 @@ # See the License for the specific language governing permissions and # limitations under the License. # +from typing import MutableMapping, MutableSequence + import proto # type: ignore __protobuf__ = proto.module( @@ -40,15 +42,15 @@ class CrawledUrl(proto.Message): used to visit the URL. """ - http_method = proto.Field( + http_method: str = proto.Field( proto.STRING, number=1, ) - url = proto.Field( + url: str = proto.Field( proto.STRING, number=2, ) - body = proto.Field( + body: str = proto.Field( proto.STRING, number=3, ) diff --git a/packages/google-cloud-websecurityscanner/google/cloud/websecurityscanner_v1alpha/types/finding.py b/packages/google-cloud-websecurityscanner/google/cloud/websecurityscanner_v1alpha/types/finding.py index d8d9f172e0f0..b595ec8daeeb 100644 --- a/packages/google-cloud-websecurityscanner/google/cloud/websecurityscanner_v1alpha/types/finding.py +++ b/packages/google-cloud-websecurityscanner/google/cloud/websecurityscanner_v1alpha/types/finding.py @@ -13,6 +13,8 @@ # See the License for the specific language governing permissions and # limitations under the License. # +from typing import MutableMapping, MutableSequence + import proto # type: ignore from google.cloud.websecurityscanner_v1alpha.types import finding_addon @@ -97,68 +99,68 @@ class FindingType(proto.Enum): MISSPELLED_SECURITY_HEADER_NAME = 10 MISMATCHING_SECURITY_HEADER_VALUES = 11 - name = proto.Field( + name: str = proto.Field( proto.STRING, number=1, ) - finding_type = proto.Field( + finding_type: FindingType = proto.Field( proto.ENUM, number=2, enum=FindingType, ) - http_method = proto.Field( + http_method: str = proto.Field( proto.STRING, number=3, ) - fuzzed_url = proto.Field( + fuzzed_url: str = proto.Field( proto.STRING, number=4, ) - body = proto.Field( + body: str = proto.Field( proto.STRING, number=5, ) - description = proto.Field( + description: str = proto.Field( proto.STRING, number=6, ) - reproduction_url = proto.Field( + reproduction_url: str = proto.Field( proto.STRING, number=7, ) - frame_url = proto.Field( + frame_url: str = proto.Field( proto.STRING, number=8, ) - final_url = proto.Field( + final_url: str = proto.Field( proto.STRING, number=9, ) - tracking_id = proto.Field( + tracking_id: str = proto.Field( proto.STRING, number=10, ) - outdated_library = proto.Field( + outdated_library: finding_addon.OutdatedLibrary = proto.Field( proto.MESSAGE, number=11, message=finding_addon.OutdatedLibrary, ) - violating_resource = proto.Field( + violating_resource: finding_addon.ViolatingResource = proto.Field( proto.MESSAGE, number=12, message=finding_addon.ViolatingResource, ) - vulnerable_headers = proto.Field( + vulnerable_headers: finding_addon.VulnerableHeaders = proto.Field( proto.MESSAGE, number=15, message=finding_addon.VulnerableHeaders, ) - vulnerable_parameters = proto.Field( + vulnerable_parameters: finding_addon.VulnerableParameters = proto.Field( proto.MESSAGE, number=13, message=finding_addon.VulnerableParameters, ) - xss = proto.Field( + xss: finding_addon.Xss = proto.Field( proto.MESSAGE, number=14, message=finding_addon.Xss, diff --git a/packages/google-cloud-websecurityscanner/google/cloud/websecurityscanner_v1alpha/types/finding_addon.py b/packages/google-cloud-websecurityscanner/google/cloud/websecurityscanner_v1alpha/types/finding_addon.py index def1cfed233f..5925e70b7773 100644 --- a/packages/google-cloud-websecurityscanner/google/cloud/websecurityscanner_v1alpha/types/finding_addon.py +++ b/packages/google-cloud-websecurityscanner/google/cloud/websecurityscanner_v1alpha/types/finding_addon.py @@ -13,6 +13,8 @@ # See the License for the specific language governing permissions and # limitations under the License. # +from typing import MutableMapping, MutableSequence + import proto # type: ignore __protobuf__ = proto.module( @@ -35,20 +37,20 @@ class OutdatedLibrary(proto.Message): The name of the outdated library. version (str): The version number. - learn_more_urls (Sequence[str]): + learn_more_urls (MutableSequence[str]): URLs to learn more information about the vulnerabilities in the library. """ - library_name = proto.Field( + library_name: str = proto.Field( proto.STRING, number=1, ) - version = proto.Field( + version: str = proto.Field( proto.STRING, number=2, ) - learn_more_urls = proto.RepeatedField( + learn_more_urls: MutableSequence[str] = proto.RepeatedField( proto.STRING, number=3, ) @@ -65,11 +67,11 @@ class ViolatingResource(proto.Message): URL of this violating resource. """ - content_type = proto.Field( + content_type: str = proto.Field( proto.STRING, number=1, ) - resource_url = proto.Field( + resource_url: str = proto.Field( proto.STRING, number=2, ) @@ -79,11 +81,11 @@ class VulnerableParameters(proto.Message): r"""Information about vulnerable request parameters. Attributes: - parameter_names (Sequence[str]): + parameter_names (MutableSequence[str]): The vulnerable parameter names. """ - parameter_names = proto.RepeatedField( + parameter_names: MutableSequence[str] = proto.RepeatedField( proto.STRING, number=1, ) @@ -93,9 +95,9 @@ class VulnerableHeaders(proto.Message): r"""Information about vulnerable or missing HTTP Headers. Attributes: - headers (Sequence[google.cloud.websecurityscanner_v1alpha.types.VulnerableHeaders.Header]): + headers (MutableSequence[google.cloud.websecurityscanner_v1alpha.types.VulnerableHeaders.Header]): List of vulnerable headers. - missing_headers (Sequence[google.cloud.websecurityscanner_v1alpha.types.VulnerableHeaders.Header]): + missing_headers (MutableSequence[google.cloud.websecurityscanner_v1alpha.types.VulnerableHeaders.Header]): List of missing headers. """ @@ -109,21 +111,21 @@ class Header(proto.Message): Header value. """ - name = proto.Field( + name: str = proto.Field( proto.STRING, number=1, ) - value = proto.Field( + value: str = proto.Field( proto.STRING, number=2, ) - headers = proto.RepeatedField( + headers: MutableSequence[Header] = proto.RepeatedField( proto.MESSAGE, number=1, message=Header, ) - missing_headers = proto.RepeatedField( + missing_headers: MutableSequence[Header] = proto.RepeatedField( proto.MESSAGE, number=2, message=Header, @@ -134,7 +136,7 @@ class Xss(proto.Message): r"""Information reported for an XSS. Attributes: - stack_traces (Sequence[str]): + stack_traces (MutableSequence[str]): Stack traces leading to the point where the XSS occurred. error_message (str): @@ -142,11 +144,11 @@ class Xss(proto.Message): breakage. """ - stack_traces = proto.RepeatedField( + stack_traces: MutableSequence[str] = proto.RepeatedField( proto.STRING, number=1, ) - error_message = proto.Field( + error_message: str = proto.Field( proto.STRING, number=2, ) diff --git a/packages/google-cloud-websecurityscanner/google/cloud/websecurityscanner_v1alpha/types/finding_type_stats.py b/packages/google-cloud-websecurityscanner/google/cloud/websecurityscanner_v1alpha/types/finding_type_stats.py index 2269cf9445e6..f0c1be2497bf 100644 --- a/packages/google-cloud-websecurityscanner/google/cloud/websecurityscanner_v1alpha/types/finding_type_stats.py +++ b/packages/google-cloud-websecurityscanner/google/cloud/websecurityscanner_v1alpha/types/finding_type_stats.py @@ -13,6 +13,8 @@ # See the License for the specific language governing permissions and # limitations under the License. # +from typing import MutableMapping, MutableSequence + import proto # type: ignore from google.cloud.websecurityscanner_v1alpha.types import finding @@ -37,12 +39,12 @@ class FindingTypeStats(proto.Message): finding type. """ - finding_type = proto.Field( + finding_type: finding.Finding.FindingType = proto.Field( proto.ENUM, number=1, enum=finding.Finding.FindingType, ) - finding_count = proto.Field( + finding_count: int = proto.Field( proto.INT32, number=2, ) diff --git a/packages/google-cloud-websecurityscanner/google/cloud/websecurityscanner_v1alpha/types/scan_config.py b/packages/google-cloud-websecurityscanner/google/cloud/websecurityscanner_v1alpha/types/scan_config.py index 9fe046646b4a..4aaa6e49d929 100644 --- a/packages/google-cloud-websecurityscanner/google/cloud/websecurityscanner_v1alpha/types/scan_config.py +++ b/packages/google-cloud-websecurityscanner/google/cloud/websecurityscanner_v1alpha/types/scan_config.py @@ -13,6 +13,8 @@ # See the License for the specific language governing permissions and # limitations under the License. # +from typing import MutableMapping, MutableSequence + from google.protobuf import timestamp_pb2 # type: ignore import proto # type: ignore @@ -44,7 +46,7 @@ class ScanConfig(proto.Message): to 20 inclusively. If the field is unspecified or its value is set 0, server will default to 15. Other values outside of [5, 20] range will be rejected with INVALID_ARGUMENT error. - starting_urls (Sequence[str]): + starting_urls (MutableSequence[str]): Required. The starting URLs from which the scanner finds site pages. authentication (google.cloud.websecurityscanner_v1alpha.types.ScanConfig.Authentication): @@ -53,12 +55,12 @@ class ScanConfig(proto.Message): configuration during scanning. user_agent (google.cloud.websecurityscanner_v1alpha.types.ScanConfig.UserAgent): The user agent used during scanning. - blacklist_patterns (Sequence[str]): + blacklist_patterns (MutableSequence[str]): The blacklist URL patterns as described in https://cloud.google.com/security-scanner/docs/excluded-urls schedule (google.cloud.websecurityscanner_v1alpha.types.ScanConfig.Schedule): The schedule of the ScanConfig. - target_platforms (Sequence[google.cloud.websecurityscanner_v1alpha.types.ScanConfig.TargetPlatform]): + target_platforms (MutableSequence[google.cloud.websecurityscanner_v1alpha.types.ScanConfig.TargetPlatform]): Set of Cloud Platforms targeted by the scan. If empty, APP_ENGINE will be used as a default. latest_run (google.cloud.websecurityscanner_v1alpha.types.ScanRun): @@ -114,11 +116,11 @@ class GoogleAccount(proto.Message): included in audit logs. """ - username = proto.Field( + username: str = proto.Field( proto.STRING, number=1, ) - password = proto.Field( + password: str = proto.Field( proto.STRING, number=2, ) @@ -140,26 +142,26 @@ class CustomAccount(proto.Message): Required. The login form URL of the website. """ - username = proto.Field( + username: str = proto.Field( proto.STRING, number=1, ) - password = proto.Field( + password: str = proto.Field( proto.STRING, number=2, ) - login_url = proto.Field( + login_url: str = proto.Field( proto.STRING, number=3, ) - google_account = proto.Field( + google_account: "ScanConfig.Authentication.GoogleAccount" = proto.Field( proto.MESSAGE, number=1, oneof="authentication", message="ScanConfig.Authentication.GoogleAccount", ) - custom_account = proto.Field( + custom_account: "ScanConfig.Authentication.CustomAccount" = proto.Field( proto.MESSAGE, number=2, oneof="authentication", @@ -181,57 +183,57 @@ class Schedule(proto.Message): executions in days. """ - schedule_time = proto.Field( + schedule_time: timestamp_pb2.Timestamp = proto.Field( proto.MESSAGE, number=1, message=timestamp_pb2.Timestamp, ) - interval_duration_days = proto.Field( + interval_duration_days: int = proto.Field( proto.INT32, number=2, ) - name = proto.Field( + name: str = proto.Field( proto.STRING, number=1, ) - display_name = proto.Field( + display_name: str = proto.Field( proto.STRING, number=2, ) - max_qps = proto.Field( + max_qps: int = proto.Field( proto.INT32, number=3, ) - starting_urls = proto.RepeatedField( + starting_urls: MutableSequence[str] = proto.RepeatedField( proto.STRING, number=4, ) - authentication = proto.Field( + authentication: Authentication = proto.Field( proto.MESSAGE, number=5, message=Authentication, ) - user_agent = proto.Field( + user_agent: UserAgent = proto.Field( proto.ENUM, number=6, enum=UserAgent, ) - blacklist_patterns = proto.RepeatedField( + blacklist_patterns: MutableSequence[str] = proto.RepeatedField( proto.STRING, number=7, ) - schedule = proto.Field( + schedule: Schedule = proto.Field( proto.MESSAGE, number=8, message=Schedule, ) - target_platforms = proto.RepeatedField( + target_platforms: MutableSequence[TargetPlatform] = proto.RepeatedField( proto.ENUM, number=9, enum=TargetPlatform, ) - latest_run = proto.Field( + latest_run: scan_run.ScanRun = proto.Field( proto.MESSAGE, number=11, message=scan_run.ScanRun, diff --git a/packages/google-cloud-websecurityscanner/google/cloud/websecurityscanner_v1alpha/types/scan_run.py b/packages/google-cloud-websecurityscanner/google/cloud/websecurityscanner_v1alpha/types/scan_run.py index 6332e29093f8..36ed77bfd7c3 100644 --- a/packages/google-cloud-websecurityscanner/google/cloud/websecurityscanner_v1alpha/types/scan_run.py +++ b/packages/google-cloud-websecurityscanner/google/cloud/websecurityscanner_v1alpha/types/scan_run.py @@ -13,6 +13,8 @@ # See the License for the specific language governing permissions and # limitations under the License. # +from typing import MutableMapping, MutableSequence + from google.protobuf import timestamp_pb2 # type: ignore import proto # type: ignore @@ -83,43 +85,43 @@ class ResultState(proto.Enum): ERROR = 2 KILLED = 3 - name = proto.Field( + name: str = proto.Field( proto.STRING, number=1, ) - execution_state = proto.Field( + execution_state: ExecutionState = proto.Field( proto.ENUM, number=2, enum=ExecutionState, ) - result_state = proto.Field( + result_state: ResultState = proto.Field( proto.ENUM, number=3, enum=ResultState, ) - start_time = proto.Field( + start_time: timestamp_pb2.Timestamp = proto.Field( proto.MESSAGE, number=4, message=timestamp_pb2.Timestamp, ) - end_time = proto.Field( + end_time: timestamp_pb2.Timestamp = proto.Field( proto.MESSAGE, number=5, message=timestamp_pb2.Timestamp, ) - urls_crawled_count = proto.Field( + urls_crawled_count: int = proto.Field( proto.INT64, number=6, ) - urls_tested_count = proto.Field( + urls_tested_count: int = proto.Field( proto.INT64, number=7, ) - has_vulnerabilities = proto.Field( + has_vulnerabilities: bool = proto.Field( proto.BOOL, number=8, ) - progress_percent = proto.Field( + progress_percent: int = proto.Field( proto.INT32, number=9, ) diff --git a/packages/google-cloud-websecurityscanner/google/cloud/websecurityscanner_v1alpha/types/web_security_scanner.py b/packages/google-cloud-websecurityscanner/google/cloud/websecurityscanner_v1alpha/types/web_security_scanner.py index 83c93e9e4fc9..c5cb8bbf5c8b 100644 --- a/packages/google-cloud-websecurityscanner/google/cloud/websecurityscanner_v1alpha/types/web_security_scanner.py +++ b/packages/google-cloud-websecurityscanner/google/cloud/websecurityscanner_v1alpha/types/web_security_scanner.py @@ -13,6 +13,8 @@ # See the License for the specific language governing permissions and # limitations under the License. # +from typing import MutableMapping, MutableSequence + from google.protobuf import field_mask_pb2 # type: ignore import proto # type: ignore @@ -61,11 +63,11 @@ class CreateScanConfigRequest(proto.Message): Required. The ScanConfig to be created. """ - parent = proto.Field( + parent: str = proto.Field( proto.STRING, number=1, ) - scan_config = proto.Field( + scan_config: gcw_scan_config.ScanConfig = proto.Field( proto.MESSAGE, number=2, message=gcw_scan_config.ScanConfig, @@ -82,7 +84,7 @@ class DeleteScanConfigRequest(proto.Message): 'projects/{projectId}/scanConfigs/{scanConfigId}'. """ - name = proto.Field( + name: str = proto.Field( proto.STRING, number=1, ) @@ -98,7 +100,7 @@ class GetScanConfigRequest(proto.Message): 'projects/{projectId}/scanConfigs/{scanConfigId}'. """ - name = proto.Field( + name: str = proto.Field( proto.STRING, number=1, ) @@ -124,15 +126,15 @@ class ListScanConfigsRequest(proto.Message): reasonable value. """ - parent = proto.Field( + parent: str = proto.Field( proto.STRING, number=1, ) - page_token = proto.Field( + page_token: str = proto.Field( proto.STRING, number=2, ) - page_size = proto.Field( + page_size: int = proto.Field( proto.INT32, number=3, ) @@ -153,12 +155,12 @@ class UpdateScanConfigRequest(proto.Message): https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#fieldmask """ - scan_config = proto.Field( + scan_config: gcw_scan_config.ScanConfig = proto.Field( proto.MESSAGE, number=2, message=gcw_scan_config.ScanConfig, ) - update_mask = proto.Field( + update_mask: field_mask_pb2.FieldMask = proto.Field( proto.MESSAGE, number=3, message=field_mask_pb2.FieldMask, @@ -169,7 +171,7 @@ class ListScanConfigsResponse(proto.Message): r"""Response for the ``ListScanConfigs`` method. Attributes: - scan_configs (Sequence[google.cloud.websecurityscanner_v1alpha.types.ScanConfig]): + scan_configs (MutableSequence[google.cloud.websecurityscanner_v1alpha.types.ScanConfig]): The list of ScanConfigs returned. next_page_token (str): Token to retrieve the next page of results, @@ -181,12 +183,12 @@ class ListScanConfigsResponse(proto.Message): def raw_page(self): return self - scan_configs = proto.RepeatedField( + scan_configs: MutableSequence[gcw_scan_config.ScanConfig] = proto.RepeatedField( proto.MESSAGE, number=1, message=gcw_scan_config.ScanConfig, ) - next_page_token = proto.Field( + next_page_token: str = proto.Field( proto.STRING, number=2, ) @@ -202,7 +204,7 @@ class StartScanRunRequest(proto.Message): 'projects/{projectId}/scanConfigs/{scanConfigId}'. """ - name = proto.Field( + name: str = proto.Field( proto.STRING, number=1, ) @@ -218,7 +220,7 @@ class GetScanRunRequest(proto.Message): 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. """ - name = proto.Field( + name: str = proto.Field( proto.STRING, number=1, ) @@ -244,15 +246,15 @@ class ListScanRunsRequest(proto.Message): reasonable value. """ - parent = proto.Field( + parent: str = proto.Field( proto.STRING, number=1, ) - page_token = proto.Field( + page_token: str = proto.Field( proto.STRING, number=2, ) - page_size = proto.Field( + page_size: int = proto.Field( proto.INT32, number=3, ) @@ -262,7 +264,7 @@ class ListScanRunsResponse(proto.Message): r"""Response for the ``ListScanRuns`` method. Attributes: - scan_runs (Sequence[google.cloud.websecurityscanner_v1alpha.types.ScanRun]): + scan_runs (MutableSequence[google.cloud.websecurityscanner_v1alpha.types.ScanRun]): The list of ScanRuns returned. next_page_token (str): Token to retrieve the next page of results, @@ -274,12 +276,12 @@ class ListScanRunsResponse(proto.Message): def raw_page(self): return self - scan_runs = proto.RepeatedField( + scan_runs: MutableSequence[scan_run.ScanRun] = proto.RepeatedField( proto.MESSAGE, number=1, message=scan_run.ScanRun, ) - next_page_token = proto.Field( + next_page_token: str = proto.Field( proto.STRING, number=2, ) @@ -295,7 +297,7 @@ class StopScanRunRequest(proto.Message): 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. """ - name = proto.Field( + name: str = proto.Field( proto.STRING, number=1, ) @@ -321,15 +323,15 @@ class ListCrawledUrlsRequest(proto.Message): reasonable value. """ - parent = proto.Field( + parent: str = proto.Field( proto.STRING, number=1, ) - page_token = proto.Field( + page_token: str = proto.Field( proto.STRING, number=2, ) - page_size = proto.Field( + page_size: int = proto.Field( proto.INT32, number=3, ) @@ -339,7 +341,7 @@ class ListCrawledUrlsResponse(proto.Message): r"""Response for the ``ListCrawledUrls`` method. Attributes: - crawled_urls (Sequence[google.cloud.websecurityscanner_v1alpha.types.CrawledUrl]): + crawled_urls (MutableSequence[google.cloud.websecurityscanner_v1alpha.types.CrawledUrl]): The list of CrawledUrls returned. next_page_token (str): Token to retrieve the next page of results, @@ -351,12 +353,12 @@ class ListCrawledUrlsResponse(proto.Message): def raw_page(self): return self - crawled_urls = proto.RepeatedField( + crawled_urls: MutableSequence[crawled_url.CrawledUrl] = proto.RepeatedField( proto.MESSAGE, number=1, message=crawled_url.CrawledUrl, ) - next_page_token = proto.Field( + next_page_token: str = proto.Field( proto.STRING, number=2, ) @@ -372,7 +374,7 @@ class GetFindingRequest(proto.Message): 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}/findings/{findingId}'. """ - name = proto.Field( + name: str = proto.Field( proto.STRING, number=1, ) @@ -402,19 +404,19 @@ class ListFindingsRequest(proto.Message): reasonable value. """ - parent = proto.Field( + parent: str = proto.Field( proto.STRING, number=1, ) - filter = proto.Field( + filter: str = proto.Field( proto.STRING, number=2, ) - page_token = proto.Field( + page_token: str = proto.Field( proto.STRING, number=3, ) - page_size = proto.Field( + page_size: int = proto.Field( proto.INT32, number=4, ) @@ -424,7 +426,7 @@ class ListFindingsResponse(proto.Message): r"""Response for the ``ListFindings`` method. Attributes: - findings (Sequence[google.cloud.websecurityscanner_v1alpha.types.Finding]): + findings (MutableSequence[google.cloud.websecurityscanner_v1alpha.types.Finding]): The list of Findings returned. next_page_token (str): Token to retrieve the next page of results, @@ -436,12 +438,12 @@ class ListFindingsResponse(proto.Message): def raw_page(self): return self - findings = proto.RepeatedField( + findings: MutableSequence[finding.Finding] = proto.RepeatedField( proto.MESSAGE, number=1, message=finding.Finding, ) - next_page_token = proto.Field( + next_page_token: str = proto.Field( proto.STRING, number=2, ) @@ -457,7 +459,7 @@ class ListFindingTypeStatsRequest(proto.Message): 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. """ - parent = proto.Field( + parent: str = proto.Field( proto.STRING, number=1, ) @@ -467,11 +469,13 @@ class ListFindingTypeStatsResponse(proto.Message): r"""Response for the ``ListFindingTypeStats`` method. Attributes: - finding_type_stats (Sequence[google.cloud.websecurityscanner_v1alpha.types.FindingTypeStats]): + finding_type_stats (MutableSequence[google.cloud.websecurityscanner_v1alpha.types.FindingTypeStats]): The list of FindingTypeStats returned. """ - finding_type_stats = proto.RepeatedField( + finding_type_stats: MutableSequence[ + gcw_finding_type_stats.FindingTypeStats + ] = proto.RepeatedField( proto.MESSAGE, number=1, message=gcw_finding_type_stats.FindingTypeStats, diff --git a/packages/google-cloud-websecurityscanner/google/cloud/websecurityscanner_v1beta/__init__.py b/packages/google-cloud-websecurityscanner/google/cloud/websecurityscanner_v1beta/__init__.py index 9a9c316f5b77..ad3694d9670b 100644 --- a/packages/google-cloud-websecurityscanner/google/cloud/websecurityscanner_v1beta/__init__.py +++ b/packages/google-cloud-websecurityscanner/google/cloud/websecurityscanner_v1beta/__init__.py @@ -13,6 +13,10 @@ # See the License for the specific language governing permissions and # limitations under the License. # +from google.cloud.websecurityscanner import gapic_version as package_version + +__version__ = package_version.__version__ + from .services.web_security_scanner import ( WebSecurityScannerAsyncClient, diff --git a/packages/google-cloud-websecurityscanner/google/cloud/websecurityscanner_v1beta/services/web_security_scanner/async_client.py b/packages/google-cloud-websecurityscanner/google/cloud/websecurityscanner_v1beta/services/web_security_scanner/async_client.py index 27929eb8778d..0072a8b0cd71 100644 --- a/packages/google-cloud-websecurityscanner/google/cloud/websecurityscanner_v1beta/services/web_security_scanner/async_client.py +++ b/packages/google-cloud-websecurityscanner/google/cloud/websecurityscanner_v1beta/services/web_security_scanner/async_client.py @@ -16,7 +16,17 @@ from collections import OrderedDict import functools import re -from typing import Dict, Mapping, Optional, Sequence, Tuple, Type, Union +from typing import ( + Dict, + Mapping, + MutableMapping, + MutableSequence, + Optional, + Sequence, + Tuple, + Type, + Union, +) from google.api_core import exceptions as core_exceptions from google.api_core import gapic_v1 @@ -186,9 +196,9 @@ def transport(self) -> WebSecurityScannerTransport: def __init__( self, *, - credentials: ga_credentials.Credentials = None, + credentials: Optional[ga_credentials.Credentials] = None, transport: Union[str, WebSecurityScannerTransport] = "grpc_asyncio", - client_options: ClientOptions = None, + client_options: Optional[ClientOptions] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, ) -> None: """Instantiates the web security scanner client. @@ -232,12 +242,14 @@ def __init__( async def create_scan_config( self, - request: Union[web_security_scanner.CreateScanConfigRequest, dict] = None, + request: Optional[ + Union[web_security_scanner.CreateScanConfigRequest, dict] + ] = None, *, - parent: str = None, - scan_config: gcw_scan_config.ScanConfig = None, + parent: Optional[str] = None, + scan_config: Optional[gcw_scan_config.ScanConfig] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> gcw_scan_config.ScanConfig: r"""Creates a new ScanConfig. @@ -274,7 +286,7 @@ async def sample_create_scan_config(): print(response) Args: - request (Union[google.cloud.websecurityscanner_v1beta.types.CreateScanConfigRequest, dict]): + request (Optional[Union[google.cloud.websecurityscanner_v1beta.types.CreateScanConfigRequest, dict]]): The request object. Request for the `CreateScanConfig` method. parent (:class:`str`): @@ -351,11 +363,13 @@ async def sample_create_scan_config(): async def delete_scan_config( self, - request: Union[web_security_scanner.DeleteScanConfigRequest, dict] = None, + request: Optional[ + Union[web_security_scanner.DeleteScanConfigRequest, dict] + ] = None, *, - name: str = None, + name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> None: r"""Deletes an existing ScanConfig and its child @@ -385,7 +399,7 @@ async def sample_delete_scan_config(): await client.delete_scan_config(request=request) Args: - request (Union[google.cloud.websecurityscanner_v1beta.types.DeleteScanConfigRequest, dict]): + request (Optional[Union[google.cloud.websecurityscanner_v1beta.types.DeleteScanConfigRequest, dict]]): The request object. Request for the `DeleteScanConfig` method. name (:class:`str`): @@ -454,11 +468,13 @@ async def sample_delete_scan_config(): async def get_scan_config( self, - request: Union[web_security_scanner.GetScanConfigRequest, dict] = None, + request: Optional[ + Union[web_security_scanner.GetScanConfigRequest, dict] + ] = None, *, - name: str = None, + name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> scan_config.ScanConfig: r"""Gets a ScanConfig. @@ -490,7 +506,7 @@ async def sample_get_scan_config(): print(response) Args: - request (Union[google.cloud.websecurityscanner_v1beta.types.GetScanConfigRequest, dict]): + request (Optional[Union[google.cloud.websecurityscanner_v1beta.types.GetScanConfigRequest, dict]]): The request object. Request for the `GetScanConfig` method. name (:class:`str`): @@ -568,11 +584,13 @@ async def sample_get_scan_config(): async def list_scan_configs( self, - request: Union[web_security_scanner.ListScanConfigsRequest, dict] = None, + request: Optional[ + Union[web_security_scanner.ListScanConfigsRequest, dict] + ] = None, *, - parent: str = None, + parent: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> pagers.ListScanConfigsAsyncPager: r"""Lists ScanConfigs under a given project. @@ -605,7 +623,7 @@ async def sample_list_scan_configs(): print(response) Args: - request (Union[google.cloud.websecurityscanner_v1beta.types.ListScanConfigsRequest, dict]): + request (Optional[Union[google.cloud.websecurityscanner_v1beta.types.ListScanConfigsRequest, dict]]): The request object. Request for the `ListScanConfigs` method. parent (:class:`str`): @@ -693,12 +711,14 @@ async def sample_list_scan_configs(): async def update_scan_config( self, - request: Union[web_security_scanner.UpdateScanConfigRequest, dict] = None, + request: Optional[ + Union[web_security_scanner.UpdateScanConfigRequest, dict] + ] = None, *, - scan_config: gcw_scan_config.ScanConfig = None, - update_mask: field_mask_pb2.FieldMask = None, + scan_config: Optional[gcw_scan_config.ScanConfig] = None, + update_mask: Optional[field_mask_pb2.FieldMask] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> gcw_scan_config.ScanConfig: r"""Updates a ScanConfig. This method support partial @@ -735,7 +755,7 @@ async def sample_update_scan_config(): print(response) Args: - request (Union[google.cloud.websecurityscanner_v1beta.types.UpdateScanConfigRequest, dict]): + request (Optional[Union[google.cloud.websecurityscanner_v1beta.types.UpdateScanConfigRequest, dict]]): The request object. Request for the `UpdateScanConfigRequest` method. scan_config (:class:`google.cloud.websecurityscanner_v1beta.types.ScanConfig`): @@ -816,11 +836,11 @@ async def sample_update_scan_config(): async def start_scan_run( self, - request: Union[web_security_scanner.StartScanRunRequest, dict] = None, + request: Optional[Union[web_security_scanner.StartScanRunRequest, dict]] = None, *, - name: str = None, + name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> scan_run.ScanRun: r"""Start a ScanRun according to the given ScanConfig. @@ -852,7 +872,7 @@ async def sample_start_scan_run(): print(response) Args: - request (Union[google.cloud.websecurityscanner_v1beta.types.StartScanRunRequest, dict]): + request (Optional[Union[google.cloud.websecurityscanner_v1beta.types.StartScanRunRequest, dict]]): The request object. Request for the `StartScanRun` method. name (:class:`str`): @@ -921,11 +941,11 @@ async def sample_start_scan_run(): async def get_scan_run( self, - request: Union[web_security_scanner.GetScanRunRequest, dict] = None, + request: Optional[Union[web_security_scanner.GetScanRunRequest, dict]] = None, *, - name: str = None, + name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> scan_run.ScanRun: r"""Gets a ScanRun. @@ -957,7 +977,7 @@ async def sample_get_scan_run(): print(response) Args: - request (Union[google.cloud.websecurityscanner_v1beta.types.GetScanRunRequest, dict]): + request (Optional[Union[google.cloud.websecurityscanner_v1beta.types.GetScanRunRequest, dict]]): The request object. Request for the `GetScanRun` method. name (:class:`str`): Required. The resource name of the @@ -1035,11 +1055,11 @@ async def sample_get_scan_run(): async def list_scan_runs( self, - request: Union[web_security_scanner.ListScanRunsRequest, dict] = None, + request: Optional[Union[web_security_scanner.ListScanRunsRequest, dict]] = None, *, - parent: str = None, + parent: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> pagers.ListScanRunsAsyncPager: r"""Lists ScanRuns under a given ScanConfig, in @@ -1073,7 +1093,7 @@ async def sample_list_scan_runs(): print(response) Args: - request (Union[google.cloud.websecurityscanner_v1beta.types.ListScanRunsRequest, dict]): + request (Optional[Union[google.cloud.websecurityscanner_v1beta.types.ListScanRunsRequest, dict]]): The request object. Request for the `ListScanRuns` method. parent (:class:`str`): @@ -1162,11 +1182,11 @@ async def sample_list_scan_runs(): async def stop_scan_run( self, - request: Union[web_security_scanner.StopScanRunRequest, dict] = None, + request: Optional[Union[web_security_scanner.StopScanRunRequest, dict]] = None, *, - name: str = None, + name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> scan_run.ScanRun: r"""Stops a ScanRun. The stopped ScanRun is returned. @@ -1198,7 +1218,7 @@ async def sample_stop_scan_run(): print(response) Args: - request (Union[google.cloud.websecurityscanner_v1beta.types.StopScanRunRequest, dict]): + request (Optional[Union[google.cloud.websecurityscanner_v1beta.types.StopScanRunRequest, dict]]): The request object. Request for the `StopScanRun` method. name (:class:`str`): @@ -1267,11 +1287,13 @@ async def sample_stop_scan_run(): async def list_crawled_urls( self, - request: Union[web_security_scanner.ListCrawledUrlsRequest, dict] = None, + request: Optional[ + Union[web_security_scanner.ListCrawledUrlsRequest, dict] + ] = None, *, - parent: str = None, + parent: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> pagers.ListCrawledUrlsAsyncPager: r"""List CrawledUrls under a given ScanRun. @@ -1304,7 +1326,7 @@ async def sample_list_crawled_urls(): print(response) Args: - request (Union[google.cloud.websecurityscanner_v1beta.types.ListCrawledUrlsRequest, dict]): + request (Optional[Union[google.cloud.websecurityscanner_v1beta.types.ListCrawledUrlsRequest, dict]]): The request object. Request for the `ListCrawledUrls` method. parent (:class:`str`): @@ -1393,11 +1415,11 @@ async def sample_list_crawled_urls(): async def get_finding( self, - request: Union[web_security_scanner.GetFindingRequest, dict] = None, + request: Optional[Union[web_security_scanner.GetFindingRequest, dict]] = None, *, - name: str = None, + name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> finding.Finding: r"""Gets a Finding. @@ -1429,7 +1451,7 @@ async def sample_get_finding(): print(response) Args: - request (Union[google.cloud.websecurityscanner_v1beta.types.GetFindingRequest, dict]): + request (Optional[Union[google.cloud.websecurityscanner_v1beta.types.GetFindingRequest, dict]]): The request object. Request for the `GetFinding` method. name (:class:`str`): Required. The resource name of the @@ -1507,12 +1529,12 @@ async def sample_get_finding(): async def list_findings( self, - request: Union[web_security_scanner.ListFindingsRequest, dict] = None, + request: Optional[Union[web_security_scanner.ListFindingsRequest, dict]] = None, *, - parent: str = None, - filter: str = None, + parent: Optional[str] = None, + filter: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> pagers.ListFindingsAsyncPager: r"""List Findings under a given ScanRun. @@ -1546,7 +1568,7 @@ async def sample_list_findings(): print(response) Args: - request (Union[google.cloud.websecurityscanner_v1beta.types.ListFindingsRequest, dict]): + request (Optional[Union[google.cloud.websecurityscanner_v1beta.types.ListFindingsRequest, dict]]): The request object. Request for the `ListFindings` method. parent (:class:`str`): @@ -1645,11 +1667,13 @@ async def sample_list_findings(): async def list_finding_type_stats( self, - request: Union[web_security_scanner.ListFindingTypeStatsRequest, dict] = None, + request: Optional[ + Union[web_security_scanner.ListFindingTypeStatsRequest, dict] + ] = None, *, - parent: str = None, + parent: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> web_security_scanner.ListFindingTypeStatsResponse: r"""List all FindingTypeStats under a given ScanRun. @@ -1681,7 +1705,7 @@ async def sample_list_finding_type_stats(): print(response) Args: - request (Union[google.cloud.websecurityscanner_v1beta.types.ListFindingTypeStatsRequest, dict]): + request (Optional[Union[google.cloud.websecurityscanner_v1beta.types.ListFindingTypeStatsRequest, dict]]): The request object. Request for the `ListFindingTypeStats` method. parent (:class:`str`): diff --git a/packages/google-cloud-websecurityscanner/google/cloud/websecurityscanner_v1beta/services/web_security_scanner/client.py b/packages/google-cloud-websecurityscanner/google/cloud/websecurityscanner_v1beta/services/web_security_scanner/client.py index 2e30bece15b3..136a044808df 100644 --- a/packages/google-cloud-websecurityscanner/google/cloud/websecurityscanner_v1beta/services/web_security_scanner/client.py +++ b/packages/google-cloud-websecurityscanner/google/cloud/websecurityscanner_v1beta/services/web_security_scanner/client.py @@ -16,7 +16,18 @@ from collections import OrderedDict import os import re -from typing import Dict, Mapping, Optional, Sequence, Tuple, Type, Union +from typing import ( + Dict, + Mapping, + MutableMapping, + MutableSequence, + Optional, + Sequence, + Tuple, + Type, + Union, + cast, +) from google.api_core import client_options as client_options_lib from google.api_core import exceptions as core_exceptions @@ -74,7 +85,7 @@ class WebSecurityScannerClientMeta(type): def get_transport_class( cls, - label: str = None, + label: Optional[str] = None, ) -> Type[WebSecurityScannerTransport]: """Returns an appropriate transport class. @@ -398,8 +409,8 @@ def __init__( self, *, credentials: Optional[ga_credentials.Credentials] = None, - transport: Union[str, WebSecurityScannerTransport, None] = None, - client_options: Optional[client_options_lib.ClientOptions] = None, + transport: Optional[Union[str, WebSecurityScannerTransport]] = None, + client_options: Optional[Union[client_options_lib.ClientOptions, dict]] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, ) -> None: """Instantiates the web security scanner client. @@ -413,7 +424,7 @@ def __init__( transport (Union[str, WebSecurityScannerTransport]): 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 (Optional[Union[google.api_core.client_options.ClientOptions, dict]]): 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 @@ -443,6 +454,7 @@ def __init__( client_options = client_options_lib.from_dict(client_options) if client_options is None: client_options = client_options_lib.ClientOptions() + client_options = cast(client_options_lib.ClientOptions, client_options) api_endpoint, client_cert_source_func = self.get_mtls_endpoint_and_cert_source( client_options @@ -495,12 +507,14 @@ def __init__( def create_scan_config( self, - request: Union[web_security_scanner.CreateScanConfigRequest, dict] = None, + request: Optional[ + Union[web_security_scanner.CreateScanConfigRequest, dict] + ] = None, *, - parent: str = None, - scan_config: gcw_scan_config.ScanConfig = None, + parent: Optional[str] = None, + scan_config: Optional[gcw_scan_config.ScanConfig] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> gcw_scan_config.ScanConfig: r"""Creates a new ScanConfig. @@ -614,11 +628,13 @@ def sample_create_scan_config(): def delete_scan_config( self, - request: Union[web_security_scanner.DeleteScanConfigRequest, dict] = None, + request: Optional[ + Union[web_security_scanner.DeleteScanConfigRequest, dict] + ] = None, *, - name: str = None, + name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> None: r"""Deletes an existing ScanConfig and its child @@ -707,11 +723,13 @@ def sample_delete_scan_config(): def get_scan_config( self, - request: Union[web_security_scanner.GetScanConfigRequest, dict] = None, + request: Optional[ + Union[web_security_scanner.GetScanConfigRequest, dict] + ] = None, *, - name: str = None, + name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> scan_config.ScanConfig: r"""Gets a ScanConfig. @@ -811,11 +829,13 @@ def sample_get_scan_config(): def list_scan_configs( self, - request: Union[web_security_scanner.ListScanConfigsRequest, dict] = None, + request: Optional[ + Union[web_security_scanner.ListScanConfigsRequest, dict] + ] = None, *, - parent: str = None, + parent: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> pagers.ListScanConfigsPager: r"""Lists ScanConfigs under a given project. @@ -926,12 +946,14 @@ def sample_list_scan_configs(): def update_scan_config( self, - request: Union[web_security_scanner.UpdateScanConfigRequest, dict] = None, + request: Optional[ + Union[web_security_scanner.UpdateScanConfigRequest, dict] + ] = None, *, - scan_config: gcw_scan_config.ScanConfig = None, - update_mask: field_mask_pb2.FieldMask = None, + scan_config: Optional[gcw_scan_config.ScanConfig] = None, + update_mask: Optional[field_mask_pb2.FieldMask] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> gcw_scan_config.ScanConfig: r"""Updates a ScanConfig. This method support partial @@ -1049,11 +1071,11 @@ def sample_update_scan_config(): def start_scan_run( self, - request: Union[web_security_scanner.StartScanRunRequest, dict] = None, + request: Optional[Union[web_security_scanner.StartScanRunRequest, dict]] = None, *, - name: str = None, + name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> scan_run.ScanRun: r"""Start a ScanRun according to the given ScanConfig. @@ -1154,11 +1176,11 @@ def sample_start_scan_run(): def get_scan_run( self, - request: Union[web_security_scanner.GetScanRunRequest, dict] = None, + request: Optional[Union[web_security_scanner.GetScanRunRequest, dict]] = None, *, - name: str = None, + name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> scan_run.ScanRun: r"""Gets a ScanRun. @@ -1258,11 +1280,11 @@ def sample_get_scan_run(): def list_scan_runs( self, - request: Union[web_security_scanner.ListScanRunsRequest, dict] = None, + request: Optional[Union[web_security_scanner.ListScanRunsRequest, dict]] = None, *, - parent: str = None, + parent: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> pagers.ListScanRunsPager: r"""Lists ScanRuns under a given ScanConfig, in @@ -1375,11 +1397,11 @@ def sample_list_scan_runs(): def stop_scan_run( self, - request: Union[web_security_scanner.StopScanRunRequest, dict] = None, + request: Optional[Union[web_security_scanner.StopScanRunRequest, dict]] = None, *, - name: str = None, + name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> scan_run.ScanRun: r"""Stops a ScanRun. The stopped ScanRun is returned. @@ -1480,11 +1502,13 @@ def sample_stop_scan_run(): def list_crawled_urls( self, - request: Union[web_security_scanner.ListCrawledUrlsRequest, dict] = None, + request: Optional[ + Union[web_security_scanner.ListCrawledUrlsRequest, dict] + ] = None, *, - parent: str = None, + parent: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> pagers.ListCrawledUrlsPager: r"""List CrawledUrls under a given ScanRun. @@ -1596,11 +1620,11 @@ def sample_list_crawled_urls(): def get_finding( self, - request: Union[web_security_scanner.GetFindingRequest, dict] = None, + request: Optional[Union[web_security_scanner.GetFindingRequest, dict]] = None, *, - name: str = None, + name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> finding.Finding: r"""Gets a Finding. @@ -1700,12 +1724,12 @@ def sample_get_finding(): def list_findings( self, - request: Union[web_security_scanner.ListFindingsRequest, dict] = None, + request: Optional[Union[web_security_scanner.ListFindingsRequest, dict]] = None, *, - parent: str = None, - filter: str = None, + parent: Optional[str] = None, + filter: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> pagers.ListFindingsPager: r"""List Findings under a given ScanRun. @@ -1828,11 +1852,13 @@ def sample_list_findings(): def list_finding_type_stats( self, - request: Union[web_security_scanner.ListFindingTypeStatsRequest, dict] = None, + request: Optional[ + Union[web_security_scanner.ListFindingTypeStatsRequest, dict] + ] = None, *, - parent: str = None, + parent: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> web_security_scanner.ListFindingTypeStatsResponse: r"""List all FindingTypeStats under a given ScanRun. diff --git a/packages/google-cloud-websecurityscanner/google/cloud/websecurityscanner_v1beta/services/web_security_scanner/transports/base.py b/packages/google-cloud-websecurityscanner/google/cloud/websecurityscanner_v1beta/services/web_security_scanner/transports/base.py index 6ff5ec453616..fa3a15100300 100644 --- a/packages/google-cloud-websecurityscanner/google/cloud/websecurityscanner_v1beta/services/web_security_scanner/transports/base.py +++ b/packages/google-cloud-websecurityscanner/google/cloud/websecurityscanner_v1beta/services/web_security_scanner/transports/base.py @@ -52,7 +52,7 @@ def __init__( self, *, host: str = DEFAULT_HOST, - credentials: ga_credentials.Credentials = None, + credentials: Optional[ga_credentials.Credentials] = None, credentials_file: Optional[str] = None, scopes: Optional[Sequence[str]] = None, quota_project_id: Optional[str] = None, diff --git a/packages/google-cloud-websecurityscanner/google/cloud/websecurityscanner_v1beta/services/web_security_scanner/transports/grpc.py b/packages/google-cloud-websecurityscanner/google/cloud/websecurityscanner_v1beta/services/web_security_scanner/transports/grpc.py index 41a1d1adfa6f..9c55848d5c87 100644 --- a/packages/google-cloud-websecurityscanner/google/cloud/websecurityscanner_v1beta/services/web_security_scanner/transports/grpc.py +++ b/packages/google-cloud-websecurityscanner/google/cloud/websecurityscanner_v1beta/services/web_security_scanner/transports/grpc.py @@ -53,14 +53,14 @@ def __init__( self, *, host: str = "websecurityscanner.googleapis.com", - credentials: ga_credentials.Credentials = None, - credentials_file: str = None, - scopes: Sequence[str] = None, - channel: grpc.Channel = None, - api_mtls_endpoint: str = None, - client_cert_source: Callable[[], Tuple[bytes, bytes]] = None, - ssl_channel_credentials: grpc.ChannelCredentials = None, - client_cert_source_for_mtls: Callable[[], Tuple[bytes, bytes]] = None, + credentials: Optional[ga_credentials.Credentials] = None, + credentials_file: Optional[str] = None, + scopes: Optional[Sequence[str]] = None, + channel: Optional[grpc.Channel] = None, + api_mtls_endpoint: Optional[str] = None, + client_cert_source: Optional[Callable[[], Tuple[bytes, bytes]]] = None, + ssl_channel_credentials: Optional[grpc.ChannelCredentials] = None, + client_cert_source_for_mtls: Optional[Callable[[], Tuple[bytes, bytes]]] = None, quota_project_id: Optional[str] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, always_use_jwt_access: Optional[bool] = False, @@ -187,8 +187,8 @@ def __init__( def create_channel( cls, host: str = "websecurityscanner.googleapis.com", - credentials: ga_credentials.Credentials = None, - credentials_file: str = None, + credentials: Optional[ga_credentials.Credentials] = None, + credentials_file: Optional[str] = None, scopes: Optional[Sequence[str]] = None, quota_project_id: Optional[str] = None, **kwargs, diff --git a/packages/google-cloud-websecurityscanner/google/cloud/websecurityscanner_v1beta/services/web_security_scanner/transports/grpc_asyncio.py b/packages/google-cloud-websecurityscanner/google/cloud/websecurityscanner_v1beta/services/web_security_scanner/transports/grpc_asyncio.py index 380a5bfdbe06..9b3a810e9831 100644 --- a/packages/google-cloud-websecurityscanner/google/cloud/websecurityscanner_v1beta/services/web_security_scanner/transports/grpc_asyncio.py +++ b/packages/google-cloud-websecurityscanner/google/cloud/websecurityscanner_v1beta/services/web_security_scanner/transports/grpc_asyncio.py @@ -55,7 +55,7 @@ class WebSecurityScannerGrpcAsyncIOTransport(WebSecurityScannerTransport): def create_channel( cls, host: str = "websecurityscanner.googleapis.com", - credentials: ga_credentials.Credentials = None, + credentials: Optional[ga_credentials.Credentials] = None, credentials_file: Optional[str] = None, scopes: Optional[Sequence[str]] = None, quota_project_id: Optional[str] = None, @@ -98,15 +98,15 @@ def __init__( self, *, host: str = "websecurityscanner.googleapis.com", - credentials: ga_credentials.Credentials = None, + credentials: Optional[ga_credentials.Credentials] = None, credentials_file: Optional[str] = None, scopes: Optional[Sequence[str]] = None, - channel: aio.Channel = None, - api_mtls_endpoint: str = None, - client_cert_source: Callable[[], Tuple[bytes, bytes]] = None, - ssl_channel_credentials: grpc.ChannelCredentials = None, - client_cert_source_for_mtls: Callable[[], Tuple[bytes, bytes]] = None, - quota_project_id=None, + channel: Optional[aio.Channel] = None, + api_mtls_endpoint: Optional[str] = None, + client_cert_source: Optional[Callable[[], Tuple[bytes, bytes]]] = None, + ssl_channel_credentials: Optional[grpc.ChannelCredentials] = None, + client_cert_source_for_mtls: Optional[Callable[[], Tuple[bytes, bytes]]] = None, + quota_project_id: Optional[str] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, always_use_jwt_access: Optional[bool] = False, api_audience: Optional[str] = None, diff --git a/packages/google-cloud-websecurityscanner/google/cloud/websecurityscanner_v1beta/types/crawled_url.py b/packages/google-cloud-websecurityscanner/google/cloud/websecurityscanner_v1beta/types/crawled_url.py index 7097faf36848..a734444afb6d 100644 --- a/packages/google-cloud-websecurityscanner/google/cloud/websecurityscanner_v1beta/types/crawled_url.py +++ b/packages/google-cloud-websecurityscanner/google/cloud/websecurityscanner_v1beta/types/crawled_url.py @@ -13,6 +13,8 @@ # See the License for the specific language governing permissions and # limitations under the License. # +from typing import MutableMapping, MutableSequence + import proto # type: ignore __protobuf__ = proto.module( @@ -40,15 +42,15 @@ class CrawledUrl(proto.Message): visit the URL. """ - http_method = proto.Field( + http_method: str = proto.Field( proto.STRING, number=1, ) - url = proto.Field( + url: str = proto.Field( proto.STRING, number=2, ) - body = proto.Field( + body: str = proto.Field( proto.STRING, number=3, ) diff --git a/packages/google-cloud-websecurityscanner/google/cloud/websecurityscanner_v1beta/types/finding.py b/packages/google-cloud-websecurityscanner/google/cloud/websecurityscanner_v1beta/types/finding.py index c8950a5642c3..ec82255e90ad 100644 --- a/packages/google-cloud-websecurityscanner/google/cloud/websecurityscanner_v1beta/types/finding.py +++ b/packages/google-cloud-websecurityscanner/google/cloud/websecurityscanner_v1beta/types/finding.py @@ -13,6 +13,8 @@ # See the License for the specific language governing permissions and # limitations under the License. # +from typing import MutableMapping, MutableSequence + import proto # type: ignore from google.cloud.websecurityscanner_v1beta.types import finding_addon @@ -88,72 +90,72 @@ class Finding(proto.Message): an XSS, if any. """ - name = proto.Field( + name: str = proto.Field( proto.STRING, number=1, ) - finding_type = proto.Field( + finding_type: str = proto.Field( proto.STRING, number=2, ) - http_method = proto.Field( + http_method: str = proto.Field( proto.STRING, number=3, ) - fuzzed_url = proto.Field( + fuzzed_url: str = proto.Field( proto.STRING, number=4, ) - body = proto.Field( + body: str = proto.Field( proto.STRING, number=5, ) - description = proto.Field( + description: str = proto.Field( proto.STRING, number=6, ) - reproduction_url = proto.Field( + reproduction_url: str = proto.Field( proto.STRING, number=7, ) - frame_url = proto.Field( + frame_url: str = proto.Field( proto.STRING, number=8, ) - final_url = proto.Field( + final_url: str = proto.Field( proto.STRING, number=9, ) - tracking_id = proto.Field( + tracking_id: str = proto.Field( proto.STRING, number=10, ) - form = proto.Field( + form: finding_addon.Form = proto.Field( proto.MESSAGE, number=16, message=finding_addon.Form, ) - outdated_library = proto.Field( + outdated_library: finding_addon.OutdatedLibrary = proto.Field( proto.MESSAGE, number=11, message=finding_addon.OutdatedLibrary, ) - violating_resource = proto.Field( + violating_resource: finding_addon.ViolatingResource = proto.Field( proto.MESSAGE, number=12, message=finding_addon.ViolatingResource, ) - vulnerable_headers = proto.Field( + vulnerable_headers: finding_addon.VulnerableHeaders = proto.Field( proto.MESSAGE, number=15, message=finding_addon.VulnerableHeaders, ) - vulnerable_parameters = proto.Field( + vulnerable_parameters: finding_addon.VulnerableParameters = proto.Field( proto.MESSAGE, number=13, message=finding_addon.VulnerableParameters, ) - xss = proto.Field( + xss: finding_addon.Xss = proto.Field( proto.MESSAGE, number=14, message=finding_addon.Xss, diff --git a/packages/google-cloud-websecurityscanner/google/cloud/websecurityscanner_v1beta/types/finding_addon.py b/packages/google-cloud-websecurityscanner/google/cloud/websecurityscanner_v1beta/types/finding_addon.py index 20d6c45f2a0f..fb45b1cc07ae 100644 --- a/packages/google-cloud-websecurityscanner/google/cloud/websecurityscanner_v1beta/types/finding_addon.py +++ b/packages/google-cloud-websecurityscanner/google/cloud/websecurityscanner_v1beta/types/finding_addon.py @@ -13,6 +13,8 @@ # See the License for the specific language governing permissions and # limitations under the License. # +from typing import MutableMapping, MutableSequence + import proto # type: ignore __protobuf__ = proto.module( @@ -35,16 +37,16 @@ class Form(proto.Message): action_uri (str): ! The URI where to send the form when it's submitted. - fields (Sequence[str]): + fields (MutableSequence[str]): ! The names of form fields related to the vulnerability. """ - action_uri = proto.Field( + action_uri: str = proto.Field( proto.STRING, number=1, ) - fields = proto.RepeatedField( + fields: MutableSequence[str] = proto.RepeatedField( proto.STRING, number=2, ) @@ -58,20 +60,20 @@ class OutdatedLibrary(proto.Message): The name of the outdated library. version (str): The version number. - learn_more_urls (Sequence[str]): + learn_more_urls (MutableSequence[str]): URLs to learn more information about the vulnerabilities in the library. """ - library_name = proto.Field( + library_name: str = proto.Field( proto.STRING, number=1, ) - version = proto.Field( + version: str = proto.Field( proto.STRING, number=2, ) - learn_more_urls = proto.RepeatedField( + learn_more_urls: MutableSequence[str] = proto.RepeatedField( proto.STRING, number=3, ) @@ -88,11 +90,11 @@ class ViolatingResource(proto.Message): URL of this violating resource. """ - content_type = proto.Field( + content_type: str = proto.Field( proto.STRING, number=1, ) - resource_url = proto.Field( + resource_url: str = proto.Field( proto.STRING, number=2, ) @@ -102,11 +104,11 @@ class VulnerableParameters(proto.Message): r"""Information about vulnerable request parameters. Attributes: - parameter_names (Sequence[str]): + parameter_names (MutableSequence[str]): The vulnerable parameter names. """ - parameter_names = proto.RepeatedField( + parameter_names: MutableSequence[str] = proto.RepeatedField( proto.STRING, number=1, ) @@ -116,9 +118,9 @@ class VulnerableHeaders(proto.Message): r"""Information about vulnerable or missing HTTP Headers. Attributes: - headers (Sequence[google.cloud.websecurityscanner_v1beta.types.VulnerableHeaders.Header]): + headers (MutableSequence[google.cloud.websecurityscanner_v1beta.types.VulnerableHeaders.Header]): List of vulnerable headers. - missing_headers (Sequence[google.cloud.websecurityscanner_v1beta.types.VulnerableHeaders.Header]): + missing_headers (MutableSequence[google.cloud.websecurityscanner_v1beta.types.VulnerableHeaders.Header]): List of missing headers. """ @@ -132,21 +134,21 @@ class Header(proto.Message): Header value. """ - name = proto.Field( + name: str = proto.Field( proto.STRING, number=1, ) - value = proto.Field( + value: str = proto.Field( proto.STRING, number=2, ) - headers = proto.RepeatedField( + headers: MutableSequence[Header] = proto.RepeatedField( proto.MESSAGE, number=1, message=Header, ) - missing_headers = proto.RepeatedField( + missing_headers: MutableSequence[Header] = proto.RepeatedField( proto.MESSAGE, number=2, message=Header, @@ -157,7 +159,7 @@ class Xss(proto.Message): r"""Information reported for an XSS. Attributes: - stack_traces (Sequence[str]): + stack_traces (MutableSequence[str]): Stack traces leading to the point where the XSS occurred. error_message (str): @@ -165,11 +167,11 @@ class Xss(proto.Message): breakage. """ - stack_traces = proto.RepeatedField( + stack_traces: MutableSequence[str] = proto.RepeatedField( proto.STRING, number=1, ) - error_message = proto.Field( + error_message: str = proto.Field( proto.STRING, number=2, ) diff --git a/packages/google-cloud-websecurityscanner/google/cloud/websecurityscanner_v1beta/types/finding_type_stats.py b/packages/google-cloud-websecurityscanner/google/cloud/websecurityscanner_v1beta/types/finding_type_stats.py index 5e1dfa4ca98b..0b937dfa19e3 100644 --- a/packages/google-cloud-websecurityscanner/google/cloud/websecurityscanner_v1beta/types/finding_type_stats.py +++ b/packages/google-cloud-websecurityscanner/google/cloud/websecurityscanner_v1beta/types/finding_type_stats.py @@ -13,6 +13,8 @@ # See the License for the specific language governing permissions and # limitations under the License. # +from typing import MutableMapping, MutableSequence + import proto # type: ignore __protobuf__ = proto.module( @@ -35,11 +37,11 @@ class FindingTypeStats(proto.Message): finding type. """ - finding_type = proto.Field( + finding_type: str = proto.Field( proto.STRING, number=1, ) - finding_count = proto.Field( + finding_count: int = proto.Field( proto.INT32, number=2, ) diff --git a/packages/google-cloud-websecurityscanner/google/cloud/websecurityscanner_v1beta/types/scan_config.py b/packages/google-cloud-websecurityscanner/google/cloud/websecurityscanner_v1beta/types/scan_config.py index cbbac1c05d15..4ef695d184f9 100644 --- a/packages/google-cloud-websecurityscanner/google/cloud/websecurityscanner_v1beta/types/scan_config.py +++ b/packages/google-cloud-websecurityscanner/google/cloud/websecurityscanner_v1beta/types/scan_config.py @@ -13,6 +13,8 @@ # See the License for the specific language governing permissions and # limitations under the License. # +from typing import MutableMapping, MutableSequence + from google.protobuf import timestamp_pb2 # type: ignore import proto # type: ignore @@ -44,7 +46,7 @@ class ScanConfig(proto.Message): to 20 inclusively. If the field is unspecified or its value is set 0, server will default to 15. Other values outside of [5, 20] range will be rejected with INVALID_ARGUMENT error. - starting_urls (Sequence[str]): + starting_urls (MutableSequence[str]): Required. The starting URLs from which the scanner finds site pages. authentication (google.cloud.websecurityscanner_v1beta.types.ScanConfig.Authentication): @@ -53,12 +55,12 @@ class ScanConfig(proto.Message): configuration during scanning. user_agent (google.cloud.websecurityscanner_v1beta.types.ScanConfig.UserAgent): The user agent used during scanning. - blacklist_patterns (Sequence[str]): + blacklist_patterns (MutableSequence[str]): The blacklist URL patterns as described in https://cloud.google.com/security-scanner/docs/excluded-urls schedule (google.cloud.websecurityscanner_v1beta.types.ScanConfig.Schedule): The schedule of the ScanConfig. - target_platforms (Sequence[google.cloud.websecurityscanner_v1beta.types.ScanConfig.TargetPlatform]): + target_platforms (MutableSequence[google.cloud.websecurityscanner_v1beta.types.ScanConfig.TargetPlatform]): Set of Cloud Platforms targeted by the scan. If empty, APP_ENGINE will be used as a default. export_to_security_command_center (google.cloud.websecurityscanner_v1beta.types.ScanConfig.ExportToSecurityCommandCenter): @@ -137,11 +139,11 @@ class GoogleAccount(proto.Message): included in audit logs. """ - username = proto.Field( + username: str = proto.Field( proto.STRING, number=1, ) - password = proto.Field( + password: str = proto.Field( proto.STRING, number=2, ) @@ -163,26 +165,26 @@ class CustomAccount(proto.Message): Required. The login form URL of the website. """ - username = proto.Field( + username: str = proto.Field( proto.STRING, number=1, ) - password = proto.Field( + password: str = proto.Field( proto.STRING, number=2, ) - login_url = proto.Field( + login_url: str = proto.Field( proto.STRING, number=3, ) - google_account = proto.Field( + google_account: "ScanConfig.Authentication.GoogleAccount" = proto.Field( proto.MESSAGE, number=1, oneof="authentication", message="ScanConfig.Authentication.GoogleAccount", ) - custom_account = proto.Field( + custom_account: "ScanConfig.Authentication.CustomAccount" = proto.Field( proto.MESSAGE, number=2, oneof="authentication", @@ -204,67 +206,67 @@ class Schedule(proto.Message): executions in days. """ - schedule_time = proto.Field( + schedule_time: timestamp_pb2.Timestamp = proto.Field( proto.MESSAGE, number=1, message=timestamp_pb2.Timestamp, ) - interval_duration_days = proto.Field( + interval_duration_days: int = proto.Field( proto.INT32, number=2, ) - name = proto.Field( + name: str = proto.Field( proto.STRING, number=1, ) - display_name = proto.Field( + display_name: str = proto.Field( proto.STRING, number=2, ) - max_qps = proto.Field( + max_qps: int = proto.Field( proto.INT32, number=3, ) - starting_urls = proto.RepeatedField( + starting_urls: MutableSequence[str] = proto.RepeatedField( proto.STRING, number=4, ) - authentication = proto.Field( + authentication: Authentication = proto.Field( proto.MESSAGE, number=5, message=Authentication, ) - user_agent = proto.Field( + user_agent: UserAgent = proto.Field( proto.ENUM, number=6, enum=UserAgent, ) - blacklist_patterns = proto.RepeatedField( + blacklist_patterns: MutableSequence[str] = proto.RepeatedField( proto.STRING, number=7, ) - schedule = proto.Field( + schedule: Schedule = proto.Field( proto.MESSAGE, number=8, message=Schedule, ) - target_platforms = proto.RepeatedField( + target_platforms: MutableSequence[TargetPlatform] = proto.RepeatedField( proto.ENUM, number=9, enum=TargetPlatform, ) - export_to_security_command_center = proto.Field( + export_to_security_command_center: ExportToSecurityCommandCenter = proto.Field( proto.ENUM, number=10, enum=ExportToSecurityCommandCenter, ) - latest_run = proto.Field( + latest_run: scan_run.ScanRun = proto.Field( proto.MESSAGE, number=11, message=scan_run.ScanRun, ) - risk_level = proto.Field( + risk_level: RiskLevel = proto.Field( proto.ENUM, number=12, enum=RiskLevel, diff --git a/packages/google-cloud-websecurityscanner/google/cloud/websecurityscanner_v1beta/types/scan_config_error.py b/packages/google-cloud-websecurityscanner/google/cloud/websecurityscanner_v1beta/types/scan_config_error.py index 9b179facfe59..ab96f891f415 100644 --- a/packages/google-cloud-websecurityscanner/google/cloud/websecurityscanner_v1beta/types/scan_config_error.py +++ b/packages/google-cloud-websecurityscanner/google/cloud/websecurityscanner_v1beta/types/scan_config_error.py @@ -13,6 +13,8 @@ # See the License for the specific language governing permissions and # limitations under the License. # +from typing import MutableMapping, MutableSequence + import proto # type: ignore __protobuf__ = proto.module( @@ -89,12 +91,12 @@ class Code(proto.Enum): UNSUPPORTED_FINDING_TYPE = 41 UNSUPPORTED_URL_SCHEME = 42 - code = proto.Field( + code: Code = proto.Field( proto.ENUM, number=1, enum=Code, ) - field_name = proto.Field( + field_name: str = proto.Field( proto.STRING, number=2, ) diff --git a/packages/google-cloud-websecurityscanner/google/cloud/websecurityscanner_v1beta/types/scan_run.py b/packages/google-cloud-websecurityscanner/google/cloud/websecurityscanner_v1beta/types/scan_run.py index 193e990ce218..60f873f520a6 100644 --- a/packages/google-cloud-websecurityscanner/google/cloud/websecurityscanner_v1beta/types/scan_run.py +++ b/packages/google-cloud-websecurityscanner/google/cloud/websecurityscanner_v1beta/types/scan_run.py @@ -13,6 +13,8 @@ # See the License for the specific language governing permissions and # limitations under the License. # +from typing import MutableMapping, MutableSequence + from google.protobuf import timestamp_pb2 # type: ignore import proto # type: ignore @@ -76,7 +78,7 @@ class ScanRun(proto.Message): If result_state is an ERROR, this field provides the primary reason for scan's termination and more details, if such are available. - warning_traces (Sequence[google.cloud.websecurityscanner_v1beta.types.ScanRunWarningTrace]): + warning_traces (MutableSequence[google.cloud.websecurityscanner_v1beta.types.ScanRunWarningTrace]): A list of warnings, if such are encountered during this scan run. """ @@ -95,52 +97,54 @@ class ResultState(proto.Enum): ERROR = 2 KILLED = 3 - name = proto.Field( + name: str = proto.Field( proto.STRING, number=1, ) - execution_state = proto.Field( + execution_state: ExecutionState = proto.Field( proto.ENUM, number=2, enum=ExecutionState, ) - result_state = proto.Field( + result_state: ResultState = proto.Field( proto.ENUM, number=3, enum=ResultState, ) - start_time = proto.Field( + start_time: timestamp_pb2.Timestamp = proto.Field( proto.MESSAGE, number=4, message=timestamp_pb2.Timestamp, ) - end_time = proto.Field( + end_time: timestamp_pb2.Timestamp = proto.Field( proto.MESSAGE, number=5, message=timestamp_pb2.Timestamp, ) - urls_crawled_count = proto.Field( + urls_crawled_count: int = proto.Field( proto.INT64, number=6, ) - urls_tested_count = proto.Field( + urls_tested_count: int = proto.Field( proto.INT64, number=7, ) - has_vulnerabilities = proto.Field( + has_vulnerabilities: bool = proto.Field( proto.BOOL, number=8, ) - progress_percent = proto.Field( + progress_percent: int = proto.Field( proto.INT32, number=9, ) - error_trace = proto.Field( + error_trace: scan_run_error_trace.ScanRunErrorTrace = proto.Field( proto.MESSAGE, number=10, message=scan_run_error_trace.ScanRunErrorTrace, ) - warning_traces = proto.RepeatedField( + warning_traces: MutableSequence[ + scan_run_warning_trace.ScanRunWarningTrace + ] = proto.RepeatedField( proto.MESSAGE, number=11, message=scan_run_warning_trace.ScanRunWarningTrace, diff --git a/packages/google-cloud-websecurityscanner/google/cloud/websecurityscanner_v1beta/types/scan_run_error_trace.py b/packages/google-cloud-websecurityscanner/google/cloud/websecurityscanner_v1beta/types/scan_run_error_trace.py index 06dc2667bb0c..fc10d901d8cb 100644 --- a/packages/google-cloud-websecurityscanner/google/cloud/websecurityscanner_v1beta/types/scan_run_error_trace.py +++ b/packages/google-cloud-websecurityscanner/google/cloud/websecurityscanner_v1beta/types/scan_run_error_trace.py @@ -13,6 +13,8 @@ # See the License for the specific language governing permissions and # limitations under the License. # +from typing import MutableMapping, MutableSequence + import proto # type: ignore from google.cloud.websecurityscanner_v1beta.types import ( @@ -58,17 +60,17 @@ class Code(proto.Enum): TOO_MANY_REDIRECTS = 5 TOO_MANY_HTTP_ERRORS = 6 - code = proto.Field( + code: Code = proto.Field( proto.ENUM, number=1, enum=Code, ) - scan_config_error = proto.Field( + scan_config_error: gcw_scan_config_error.ScanConfigError = proto.Field( proto.MESSAGE, number=2, message=gcw_scan_config_error.ScanConfigError, ) - most_common_http_error_code = proto.Field( + most_common_http_error_code: int = proto.Field( proto.INT32, number=3, ) diff --git a/packages/google-cloud-websecurityscanner/google/cloud/websecurityscanner_v1beta/types/scan_run_warning_trace.py b/packages/google-cloud-websecurityscanner/google/cloud/websecurityscanner_v1beta/types/scan_run_warning_trace.py index abc74c9e1121..02cca4731f88 100644 --- a/packages/google-cloud-websecurityscanner/google/cloud/websecurityscanner_v1beta/types/scan_run_warning_trace.py +++ b/packages/google-cloud-websecurityscanner/google/cloud/websecurityscanner_v1beta/types/scan_run_warning_trace.py @@ -13,6 +13,8 @@ # See the License for the specific language governing permissions and # limitations under the License. # +from typing import MutableMapping, MutableSequence + import proto # type: ignore __protobuf__ = proto.module( @@ -45,7 +47,7 @@ class Code(proto.Enum): TOO_MANY_FUZZ_TASKS = 3 BLOCKED_BY_IAP = 4 - code = proto.Field( + code: Code = proto.Field( proto.ENUM, number=1, enum=Code, diff --git a/packages/google-cloud-websecurityscanner/google/cloud/websecurityscanner_v1beta/types/web_security_scanner.py b/packages/google-cloud-websecurityscanner/google/cloud/websecurityscanner_v1beta/types/web_security_scanner.py index bd03bd9089ac..ab7d7848892c 100644 --- a/packages/google-cloud-websecurityscanner/google/cloud/websecurityscanner_v1beta/types/web_security_scanner.py +++ b/packages/google-cloud-websecurityscanner/google/cloud/websecurityscanner_v1beta/types/web_security_scanner.py @@ -13,6 +13,8 @@ # See the License for the specific language governing permissions and # limitations under the License. # +from typing import MutableMapping, MutableSequence + from google.protobuf import field_mask_pb2 # type: ignore import proto # type: ignore @@ -61,11 +63,11 @@ class CreateScanConfigRequest(proto.Message): Required. The ScanConfig to be created. """ - parent = proto.Field( + parent: str = proto.Field( proto.STRING, number=1, ) - scan_config = proto.Field( + scan_config: gcw_scan_config.ScanConfig = proto.Field( proto.MESSAGE, number=2, message=gcw_scan_config.ScanConfig, @@ -82,7 +84,7 @@ class DeleteScanConfigRequest(proto.Message): 'projects/{projectId}/scanConfigs/{scanConfigId}'. """ - name = proto.Field( + name: str = proto.Field( proto.STRING, number=1, ) @@ -98,7 +100,7 @@ class GetScanConfigRequest(proto.Message): 'projects/{projectId}/scanConfigs/{scanConfigId}'. """ - name = proto.Field( + name: str = proto.Field( proto.STRING, number=1, ) @@ -124,15 +126,15 @@ class ListScanConfigsRequest(proto.Message): reasonable value. """ - parent = proto.Field( + parent: str = proto.Field( proto.STRING, number=1, ) - page_token = proto.Field( + page_token: str = proto.Field( proto.STRING, number=2, ) - page_size = proto.Field( + page_size: int = proto.Field( proto.INT32, number=3, ) @@ -153,12 +155,12 @@ class UpdateScanConfigRequest(proto.Message): https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#fieldmask """ - scan_config = proto.Field( + scan_config: gcw_scan_config.ScanConfig = proto.Field( proto.MESSAGE, number=2, message=gcw_scan_config.ScanConfig, ) - update_mask = proto.Field( + update_mask: field_mask_pb2.FieldMask = proto.Field( proto.MESSAGE, number=3, message=field_mask_pb2.FieldMask, @@ -169,7 +171,7 @@ class ListScanConfigsResponse(proto.Message): r"""Response for the ``ListScanConfigs`` method. Attributes: - scan_configs (Sequence[google.cloud.websecurityscanner_v1beta.types.ScanConfig]): + scan_configs (MutableSequence[google.cloud.websecurityscanner_v1beta.types.ScanConfig]): The list of ScanConfigs returned. next_page_token (str): Token to retrieve the next page of results, @@ -181,12 +183,12 @@ class ListScanConfigsResponse(proto.Message): def raw_page(self): return self - scan_configs = proto.RepeatedField( + scan_configs: MutableSequence[gcw_scan_config.ScanConfig] = proto.RepeatedField( proto.MESSAGE, number=1, message=gcw_scan_config.ScanConfig, ) - next_page_token = proto.Field( + next_page_token: str = proto.Field( proto.STRING, number=2, ) @@ -202,7 +204,7 @@ class StartScanRunRequest(proto.Message): 'projects/{projectId}/scanConfigs/{scanConfigId}'. """ - name = proto.Field( + name: str = proto.Field( proto.STRING, number=1, ) @@ -218,7 +220,7 @@ class GetScanRunRequest(proto.Message): 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. """ - name = proto.Field( + name: str = proto.Field( proto.STRING, number=1, ) @@ -244,15 +246,15 @@ class ListScanRunsRequest(proto.Message): reasonable value. """ - parent = proto.Field( + parent: str = proto.Field( proto.STRING, number=1, ) - page_token = proto.Field( + page_token: str = proto.Field( proto.STRING, number=2, ) - page_size = proto.Field( + page_size: int = proto.Field( proto.INT32, number=3, ) @@ -262,7 +264,7 @@ class ListScanRunsResponse(proto.Message): r"""Response for the ``ListScanRuns`` method. Attributes: - scan_runs (Sequence[google.cloud.websecurityscanner_v1beta.types.ScanRun]): + scan_runs (MutableSequence[google.cloud.websecurityscanner_v1beta.types.ScanRun]): The list of ScanRuns returned. next_page_token (str): Token to retrieve the next page of results, @@ -274,12 +276,12 @@ class ListScanRunsResponse(proto.Message): def raw_page(self): return self - scan_runs = proto.RepeatedField( + scan_runs: MutableSequence[scan_run.ScanRun] = proto.RepeatedField( proto.MESSAGE, number=1, message=scan_run.ScanRun, ) - next_page_token = proto.Field( + next_page_token: str = proto.Field( proto.STRING, number=2, ) @@ -295,7 +297,7 @@ class StopScanRunRequest(proto.Message): 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. """ - name = proto.Field( + name: str = proto.Field( proto.STRING, number=1, ) @@ -321,15 +323,15 @@ class ListCrawledUrlsRequest(proto.Message): reasonable value. """ - parent = proto.Field( + parent: str = proto.Field( proto.STRING, number=1, ) - page_token = proto.Field( + page_token: str = proto.Field( proto.STRING, number=2, ) - page_size = proto.Field( + page_size: int = proto.Field( proto.INT32, number=3, ) @@ -339,7 +341,7 @@ class ListCrawledUrlsResponse(proto.Message): r"""Response for the ``ListCrawledUrls`` method. Attributes: - crawled_urls (Sequence[google.cloud.websecurityscanner_v1beta.types.CrawledUrl]): + crawled_urls (MutableSequence[google.cloud.websecurityscanner_v1beta.types.CrawledUrl]): The list of CrawledUrls returned. next_page_token (str): Token to retrieve the next page of results, @@ -351,12 +353,12 @@ class ListCrawledUrlsResponse(proto.Message): def raw_page(self): return self - crawled_urls = proto.RepeatedField( + crawled_urls: MutableSequence[crawled_url.CrawledUrl] = proto.RepeatedField( proto.MESSAGE, number=1, message=crawled_url.CrawledUrl, ) - next_page_token = proto.Field( + next_page_token: str = proto.Field( proto.STRING, number=2, ) @@ -372,7 +374,7 @@ class GetFindingRequest(proto.Message): 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}/findings/{findingId}'. """ - name = proto.Field( + name: str = proto.Field( proto.STRING, number=1, ) @@ -402,19 +404,19 @@ class ListFindingsRequest(proto.Message): reasonable value. """ - parent = proto.Field( + parent: str = proto.Field( proto.STRING, number=1, ) - filter = proto.Field( + filter: str = proto.Field( proto.STRING, number=2, ) - page_token = proto.Field( + page_token: str = proto.Field( proto.STRING, number=3, ) - page_size = proto.Field( + page_size: int = proto.Field( proto.INT32, number=4, ) @@ -424,7 +426,7 @@ class ListFindingsResponse(proto.Message): r"""Response for the ``ListFindings`` method. Attributes: - findings (Sequence[google.cloud.websecurityscanner_v1beta.types.Finding]): + findings (MutableSequence[google.cloud.websecurityscanner_v1beta.types.Finding]): The list of Findings returned. next_page_token (str): Token to retrieve the next page of results, @@ -436,12 +438,12 @@ class ListFindingsResponse(proto.Message): def raw_page(self): return self - findings = proto.RepeatedField( + findings: MutableSequence[finding.Finding] = proto.RepeatedField( proto.MESSAGE, number=1, message=finding.Finding, ) - next_page_token = proto.Field( + next_page_token: str = proto.Field( proto.STRING, number=2, ) @@ -457,7 +459,7 @@ class ListFindingTypeStatsRequest(proto.Message): 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'. """ - parent = proto.Field( + parent: str = proto.Field( proto.STRING, number=1, ) @@ -467,11 +469,13 @@ class ListFindingTypeStatsResponse(proto.Message): r"""Response for the ``ListFindingTypeStats`` method. Attributes: - finding_type_stats (Sequence[google.cloud.websecurityscanner_v1beta.types.FindingTypeStats]): + finding_type_stats (MutableSequence[google.cloud.websecurityscanner_v1beta.types.FindingTypeStats]): The list of FindingTypeStats returned. """ - finding_type_stats = proto.RepeatedField( + finding_type_stats: MutableSequence[ + gcw_finding_type_stats.FindingTypeStats + ] = proto.RepeatedField( proto.MESSAGE, number=1, message=gcw_finding_type_stats.FindingTypeStats, diff --git a/packages/google-cloud-websecurityscanner/owlbot.py b/packages/google-cloud-websecurityscanner/owlbot.py new file mode 100644 index 000000000000..ce738f01d012 --- /dev/null +++ b/packages/google-cloud-websecurityscanner/owlbot.py @@ -0,0 +1,56 @@ +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import json +from pathlib import Path +import shutil + +import synthtool as s +import synthtool.gcp as gcp +from synthtool.languages import python + +# ---------------------------------------------------------------------------- +# Copy the generated client from the owl-bot staging directory +# ---------------------------------------------------------------------------- + +clean_up_generated_samples = True + +# Load the default version defined in .repo-metadata.json. +default_version = json.load(open(".repo-metadata.json", "rt")).get( + "default_version" +) + +for library in s.get_staging_dirs(default_version): + if clean_up_generated_samples: + shutil.rmtree("samples/generated_samples", ignore_errors=True) + clean_up_generated_samples = False + s.move([library], excludes=["**/gapic_version.py"]) +s.remove_staging_dirs() + +# ---------------------------------------------------------------------------- +# Add templated files +# ---------------------------------------------------------------------------- + +templated_files = gcp.CommonTemplates().py_library( + cov_level=100, + microgenerator=True, + versions=gcp.common.detect_versions(path="./google", default_first=True), +) +s.move(templated_files, excludes=[".coveragerc", ".github/release-please.yml"]) + +python.py_samples(skip_readmes=True) + +# run format session for all directories which have a noxfile +for noxfile in Path(".").glob("**/noxfile.py"): + s.shell.run(["nox", "-s", "format"], cwd=noxfile.parent, hide_output=False) diff --git a/packages/google-cloud-websecurityscanner/release-please-config.json b/packages/google-cloud-websecurityscanner/release-please-config.json new file mode 100644 index 000000000000..266be1fe1ebc --- /dev/null +++ b/packages/google-cloud-websecurityscanner/release-please-config.json @@ -0,0 +1,33 @@ +{ + "$schema": "https://raw.githubusercontent.com/googleapis/release-please/main/schemas/config.json", + "packages": { + ".": { + "release-type": "python", + "extra-files": [ + "google/cloud/websecurityscanner/gapic_version.py", + { + "type": "json", + "path": "samples/generated_samples/snippet_metadata_google.cloud.websecurityscanner.v1alpha.json", + "jsonpath": "$.clientLibrary.version" + }, + { + "type": "json", + "path": "samples/generated_samples/snippet_metadata_google.cloud.websecurityscanner.v1beta.json", + "jsonpath": "$.clientLibrary.version" + }, + { + "type": "json", + "path": "samples/generated_samples/snippet_metadata_google.cloud.websecurityscanner.v1.json", + "jsonpath": "$.clientLibrary.version" + } + ] + } + }, + "release-type": "python", + "plugins": [ + { + "type": "sentence-case" + } + ], + "initial-version": "0.1.0" +} diff --git a/packages/google-cloud-websecurityscanner/samples/generated_samples/snippet_metadata_websecurityscanner_v1.json b/packages/google-cloud-websecurityscanner/samples/generated_samples/snippet_metadata_google.cloud.websecurityscanner.v1.json similarity index 99% rename from packages/google-cloud-websecurityscanner/samples/generated_samples/snippet_metadata_websecurityscanner_v1.json rename to packages/google-cloud-websecurityscanner/samples/generated_samples/snippet_metadata_google.cloud.websecurityscanner.v1.json index ee0237c1fdd1..030ea8082797 100644 --- a/packages/google-cloud-websecurityscanner/samples/generated_samples/snippet_metadata_websecurityscanner_v1.json +++ b/packages/google-cloud-websecurityscanner/samples/generated_samples/snippet_metadata_google.cloud.websecurityscanner.v1.json @@ -7,7 +7,8 @@ } ], "language": "PYTHON", - "name": "google-cloud-websecurityscanner" + "name": "google-cloud-websecurityscanner", + "version": "0.1.0" }, "snippets": [ { diff --git a/packages/google-cloud-websecurityscanner/samples/generated_samples/snippet_metadata_websecurityscanner_v1alpha.json b/packages/google-cloud-websecurityscanner/samples/generated_samples/snippet_metadata_google.cloud.websecurityscanner.v1alpha.json similarity index 99% rename from packages/google-cloud-websecurityscanner/samples/generated_samples/snippet_metadata_websecurityscanner_v1alpha.json rename to packages/google-cloud-websecurityscanner/samples/generated_samples/snippet_metadata_google.cloud.websecurityscanner.v1alpha.json index 736b256a6025..c87e0efb514b 100644 --- a/packages/google-cloud-websecurityscanner/samples/generated_samples/snippet_metadata_websecurityscanner_v1alpha.json +++ b/packages/google-cloud-websecurityscanner/samples/generated_samples/snippet_metadata_google.cloud.websecurityscanner.v1alpha.json @@ -7,7 +7,8 @@ } ], "language": "PYTHON", - "name": "google-cloud-websecurityscanner" + "name": "google-cloud-websecurityscanner", + "version": "0.1.0" }, "snippets": [ { diff --git a/packages/google-cloud-websecurityscanner/samples/generated_samples/snippet_metadata_websecurityscanner_v1beta.json b/packages/google-cloud-websecurityscanner/samples/generated_samples/snippet_metadata_google.cloud.websecurityscanner.v1beta.json similarity index 99% rename from packages/google-cloud-websecurityscanner/samples/generated_samples/snippet_metadata_websecurityscanner_v1beta.json rename to packages/google-cloud-websecurityscanner/samples/generated_samples/snippet_metadata_google.cloud.websecurityscanner.v1beta.json index 590155bccdf6..3896b1676525 100644 --- a/packages/google-cloud-websecurityscanner/samples/generated_samples/snippet_metadata_websecurityscanner_v1beta.json +++ b/packages/google-cloud-websecurityscanner/samples/generated_samples/snippet_metadata_google.cloud.websecurityscanner.v1beta.json @@ -7,7 +7,8 @@ } ], "language": "PYTHON", - "name": "google-cloud-websecurityscanner" + "name": "google-cloud-websecurityscanner", + "version": "0.1.0" }, "snippets": [ { diff --git a/packages/google-cloud-websecurityscanner/setup.py b/packages/google-cloud-websecurityscanner/setup.py index 363c0f80a1fa..3b81b98f3cef 100644 --- a/packages/google-cloud-websecurityscanner/setup.py +++ b/packages/google-cloud-websecurityscanner/setup.py @@ -1,41 +1,48 @@ -# Copyright 2018 Google LLC +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # -# https://www.apache.org/licenses/LICENSE-2.0 +# http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. - +# import io import os -import setuptools +import setuptools # type: ignore -# Package metadata. +package_root = os.path.abspath(os.path.dirname(__file__)) name = "google-cloud-websecurityscanner" -description = ("Google Cloud Web Security Scanner API client library",) -version = "1.9.2" -# Should be one of: -# 'Development Status :: 3 - Alpha' -# 'Development Status :: 4 - Beta' -# 'Development Status :: 5 - Production/Stable' -release_status = "Development Status :: 5 - Production/Stable" + + +description = "Google Cloud Websecurityscanner API client library" + +version = {} +with open( + os.path.join(package_root, "google/cloud/websecurityscanner/gapic_version.py") +) as fp: + exec(fp.read(), version) +version = version["__version__"] + +if version[0] == "0": + release_status = "Development Status :: 4 - Beta" +else: + release_status = "Development Status :: 5 - Production/Stable" + dependencies = [ - "google-api-core[grpc] >= 1.32.0, <3.0.0dev,!=2.0.*,!=2.1.*,!=2.2.*,!=2.3.*,!=2.4.*,!=2.5.*,!=2.6.*,!=2.7.*", + "google-api-core[grpc] >= 1.33.2, <3.0.0dev,!=2.0.*,!=2.1.*,!=2.2.*,!=2.3.*,!=2.4.*,!=2.5.*,!=2.6.*,!=2.7.*", "proto-plus >= 1.22.0, <2.0.0dev", "protobuf>=3.19.5,<5.0.0dev,!=3.20.0,!=3.20.1,!=4.21.0,!=4.21.1,!=4.21.2,!=4.21.3,!=4.21.4,!=4.21.5", ] -extras = {} - - -# Setup boilerplate below this line. +url = "https://github.com/googleapis/python-websecurityscanner" package_root = os.path.abspath(os.path.dirname(__file__)) @@ -43,20 +50,16 @@ with io.open(readme_filename, encoding="utf-8") as readme_file: readme = readme_file.read() -# Only include packages under the 'google' namespace. Do not include tests, -# benchmarks, etc. packages = [ package for package in setuptools.PEP420PackageFinder.find() if package.startswith("google") ] -# Determine which namespaces are needed. namespaces = ["google"] if "google.cloud" in packages: namespaces.append("google.cloud") - setuptools.setup( name=name, version=version, @@ -65,12 +68,10 @@ author="Google LLC", author_email="googleapis-packages@google.com", license="Apache 2.0", - url="https://github.com/googleapis/python-websecurityscanner", + url=url, classifiers=[ release_status, "Intended Audience :: Developers", - "Development Status :: 5 - Production/Stable", - "Intended Audience :: Developers", "License :: OSI Approved :: Apache Software License", "Programming Language :: Python", "Programming Language :: Python :: 3", @@ -78,17 +79,14 @@ "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", + "Operating System :: OS Independent", + "Topic :: Internet", ], platforms="Posix; MacOS X; Windows", packages=packages, + python_requires=">=3.7", namespace_packages=namespaces, install_requires=dependencies, - extras_require=extras, - python_requires=">=3.7", - scripts=[ - "scripts/fixup_websecurityscanner_v1alpha_keywords.py", - "scripts/fixup_websecurityscanner_v1beta_keywords.py", - ], include_package_data=True, zip_safe=False, ) diff --git a/packages/google-cloud-websecurityscanner/testing/constraints-3.10.txt b/packages/google-cloud-websecurityscanner/testing/constraints-3.10.txt index e69de29bb2d1..ed7f9aed2559 100644 --- a/packages/google-cloud-websecurityscanner/testing/constraints-3.10.txt +++ b/packages/google-cloud-websecurityscanner/testing/constraints-3.10.txt @@ -0,0 +1,6 @@ +# -*- coding: utf-8 -*- +# This constraints file is required for unit tests. +# List all library dependencies and extras in this file. +google-api-core +proto-plus +protobuf diff --git a/packages/google-cloud-websecurityscanner/testing/constraints-3.11.txt b/packages/google-cloud-websecurityscanner/testing/constraints-3.11.txt index e69de29bb2d1..ed7f9aed2559 100644 --- a/packages/google-cloud-websecurityscanner/testing/constraints-3.11.txt +++ b/packages/google-cloud-websecurityscanner/testing/constraints-3.11.txt @@ -0,0 +1,6 @@ +# -*- coding: utf-8 -*- +# This constraints file is required for unit tests. +# List all library dependencies and extras in this file. +google-api-core +proto-plus +protobuf diff --git a/packages/google-cloud-websecurityscanner/testing/constraints-3.7.txt b/packages/google-cloud-websecurityscanner/testing/constraints-3.7.txt index 5dcaa6fd1884..6f3158cc2034 100644 --- a/packages/google-cloud-websecurityscanner/testing/constraints-3.7.txt +++ b/packages/google-cloud-websecurityscanner/testing/constraints-3.7.txt @@ -1,10 +1,9 @@ # This constraints file is used to check that lower bounds # are correct in setup.py -# List *all* library dependencies and extras in this file. +# List all library dependencies and extras in this file. # Pin the version to the lower bound. -# -# 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.32.0 +# e.g., if setup.py has "google-cloud-foo >= 1.14.0, < 2.0.0dev", +# Then this file should have google-cloud-foo==1.14.0 +google-api-core==1.33.2 proto-plus==1.22.0 protobuf==3.19.5 diff --git a/packages/google-cloud-websecurityscanner/testing/constraints-3.8.txt b/packages/google-cloud-websecurityscanner/testing/constraints-3.8.txt index e69de29bb2d1..ed7f9aed2559 100644 --- a/packages/google-cloud-websecurityscanner/testing/constraints-3.8.txt +++ b/packages/google-cloud-websecurityscanner/testing/constraints-3.8.txt @@ -0,0 +1,6 @@ +# -*- coding: utf-8 -*- +# This constraints file is required for unit tests. +# List all library dependencies and extras in this file. +google-api-core +proto-plus +protobuf diff --git a/packages/google-cloud-websecurityscanner/testing/constraints-3.9.txt b/packages/google-cloud-websecurityscanner/testing/constraints-3.9.txt index e69de29bb2d1..ed7f9aed2559 100644 --- a/packages/google-cloud-websecurityscanner/testing/constraints-3.9.txt +++ b/packages/google-cloud-websecurityscanner/testing/constraints-3.9.txt @@ -0,0 +1,6 @@ +# -*- coding: utf-8 -*- +# This constraints file is required for unit tests. +# List all library dependencies and extras in this file. +google-api-core +proto-plus +protobuf