Skip to content

Commit 4400be7

Browse files
fix(deps): Require google-api-core >=1.34.0, >=2.11.0 (#414)
* fix(deps): Require google-api-core >=1.34.0, >=2.11.0 fix: Drop usage of pkg_resources fix: Fix timeout default values docs(samples): Snippetgen should call await on the operation coroutine before calling result PiperOrigin-RevId: 493260409 Source-Link: googleapis/googleapis@fea4387 Source-Link: googleapis/googleapis-gen@387b734 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiMzg3YjczNDRjNzUyOWVlNDRiZTg0ZTYxM2IxOWE4MjA1MDhjNjEyYiJ9 * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * add gapic_version.py * add gapic_version.py Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com> Co-authored-by: Anthonios Partheniou <partheniou@google.com>
1 parent 61682bf commit 4400be7

File tree

20 files changed

+257
-250
lines changed

20 files changed

+257
-250
lines changed

packages/google-cloud-securitycenter/.coveragerc

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,3 @@ exclude_lines =
1010
pragma: NO COVER
1111
# Ignore debug-only repr
1212
def __repr__
13-
# Ignore pkg_resources exceptions.
14-
# This is added at the module level as a safeguard for if someone
15-
# generates the code and tries to run it without pip installing. This
16-
# makes it virtually impossible to test properly.
17-
except pkg_resources.DistributionNotFound
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# -*- coding: utf-8 -*-
2+
# Copyright 2022 Google LLC
3+
#
4+
# Licensed under the Apache License, Version 2.0 (the "License");
5+
# you may not use this file except in compliance with the License.
6+
# You may obtain a copy of the License at
7+
#
8+
# http://www.apache.org/licenses/LICENSE-2.0
9+
#
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
# See the License for the specific language governing permissions and
14+
# limitations under the License.
15+
#
16+
__version__ = "1.16.2" # {x-release-please-version}

packages/google-cloud-securitycenter/google/cloud/securitycenter_v1/services/security_center/async_client.py

Lines changed: 43 additions & 47 deletions
Large diffs are not rendered by default.

packages/google-cloud-securitycenter/google/cloud/securitycenter_v1/services/security_center/client.py

Lines changed: 41 additions & 45 deletions
Large diffs are not rendered by default.

packages/google-cloud-securitycenter/google/cloud/securitycenter_v1/services/security_center/transports/base.py

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@
2727
from google.longrunning import operations_pb2 # type: ignore
2828
from google.oauth2 import service_account # type: ignore
2929
from google.protobuf import empty_pb2 # type: ignore
30-
import pkg_resources
3130

31+
from google.cloud.securitycenter_v1 import gapic_version as package_version
3232
from google.cloud.securitycenter_v1.types import external_system as gcs_external_system
3333
from google.cloud.securitycenter_v1.types import (
3434
notification_config as gcs_notification_config,
@@ -48,14 +48,9 @@
4848
from google.cloud.securitycenter_v1.types import source
4949
from google.cloud.securitycenter_v1.types import source as gcs_source
5050

51-
try:
52-
DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo(
53-
gapic_version=pkg_resources.get_distribution(
54-
"google-cloud-securitycenter",
55-
).version,
56-
)
57-
except pkg_resources.DistributionNotFound:
58-
DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo()
51+
DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo(
52+
gapic_version=package_version.__version__
53+
)
5954

6055

6156
class SecurityCenterTransport(abc.ABC):
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# -*- coding: utf-8 -*-
2+
# Copyright 2022 Google LLC
3+
#
4+
# Licensed under the Apache License, Version 2.0 (the "License");
5+
# you may not use this file except in compliance with the License.
6+
# You may obtain a copy of the License at
7+
#
8+
# http://www.apache.org/licenses/LICENSE-2.0
9+
#
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
# See the License for the specific language governing permissions and
14+
# limitations under the License.
15+
#
16+
__version__ = "1.16.2" # {x-release-please-version}

packages/google-cloud-securitycenter/google/cloud/securitycenter_v1beta1/services/security_center/async_client.py

Lines changed: 24 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,8 @@
3434
from google.api_core.client_options import ClientOptions
3535
from google.auth import credentials as ga_credentials # type: ignore
3636
from google.oauth2 import service_account # type: ignore
37-
import pkg_resources
37+
38+
from google.cloud.securitycenter_v1beta1 import gapic_version as package_version
3839

3940
try:
4041
OptionalRetry = Union[retries.Retry, gapic_v1.method._MethodDefault]
@@ -255,7 +256,7 @@ async def create_source(
255256
parent: Optional[str] = None,
256257
source: Optional[gcs_source.Source] = None,
257258
retry: OptionalRetry = gapic_v1.method.DEFAULT,
258-
timeout: Optional[float] = None,
259+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
259260
metadata: Sequence[Tuple[str, str]] = (),
260261
) -> gcs_source.Source:
261262
r"""Creates a source.
@@ -375,7 +376,7 @@ async def create_finding(
375376
finding_id: Optional[str] = None,
376377
finding: Optional[gcs_finding.Finding] = None,
377378
retry: OptionalRetry = gapic_v1.method.DEFAULT,
378-
timeout: Optional[float] = None,
379+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
379380
metadata: Sequence[Tuple[str, str]] = (),
380381
) -> gcs_finding.Finding:
381382
r"""Creates a finding. The corresponding source must
@@ -509,7 +510,7 @@ async def get_iam_policy(
509510
*,
510511
resource: Optional[str] = None,
511512
retry: OptionalRetry = gapic_v1.method.DEFAULT,
512-
timeout: Optional[float] = None,
513+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
513514
metadata: Sequence[Tuple[str, str]] = (),
514515
) -> policy_pb2.Policy:
515516
r"""Gets the access control policy on the specified
@@ -688,7 +689,7 @@ async def get_organization_settings(
688689
*,
689690
name: Optional[str] = None,
690691
retry: OptionalRetry = gapic_v1.method.DEFAULT,
691-
timeout: Optional[float] = None,
692+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
692693
metadata: Sequence[Tuple[str, str]] = (),
693694
) -> organization_settings.OrganizationSettings:
694695
r"""Gets the settings for an organization.
@@ -802,7 +803,7 @@ async def get_source(
802803
*,
803804
name: Optional[str] = None,
804805
retry: OptionalRetry = gapic_v1.method.DEFAULT,
805-
timeout: Optional[float] = None,
806+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
806807
metadata: Sequence[Tuple[str, str]] = (),
807808
) -> source.Source:
808809
r"""Gets a source.
@@ -920,7 +921,7 @@ async def group_assets(
920921
] = None,
921922
*,
922923
retry: OptionalRetry = gapic_v1.method.DEFAULT,
923-
timeout: Optional[float] = None,
924+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
924925
metadata: Sequence[Tuple[str, str]] = (),
925926
) -> pagers.GroupAssetsAsyncPager:
926927
r"""Filters an organization's assets and groups them by
@@ -1029,7 +1030,7 @@ async def group_findings(
10291030
parent: Optional[str] = None,
10301031
group_by: Optional[str] = None,
10311032
retry: OptionalRetry = gapic_v1.method.DEFAULT,
1032-
timeout: Optional[float] = None,
1033+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
10331034
metadata: Sequence[Tuple[str, str]] = (),
10341035
) -> pagers.GroupFindingsAsyncPager:
10351036
r"""Filters an organization or source's findings and groups them by
@@ -1180,7 +1181,7 @@ async def list_assets(
11801181
request: Optional[Union[securitycenter_service.ListAssetsRequest, dict]] = None,
11811182
*,
11821183
retry: OptionalRetry = gapic_v1.method.DEFAULT,
1183-
timeout: Optional[float] = None,
1184+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
11841185
metadata: Sequence[Tuple[str, str]] = (),
11851186
) -> pagers.ListAssetsAsyncPager:
11861187
r"""Lists an organization's assets.
@@ -1283,7 +1284,7 @@ async def list_findings(
12831284
] = None,
12841285
*,
12851286
retry: OptionalRetry = gapic_v1.method.DEFAULT,
1286-
timeout: Optional[float] = None,
1287+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
12871288
metadata: Sequence[Tuple[str, str]] = (),
12881289
) -> pagers.ListFindingsAsyncPager:
12891290
r"""Lists an organization or source's findings.
@@ -1393,7 +1394,7 @@ async def list_sources(
13931394
*,
13941395
parent: Optional[str] = None,
13951396
retry: OptionalRetry = gapic_v1.method.DEFAULT,
1396-
timeout: Optional[float] = None,
1397+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
13971398
metadata: Sequence[Tuple[str, str]] = (),
13981399
) -> pagers.ListSourcesAsyncPager:
13991400
r"""Lists all sources belonging to an organization.
@@ -1519,7 +1520,7 @@ async def run_asset_discovery(
15191520
*,
15201521
parent: Optional[str] = None,
15211522
retry: OptionalRetry = gapic_v1.method.DEFAULT,
1522-
timeout: Optional[float] = None,
1523+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
15231524
metadata: Sequence[Tuple[str, str]] = (),
15241525
) -> operation_async.AsyncOperation:
15251526
r"""Runs asset discovery. The discovery is tracked with a
@@ -1554,7 +1555,7 @@ async def sample_run_asset_discovery():
15541555
15551556
print("Waiting for operation to complete...")
15561557
1557-
response = await operation.result()
1558+
response = (await operation).result()
15581559
15591560
# Handle the response
15601561
print(response)
@@ -1653,7 +1654,7 @@ async def set_finding_state(
16531654
state: Optional[finding.Finding.State] = None,
16541655
start_time: Optional[timestamp_pb2.Timestamp] = None,
16551656
retry: OptionalRetry = gapic_v1.method.DEFAULT,
1656-
timeout: Optional[float] = None,
1657+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
16571658
metadata: Sequence[Tuple[str, str]] = (),
16581659
) -> finding.Finding:
16591660
r"""Updates the state of a finding.
@@ -1784,7 +1785,7 @@ async def set_iam_policy(
17841785
*,
17851786
resource: Optional[str] = None,
17861787
retry: OptionalRetry = gapic_v1.method.DEFAULT,
1787-
timeout: Optional[float] = None,
1788+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
17881789
metadata: Sequence[Tuple[str, str]] = (),
17891790
) -> policy_pb2.Policy:
17901791
r"""Sets the access control policy on the specified
@@ -1952,7 +1953,7 @@ async def test_iam_permissions(
19521953
resource: Optional[str] = None,
19531954
permissions: Optional[MutableSequence[str]] = None,
19541955
retry: OptionalRetry = gapic_v1.method.DEFAULT,
1955-
timeout: Optional[float] = None,
1956+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
19561957
metadata: Sequence[Tuple[str, str]] = (),
19571958
) -> iam_policy_pb2.TestIamPermissionsResponse:
19581959
r"""Returns the permissions that a caller has on the
@@ -2081,7 +2082,7 @@ async def update_finding(
20812082
*,
20822083
finding: Optional[gcs_finding.Finding] = None,
20832084
retry: OptionalRetry = gapic_v1.method.DEFAULT,
2084-
timeout: Optional[float] = None,
2085+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
20852086
metadata: Sequence[Tuple[str, str]] = (),
20862087
) -> gcs_finding.Finding:
20872088
r"""Creates or updates a finding. The corresponding
@@ -2201,7 +2202,7 @@ async def update_organization_settings(
22012202
gcs_organization_settings.OrganizationSettings
22022203
] = None,
22032204
retry: OptionalRetry = gapic_v1.method.DEFAULT,
2204-
timeout: Optional[float] = None,
2205+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
22052206
metadata: Sequence[Tuple[str, str]] = (),
22062207
) -> gcs_organization_settings.OrganizationSettings:
22072208
r"""Updates an organization's settings.
@@ -2307,7 +2308,7 @@ async def update_source(
23072308
*,
23082309
source: Optional[gcs_source.Source] = None,
23092310
retry: OptionalRetry = gapic_v1.method.DEFAULT,
2310-
timeout: Optional[float] = None,
2311+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
23112312
metadata: Sequence[Tuple[str, str]] = (),
23122313
) -> gcs_source.Source:
23132314
r"""Updates a source.
@@ -2416,7 +2417,7 @@ async def update_security_marks(
24162417
*,
24172418
security_marks: Optional[gcs_security_marks.SecurityMarks] = None,
24182419
retry: OptionalRetry = gapic_v1.method.DEFAULT,
2419-
timeout: Optional[float] = None,
2420+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
24202421
metadata: Sequence[Tuple[str, str]] = (),
24212422
) -> gcs_security_marks.SecurityMarks:
24222423
r"""Updates security marks.
@@ -2526,14 +2527,9 @@ async def __aexit__(self, exc_type, exc, tb):
25262527
await self.transport.close()
25272528

25282529

2529-
try:
2530-
DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo(
2531-
gapic_version=pkg_resources.get_distribution(
2532-
"google-cloud-securitycenter",
2533-
).version,
2534-
)
2535-
except pkg_resources.DistributionNotFound:
2536-
DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo()
2530+
DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo(
2531+
gapic_version=package_version.__version__
2532+
)
25372533

25382534

25392535
__all__ = ("SecurityCenterAsyncClient",)

0 commit comments

Comments
 (0)