intersight-rest
Cisco has released their new Intersight platform for managing UCS Server and Hyperflex Hyperconverged infrastructure from a SaaS based interface. With high security standards, forming and signing the RESTful API calls to Intersight can be a challenge, so this package was written to do all of that work for you. All you need to provide is your Public/Private keys generated from the Intersight interface, as well at the API endpoint you'd like to target. Optionally you can add in query parameters for GET requests, and a body for POST/PATCH opterations.
Overview:
intersight_call(**options);
| Option | Format | Value |
|---|---|---|
| resource_path | <String> | Resource Path from https://intersight.com/apidocs |
| query_params | <Dict> | Query Parameters from Resource Path GET |
| body | <Dict> | Body Parameters from Resource Path POST |
| moid | <String> | MOID of Object to be Modified |
The HTTP verbs will be assumed as follows:
- GET: <resource_path>
- GET: <resource_path> + <query_params>
- POST: <resource_path> + <body>
- PATCH: <resource_path> + <body> + <moid>
More information about Intersight is available at: https://intersight.com
Details on the RESTful API and documentation: https://intersight.com/apidocs
NPM Installation:
$ pip install intersight-rest
Usage:
# Import "intersight.rest" Package
import intersight_rest as isREST
# Import JSON PAckage
import json
# Load Public/Private Keys
isREST.set_private_key(open("./keys/private_key.pem", "r") .read())
isREST.set_public_key(open("./keys/public_key.txt", "r") .read())
# Select Resource Path from https://www.intersight.com/apidocs
resourcePath = '/ntp/Policies'
# GET EXAMPLE
#-- Set GET Options --#
options = {
resource_path: resourcePath,
query_params: queryParams
}
results = isREST.intersight_call(**options)
print(json.dumps(results, indent=4))
#-- NOTE: intersightREST Returns a JS Promise --#
# GET "queryParams" Examples
#-- Example queryParams returning the top 1 result(s) --#
queryParams = {
"$top": 1
}
#-- Example queryParams showing filter by "Name" key --#
queryParams = {
"$filter": "Name eq 'Test-NTP'"
}
#-- Example queryParams showing filter by "Description" key --#
queryParams = {
"$filter": "Description eq 'pool.ntp.org'"
}
#-- Example queryParams showing advanced Tag filder by key & value --#
queryParams = {
"$filter": "Tags/any(t: t/Key eq 'loc' and t/Value eq 'California')"
}
# POST EXAMPLE
#-- Assemble POST Body --#
postBody = {
Name: "Test-NTP",
Description: "Test NTP Policy",
NtpServers: ["8.8.8.8"]
}
#-- Set POST Options --#
options = {
resource_path: resourcePath,
body: postBody
}
results = isREST.intersight_call(**options)
print(json.dumps(results, indent=4))
#-- NOTE: intersightREST Returns a JS Promise --#
# PATCH EXAMPLE
#-- Set Object MOID to be Modified --#
patchMoid = "6b1727fa686c873463b8163e"
#-- Assemble PATCH Body --#
patchBody = {
NtpServers: ["10.10.10.10"]
}
#-- Set PATCH Options --#
options = {
resource_path: resourcePath,
body: patchBody,
moid: patchMoid
}
results = isREST.intersight_call(**options)
print(json.dumps(results, indent=4))
#-- NOTE: intersightREST Returns a JS Promise --#
See package source for more details...
*Copyright (c) 2018 Cisco and/or its affiliates.
Metadata
Release files for intersight-rest 1.0.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| intersight-rest-1.0.4.tar.gz | 5.2 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| intersight_rest-1.0.4-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 10.7 kB
Release files / intersight-rest-1.0.4.tar.gz
| Download URL | intersight-rest-1.0.4.tar.gz |
|---|---|
| Size | 5.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b594a39ab152d64ce9582287db11d5bc1ad38aafc7e1b96a2ce4e1e6d6f4b776
|
|
BLAKE2b-256 checksum How to use checksums |
ab527563e6eca3fe5ecce20c5e66de1397194d9449371b17b62e31303a26d70e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.11.0 pkginfo/1.4.2 requests/2.18.4 setuptools/40.2.0 requests-toolbelt/0.8.0 tqdm/4.25.0 CPython/3.6.2
|
Release files / intersight_rest-1.0.4-py3-none-any.whl
| Download URL | intersight_rest-1.0.4-py3-none-any.whl |
|---|---|
| Size | 5.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
5660fbde701d10e8f66d40c7ba8f733b873ea4dc81c8ef23a36c49a4fc448348
|
|
BLAKE2b-256 checksum How to use checksums |
d732ec499014b86d0f2a72c9fc4ea9abee70596efdca8fd335c1a7b15d8be758
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.11.0 pkginfo/1.4.2 requests/2.18.4 setuptools/40.2.0 requests-toolbelt/0.8.0 tqdm/4.25.0 CPython/3.6.2
|
Security for intersight-rest 1.0.4
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.