Skip to content
This repository has been archived by the owner on Sep 5, 2023. It is now read-only.

Commit

Permalink
feat: Add connection and description field to finding's list of attri…
Browse files Browse the repository at this point in the history
…butes (#323)

* feat: Add connection and description field to finding's list of attributes

PiperOrigin-RevId: 442589635

Source-Link: googleapis/googleapis@50fc834

Source-Link: googleapis/googleapis-gen@86cc920
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiODZjYzkyMDUyOWIwODc3YmE4MTIxNmI1MmQ5OTVjZTRkZDJmOGI0ZiJ9

* 🦉 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 <gcf-owl-bot[bot]@users.noreply.github.com>
  • Loading branch information
gcf-owl-bot[bot] and gcf-owl-bot[bot] committed Apr 18, 2022
1 parent 7479463 commit 3a9e9bd
Show file tree
Hide file tree
Showing 8 changed files with 121 additions and 0 deletions.
2 changes: 2 additions & 0 deletions google/cloud/securitycenter/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
from google.cloud.securitycenter_v1.types.access import Geolocation
from google.cloud.securitycenter_v1.types.asset import Asset
from google.cloud.securitycenter_v1.types.bigquery_export import BigQueryExport
from google.cloud.securitycenter_v1.types.connection import Connection
from google.cloud.securitycenter_v1.types.external_system import ExternalSystem
from google.cloud.securitycenter_v1.types.finding import Finding
from google.cloud.securitycenter_v1.types.folder import Folder
Expand Down Expand Up @@ -180,6 +181,7 @@
"Geolocation",
"Asset",
"BigQueryExport",
"Connection",
"ExternalSystem",
"Finding",
"Folder",
Expand Down
2 changes: 2 additions & 0 deletions google/cloud/securitycenter_v1/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
from .types.access import Geolocation
from .types.asset import Asset
from .types.bigquery_export import BigQueryExport
from .types.connection import Connection
from .types.external_system import ExternalSystem
from .types.finding import Finding
from .types.folder import Folder
Expand Down Expand Up @@ -90,6 +91,7 @@
"BigQueryExport",
"BulkMuteFindingsRequest",
"BulkMuteFindingsResponse",
"Connection",
"CreateBigQueryExportRequest",
"CreateFindingRequest",
"CreateMuteConfigRequest",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
from google.cloud.securitycenter_v1.services.security_center import pagers
from google.cloud.securitycenter_v1.types import access
from google.cloud.securitycenter_v1.types import bigquery_export
from google.cloud.securitycenter_v1.types import connection
from google.cloud.securitycenter_v1.types import external_system as gcs_external_system
from google.cloud.securitycenter_v1.types import finding
from google.cloud.securitycenter_v1.types import finding as gcs_finding
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
from google.cloud.securitycenter_v1.services.security_center import pagers
from google.cloud.securitycenter_v1.types import access
from google.cloud.securitycenter_v1.types import bigquery_export
from google.cloud.securitycenter_v1.types import connection
from google.cloud.securitycenter_v1.types import external_system as gcs_external_system
from google.cloud.securitycenter_v1.types import finding
from google.cloud.securitycenter_v1.types import finding as gcs_finding
Expand Down
4 changes: 4 additions & 0 deletions google/cloud/securitycenter_v1/types/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@
from .bigquery_export import (
BigQueryExport,
)
from .connection import (
Connection,
)
from .external_system import (
ExternalSystem,
)
Expand Down Expand Up @@ -122,6 +125,7 @@
"Geolocation",
"Asset",
"BigQueryExport",
"Connection",
"ExternalSystem",
"Finding",
"Folder",
Expand Down
79 changes: 79 additions & 0 deletions google/cloud/securitycenter_v1/types/connection.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
# -*- 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.
#
import proto # type: ignore


__protobuf__ = proto.module(
package="google.cloud.securitycenter.v1",
manifest={
"Connection",
},
)


class Connection(proto.Message):
r"""Contains information about the IP connection associated with
the finding.
Attributes:
destination_ip (str):
Destination IP address. Not present for
sockets that are listening and not connected.
destination_port (int):
Destination port. Not present for sockets
that are listening and not connected.
source_ip (str):
Source IP address.
source_port (int):
Source port.
protocol (google.cloud.securitycenter_v1.types.Connection.Protocol):
IANA Internet Protocol Number such as TCP(6)
and UDP(17).
"""

class Protocol(proto.Enum):
r"""IANA Internet Protocol Number such as TCP(6) and UDP(17)."""
PROTOCOL_UNSPECIFIED = 0
ICMP = 1
TCP = 6
UDP = 17
GRE = 47
ESP = 50

destination_ip = proto.Field(
proto.STRING,
number=1,
)
destination_port = proto.Field(
proto.INT32,
number=2,
)
source_ip = proto.Field(
proto.STRING,
number=3,
)
source_port = proto.Field(
proto.INT32,
number=4,
)
protocol = proto.Field(
proto.ENUM,
number=5,
enum=Protocol,
)


__all__ = tuple(sorted(__protobuf__.manifest))
15 changes: 15 additions & 0 deletions google/cloud/securitycenter_v1/types/finding.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import proto # type: ignore

from google.cloud.securitycenter_v1.types import access as gcs_access
from google.cloud.securitycenter_v1.types import connection
from google.cloud.securitycenter_v1.types import external_system
from google.cloud.securitycenter_v1.types import iam_binding
from google.cloud.securitycenter_v1.types import indicator as gcs_indicator
Expand Down Expand Up @@ -141,12 +142,17 @@ class Finding(proto.Message):
Access details associated to the Finding,
such as more information on the caller, which
method was accessed, from where, etc.
connections (Sequence[google.cloud.securitycenter_v1.types.Connection]):
Contains information about the IP connection
associated with the finding.
mute_initiator (str):
First known as mute_annotation. Records additional
information about the mute operation e.g. mute config that
muted the finding, user who muted the finding, etc. Unlike
other attributes of a finding, a finding provider shouldn't
set the value of mute.
description (str):
Contains more detail about the finding.
iam_bindings (Sequence[google.cloud.securitycenter_v1.types.IamBinding]):
Represents IAM bindings associated with the
Finding.
Expand Down Expand Up @@ -280,10 +286,19 @@ class FindingClass(proto.Enum):
number=26,
message=gcs_access.Access,
)
connections = proto.RepeatedField(
proto.MESSAGE,
number=31,
message=connection.Connection,
)
mute_initiator = proto.Field(
proto.STRING,
number=28,
)
description = proto.Field(
proto.STRING,
number=37,
)
iam_bindings = proto.RepeatedField(
proto.MESSAGE,
number=39,
Expand Down
17 changes: 17 additions & 0 deletions tests/unit/gapic/securitycenter_v1/test_security_center.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
from google.cloud.securitycenter_v1.services.security_center import transports
from google.cloud.securitycenter_v1.types import access
from google.cloud.securitycenter_v1.types import bigquery_export
from google.cloud.securitycenter_v1.types import connection
from google.cloud.securitycenter_v1.types import external_system
from google.cloud.securitycenter_v1.types import external_system as gcs_external_system
from google.cloud.securitycenter_v1.types import finding
Expand Down Expand Up @@ -1209,6 +1210,7 @@ def test_create_finding(request_type, transport: str = "grpc"):
mute=gcs_finding.Finding.Mute.MUTED,
finding_class=gcs_finding.Finding.FindingClass.THREAT,
mute_initiator="mute_initiator_value",
description="description_value",
next_steps="next_steps_value",
)
response = client.create_finding(request)
Expand All @@ -1231,6 +1233,7 @@ def test_create_finding(request_type, transport: str = "grpc"):
assert response.mute == gcs_finding.Finding.Mute.MUTED
assert response.finding_class == gcs_finding.Finding.FindingClass.THREAT
assert response.mute_initiator == "mute_initiator_value"
assert response.description == "description_value"
assert response.next_steps == "next_steps_value"


