| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 1c2e943 commit e705a7b
14 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -22,6 +22,7 @@ | |||
| 22 | 22 | ) | |
| 23 | 23 | ||
| 24 | 24 | from google.cloud.securitycenter_v1.types.asset import Asset | |
| 25 | + from google.cloud.securitycenter_v1.types.external_system import ExternalSystem | ||
| 25 | 26 | from google.cloud.securitycenter_v1.types.finding import Finding | |
| 26 | 27 | from google.cloud.securitycenter_v1.types.folder import Folder | |
| 27 | 28 | from google.cloud.securitycenter_v1.types.indicator import Indicator | |
@@ -122,6 +123,9 @@ | |||
| 122 | 123 | SetFindingStateRequest, | |
| 123 | 124 | ) | |
| 124 | 125 | from google.cloud.securitycenter_v1.types.securitycenter_service import SetMuteRequest | |
| 126 | + from google.cloud.securitycenter_v1.types.securitycenter_service import ( | ||
| 127 | + UpdateExternalSystemRequest, | ||
| 128 | + ) | ||
| 125 | 129 | from google.cloud.securitycenter_v1.types.securitycenter_service import ( | |
| 126 | 130 | UpdateFindingRequest, | |
| 127 | 131 | ) | |
@@ -150,6 +154,7 @@ | |||
| 150 | 154 | "SecurityCenterClient", | |
| 151 | 155 | "SecurityCenterAsyncClient", | |
| 152 | 156 | "Asset", | |
| 157 | + "ExternalSystem", | ||
| 153 | 158 | "Finding", | |
| 154 | 159 | "Folder", | |
| 155 | 160 | "Indicator", | |
@@ -190,6 +195,7 @@ | |||
| 190 | 195 | "RunAssetDiscoveryRequest", | |
| 191 | 196 | "SetFindingStateRequest", | |
| 192 | 197 | "SetMuteRequest", | |
| 198 | + "UpdateExternalSystemRequest", | ||
| 193 | 199 | "UpdateFindingRequest", | |
| 194 | 200 | "UpdateMuteConfigRequest", | |
| 195 | 201 | "UpdateNotificationConfigRequest", | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -18,6 +18,7 @@ | |||
| 18 | 18 | from .services.security_center import SecurityCenterAsyncClient | |
| 19 | 19 | ||
| 20 | 20 | from .types.asset import Asset | |
| 21 | + from .types.external_system import ExternalSystem | ||
| 21 | 22 | from .types.finding import Finding | |
| 22 | 23 | from .types.folder import Folder | |
| 23 | 24 | from .types.indicator import Indicator | |
@@ -58,6 +59,7 @@ | |||
| 58 | 59 | from .types.securitycenter_service import RunAssetDiscoveryRequest | |
| 59 | 60 | from .types.securitycenter_service import SetFindingStateRequest | |
| 60 | 61 | from .types.securitycenter_service import SetMuteRequest | |
| 62 | + from .types.securitycenter_service import UpdateExternalSystemRequest | ||
| 61 | 63 | from .types.securitycenter_service import UpdateFindingRequest | |
| 62 | 64 | from .types.securitycenter_service import UpdateMuteConfigRequest | |
| 63 | 65 | from .types.securitycenter_service import UpdateNotificationConfigRequest | |
@@ -83,6 +85,7 @@ | |||
| 83 | 85 | "Cvssv3", | |
| 84 | 86 | "DeleteMuteConfigRequest", | |
| 85 | 87 | "DeleteNotificationConfigRequest", | |
| 88 | + "ExternalSystem", | ||
| 86 | 89 | "Finding", | |
| 87 | 90 | "Folder", | |
| 88 | 91 | "GetMuteConfigRequest", | |
@@ -118,6 +121,7 @@ | |||
| 118 | 121 | "SetFindingStateRequest", | |
| 119 | 122 | "SetMuteRequest", | |
| 120 | 123 | "Source", | |
| 124 | + "UpdateExternalSystemRequest", | ||
| 121 | 125 | "UpdateFindingRequest", | |
| 122 | 126 | "UpdateMuteConfigRequest", | |
| 123 | 127 | "UpdateNotificationConfigRequest", | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -130,6 +130,11 @@ | |||
| 130 | 130 | "test_iam_permissions" | |
| 131 | 131 | ] | |
| 132 | 132 | }, | |
| 133 | + "UpdateExternalSystem": { | ||
| 134 | + "methods": [ | ||
| 135 | + "update_external_system" | ||
| 136 | + ] | ||
| 137 | + }, | ||
| 133 | 138 | "UpdateFinding": { | |
| 134 | 139 | "methods": [ | |
| 135 | 140 | "update_finding" | |
@@ -285,6 +290,11 @@ | |||
| 285 | 290 | "test_iam_permissions" | |
| 286 | 291 | ] | |
| 287 | 292 | }, | |
| 293 | + "UpdateExternalSystem": { | ||
| 294 | + "methods": [ | ||
| 295 | + "update_external_system" | ||
| 296 | + ] | ||
| 297 | + }, | ||
| 288 | 298 | "UpdateFinding": { | |
| 289 | 299 | "methods": [ | |
| 290 | 300 | "update_finding" | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -34,6 +34,7 @@ | |||
| 34 | 34 | from google.api_core import operation # type: ignore | |
| 35 | 35 | from google.api_core import operation_async # type: ignore | |
| 36 | 36 | from google.cloud.securitycenter_v1.services.security_center import pagers | |
| 37 | + from google.cloud.securitycenter_v1.types import external_system as gcs_external_system | ||
| 37 | 38 | from google.cloud.securitycenter_v1.types import finding | |
| 38 | 39 | from google.cloud.securitycenter_v1.types import finding as gcs_finding | |
| 39 | 40 | from google.cloud.securitycenter_v1.types import indicator | |
@@ -74,6 +75,10 @@ class SecurityCenterAsyncClient: | |||
| 74 | 75 | ||
| 75 | 76 | asset_path = staticmethod(SecurityCenterClient.asset_path) | |
| 76 | 77 | parse_asset_path = staticmethod(SecurityCenterClient.parse_asset_path) | |
| 78 | + external_system_path = staticmethod(SecurityCenterClient.external_system_path) | ||
| 79 | + parse_external_system_path = staticmethod( | ||
| 80 | + SecurityCenterClient.parse_external_system_path | ||
| 81 | + ) | ||
| 77 | 82 | finding_path = staticmethod(SecurityCenterClient.finding_path) | |
| 78 | 83 | parse_finding_path = staticmethod(SecurityCenterClient.parse_finding_path) | |
| 79 | 84 | mute_config_path = staticmethod(SecurityCenterClient.mute_config_path) | |
@@ -2406,6 +2411,91 @@ async def test_iam_permissions( | |||
| 2406 | 2411 | # Done; return the response. | |
| 2407 | 2412 | return response | |
| 2408 | 2413 | ||
| 2414 | + async def update_external_system( | ||
| 2415 | + self, | ||
| 2416 | + request: Union[securitycenter_service.UpdateExternalSystemRequest, dict] = None, | ||
| 2417 | + *, | ||
| 2418 | + external_system: gcs_external_system.ExternalSystem = None, | ||
| 2419 | + update_mask: field_mask_pb2.FieldMask = None, | ||
| 2420 | + retry: OptionalRetry = gapic_v1.method.DEFAULT, | ||
| 2421 | + timeout: float = None, | ||
| 2422 | + metadata: Sequence[Tuple[str, str]] = (), | ||
| 2423 | + ) -> gcs_external_system.ExternalSystem: | ||
| 2424 | + r"""Updates external system. This is for a given finding. | ||
| 2425 | + | ||
| 2426 | + Args: | ||
| 2427 | + request (Union[google.cloud.securitycenter_v1.types.UpdateExternalSystemRequest, dict]): | ||
| 2428 | + The request object. Request message for updating a | ||
| 2429 | + ExternalSystem resource. | ||
| 2430 | + external_system (:class:`google.cloud.securitycenter_v1.types.ExternalSystem`): | ||
| 2431 | + Required. The external system | ||
| 2432 | + resource to update. | ||
| 2433 | + | ||
| 2434 | + This corresponds to the ``external_system`` field | ||
| 2435 | + on the ``request`` instance; if ``request`` is provided, this | ||
| 2436 | + should not be set. | ||
| 2437 | + update_mask (:class:`google.protobuf.field_mask_pb2.FieldMask`): | ||
| 2438 | + The FieldMask to use when updating | ||
| 2439 | + the external system resource. | ||
| 2440 | + If empty all mutable fields will be | ||
| 2441 | + updated. | ||
| 2442 | + | ||
| 2443 | + This corresponds to the ``update_mask`` field | ||
| 2444 | + on the ``request`` instance; if ``request`` is provided, this | ||
| 2445 | + should not be set. | ||
| 2446 | + retry (google.api_core.retry.Retry): Designation of what errors, if any, | ||
| 2447 | + should be retried. | ||
| 2448 | + timeout (float): The timeout for this request. | ||
| 2449 | + metadata (Sequence[Tuple[str, str]]): Strings which should be | ||
| 2450 | + sent along with the request as metadata. | ||
| 2451 | + | ||
| 2452 | + Returns: | ||
| 2453 | + google.cloud.securitycenter_v1.types.ExternalSystem: | ||
| 2454 | + Representation of third party | ||
| 2455 | + SIEM/SOAR fields within SCC. | ||
| 2456 | + | ||
| 2457 | + """ | ||
| 2458 | + # Create or coerce a protobuf request object. | ||
| 2459 | + # Sanity check: If we got a request object, we should *not* have | ||
| 2460 | + # gotten any keyword arguments that map to the request. | ||
| 2461 | + has_flattened_params = any([external_system, update_mask]) | ||
| 2462 | + if request is not None and has_flattened_params: | ||
| 2463 | + raise ValueError( | ||
| 2464 | + "If the `request` argument is set, then none of " | ||
| 2465 | + "the individual field arguments should be set." | ||
| 2466 | + ) | ||
| 2467 | + | ||
| 2468 | + request = securitycenter_service.UpdateExternalSystemRequest(request) | ||
| 2469 | + | ||
| 2470 | + # If we have keyword arguments corresponding to fields on the | ||
| 2471 | + # request, apply these. | ||
| 2472 | + if external_system is not None: | ||
| 2473 | + request.external_system = external_system | ||
| 2474 | + if update_mask is not None: | ||
| 2475 | + request.update_mask = update_mask | ||
| 2476 | + | ||
| 2477 | + # Wrap the RPC method; this adds retry and timeout information, | ||
| 2478 | + # and friendly error handling. | ||
| 2479 | + rpc = gapic_v1.method_async.wrap_method( | ||
| 2480 | + self._client._transport.update_external_system, | ||
| 2481 | + default_timeout=None, | ||
| 2482 | + client_info=DEFAULT_CLIENT_INFO, | ||
| 2483 | + ) | ||
| 2484 | + | ||
| 2485 | + # Certain fields should be provided within the metadata header; | ||
| 2486 | + # add these here. | ||
| 2487 | + metadata = tuple(metadata) + ( | ||
| 2488 | + gapic_v1.routing_header.to_grpc_metadata( | ||
| 2489 | + (("external_system.name", request.external_system.name),) | ||
| 2490 | + ), | ||
| 2491 | + ) | ||
| 2492 | + | ||
| 2493 | + # Send the request. | ||
| 2494 | + response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) | ||
| 2495 | + | ||
| 2496 | + # Done; return the response. | ||
| 2497 | + return response | ||
| 2498 | + | ||
| 2409 | 2499 | async def update_finding( | |
| 2410 | 2500 | self, | |
| 2411 | 2501 | request: Union[securitycenter_service.UpdateFindingRequest, dict] = None, | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -37,6 +37,7 @@ | |||
| 37 | 37 | from google.api_core import operation # type: ignore | |
| 38 | 38 | from google.api_core import operation_async # type: ignore | |
| 39 | 39 | from google.cloud.securitycenter_v1.services.security_center import pagers | |
| 40 | + from google.cloud.securitycenter_v1.types import external_system as gcs_external_system | ||
| 40 | 41 | from google.cloud.securitycenter_v1.types import finding | |
| 41 | 42 | from google.cloud.securitycenter_v1.types import finding as gcs_finding | |
| 42 | 43 | from google.cloud.securitycenter_v1.types import indicator | |
@@ -200,6 +201,27 @@ def parse_asset_path(path: str) -> Dict[str, str]: | |||
| 200 | 201 | ) | |
| 201 | 202 | return m.groupdict() if m else {} | |
| 202 | 203 | ||
| 204 | + @staticmethod | ||
| 205 | + def external_system_path( | ||
| 206 | + organization: str, source: str, finding: str, externalsystem: str, | ||
| 207 | + ) -> str: | ||
| 208 | + """Returns a fully-qualified external_system string.""" | ||
| 209 | + return "organizations/{organization}/sources/{source}/findings/{finding}/externalSystems/{externalsystem}".format( | ||
| 210 | + organization=organization, | ||
| 211 | + source=source, | ||
| 212 | + finding=finding, | ||
| 213 | + externalsystem=externalsystem, | ||
| 214 | + ) | ||
| 215 | + | ||
| 216 | + @staticmethod | ||
| 217 | + def parse_external_system_path(path: str) -> Dict[str, str]: | ||
| 218 | + """Parses a external_system path into its component segments.""" | ||
| 219 | + m = re.match( | ||
| 220 | + r"^organizations/(?P<organization>.+?)/sources/(?P<source>.+?)/findings/(?P<finding>.+?)/externalSystems/(?P<externalsystem>.+?)$", | ||
| 221 | + path, | ||
| 222 | + ) | ||
| 223 | + return m.groupdict() if m else {} | ||
| 224 | + | ||
| 203 | 225 | @staticmethod | |
| 204 | 226 | def finding_path(organization: str, source: str, finding: str,) -> str: | |
| 205 | 227 | """Returns a fully-qualified finding string.""" | |
@@ -2584,6 +2606,91 @@ def test_iam_permissions( | |||
| 2584 | 2606 | # Done; return the response. | |
| 2585 | 2607 | return response | |
| 2586 | 2608 | ||
| 2609 | + def update_external_system( | ||
| 2610 | + self, | ||
| 2611 | + request: Union[securitycenter_service.UpdateExternalSystemRequest, dict] = None, | ||
| 2612 | + *, | ||
| 2613 | + external_system: gcs_external_system.ExternalSystem = None, | ||
| 2614 | + update_mask: field_mask_pb2.FieldMask = None, | ||
| 2615 | + retry: OptionalRetry = gapic_v1.method.DEFAULT, | ||
| 2616 | + timeout: float = None, | ||
| 2617 | + metadata: Sequence[Tuple[str, str]] = (), | ||
| 2618 | + ) -> gcs_external_system.ExternalSystem: | ||
| 2619 | + r"""Updates external system. This is for a given finding. | ||
| 2620 | + | ||
| 2621 | + Args: | ||
| 2622 | + request (Union[google.cloud.securitycenter_v1.types.UpdateExternalSystemRequest, dict]): | ||
| 2623 | + The request object. Request message for updating a | ||
| 2624 | + ExternalSystem resource. | ||
| 2625 | + external_system (google.cloud.securitycenter_v1.types.ExternalSystem): | ||
| 2626 | + Required. The external system | ||
| 2627 | + resource to update. | ||
| 2628 | + | ||
| 2629 | + This corresponds to the ``external_system`` field | ||
| 2630 | + on the ``request`` instance; if ``request`` is provided, this | ||
| 2631 | + should not be set. | ||
| 2632 | + update_mask (google.protobuf.field_mask_pb2.FieldMask): | ||
| 2633 | + The FieldMask to use when updating | ||
| 2634 | + the external system resource. | ||
| 2635 | + If empty all mutable fields will be | ||
| 2636 | + updated. | ||
| 2637 | + | ||
| 2638 | + This corresponds to the ``update_mask`` field | ||
| 2639 | + on the ``request`` instance; if ``request`` is provided, this | ||
| 2640 | + should not be set. | ||
| 2641 | + retry (google.api_core.retry.Retry): Designation of what errors, if any, | ||
| 2642 | + should be retried. | ||
| 2643 | + timeout (float): The timeout for this request. | ||
| 2644 | + metadata (Sequence[Tuple[str, str]]): Strings which should be | ||
| 2645 | + sent along with the request as metadata. | ||
| 2646 | + | ||
| 2647 | + Returns: | ||
| 2648 | + google.cloud.securitycenter_v1.types.ExternalSystem: | ||
| 2649 | + Representation of third party | ||
| 2650 | + SIEM/SOAR fields within SCC. | ||
| 2651 | + | ||
| 2652 | + """ | ||
| 2653 | + # Create or coerce a protobuf request object. | ||
| 2654 | + # Sanity check: If we got a request object, we should *not* have | ||
| 2655 | + # gotten any keyword arguments that map to the request. | ||
| 2656 | + has_flattened_params = any([external_system, update_mask]) | ||
| 2657 | + if request is not None and has_flattened_params: | ||
| 2658 | + raise ValueError( | ||
| 2659 | + "If the `request` argument is set, then none of " | ||
| 2660 | + "the individual field arguments should be set." | ||
| 2661 | + ) | ||
| 2662 | + | ||
| 2663 | + # Minor optimization to avoid making a copy if the user passes | ||
| 2664 | + # in a securitycenter_service.UpdateExternalSystemRequest. | ||
| 2665 | + # There's no risk of modifying the input as we've already verified | ||
| 2666 | + # there are no flattened fields. | ||
| 2667 | + if not isinstance(request, securitycenter_service.UpdateExternalSystemRequest): | ||
| 2668 | + request = securitycenter_service.UpdateExternalSystemRequest(request) | ||
| 2669 | + # If we have keyword arguments corresponding to fields on the | ||
| 2670 | + # request, apply these. | ||
| 2671 | + if external_system is not None: | ||
| 2672 | + request.external_system = external_system | ||
| 2673 | + if update_mask is not None: | ||
| 2674 | + request.update_mask = update_mask | ||
| 2675 | + | ||
| 2676 | + # Wrap the RPC method; this adds retry and timeout information, | ||
| 2677 | + # and friendly error handling. | ||
| 2678 | + rpc = self._transport._wrapped_methods[self._transport.update_external_system] | ||
| 2679 | + | ||
| 2680 | + # Certain fields should be provided within the metadata header; | ||
| 2681 | + # add these here. | ||
| 2682 | + metadata = tuple(metadata) + ( | ||
| 2683 | + gapic_v1.routing_header.to_grpc_metadata( | ||
| 2684 | + (("external_system.name", request.external_system.name),) | ||
| 2685 | + ), | ||
| 2686 | + ) | ||
| 2687 | + | ||
| 2688 | + # Send the request. | ||
| 2689 | + response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) | ||
| 2690 | + | ||
| 2691 | + # Done; return the response. | ||
| 2692 | + return response | ||
| 2693 | + | ||
| 2587 | 2694 | def update_finding( | |
| 2588 | 2695 | self, | |
| 2589 | 2696 | request: Union[securitycenter_service.UpdateFindingRequest, dict] = None, | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -26,6 +26,7 @@ | |||
| 26 | 26 | from google.auth import credentials as ga_credentials # type: ignore | |
| 27 | 27 | from google.oauth2 import service_account # type: ignore | |
| 28 | 28 | ||
| 29 | + from google.cloud.securitycenter_v1.types import external_system as gcs_external_system | ||
| 29 | 30 | from google.cloud.securitycenter_v1.types import finding | |
| 30 | 31 | from google.cloud.securitycenter_v1.types import finding as gcs_finding | |
| 31 | 32 | from google.cloud.securitycenter_v1.types import mute_config | |
@@ -349,6 +350,11 @@ def _prep_wrapped_messages(self, client_info): | |||
| 349 | 350 | default_timeout=60.0, | |
| 350 | 351 | client_info=client_info, | |
| 351 | 352 | ), | |
| 353 | + self.update_external_system: gapic_v1.method.wrap_method( | ||
| 354 | + self.update_external_system, | ||
| 355 | + default_timeout=None, | ||
| 356 | + client_info=client_info, | ||
| 357 | + ), | ||
| 352 | 358 | self.update_finding: gapic_v1.method.wrap_method( | |
| 353 | 359 | self.update_finding, default_timeout=60.0, client_info=client_info, | |
| 354 | 360 | ), | |
@@ -638,6 +644,18 @@ def test_iam_permissions( | |||
| 638 | 644 | ]: | |
| 639 | 645 | raise NotImplementedError() | |
| 640 | 646 | ||
| 647 | + @property | ||
| 648 | + def update_external_system( | ||
| 649 | + self, | ||
| 650 | + ) -> Callable[ | ||
| 651 | + [securitycenter_service.UpdateExternalSystemRequest], | ||
| 652 | + Union[ | ||
| 653 | + gcs_external_system.ExternalSystem, | ||
| 654 | + Awaitable[gcs_external_system.ExternalSystem], | ||
| 655 | + ], | ||
| 656 | + ]: | ||
| 657 | + raise NotImplementedError() | ||
| 658 | + | ||
| 641 | 659 | @property | |
| 642 | 660 | def update_finding( | |
| 643 | 661 | self, | |
| Back | FazBrowse Home | New Git URL |
0 commit comments