| .. | ||
| .github/workflows | ||
| .openapi-generator | ||
| docs | ||
| test | ||
| test_templates_api | ||
| .gitignore | ||
| .gitlab-ci.yml | ||
| .openapi-generator-ignore | ||
| .travis.yml | ||
| git_push.sh | ||
| pyproject.toml | ||
| README.md | ||
| requirements.txt | ||
| setup.cfg | ||
| setup.py | ||
| test-requirements.txt | ||
| tox.ini | ||
test-templates-api
Overview
Test templates allow you create a set of tests, alert rules, dashboards, and labels from a single template configuration file.
The following applies to test templates:
-
You can create tests for monitoring common services and applications such as Microsoft 365, Webex, and others using a predefined set of certified templates.
-
Test templates reduce the time and complexity of creating tests for common SaaS or other services by providing a set of templates for creating tests, alert rules, and other assets within the ThousandEyes platform.
-
Templates created with an account group in a particular organization are visible to all account groups in that organization, provided they have the
View Test Templatespermission. -
Credentials (usernames, passwords, tokens, etc.) can be included in a test template only as placeholders whose value is provided by user input when the template is deployed. Creating or updating a test template that contains a credentials field in plain text will result in a bad request (HTTP 400).
-
The schemas to use for
labels,tests,alertRulesanddashboardsare defined at https://developer.thousandeyes.com/v7/. -
To support referencing an asset from another asset of a different type (for example, defining the
testIdfield of analertRuleby referencing the ID of a test defined in the template itself), the deployment of assets is done in a specific order:- Labels
- Tests
- Alert rules
- Dashboards
For a given asset type, you can reference any asset type with a higher order. (For example, labels cannot reference other assets in the template; tests can only reference labels; alert rules can reference tests and labels, etc.)
This Python package is automatically generated by the OpenAPI Generator project:
- API version: 7.0.1
- 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 test_templates_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 test_templates_api
Tests
Execute pytest to run the tests.
Getting Started
Please follow the installation procedure and then run the following:
import time
import test_templates_api
from test_templates_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 = test_templates_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 = test_templates_api.Configuration(
access_token = os.environ["BEARER_TOKEN"]
)
# Enter a context with an instance of the API client
with test_templates_api.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = test_templates_api.TestTemplateEndpointsApi(api_client)
test_template_upsert = test_templates_api.TestTemplateUpsert() # TestTemplateUpsert | The test template to create or update.
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 a test template.
api_response = api_instance.create_test_template(test_template_upsert, aid=aid)
print("The response of TestTemplateEndpointsApi->create_test_template:\n")
pprint(api_response)
except ApiException as e:
print("Exception when calling TestTemplateEndpointsApi->create_test_template: %s\n" % e)
Documentation for API Endpoints
All URIs are relative to https://api.thousandeyes.com
| Class | Method | HTTP request | Description |
|---|---|---|---|
| TestTemplateEndpointsApi | create_test_template | POST /v7/tests/templates | Create a test template. |
| TestTemplateEndpointsApi | delete_test_template | DELETE /v7/tests/templates/{id} | Delete a test template |
| TestTemplateEndpointsApi | deploy_user_template | POST /v7/tests/templates/{id}/deploy | Deploy a test template. |
| TestTemplateEndpointsApi | get_user_org_test_template | GET /v7/tests/templates/{id} | Retrieve a test template |
| TestTemplateEndpointsApi | get_user_org_test_templates | GET /v7/tests/templates | List all test templates. |
| TestTemplateEndpointsApi | update_test_template | PUT /v7/tests/templates/{id} | Update a test template |
Documentation For Models
- ApiError
- BadRequestError
- DeployTestTemplate
- DeployTestTemplateTests
- DeployTestTemplateUserInputValues
- DeploymentStrategy
- Link
- NotFoundError
- TestTemplate
- TestTemplateCollection
- TestTemplateCollectionLinks
- TestTemplateCollectionLinksSelf
- TestTemplateUpsert
- UnauthorizedError
- UserInput
- UserInputDefaultValue
- UserInputType
Documentation For Authorization
Authentication schemes defined for the API:
BearerAuth
- Type: Bearer authentication