thousandeyes-sdk-python/alerts_api/docs/AlertRulesApi.md
2023-12-11 09:29:15 +00:00

18 KiB
Raw Blame History

alerts_api.AlertRulesApi

All URIs are relative to https://api.thousandeyes.com

Method HTTP request Description
create_alert_rule POST /v7/alerts/rules Create alert rule
delete_alert_rule DELETE /v7/alerts/rules/{ruleId} Delete alert rule
get_alert_rule_details GET /v7/alerts/rules/{ruleId} Retrieve alert rule
get_alerts_rules GET /v7/alerts/rules List alert rules
update_alert_rule PUT /v7/alerts/rules/{ruleId} Update alert rule

create_alert_rule

CreateAlertRule201Response create_alert_rule(rule_detail_update, aid=aid)

Create alert rule

Creates a new alert rule in your account, using the provided POST data. The Edit alert rules permission is required to create an alert rule. Note: Assigning an alert rule to a test during creation requires the Edit tests permission.

Example

  • Bearer Authentication (BearerAuth):
import time
import os
import alerts_api
from alerts_api.models.create_alert_rule201_response import CreateAlertRule201Response
from alerts_api.models.rule_detail_update import RuleDetailUpdate
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 Exception as e:
        print("Exception when calling AlertRulesApi->create_alert_rule: %s\n" % e)

Parameters

Name Type Description Notes
rule_detail_update RuleDetailUpdate
aid 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]

Return type

CreateAlertRule201Response

Authorization

BearerAuth

HTTP request headers

  • Content-Type: application/hal+json
  • Accept: application/hal+json, application/problem+json

HTTP response details

Status code Description Response headers
201 Created * Location -
400 Bad Request -
401 Unauthorized -
403 Insufficient permissions to query endpoint -
404 Not found -
429 Exhausted rate limit for the organization -
500 Internal server error -

[Back to top] [Back to API list] [Back to Model list] [Back to README]

delete_alert_rule

delete_alert_rule(rule_id, aid=aid)

Delete alert rule

Deletes an alert rule from your account. Users must have both Edit alert rules and Edit tests permissions, especially if the rule is linked to any tests. Without these permissions, an error occurs.

Example

  • Bearer Authentication (BearerAuth):
import time
import os
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_id = '127094' # str | Unique alert rule ID.
    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:
        # Delete alert rule
        api_instance.delete_alert_rule(rule_id, aid=aid)
    except Exception as e:
        print("Exception when calling AlertRulesApi->delete_alert_rule: %s\n" % e)

Parameters

Name Type Description Notes
rule_id str Unique alert rule ID.
aid 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]

Return type

void (empty response body)

Authorization

BearerAuth

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json, application/problem+json

HTTP response details

Status code Description Response headers
204 No content -
400 Bad Request -
401 Unauthorized -
403 Insufficient permissions to query endpoint -
404 Not found -
429 Exhausted rate limit for the organization -
500 Internal server error -

[Back to top] [Back to API list] [Back to Model list] [Back to README]

get_alert_rule_details

GetAlertRuleDetails200Response get_alert_rule_details(rule_id, aid=aid)

Retrieve alert rule

Returns detailed information about an alert rule using the ruleId. If the ruleId doesnt exist or is inaccessible by your account, an empty response is returned.

Example

  • Bearer Authentication (BearerAuth):
import time
import os
import alerts_api
from alerts_api.models.get_alert_rule_details200_response import GetAlertRuleDetails200Response
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_id = '127094' # str | Unique alert rule ID.
    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:
        # Retrieve alert rule
        api_response = api_instance.get_alert_rule_details(rule_id, aid=aid)
        print("The response of AlertRulesApi->get_alert_rule_details:\n")
        pprint(api_response)
    except Exception as e:
        print("Exception when calling AlertRulesApi->get_alert_rule_details: %s\n" % e)

Parameters

Name Type Description Notes
rule_id str Unique alert rule ID.
aid 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]

Return type

GetAlertRuleDetails200Response

Authorization

BearerAuth

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/hal+json, application/problem+json

HTTP response details

Status code Description Response headers
200 OK -
401 Unauthorized -
403 Insufficient permissions to query endpoint -
404 Not found -
429 Exhausted rate limit for the organization -
500 Internal server error -

[Back to top] [Back to API list] [Back to Model list] [Back to README]

get_alerts_rules

GetAlertsRules200Response get_alerts_rules(aid=aid)

List alert rules

Returns a list of alert rules. Default rules for each test type are indicated with a boolean response (true or false); these default alert rules automatically apply to their respective test types.

Example

  • Bearer Authentication (BearerAuth):
import time
import os
import alerts_api
from alerts_api.models.get_alerts_rules200_response import GetAlertsRules200Response
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)
    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:
        # List alert rules
        api_response = api_instance.get_alerts_rules(aid=aid)
        print("The response of AlertRulesApi->get_alerts_rules:\n")
        pprint(api_response)
    except Exception as e:
        print("Exception when calling AlertRulesApi->get_alerts_rules: %s\n" % e)

Parameters

Name Type Description Notes
aid 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]

Return type

GetAlertsRules200Response

Authorization

BearerAuth

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/hal+json, application/problem+json

HTTP response details

Status code Description Response headers
200 OK -
401 Unauthorized -
403 Insufficient permissions to query endpoint -
404 Not found -
429 Exhausted rate limit for the organization -
500 Internal server error -

[Back to top] [Back to API list] [Back to Model list] [Back to README]

update_alert_rule

CreateAlertRule201Response update_alert_rule(rule_id, rule_detail_update, aid=aid)

Update alert rule

Modifies an existing alert rule in your account, using the provided POST data. The Edit alert rules permission is required to modify an alert rule. Note: Assigning an alert rule to a test during creation requires the Edit tests permission.

Example

  • Bearer Authentication (BearerAuth):
import time
import os
import alerts_api
from alerts_api.models.create_alert_rule201_response import CreateAlertRule201Response
from alerts_api.models.rule_detail_update import RuleDetailUpdate
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_id = '127094' # str | Unique alert rule ID.
    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:
        # Update alert rule
        api_response = api_instance.update_alert_rule(rule_id, rule_detail_update, aid=aid)
        print("The response of AlertRulesApi->update_alert_rule:\n")
        pprint(api_response)
    except Exception as e:
        print("Exception when calling AlertRulesApi->update_alert_rule: %s\n" % e)

Parameters

Name Type Description Notes
rule_id str Unique alert rule ID.
rule_detail_update RuleDetailUpdate
aid 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]

Return type

CreateAlertRule201Response

Authorization

BearerAuth

HTTP request headers

  • Content-Type: application/hal+json
  • Accept: application/hal+json, application/problem+json

HTTP response details

Status code Description Response headers
200 OK -
400 Bad Request -
401 Unauthorized -
403 Insufficient permissions to query endpoint -
404 Not found -
429 Exhausted rate limit for the organization -
500 Internal server error -

[Back to top] [Back to API list] [Back to Model list] [Back to README]