cloud_scanner.services package

Submodules

cloud_scanner.services.resource_scanner module

class cloud_scanner.services.resource_scanner.ResourceScanner

Bases: object

Scan cloud service for resources.

static process_queue_message(message)

Receives message from queue, which tells it which resources to scan from cloud provider.

Parameters:message – Task of which resources to scan
Returns:List of resources scanned from cloud provider
class cloud_scanner.services.resource_scanner.ResourceTaskProcessor(resource_service: cloud_scanner.contracts.resource_service.ResourceService, output_queue: cloud_scanner.contracts.queue.Queue)

Bases: object

Process resource scanning tasks and return as dictionaries.

execute(task)

Execute scanning of resources.

Parameters:task – Defines which resources to scan
Returns:List of resources as dictionaries

cloud_scanner.services.resource_storage module

class cloud_scanner.services.resource_storage.ResourceStorage

Bases: object

Store resources from scanning.

static process_queue_message(message)

Receives resources from queue and stores in registered service.

Parameters:message – Payload of resources to store
Returns:Number of resources stored in service

cloud_scanner.services.resource_tagger module

class cloud_scanner.services.resource_tagger.ResourceTagProcessor(resource_service: cloud_scanner.contracts.resource_service.ResourceService)

Bases: object

Writes tags to cloud resources.

execute(resource: cloud_scanner.contracts.resource.Resource, tags: dict, overwrite=False)

Execute tagging of resource.

Parameters:
  • resource – Resource to tag
  • tags – tags to apply
  • overwrite – True if overwrite of existing tags is desired, default False
reset()

Reset the tags written and tags skipped to 0.

tags_skipped
Returns:int number of tags skipped
tags_written
Returns:int number of tags written
class cloud_scanner.services.resource_tagger.ResourceTagger

Bases: object

Tag resources within cloud provider.

static process_queue_message(message)

Apply tags to resources specified by message.

Parameters:message – Payload of resources
Returns:Tags written, tags skipped
static process_tag_rules()

Get rules from rules factory and run them.

Returns:Number of matches found and applied tags to

cloud_scanner.services.task_scheduler module

class cloud_scanner.services.task_scheduler.TaskScheduler

Bases: object

Schedule tasks for resource scanning.

static execute()

Execute scheduling of tasks.

Returns:int number of tasks scheduled

Module contents