Expand Down Expand Up @@ -1280,6 +1283,7 @@ async def test_create_finding_async(
mute=gcs_finding.Finding.Mute.MUTED,
finding_class=gcs_finding.Finding.FindingClass.THREAT,
mute_initiator="mute_initiator_value",
description="description_value",
next_steps="next_steps_value",
)
)
Expand All @@ -1303,6 +1307,7 @@ async def test_create_finding_async(
assert response.mute == gcs_finding.Finding.Mute.MUTED
assert response.finding_class == gcs_finding.Finding.FindingClass.THREAT
assert response.mute_initiator == "mute_initiator_value"
assert response.description == "description_value"
assert response.next_steps == "next_steps_value"


Expand Down Expand Up @@ -7098,6 +7103,7 @@ def test_set_finding_state(request_type, transport: str = "grpc"):
mute=finding.Finding.Mute.MUTED,
finding_class=finding.Finding.FindingClass.THREAT,
mute_initiator="mute_initiator_value",
description="description_value",
next_steps="next_steps_value",
)
response = client.set_finding_state(request)
Expand All @@ -7120,6 +7126,7 @@ def test_set_finding_state(request_type, transport: str = "grpc"):
assert response.mute == finding.Finding.Mute.MUTED
assert response.finding_class == finding.Finding.FindingClass.THREAT
assert response.mute_initiator == "mute_initiator_value"
assert response.description == "description_value"
assert response.next_steps == "next_steps_value"


