mage.api_resources.asset module¶
-
class
mage.api_resources.asset.Asset¶ Bases:
mage.api_resources.abstract.listable_api_resource.ListableAPIResource,mage.api_resources.abstract.mutable_api_resource.MutableAPIResource-
id¶ Unique asset ID
- Type
str
-
created_at¶ When the asset was created (e.g., ‘2020-01-02T03:04:56.789Z’)
- Type
str
-
updated_at¶ When the asset was last updated (e.g., ‘2020-01-02T03:04:56.789Z’)
- Type
str
-
asset_type¶ Type of the asset (e.g., ‘IP_ADDRESS’)
-
asset_identifier¶ Identifier of the asset (e.g., ‘192.168.1.1’)
- Type
str
-
asset_source¶ How this asset was created (customer defined vs discovered)
One or more labels or identifiers using arbitrary values (e.g., ‘app-prod’, ‘app-dev’, etc.)
- Type
list of str
-
criticality¶ An integer value that represents the potential impact that the loss or compromise of the asset would have. 1 is the default (lowest) criticality. 5 is the most impactful.
- Type
int
-
property
assessments¶ Associated assessments.
- Returns
-
property
asset_groups¶ Associated asset groups.
- Returns
-
connect(item=None, assessment_id=None, assessment_run_id=None, asset_group_id=None)¶ Connect an asset to an assessment, assessment run, or asset group
- Parameters
item (object, optional) – Assessment or AssessmentRun or AssetGroup to connect the asset to
assessment_id (str, optional) – ID of the assessment to connect the asset to
assessment_run_id (str, optional) – ID of the assessment run to connect the asset to
asset_group_id (str, optional) – ID of the asset group to connect the asset to
- Returns
AssessmentAssetConnectionorAssetGroupConnectionorAssessmentRunAssetConnection
Example
>>> import mage >>> mage.connect() >>> asset = mage.Asset.eq(asset_identifier='www.example.com')[0] >>> asset.connect(mage.Assessment.last()[0]) >>> ar = mage.AssessmentRun.last()[0] >>> asset.connect(assessment_run_id=ar.id)
-
property
connections¶ Asset relationships.
- Returns
-
classmethod
create(asset_type, id, **kwargs)¶ Creates a new asset.
- Parameters
asset_type (mage.schema.AssetType) – Type of asset to create
id (str) – Asset identifier
**kwargs – Additional arguments to initialize the asset with.
- Returns
The created asset
- Return type
Example
>>> import mage >>> mage.connect() >>> mage.Asset.create('IP_ADDRESS', '192.168.1.1')
-
property
credentials¶ Associated credentials.
- Returns
-
property
findings¶ Associated findings.
- Returns
-