|
34 | 34 | from google.api_core.client_options import ClientOptions |
35 | 35 | from google.auth import credentials as ga_credentials # type: ignore |
36 | 36 | 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 |
38 | 39 |
|
39 | 40 | try: |
40 | 41 | OptionalRetry = Union[retries.Retry, gapic_v1.method._MethodDefault] |
@@ -255,7 +256,7 @@ async def create_source( |
255 | 256 | parent: Optional[str] = None, |
256 | 257 | source: Optional[gcs_source.Source] = None, |
257 | 258 | retry: OptionalRetry = gapic_v1.method.DEFAULT, |
258 | | - timeout: Optional[float] = None, |
| 259 | + timeout: Union[float, object] = gapic_v1.method.DEFAULT, |
259 | 260 | metadata: Sequence[Tuple[str, str]] = (), |
260 | 261 | ) -> gcs_source.Source: |
261 | 262 | r"""Creates a source. |
@@ -375,7 +376,7 @@ async def create_finding( |
375 | 376 | finding_id: Optional[str] = None, |
376 | 377 | finding: Optional[gcs_finding.Finding] = None, |
377 | 378 | retry: OptionalRetry = gapic_v1.method.DEFAULT, |
378 | | - timeout: Optional[float] = None, |
| 379 | + timeout: Union[float, object] = gapic_v1.method.DEFAULT, |
379 | 380 | metadata: Sequence[Tuple[str, str]] = (), |
380 | 381 | ) -> gcs_finding.Finding: |
381 | 382 | r"""Creates a finding. The corresponding source must |
@@ -509,7 +510,7 @@ async def get_iam_policy( |
509 | 510 | *, |
510 | 511 | resource: Optional[str] = None, |
511 | 512 | retry: OptionalRetry = gapic_v1.method.DEFAULT, |
512 | | - timeout: Optional[float] = None, |
| 513 | + timeout: Union[float, object] = gapic_v1.method.DEFAULT, |
513 | 514 | metadata: Sequence[Tuple[str, str]] = (), |
514 | 515 | ) -> policy_pb2.Policy: |
515 | 516 | r"""Gets the access control policy on the specified |
@@ -688,7 +689,7 @@ async def get_organization_settings( |
688 | 689 | *, |
689 | 690 | name: Optional[str] = None, |
690 | 691 | retry: OptionalRetry = gapic_v1.method.DEFAULT, |
691 | | - timeout: Optional[float] = None, |
| 692 | + timeout: Union[float, object] = gapic_v1.method.DEFAULT, |
692 | 693 | metadata: Sequence[Tuple[str, str]] = (), |
693 | 694 | ) -> organization_settings.OrganizationSettings: |
694 | 695 | r"""Gets the settings for an organization. |
@@ -802,7 +803,7 @@ async def get_source( |
802 | 803 | *, |
803 | 804 | name: Optional[str] = None, |
804 | 805 | retry: OptionalRetry = gapic_v1.method.DEFAULT, |
805 | | - timeout: Optional[float] = None, |
| 806 | + timeout: Union[float, object] = gapic_v1.method.DEFAULT, |
806 | 807 | metadata: Sequence[Tuple[str, str]] = (), |
807 | 808 | ) -> source.Source: |
808 | 809 | r"""Gets a source. |
@@ -920,7 +921,7 @@ async def group_assets( |
920 | 921 | ] = None, |
921 | 922 | *, |
922 | 923 | retry: OptionalRetry = gapic_v1.method.DEFAULT, |
923 | | - timeout: Optional[float] = None, |
| 924 | + timeout: Union[float, object] = gapic_v1.method.DEFAULT, |
924 | 925 | metadata: Sequence[Tuple[str, str]] = (), |
925 | 926 | ) -> pagers.GroupAssetsAsyncPager: |
926 | 927 | r"""Filters an organization's assets and groups them by |
@@ -1029,7 +1030,7 @@ async def group_findings( |
1029 | 1030 | parent: Optional[str] = None, |
1030 | 1031 | group_by: Optional[str] = None, |
1031 | 1032 | retry: OptionalRetry = gapic_v1.method.DEFAULT, |
1032 | | - timeout: Optional[float] = None, |
| 1033 | + timeout: Union[float, object] = gapic_v1.method.DEFAULT, |
1033 | 1034 | metadata: Sequence[Tuple[str, str]] = (), |
1034 | 1035 | ) -> pagers.GroupFindingsAsyncPager: |
1035 | 1036 | r"""Filters an organization or source's findings and groups them by |
@@ -1180,7 +1181,7 @@ async def list_assets( |
1180 | 1181 | request: Optional[Union[securitycenter_service.ListAssetsRequest, dict]] = None, |
1181 | 1182 | *, |
1182 | 1183 | retry: OptionalRetry = gapic_v1.method.DEFAULT, |
1183 | | - timeout: Optional[float] = None, |
| 1184 | + timeout: Union[float, object] = gapic_v1.method.DEFAULT, |
1184 | 1185 | metadata: Sequence[Tuple[str, str]] = (), |
1185 | 1186 | ) -> pagers.ListAssetsAsyncPager: |
1186 | 1187 | r"""Lists an organization's assets. |
@@ -1283,7 +1284,7 @@ async def list_findings( |
1283 | 1284 | ] = None, |
1284 | 1285 | *, |
1285 | 1286 | retry: OptionalRetry = gapic_v1.method.DEFAULT, |
1286 | | - timeout: Optional[float] = None, |
| 1287 | + timeout: Union[float, object] = gapic_v1.method.DEFAULT, |
1287 | 1288 | metadata: Sequence[Tuple[str, str]] = (), |
1288 | 1289 | ) -> pagers.ListFindingsAsyncPager: |
1289 | 1290 | r"""Lists an organization or source's findings. |
@@ -1393,7 +1394,7 @@ async def list_sources( |
1393 | 1394 | *, |
1394 | 1395 | parent: Optional[str] = None, |
1395 | 1396 | retry: OptionalRetry = gapic_v1.method.DEFAULT, |
1396 | | - timeout: Optional[float] = None, |
| 1397 | + timeout: Union[float, object] = gapic_v1.method.DEFAULT, |
1397 | 1398 | metadata: Sequence[Tuple[str, str]] = (), |
1398 | 1399 | ) -> pagers.ListSourcesAsyncPager: |
1399 | 1400 | r"""Lists all sources belonging to an organization. |
@@ -1519,7 +1520,7 @@ async def run_asset_discovery( |
1519 | 1520 | *, |
1520 | 1521 | parent: Optional[str] = None, |
1521 | 1522 | retry: OptionalRetry = gapic_v1.method.DEFAULT, |
1522 | | - timeout: Optional[float] = None, |
| 1523 | + timeout: Union[float, object] = gapic_v1.method.DEFAULT, |
1523 | 1524 | metadata: Sequence[Tuple[str, str]] = (), |
1524 | 1525 | ) -> operation_async.AsyncOperation: |
1525 | 1526 | r"""Runs asset discovery. The discovery is tracked with a |
@@ -1554,7 +1555,7 @@ async def sample_run_asset_discovery(): |
1554 | 1555 |
|
1555 | 1556 | print("Waiting for operation to complete...") |
1556 | 1557 |
|
1557 | | - response = await operation.result() |
| 1558 | + response = (await operation).result() |
1558 | 1559 |
|
1559 | 1560 | # Handle the response |
1560 | 1561 | print(response) |
@@ -1653,7 +1654,7 @@ async def set_finding_state( |
1653 | 1654 | state: Optional[finding.Finding.State] = None, |
1654 | 1655 | start_time: Optional[timestamp_pb2.Timestamp] = None, |
1655 | 1656 | retry: OptionalRetry = gapic_v1.method.DEFAULT, |
1656 | | - timeout: Optional[float] = None, |
| 1657 | + timeout: Union[float, object] = gapic_v1.method.DEFAULT, |
1657 | 1658 | metadata: Sequence[Tuple[str, str]] = (), |
1658 | 1659 | ) -> finding.Finding: |
1659 | 1660 | r"""Updates the state of a finding. |
@@ -1784,7 +1785,7 @@ async def set_iam_policy( |
1784 | 1785 | *, |
1785 | 1786 | resource: Optional[str] = None, |
1786 | 1787 | retry: OptionalRetry = gapic_v1.method.DEFAULT, |
1787 | | - timeout: Optional[float] = None, |
| 1788 | + timeout: Union[float, object] = gapic_v1.method.DEFAULT, |
1788 | 1789 | metadata: Sequence[Tuple[str, str]] = (), |
1789 | 1790 | ) -> policy_pb2.Policy: |
1790 | 1791 | r"""Sets the access control policy on the specified |
@@ -1952,7 +1953,7 @@ async def test_iam_permissions( |
1952 | 1953 | resource: Optional[str] = None, |
1953 | 1954 | permissions: Optional[MutableSequence[str]] = None, |
1954 | 1955 | retry: OptionalRetry = gapic_v1.method.DEFAULT, |
1955 | | - timeout: Optional[float] = None, |
| 1956 | + timeout: Union[float, object] = gapic_v1.method.DEFAULT, |
1956 | 1957 | metadata: Sequence[Tuple[str, str]] = (), |
1957 | 1958 | ) -> iam_policy_pb2.TestIamPermissionsResponse: |
1958 | 1959 | r"""Returns the permissions that a caller has on the |
@@ -2081,7 +2082,7 @@ async def update_finding( |
2081 | 2082 | *, |
2082 | 2083 | finding: Optional[gcs_finding.Finding] = None, |
2083 | 2084 | retry: OptionalRetry = gapic_v1.method.DEFAULT, |
2084 | | - timeout: Optional[float] = None, |
| 2085 | + timeout: Union[float, object] = gapic_v1.method.DEFAULT, |
2085 | 2086 | metadata: Sequence[Tuple[str, str]] = (), |
2086 | 2087 | ) -> gcs_finding.Finding: |
2087 | 2088 | r"""Creates or updates a finding. The corresponding |
@@ -2201,7 +2202,7 @@ async def update_organization_settings( |
2201 | 2202 | gcs_organization_settings.OrganizationSettings |
2202 | 2203 | ] = None, |
2203 | 2204 | retry: OptionalRetry = gapic_v1.method.DEFAULT, |
2204 | | - timeout: Optional[float] = None, |
| 2205 | + timeout: Union[float, object] = gapic_v1.method.DEFAULT, |
2205 | 2206 | metadata: Sequence[Tuple[str, str]] = (), |
2206 | 2207 | ) -> gcs_organization_settings.OrganizationSettings: |
2207 | 2208 | r"""Updates an organization's settings. |
@@ -2307,7 +2308,7 @@ async def update_source( |
2307 | 2308 | *, |
2308 | 2309 | source: Optional[gcs_source.Source] = None, |
2309 | 2310 | retry: OptionalRetry = gapic_v1.method.DEFAULT, |
2310 | | - timeout: Optional[float] = None, |
| 2311 | + timeout: Union[float, object] = gapic_v1.method.DEFAULT, |
2311 | 2312 | metadata: Sequence[Tuple[str, str]] = (), |
2312 | 2313 | ) -> gcs_source.Source: |
2313 | 2314 | r"""Updates a source. |
@@ -2416,7 +2417,7 @@ async def update_security_marks( |
2416 | 2417 | *, |
2417 | 2418 | security_marks: Optional[gcs_security_marks.SecurityMarks] = None, |
2418 | 2419 | retry: OptionalRetry = gapic_v1.method.DEFAULT, |
2419 | | - timeout: Optional[float] = None, |
| 2420 | + timeout: Union[float, object] = gapic_v1.method.DEFAULT, |
2420 | 2421 | metadata: Sequence[Tuple[str, str]] = (), |
2421 | 2422 | ) -> gcs_security_marks.SecurityMarks: |
2422 | 2423 | r"""Updates security marks. |
@@ -2526,14 +2527,9 @@ async def __aexit__(self, exc_type, exc, tb): |
2526 | 2527 | await self.transport.close() |
2527 | 2528 |
|
2528 | 2529 |
|
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 | +) |
2537 | 2533 |
|
2538 | 2534 |
|
2539 | 2535 | __all__ = ("SecurityCenterAsyncClient",) |
0 commit comments