mage.api_resources.asset_group module¶
-
class
mage.api_resources.asset_group.AssetGroup¶ Bases:
mage.api_resources.abstract.listable_api_resource.ListableAPIResource,mage.api_resources.abstract.mutable_api_resource.MutableAPIResourceA group of assets that can be connected to assessments.
-
created_at¶ When the asset group was created (e.g., ‘2020-01-02T03:04:56.789Z’)
- Type
str
-
id¶ Unique asset group ID (e.g., ‘11111111-1111-1111-1111-111111111111’)
- Type
str
-
name¶ Name of the group
- Type
str
-
updated_at¶ When the asset group was last updated (e.g., ‘2020-01-02T03:04:56.789Z’)
- Type
str
-
property
assessments¶ Associated assessments.
- Returns
-
property
assets¶ Associated assets.
- Returns
-
connect(item=None, assessment_id=None, asset_id=None)¶ Connect an asset group to an assessment or asset
- Parameters
item (object, optional) – Assessment or Asset to connect the group to
assessment_id (str, optional) – ID of the assessment to connect the group to
asset_id (str, optional) – ID of the asset to connect the group to
- Returns
Example
>>> import mage >>> mage.connect() >>> ag = mage.AssetGroup.eq(name='My Group')[0] >>> ag.connect(mage.Assessment.eq(name='MyAssessment')[0]) >>> ag.connect(asset_id=mage.Asset.eq(id='192.168.1.1')[0].id)
-
classmethod
create(name, **kwargs)¶ Creates an asset group.
- Parameters
name (str) – Name of the asset group
**kwargs – Additional arguments to initialize the asset group with.
- Returns
The created asset group
- Return type
Example
>>> import mage >>> mage.connect() >>> mage.AssetGroup.create('web servers')
-