mirror of
https://github.com/thousandeyes/thousandeyes-sdk-python.git
synced 2025-12-06 06:26:51 +00:00
7.8 KiB
7.8 KiB
alerts-api
Overview
Manage all alerts, alert rules and alert suppression windows.
This Python package is automatically generated by the OpenAPI Generator project:
- API version: 7.0.0
- Package version: 1.0.0
- Build package: org.openapitools.codegen.languages.PythonClientCodegen
Requirements.
Python 3.7+
Installation & Usage
pip install
If the python package is hosted on a repository, you can install directly using:
pip install git+https://github.com/thousandeyes/thousandeyes-python-sdk.git
(you may need to run pip with root permission: sudo pip install git+https://github.com/thousandeyes/thousandeyes-python-sdk.git)
Then import the package:
import alerts_api
Setuptools
Install via Setuptools.
python setup.py install --user
(or sudo python setup.py install to install the package for all users)
Then import the package:
import alerts_api
Tests
Execute pytest to run the tests.
Getting Started
Please follow the installation procedure and then run the following:
import time
import alerts_api
from alerts_api.rest import ApiException
from pprint import pprint
# Defining the host is optional and defaults to https://api.thousandeyes.com
# See configuration.py for a list of all supported configuration parameters.
configuration = alerts_api.Configuration(
host = "https://api.thousandeyes.com"
)
# The client must configure the authentication and authorization parameters
# in accordance with the API server security policy.
# Examples for each auth method are provided below, use the example that
# satisfies your auth use case.
# Configure Bearer authorization: BearerAuth
configuration = alerts_api.Configuration(
access_token = os.environ["BEARER_TOKEN"]
)
# Enter a context with an instance of the API client
with alerts_api.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = alerts_api.AlertRulesApi(api_client)
rule_detail_update = alerts_api.RuleDetailUpdate() # RuleDetailUpdate |
aid = '2067' # str | A unique identifier associated with your account group. You can retrieve your `AccountGroupId` from the `/account-groups` endpoint. Note that you must be assigned to the target account group. Specifying this parameter without being assigned to the target account group will result in an error response. (optional)
try:
# Create alert rule
api_response = api_instance.create_alert_rule(rule_detail_update, aid=aid)
print("The response of AlertRulesApi->create_alert_rule:\n")
pprint(api_response)
except ApiException as e:
print("Exception when calling AlertRulesApi->create_alert_rule: %s\n" % e)
Documentation for API Endpoints
All URIs are relative to https://api.thousandeyes.com
| Class | Method | HTTP request | Description |
|---|---|---|---|
| AlertRulesApi | create_alert_rule | POST /v7/alerts/rules | Create alert rule |
| AlertRulesApi | delete_alert_rule | DELETE /v7/alerts/rules/{ruleId} | Delete alert rule |
| AlertRulesApi | get_alert_rule_details | GET /v7/alerts/rules/{ruleId} | Retrieve alert rule |
| AlertRulesApi | get_alerts_rules | GET /v7/alerts/rules | List alert rules |
| AlertRulesApi | update_alert_rule | PUT /v7/alerts/rules/{ruleId} | Update alert rule |
| AlertSuppressionWindowsApi | create_suppression_windows | POST /v7/alert-suppression-windows | Create alert suppression window |
| AlertSuppressionWindowsApi | delete_suppression_window | DELETE /v7/alert-suppression-windows/{windowId} | Delete alert suppression window |
| AlertSuppressionWindowsApi | get_suppression_window_details | GET /v7/alert-suppression-windows/{windowId} | Retrieve alert suppression window |
| AlertSuppressionWindowsApi | get_suppression_windows | GET /v7/alert-suppression-windows | List alert suppression windows |
| AlertSuppressionWindowsApi | update_suppression_window | PUT /v7/alert-suppression-windows/{windowId} | Update alert suppression window |
| AlertsApi | get_alert_details | GET /v7/alerts/{alertId} | Retrieve alert details |
| AlertsApi | get_alerts | GET /v7/alerts | List active alerts |
Documentation For Models
- Alert
- AlertDetail
- AlertLinks
- AlertMetricDetail
- AlertMetricDetailEnd
- AlertMetricDetailStart
- AlertMetrics
- AlertRoundsViolationMode
- AlertRule
- AlertSuppressionWindow
- AlertSuppressionWindowRequest
- AlertSuppressionWindowState
- AlertSuppressionWindows
- AlertSuppressionWindowsAlertSuppressionWindowsInner
- AlertType
- Alerts
- AppLinks
- AppLinksLinks
- BaseAlert
- BaseTest
- CompleteAlertSuppressionWindow
- CreateAlertRule201Response
- CreateSuppressionWindows201Response
- DaysOfWeek
- EndRepeat
- EndRepeatType
- Error
- Expand
- GetAlertRuleDetails200Response
- GetAlerts200Response
- GetAlertsRules200Response
- GetSuppressionWindows200Response
- IntervalType
- Link
- Notification
- NotificationEmail
- NotificationThirdParty
- NotificationWebhook
- PaginationLinks
- PaginationLinksLinks
- Repeat
- RepeatType
- Rule
- RuleDetail
- RuleDetailUpdate
- RuleLinks
- RuleLinksLinks
- Rules
- SelfLinks
- SelfLinksLinks
- Severity
- State
- TestDirection
- TestInterval
- ThirdPartyIntegrationType
- UnauthorizedError
- UnexpandedTest
- WebhookIntegrationType
Documentation For Authorization
Authentication schemes defined for the API:
BearerAuth
- Type: Bearer authentication