Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[aws][feat] Add collection of GuardDuty resource #2255

Merged
merged 19 commits into from
Nov 1, 2024
Merged
Show file tree
Hide file tree
Changes from 17 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions plugins/aws/fix_plugin_aws/collector.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
backup,
bedrock,
scp,
guardduty,
inspector,
)
from fix_plugin_aws.resource.base import (
Expand Down Expand Up @@ -105,6 +106,7 @@
+ elb.resources
+ elbv2.resources
+ glacier.resources
+ guardduty.resources
+ kinesis.resources
+ kms.resources
+ lambda_.resources
Expand Down
18 changes: 9 additions & 9 deletions plugins/aws/fix_plugin_aws/resource/bedrock.py
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ def add_tags(job: AwsResource) -> None:
modelIdentifier=js["modelArn"],
):
if instance := cls.from_api(result, builder):
builder.add_node(instance, js)
builder.add_node(instance, result)
builder.submit_work(service_name, add_tags, instance)


Expand Down Expand Up @@ -505,7 +505,7 @@ def add_tags(job: AwsResource) -> None:
guardrailVersion=js["version"],
):
if instance := cls.from_api(result, builder):
builder.add_node(instance, js)
builder.add_node(instance, result)
builder.submit_work(service_name, add_tags, instance)


Expand Down Expand Up @@ -637,7 +637,7 @@ def add_tags(job: AwsResource) -> None:
jobIdentifier=js["jobArn"],
):
if instance := cls.from_api(result, builder):
builder.add_node(instance, js)
builder.add_node(instance, result)
builder.submit_work(service_name, add_tags, instance)


Expand Down Expand Up @@ -838,7 +838,7 @@ def add_tags(job: AwsResource) -> None:
jobIdentifier=js["jobArn"],
):
if instance := cls.from_api(result, builder):
builder.add_node(instance, js)
builder.add_node(instance, result)
builder.submit_work(service_name, add_tags, instance)


Expand Down Expand Up @@ -1037,7 +1037,7 @@ def add_tags(agent: AwsResource) -> None:
):
if instance := AwsBedrockAgent.from_api(result, builder):
instance.agent_version = js["latestAgentVersion"]
builder.add_node(instance, js)
builder.add_node(instance, result)
builder.submit_work("bedrock-agent", add_tags, instance)


Expand Down Expand Up @@ -1324,7 +1324,7 @@ def add_tags(knowledge_base: AwsResource) -> None:
knowledgeBaseId=js["knowledgeBaseId"],
):
if instance := cls.from_api(result, builder):
builder.add_node(instance, js)
builder.add_node(instance, result)
builder.submit_work(service_name, add_tags, instance)

@classmethod
Expand Down Expand Up @@ -1492,7 +1492,7 @@ def add_tags(prompt: AwsResource) -> None:
promptVersion=js["version"],
):
if instance := cls.from_api(result, builder):
builder.add_node(instance, js)
builder.add_node(instance, result)
builder.submit_work("bedrock-agent", add_tags, instance)


Expand Down Expand Up @@ -1822,7 +1822,7 @@ def collect_flow_versions(flow: AwsBedrockAgentFlow) -> None:
flowVersion=flow.version,
):
if instance := AwsBedrockAgentFlowVersion.from_api(result, builder):
builder.add_node(instance, js)
builder.add_node(instance, result)
builder.submit_work("bedrock-agent", add_tags, instance)

for js in json:
Expand All @@ -1834,7 +1834,7 @@ def collect_flow_versions(flow: AwsBedrockAgentFlow) -> None:
if instance := AwsBedrockAgentFlow.from_api(result, builder):
if not instance.version:
instance.version = js["version"]
builder.add_node(instance, js)
builder.add_node(instance, result)
builder.submit_work("bedrock-agent", add_tags, instance)
builder.submit_work("bedrock-agent", collect_flow_versions, instance)

Expand Down
3 changes: 1 addition & 2 deletions plugins/aws/fix_plugin_aws/resource/ecr.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

from fix_plugin_aws.resource.base import AwsResource, AwsApiSpec, GraphBuilder
from fix_plugin_aws.utils import ToDict
from fixlib.baseresources import HasResourcePolicy, ModelReference, PolicySource, PolicySourceKind
from fixlib.baseresources import HasResourcePolicy, PolicySource, PolicySourceKind
from fixlib.json import sort_json
from fixlib.json_bender import Bender, S, Bend
from fixlib.types import Json
Expand All @@ -34,7 +34,6 @@ class AwsEcrRepository(AwsResource, HasResourcePolicy):
_kind_service: ClassVar[Optional[str]] = service_name
_metadata: ClassVar[Dict[str, Any]] = {"icon": "repository", "group": "compute"}
_aws_metadata: ClassVar[Dict[str, Any]] = {"provider_link_tpl": "https://{region_id}.console.aws.amazon.com/ecr/repositories/{name}?region={region}", "arn_tpl": "arn:{partition}:ecr:{region}:{account}:repository/{name}"} # fmt: skip
_reference_kinds: ClassVar[ModelReference] = {}
api_spec: ClassVar[AwsApiSpec] = AwsApiSpec("ecr", "describe-repositories", "repositories")
public_spec: ClassVar[AwsApiSpec] = AwsApiSpec("ecr-public", "describe-repositories", "repositories")
mapping: ClassVar[Dict[str, Bender]] = {
Expand Down
Loading
Loading