IntersightApiClient
from intersight.apis import
equipment_device_summary_api
# Create an Intersight API Client instance
API_INSTANCE = IntersightApiClient(
host="https://intersight.com/api/v1",\
private_key="/Path_to/SecretKey.txt",\
api_key_id="your_own_api_key_id")
# Create an equipment device handle
D_HANDLE =
equipment_device_summary_api.EquipmentDeviceSummaryApi(API_INSTANCE)
DEVICES =
D_HANDLE.equipment_device_summaries_get().results
print('{0:35s}{1:40s}{2:13s}{3:14s}'.format(
"DN",
"MODEL",
"SERIAL",
"OBJECT TYPE"))
print('-'* 105 )
# Loop through devices and extract data
for DEVICE in DEVICES:
print('{0:35s}{1:40s}{2:13s}
{3:14s}'.format(
DEVICE.dn,
DEVICE.model,
DEVICE.serial,
DEVICE.source_object_type))
The first two lines of Example 9-16 use the import
keyword to bring in and make available for later
consumption the IntersightApiClient Python class
that will be used to create a connection to the Cisco
Intersight platform and the
equipment_device_summary_api file, which
contains Python objects that are useful for retrieving
equipment that is being managed by Intersight. Every
Cisco Intersight REST API endpoint has a corresponding
Python file containing classes and methods that can be
used to programmatically process those REST API
endpoints. Next, an instance of the
IntersightApiClient class is created in order to