mirror of
https://github.com/prowler-cloud/prowler.git
synced 2026-07-23 20:42:02 +00:00
feat(azure): include resource metadata in Check_Report_Azure (#6505)
This commit is contained in:
committed by
Pepe Fagoaga
parent
66e8f0ce18
commit
27d27fff81
@@ -5,7 +5,7 @@ import sys
|
||||
from abc import ABC, abstractmethod
|
||||
from dataclasses import dataclass
|
||||
from enum import Enum
|
||||
from typing import Set
|
||||
from typing import Any, Set
|
||||
|
||||
from pydantic import BaseModel, ValidationError, validator
|
||||
|
||||
@@ -453,12 +453,34 @@ class Check_Report_Azure(Check_Report):
|
||||
subscription: str
|
||||
location: str
|
||||
|
||||
def __init__(self, metadata):
|
||||
super().__init__(metadata)
|
||||
self.resource_name = ""
|
||||
self.resource_id = ""
|
||||
def __init__(self, metadata: dict, resource_metadata: Any = None) -> None:
|
||||
"""Initialize the Azure Check's finding information.
|
||||
|
||||
Args:
|
||||
metadata: The metadata of the check.
|
||||
resource_metadata: Basic information about the resource. Defaults to None.
|
||||
"""
|
||||
super().__init__(metadata, resource_metadata)
|
||||
self.resource_name = (
|
||||
resource_metadata.name
|
||||
if hasattr(resource_metadata, "name")
|
||||
else (
|
||||
resource_metadata.resource_name
|
||||
if hasattr(resource_metadata, "resource_name")
|
||||
else ""
|
||||
)
|
||||
)
|
||||
self.resource_id = (
|
||||
resource_metadata.id
|
||||
if hasattr(resource_metadata, "id")
|
||||
else (
|
||||
resource_metadata.resource_id
|
||||
if hasattr(resource_metadata, "resource_id")
|
||||
else ""
|
||||
)
|
||||
)
|
||||
self.subscription = ""
|
||||
self.location = "global"
|
||||
self.location = getattr(resource_metadata, "location", "global")
|
||||
|
||||
|
||||
@dataclass
|
||||
|
||||
Reference in New Issue
Block a user