Image Class
Interact with Images
Constructor
Image(freta)
Methods
| analyze |
Analyze (or re-analyze) an uploaded image. TODO example |
| cancel_analysis |
Cancel analyze an uploaded image. TODO example |
| delete |
Delete an image along with any of its generated reports and other artifacts. |
| formats |
Get the list of currently supported image formats. Example result:
|
| list |
Get the list of images and their statuses. Example result:
|
| search_filters |
Lists the currently supported search filters. Example result:
|
| status |
Get the status of a single image. Example result:
|
| update |
Update metadata for an image. TODO example |
| upload |
Upload an image file and submit it for analysis. Example result:
|
| upload_sas |
Obtain SAS URIs authorizing (only) upload of an image and a profile. This method does not queue the image for analysis. Call self.analyze() with the returned image_id after writing the image data. Example result:
|
analyze
Analyze (or re-analyze) an uploaded image.
TODO example
analyze(image_id: str, owner_id: typing.Union[str, NoneType] = None)
Parameters
| Name | Description |
|---|---|
|
image_id
Required
|
Image identifier. |
|
owner_id
Required
|
For group-owned images, userid of the image owner. |
Returns
| Type | Description |
|---|---|
|
True |
cancel_analysis
Cancel analyze an uploaded image.
TODO example
cancel_analysis(image_id: str, owner_id: typing.Union[str, NoneType] = None)
Parameters
| Name | Description |
|---|---|
|
image_id
Required
|
Image identifier. |
|
owner_id
Required
|
For group-owned images, userid of the image owner. |
Returns
| Type | Description |
|---|---|
|
True |
delete
Delete an image along with any of its generated reports and other artifacts.
delete(image_id: str, owner_id: typing.Union[str, NoneType] = None)
Parameters
| Name | Description |
|---|---|
|
image_id
Required
|
Freta identifier for the image. |
|
owner_id
Required
|
Optional userid of the image owner (For group owned images) |
Returns
| Type | Description |
|---|---|
|
True |
formats
Get the list of currently supported image formats.
Example result:
{
"lime": "LiME image",
"raw": "Raw Physical Memory Dump",
"vmrs": "Hyper-V Memory Snapshot"
}
formats()
Returns
| Type | Description |
|---|---|
|
dict |
list
Get the list of images and their statuses.
Example result:
[
{
"Timestamp": "2019-05-13 18:50:01",
"image_id": "7fe75a61-b346-4a64-81f1-6389d12901f2",
"image_type": "lime",
"machine_id": "ubuntu-16.04-4.15.0-1040-azure",
"owner_id": "986c3ebe-18e9-4c89-afad-1178c21603e1",
"region": "eastus",
"state": "Report available"
}
]
list(search_filter: typing.Union[str, NoneType] = None)
Parameters
| Name | Description |
|---|---|
|
search_filter
Required
|
Filter search results, call <xref:freta.Freta.search_filters> for allowed values. |
Returns
| Type | Description |
|---|---|
|
List of dicts having keys as shown below. |
search_filters
Lists the currently supported search filters.
Example result:
[
"my_images",
"my_images_and_samples"
]
search_filters()
Returns
| Type | Description |
|---|---|
|
[str] |
status
Get the status of a single image.
Example result:
{
"Timestamp": "2019-06-11 19:03:17",
"analysis_version": "0.0.0",
"image_id": "23ca6dbe-4c6f-41c0-898e-82cdd56fcf4e",
"image_type": "vmrs",
"machine_id": "testing_upload_sas",
"owner_id": "309fc32f-a06b-4821-a97b-194c271f9cc5",
"region": "australiaeast",
"state": "Upload started"
}
status(image_id: str, owner_id: typing.Union[str, NoneType] = None)
Parameters
| Name | Description |
|---|---|
|
image_id
Required
|
Freta identifier for the image. |
|
owner_id
Required
|
userid of the image owner (For group-owned images) |
Returns
| Type | Description |
|---|---|
|
dict |
update
Update metadata for an image.
TODO example
update(image_id: str, owner_id: typing.Union[str, NoneType] = None, name: typing.Union[str, NoneType] = None)
Parameters
| Name | Description |
|---|---|
|
image_id
Required
|
Freta identifier for the image |
|
owner_id
Required
|
For group owned images, the userid of the image owner. |
|
name
Required
|
Optionally set the user specified machine identifer for the image |
upload
Upload an image file and submit it for analysis.
Example result:
{
'image_id': '[guid string]',
'owner_id': '[guid string]'
}
upload(name: str, image_type: str, region: str, image: <function NewType.<locals>.new_type at 0x000001E3C872E840>, profile: typing.Union[File, NoneType] = None)
Parameters
| Name | Description |
|---|---|
|
name
Required
|
User-specified name for the image. |
|
image_type
Required
|
Format of the image. See <xref:freta.Freta.formats> for allowed values. |
|
region
Required
|
Region within which to store and process the image. See <xref:freta.Freta.regions> for allowed values. |
|
image
Required
|
Filesystem path to the image file. |
|
profile
Required
|
Filesystem path to kernel profile. (Optional) |
Returns
| Type | Description |
|---|---|
|
dict |
upload_sas
Obtain SAS URIs authorizing (only) upload of an image and a profile.
This method does not queue the image for analysis. Call self.analyze() with the returned image_id after writing the image data.
Example result:
{
"image": {
"sas_url": "https://fretaNNNN.blob.core.windows.net/..."
},
"image_id": "23ca6dbe-4c6f-41c0-898e-82cdd56fcf4e",
"profile": {
"sas_url": "https://fretaNNNN.blob.core.windows.net/..."
},
"result": True
}
upload_sas(name: str, image_type: str, region: str)
Parameters
| Name | Description |
|---|---|
|
name
Required
|
Name for the image. |
|
image_type
Required
|
Format of the image. See <xref:freta.Freta.formats> for allowed values. |
|
region
Required
|
Region within which to store and process the image. See Freta.regions for allowed values. TODO link |
Returns
| Type | Description |
|---|---|
|
dict |