cloud_scanner.simulators package¶
Submodules¶
cloud_scanner.simulators.account_service_simulator module¶
-
class
cloud_scanner.simulators.account_service_simulator.
AccountServiceSimulator
¶ Bases:
cloud_scanner.contracts.account_service.AccountService
Simulator of AccoutService.
-
get_accounts
()¶ Get fake accounts.
Returns: List of fake accounts - [
- {
- ‘subscriptionId’: ‘…’, ‘displayName’: ‘…’
]
-
cloud_scanner.simulators.container_storage_simulator module¶
-
class
cloud_scanner.simulators.container_storage_simulator.
MockBlobStorageOutput
(name, content)¶ Bases:
object
Simulator of blob storage output.
-
content
¶ Returns: str Content of blob file
-
name
¶ Returns: str Name of blob file
-
-
class
cloud_scanner.simulators.container_storage_simulator.
MockBlobStorageSimulator
¶ Bases:
cloud_scanner.contracts.storage_container.StorageContainer
Simulator of BlobStorage.
-
get_blob_to_text
(config)¶ Parameters: config – Config file to get text from Returns: Text contained in config
-
get_latest_config
()¶ Returns: Latest config file
-
list_blobs
()¶ Returns: List of blob files
-
upload_text
(filename, text)¶ Fake call to upload text.
Parameters: - filename – name of new config file
- text – text to put in config file
Returns: None
-
cloud_scanner.simulators.queue_simulator module¶
-
class
cloud_scanner.simulators.queue_simulator.
QueueSimulator
(queue_name, config=None)¶ Bases:
cloud_scanner.contracts.queue.Queue
Simulator of queue service.
-
peek
()¶ Peek at message, but don’t pop.
Returns: Message peeked
-
pop
()¶ Pop message off of queue.
Returns: Message popped
-
push
(message)¶ Push new message to queue.
Parameters: message – message to push Returns: None
-
cloud_scanner.simulators.resource_service_simulator module¶
-
class
cloud_scanner.simulators.resource_service_simulator.
ResourceServiceSimulator
¶ Bases:
cloud_scanner.contracts.resource_service.ResourceService
Simulator of resource service.
-
get_filter
(payload) → cloud_scanner.contracts.resource_service.ResourceFilter¶ Get filter object based on payload Not implemented in this class.
-
get_resources
(filter: cloud_scanner.contracts.resource_service.ResourceFilter = None)¶ Get list of AzureResources from service.
Parameters: filter – Filter object to filter resources Returns: List of AzureResource objects
-
name
¶ Returns: ‘simulator’
-
resources
= [{'id': '/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/yyyyyyyyyyyy/providers/microsoft.insights/components/wwwwwwwwwwww', 'name': 'wwwwwwwwwwww', 'type': 'microsoft.insights/components', 'location': 'southcentralus', 'tags': {'hidden-link:/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/yyyyyyyyyyyy/providers/Microsoft.Web/sites/wwwwwwwwwwww': 'Resource'}, 'kind': 'web'}, {'id': '/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/yyyyyyyyyyyy/providers/Microsoft.ServiceBus/namespaces/wwwwwwwwwwww', 'name': 'wwwwwwwwwwww', 'type': 'Microsoft.ServiceBus/namespaces', 'location': 'southcentralus', 'tags': {}, 'sku': {'name': 'Standard', 'tier': 'Standard'}}, {'id': '/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/yyyyyyyyyyyy/providers/Microsoft.Storage/storageAccounts/wwwwwwwwwwww', 'name': 'wwwwwwwwwwww', 'type': 'Microsoft.Storage/storageAccounts', 'location': 'southcentralus', 'tags': {}, 'kind': 'Storage', 'sku': {'name': 'Standard_LRS', 'tier': 'Standard'}}, {'id': '/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/yyyyyyyyyyyy/providers/Microsoft.Web/serverFarms/wwwwwwwwwwww', 'name': 'wwwwwwwwwwww', 'type': 'Microsoft.Web/serverFarms', 'location': 'southcentralus', 'kind': 'functionapp'}, {'id': '/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/yyyyyyyyyyyy/providers/Microsoft.Web/sites/wwwwwwwwwwww', 'name': 'wwwwwwwwwwww', 'type': 'Microsoft.Web/sites', 'location': 'southcentralus', 'kind': 'functionapp'}]¶
-
update_resource
(resource)¶ Update resource within cloud service provider Not implemented in this class.
-
cloud_scanner.simulators.table_storage_simulator module¶
-
class
cloud_scanner.simulators.table_storage_simulator.
TableStorageSimulator
¶ Bases:
cloud_scanner.contracts.table_storage.TableStorage
Simulator of TableStorage service.
-
delete
(partition_key, row_key)¶ Delete resource from storage.
Parameters: - partition_key – Partition key of resource
- row_key – Row key of resource
Returns: None
-
query
(partition_key, row_key)¶ Get element from table storage.
Parameters: - partition_key – Partition key of resource
- row_key – Row key of resource
Returns: Resource if found
-
query_list
()¶ Get all resources in storage.
Returns: List of Resource objects
-
write
(resource)¶ Write resource to storage.
Parameters: resource – Resource to write Returns: None
-