Expand Down Expand Up @@ -7173,6 +7180,7 @@ async def test_set_finding_state_async(
mute=finding.Finding.Mute.MUTED,
finding_class=finding.Finding.FindingClass.THREAT,
mute_initiator="mute_initiator_value",
description="description_value",
next_steps="next_steps_value",
)
)
Expand All @@ -7196,6 +7204,7 @@ async def test_set_finding_state_async(
assert response.mute == finding.Finding.Mute.MUTED
assert response.finding_class == finding.Finding.FindingClass.THREAT
assert response.mute_initiator == "mute_initiator_value"
assert response.description == "description_value"
assert response.next_steps == "next_steps_value"


Expand Down Expand Up @@ -7403,6 +7412,7 @@ def test_set_mute(request_type, transport: str = "grpc"):
mute=finding.Finding.Mute.MUTED,
finding_class=finding.Finding.FindingClass.THREAT,
mute_initiator="mute_initiator_value",
description="description_value",
next_steps="next_steps_value",
)
response = client.set_mute(request)
Expand All @@ -7425,6 +7435,7 @@ def test_set_mute(request_type, transport: str = "grpc"):
assert response.mute == finding.Finding.Mute.MUTED
assert response.finding_class == finding.Finding.FindingClass.THREAT
assert response.mute_initiator == "mute_initiator_value"
assert response.description == "description_value"
assert response.next_steps == "next_steps_value"


Expand Down Expand Up @@ -7473,6 +7484,7 @@ async def test_set_mute_async(
mute=finding.Finding.Mute.MUTED,
finding_class=finding.Finding.FindingClass.THREAT,
mute_initiator="mute_initiator_value",
description="description_value",
next_steps="next_steps_value",
)
)
Expand All @@ -7496,6 +7508,7 @@ async def test_set_mute_async(
assert response.mute == finding.Finding.Mute.MUTED
assert response.finding_class == finding.Finding.FindingClass.THREAT
assert response.mute_initiator == "mute_initiator_value"
assert response.description == "description_value"
assert response.next_steps == "next_steps_value"


Expand Down Expand Up @@ -8480,6 +8493,7 @@ def test_update_finding(request_type, transport: str = "grpc"):
mute=gcs_finding.Finding.Mute.MUTED,
finding_class=gcs_finding.Finding.FindingClass.THREAT,
mute_initiator="mute_initiator_value",
description="description_value",
next_steps="next_steps_value",
)
response = client.update_finding(request)
Expand All @@ -8502,6 +8516,7 @@ def test_update_finding(request_type, transport: str = "grpc"):
assert response.mute == gcs_finding.Finding.Mute.MUTED
assert response.finding_class == gcs_finding.Finding.FindingClass.THREAT
assert response.mute_initiator == "mute_initiator_value"
assert response.description == "description_value"
assert response.next_steps == "next_steps_value"


Expand Down Expand Up @@ -8551,6 +8566,7 @@ async def test_update_finding_async(
mute=gcs_finding.Finding.Mute.MUTED,
finding_class=gcs_finding.Finding.FindingClass.THREAT,
mute_initiator="mute_initiator_value",
description="description_value",
next_steps="next_steps_value",
)
)
Expand All @@ -8574,6 +8590,7 @@ async def test_update_finding_async(
assert response.mute == gcs_finding.Finding.Mute.MUTED
assert response.finding_class == gcs_finding.Finding.FindingClass.THREAT
assert response.mute_initiator == "mute_initiator_value"
assert response.description == "description_value"
assert response.next_steps == "next_steps_value"


Expand Down

0 comments on commit 3a9e9bd

Please sign in to comment.