cloud_scanner_azure.helpers package¶
Submodules¶
cloud_scanner_azure.helpers.extractors module¶
-
class
cloud_scanner_azure.helpers.extractors.
ResourceExtractors
¶ Bases:
object
Utility class for extracting components from an Azure Resource id.
- Attributes:
- provider_extractor: Regex for extracting the resource provider. type_extractor: Regex for extracting types from a resource provider. rg_sub_extractor: Regex for extracting the resource group and subscription id.
-
classmethod
get_resource_group
(resource_id)¶ Extracts the resource group from a resource id.
:param resource_id” resource id to extract from :return: resource group string or None
-
classmethod
get_resource_provider
(resource_id)¶ Extracts the resource provider from a resource id.
:param resource_id” resource id to extract from :return: resource provider string or None
-
classmethod
get_resource_type
(resource_id)¶ Extracts the resource type from a resource id.
:param resource_id” resource id to extract from :return: resource type string or None
-
classmethod
get_subscription
(resource_id)¶ Extracts the subscription id from a resource id.
:param resource_id” resource id to extract from :return: subscription id string or None
-
provider_extractor
= re.compile('(?!(?:\\/[^\\/]+\\/[^\\/]+)+\\/providers)\\/providers\\/([^\\/]+)((:?\\/[^\\/]+\\/[^\\/]+)*)$', re.IGNORECASE)¶
-
rg_sub_extractor
= re.compile('\\/subscriptions\\/([^\\/\\s]+)(?:\\/resourceGroups\\/([^\\/\\s]+))?', re.IGNORECASE)¶
-
type_extractor
= re.compile('\\/([^\\/]+)\\/([^\\/]+)', re.IGNORECASE)¶