mirror of
https://github.com/thousandeyes/thousandeyes-sdk-python.git
synced 2026-09-18 07:53:55 +00:00
[GitHub Bot] Generated python SDK (#181)
Some checks failed
Python CI / build (push) Has been cancelled
Some checks failed
Python CI / build (push) Has been cancelled
Co-authored-by: API Team <api-team@thousandeyes.com>
This commit is contained in:
parent
75929e93d0
commit
c6ae90df0d
@ -126,9 +126,17 @@ src/thousandeyes_sdk/administrative/models/validation_error.py
|
||||
src/thousandeyes_sdk/administrative/models/validation_error_item.py
|
||||
src/thousandeyes_sdk/administrative/py.typed
|
||||
test/__init__.py
|
||||
test/conftest.py
|
||||
test/integration_test_utils.py
|
||||
test/mock_manifest.py
|
||||
test/test_account_groups_api.py
|
||||
test/test_account_groups_api_integration.py
|
||||
test/test_permissions_api.py
|
||||
test/test_permissions_api_integration.py
|
||||
test/test_roles_api.py
|
||||
test/test_roles_api_integration.py
|
||||
test/test_user_events_api.py
|
||||
test/test_user_events_api_integration.py
|
||||
test/test_users_api.py
|
||||
test/test_users_api_integration.py
|
||||
test/test_utils.py
|
||||
|
||||
@ -12,7 +12,7 @@ This API provides the following operations to manage your organization:
|
||||
|
||||
This Python package is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project:
|
||||
|
||||
- API version: 7.0.96
|
||||
- API version: 7.0.99
|
||||
- Generator version: 7.6.0
|
||||
- Build package: com.thousandeyes.api.codegen.ThousandeyesPythonGenerator
|
||||
|
||||
@ -86,7 +86,7 @@ with thousandeyes_sdk.core.ApiClient(configuration) as api_client:
|
||||
# Create an instance of the API class
|
||||
api_instance = thousandeyes_sdk.administrative.AccountGroupsApi(api_client)
|
||||
account_group_request = thousandeyes_sdk.administrative.AccountGroupRequest() # AccountGroupRequest |
|
||||
expand = [thousandeyes_sdk.administrative.ExpandAccountGroupOptions()] # List[ExpandAccountGroupOptions] | Optional parameter that specifies whether or not account group related resources should be expanded. By default, no expansion takes place if the query parameter is not passed. For example, to expand the `users` resource, pass the `?expand=user` query. (optional)
|
||||
expand = ["user"] # List[ExpandAccountGroupOptions] | Optional parameter that specifies whether or not account group related resources should be expanded. By default, no expansion takes place if the query parameter is not passed. For example, to expand the `users` resource, pass the `?expand=user` query. (optional)
|
||||
|
||||
try:
|
||||
# Create account group
|
||||
|
||||
@ -51,7 +51,7 @@ with thousandeyes_sdk.core.ApiClient(configuration) as api_client:
|
||||
# Create an instance of the API class
|
||||
api_instance = thousandeyes_sdk.administrative.AccountGroupsApi(api_client)
|
||||
account_group_request = thousandeyes_sdk.administrative.AccountGroupRequest() # AccountGroupRequest |
|
||||
expand = [thousandeyes_sdk.administrative.ExpandAccountGroupOptions()] # List[ExpandAccountGroupOptions] | Optional parameter that specifies whether or not account group related resources should be expanded. By default, no expansion takes place if the query parameter is not passed. For example, to expand the `users` resource, pass the `?expand=user` query. (optional)
|
||||
expand = ["user"] # List[ExpandAccountGroupOptions] | Optional parameter that specifies whether or not account group related resources should be expanded. By default, no expansion takes place if the query parameter is not passed. For example, to expand the `users` resource, pass the `?expand=user` query. (optional)
|
||||
|
||||
try:
|
||||
# Create account group
|
||||
@ -219,7 +219,7 @@ with thousandeyes_sdk.core.ApiClient(configuration) as api_client:
|
||||
# Create an instance of the API class
|
||||
api_instance = thousandeyes_sdk.administrative.AccountGroupsApi(api_client)
|
||||
id = '1234' # str | Identifier for the account group.
|
||||
expand = [thousandeyes_sdk.administrative.ExpandAccountGroupOptions()] # List[ExpandAccountGroupOptions] | Optional parameter that specifies whether or not account group related resources should be expanded. By default, no expansion takes place if the query parameter is not passed. For example, to expand the `users` resource, pass the `?expand=user` query. (optional)
|
||||
expand = ["user"] # List[ExpandAccountGroupOptions] | Optional parameter that specifies whether or not account group related resources should be expanded. By default, no expansion takes place if the query parameter is not passed. For example, to expand the `users` resource, pass the `?expand=user` query. (optional)
|
||||
|
||||
try:
|
||||
# Retrieve account group
|
||||
@ -388,7 +388,7 @@ with thousandeyes_sdk.core.ApiClient(configuration) as api_client:
|
||||
api_instance = thousandeyes_sdk.administrative.AccountGroupsApi(api_client)
|
||||
id = '1234' # str | Identifier for the account group.
|
||||
account_group_request = thousandeyes_sdk.administrative.AccountGroupRequest() # AccountGroupRequest |
|
||||
expand = [thousandeyes_sdk.administrative.ExpandAccountGroupOptions()] # List[ExpandAccountGroupOptions] | Optional parameter that specifies whether or not account group related resources should be expanded. By default, no expansion takes place if the query parameter is not passed. For example, to expand the `users` resource, pass the `?expand=user` query. (optional)
|
||||
expand = ["user"] # List[ExpandAccountGroupOptions] | Optional parameter that specifies whether or not account group related resources should be expanded. By default, no expansion takes place if the query parameter is not passed. For example, to expand the `users` resource, pass the `?expand=user` query. (optional)
|
||||
|
||||
try:
|
||||
# Update account group
|
||||
|
||||
7
thousandeyes-sdk-administrative/test/conftest.py
Normal file
7
thousandeyes-sdk-administrative/test/conftest.py
Normal file
@ -0,0 +1,7 @@
|
||||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
_repo_root = Path(__file__).resolve().parents[2]
|
||||
_core_test_support = _repo_root / "thousandeyes-sdk-core" / "test"
|
||||
if str(_core_test_support) not in sys.path:
|
||||
sys.path.insert(0, str(_core_test_support))
|
||||
@ -0,0 +1,37 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
Administrative API
|
||||
|
||||
Manage users, accounts, and account groups in the ThousandEyes platform using the Administrative API. This API provides the following operations to manage your organization: * `/account-groups`: Account groups are used to divide an organization into different sections. These operations can be used to create, retrieve, update and delete account groups. * `/users`: Create, retrieve, update and delete users within an organization. * `/roles`: Create, retrieve and update roles for the current user. * `/permissions`: Retrieve all assignable permissions. Used in the context of modifying roles. * `/audit-user-events`: Retrieve all activity log events. For more information about the administrative models, see [Account Management](https://docs.thousandeyes.com/product-documentation/user-management).
|
||||
|
||||
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
||||
|
||||
Do not edit the class manually.
|
||||
""" # noqa: E501
|
||||
|
||||
|
||||
import unittest
|
||||
|
||||
from thousandeyes_sdk.core.api_client import ApiClient
|
||||
from thousandeyes_sdk.core.configuration import Configuration
|
||||
from sdk_test_support.mock_server import ERROR_STATUS_HEADER, OPERATION_ID_HEADER, MockApiServer
|
||||
|
||||
from .mock_manifest import OPERATION_MANIFEST
|
||||
|
||||
|
||||
class IntegrationTestBase(unittest.TestCase):
|
||||
def setUp(self) -> None:
|
||||
self.server = MockApiServer(OPERATION_MANIFEST)
|
||||
self.server.start()
|
||||
configuration = Configuration(host=self.server.base_url, access_token="test-token")
|
||||
self.api_client = ApiClient(configuration=configuration)
|
||||
|
||||
def tearDown(self) -> None:
|
||||
self.server.stop()
|
||||
|
||||
def te_headers(self, operation_id: str, error_status=None):
|
||||
headers = {OPERATION_ID_HEADER: operation_id}
|
||||
if error_status is not None:
|
||||
headers[ERROR_STATUS_HEADER] = error_status
|
||||
return headers
|
||||
3252
thousandeyes-sdk-administrative/test/mock_manifest.py
Normal file
3252
thousandeyes-sdk-administrative/test/mock_manifest.py
Normal file
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,233 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
Administrative API
|
||||
|
||||
Manage users, accounts, and account groups in the ThousandEyes platform using the Administrative API. This API provides the following operations to manage your organization: * `/account-groups`: Account groups are used to divide an organization into different sections. These operations can be used to create, retrieve, update and delete account groups. * `/users`: Create, retrieve, update and delete users within an organization. * `/roles`: Create, retrieve and update roles for the current user. * `/permissions`: Retrieve all assignable permissions. Used in the context of modifying roles. * `/audit-user-events`: Retrieve all activity log events. For more information about the administrative models, see [Account Management](https://docs.thousandeyes.com/product-documentation/user-management).
|
||||
|
||||
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
||||
|
||||
Do not edit the class manually.
|
||||
""" # noqa: E501
|
||||
|
||||
|
||||
import json
|
||||
import unittest
|
||||
import thousandeyes_sdk.administrative.models
|
||||
|
||||
from thousandeyes_sdk.core.exceptions import ApiException
|
||||
from thousandeyes_sdk.administrative.api.permissions_api import PermissionsApi
|
||||
from .integration_test_utils import IntegrationTestBase
|
||||
from .test_utils import assert_constructed_model_matches_example_json
|
||||
|
||||
|
||||
class TestPermissionsApiIntegration(IntegrationTestBase):
|
||||
"""PermissionsApi integration test stubs"""
|
||||
|
||||
def setUp(self) -> None:
|
||||
super().setUp()
|
||||
self.api = PermissionsApi(self.api_client)
|
||||
|
||||
|
||||
def test_get_permissions_happy_path(self) -> None:
|
||||
"""Integration test for get_permissions success path"""
|
||||
aid = '1234'
|
||||
response_body_json = """
|
||||
{
|
||||
"_links" : {
|
||||
"self" : {
|
||||
"hreflang" : "hreflang",
|
||||
"templated" : true,
|
||||
"profile" : "profile",
|
||||
"name" : "name",
|
||||
"href" : "https://api.thousandeyes.com/v7/link/to/resource/id",
|
||||
"type" : "type",
|
||||
"deprecation" : "deprecation",
|
||||
"title" : "title"
|
||||
}
|
||||
},
|
||||
"permissions" : [ {
|
||||
"label" : "View reports",
|
||||
"permissionId" : "1",
|
||||
"isManagementPermission" : true,
|
||||
"permission" : "REPORT_READ"
|
||||
}, {
|
||||
"label" : "View snapshots",
|
||||
"permissionId" : "51",
|
||||
"isManagementPermission" : false,
|
||||
"permission" : "REPORT_SNAPSHOTS_READ"
|
||||
} ]
|
||||
}
|
||||
"""
|
||||
expected_response = json.loads(response_body_json)
|
||||
response = self.api.get_permissions(
|
||||
|
||||
aid=aid,
|
||||
|
||||
_headers=self.te_headers("get_permissions"),
|
||||
)
|
||||
assert_constructed_model_matches_example_json(response, expected_response)
|
||||
|
||||
|
||||
def test_get_permissions_error_400(self) -> None:
|
||||
"""Integration test for get_permissions error path (HTTP 400)"""
|
||||
aid = '1234'
|
||||
error_body_json = """
|
||||
{
|
||||
"instance" : "instance",
|
||||
"detail" : "detail",
|
||||
"type" : "type",
|
||||
"title" : "title",
|
||||
"errors" : [ {
|
||||
"code" : "code",
|
||||
"field" : "field",
|
||||
"message" : "message"
|
||||
}, {
|
||||
"code" : "code",
|
||||
"field" : "field",
|
||||
"message" : "message"
|
||||
} ],
|
||||
"status" : 0
|
||||
}
|
||||
"""
|
||||
expected_error = json.loads(error_body_json)
|
||||
with self.assertRaises(
|
||||
ApiException.exception_class_for_http_status(400)
|
||||
) as context:
|
||||
self.api.get_permissions(
|
||||
|
||||
aid=aid,
|
||||
|
||||
_headers=self.te_headers("get_permissions", error_status="400"),
|
||||
)
|
||||
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
|
||||
|
||||
|
||||
def test_get_permissions_error_401(self) -> None:
|
||||
"""Integration test for get_permissions error path (HTTP 401)"""
|
||||
aid = '1234'
|
||||
error_body_json = """
|
||||
{
|
||||
"error_description" : "Invalid access token",
|
||||
"error" : "invalid_token"
|
||||
}
|
||||
"""
|
||||
expected_error = json.loads(error_body_json)
|
||||
with self.assertRaises(
|
||||
ApiException.exception_class_for_http_status(401)
|
||||
) as context:
|
||||
self.api.get_permissions(
|
||||
|
||||
aid=aid,
|
||||
|
||||
_headers=self.te_headers("get_permissions", error_status="401"),
|
||||
)
|
||||
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
|
||||
|
||||
|
||||
def test_get_permissions_error_403(self) -> None:
|
||||
"""Integration test for get_permissions error path (HTTP 403)"""
|
||||
aid = '1234'
|
||||
error_body_json = """
|
||||
{
|
||||
"instance" : "instance",
|
||||
"detail" : "detail",
|
||||
"type" : "type",
|
||||
"title" : "title",
|
||||
"status" : 6
|
||||
}
|
||||
"""
|
||||
expected_error = json.loads(error_body_json)
|
||||
with self.assertRaises(
|
||||
ApiException.exception_class_for_http_status(403)
|
||||
) as context:
|
||||
self.api.get_permissions(
|
||||
|
||||
aid=aid,
|
||||
|
||||
_headers=self.te_headers("get_permissions", error_status="403"),
|
||||
)
|
||||
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
|
||||
|
||||
|
||||
def test_get_permissions_error_404(self) -> None:
|
||||
"""Integration test for get_permissions error path (HTTP 404)"""
|
||||
aid = '1234'
|
||||
error_body_json = """
|
||||
{
|
||||
"instance" : "instance",
|
||||
"detail" : "detail",
|
||||
"type" : "type",
|
||||
"title" : "title",
|
||||
"status" : 6
|
||||
}
|
||||
"""
|
||||
expected_error = json.loads(error_body_json)
|
||||
with self.assertRaises(
|
||||
ApiException.exception_class_for_http_status(404)
|
||||
) as context:
|
||||
self.api.get_permissions(
|
||||
|
||||
aid=aid,
|
||||
|
||||
_headers=self.te_headers("get_permissions", error_status="404"),
|
||||
)
|
||||
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
|
||||
|
||||
|
||||
def test_get_permissions_error_429(self) -> None:
|
||||
"""Integration test for get_permissions error path (HTTP 429)"""
|
||||
aid = '1234'
|
||||
error_body_json = """
|
||||
{
|
||||
"instance" : "instance",
|
||||
"detail" : "detail",
|
||||
"type" : "type",
|
||||
"title" : "title",
|
||||
"status" : 6
|
||||
}
|
||||
"""
|
||||
expected_error = json.loads(error_body_json)
|
||||
with self.assertRaises(
|
||||
ApiException.exception_class_for_http_status(429)
|
||||
) as context:
|
||||
self.api.get_permissions(
|
||||
|
||||
aid=aid,
|
||||
|
||||
_headers=self.te_headers("get_permissions", error_status="429"),
|
||||
)
|
||||
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
|
||||
|
||||
|
||||
def test_get_permissions_error_500(self) -> None:
|
||||
"""Integration test for get_permissions error path (HTTP 500)"""
|
||||
aid = '1234'
|
||||
error_body_json = """
|
||||
{
|
||||
"instance" : "instance",
|
||||
"detail" : "detail",
|
||||
"type" : "type",
|
||||
"title" : "title",
|
||||
"status" : 6
|
||||
}
|
||||
"""
|
||||
expected_error = json.loads(error_body_json)
|
||||
with self.assertRaises(
|
||||
ApiException.exception_class_for_http_status(500)
|
||||
) as context:
|
||||
self.api.get_permissions(
|
||||
|
||||
aid=aid,
|
||||
|
||||
_headers=self.te_headers("get_permissions", error_status="500"),
|
||||
)
|
||||
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
1224
thousandeyes-sdk-administrative/test/test_roles_api_integration.py
Normal file
1224
thousandeyes-sdk-administrative/test/test_roles_api_integration.py
Normal file
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,373 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
Administrative API
|
||||
|
||||
Manage users, accounts, and account groups in the ThousandEyes platform using the Administrative API. This API provides the following operations to manage your organization: * `/account-groups`: Account groups are used to divide an organization into different sections. These operations can be used to create, retrieve, update and delete account groups. * `/users`: Create, retrieve, update and delete users within an organization. * `/roles`: Create, retrieve and update roles for the current user. * `/permissions`: Retrieve all assignable permissions. Used in the context of modifying roles. * `/audit-user-events`: Retrieve all activity log events. For more information about the administrative models, see [Account Management](https://docs.thousandeyes.com/product-documentation/user-management).
|
||||
|
||||
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
||||
|
||||
Do not edit the class manually.
|
||||
""" # noqa: E501
|
||||
|
||||
|
||||
import json
|
||||
import unittest
|
||||
import thousandeyes_sdk.administrative.models
|
||||
|
||||
from thousandeyes_sdk.core.exceptions import ApiException
|
||||
from thousandeyes_sdk.administrative.api.user_events_api import UserEventsApi
|
||||
from .integration_test_utils import IntegrationTestBase
|
||||
from .test_utils import assert_constructed_model_matches_example_json
|
||||
|
||||
|
||||
class TestUserEventsApiIntegration(IntegrationTestBase):
|
||||
"""UserEventsApi integration test stubs"""
|
||||
|
||||
def setUp(self) -> None:
|
||||
super().setUp()
|
||||
self.api = UserEventsApi(self.api_client)
|
||||
|
||||
|
||||
def test_get_user_events_happy_path(self) -> None:
|
||||
"""Integration test for get_user_events success path"""
|
||||
aid = '1234'
|
||||
use_all_permitted_aids = False
|
||||
window = '12h'
|
||||
start_date = '2022-07-17T22:00:54Z'
|
||||
end_date = '2022-07-18T22:00:54Z'
|
||||
cursor = 'cursor_example'
|
||||
response_body_json = """
|
||||
{
|
||||
"endDate" : "2022-07-18T22:00:54Z",
|
||||
"_links" : {
|
||||
"next" : {
|
||||
"hreflang" : "hreflang",
|
||||
"templated" : true,
|
||||
"profile" : "profile",
|
||||
"name" : "name",
|
||||
"href" : "https://api.thousandeyes.com/v7/link/to/resource/id",
|
||||
"type" : "type",
|
||||
"deprecation" : "deprecation",
|
||||
"title" : "title"
|
||||
},
|
||||
"previous" : {
|
||||
"hreflang" : "hreflang",
|
||||
"templated" : true,
|
||||
"profile" : "profile",
|
||||
"name" : "name",
|
||||
"href" : "https://api.thousandeyes.com/v7/link/to/resource/id",
|
||||
"type" : "type",
|
||||
"deprecation" : "deprecation",
|
||||
"title" : "title"
|
||||
},
|
||||
"self" : {
|
||||
"hreflang" : "hreflang",
|
||||
"templated" : true,
|
||||
"profile" : "profile",
|
||||
"name" : "name",
|
||||
"href" : "https://api.thousandeyes.com/v7/link/to/resource/id",
|
||||
"type" : "type",
|
||||
"deprecation" : "deprecation",
|
||||
"title" : "title"
|
||||
}
|
||||
},
|
||||
"auditEvents" : [ {
|
||||
"accountGroupName" : "API Sandbox",
|
||||
"aid" : "1234",
|
||||
"date" : "2020-07-17T21:54:54Z",
|
||||
"event" : "Report created.",
|
||||
"ipAddress" : "99.128.0.0/11",
|
||||
"uid" : "1234",
|
||||
"user" : "API Sandbox User (noreply@thousandeyes.com)",
|
||||
"resources" : [ {
|
||||
"name" : "My New report",
|
||||
"type" : "reportTitle"
|
||||
}, {
|
||||
"name" : "Other Report",
|
||||
"type" : "testName"
|
||||
} ]
|
||||
}, {
|
||||
"accountGroupName" : "API Sandbox",
|
||||
"aid" : "1234",
|
||||
"date" : "2020-07-17T22:00:54Z",
|
||||
"event" : "Login failed.",
|
||||
"ipAddress" : "99.128.0.0/11",
|
||||
"uid" : "1234",
|
||||
"user" : "API Sandbox User (noreply@thousandeyes.com)"
|
||||
} ],
|
||||
"startDate" : "2022-07-17T22:00:54Z"
|
||||
}
|
||||
"""
|
||||
expected_response = json.loads(response_body_json)
|
||||
response = self.api.get_user_events(
|
||||
|
||||
aid=aid,
|
||||
|
||||
use_all_permitted_aids=use_all_permitted_aids,
|
||||
|
||||
window=window,
|
||||
|
||||
start_date=start_date,
|
||||
|
||||
end_date=end_date,
|
||||
|
||||
cursor=cursor,
|
||||
|
||||
_headers=self.te_headers("get_user_events"),
|
||||
)
|
||||
assert_constructed_model_matches_example_json(response, expected_response)
|
||||
|
||||
|
||||
def test_get_user_events_error_400(self) -> None:
|
||||
"""Integration test for get_user_events error path (HTTP 400)"""
|
||||
aid = '1234'
|
||||
use_all_permitted_aids = False
|
||||
window = '12h'
|
||||
start_date = '2022-07-17T22:00:54Z'
|
||||
end_date = '2022-07-18T22:00:54Z'
|
||||
cursor = 'cursor_example'
|
||||
error_body_json = """
|
||||
{
|
||||
"instance" : "instance",
|
||||
"detail" : "detail",
|
||||
"type" : "type",
|
||||
"title" : "title",
|
||||
"errors" : [ {
|
||||
"code" : "code",
|
||||
"field" : "field",
|
||||
"message" : "message"
|
||||
}, {
|
||||
"code" : "code",
|
||||
"field" : "field",
|
||||
"message" : "message"
|
||||
} ],
|
||||
"status" : 0
|
||||
}
|
||||
"""
|
||||
expected_error = json.loads(error_body_json)
|
||||
with self.assertRaises(
|
||||
ApiException.exception_class_for_http_status(400)
|
||||
) as context:
|
||||
self.api.get_user_events(
|
||||
|
||||
aid=aid,
|
||||
|
||||
use_all_permitted_aids=use_all_permitted_aids,
|
||||
|
||||
window=window,
|
||||
|
||||
start_date=start_date,
|
||||
|
||||
end_date=end_date,
|
||||
|
||||
cursor=cursor,
|
||||
|
||||
_headers=self.te_headers("get_user_events", error_status="400"),
|
||||
)
|
||||
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
|
||||
|
||||
|
||||
def test_get_user_events_error_401(self) -> None:
|
||||
"""Integration test for get_user_events error path (HTTP 401)"""
|
||||
aid = '1234'
|
||||
use_all_permitted_aids = False
|
||||
window = '12h'
|
||||
start_date = '2022-07-17T22:00:54Z'
|
||||
end_date = '2022-07-18T22:00:54Z'
|
||||
cursor = 'cursor_example'
|
||||
error_body_json = """
|
||||
{
|
||||
"error_description" : "Invalid access token",
|
||||
"error" : "invalid_token"
|
||||
}
|
||||
"""
|
||||
expected_error = json.loads(error_body_json)
|
||||
with self.assertRaises(
|
||||
ApiException.exception_class_for_http_status(401)
|
||||
) as context:
|
||||
self.api.get_user_events(
|
||||
|
||||
aid=aid,
|
||||
|
||||
use_all_permitted_aids=use_all_permitted_aids,
|
||||
|
||||
window=window,
|
||||
|
||||
start_date=start_date,
|
||||
|
||||
end_date=end_date,
|
||||
|
||||
cursor=cursor,
|
||||
|
||||
_headers=self.te_headers("get_user_events", error_status="401"),
|
||||
)
|
||||
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
|
||||
|
||||
|
||||
def test_get_user_events_error_403(self) -> None:
|
||||
"""Integration test for get_user_events error path (HTTP 403)"""
|
||||
aid = '1234'
|
||||
use_all_permitted_aids = False
|
||||
window = '12h'
|
||||
start_date = '2022-07-17T22:00:54Z'
|
||||
end_date = '2022-07-18T22:00:54Z'
|
||||
cursor = 'cursor_example'
|
||||
error_body_json = """
|
||||
{
|
||||
"instance" : "instance",
|
||||
"detail" : "detail",
|
||||
"type" : "type",
|
||||
"title" : "title",
|
||||
"status" : 6
|
||||
}
|
||||
"""
|
||||
expected_error = json.loads(error_body_json)
|
||||
with self.assertRaises(
|
||||
ApiException.exception_class_for_http_status(403)
|
||||
) as context:
|
||||
self.api.get_user_events(
|
||||
|
||||
aid=aid,
|
||||
|
||||
use_all_permitted_aids=use_all_permitted_aids,
|
||||
|
||||
window=window,
|
||||
|
||||
start_date=start_date,
|
||||
|
||||
end_date=end_date,
|
||||
|
||||
cursor=cursor,
|
||||
|
||||
_headers=self.te_headers("get_user_events", error_status="403"),
|
||||
)
|
||||
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
|
||||
|
||||
|
||||
def test_get_user_events_error_404(self) -> None:
|
||||
"""Integration test for get_user_events error path (HTTP 404)"""
|
||||
aid = '1234'
|
||||
use_all_permitted_aids = False
|
||||
window = '12h'
|
||||
start_date = '2022-07-17T22:00:54Z'
|
||||
end_date = '2022-07-18T22:00:54Z'
|
||||
cursor = 'cursor_example'
|
||||
error_body_json = """
|
||||
{
|
||||
"instance" : "instance",
|
||||
"detail" : "detail",
|
||||
"type" : "type",
|
||||
"title" : "title",
|
||||
"status" : 6
|
||||
}
|
||||
"""
|
||||
expected_error = json.loads(error_body_json)
|
||||
with self.assertRaises(
|
||||
ApiException.exception_class_for_http_status(404)
|
||||
) as context:
|
||||
self.api.get_user_events(
|
||||
|
||||
aid=aid,
|
||||
|
||||
use_all_permitted_aids=use_all_permitted_aids,
|
||||
|
||||
window=window,
|
||||
|
||||
start_date=start_date,
|
||||
|
||||
end_date=end_date,
|
||||
|
||||
cursor=cursor,
|
||||
|
||||
_headers=self.te_headers("get_user_events", error_status="404"),
|
||||
)
|
||||
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
|
||||
|
||||
|
||||
def test_get_user_events_error_429(self) -> None:
|
||||
"""Integration test for get_user_events error path (HTTP 429)"""
|
||||
aid = '1234'
|
||||
use_all_permitted_aids = False
|
||||
window = '12h'
|
||||
start_date = '2022-07-17T22:00:54Z'
|
||||
end_date = '2022-07-18T22:00:54Z'
|
||||
cursor = 'cursor_example'
|
||||
error_body_json = """
|
||||
{
|
||||
"instance" : "instance",
|
||||
"detail" : "detail",
|
||||
"type" : "type",
|
||||
"title" : "title",
|
||||
"status" : 6
|
||||
}
|
||||
"""
|
||||
expected_error = json.loads(error_body_json)
|
||||
with self.assertRaises(
|
||||
ApiException.exception_class_for_http_status(429)
|
||||
) as context:
|
||||
self.api.get_user_events(
|
||||
|
||||
aid=aid,
|
||||
|
||||
use_all_permitted_aids=use_all_permitted_aids,
|
||||
|
||||
window=window,
|
||||
|
||||
start_date=start_date,
|
||||
|
||||
end_date=end_date,
|
||||
|
||||
cursor=cursor,
|
||||
|
||||
_headers=self.te_headers("get_user_events", error_status="429"),
|
||||
)
|
||||
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
|
||||
|
||||
|
||||
def test_get_user_events_error_500(self) -> None:
|
||||
"""Integration test for get_user_events error path (HTTP 500)"""
|
||||
aid = '1234'
|
||||
use_all_permitted_aids = False
|
||||
window = '12h'
|
||||
start_date = '2022-07-17T22:00:54Z'
|
||||
end_date = '2022-07-18T22:00:54Z'
|
||||
cursor = 'cursor_example'
|
||||
error_body_json = """
|
||||
{
|
||||
"instance" : "instance",
|
||||
"detail" : "detail",
|
||||
"type" : "type",
|
||||
"title" : "title",
|
||||
"status" : 6
|
||||
}
|
||||
"""
|
||||
expected_error = json.loads(error_body_json)
|
||||
with self.assertRaises(
|
||||
ApiException.exception_class_for_http_status(500)
|
||||
) as context:
|
||||
self.api.get_user_events(
|
||||
|
||||
aid=aid,
|
||||
|
||||
use_all_permitted_aids=use_all_permitted_aids,
|
||||
|
||||
window=window,
|
||||
|
||||
start_date=start_date,
|
||||
|
||||
end_date=end_date,
|
||||
|
||||
cursor=cursor,
|
||||
|
||||
_headers=self.te_headers("get_user_events", error_status="500"),
|
||||
)
|
||||
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
1695
thousandeyes-sdk-administrative/test/test_users_api_integration.py
Normal file
1695
thousandeyes-sdk-administrative/test/test_users_api_integration.py
Normal file
File diff suppressed because it is too large
Load Diff
@ -2,15 +2,36 @@
|
||||
|
||||
import json
|
||||
import unittest
|
||||
from typing import Any
|
||||
|
||||
from pydantic import BaseModel
|
||||
|
||||
|
||||
def _project_onto_constructed(expected: Any, constructed: Any) -> Any:
|
||||
"""Keep only example fields that appear in the constructed model output."""
|
||||
if isinstance(constructed, dict):
|
||||
if not isinstance(expected, dict):
|
||||
return expected
|
||||
return {
|
||||
key: _project_onto_constructed(expected.get(key), value)
|
||||
for key, value in constructed.items()
|
||||
}
|
||||
if isinstance(constructed, list):
|
||||
if not isinstance(expected, list):
|
||||
return expected
|
||||
return [
|
||||
_project_onto_constructed(expected[index], value)
|
||||
for index, value in enumerate(constructed)
|
||||
]
|
||||
return expected
|
||||
|
||||
|
||||
def assert_constructed_model_matches_example_json(model: BaseModel, loaded_json: dict):
|
||||
test_case = unittest.TestCase()
|
||||
test_case.maxDiff = None
|
||||
test_case.assertIsNotNone(model)
|
||||
constructed_json = json.loads(model.to_json())
|
||||
sorted_loaded_json = json.dumps(loaded_json, sort_keys=True)
|
||||
projected_loaded_json = _project_onto_constructed(loaded_json, constructed_json)
|
||||
sorted_loaded_json = json.dumps(projected_loaded_json, sort_keys=True)
|
||||
sorted_constructed_json = json.dumps(constructed_json, sort_keys=True)
|
||||
test_case.assertEqual(sorted_loaded_json, sorted_constructed_json)
|
||||
|
||||
@ -140,10 +140,19 @@ src/thousandeyes_sdk/agents/models/validation_error.py
|
||||
src/thousandeyes_sdk/agents/models/validation_error_item.py
|
||||
src/thousandeyes_sdk/agents/py.typed
|
||||
test/__init__.py
|
||||
test/conftest.py
|
||||
test/integration_test_utils.py
|
||||
test/mock_manifest.py
|
||||
test/test_agent_proxies_api.py
|
||||
test/test_agent_proxies_api_integration.py
|
||||
test/test_cloud_and_enterprise_agent_notification_rules_api.py
|
||||
test/test_cloud_and_enterprise_agent_notification_rules_api_integration.py
|
||||
test/test_cloud_and_enterprise_agents_api.py
|
||||
test/test_cloud_and_enterprise_agents_api_integration.py
|
||||
test/test_enterprise_agent_cluster_api.py
|
||||
test/test_enterprise_agent_cluster_api_integration.py
|
||||
test/test_local_problems_api.py
|
||||
test/test_local_problems_api_integration.py
|
||||
test/test_tests_assignment_on_agents_api.py
|
||||
test/test_tests_assignment_on_agents_api_integration.py
|
||||
test/test_utils.py
|
||||
|
||||
@ -5,7 +5,7 @@ Manage Cloud and Enterprise Agents available to your account in ThousandEyes.
|
||||
|
||||
This Python package is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project:
|
||||
|
||||
- API version: 7.0.96
|
||||
- API version: 7.0.99
|
||||
- Generator version: 7.6.0
|
||||
- Build package: com.thousandeyes.api.codegen.ThousandeyesPythonGenerator
|
||||
|
||||
|
||||
@ -134,7 +134,7 @@ with thousandeyes_sdk.core.ApiClient(configuration) as api_client:
|
||||
api_instance = thousandeyes_sdk.agents.CloudAndEnterpriseAgentsApi(api_client)
|
||||
agent_id = '281474976710706' # str | Unique ID for the agent.
|
||||
aid = '1234' # 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)
|
||||
expand = [thousandeyes_sdk.agents.AgentDetailsExpand()] # List[AgentDetailsExpand] | Optional parameter, off by default. Indicates which agent sub-resource to expand. For example, if you wish to expand the `clusterMembers` sub-resource, pass the `?expand=cluster-member` query. (optional)
|
||||
expand = ["cluster-member"] # List[AgentDetailsExpand] | Optional parameter, off by default. Indicates which agent sub-resource to expand. For example, if you wish to expand the `clusterMembers` sub-resource, pass the `?expand=cluster-member` query. (optional)
|
||||
|
||||
try:
|
||||
# Retrieve Cloud and Enterprise Agent
|
||||
@ -224,8 +224,8 @@ with thousandeyes_sdk.core.ApiClient(configuration) as api_client:
|
||||
# Create an instance of the API class
|
||||
api_instance = thousandeyes_sdk.agents.CloudAndEnterpriseAgentsApi(api_client)
|
||||
aid = '1234' # 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)
|
||||
expand = [thousandeyes_sdk.agents.AgentListExpand()] # List[AgentListExpand] | Optional parameter, off by default. Indicates which agent sub-resource to expand. For example, if you wish to expand the `clusterMembers` sub-resource, pass the `?expand=cluster-member` query. (optional)
|
||||
agent_types = [thousandeyes_sdk.agents.CloudEnterpriseAgentType()] # List[CloudEnterpriseAgentType] | Specifies the type of agent to request. (optional)
|
||||
expand = ["cluster-member"] # List[AgentListExpand] | Optional parameter, off by default. Indicates which agent sub-resource to expand. For example, if you wish to expand the `clusterMembers` sub-resource, pass the `?expand=cluster-member` query. (optional)
|
||||
agent_types = ["enterprise"] # List[CloudEnterpriseAgentType] | Specifies the type of agent to request. (optional)
|
||||
labels = ['[\"myCustomLabeledAgent\"]'] # List[str] | Specifies the labels of the agents to request. (optional)
|
||||
tag_keys = ['tag_keys_example'] # List[str] | Specifies which tag keys to request from the agents. (optional)
|
||||
|
||||
@ -321,7 +321,7 @@ with thousandeyes_sdk.core.ApiClient(configuration) as api_client:
|
||||
agent_id = '281474976710706' # str | Unique ID for the agent.
|
||||
agent_request = thousandeyes_sdk.agents.AgentRequest() # AgentRequest |
|
||||
aid = '1234' # 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)
|
||||
expand = [thousandeyes_sdk.agents.AgentDetailsExpand()] # List[AgentDetailsExpand] | Optional parameter, off by default. Indicates which agent sub-resource to expand. For example, if you wish to expand the `clusterMembers` sub-resource, pass the `?expand=cluster-member` query. (optional)
|
||||
expand = ["cluster-member"] # List[AgentDetailsExpand] | Optional parameter, off by default. Indicates which agent sub-resource to expand. For example, if you wish to expand the `clusterMembers` sub-resource, pass the `?expand=cluster-member` query. (optional)
|
||||
|
||||
try:
|
||||
# Update Enterprise Agent
|
||||
|
||||
@ -50,7 +50,7 @@ with thousandeyes_sdk.core.ApiClient(configuration) as api_client:
|
||||
agent_id = '281474976710706' # str | Unique ID for the Enterprise Agent cluster to add new agents to.
|
||||
agent_cluster_assign_request = thousandeyes_sdk.agents.AgentClusterAssignRequest() # AgentClusterAssignRequest |
|
||||
aid = '1234' # 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)
|
||||
expand = [thousandeyes_sdk.agents.AgentDetailsExpand()] # List[AgentDetailsExpand] | Optional parameter, off by default. Indicates which agent sub-resource to expand. For example, if you wish to expand the `clusterMembers` sub-resource, pass the `?expand=cluster-member` query. (optional)
|
||||
expand = ["cluster-member"] # List[AgentDetailsExpand] | Optional parameter, off by default. Indicates which agent sub-resource to expand. For example, if you wish to expand the `clusterMembers` sub-resource, pass the `?expand=cluster-member` query. (optional)
|
||||
|
||||
try:
|
||||
# Add member to Enterprise Agent cluster
|
||||
@ -144,7 +144,7 @@ with thousandeyes_sdk.core.ApiClient(configuration) as api_client:
|
||||
agent_id = '281474976710706' # str | Unique ID for the Enterprise Agent cluster to remove agents from.
|
||||
agent_cluster_unassign_request = thousandeyes_sdk.agents.AgentClusterUnassignRequest() # AgentClusterUnassignRequest |
|
||||
aid = '1234' # 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)
|
||||
expand = [thousandeyes_sdk.agents.AgentDetailsExpand()] # List[AgentDetailsExpand] | Optional parameter, off by default. Indicates which agent sub-resource to expand. For example, if you wish to expand the `clusterMembers` sub-resource, pass the `?expand=cluster-member` query. (optional)
|
||||
expand = ["cluster-member"] # List[AgentDetailsExpand] | Optional parameter, off by default. Indicates which agent sub-resource to expand. For example, if you wish to expand the `clusterMembers` sub-resource, pass the `?expand=cluster-member` query. (optional)
|
||||
|
||||
try:
|
||||
# Remove member from Enterprise Agent cluster
|
||||
|
||||
7
thousandeyes-sdk-agents/test/conftest.py
Normal file
7
thousandeyes-sdk-agents/test/conftest.py
Normal file
@ -0,0 +1,7 @@
|
||||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
_repo_root = Path(__file__).resolve().parents[2]
|
||||
_core_test_support = _repo_root / "thousandeyes-sdk-core" / "test"
|
||||
if str(_core_test_support) not in sys.path:
|
||||
sys.path.insert(0, str(_core_test_support))
|
||||
37
thousandeyes-sdk-agents/test/integration_test_utils.py
Normal file
37
thousandeyes-sdk-agents/test/integration_test_utils.py
Normal file
@ -0,0 +1,37 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
Agents API
|
||||
|
||||
## Overview Manage Cloud and Enterprise Agents available to your account in ThousandEyes.
|
||||
|
||||
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
||||
|
||||
Do not edit the class manually.
|
||||
""" # noqa: E501
|
||||
|
||||
|
||||
import unittest
|
||||
|
||||
from thousandeyes_sdk.core.api_client import ApiClient
|
||||
from thousandeyes_sdk.core.configuration import Configuration
|
||||
from sdk_test_support.mock_server import ERROR_STATUS_HEADER, OPERATION_ID_HEADER, MockApiServer
|
||||
|
||||
from .mock_manifest import OPERATION_MANIFEST
|
||||
|
||||
|
||||
class IntegrationTestBase(unittest.TestCase):
|
||||
def setUp(self) -> None:
|
||||
self.server = MockApiServer(OPERATION_MANIFEST)
|
||||
self.server.start()
|
||||
configuration = Configuration(host=self.server.base_url, access_token="test-token")
|
||||
self.api_client = ApiClient(configuration=configuration)
|
||||
|
||||
def tearDown(self) -> None:
|
||||
self.server.stop()
|
||||
|
||||
def te_headers(self, operation_id: str, error_status=None):
|
||||
headers = {OPERATION_ID_HEADER: operation_id}
|
||||
if error_status is not None:
|
||||
headers[ERROR_STATUS_HEADER] = error_status
|
||||
return headers
|
||||
2459
thousandeyes-sdk-agents/test/mock_manifest.py
Normal file
2459
thousandeyes-sdk-agents/test/mock_manifest.py
Normal file
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,238 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
Agents API
|
||||
|
||||
## Overview Manage Cloud and Enterprise Agents available to your account in ThousandEyes.
|
||||
|
||||
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
||||
|
||||
Do not edit the class manually.
|
||||
""" # noqa: E501
|
||||
|
||||
|
||||
import json
|
||||
import unittest
|
||||
import thousandeyes_sdk.agents.models
|
||||
|
||||
from thousandeyes_sdk.core.exceptions import ApiException
|
||||
from thousandeyes_sdk.agents.api.agent_proxies_api import AgentProxiesApi
|
||||
from .integration_test_utils import IntegrationTestBase
|
||||
from .test_utils import assert_constructed_model_matches_example_json
|
||||
|
||||
|
||||
class TestAgentProxiesApiIntegration(IntegrationTestBase):
|
||||
"""AgentProxiesApi integration test stubs"""
|
||||
|
||||
def setUp(self) -> None:
|
||||
super().setUp()
|
||||
self.api = AgentProxiesApi(self.api_client)
|
||||
|
||||
|
||||
def test_get_agents_proxies_happy_path(self) -> None:
|
||||
"""Integration test for get_agents_proxies success path"""
|
||||
aid = '1234'
|
||||
response_body_json = """
|
||||
{
|
||||
"_links" : {
|
||||
"self" : {
|
||||
"hreflang" : "hreflang",
|
||||
"templated" : true,
|
||||
"profile" : "profile",
|
||||
"name" : "name",
|
||||
"href" : "https://api.thousandeyes.com/v7/link/to/resource/id",
|
||||
"type" : "type",
|
||||
"deprecation" : "deprecation",
|
||||
"title" : "title"
|
||||
}
|
||||
},
|
||||
"agentProxies" : [ {
|
||||
"password" : "**********",
|
||||
"isLocalConfigured" : true,
|
||||
"name" : "Test Proxy - Auth Type - BASIC",
|
||||
"location" : "proxy.thousandeyes.com:3128",
|
||||
"lastModified" : "2022-07-17T22:00:54Z",
|
||||
"authType" : "basic",
|
||||
"type" : "static",
|
||||
"aid" : "1234",
|
||||
"bypassList" : [ "10.0.0.0/16", "*.thousandeyes.com" ],
|
||||
"user" : "user1",
|
||||
"proxyId" : "281474976710706"
|
||||
}, {
|
||||
"password" : "**********",
|
||||
"isLocalConfigured" : true,
|
||||
"name" : "Test Proxy - Auth Type - BASIC",
|
||||
"location" : "proxy.thousandeyes.com:3128",
|
||||
"lastModified" : "2022-07-17T22:00:54Z",
|
||||
"authType" : "basic",
|
||||
"type" : "static",
|
||||
"aid" : "1234",
|
||||
"bypassList" : [ "10.0.0.0/16", "*.thousandeyes.com" ],
|
||||
"user" : "user1",
|
||||
"proxyId" : "281474976710706"
|
||||
} ]
|
||||
}
|
||||
"""
|
||||
expected_response = json.loads(response_body_json)
|
||||
response = self.api.get_agents_proxies(
|
||||
|
||||
aid=aid,
|
||||
|
||||
_headers=self.te_headers("get_agents_proxies"),
|
||||
)
|
||||
assert_constructed_model_matches_example_json(response, expected_response)
|
||||
|
||||
|
||||
def test_get_agents_proxies_error_401(self) -> None:
|
||||
"""Integration test for get_agents_proxies error path (HTTP 401)"""
|
||||
aid = '1234'
|
||||
error_body_json = """
|
||||
{
|
||||
"error_description" : "Invalid access token",
|
||||
"error" : "invalid_token"
|
||||
}
|
||||
"""
|
||||
expected_error = json.loads(error_body_json)
|
||||
with self.assertRaises(
|
||||
ApiException.exception_class_for_http_status(401)
|
||||
) as context:
|
||||
self.api.get_agents_proxies(
|
||||
|
||||
aid=aid,
|
||||
|
||||
_headers=self.te_headers("get_agents_proxies", error_status="401"),
|
||||
)
|
||||
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
|
||||
|
||||
|
||||
def test_get_agents_proxies_error_403(self) -> None:
|
||||
"""Integration test for get_agents_proxies error path (HTTP 403)"""
|
||||
aid = '1234'
|
||||
error_body_json = """
|
||||
{
|
||||
"instance" : "instance",
|
||||
"detail" : "detail",
|
||||
"type" : "type",
|
||||
"title" : "title",
|
||||
"status" : 0
|
||||
}
|
||||
"""
|
||||
expected_error = json.loads(error_body_json)
|
||||
with self.assertRaises(
|
||||
ApiException.exception_class_for_http_status(403)
|
||||
) as context:
|
||||
self.api.get_agents_proxies(
|
||||
|
||||
aid=aid,
|
||||
|
||||
_headers=self.te_headers("get_agents_proxies", error_status="403"),
|
||||
)
|
||||
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
|
||||
|
||||
|
||||
def test_get_agents_proxies_error_404(self) -> None:
|
||||
"""Integration test for get_agents_proxies error path (HTTP 404)"""
|
||||
aid = '1234'
|
||||
error_body_json = """
|
||||
{
|
||||
"instance" : "instance",
|
||||
"detail" : "detail",
|
||||
"type" : "type",
|
||||
"title" : "title",
|
||||
"status" : 0
|
||||
}
|
||||
"""
|
||||
expected_error = json.loads(error_body_json)
|
||||
with self.assertRaises(
|
||||
ApiException.exception_class_for_http_status(404)
|
||||
) as context:
|
||||
self.api.get_agents_proxies(
|
||||
|
||||
aid=aid,
|
||||
|
||||
_headers=self.te_headers("get_agents_proxies", error_status="404"),
|
||||
)
|
||||
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
|
||||
|
||||
|
||||
def test_get_agents_proxies_error_429(self) -> None:
|
||||
"""Integration test for get_agents_proxies error path (HTTP 429)"""
|
||||
aid = '1234'
|
||||
error_body_json = """
|
||||
{
|
||||
"instance" : "instance",
|
||||
"detail" : "detail",
|
||||
"type" : "type",
|
||||
"title" : "title",
|
||||
"status" : 0
|
||||
}
|
||||
"""
|
||||
expected_error = json.loads(error_body_json)
|
||||
with self.assertRaises(
|
||||
ApiException.exception_class_for_http_status(429)
|
||||
) as context:
|
||||
self.api.get_agents_proxies(
|
||||
|
||||
aid=aid,
|
||||
|
||||
_headers=self.te_headers("get_agents_proxies", error_status="429"),
|
||||
)
|
||||
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
|
||||
|
||||
|
||||
def test_get_agents_proxies_error_500(self) -> None:
|
||||
"""Integration test for get_agents_proxies error path (HTTP 500)"""
|
||||
aid = '1234'
|
||||
error_body_json = """
|
||||
{
|
||||
"instance" : "instance",
|
||||
"detail" : "detail",
|
||||
"type" : "type",
|
||||
"title" : "title",
|
||||
"status" : 0
|
||||
}
|
||||
"""
|
||||
expected_error = json.loads(error_body_json)
|
||||
with self.assertRaises(
|
||||
ApiException.exception_class_for_http_status(500)
|
||||
) as context:
|
||||
self.api.get_agents_proxies(
|
||||
|
||||
aid=aid,
|
||||
|
||||
_headers=self.te_headers("get_agents_proxies", error_status="500"),
|
||||
)
|
||||
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
|
||||
|
||||
|
||||
def test_get_agents_proxies_error_502(self) -> None:
|
||||
"""Integration test for get_agents_proxies error path (HTTP 502)"""
|
||||
aid = '1234'
|
||||
error_body_json = """
|
||||
{
|
||||
"instance" : "instance",
|
||||
"detail" : "detail",
|
||||
"type" : "type",
|
||||
"title" : "title",
|
||||
"status" : 0
|
||||
}
|
||||
"""
|
||||
expected_error = json.loads(error_body_json)
|
||||
with self.assertRaises(
|
||||
ApiException.exception_class_for_http_status(502)
|
||||
) as context:
|
||||
self.api.get_agents_proxies(
|
||||
|
||||
aid=aid,
|
||||
|
||||
_headers=self.te_headers("get_agents_proxies", error_status="502"),
|
||||
)
|
||||
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
@ -0,0 +1,517 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
Agents API
|
||||
|
||||
## Overview Manage Cloud and Enterprise Agents available to your account in ThousandEyes.
|
||||
|
||||
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
||||
|
||||
Do not edit the class manually.
|
||||
""" # noqa: E501
|
||||
|
||||
|
||||
import json
|
||||
import unittest
|
||||
import thousandeyes_sdk.agents.models
|
||||
|
||||
from thousandeyes_sdk.core.exceptions import ApiException
|
||||
from thousandeyes_sdk.agents.api.cloud_and_enterprise_agent_notification_rules_api import CloudAndEnterpriseAgentNotificationRulesApi
|
||||
from .integration_test_utils import IntegrationTestBase
|
||||
from .test_utils import assert_constructed_model_matches_example_json
|
||||
|
||||
|
||||
class TestCloudAndEnterpriseAgentNotificationRulesApiIntegration(IntegrationTestBase):
|
||||
"""CloudAndEnterpriseAgentNotificationRulesApi integration test stubs"""
|
||||
|
||||
def setUp(self) -> None:
|
||||
super().setUp()
|
||||
self.api = CloudAndEnterpriseAgentNotificationRulesApi(self.api_client)
|
||||
|
||||
|
||||
def test_get_agents_notification_rule_happy_path(self) -> None:
|
||||
"""Integration test for get_agents_notification_rule success path"""
|
||||
notification_rule_id = '281474976710706'
|
||||
aid = '1234'
|
||||
response_body_json = """
|
||||
{
|
||||
"isDefault" : false,
|
||||
"expression" : "((lastContact >= 30 min))",
|
||||
"_links" : {
|
||||
"self" : {
|
||||
"hreflang" : "hreflang",
|
||||
"templated" : true,
|
||||
"profile" : "profile",
|
||||
"name" : "name",
|
||||
"href" : "https://api.thousandeyes.com/v7/link/to/resource/id",
|
||||
"type" : "type",
|
||||
"deprecation" : "deprecation",
|
||||
"title" : "title"
|
||||
}
|
||||
},
|
||||
"ruleName" : "Default Agent Offline Notification",
|
||||
"ruleId" : "281474976710706",
|
||||
"notifications" : {
|
||||
"thirdParty" : [ {
|
||||
"integrationType" : "slack",
|
||||
"integrationName" : "integrationSlack1",
|
||||
"authToken" : "0VqDYEpidpHVAK397x8PBsmZ",
|
||||
"channel" : "#slackChannel",
|
||||
"integrationId" : "wb-78",
|
||||
"authMethod" : "Basic",
|
||||
"authUser" : "user123",
|
||||
"target" : "https://hooks.slack.com/services/asd/0VqDYEpidpHVAK397x8PBsmZ"
|
||||
}, {
|
||||
"integrationType" : "slack",
|
||||
"integrationName" : "integrationSlack1",
|
||||
"authToken" : "0VqDYEpidpHVAK397x8PBsmZ",
|
||||
"channel" : "#slackChannel",
|
||||
"integrationId" : "wb-78",
|
||||
"authMethod" : "Basic",
|
||||
"authUser" : "user123",
|
||||
"target" : "https://hooks.slack.com/services/asd/0VqDYEpidpHVAK397x8PBsmZ"
|
||||
} ],
|
||||
"webhook" : [ {
|
||||
"integrationType" : "slack",
|
||||
"integrationName" : "integrationSlack1",
|
||||
"authToken" : "0VqDYEpidpHVAK397x8PBsmZ",
|
||||
"channel" : "#slackChannel",
|
||||
"integrationId" : "wb-78",
|
||||
"authMethod" : "Basic",
|
||||
"authUser" : "user123",
|
||||
"target" : "https://hooks.slack.com/services/asd/0VqDYEpidpHVAK397x8PBsmZ"
|
||||
}, {
|
||||
"integrationType" : "slack",
|
||||
"integrationName" : "integrationSlack1",
|
||||
"authToken" : "0VqDYEpidpHVAK397x8PBsmZ",
|
||||
"channel" : "#slackChannel",
|
||||
"integrationId" : "wb-78",
|
||||
"authMethod" : "Basic",
|
||||
"authUser" : "user123",
|
||||
"target" : "https://hooks.slack.com/services/asd/0VqDYEpidpHVAK397x8PBsmZ"
|
||||
} ],
|
||||
"email" : {
|
||||
"recipients" : [ "user1@thousandeyes.com", "user2@cisco.com" ],
|
||||
"message" : "This test is failing, check as soon as possible."
|
||||
}
|
||||
},
|
||||
"notifyOnClear" : true,
|
||||
"agents" : [ {
|
||||
"agentId" : "281474976710706",
|
||||
"agentType" : "enterprise-cluster",
|
||||
"prefix" : "99.128.0.0/11",
|
||||
"coordinates" : {
|
||||
"latitude" : 37.77493,
|
||||
"longitude" : -122.41942
|
||||
},
|
||||
"agentName" : "thousandeyes-stg-va-254",
|
||||
"networkProviderInfo" : {
|
||||
"asn" : 7018,
|
||||
"name" : "AT&T Services, Inc.",
|
||||
"type" : "isp"
|
||||
},
|
||||
"countryId" : "US",
|
||||
"enabled" : true,
|
||||
"network" : "AT&T Services, Inc. (AS 7018)",
|
||||
"publicIpAddresses" : [ "192.168.1.78", "f9b2:3a21:f25c:d300:03f4:586d:f8d6:4e1c" ],
|
||||
"ipAddresses" : [ "99.139.65.220", "9bbd:8a0a:a257:5876:288b:6cb2:3f36:64ce" ],
|
||||
"location" : "San Francisco Bay Area",
|
||||
"verifySslCertificates" : true
|
||||
}, {
|
||||
"agentId" : "281474976710706",
|
||||
"agentType" : "enterprise-cluster",
|
||||
"prefix" : "99.128.0.0/11",
|
||||
"coordinates" : {
|
||||
"latitude" : 37.77493,
|
||||
"longitude" : -122.41942
|
||||
},
|
||||
"agentName" : "thousandeyes-stg-va-254",
|
||||
"networkProviderInfo" : {
|
||||
"asn" : 7018,
|
||||
"name" : "AT&T Services, Inc.",
|
||||
"type" : "isp"
|
||||
},
|
||||
"countryId" : "US",
|
||||
"enabled" : true,
|
||||
"network" : "AT&T Services, Inc. (AS 7018)",
|
||||
"publicIpAddresses" : [ "192.168.1.78", "f9b2:3a21:f25c:d300:03f4:586d:f8d6:4e1c" ],
|
||||
"ipAddresses" : [ "99.139.65.220", "9bbd:8a0a:a257:5876:288b:6cb2:3f36:64ce" ],
|
||||
"location" : "San Francisco Bay Area",
|
||||
"verifySslCertificates" : true
|
||||
} ]
|
||||
}
|
||||
"""
|
||||
expected_response = json.loads(response_body_json)
|
||||
response = self.api.get_agents_notification_rule(
|
||||
|
||||
notification_rule_id=notification_rule_id,
|
||||
|
||||
aid=aid,
|
||||
|
||||
_headers=self.te_headers("get_agents_notification_rule"),
|
||||
)
|
||||
assert_constructed_model_matches_example_json(response, expected_response)
|
||||
|
||||
|
||||
def test_get_agents_notification_rule_error_401(self) -> None:
|
||||
"""Integration test for get_agents_notification_rule error path (HTTP 401)"""
|
||||
notification_rule_id = '281474976710706'
|
||||
aid = '1234'
|
||||
error_body_json = """
|
||||
{
|
||||
"error_description" : "Invalid access token",
|
||||
"error" : "invalid_token"
|
||||
}
|
||||
"""
|
||||
expected_error = json.loads(error_body_json)
|
||||
with self.assertRaises(
|
||||
ApiException.exception_class_for_http_status(401)
|
||||
) as context:
|
||||
self.api.get_agents_notification_rule(
|
||||
|
||||
notification_rule_id=notification_rule_id,
|
||||
|
||||
aid=aid,
|
||||
|
||||
_headers=self.te_headers("get_agents_notification_rule", error_status="401"),
|
||||
)
|
||||
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
|
||||
|
||||
|
||||
def test_get_agents_notification_rule_error_403(self) -> None:
|
||||
"""Integration test for get_agents_notification_rule error path (HTTP 403)"""
|
||||
notification_rule_id = '281474976710706'
|
||||
aid = '1234'
|
||||
error_body_json = """
|
||||
{
|
||||
"instance" : "instance",
|
||||
"detail" : "detail",
|
||||
"type" : "type",
|
||||
"title" : "title",
|
||||
"status" : 0
|
||||
}
|
||||
"""
|
||||
expected_error = json.loads(error_body_json)
|
||||
with self.assertRaises(
|
||||
ApiException.exception_class_for_http_status(403)
|
||||
) as context:
|
||||
self.api.get_agents_notification_rule(
|
||||
|
||||
notification_rule_id=notification_rule_id,
|
||||
|
||||
aid=aid,
|
||||
|
||||
_headers=self.te_headers("get_agents_notification_rule", error_status="403"),
|
||||
)
|
||||
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
|
||||
|
||||
|
||||
def test_get_agents_notification_rule_error_404(self) -> None:
|
||||
"""Integration test for get_agents_notification_rule error path (HTTP 404)"""
|
||||
notification_rule_id = '281474976710706'
|
||||
aid = '1234'
|
||||
error_body_json = """
|
||||
{
|
||||
"instance" : "instance",
|
||||
"detail" : "detail",
|
||||
"type" : "type",
|
||||
"title" : "title",
|
||||
"status" : 0
|
||||
}
|
||||
"""
|
||||
expected_error = json.loads(error_body_json)
|
||||
with self.assertRaises(
|
||||
ApiException.exception_class_for_http_status(404)
|
||||
) as context:
|
||||
self.api.get_agents_notification_rule(
|
||||
|
||||
notification_rule_id=notification_rule_id,
|
||||
|
||||
aid=aid,
|
||||
|
||||
_headers=self.te_headers("get_agents_notification_rule", error_status="404"),
|
||||
)
|
||||
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
|
||||
|
||||
|
||||
def test_get_agents_notification_rule_error_429(self) -> None:
|
||||
"""Integration test for get_agents_notification_rule error path (HTTP 429)"""
|
||||
notification_rule_id = '281474976710706'
|
||||
aid = '1234'
|
||||
error_body_json = """
|
||||
{
|
||||
"instance" : "instance",
|
||||
"detail" : "detail",
|
||||
"type" : "type",
|
||||
"title" : "title",
|
||||
"status" : 0
|
||||
}
|
||||
"""
|
||||
expected_error = json.loads(error_body_json)
|
||||
with self.assertRaises(
|
||||
ApiException.exception_class_for_http_status(429)
|
||||
) as context:
|
||||
self.api.get_agents_notification_rule(
|
||||
|
||||
notification_rule_id=notification_rule_id,
|
||||
|
||||
aid=aid,
|
||||
|
||||
_headers=self.te_headers("get_agents_notification_rule", error_status="429"),
|
||||
)
|
||||
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
|
||||
|
||||
|
||||
def test_get_agents_notification_rule_error_500(self) -> None:
|
||||
"""Integration test for get_agents_notification_rule error path (HTTP 500)"""
|
||||
notification_rule_id = '281474976710706'
|
||||
aid = '1234'
|
||||
error_body_json = """
|
||||
{
|
||||
"instance" : "instance",
|
||||
"detail" : "detail",
|
||||
"type" : "type",
|
||||
"title" : "title",
|
||||
"status" : 0
|
||||
}
|
||||
"""
|
||||
expected_error = json.loads(error_body_json)
|
||||
with self.assertRaises(
|
||||
ApiException.exception_class_for_http_status(500)
|
||||
) as context:
|
||||
self.api.get_agents_notification_rule(
|
||||
|
||||
notification_rule_id=notification_rule_id,
|
||||
|
||||
aid=aid,
|
||||
|
||||
_headers=self.te_headers("get_agents_notification_rule", error_status="500"),
|
||||
)
|
||||
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
|
||||
|
||||
|
||||
def test_get_agents_notification_rule_error_502(self) -> None:
|
||||
"""Integration test for get_agents_notification_rule error path (HTTP 502)"""
|
||||
notification_rule_id = '281474976710706'
|
||||
aid = '1234'
|
||||
error_body_json = """
|
||||
{
|
||||
"instance" : "instance",
|
||||
"detail" : "detail",
|
||||
"type" : "type",
|
||||
"title" : "title",
|
||||
"status" : 0
|
||||
}
|
||||
"""
|
||||
expected_error = json.loads(error_body_json)
|
||||
with self.assertRaises(
|
||||
ApiException.exception_class_for_http_status(502)
|
||||
) as context:
|
||||
self.api.get_agents_notification_rule(
|
||||
|
||||
notification_rule_id=notification_rule_id,
|
||||
|
||||
aid=aid,
|
||||
|
||||
_headers=self.te_headers("get_agents_notification_rule", error_status="502"),
|
||||
)
|
||||
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
|
||||
|
||||
|
||||
|
||||
|
||||
def test_get_agents_notification_rules_happy_path(self) -> None:
|
||||
"""Integration test for get_agents_notification_rules success path"""
|
||||
aid = '1234'
|
||||
response_body_json = """
|
||||
{
|
||||
"agentAlertRules" : [ {
|
||||
"ruleId" : "281474976710706",
|
||||
"ruleName" : "Default Agent Offline Notification",
|
||||
"expression" : "((lastContact >= 30 min))",
|
||||
"notifyOnClear" : true,
|
||||
"isDefault" : false
|
||||
}, {
|
||||
"ruleId" : "281474976710709",
|
||||
"ruleName" : "Test Rule",
|
||||
"expression" : "((lastContact >= 40 min))",
|
||||
"notifyOnClear" : true,
|
||||
"isDefault" : true
|
||||
} ],
|
||||
"_links" : {
|
||||
"self" : {
|
||||
"hreflang" : "hreflang",
|
||||
"templated" : true,
|
||||
"profile" : "profile",
|
||||
"name" : "name",
|
||||
"href" : "https://api.thousandeyes.com/v7/link/to/resource/id",
|
||||
"type" : "type",
|
||||
"deprecation" : "deprecation",
|
||||
"title" : "title"
|
||||
}
|
||||
}
|
||||
}
|
||||
"""
|
||||
expected_response = json.loads(response_body_json)
|
||||
response = self.api.get_agents_notification_rules(
|
||||
|
||||
aid=aid,
|
||||
|
||||
_headers=self.te_headers("get_agents_notification_rules"),
|
||||
)
|
||||
assert_constructed_model_matches_example_json(response, expected_response)
|
||||
|
||||
|
||||
def test_get_agents_notification_rules_error_401(self) -> None:
|
||||
"""Integration test for get_agents_notification_rules error path (HTTP 401)"""
|
||||
aid = '1234'
|
||||
error_body_json = """
|
||||
{
|
||||
"error_description" : "Invalid access token",
|
||||
"error" : "invalid_token"
|
||||
}
|
||||
"""
|
||||
expected_error = json.loads(error_body_json)
|
||||
with self.assertRaises(
|
||||
ApiException.exception_class_for_http_status(401)
|
||||
) as context:
|
||||
self.api.get_agents_notification_rules(
|
||||
|
||||
aid=aid,
|
||||
|
||||
_headers=self.te_headers("get_agents_notification_rules", error_status="401"),
|
||||
)
|
||||
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
|
||||
|
||||
|
||||
def test_get_agents_notification_rules_error_403(self) -> None:
|
||||
"""Integration test for get_agents_notification_rules error path (HTTP 403)"""
|
||||
aid = '1234'
|
||||
error_body_json = """
|
||||
{
|
||||
"instance" : "instance",
|
||||
"detail" : "detail",
|
||||
"type" : "type",
|
||||
"title" : "title",
|
||||
"status" : 0
|
||||
}
|
||||
"""
|
||||
expected_error = json.loads(error_body_json)
|
||||
with self.assertRaises(
|
||||
ApiException.exception_class_for_http_status(403)
|
||||
) as context:
|
||||
self.api.get_agents_notification_rules(
|
||||
|
||||
aid=aid,
|
||||
|
||||
_headers=self.te_headers("get_agents_notification_rules", error_status="403"),
|
||||
)
|
||||
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
|
||||
|
||||
|
||||
def test_get_agents_notification_rules_error_404(self) -> None:
|
||||
"""Integration test for get_agents_notification_rules error path (HTTP 404)"""
|
||||
aid = '1234'
|
||||
error_body_json = """
|
||||
{
|
||||
"instance" : "instance",
|
||||
"detail" : "detail",
|
||||
"type" : "type",
|
||||
"title" : "title",
|
||||
"status" : 0
|
||||
}
|
||||
"""
|
||||
expected_error = json.loads(error_body_json)
|
||||
with self.assertRaises(
|
||||
ApiException.exception_class_for_http_status(404)
|
||||
) as context:
|
||||
self.api.get_agents_notification_rules(
|
||||
|
||||
aid=aid,
|
||||
|
||||
_headers=self.te_headers("get_agents_notification_rules", error_status="404"),
|
||||
)
|
||||
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
|
||||
|
||||
|
||||
def test_get_agents_notification_rules_error_429(self) -> None:
|
||||
"""Integration test for get_agents_notification_rules error path (HTTP 429)"""
|
||||
aid = '1234'
|
||||
error_body_json = """
|
||||
{
|
||||
"instance" : "instance",
|
||||
"detail" : "detail",
|
||||
"type" : "type",
|
||||
"title" : "title",
|
||||
"status" : 0
|
||||
}
|
||||
"""
|
||||
expected_error = json.loads(error_body_json)
|
||||
with self.assertRaises(
|
||||
ApiException.exception_class_for_http_status(429)
|
||||
) as context:
|
||||
self.api.get_agents_notification_rules(
|
||||
|
||||
aid=aid,
|
||||
|
||||
_headers=self.te_headers("get_agents_notification_rules", error_status="429"),
|
||||
)
|
||||
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
|
||||
|
||||
|
||||
def test_get_agents_notification_rules_error_500(self) -> None:
|
||||
"""Integration test for get_agents_notification_rules error path (HTTP 500)"""
|
||||
aid = '1234'
|
||||
error_body_json = """
|
||||
{
|
||||
"instance" : "instance",
|
||||
"detail" : "detail",
|
||||
"type" : "type",
|
||||
"title" : "title",
|
||||
"status" : 0
|
||||
}
|
||||
"""
|
||||
expected_error = json.loads(error_body_json)
|
||||
with self.assertRaises(
|
||||
ApiException.exception_class_for_http_status(500)
|
||||
) as context:
|
||||
self.api.get_agents_notification_rules(
|
||||
|
||||
aid=aid,
|
||||
|
||||
_headers=self.te_headers("get_agents_notification_rules", error_status="500"),
|
||||
)
|
||||
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
|
||||
|
||||
|
||||
def test_get_agents_notification_rules_error_502(self) -> None:
|
||||
"""Integration test for get_agents_notification_rules error path (HTTP 502)"""
|
||||
aid = '1234'
|
||||
error_body_json = """
|
||||
{
|
||||
"instance" : "instance",
|
||||
"detail" : "detail",
|
||||
"type" : "type",
|
||||
"title" : "title",
|
||||
"status" : 0
|
||||
}
|
||||
"""
|
||||
expected_error = json.loads(error_body_json)
|
||||
with self.assertRaises(
|
||||
ApiException.exception_class_for_http_status(502)
|
||||
) as context:
|
||||
self.api.get_agents_notification_rules(
|
||||
|
||||
aid=aid,
|
||||
|
||||
_headers=self.te_headers("get_agents_notification_rules", error_status="502"),
|
||||
)
|
||||
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,857 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
Agents API
|
||||
|
||||
## Overview Manage Cloud and Enterprise Agents available to your account in ThousandEyes.
|
||||
|
||||
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
||||
|
||||
Do not edit the class manually.
|
||||
""" # noqa: E501
|
||||
|
||||
|
||||
import json
|
||||
import unittest
|
||||
import thousandeyes_sdk.agents.models
|
||||
|
||||
from thousandeyes_sdk.core.exceptions import ApiException
|
||||
from thousandeyes_sdk.agents.api.enterprise_agent_cluster_api import EnterpriseAgentClusterApi
|
||||
from .integration_test_utils import IntegrationTestBase
|
||||
from .test_utils import assert_constructed_model_matches_example_json
|
||||
|
||||
|
||||
class TestEnterpriseAgentClusterApiIntegration(IntegrationTestBase):
|
||||
"""EnterpriseAgentClusterApi integration test stubs"""
|
||||
|
||||
def setUp(self) -> None:
|
||||
super().setUp()
|
||||
self.api = EnterpriseAgentClusterApi(self.api_client)
|
||||
|
||||
|
||||
def test_assign_agent_to_cluster_happy_path(self) -> None:
|
||||
"""Integration test for assign_agent_to_cluster success path"""
|
||||
request_body_json = """
|
||||
|
||||
{
|
||||
"agents" : [ "281474976710706" ]
|
||||
}
|
||||
|
||||
"""
|
||||
agent_cluster_assign_request = thousandeyes_sdk.agents.models.AgentClusterAssignRequest.from_json(request_body_json)
|
||||
agent_id = '281474976710706'
|
||||
aid = '1234'
|
||||
expand = ["cluster-member"]
|
||||
response_body_json = """
|
||||
{
|
||||
"agentId" : "281474976710706",
|
||||
"agentType" : "cloud",
|
||||
"_links" : {
|
||||
"self" : {
|
||||
"hreflang" : "hreflang",
|
||||
"templated" : true,
|
||||
"profile" : "profile",
|
||||
"name" : "name",
|
||||
"href" : "https://api.thousandeyes.com/v7/link/to/resource/id",
|
||||
"type" : "type",
|
||||
"deprecation" : "deprecation",
|
||||
"title" : "title"
|
||||
}
|
||||
},
|
||||
"prefix" : "99.128.0.0/11",
|
||||
"coordinates" : {
|
||||
"latitude" : 37.77493,
|
||||
"longitude" : -122.41942
|
||||
},
|
||||
"agentName" : "thousandeyes-stg-va-254",
|
||||
"networkProviderInfo" : {
|
||||
"asn" : 7018,
|
||||
"name" : "AT&T Services, Inc.",
|
||||
"type" : "isp"
|
||||
},
|
||||
"countryId" : "US",
|
||||
"enabled" : true,
|
||||
"network" : "AT&T Services, Inc. (AS 7018)",
|
||||
"labels" : [ {
|
||||
"labelId" : "11",
|
||||
"name" : "Label name"
|
||||
}, {
|
||||
"labelId" : "11",
|
||||
"name" : "Label name"
|
||||
} ],
|
||||
"tags" : [ {
|
||||
"id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c",
|
||||
"value" : "San Francisco",
|
||||
"key" : "Location"
|
||||
}, {
|
||||
"id" : "5aeab5d5-0d34-4d44-a7ac-fb440185295c",
|
||||
"value" : "San Francisco",
|
||||
"key" : "Location"
|
||||
} ],
|
||||
"tests" : [ {
|
||||
"_links" : {
|
||||
"testResults" : [ {
|
||||
"href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network"
|
||||
}, {
|
||||
"href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis"
|
||||
} ],
|
||||
"self" : {
|
||||
"hreflang" : "hreflang",
|
||||
"templated" : true,
|
||||
"profile" : "profile",
|
||||
"name" : "name",
|
||||
"href" : "https://api.thousandeyes.com/v7/link/to/resource/id",
|
||||
"type" : "type",
|
||||
"deprecation" : "deprecation",
|
||||
"title" : "title"
|
||||
}
|
||||
},
|
||||
"liveShare" : false,
|
||||
"savedEvent" : true,
|
||||
"description" : "ThousandEyes Test",
|
||||
"type" : "agent-to-server",
|
||||
"enabled" : true,
|
||||
"createdDate" : "2022-07-17T22:00:54Z",
|
||||
"createdBy" : "user@user.com",
|
||||
"modifiedDate" : "2022-07-17T22:00:54Z",
|
||||
"interval" : 60,
|
||||
"modifiedBy" : "user@user.com",
|
||||
"testId" : "281474976710706",
|
||||
"alertsEnabled" : true,
|
||||
"testName" : "ThousandEyes Test"
|
||||
}, {
|
||||
"_links" : {
|
||||
"testResults" : [ {
|
||||
"href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/network"
|
||||
}, {
|
||||
"href" : "https://api.thousandeyes.com/v7/test-results/281474976710706/path-vis"
|
||||
} ],
|
||||
"self" : {
|
||||
"hreflang" : "hreflang",
|
||||
"templated" : true,
|
||||
"profile" : "profile",
|
||||
"name" : "name",
|
||||
"href" : "https://api.thousandeyes.com/v7/link/to/resource/id",
|
||||
"type" : "type",
|
||||
"deprecation" : "deprecation",
|
||||
"title" : "title"
|
||||
}
|
||||
},
|
||||
"liveShare" : false,
|
||||
"savedEvent" : true,
|
||||
"description" : "ThousandEyes Test",
|
||||
"type" : "agent-to-server",
|
||||
"enabled" : true,
|
||||
"createdDate" : "2022-07-17T22:00:54Z",
|
||||
"createdBy" : "user@user.com",
|
||||
"modifiedDate" : "2022-07-17T22:00:54Z",
|
||||
"interval" : 60,
|
||||
"modifiedBy" : "user@user.com",
|
||||
"testId" : "281474976710706",
|
||||
"alertsEnabled" : true,
|
||||
"testName" : "ThousandEyes Test"
|
||||
} ],
|
||||
"publicIpAddresses" : [ "192.168.1.78", "f9b2:3a21:f25c:d300:03f4:586d:f8d6:4e1c" ],
|
||||
"ipAddresses" : [ "99.139.65.220", "9bbd:8a0a:a257:5876:288b:6cb2:3f36:64ce" ],
|
||||
"location" : "San Francisco Bay Area",
|
||||
"verifySslCertificates" : true
|
||||
}
|
||||
"""
|
||||
expected_response = json.loads(response_body_json)
|
||||
response = self.api.assign_agent_to_cluster(
|
||||
|
||||
agent_id=agent_id,
|
||||
|
||||
agent_cluster_assign_request=agent_cluster_assign_request,
|
||||
|
||||
aid=aid,
|
||||
|
||||
expand=expand,
|
||||
|
||||
_headers=self.te_headers("assign_agent_to_cluster"),
|
||||
)
|
||||
assert_constructed_model_matches_example_json(response, expected_response)
|
||||
|
||||
|
||||
def test_assign_agent_to_cluster_error_400(self) -> None:
|
||||
"""Integration test for assign_agent_to_cluster error path (HTTP 400)"""
|
||||
request_body_json = """
|
||||
|
||||
{
|
||||
"agents" : [ "281474976710706" ]
|
||||
}
|
||||
|
||||
"""
|
||||
agent_cluster_assign_request = thousandeyes_sdk.agents.models.AgentClusterAssignRequest.from_json(request_body_json)
|
||||
agent_id = '281474976710706'
|
||||
aid = '1234'
|
||||
expand = ["cluster-member"]
|
||||
error_body_json = """
|
||||
{
|
||||
"instance" : "instance",
|
||||
"detail" : "detail",
|
||||
"type" : "type",
|
||||
"title" : "title",
|
||||
"errors" : [ {
|
||||
"code" : "code",
|
||||
"field" : "field",
|
||||
"message" : "message"
|
||||
}, {
|
||||
"code" : "code",
|
||||
"field" : "field",
|
||||
"message" : "message"
|
||||
} ],
|
||||
"status" : 0
|
||||
}
|
||||
"""
|
||||
expected_error = json.loads(error_body_json)
|
||||
with self.assertRaises(
|
||||
ApiException.exception_class_for_http_status(400)
|
||||
) as context:
|
||||
self.api.assign_agent_to_cluster(
|
||||
|
||||
agent_id=agent_id,
|
||||
|
||||
agent_cluster_assign_request=agent_cluster_assign_request,
|
||||
|
||||
aid=aid,
|
||||
|
||||
expand=expand,
|
||||
|
||||
_headers=self.te_headers("assign_agent_to_cluster", error_status="400"),
|
||||
)
|
||||
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
|
||||
|
||||
|
||||
def test_assign_agent_to_cluster_error_401(self) -> None:
|
||||
"""Integration test for assign_agent_to_cluster error path (HTTP 401)"""
|
||||
request_body_json = """
|
||||
|
||||
{
|
||||
"agents" : [ "281474976710706" ]
|
||||
}
|
||||
|
||||
"""
|
||||
agent_cluster_assign_request = thousandeyes_sdk.agents.models.AgentClusterAssignRequest.from_json(request_body_json)
|
||||
agent_id = '281474976710706'
|
||||
aid = '1234'
|
||||
expand = ["cluster-member"]
|
||||
error_body_json = """
|
||||
{
|
||||
"error_description" : "Invalid access token",
|
||||
"error" : "invalid_token"
|
||||
}
|
||||
"""
|
||||
expected_error = json.loads(error_body_json)
|
||||
with self.assertRaises(
|
||||
ApiException.exception_class_for_http_status(401)
|
||||
) as context:
|
||||
self.api.assign_agent_to_cluster(
|
||||
|
||||
agent_id=agent_id,
|
||||
|
||||
agent_cluster_assign_request=agent_cluster_assign_request,
|
||||
|
||||
aid=aid,
|
||||
|
||||
expand=expand,
|
||||
|
||||
_headers=self.te_headers("assign_agent_to_cluster", error_status="401"),
|
||||
)
|
||||
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
|
||||
|
||||
|
||||
def test_assign_agent_to_cluster_error_403(self) -> None:
|
||||
"""Integration test for assign_agent_to_cluster error path (HTTP 403)"""
|
||||
request_body_json = """
|
||||
|
||||
{
|
||||
"agents" : [ "281474976710706" ]
|
||||
}
|
||||
|
||||
"""
|
||||
agent_cluster_assign_request = thousandeyes_sdk.agents.models.AgentClusterAssignRequest.from_json(request_body_json)
|
||||
agent_id = '281474976710706'
|
||||
aid = '1234'
|
||||
expand = ["cluster-member"]
|
||||
error_body_json = """
|
||||
{
|
||||
"instance" : "instance",
|
||||
"detail" : "detail",
|
||||
"type" : "type",
|
||||
"title" : "title",
|
||||
"status" : 0
|
||||
}
|
||||
"""
|
||||
expected_error = json.loads(error_body_json)
|
||||
with self.assertRaises(
|
||||
ApiException.exception_class_for_http_status(403)
|
||||
) as context:
|
||||
self.api.assign_agent_to_cluster(
|
||||
|
||||
agent_id=agent_id,
|
||||
|
||||
agent_cluster_assign_request=agent_cluster_assign_request,
|
||||
|
||||
aid=aid,
|
||||
|
||||
expand=expand,
|
||||
|
||||
_headers=self.te_headers("assign_agent_to_cluster", error_status="403"),
|
||||
)
|
||||
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
|
||||
|
||||
|
||||
def test_assign_agent_to_cluster_error_404(self) -> None:
|
||||
"""Integration test for assign_agent_to_cluster error path (HTTP 404)"""
|
||||
request_body_json = """
|
||||
|
||||
{
|
||||
"agents" : [ "281474976710706" ]
|
||||
}
|
||||
|
||||
"""
|
||||
agent_cluster_assign_request = thousandeyes_sdk.agents.models.AgentClusterAssignRequest.from_json(request_body_json)
|
||||
agent_id = '281474976710706'
|
||||
aid = '1234'
|
||||
expand = ["cluster-member"]
|
||||
error_body_json = """
|
||||
{
|
||||
"instance" : "instance",
|
||||
"detail" : "detail",
|
||||
"type" : "type",
|
||||
"title" : "title",
|
||||
"status" : 0
|
||||
}
|
||||
"""
|
||||
expected_error = json.loads(error_body_json)
|
||||
with self.assertRaises(
|
||||
ApiException.exception_class_for_http_status(404)
|
||||
) as context:
|
||||
self.api.assign_agent_to_cluster(
|
||||
|
||||
agent_id=agent_id,
|
||||
|
||||
agent_cluster_assign_request=agent_cluster_assign_request,
|
||||
|
||||
aid=aid,
|
||||
|
||||
expand=expand,
|
||||
|
||||
_headers=self.te_headers("assign_agent_to_cluster", error_status="404"),
|
||||
)
|
||||
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
|
||||
|
||||
|
||||
def test_assign_agent_to_cluster_error_429(self) -> None:
|
||||
"""Integration test for assign_agent_to_cluster error path (HTTP 429)"""
|
||||
request_body_json = """
|
||||
|
||||
{
|
||||
"agents" : [ "281474976710706" ]
|
||||
}
|
||||
|
||||
"""
|
||||
agent_cluster_assign_request = thousandeyes_sdk.agents.models.AgentClusterAssignRequest.from_json(request_body_json)
|
||||
agent_id = '281474976710706'
|
||||
aid = '1234'
|
||||
expand = ["cluster-member"]
|
||||
error_body_json = """
|
||||
{
|
||||
"instance" : "instance",
|
||||
"detail" : "detail",
|
||||
"type" : "type",
|
||||
"title" : "title",
|
||||
"status" : 0
|
||||
}
|
||||
"""
|
||||
expected_error = json.loads(error_body_json)
|
||||
with self.assertRaises(
|
||||
ApiException.exception_class_for_http_status(429)
|
||||
) as context:
|
||||
self.api.assign_agent_to_cluster(
|
||||
|
||||
agent_id=agent_id,
|
||||
|
||||
agent_cluster_assign_request=agent_cluster_assign_request,
|
||||
|
||||
aid=aid,
|
||||
|
||||
expand=expand,
|
||||
|
||||
_headers=self.te_headers("assign_agent_to_cluster", error_status="429"),
|
||||
)
|
||||
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
|
||||
|
||||
|
||||
def test_assign_agent_to_cluster_error_500(self) -> None:
|
||||
"""Integration test for assign_agent_to_cluster error path (HTTP 500)"""
|
||||
request_body_json = """
|
||||
|
||||
{
|
||||
"agents" : [ "281474976710706" ]
|
||||
}
|
||||
|
||||
"""
|
||||
agent_cluster_assign_request = thousandeyes_sdk.agents.models.AgentClusterAssignRequest.from_json(request_body_json)
|
||||
agent_id = '281474976710706'
|
||||
aid = '1234'
|
||||
expand = ["cluster-member"]
|
||||
error_body_json = """
|
||||
{
|
||||
"instance" : "instance",
|
||||
"detail" : "detail",
|
||||
"type" : "type",
|
||||
"title" : "title",
|
||||
"status" : 0
|
||||
}
|
||||
"""
|
||||
expected_error = json.loads(error_body_json)
|
||||
with self.assertRaises(
|
||||
ApiException.exception_class_for_http_status(500)
|
||||
) as context:
|
||||
self.api.assign_agent_to_cluster(
|
||||
|
||||
agent_id=agent_id,
|
||||
|
||||
agent_cluster_assign_request=agent_cluster_assign_request,
|
||||
|
||||
aid=aid,
|
||||
|
||||
expand=expand,
|
||||
|
||||
_headers=self.te_headers("assign_agent_to_cluster", error_status="500"),
|
||||
)
|
||||
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
|
||||
|
||||
|
||||
def test_assign_agent_to_cluster_error_502(self) -> None:
|
||||
"""Integration test for assign_agent_to_cluster error path (HTTP 502)"""
|
||||
request_body_json = """
|
||||
|
||||
{
|
||||
"agents" : [ "281474976710706" ]
|
||||
}
|
||||
|
||||
"""
|
||||
agent_cluster_assign_request = thousandeyes_sdk.agents.models.AgentClusterAssignRequest.from_json(request_body_json)
|
||||
agent_id = '281474976710706'
|
||||
aid = '1234'
|
||||
expand = ["cluster-member"]
|
||||
error_body_json = """
|
||||
{
|
||||
"instance" : "instance",
|
||||
"detail" : "detail",
|
||||
"type" : "type",
|
||||
"title" : "title",
|
||||
"status" : 0
|
||||
}
|
||||
"""
|
||||
expected_error = json.loads(error_body_json)
|
||||
with self.assertRaises(
|
||||
ApiException.exception_class_for_http_status(502)
|
||||
) as context:
|
||||
self.api.assign_agent_to_cluster(
|
||||
|
||||
agent_id=agent_id,
|
||||
|
||||
agent_cluster_assign_request=agent_cluster_assign_request,
|
||||
|
||||
aid=aid,
|
||||
|
||||
expand=expand,
|
||||
|
||||
_headers=self.te_headers("assign_agent_to_cluster", error_status="502"),
|
||||
)
|
||||
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
|
||||
|
||||
|
||||
|
||||
|
||||
def test_unassign_agent_from_cluster_happy_path(self) -> None:
|
||||
"""Integration test for unassign_agent_from_cluster success path"""
|
||||
request_body_json = """
|
||||
|
||||
{
|
||||
"members" : [ "281474976710706" ]
|
||||
}
|
||||
|
||||
"""
|
||||
agent_cluster_unassign_request = thousandeyes_sdk.agents.models.AgentClusterUnassignRequest.from_json(request_body_json)
|
||||
agent_id = '281474976710706'
|
||||
aid = '1234'
|
||||
expand = ["cluster-member"]
|
||||
response_body_json = """
|
||||
{
|
||||
"_links" : {
|
||||
"self" : {
|
||||
"hreflang" : "hreflang",
|
||||
"templated" : true,
|
||||
"profile" : "profile",
|
||||
"name" : "name",
|
||||
"href" : "https://api.thousandeyes.com/v7/link/to/resource/id",
|
||||
"type" : "type",
|
||||
"deprecation" : "deprecation",
|
||||
"title" : "title"
|
||||
}
|
||||
},
|
||||
"agents" : [ {
|
||||
"agentId" : "281474976710706",
|
||||
"agentType" : "enterprise-cluster",
|
||||
"prefix" : "99.128.0.0/11",
|
||||
"coordinates" : {
|
||||
"latitude" : 37.77493,
|
||||
"longitude" : -122.41942
|
||||
},
|
||||
"agentName" : "thousandeyes-stg-va-254",
|
||||
"networkProviderInfo" : {
|
||||
"asn" : 7018,
|
||||
"name" : "AT&T Services, Inc.",
|
||||
"type" : "isp"
|
||||
},
|
||||
"countryId" : "US",
|
||||
"enabled" : true,
|
||||
"network" : "AT&T Services, Inc. (AS 7018)",
|
||||
"publicIpAddresses" : [ "192.168.1.78", "f9b2:3a21:f25c:d300:03f4:586d:f8d6:4e1c" ],
|
||||
"ipAddresses" : [ "99.139.65.220", "9bbd:8a0a:a257:5876:288b:6cb2:3f36:64ce" ],
|
||||
"location" : "San Francisco Bay Area",
|
||||
"verifySslCertificates" : true
|
||||
}, {
|
||||
"agentId" : "281474976710706",
|
||||
"agentType" : "enterprise-cluster",
|
||||
"prefix" : "99.128.0.0/11",
|
||||
"coordinates" : {
|
||||
"latitude" : 37.77493,
|
||||
"longitude" : -122.41942
|
||||
},
|
||||
"agentName" : "thousandeyes-stg-va-254",
|
||||
"networkProviderInfo" : {
|
||||
"asn" : 7018,
|
||||
"name" : "AT&T Services, Inc.",
|
||||
"type" : "isp"
|
||||
},
|
||||
"countryId" : "US",
|
||||
"enabled" : true,
|
||||
"network" : "AT&T Services, Inc. (AS 7018)",
|
||||
"publicIpAddresses" : [ "192.168.1.78", "f9b2:3a21:f25c:d300:03f4:586d:f8d6:4e1c" ],
|
||||
"ipAddresses" : [ "99.139.65.220", "9bbd:8a0a:a257:5876:288b:6cb2:3f36:64ce" ],
|
||||
"location" : "San Francisco Bay Area",
|
||||
"verifySslCertificates" : true
|
||||
} ]
|
||||
}
|
||||
"""
|
||||
expected_response = json.loads(response_body_json)
|
||||
response = self.api.unassign_agent_from_cluster(
|
||||
|
||||
agent_id=agent_id,
|
||||
|
||||
agent_cluster_unassign_request=agent_cluster_unassign_request,
|
||||
|
||||
aid=aid,
|
||||
|
||||
expand=expand,
|
||||
|
||||
_headers=self.te_headers("unassign_agent_from_cluster"),
|
||||
)
|
||||
assert_constructed_model_matches_example_json(response, expected_response)
|
||||
|
||||
|
||||
def test_unassign_agent_from_cluster_error_400(self) -> None:
|
||||
"""Integration test for unassign_agent_from_cluster error path (HTTP 400)"""
|
||||
request_body_json = """
|
||||
|
||||
{
|
||||
"members" : [ "281474976710706" ]
|
||||
}
|
||||
|
||||
"""
|
||||
agent_cluster_unassign_request = thousandeyes_sdk.agents.models.AgentClusterUnassignRequest.from_json(request_body_json)
|
||||
agent_id = '281474976710706'
|
||||
aid = '1234'
|
||||
expand = ["cluster-member"]
|
||||
error_body_json = """
|
||||
{
|
||||
"instance" : "instance",
|
||||
"detail" : "detail",
|
||||
"type" : "type",
|
||||
"title" : "title",
|
||||
"errors" : [ {
|
||||
"code" : "code",
|
||||
"field" : "field",
|
||||
"message" : "message"
|
||||
}, {
|
||||
"code" : "code",
|
||||
"field" : "field",
|
||||
"message" : "message"
|
||||
} ],
|
||||
"status" : 0
|
||||
}
|
||||
"""
|
||||
expected_error = json.loads(error_body_json)
|
||||
with self.assertRaises(
|
||||
ApiException.exception_class_for_http_status(400)
|
||||
) as context:
|
||||
self.api.unassign_agent_from_cluster(
|
||||
|
||||
agent_id=agent_id,
|
||||
|
||||
agent_cluster_unassign_request=agent_cluster_unassign_request,
|
||||
|
||||
aid=aid,
|
||||
|
||||
expand=expand,
|
||||
|
||||
_headers=self.te_headers("unassign_agent_from_cluster", error_status="400"),
|
||||
)
|
||||
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
|
||||
|
||||
|
||||
def test_unassign_agent_from_cluster_error_401(self) -> None:
|
||||
"""Integration test for unassign_agent_from_cluster error path (HTTP 401)"""
|
||||
request_body_json = """
|
||||
|
||||
{
|
||||
"members" : [ "281474976710706" ]
|
||||
}
|
||||
|
||||
"""
|
||||
agent_cluster_unassign_request = thousandeyes_sdk.agents.models.AgentClusterUnassignRequest.from_json(request_body_json)
|
||||
agent_id = '281474976710706'
|
||||
aid = '1234'
|
||||
expand = ["cluster-member"]
|
||||
error_body_json = """
|
||||
{
|
||||
"error_description" : "Invalid access token",
|
||||
"error" : "invalid_token"
|
||||
}
|
||||
"""
|
||||
expected_error = json.loads(error_body_json)
|
||||
with self.assertRaises(
|
||||
ApiException.exception_class_for_http_status(401)
|
||||
) as context:
|
||||
self.api.unassign_agent_from_cluster(
|
||||
|
||||
agent_id=agent_id,
|
||||
|
||||
agent_cluster_unassign_request=agent_cluster_unassign_request,
|
||||
|
||||
aid=aid,
|
||||
|
||||
expand=expand,
|
||||
|
||||
_headers=self.te_headers("unassign_agent_from_cluster", error_status="401"),
|
||||
)
|
||||
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
|
||||
|
||||
|
||||
def test_unassign_agent_from_cluster_error_403(self) -> None:
|
||||
"""Integration test for unassign_agent_from_cluster error path (HTTP 403)"""
|
||||
request_body_json = """
|
||||
|
||||
{
|
||||
"members" : [ "281474976710706" ]
|
||||
}
|
||||
|
||||
"""
|
||||
agent_cluster_unassign_request = thousandeyes_sdk.agents.models.AgentClusterUnassignRequest.from_json(request_body_json)
|
||||
agent_id = '281474976710706'
|
||||
aid = '1234'
|
||||
expand = ["cluster-member"]
|
||||
error_body_json = """
|
||||
{
|
||||
"instance" : "instance",
|
||||
"detail" : "detail",
|
||||
"type" : "type",
|
||||
"title" : "title",
|
||||
"status" : 0
|
||||
}
|
||||
"""
|
||||
expected_error = json.loads(error_body_json)
|
||||
with self.assertRaises(
|
||||
ApiException.exception_class_for_http_status(403)
|
||||
) as context:
|
||||
self.api.unassign_agent_from_cluster(
|
||||
|
||||
agent_id=agent_id,
|
||||
|
||||
agent_cluster_unassign_request=agent_cluster_unassign_request,
|
||||
|
||||
aid=aid,
|
||||
|
||||
expand=expand,
|
||||
|
||||
_headers=self.te_headers("unassign_agent_from_cluster", error_status="403"),
|
||||
)
|
||||
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
|
||||
|
||||
|
||||
def test_unassign_agent_from_cluster_error_404(self) -> None:
|
||||
"""Integration test for unassign_agent_from_cluster error path (HTTP 404)"""
|
||||
request_body_json = """
|
||||
|
||||
{
|
||||
"members" : [ "281474976710706" ]
|
||||
}
|
||||
|
||||
"""
|
||||
agent_cluster_unassign_request = thousandeyes_sdk.agents.models.AgentClusterUnassignRequest.from_json(request_body_json)
|
||||
agent_id = '281474976710706'
|
||||
aid = '1234'
|
||||
expand = ["cluster-member"]
|
||||
error_body_json = """
|
||||
{
|
||||
"instance" : "instance",
|
||||
"detail" : "detail",
|
||||
"type" : "type",
|
||||
"title" : "title",
|
||||
"status" : 0
|
||||
}
|
||||
"""
|
||||
expected_error = json.loads(error_body_json)
|
||||
with self.assertRaises(
|
||||
ApiException.exception_class_for_http_status(404)
|
||||
) as context:
|
||||
self.api.unassign_agent_from_cluster(
|
||||
|
||||
agent_id=agent_id,
|
||||
|
||||
agent_cluster_unassign_request=agent_cluster_unassign_request,
|
||||
|
||||
aid=aid,
|
||||
|
||||
expand=expand,
|
||||
|
||||
_headers=self.te_headers("unassign_agent_from_cluster", error_status="404"),
|
||||
)
|
||||
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
|
||||
|
||||
|
||||
def test_unassign_agent_from_cluster_error_429(self) -> None:
|
||||
"""Integration test for unassign_agent_from_cluster error path (HTTP 429)"""
|
||||
request_body_json = """
|
||||
|
||||
{
|
||||
"members" : [ "281474976710706" ]
|
||||
}
|
||||
|
||||
"""
|
||||
agent_cluster_unassign_request = thousandeyes_sdk.agents.models.AgentClusterUnassignRequest.from_json(request_body_json)
|
||||
agent_id = '281474976710706'
|
||||
aid = '1234'
|
||||
expand = ["cluster-member"]
|
||||
error_body_json = """
|
||||
{
|
||||
"instance" : "instance",
|
||||
"detail" : "detail",
|
||||
"type" : "type",
|
||||
"title" : "title",
|
||||
"status" : 0
|
||||
}
|
||||
"""
|
||||
expected_error = json.loads(error_body_json)
|
||||
with self.assertRaises(
|
||||
ApiException.exception_class_for_http_status(429)
|
||||
) as context:
|
||||
self.api.unassign_agent_from_cluster(
|
||||
|
||||
agent_id=agent_id,
|
||||
|
||||
agent_cluster_unassign_request=agent_cluster_unassign_request,
|
||||
|
||||
aid=aid,
|
||||
|
||||
expand=expand,
|
||||
|
||||
_headers=self.te_headers("unassign_agent_from_cluster", error_status="429"),
|
||||
)
|
||||
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
|
||||
|
||||
|
||||
def test_unassign_agent_from_cluster_error_500(self) -> None:
|
||||
"""Integration test for unassign_agent_from_cluster error path (HTTP 500)"""
|
||||
request_body_json = """
|
||||
|
||||
{
|
||||
"members" : [ "281474976710706" ]
|
||||
}
|
||||
|
||||
"""
|
||||
agent_cluster_unassign_request = thousandeyes_sdk.agents.models.AgentClusterUnassignRequest.from_json(request_body_json)
|
||||
agent_id = '281474976710706'
|
||||
aid = '1234'
|
||||
expand = ["cluster-member"]
|
||||
error_body_json = """
|
||||
{
|
||||
"instance" : "instance",
|
||||
"detail" : "detail",
|
||||
"type" : "type",
|
||||
"title" : "title",
|
||||
"status" : 0
|
||||
}
|
||||
"""
|
||||
expected_error = json.loads(error_body_json)
|
||||
with self.assertRaises(
|
||||
ApiException.exception_class_for_http_status(500)
|
||||
) as context:
|
||||
self.api.unassign_agent_from_cluster(
|
||||
|
||||
agent_id=agent_id,
|
||||
|
||||
agent_cluster_unassign_request=agent_cluster_unassign_request,
|
||||
|
||||
aid=aid,
|
||||
|
||||
expand=expand,
|
||||
|
||||
_headers=self.te_headers("unassign_agent_from_cluster", error_status="500"),
|
||||
)
|
||||
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
|
||||
|
||||
|
||||
def test_unassign_agent_from_cluster_error_502(self) -> None:
|
||||
"""Integration test for unassign_agent_from_cluster error path (HTTP 502)"""
|
||||
request_body_json = """
|
||||
|
||||
{
|
||||
"members" : [ "281474976710706" ]
|
||||
}
|
||||
|
||||
"""
|
||||
agent_cluster_unassign_request = thousandeyes_sdk.agents.models.AgentClusterUnassignRequest.from_json(request_body_json)
|
||||
agent_id = '281474976710706'
|
||||
aid = '1234'
|
||||
expand = ["cluster-member"]
|
||||
error_body_json = """
|
||||
{
|
||||
"instance" : "instance",
|
||||
"detail" : "detail",
|
||||
"type" : "type",
|
||||
"title" : "title",
|
||||
"status" : 0
|
||||
}
|
||||
"""
|
||||
expected_error = json.loads(error_body_json)
|
||||
with self.assertRaises(
|
||||
ApiException.exception_class_for_http_status(502)
|
||||
) as context:
|
||||
self.api.unassign_agent_from_cluster(
|
||||
|
||||
agent_id=agent_id,
|
||||
|
||||
agent_cluster_unassign_request=agent_cluster_unassign_request,
|
||||
|
||||
aid=aid,
|
||||
|
||||
expand=expand,
|
||||
|
||||
_headers=self.te_headers("unassign_agent_from_cluster", error_status="502"),
|
||||
)
|
||||
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
@ -0,0 +1,344 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
Agents API
|
||||
|
||||
## Overview Manage Cloud and Enterprise Agents available to your account in ThousandEyes.
|
||||
|
||||
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
||||
|
||||
Do not edit the class manually.
|
||||
""" # noqa: E501
|
||||
|
||||
|
||||
import json
|
||||
import unittest
|
||||
import thousandeyes_sdk.agents.models
|
||||
|
||||
from thousandeyes_sdk.core.exceptions import ApiException
|
||||
from thousandeyes_sdk.agents.api.local_problems_api import LocalProblemsApi
|
||||
from .integration_test_utils import IntegrationTestBase
|
||||
from .test_utils import assert_constructed_model_matches_example_json
|
||||
|
||||
|
||||
class TestLocalProblemsApiIntegration(IntegrationTestBase):
|
||||
"""LocalProblemsApi integration test stubs"""
|
||||
|
||||
def setUp(self) -> None:
|
||||
super().setUp()
|
||||
self.api = LocalProblemsApi(self.api_client)
|
||||
|
||||
|
||||
def test_get_agents_local_problems_happy_path(self) -> None:
|
||||
"""Integration test for get_agents_local_problems success path"""
|
||||
aid = '1234'
|
||||
window = '12h'
|
||||
start_date = '2022-07-17T22:00:54Z'
|
||||
end_date = '2022-07-18T22:00:54Z'
|
||||
response_body_json = """
|
||||
{
|
||||
"endDate" : "2022-07-18T22:00:54Z",
|
||||
"_links" : {
|
||||
"self" : {
|
||||
"hreflang" : "hreflang",
|
||||
"templated" : true,
|
||||
"profile" : "profile",
|
||||
"name" : "name",
|
||||
"href" : "https://api.thousandeyes.com/v7/link/to/resource/id",
|
||||
"type" : "type",
|
||||
"deprecation" : "deprecation",
|
||||
"title" : "title"
|
||||
}
|
||||
},
|
||||
"localProblems" : [ {
|
||||
"duration" : 480,
|
||||
"agent" : {
|
||||
"agentId" : "281474976710706",
|
||||
"agentName" : "thousandeyes-stg-va-254",
|
||||
"location" : "San Francisco Bay Area",
|
||||
"countryId" : "US"
|
||||
},
|
||||
"endDate" : "2026-05-18T03:22:00Z",
|
||||
"active" : false,
|
||||
"startDate" : "2026-05-18T03:14:00Z"
|
||||
}, {
|
||||
"duration" : 480,
|
||||
"agent" : {
|
||||
"agentId" : "281474976710706",
|
||||
"agentName" : "thousandeyes-stg-va-254",
|
||||
"location" : "San Francisco Bay Area",
|
||||
"countryId" : "US"
|
||||
},
|
||||
"endDate" : "2026-05-18T03:22:00Z",
|
||||
"active" : false,
|
||||
"startDate" : "2026-05-18T03:14:00Z"
|
||||
} ],
|
||||
"startDate" : "2022-07-17T22:00:54Z"
|
||||
}
|
||||
"""
|
||||
expected_response = json.loads(response_body_json)
|
||||
response = self.api.get_agents_local_problems(
|
||||
|
||||
aid=aid,
|
||||
|
||||
window=window,
|
||||
|
||||
start_date=start_date,
|
||||
|
||||
end_date=end_date,
|
||||
|
||||
_headers=self.te_headers("get_agents_local_problems"),
|
||||
)
|
||||
assert_constructed_model_matches_example_json(response, expected_response)
|
||||
|
||||
|
||||
def test_get_agents_local_problems_error_400(self) -> None:
|
||||
"""Integration test for get_agents_local_problems error path (HTTP 400)"""
|
||||
aid = '1234'
|
||||
window = '12h'
|
||||
start_date = '2022-07-17T22:00:54Z'
|
||||
end_date = '2022-07-18T22:00:54Z'
|
||||
error_body_json = """
|
||||
{
|
||||
"instance" : "instance",
|
||||
"detail" : "detail",
|
||||
"type" : "type",
|
||||
"title" : "title",
|
||||
"errors" : [ {
|
||||
"code" : "code",
|
||||
"field" : "field",
|
||||
"message" : "message"
|
||||
}, {
|
||||
"code" : "code",
|
||||
"field" : "field",
|
||||
"message" : "message"
|
||||
} ],
|
||||
"status" : 0
|
||||
}
|
||||
"""
|
||||
expected_error = json.loads(error_body_json)
|
||||
with self.assertRaises(
|
||||
ApiException.exception_class_for_http_status(400)
|
||||
) as context:
|
||||
self.api.get_agents_local_problems(
|
||||
|
||||
aid=aid,
|
||||
|
||||
window=window,
|
||||
|
||||
start_date=start_date,
|
||||
|
||||
end_date=end_date,
|
||||
|
||||
_headers=self.te_headers("get_agents_local_problems", error_status="400"),
|
||||
)
|
||||
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
|
||||
|
||||
|
||||
def test_get_agents_local_problems_error_401(self) -> None:
|
||||
"""Integration test for get_agents_local_problems error path (HTTP 401)"""
|
||||
aid = '1234'
|
||||
window = '12h'
|
||||
start_date = '2022-07-17T22:00:54Z'
|
||||
end_date = '2022-07-18T22:00:54Z'
|
||||
error_body_json = """
|
||||
{
|
||||
"error_description" : "Invalid access token",
|
||||
"error" : "invalid_token"
|
||||
}
|
||||
"""
|
||||
expected_error = json.loads(error_body_json)
|
||||
with self.assertRaises(
|
||||
ApiException.exception_class_for_http_status(401)
|
||||
) as context:
|
||||
self.api.get_agents_local_problems(
|
||||
|
||||
aid=aid,
|
||||
|
||||
window=window,
|
||||
|
||||
start_date=start_date,
|
||||
|
||||
end_date=end_date,
|
||||
|
||||
_headers=self.te_headers("get_agents_local_problems", error_status="401"),
|
||||
)
|
||||
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
|
||||
|
||||
|
||||
def test_get_agents_local_problems_error_403(self) -> None:
|
||||
"""Integration test for get_agents_local_problems error path (HTTP 403)"""
|
||||
aid = '1234'
|
||||
window = '12h'
|
||||
start_date = '2022-07-17T22:00:54Z'
|
||||
end_date = '2022-07-18T22:00:54Z'
|
||||
error_body_json = """
|
||||
{
|
||||
"instance" : "instance",
|
||||
"detail" : "detail",
|
||||
"type" : "type",
|
||||
"title" : "title",
|
||||
"status" : 0
|
||||
}
|
||||
"""
|
||||
expected_error = json.loads(error_body_json)
|
||||
with self.assertRaises(
|
||||
ApiException.exception_class_for_http_status(403)
|
||||
) as context:
|
||||
self.api.get_agents_local_problems(
|
||||
|
||||
aid=aid,
|
||||
|
||||
window=window,
|
||||
|
||||
start_date=start_date,
|
||||
|
||||
end_date=end_date,
|
||||
|
||||
_headers=self.te_headers("get_agents_local_problems", error_status="403"),
|
||||
)
|
||||
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
|
||||
|
||||
|
||||
def test_get_agents_local_problems_error_404(self) -> None:
|
||||
"""Integration test for get_agents_local_problems error path (HTTP 404)"""
|
||||
aid = '1234'
|
||||
window = '12h'
|
||||
start_date = '2022-07-17T22:00:54Z'
|
||||
end_date = '2022-07-18T22:00:54Z'
|
||||
error_body_json = """
|
||||
{
|
||||
"instance" : "instance",
|
||||
"detail" : "detail",
|
||||
"type" : "type",
|
||||
"title" : "title",
|
||||
"status" : 0
|
||||
}
|
||||
"""
|
||||
expected_error = json.loads(error_body_json)
|
||||
with self.assertRaises(
|
||||
ApiException.exception_class_for_http_status(404)
|
||||
) as context:
|
||||
self.api.get_agents_local_problems(
|
||||
|
||||
aid=aid,
|
||||
|
||||
window=window,
|
||||
|
||||
start_date=start_date,
|
||||
|
||||
end_date=end_date,
|
||||
|
||||
_headers=self.te_headers("get_agents_local_problems", error_status="404"),
|
||||
)
|
||||
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
|
||||
|
||||
|
||||
def test_get_agents_local_problems_error_429(self) -> None:
|
||||
"""Integration test for get_agents_local_problems error path (HTTP 429)"""
|
||||
aid = '1234'
|
||||
window = '12h'
|
||||
start_date = '2022-07-17T22:00:54Z'
|
||||
end_date = '2022-07-18T22:00:54Z'
|
||||
error_body_json = """
|
||||
{
|
||||
"instance" : "instance",
|
||||
"detail" : "detail",
|
||||
"type" : "type",
|
||||
"title" : "title",
|
||||
"status" : 0
|
||||
}
|
||||
"""
|
||||
expected_error = json.loads(error_body_json)
|
||||
with self.assertRaises(
|
||||
ApiException.exception_class_for_http_status(429)
|
||||
) as context:
|
||||
self.api.get_agents_local_problems(
|
||||
|
||||
aid=aid,
|
||||
|
||||
window=window,
|
||||
|
||||
start_date=start_date,
|
||||
|
||||
end_date=end_date,
|
||||
|
||||
_headers=self.te_headers("get_agents_local_problems", error_status="429"),
|
||||
)
|
||||
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
|
||||
|
||||
|
||||
def test_get_agents_local_problems_error_500(self) -> None:
|
||||
"""Integration test for get_agents_local_problems error path (HTTP 500)"""
|
||||
aid = '1234'
|
||||
window = '12h'
|
||||
start_date = '2022-07-17T22:00:54Z'
|
||||
end_date = '2022-07-18T22:00:54Z'
|
||||
error_body_json = """
|
||||
{
|
||||
"instance" : "instance",
|
||||
"detail" : "detail",
|
||||
"type" : "type",
|
||||
"title" : "title",
|
||||
"status" : 0
|
||||
}
|
||||
"""
|
||||
expected_error = json.loads(error_body_json)
|
||||
with self.assertRaises(
|
||||
ApiException.exception_class_for_http_status(500)
|
||||
) as context:
|
||||
self.api.get_agents_local_problems(
|
||||
|
||||
aid=aid,
|
||||
|
||||
window=window,
|
||||
|
||||
start_date=start_date,
|
||||
|
||||
end_date=end_date,
|
||||
|
||||
_headers=self.te_headers("get_agents_local_problems", error_status="500"),
|
||||
)
|
||||
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
|
||||
|
||||
|
||||
def test_get_agents_local_problems_error_502(self) -> None:
|
||||
"""Integration test for get_agents_local_problems error path (HTTP 502)"""
|
||||
aid = '1234'
|
||||
window = '12h'
|
||||
start_date = '2022-07-17T22:00:54Z'
|
||||
end_date = '2022-07-18T22:00:54Z'
|
||||
error_body_json = """
|
||||
{
|
||||
"instance" : "instance",
|
||||
"detail" : "detail",
|
||||
"type" : "type",
|
||||
"title" : "title",
|
||||
"status" : 0
|
||||
}
|
||||
"""
|
||||
expected_error = json.loads(error_body_json)
|
||||
with self.assertRaises(
|
||||
ApiException.exception_class_for_http_status(502)
|
||||
) as context:
|
||||
self.api.get_agents_local_problems(
|
||||
|
||||
aid=aid,
|
||||
|
||||
window=window,
|
||||
|
||||
start_date=start_date,
|
||||
|
||||
end_date=end_date,
|
||||
|
||||
_headers=self.te_headers("get_agents_local_problems", error_status="502"),
|
||||
)
|
||||
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
File diff suppressed because it is too large
Load Diff
@ -2,15 +2,36 @@
|
||||
|
||||
import json
|
||||
import unittest
|
||||
from typing import Any
|
||||
|
||||
from pydantic import BaseModel
|
||||
|
||||
|
||||
def _project_onto_constructed(expected: Any, constructed: Any) -> Any:
|
||||
"""Keep only example fields that appear in the constructed model output."""
|
||||
if isinstance(constructed, dict):
|
||||
if not isinstance(expected, dict):
|
||||
return expected
|
||||
return {
|
||||
key: _project_onto_constructed(expected.get(key), value)
|
||||
for key, value in constructed.items()
|
||||
}
|
||||
if isinstance(constructed, list):
|
||||
if not isinstance(expected, list):
|
||||
return expected
|
||||
return [
|
||||
_project_onto_constructed(expected[index], value)
|
||||
for index, value in enumerate(constructed)
|
||||
]
|
||||
return expected
|
||||
|
||||
|
||||
def assert_constructed_model_matches_example_json(model: BaseModel, loaded_json: dict):
|
||||
test_case = unittest.TestCase()
|
||||
test_case.maxDiff = None
|
||||
test_case.assertIsNotNone(model)
|
||||
constructed_json = json.loads(model.to_json())
|
||||
sorted_loaded_json = json.dumps(loaded_json, sort_keys=True)
|
||||
projected_loaded_json = _project_onto_constructed(loaded_json, constructed_json)
|
||||
sorted_loaded_json = json.dumps(projected_loaded_json, sort_keys=True)
|
||||
sorted_constructed_json = json.dumps(constructed_json, sort_keys=True)
|
||||
test_case.assertEqual(sorted_loaded_json, sorted_constructed_json)
|
||||
|
||||
@ -134,7 +134,13 @@ src/thousandeyes_sdk/alerts/models/validation_error_item.py
|
||||
src/thousandeyes_sdk/alerts/models/webhook_integration_type.py
|
||||
src/thousandeyes_sdk/alerts/py.typed
|
||||
test/__init__.py
|
||||
test/conftest.py
|
||||
test/integration_test_utils.py
|
||||
test/mock_manifest.py
|
||||
test/test_alert_rules_api.py
|
||||
test/test_alert_rules_api_integration.py
|
||||
test/test_alert_suppression_windows_api.py
|
||||
test/test_alert_suppression_windows_api_integration.py
|
||||
test/test_alerts_api.py
|
||||
test/test_alerts_api_integration.py
|
||||
test/test_utils.py
|
||||
|
||||
@ -14,7 +14,7 @@ For more information about the alerts, see [Alerts](https://docs.thousandeyes.co
|
||||
|
||||
This Python package is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project:
|
||||
|
||||
- API version: 7.0.96
|
||||
- API version: 7.0.99
|
||||
- Generator version: 7.6.0
|
||||
- Build package: com.thousandeyes.api.codegen.ThousandeyesPythonGenerator
|
||||
|
||||
|
||||
@ -52,7 +52,7 @@ with thousandeyes_sdk.core.ApiClient(configuration) as api_client:
|
||||
api_instance = thousandeyes_sdk.alerts.AlertSuppressionWindowsApi(api_client)
|
||||
alert_suppression_window_request = thousandeyes_sdk.alerts.AlertSuppressionWindowRequest() # AlertSuppressionWindowRequest |
|
||||
aid = '1234' # 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)
|
||||
expand = [thousandeyes_sdk.alerts.ExpandAlertTestOptions()] # List[ExpandAlertTestOptions] | Optional parameter on whether or not to expand alert related resources. Without this parameter, there's no default expansion. For example, to expand the \"tests\" resource, use the `?expand=test` query. (optional)
|
||||
expand = ["test"] # List[ExpandAlertTestOptions] | Optional parameter on whether or not to expand alert related resources. Without this parameter, there's no default expansion. For example, to expand the \"tests\" resource, use the `?expand=test` query. (optional)
|
||||
|
||||
try:
|
||||
# Create alert suppression window
|
||||
@ -224,7 +224,7 @@ with thousandeyes_sdk.core.ApiClient(configuration) as api_client:
|
||||
api_instance = thousandeyes_sdk.alerts.AlertSuppressionWindowsApi(api_client)
|
||||
window_id = '2411' # str | Unique window ID.
|
||||
aid = '1234' # 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)
|
||||
expand = [thousandeyes_sdk.alerts.ExpandAlertTestOptions()] # List[ExpandAlertTestOptions] | Optional parameter on whether or not to expand alert related resources. Without this parameter, there's no default expansion. For example, to expand the \"tests\" resource, use the `?expand=test` query. (optional)
|
||||
expand = ["test"] # List[ExpandAlertTestOptions] | Optional parameter on whether or not to expand alert related resources. Without this parameter, there's no default expansion. For example, to expand the \"tests\" resource, use the `?expand=test` query. (optional)
|
||||
|
||||
try:
|
||||
# Retrieve alert suppression window
|
||||
@ -397,7 +397,7 @@ with thousandeyes_sdk.core.ApiClient(configuration) as api_client:
|
||||
window_id = '2411' # str | Unique window ID.
|
||||
alert_suppression_window_request = thousandeyes_sdk.alerts.AlertSuppressionWindowRequest() # AlertSuppressionWindowRequest |
|
||||
aid = '1234' # 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)
|
||||
expand = [thousandeyes_sdk.alerts.ExpandAlertTestOptions()] # List[ExpandAlertTestOptions] | Optional parameter on whether or not to expand alert related resources. Without this parameter, there's no default expansion. For example, to expand the \"tests\" resource, use the `?expand=test` query. (optional)
|
||||
expand = ["test"] # List[ExpandAlertTestOptions] | Optional parameter on whether or not to expand alert related resources. Without this parameter, there's no default expansion. For example, to expand the \"tests\" resource, use the `?expand=test` query. (optional)
|
||||
|
||||
try:
|
||||
# Update alert suppression window
|
||||
|
||||
@ -136,7 +136,7 @@ with thousandeyes_sdk.core.ApiClient(configuration) as api_client:
|
||||
end_date = '2022-07-18T22:00:54Z' # datetime | Defaults to current time the request is made. Use with the `startDate` parameter. Include the complete time (hours, minutes, and seconds) in UTC time zone, following the ISO 8601 date-time format. See the example for reference. Please note that this parameter can't be used with `window`. (optional)
|
||||
max = 5 # int | (Optional) Maximum number of objects to return. (optional)
|
||||
cursor = 'cursor_example' # str | (Optional) Opaque cursor used for pagination. Clients should use `next` value from `_links` instead of this parameter. (optional)
|
||||
state = thousandeyes_sdk.alerts.State() # State | Optional parameter to match a specific alert state. If not specified, it defaults to `trigger`. (optional)
|
||||
state = 'trigger' # State | Optional parameter to match a specific alert state. If not specified, it defaults to `trigger`. (optional)
|
||||
|
||||
try:
|
||||
# List alerts
|
||||
|
||||
7
thousandeyes-sdk-alerts/test/conftest.py
Normal file
7
thousandeyes-sdk-alerts/test/conftest.py
Normal file
@ -0,0 +1,7 @@
|
||||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
_repo_root = Path(__file__).resolve().parents[2]
|
||||
_core_test_support = _repo_root / "thousandeyes-sdk-core" / "test"
|
||||
if str(_core_test_support) not in sys.path:
|
||||
sys.path.insert(0, str(_core_test_support))
|
||||
37
thousandeyes-sdk-alerts/test/integration_test_utils.py
Normal file
37
thousandeyes-sdk-alerts/test/integration_test_utils.py
Normal file
@ -0,0 +1,37 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
Alerts API
|
||||
|
||||
**Note:** API operations for the creation or retrieval of API, Page Load, or Web-Transaction alert rules are not available for ThousandEyes for Government instance. You can manage the following alert functionalities on the ThousandEyes platform using the Alerts API: * **Alerts**: Retrieve alert details. Alerts are assigned to tests through alert rules. * **Alert Rules**: Conditions that you configure in order to highlight or be notified of events of interest in your ThousandEyes tests. When an alert rule’s conditions are met, the associated alert is triggered and the alert becomes active. It remains active until the alert is cleared. Alert rules are reusable across multiple tests.. * **Alert Suppression Windows**: Suppress alerts for tests during periods such as planned maintenance. Windows can be one-time events or recurring events to handle periodic occurrences such as monthly downtime for maintenance. For more information about the alerts, see [Alerts](https://docs.thousandeyes.com/product-documentation/alerts).
|
||||
|
||||
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
||||
|
||||
Do not edit the class manually.
|
||||
""" # noqa: E501
|
||||
|
||||
|
||||
import unittest
|
||||
|
||||
from thousandeyes_sdk.core.api_client import ApiClient
|
||||
from thousandeyes_sdk.core.configuration import Configuration
|
||||
from sdk_test_support.mock_server import ERROR_STATUS_HEADER, OPERATION_ID_HEADER, MockApiServer
|
||||
|
||||
from .mock_manifest import OPERATION_MANIFEST
|
||||
|
||||
|
||||
class IntegrationTestBase(unittest.TestCase):
|
||||
def setUp(self) -> None:
|
||||
self.server = MockApiServer(OPERATION_MANIFEST)
|
||||
self.server.start()
|
||||
configuration = Configuration(host=self.server.base_url, access_token="test-token")
|
||||
self.api_client = ApiClient(configuration=configuration)
|
||||
|
||||
def tearDown(self) -> None:
|
||||
self.server.stop()
|
||||
|
||||
def te_headers(self, operation_id: str, error_status=None):
|
||||
headers = {OPERATION_ID_HEADER: operation_id}
|
||||
if error_status is not None:
|
||||
headers[ERROR_STATUS_HEADER] = error_status
|
||||
return headers
|
||||
2247
thousandeyes-sdk-alerts/test/mock_manifest.py
Normal file
2247
thousandeyes-sdk-alerts/test/mock_manifest.py
Normal file
File diff suppressed because it is too large
Load Diff
2130
thousandeyes-sdk-alerts/test/test_alert_rules_api_integration.py
Normal file
2130
thousandeyes-sdk-alerts/test/test_alert_rules_api_integration.py
Normal file
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
698
thousandeyes-sdk-alerts/test/test_alerts_api_integration.py
Normal file
698
thousandeyes-sdk-alerts/test/test_alerts_api_integration.py
Normal file
@ -0,0 +1,698 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
Alerts API
|
||||
|
||||
**Note:** API operations for the creation or retrieval of API, Page Load, or Web-Transaction alert rules are not available for ThousandEyes for Government instance. You can manage the following alert functionalities on the ThousandEyes platform using the Alerts API: * **Alerts**: Retrieve alert details. Alerts are assigned to tests through alert rules. * **Alert Rules**: Conditions that you configure in order to highlight or be notified of events of interest in your ThousandEyes tests. When an alert rule’s conditions are met, the associated alert is triggered and the alert becomes active. It remains active until the alert is cleared. Alert rules are reusable across multiple tests.. * **Alert Suppression Windows**: Suppress alerts for tests during periods such as planned maintenance. Windows can be one-time events or recurring events to handle periodic occurrences such as monthly downtime for maintenance. For more information about the alerts, see [Alerts](https://docs.thousandeyes.com/product-documentation/alerts).
|
||||
|
||||
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
||||
|
||||
Do not edit the class manually.
|
||||
""" # noqa: E501
|
||||
|
||||
|
||||
import json
|
||||
import unittest
|
||||
import thousandeyes_sdk.alerts.models
|
||||
|
||||
from thousandeyes_sdk.core.exceptions import ApiException
|
||||
from thousandeyes_sdk.alerts.api.alerts_api import AlertsApi
|
||||
from .integration_test_utils import IntegrationTestBase
|
||||
from .test_utils import assert_constructed_model_matches_example_json
|
||||
|
||||
|
||||
class TestAlertsApiIntegration(IntegrationTestBase):
|
||||
"""AlertsApi integration test stubs"""
|
||||
|
||||
def setUp(self) -> None:
|
||||
super().setUp()
|
||||
self.api = AlertsApi(self.api_client)
|
||||
|
||||
|
||||
def test_get_alert_happy_path(self) -> None:
|
||||
"""Integration test for get_alert success path"""
|
||||
alert_id = 'e9c3bf02-a48c-4aa8-9e5f-898800d6f569'
|
||||
aid = '1234'
|
||||
response_body_json = """
|
||||
{
|
||||
"severity" : "major",
|
||||
"alertType" : "http-server",
|
||||
"endDate" : "2022-07-18T22:00:54Z",
|
||||
"_links" : {
|
||||
"appLink" : {
|
||||
"hreflang" : "hreflang",
|
||||
"templated" : true,
|
||||
"profile" : "profile",
|
||||
"name" : "name",
|
||||
"href" : "https://api.thousandeyes.com/v7/link/to/resource/id",
|
||||
"type" : "type",
|
||||
"deprecation" : "deprecation",
|
||||
"title" : "title"
|
||||
},
|
||||
"test" : {
|
||||
"hreflang" : "hreflang",
|
||||
"templated" : true,
|
||||
"profile" : "profile",
|
||||
"name" : "name",
|
||||
"href" : "https://api.thousandeyes.com/v7/link/to/resource/id",
|
||||
"type" : "type",
|
||||
"deprecation" : "deprecation",
|
||||
"title" : "title"
|
||||
},
|
||||
"rule" : {
|
||||
"hreflang" : "hreflang",
|
||||
"templated" : true,
|
||||
"profile" : "profile",
|
||||
"name" : "name",
|
||||
"href" : "https://api.thousandeyes.com/v7/link/to/resource/id",
|
||||
"type" : "type",
|
||||
"deprecation" : "deprecation",
|
||||
"title" : "title"
|
||||
},
|
||||
"self" : {
|
||||
"hreflang" : "hreflang",
|
||||
"templated" : true,
|
||||
"profile" : "profile",
|
||||
"name" : "name",
|
||||
"href" : "https://api.thousandeyes.com/v7/link/to/resource/id",
|
||||
"type" : "type",
|
||||
"deprecation" : "deprecation",
|
||||
"title" : "title"
|
||||
}
|
||||
},
|
||||
"alertSeverity" : "major",
|
||||
"duration" : 60,
|
||||
"violationCount" : 2,
|
||||
"_embedded" : {
|
||||
"asn" : {
|
||||
"name" : "Cisco Webex LLC",
|
||||
"id" : "13445",
|
||||
"type" : "asn"
|
||||
}
|
||||
},
|
||||
"meta" : {
|
||||
"version" : 1
|
||||
},
|
||||
"details" : [ {
|
||||
"name" : "Bucharest, Romania",
|
||||
"start" : {
|
||||
"metrics" : "metrics"
|
||||
},
|
||||
"end" : {
|
||||
"metrics" : "metrics"
|
||||
},
|
||||
"id" : "3379",
|
||||
"state" : "trigger",
|
||||
"type" : "cea_agent"
|
||||
}, {
|
||||
"name" : "Bucharest, Romania",
|
||||
"start" : {
|
||||
"metrics" : "metrics"
|
||||
},
|
||||
"end" : {
|
||||
"metrics" : "metrics"
|
||||
},
|
||||
"id" : "3379",
|
||||
"state" : "trigger",
|
||||
"type" : "cea_agent"
|
||||
} ],
|
||||
"id" : "e9c3bf02-a48c-4aa8-9e5f-898800d6f569",
|
||||
"suppressed" : false,
|
||||
"state" : "trigger",
|
||||
"alertState" : "trigger",
|
||||
"startDate" : "2022-07-17T22:00:54Z"
|
||||
}
|
||||
"""
|
||||
expected_response = json.loads(response_body_json)
|
||||
response = self.api.get_alert(
|
||||
|
||||
alert_id=alert_id,
|
||||
|
||||
aid=aid,
|
||||
|
||||
_headers=self.te_headers("get_alert"),
|
||||
)
|
||||
assert_constructed_model_matches_example_json(response, expected_response)
|
||||
|
||||
|
||||
def test_get_alert_error_401(self) -> None:
|
||||
"""Integration test for get_alert error path (HTTP 401)"""
|
||||
alert_id = 'e9c3bf02-a48c-4aa8-9e5f-898800d6f569'
|
||||
aid = '1234'
|
||||
error_body_json = """
|
||||
{
|
||||
"error_description" : "Invalid access token",
|
||||
"error" : "invalid_token"
|
||||
}
|
||||
"""
|
||||
expected_error = json.loads(error_body_json)
|
||||
with self.assertRaises(
|
||||
ApiException.exception_class_for_http_status(401)
|
||||
) as context:
|
||||
self.api.get_alert(
|
||||
|
||||
alert_id=alert_id,
|
||||
|
||||
aid=aid,
|
||||
|
||||
_headers=self.te_headers("get_alert", error_status="401"),
|
||||
)
|
||||
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
|
||||
|
||||
|
||||
def test_get_alert_error_403(self) -> None:
|
||||
"""Integration test for get_alert error path (HTTP 403)"""
|
||||
alert_id = 'e9c3bf02-a48c-4aa8-9e5f-898800d6f569'
|
||||
aid = '1234'
|
||||
error_body_json = """
|
||||
{
|
||||
"instance" : "instance",
|
||||
"detail" : "detail",
|
||||
"type" : "type",
|
||||
"title" : "title",
|
||||
"status" : 0
|
||||
}
|
||||
"""
|
||||
expected_error = json.loads(error_body_json)
|
||||
with self.assertRaises(
|
||||
ApiException.exception_class_for_http_status(403)
|
||||
) as context:
|
||||
self.api.get_alert(
|
||||
|
||||
alert_id=alert_id,
|
||||
|
||||
aid=aid,
|
||||
|
||||
_headers=self.te_headers("get_alert", error_status="403"),
|
||||
)
|
||||
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
|
||||
|
||||
|
||||
def test_get_alert_error_404(self) -> None:
|
||||
"""Integration test for get_alert error path (HTTP 404)"""
|
||||
alert_id = 'e9c3bf02-a48c-4aa8-9e5f-898800d6f569'
|
||||
aid = '1234'
|
||||
error_body_json = """
|
||||
{
|
||||
"instance" : "instance",
|
||||
"detail" : "detail",
|
||||
"type" : "type",
|
||||
"title" : "title",
|
||||
"status" : 0
|
||||
}
|
||||
"""
|
||||
expected_error = json.loads(error_body_json)
|
||||
with self.assertRaises(
|
||||
ApiException.exception_class_for_http_status(404)
|
||||
) as context:
|
||||
self.api.get_alert(
|
||||
|
||||
alert_id=alert_id,
|
||||
|
||||
aid=aid,
|
||||
|
||||
_headers=self.te_headers("get_alert", error_status="404"),
|
||||
)
|
||||
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
|
||||
|
||||
|
||||
def test_get_alert_error_429(self) -> None:
|
||||
"""Integration test for get_alert error path (HTTP 429)"""
|
||||
alert_id = 'e9c3bf02-a48c-4aa8-9e5f-898800d6f569'
|
||||
aid = '1234'
|
||||
error_body_json = """
|
||||
{
|
||||
"instance" : "instance",
|
||||
"detail" : "detail",
|
||||
"type" : "type",
|
||||
"title" : "title",
|
||||
"status" : 0
|
||||
}
|
||||
"""
|
||||
expected_error = json.loads(error_body_json)
|
||||
with self.assertRaises(
|
||||
ApiException.exception_class_for_http_status(429)
|
||||
) as context:
|
||||
self.api.get_alert(
|
||||
|
||||
alert_id=alert_id,
|
||||
|
||||
aid=aid,
|
||||
|
||||
_headers=self.te_headers("get_alert", error_status="429"),
|
||||
)
|
||||
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
|
||||
|
||||
|
||||
def test_get_alert_error_500(self) -> None:
|
||||
"""Integration test for get_alert error path (HTTP 500)"""
|
||||
alert_id = 'e9c3bf02-a48c-4aa8-9e5f-898800d6f569'
|
||||
aid = '1234'
|
||||
error_body_json = """
|
||||
{
|
||||
"instance" : "instance",
|
||||
"detail" : "detail",
|
||||
"type" : "type",
|
||||
"title" : "title",
|
||||
"status" : 0
|
||||
}
|
||||
"""
|
||||
expected_error = json.loads(error_body_json)
|
||||
with self.assertRaises(
|
||||
ApiException.exception_class_for_http_status(500)
|
||||
) as context:
|
||||
self.api.get_alert(
|
||||
|
||||
alert_id=alert_id,
|
||||
|
||||
aid=aid,
|
||||
|
||||
_headers=self.te_headers("get_alert", error_status="500"),
|
||||
)
|
||||
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
|
||||
|
||||
|
||||
|
||||
|
||||
def test_get_alerts_happy_path(self) -> None:
|
||||
"""Integration test for get_alerts success path"""
|
||||
aid = '1234'
|
||||
window = '12h'
|
||||
start_date = '2022-07-17T22:00:54Z'
|
||||
end_date = '2022-07-18T22:00:54Z'
|
||||
max = 5
|
||||
cursor = 'cursor_example'
|
||||
state = 'trigger'
|
||||
response_body_json = """
|
||||
{
|
||||
"alerts" : [ {
|
||||
"severity" : "MAJOR",
|
||||
"alertType" : "http-server",
|
||||
"endDate" : "2022-07-18T22:00:54Z",
|
||||
"_links" : {
|
||||
"appLink" : {
|
||||
"hreflang" : "hreflang",
|
||||
"templated" : true,
|
||||
"profile" : "profile",
|
||||
"name" : "name",
|
||||
"href" : "https://api.thousandeyes.com/v7/link/to/resource/id",
|
||||
"type" : "type",
|
||||
"deprecation" : "deprecation",
|
||||
"title" : "title"
|
||||
},
|
||||
"test" : {
|
||||
"hreflang" : "hreflang",
|
||||
"templated" : true,
|
||||
"profile" : "profile",
|
||||
"name" : "name",
|
||||
"href" : "https://api.thousandeyes.com/v7/link/to/resource/id",
|
||||
"type" : "type",
|
||||
"deprecation" : "deprecation",
|
||||
"title" : "title"
|
||||
},
|
||||
"rule" : {
|
||||
"hreflang" : "hreflang",
|
||||
"templated" : true,
|
||||
"profile" : "profile",
|
||||
"name" : "name",
|
||||
"href" : "https://api.thousandeyes.com/v7/link/to/resource/id",
|
||||
"type" : "type",
|
||||
"deprecation" : "deprecation",
|
||||
"title" : "title"
|
||||
},
|
||||
"self" : {
|
||||
"hreflang" : "hreflang",
|
||||
"templated" : true,
|
||||
"profile" : "profile",
|
||||
"name" : "name",
|
||||
"href" : "https://api.thousandeyes.com/v7/link/to/resource/id",
|
||||
"type" : "type",
|
||||
"deprecation" : "deprecation",
|
||||
"title" : "title"
|
||||
}
|
||||
},
|
||||
"apiLinks" : [ {
|
||||
"key" : ""
|
||||
}, {
|
||||
"key" : ""
|
||||
} ],
|
||||
"alertSeverity" : "major",
|
||||
"dateEnd" : "2020-04-23 13:43:16",
|
||||
"duration" : 60,
|
||||
"violationCount" : 2,
|
||||
"dateStart" : "2020-04-23 13:43:16",
|
||||
"meta" : {
|
||||
"version" : 1
|
||||
},
|
||||
"id" : "e9c3bf02-a48c-4aa8-9e5f-898800d6f569",
|
||||
"suppressed" : false,
|
||||
"alertId" : "e9c3bf02-a48c-4aa8-9e5f-898800d6f569",
|
||||
"state" : "ACTIVE",
|
||||
"ruleId" : 127094,
|
||||
"permalink" : "https://app.thousandeyes.com/alerts/list?__a=75&alertId=2783&agentId=12",
|
||||
"alertState" : "trigger",
|
||||
"startDate" : "2022-07-17T22:00:54Z",
|
||||
"alertRuleId" : "127094"
|
||||
}, {
|
||||
"severity" : "MAJOR",
|
||||
"alertType" : "http-server",
|
||||
"endDate" : "2022-07-18T22:00:54Z",
|
||||
"_links" : {
|
||||
"appLink" : {
|
||||
"hreflang" : "hreflang",
|
||||
"templated" : true,
|
||||
"profile" : "profile",
|
||||
"name" : "name",
|
||||
"href" : "https://api.thousandeyes.com/v7/link/to/resource/id",
|
||||
"type" : "type",
|
||||
"deprecation" : "deprecation",
|
||||
"title" : "title"
|
||||
},
|
||||
"test" : {
|
||||
"hreflang" : "hreflang",
|
||||
"templated" : true,
|
||||
"profile" : "profile",
|
||||
"name" : "name",
|
||||
"href" : "https://api.thousandeyes.com/v7/link/to/resource/id",
|
||||
"type" : "type",
|
||||
"deprecation" : "deprecation",
|
||||
"title" : "title"
|
||||
},
|
||||
"rule" : {
|
||||
"hreflang" : "hreflang",
|
||||
"templated" : true,
|
||||
"profile" : "profile",
|
||||
"name" : "name",
|
||||
"href" : "https://api.thousandeyes.com/v7/link/to/resource/id",
|
||||
"type" : "type",
|
||||
"deprecation" : "deprecation",
|
||||
"title" : "title"
|
||||
},
|
||||
"self" : {
|
||||
"hreflang" : "hreflang",
|
||||
"templated" : true,
|
||||
"profile" : "profile",
|
||||
"name" : "name",
|
||||
"href" : "https://api.thousandeyes.com/v7/link/to/resource/id",
|
||||
"type" : "type",
|
||||
"deprecation" : "deprecation",
|
||||
"title" : "title"
|
||||
}
|
||||
},
|
||||
"apiLinks" : [ {
|
||||
"key" : ""
|
||||
}, {
|
||||
"key" : ""
|
||||
} ],
|
||||
"alertSeverity" : "major",
|
||||
"dateEnd" : "2020-04-23 13:43:16",
|
||||
"duration" : 60,
|
||||
"violationCount" : 2,
|
||||
"dateStart" : "2020-04-23 13:43:16",
|
||||
"meta" : {
|
||||
"version" : 1
|
||||
},
|
||||
"id" : "e9c3bf02-a48c-4aa8-9e5f-898800d6f569",
|
||||
"suppressed" : false,
|
||||
"alertId" : "e9c3bf02-a48c-4aa8-9e5f-898800d6f569",
|
||||
"state" : "ACTIVE",
|
||||
"ruleId" : 127094,
|
||||
"permalink" : "https://app.thousandeyes.com/alerts/list?__a=75&alertId=2783&agentId=12",
|
||||
"alertState" : "trigger",
|
||||
"startDate" : "2022-07-17T22:00:54Z",
|
||||
"alertRuleId" : "127094"
|
||||
} ],
|
||||
"_links" : {
|
||||
"next" : {
|
||||
"hreflang" : "hreflang",
|
||||
"templated" : true,
|
||||
"profile" : "profile",
|
||||
"name" : "name",
|
||||
"href" : "https://api.thousandeyes.com/v7/link/to/resource/id",
|
||||
"type" : "type",
|
||||
"deprecation" : "deprecation",
|
||||
"title" : "title"
|
||||
},
|
||||
"previous" : {
|
||||
"hreflang" : "hreflang",
|
||||
"templated" : true,
|
||||
"profile" : "profile",
|
||||
"name" : "name",
|
||||
"href" : "https://api.thousandeyes.com/v7/link/to/resource/id",
|
||||
"type" : "type",
|
||||
"deprecation" : "deprecation",
|
||||
"title" : "title"
|
||||
},
|
||||
"self" : {
|
||||
"hreflang" : "hreflang",
|
||||
"templated" : true,
|
||||
"profile" : "profile",
|
||||
"name" : "name",
|
||||
"href" : "https://api.thousandeyes.com/v7/link/to/resource/id",
|
||||
"type" : "type",
|
||||
"deprecation" : "deprecation",
|
||||
"title" : "title"
|
||||
}
|
||||
}
|
||||
}
|
||||
"""
|
||||
expected_response = json.loads(response_body_json)
|
||||
response = self.api.get_alerts(
|
||||
|
||||
aid=aid,
|
||||
|
||||
window=window,
|
||||
|
||||
start_date=start_date,
|
||||
|
||||
end_date=end_date,
|
||||
|
||||
max=max,
|
||||
|
||||
cursor=cursor,
|
||||
|
||||
state=state,
|
||||
|
||||
_headers=self.te_headers("get_alerts"),
|
||||
)
|
||||
assert_constructed_model_matches_example_json(response, expected_response)
|
||||
|
||||
|
||||
def test_get_alerts_error_401(self) -> None:
|
||||
"""Integration test for get_alerts error path (HTTP 401)"""
|
||||
aid = '1234'
|
||||
window = '12h'
|
||||
start_date = '2022-07-17T22:00:54Z'
|
||||
end_date = '2022-07-18T22:00:54Z'
|
||||
max = 5
|
||||
cursor = 'cursor_example'
|
||||
state = 'trigger'
|
||||
error_body_json = """
|
||||
{
|
||||
"error_description" : "Invalid access token",
|
||||
"error" : "invalid_token"
|
||||
}
|
||||
"""
|
||||
expected_error = json.loads(error_body_json)
|
||||
with self.assertRaises(
|
||||
ApiException.exception_class_for_http_status(401)
|
||||
) as context:
|
||||
self.api.get_alerts(
|
||||
|
||||
aid=aid,
|
||||
|
||||
window=window,
|
||||
|
||||
start_date=start_date,
|
||||
|
||||
end_date=end_date,
|
||||
|
||||
max=max,
|
||||
|
||||
cursor=cursor,
|
||||
|
||||
state=state,
|
||||
|
||||
_headers=self.te_headers("get_alerts", error_status="401"),
|
||||
)
|
||||
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
|
||||
|
||||
|
||||
def test_get_alerts_error_403(self) -> None:
|
||||
"""Integration test for get_alerts error path (HTTP 403)"""
|
||||
aid = '1234'
|
||||
window = '12h'
|
||||
start_date = '2022-07-17T22:00:54Z'
|
||||
end_date = '2022-07-18T22:00:54Z'
|
||||
max = 5
|
||||
cursor = 'cursor_example'
|
||||
state = 'trigger'
|
||||
error_body_json = """
|
||||
{
|
||||
"instance" : "instance",
|
||||
"detail" : "detail",
|
||||
"type" : "type",
|
||||
"title" : "title",
|
||||
"status" : 0
|
||||
}
|
||||
"""
|
||||
expected_error = json.loads(error_body_json)
|
||||
with self.assertRaises(
|
||||
ApiException.exception_class_for_http_status(403)
|
||||
) as context:
|
||||
self.api.get_alerts(
|
||||
|
||||
aid=aid,
|
||||
|
||||
window=window,
|
||||
|
||||
start_date=start_date,
|
||||
|
||||
end_date=end_date,
|
||||
|
||||
max=max,
|
||||
|
||||
cursor=cursor,
|
||||
|
||||
state=state,
|
||||
|
||||
_headers=self.te_headers("get_alerts", error_status="403"),
|
||||
)
|
||||
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
|
||||
|
||||
|
||||
def test_get_alerts_error_404(self) -> None:
|
||||
"""Integration test for get_alerts error path (HTTP 404)"""
|
||||
aid = '1234'
|
||||
window = '12h'
|
||||
start_date = '2022-07-17T22:00:54Z'
|
||||
end_date = '2022-07-18T22:00:54Z'
|
||||
max = 5
|
||||
cursor = 'cursor_example'
|
||||
state = 'trigger'
|
||||
error_body_json = """
|
||||
{
|
||||
"instance" : "instance",
|
||||
"detail" : "detail",
|
||||
"type" : "type",
|
||||
"title" : "title",
|
||||
"status" : 0
|
||||
}
|
||||
"""
|
||||
expected_error = json.loads(error_body_json)
|
||||
with self.assertRaises(
|
||||
ApiException.exception_class_for_http_status(404)
|
||||
) as context:
|
||||
self.api.get_alerts(
|
||||
|
||||
aid=aid,
|
||||
|
||||
window=window,
|
||||
|
||||
start_date=start_date,
|
||||
|
||||
end_date=end_date,
|
||||
|
||||
max=max,
|
||||
|
||||
cursor=cursor,
|
||||
|
||||
state=state,
|
||||
|
||||
_headers=self.te_headers("get_alerts", error_status="404"),
|
||||
)
|
||||
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
|
||||
|
||||
|
||||
def test_get_alerts_error_429(self) -> None:
|
||||
"""Integration test for get_alerts error path (HTTP 429)"""
|
||||
aid = '1234'
|
||||
window = '12h'
|
||||
start_date = '2022-07-17T22:00:54Z'
|
||||
end_date = '2022-07-18T22:00:54Z'
|
||||
max = 5
|
||||
cursor = 'cursor_example'
|
||||
state = 'trigger'
|
||||
error_body_json = """
|
||||
{
|
||||
"instance" : "instance",
|
||||
"detail" : "detail",
|
||||
"type" : "type",
|
||||
"title" : "title",
|
||||
"status" : 0
|
||||
}
|
||||
"""
|
||||
expected_error = json.loads(error_body_json)
|
||||
with self.assertRaises(
|
||||
ApiException.exception_class_for_http_status(429)
|
||||
) as context:
|
||||
self.api.get_alerts(
|
||||
|
||||
aid=aid,
|
||||
|
||||
window=window,
|
||||
|
||||
start_date=start_date,
|
||||
|
||||
end_date=end_date,
|
||||
|
||||
max=max,
|
||||
|
||||
cursor=cursor,
|
||||
|
||||
state=state,
|
||||
|
||||
_headers=self.te_headers("get_alerts", error_status="429"),
|
||||
)
|
||||
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
|
||||
|
||||
|
||||
def test_get_alerts_error_500(self) -> None:
|
||||
"""Integration test for get_alerts error path (HTTP 500)"""
|
||||
aid = '1234'
|
||||
window = '12h'
|
||||
start_date = '2022-07-17T22:00:54Z'
|
||||
end_date = '2022-07-18T22:00:54Z'
|
||||
max = 5
|
||||
cursor = 'cursor_example'
|
||||
state = 'trigger'
|
||||
error_body_json = """
|
||||
{
|
||||
"instance" : "instance",
|
||||
"detail" : "detail",
|
||||
"type" : "type",
|
||||
"title" : "title",
|
||||
"status" : 0
|
||||
}
|
||||
"""
|
||||
expected_error = json.loads(error_body_json)
|
||||
with self.assertRaises(
|
||||
ApiException.exception_class_for_http_status(500)
|
||||
) as context:
|
||||
self.api.get_alerts(
|
||||
|
||||
aid=aid,
|
||||
|
||||
window=window,
|
||||
|
||||
start_date=start_date,
|
||||
|
||||
end_date=end_date,
|
||||
|
||||
max=max,
|
||||
|
||||
cursor=cursor,
|
||||
|
||||
state=state,
|
||||
|
||||
_headers=self.te_headers("get_alerts", error_status="500"),
|
||||
)
|
||||
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
@ -2,15 +2,36 @@
|
||||
|
||||
import json
|
||||
import unittest
|
||||
from typing import Any
|
||||
|
||||
from pydantic import BaseModel
|
||||
|
||||
|
||||
def _project_onto_constructed(expected: Any, constructed: Any) -> Any:
|
||||
"""Keep only example fields that appear in the constructed model output."""
|
||||
if isinstance(constructed, dict):
|
||||
if not isinstance(expected, dict):
|
||||
return expected
|
||||
return {
|
||||
key: _project_onto_constructed(expected.get(key), value)
|
||||
for key, value in constructed.items()
|
||||
}
|
||||
if isinstance(constructed, list):
|
||||
if not isinstance(expected, list):
|
||||
return expected
|
||||
return [
|
||||
_project_onto_constructed(expected[index], value)
|
||||
for index, value in enumerate(constructed)
|
||||
]
|
||||
return expected
|
||||
|
||||
|
||||
def assert_constructed_model_matches_example_json(model: BaseModel, loaded_json: dict):
|
||||
test_case = unittest.TestCase()
|
||||
test_case.maxDiff = None
|
||||
test_case.assertIsNotNone(model)
|
||||
constructed_json = json.loads(model.to_json())
|
||||
sorted_loaded_json = json.dumps(loaded_json, sort_keys=True)
|
||||
projected_loaded_json = _project_onto_constructed(loaded_json, constructed_json)
|
||||
sorted_loaded_json = json.dumps(projected_loaded_json, sort_keys=True)
|
||||
sorted_constructed_json = json.dumps(constructed_json, sort_keys=True)
|
||||
test_case.assertEqual(sorted_loaded_json, sorted_constructed_json)
|
||||
|
||||
@ -24,5 +24,9 @@ src/thousandeyes_sdk/bgp_monitors/models/self_links.py
|
||||
src/thousandeyes_sdk/bgp_monitors/models/unauthorized_error.py
|
||||
src/thousandeyes_sdk/bgp_monitors/py.typed
|
||||
test/__init__.py
|
||||
test/conftest.py
|
||||
test/integration_test_utils.py
|
||||
test/mock_manifest.py
|
||||
test/test_bgp_monitors_api.py
|
||||
test/test_bgp_monitors_api_integration.py
|
||||
test/test_utils.py
|
||||
|
||||
@ -10,7 +10,7 @@ For more information about monitors, see [Inside-Out BGP Visibility](https://doc
|
||||
|
||||
This Python package is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project:
|
||||
|
||||
- API version: 7.0.96
|
||||
- API version: 7.0.99
|
||||
- Generator version: 7.6.0
|
||||
- Build package: com.thousandeyes.api.codegen.ThousandeyesPythonGenerator
|
||||
|
||||
|
||||
7
thousandeyes-sdk-bgp-monitors/test/conftest.py
Normal file
7
thousandeyes-sdk-bgp-monitors/test/conftest.py
Normal file
@ -0,0 +1,7 @@
|
||||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
_repo_root = Path(__file__).resolve().parents[2]
|
||||
_core_test_support = _repo_root / "thousandeyes-sdk-core" / "test"
|
||||
if str(_core_test_support) not in sys.path:
|
||||
sys.path.insert(0, str(_core_test_support))
|
||||
37
thousandeyes-sdk-bgp-monitors/test/integration_test_utils.py
Normal file
37
thousandeyes-sdk-bgp-monitors/test/integration_test_utils.py
Normal file
@ -0,0 +1,37 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
BGP Monitors API
|
||||
|
||||
**Note:** Private monitor data is not available for ThousandEyes for Government instance. Retrieve information about BGP monitors available to your ThousandEyes account. ThousandEyes ingests BGP routing data from dozens of global BGP collectors and automatically integrates that visibility as a configurable layer under service, network, and path visualization layers. When you specify a service URL in a test, layered BGP tests automatically track reachability and path changes for any relevant prefix. When you use an IP address as the target for a test, the ThousandEyes platform monitors the relevant internet-routed prefix. You can also create specific BGP monitoring for a prefix, and can alert on hijacks and leaks. For more information about monitors, see [Inside-Out BGP Visibility](https://docs.thousandeyes.com/product-documentation/internet-and-wan-monitoring/tests/bgp-tests/inside-out-bgp-visibility).
|
||||
|
||||
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
||||
|
||||
Do not edit the class manually.
|
||||
""" # noqa: E501
|
||||
|
||||
|
||||
import unittest
|
||||
|
||||
from thousandeyes_sdk.core.api_client import ApiClient
|
||||
from thousandeyes_sdk.core.configuration import Configuration
|
||||
from sdk_test_support.mock_server import ERROR_STATUS_HEADER, OPERATION_ID_HEADER, MockApiServer
|
||||
|
||||
from .mock_manifest import OPERATION_MANIFEST
|
||||
|
||||
|
||||
class IntegrationTestBase(unittest.TestCase):
|
||||
def setUp(self) -> None:
|
||||
self.server = MockApiServer(OPERATION_MANIFEST)
|
||||
self.server.start()
|
||||
configuration = Configuration(host=self.server.base_url, access_token="test-token")
|
||||
self.api_client = ApiClient(configuration=configuration)
|
||||
|
||||
def tearDown(self) -> None:
|
||||
self.server.stop()
|
||||
|
||||
def te_headers(self, operation_id: str, error_status=None):
|
||||
headers = {OPERATION_ID_HEADER: operation_id}
|
||||
if error_status is not None:
|
||||
headers[ERROR_STATUS_HEADER] = error_status
|
||||
return headers
|
||||
131
thousandeyes-sdk-bgp-monitors/test/mock_manifest.py
Normal file
131
thousandeyes-sdk-bgp-monitors/test/mock_manifest.py
Normal file
@ -0,0 +1,131 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
BGP Monitors API
|
||||
|
||||
**Note:** Private monitor data is not available for ThousandEyes for Government instance. Retrieve information about BGP monitors available to your ThousandEyes account. ThousandEyes ingests BGP routing data from dozens of global BGP collectors and automatically integrates that visibility as a configurable layer under service, network, and path visualization layers. When you specify a service URL in a test, layered BGP tests automatically track reachability and path changes for any relevant prefix. When you use an IP address as the target for a test, the ThousandEyes platform monitors the relevant internet-routed prefix. You can also create specific BGP monitoring for a prefix, and can alert on hijacks and leaks. For more information about monitors, see [Inside-Out BGP Visibility](https://docs.thousandeyes.com/product-documentation/internet-and-wan-monitoring/tests/bgp-tests/inside-out-bgp-visibility).
|
||||
|
||||
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
||||
|
||||
Do not edit the class manually.
|
||||
""" # noqa: E501
|
||||
|
||||
|
||||
import json
|
||||
|
||||
from sdk_test_support.mock_server_types import ErrorResponseExpectation, OperationExpectation
|
||||
|
||||
OPERATION_MANIFEST = {
|
||||
|
||||
"get_bgp_monitors": OperationExpectation(
|
||||
operation_id="get_bgp_monitors",
|
||||
method="GET",
|
||||
path="/monitors",
|
||||
path_param_examples={
|
||||
},
|
||||
success_status=200,
|
||||
success_body=json.loads("""
|
||||
|
||||
{
|
||||
"_links" : {
|
||||
"self" : {
|
||||
"hreflang" : "hreflang",
|
||||
"templated" : true,
|
||||
"profile" : "profile",
|
||||
"name" : "name",
|
||||
"href" : "https://api.thousandeyes.com/v7/link/to/resource/id",
|
||||
"type" : "type",
|
||||
"deprecation" : "deprecation",
|
||||
"title" : "title"
|
||||
}
|
||||
},
|
||||
"monitors" : [ {
|
||||
"monitorType" : "public",
|
||||
"monitorId" : "1234",
|
||||
"monitorName" : "Seattle, WA",
|
||||
"ipAddress" : "4.69.184.193",
|
||||
"countryId" : "GB",
|
||||
"network" : "Level 3 Communications, Inc. (AS 3356)"
|
||||
}, {
|
||||
"monitorType" : "public",
|
||||
"monitorId" : "1234",
|
||||
"monitorName" : "Seattle, WA",
|
||||
"ipAddress" : "4.69.184.193",
|
||||
"countryId" : "GB",
|
||||
"network" : "Level 3 Communications, Inc. (AS 3356)"
|
||||
} ]
|
||||
}
|
||||
|
||||
"""),
|
||||
|
||||
success_content_type="application/json",
|
||||
|
||||
request_body_example=None,
|
||||
error_responses={
|
||||
|
||||
"401": ErrorResponseExpectation(
|
||||
status=401,
|
||||
body=json.loads("""
|
||||
{
|
||||
"error_description" : "Invalid access token",
|
||||
"error" : "invalid_token"
|
||||
}"""),
|
||||
content_type="application/json",
|
||||
),
|
||||
|
||||
"403": ErrorResponseExpectation(
|
||||
status=403,
|
||||
body=json.loads("""
|
||||
{
|
||||
"instance" : "instance",
|
||||
"detail" : "detail",
|
||||
"type" : "type",
|
||||
"title" : "title",
|
||||
"status" : 0
|
||||
}"""),
|
||||
content_type="application/json",
|
||||
),
|
||||
|
||||
"404": ErrorResponseExpectation(
|
||||
status=404,
|
||||
body=json.loads("""
|
||||
{
|
||||
"instance" : "instance",
|
||||
"detail" : "detail",
|
||||
"type" : "type",
|
||||
"title" : "title",
|
||||
"status" : 0
|
||||
}"""),
|
||||
content_type="application/json",
|
||||
),
|
||||
|
||||
"429": ErrorResponseExpectation(
|
||||
status=429,
|
||||
body=json.loads("""
|
||||
{
|
||||
"instance" : "instance",
|
||||
"detail" : "detail",
|
||||
"type" : "type",
|
||||
"title" : "title",
|
||||
"status" : 0
|
||||
}"""),
|
||||
content_type="application/json",
|
||||
),
|
||||
|
||||
"500": ErrorResponseExpectation(
|
||||
status=500,
|
||||
body=json.loads("""
|
||||
{
|
||||
"instance" : "instance",
|
||||
"detail" : "detail",
|
||||
"type" : "type",
|
||||
"title" : "title",
|
||||
"status" : 0
|
||||
}"""),
|
||||
content_type="application/json",
|
||||
),
|
||||
|
||||
},
|
||||
),
|
||||
|
||||
}
|
||||
@ -0,0 +1,203 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
BGP Monitors API
|
||||
|
||||
**Note:** Private monitor data is not available for ThousandEyes for Government instance. Retrieve information about BGP monitors available to your ThousandEyes account. ThousandEyes ingests BGP routing data from dozens of global BGP collectors and automatically integrates that visibility as a configurable layer under service, network, and path visualization layers. When you specify a service URL in a test, layered BGP tests automatically track reachability and path changes for any relevant prefix. When you use an IP address as the target for a test, the ThousandEyes platform monitors the relevant internet-routed prefix. You can also create specific BGP monitoring for a prefix, and can alert on hijacks and leaks. For more information about monitors, see [Inside-Out BGP Visibility](https://docs.thousandeyes.com/product-documentation/internet-and-wan-monitoring/tests/bgp-tests/inside-out-bgp-visibility).
|
||||
|
||||
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
||||
|
||||
Do not edit the class manually.
|
||||
""" # noqa: E501
|
||||
|
||||
|
||||
import json
|
||||
import unittest
|
||||
import thousandeyes_sdk.bgp_monitors.models
|
||||
|
||||
from thousandeyes_sdk.core.exceptions import ApiException
|
||||
from thousandeyes_sdk.bgp_monitors.api.bgp_monitors_api import BGPMonitorsApi
|
||||
from .integration_test_utils import IntegrationTestBase
|
||||
from .test_utils import assert_constructed_model_matches_example_json
|
||||
|
||||
|
||||
class TestBGPMonitorsApiIntegration(IntegrationTestBase):
|
||||
"""BGPMonitorsApi integration test stubs"""
|
||||
|
||||
def setUp(self) -> None:
|
||||
super().setUp()
|
||||
self.api = BGPMonitorsApi(self.api_client)
|
||||
|
||||
|
||||
def test_get_bgp_monitors_happy_path(self) -> None:
|
||||
"""Integration test for get_bgp_monitors success path"""
|
||||
aid = '1234'
|
||||
response_body_json = """
|
||||
{
|
||||
"_links" : {
|
||||
"self" : {
|
||||
"hreflang" : "hreflang",
|
||||
"templated" : true,
|
||||
"profile" : "profile",
|
||||
"name" : "name",
|
||||
"href" : "https://api.thousandeyes.com/v7/link/to/resource/id",
|
||||
"type" : "type",
|
||||
"deprecation" : "deprecation",
|
||||
"title" : "title"
|
||||
}
|
||||
},
|
||||
"monitors" : [ {
|
||||
"monitorType" : "public",
|
||||
"monitorId" : "1234",
|
||||
"monitorName" : "Seattle, WA",
|
||||
"ipAddress" : "4.69.184.193",
|
||||
"countryId" : "GB",
|
||||
"network" : "Level 3 Communications, Inc. (AS 3356)"
|
||||
}, {
|
||||
"monitorType" : "public",
|
||||
"monitorId" : "1234",
|
||||
"monitorName" : "Seattle, WA",
|
||||
"ipAddress" : "4.69.184.193",
|
||||
"countryId" : "GB",
|
||||
"network" : "Level 3 Communications, Inc. (AS 3356)"
|
||||
} ]
|
||||
}
|
||||
"""
|
||||
expected_response = json.loads(response_body_json)
|
||||
response = self.api.get_bgp_monitors(
|
||||
|
||||
aid=aid,
|
||||
|
||||
_headers=self.te_headers("get_bgp_monitors"),
|
||||
)
|
||||
assert_constructed_model_matches_example_json(response, expected_response)
|
||||
|
||||
|
||||
def test_get_bgp_monitors_error_401(self) -> None:
|
||||
"""Integration test for get_bgp_monitors error path (HTTP 401)"""
|
||||
aid = '1234'
|
||||
error_body_json = """
|
||||
{
|
||||
"error_description" : "Invalid access token",
|
||||
"error" : "invalid_token"
|
||||
}
|
||||
"""
|
||||
expected_error = json.loads(error_body_json)
|
||||
with self.assertRaises(
|
||||
ApiException.exception_class_for_http_status(401)
|
||||
) as context:
|
||||
self.api.get_bgp_monitors(
|
||||
|
||||
aid=aid,
|
||||
|
||||
_headers=self.te_headers("get_bgp_monitors", error_status="401"),
|
||||
)
|
||||
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
|
||||
|
||||
|
||||
def test_get_bgp_monitors_error_403(self) -> None:
|
||||
"""Integration test for get_bgp_monitors error path (HTTP 403)"""
|
||||
aid = '1234'
|
||||
error_body_json = """
|
||||
{
|
||||
"instance" : "instance",
|
||||
"detail" : "detail",
|
||||
"type" : "type",
|
||||
"title" : "title",
|
||||
"status" : 0
|
||||
}
|
||||
"""
|
||||
expected_error = json.loads(error_body_json)
|
||||
with self.assertRaises(
|
||||
ApiException.exception_class_for_http_status(403)
|
||||
) as context:
|
||||
self.api.get_bgp_monitors(
|
||||
|
||||
aid=aid,
|
||||
|
||||
_headers=self.te_headers("get_bgp_monitors", error_status="403"),
|
||||
)
|
||||
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
|
||||
|
||||
|
||||
def test_get_bgp_monitors_error_404(self) -> None:
|
||||
"""Integration test for get_bgp_monitors error path (HTTP 404)"""
|
||||
aid = '1234'
|
||||
error_body_json = """
|
||||
{
|
||||
"instance" : "instance",
|
||||
"detail" : "detail",
|
||||
"type" : "type",
|
||||
"title" : "title",
|
||||
"status" : 0
|
||||
}
|
||||
"""
|
||||
expected_error = json.loads(error_body_json)
|
||||
with self.assertRaises(
|
||||
ApiException.exception_class_for_http_status(404)
|
||||
) as context:
|
||||
self.api.get_bgp_monitors(
|
||||
|
||||
aid=aid,
|
||||
|
||||
_headers=self.te_headers("get_bgp_monitors", error_status="404"),
|
||||
)
|
||||
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
|
||||
|
||||
|
||||
def test_get_bgp_monitors_error_429(self) -> None:
|
||||
"""Integration test for get_bgp_monitors error path (HTTP 429)"""
|
||||
aid = '1234'
|
||||
error_body_json = """
|
||||
{
|
||||
"instance" : "instance",
|
||||
"detail" : "detail",
|
||||
"type" : "type",
|
||||
"title" : "title",
|
||||
"status" : 0
|
||||
}
|
||||
"""
|
||||
expected_error = json.loads(error_body_json)
|
||||
with self.assertRaises(
|
||||
ApiException.exception_class_for_http_status(429)
|
||||
) as context:
|
||||
self.api.get_bgp_monitors(
|
||||
|
||||
aid=aid,
|
||||
|
||||
_headers=self.te_headers("get_bgp_monitors", error_status="429"),
|
||||
)
|
||||
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
|
||||
|
||||
|
||||
def test_get_bgp_monitors_error_500(self) -> None:
|
||||
"""Integration test for get_bgp_monitors error path (HTTP 500)"""
|
||||
aid = '1234'
|
||||
error_body_json = """
|
||||
{
|
||||
"instance" : "instance",
|
||||
"detail" : "detail",
|
||||
"type" : "type",
|
||||
"title" : "title",
|
||||
"status" : 0
|
||||
}
|
||||
"""
|
||||
expected_error = json.loads(error_body_json)
|
||||
with self.assertRaises(
|
||||
ApiException.exception_class_for_http_status(500)
|
||||
) as context:
|
||||
self.api.get_bgp_monitors(
|
||||
|
||||
aid=aid,
|
||||
|
||||
_headers=self.te_headers("get_bgp_monitors", error_status="500"),
|
||||
)
|
||||
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
@ -2,15 +2,36 @@
|
||||
|
||||
import json
|
||||
import unittest
|
||||
from typing import Any
|
||||
|
||||
from pydantic import BaseModel
|
||||
|
||||
|
||||
def _project_onto_constructed(expected: Any, constructed: Any) -> Any:
|
||||
"""Keep only example fields that appear in the constructed model output."""
|
||||
if isinstance(constructed, dict):
|
||||
if not isinstance(expected, dict):
|
||||
return expected
|
||||
return {
|
||||
key: _project_onto_constructed(expected.get(key), value)
|
||||
for key, value in constructed.items()
|
||||
}
|
||||
if isinstance(constructed, list):
|
||||
if not isinstance(expected, list):
|
||||
return expected
|
||||
return [
|
||||
_project_onto_constructed(expected[index], value)
|
||||
for index, value in enumerate(constructed)
|
||||
]
|
||||
return expected
|
||||
|
||||
|
||||
def assert_constructed_model_matches_example_json(model: BaseModel, loaded_json: dict):
|
||||
test_case = unittest.TestCase()
|
||||
test_case.maxDiff = None
|
||||
test_case.assertIsNotNone(model)
|
||||
constructed_json = json.loads(model.to_json())
|
||||
sorted_loaded_json = json.dumps(loaded_json, sort_keys=True)
|
||||
projected_loaded_json = _project_onto_constructed(loaded_json, constructed_json)
|
||||
sorted_loaded_json = json.dumps(projected_loaded_json, sort_keys=True)
|
||||
sorted_constructed_json = json.dumps(constructed_json, sort_keys=True)
|
||||
test_case.assertEqual(sorted_loaded_json, sorted_constructed_json)
|
||||
|
||||
@ -28,6 +28,12 @@ docs/OperationConnectorsApi.md
|
||||
docs/OperationStatus.md
|
||||
docs/OperationType.md
|
||||
docs/OtherTokenAuthentication.md
|
||||
docs/PanoramaConnector.md
|
||||
docs/PanoramaConnectorAuth.md
|
||||
docs/PanoramaConnectors.md
|
||||
docs/PanoramaConnectorsApi.md
|
||||
docs/PanoramaKeyGenAuthentication.md
|
||||
docs/PanoramaTokenAuthentication.md
|
||||
docs/SelfLinks.md
|
||||
docs/UnauthorizedError.md
|
||||
docs/ValidationError.md
|
||||
@ -43,6 +49,7 @@ src/thousandeyes_sdk/connectors/api/credential_vault_operations_api.py
|
||||
src/thousandeyes_sdk/connectors/api/cyber_ark_conjur_connectors_api.py
|
||||
src/thousandeyes_sdk/connectors/api/generic_connectors_api.py
|
||||
src/thousandeyes_sdk/connectors/api/operation_connectors_api.py
|
||||
src/thousandeyes_sdk/connectors/api/panorama_connectors_api.py
|
||||
src/thousandeyes_sdk/connectors/api/webhook_operations_api.py
|
||||
src/thousandeyes_sdk/connectors/models/__init__.py
|
||||
src/thousandeyes_sdk/connectors/models/assignments.py
|
||||
@ -68,6 +75,11 @@ src/thousandeyes_sdk/connectors/models/operation_category.py
|
||||
src/thousandeyes_sdk/connectors/models/operation_status.py
|
||||
src/thousandeyes_sdk/connectors/models/operation_type.py
|
||||
src/thousandeyes_sdk/connectors/models/other_token_authentication.py
|
||||
src/thousandeyes_sdk/connectors/models/panorama_connector.py
|
||||
src/thousandeyes_sdk/connectors/models/panorama_connector_auth.py
|
||||
src/thousandeyes_sdk/connectors/models/panorama_connectors.py
|
||||
src/thousandeyes_sdk/connectors/models/panorama_key_gen_authentication.py
|
||||
src/thousandeyes_sdk/connectors/models/panorama_token_authentication.py
|
||||
src/thousandeyes_sdk/connectors/models/self_links.py
|
||||
src/thousandeyes_sdk/connectors/models/unauthorized_error.py
|
||||
src/thousandeyes_sdk/connectors/models/validation_error.py
|
||||
@ -76,9 +88,19 @@ src/thousandeyes_sdk/connectors/models/webhook_operation.py
|
||||
src/thousandeyes_sdk/connectors/models/webhook_operations.py
|
||||
src/thousandeyes_sdk/connectors/py.typed
|
||||
test/__init__.py
|
||||
test/conftest.py
|
||||
test/integration_test_utils.py
|
||||
test/mock_manifest.py
|
||||
test/test_credential_vault_operations_api.py
|
||||
test/test_credential_vault_operations_api_integration.py
|
||||
test/test_cyber_ark_conjur_connectors_api.py
|
||||
test/test_cyber_ark_conjur_connectors_api_integration.py
|
||||
test/test_generic_connectors_api.py
|
||||
test/test_generic_connectors_api_integration.py
|
||||
test/test_operation_connectors_api.py
|
||||
test/test_operation_connectors_api_integration.py
|
||||
test/test_panorama_connectors_api.py
|
||||
test/test_panorama_connectors_api_integration.py
|
||||
test/test_utils.py
|
||||
test/test_webhook_operations_api.py
|
||||
test/test_webhook_operations_api_integration.py
|
||||
|
||||
@ -6,7 +6,7 @@ Manage connectors and operations.
|
||||
|
||||
This Python package is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project:
|
||||
|
||||
- API version: 7.0.96
|
||||
- API version: 7.0.99
|
||||
- Generator version: 7.6.0
|
||||
- Build package: com.thousandeyes.api.codegen.ThousandeyesPythonGenerator
|
||||
|
||||
@ -119,6 +119,13 @@ Class | Method | HTTP request | Description
|
||||
*GenericConnectorsApi* | [**update_generic_connector**](https://github.com/thousandeyes/thousandeyes-sdk-python//tree/main/thousandeyes-sdk-connectors/docs/GenericConnectorsApi.md#update_generic_connector) | **PUT** /connectors/generic/{id} | Update connector
|
||||
*OperationConnectorsApi* | [**get_operation_connectors**](https://github.com/thousandeyes/thousandeyes-sdk-python//tree/main/thousandeyes-sdk-connectors/docs/OperationConnectorsApi.md#get_operation_connectors) | **GET** /operations/{type}/{id}/connectors | Retrieve connectors assigned to an operation
|
||||
*OperationConnectorsApi* | [**set_operation_connectors**](https://github.com/thousandeyes/thousandeyes-sdk-python//tree/main/thousandeyes-sdk-connectors/docs/OperationConnectorsApi.md#set_operation_connectors) | **PUT** /operations/{type}/{id}/connectors | Assign connectors to an operation
|
||||
*PanoramaConnectorsApi* | [**create_panorama_connector**](https://github.com/thousandeyes/thousandeyes-sdk-python//tree/main/thousandeyes-sdk-connectors/docs/PanoramaConnectorsApi.md#create_panorama_connector) | **POST** /connectors/panorama | Create Panorama connector
|
||||
*PanoramaConnectorsApi* | [**delete_panorama_connector**](https://github.com/thousandeyes/thousandeyes-sdk-python//tree/main/thousandeyes-sdk-connectors/docs/PanoramaConnectorsApi.md#delete_panorama_connector) | **DELETE** /connectors/panorama/{id} | Delete Panorama connector
|
||||
*PanoramaConnectorsApi* | [**get_panorama_connector**](https://github.com/thousandeyes/thousandeyes-sdk-python//tree/main/thousandeyes-sdk-connectors/docs/PanoramaConnectorsApi.md#get_panorama_connector) | **GET** /connectors/panorama/{id} | Retrieve Panorama connector
|
||||
*PanoramaConnectorsApi* | [**get_panorama_connector_operations**](https://github.com/thousandeyes/thousandeyes-sdk-python//tree/main/thousandeyes-sdk-connectors/docs/PanoramaConnectorsApi.md#get_panorama_connector_operations) | **GET** /connectors/panorama/{id}/operations | List operation IDs for Panorama connector
|
||||
*PanoramaConnectorsApi* | [**get_panorama_connectors**](https://github.com/thousandeyes/thousandeyes-sdk-python//tree/main/thousandeyes-sdk-connectors/docs/PanoramaConnectorsApi.md#get_panorama_connectors) | **GET** /connectors/panorama | List Panorama connectors
|
||||
*PanoramaConnectorsApi* | [**set_panorama_connector_operations**](https://github.com/thousandeyes/thousandeyes-sdk-python//tree/main/thousandeyes-sdk-connectors/docs/PanoramaConnectorsApi.md#set_panorama_connector_operations) | **PUT** /connectors/panorama/{id}/operations | Assign operations to Panorama connector
|
||||
*PanoramaConnectorsApi* | [**update_panorama_connector**](https://github.com/thousandeyes/thousandeyes-sdk-python//tree/main/thousandeyes-sdk-connectors/docs/PanoramaConnectorsApi.md#update_panorama_connector) | **PUT** /connectors/panorama/{id} | Update Panorama connector
|
||||
*WebhookOperationsApi* | [**create_webhook_operation**](https://github.com/thousandeyes/thousandeyes-sdk-python//tree/main/thousandeyes-sdk-connectors/docs/WebhookOperationsApi.md#create_webhook_operation) | **POST** /operations/webhooks | Create webhook operation
|
||||
*WebhookOperationsApi* | [**delete_webhook_operation**](https://github.com/thousandeyes/thousandeyes-sdk-python//tree/main/thousandeyes-sdk-connectors/docs/WebhookOperationsApi.md#delete_webhook_operation) | **DELETE** /operations/webhooks/{id} | Delete webhook operation
|
||||
*WebhookOperationsApi* | [**get_webhook_operation**](https://github.com/thousandeyes/thousandeyes-sdk-python//tree/main/thousandeyes-sdk-connectors/docs/WebhookOperationsApi.md#get_webhook_operation) | **GET** /operations/webhooks/{id} | Retrieve webhook operation
|
||||
@ -151,6 +158,11 @@ Class | Method | HTTP request | Description
|
||||
- [OperationStatus](https://github.com/thousandeyes/thousandeyes-sdk-python//tree/main/thousandeyes-sdk-connectors/docs/OperationStatus.md)
|
||||
- [OperationType](https://github.com/thousandeyes/thousandeyes-sdk-python//tree/main/thousandeyes-sdk-connectors/docs/OperationType.md)
|
||||
- [OtherTokenAuthentication](https://github.com/thousandeyes/thousandeyes-sdk-python//tree/main/thousandeyes-sdk-connectors/docs/OtherTokenAuthentication.md)
|
||||
- [PanoramaConnector](https://github.com/thousandeyes/thousandeyes-sdk-python//tree/main/thousandeyes-sdk-connectors/docs/PanoramaConnector.md)
|
||||
- [PanoramaConnectorAuth](https://github.com/thousandeyes/thousandeyes-sdk-python//tree/main/thousandeyes-sdk-connectors/docs/PanoramaConnectorAuth.md)
|
||||
- [PanoramaConnectors](https://github.com/thousandeyes/thousandeyes-sdk-python//tree/main/thousandeyes-sdk-connectors/docs/PanoramaConnectors.md)
|
||||
- [PanoramaKeyGenAuthentication](https://github.com/thousandeyes/thousandeyes-sdk-python//tree/main/thousandeyes-sdk-connectors/docs/PanoramaKeyGenAuthentication.md)
|
||||
- [PanoramaTokenAuthentication](https://github.com/thousandeyes/thousandeyes-sdk-python//tree/main/thousandeyes-sdk-connectors/docs/PanoramaTokenAuthentication.md)
|
||||
- [SelfLinks](https://github.com/thousandeyes/thousandeyes-sdk-python//tree/main/thousandeyes-sdk-connectors/docs/SelfLinks.md)
|
||||
- [UnauthorizedError](https://github.com/thousandeyes/thousandeyes-sdk-python//tree/main/thousandeyes-sdk-connectors/docs/UnauthorizedError.md)
|
||||
- [ValidationError](https://github.com/thousandeyes/thousandeyes-sdk-python//tree/main/thousandeyes-sdk-connectors/docs/ValidationError.md)
|
||||
|
||||
36
thousandeyes-sdk-connectors/docs/PanoramaConnector.md
Normal file
36
thousandeyes-sdk-connectors/docs/PanoramaConnector.md
Normal file
@ -0,0 +1,36 @@
|
||||
# PanoramaConnector
|
||||
|
||||
Palo Alto Networks Panorama connector configuration.
|
||||
|
||||
## Properties
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
**id** | **str** | Unique ID of the Panorama connector. | [optional] [readonly]
|
||||
**type** | **str** | Connector type. |
|
||||
**name** | **str** | Name of the Panorama connector. |
|
||||
**target** | **str** | URL of the Panorama instance. |
|
||||
**last_modified_date** | **int** | Time when the connector was last modified, in milliseconds since the Unix epoch. | [optional] [readonly]
|
||||
**authentication** | [**PanoramaConnectorAuth**](PanoramaConnectorAuth.md) | |
|
||||
**links** | [**SelfLinks**](SelfLinks.md) | | [optional]
|
||||
|
||||
## Example
|
||||
|
||||
```python
|
||||
from thousandeyes_sdk.connectors.models.panorama_connector import PanoramaConnector
|
||||
|
||||
# TODO update the JSON string below
|
||||
json = "{}"
|
||||
# create an instance of PanoramaConnector from a JSON string
|
||||
panorama_connector_instance = PanoramaConnector.from_json(json)
|
||||
# print the JSON string representation of the object
|
||||
print(PanoramaConnector.to_json())
|
||||
|
||||
# convert the object into a dict
|
||||
panorama_connector_dict = panorama_connector_instance.to_dict()
|
||||
# create an instance of PanoramaConnector from a dict
|
||||
panorama_connector_from_dict = PanoramaConnector.from_dict(panorama_connector_dict)
|
||||
```
|
||||
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
|
||||
|
||||
|
||||
34
thousandeyes-sdk-connectors/docs/PanoramaConnectorAuth.md
Normal file
34
thousandeyes-sdk-connectors/docs/PanoramaConnectorAuth.md
Normal file
@ -0,0 +1,34 @@
|
||||
# PanoramaConnectorAuth
|
||||
|
||||
Authentication configuration for the Panorama connector.
|
||||
|
||||
## Properties
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
**token** | **str** | Panorama API key used for authentication. |
|
||||
**type** | **str** | Authentication type. |
|
||||
**username** | **str** | Username used to generate the Panorama API key. |
|
||||
**password** | **str** | Password used to generate the Panorama API key. |
|
||||
**key_ttl** | **int** | Time to live for the generated Panorama API key, in minutes. |
|
||||
|
||||
## Example
|
||||
|
||||
```python
|
||||
from thousandeyes_sdk.connectors.models.panorama_connector_auth import PanoramaConnectorAuth
|
||||
|
||||
# TODO update the JSON string below
|
||||
json = "{}"
|
||||
# create an instance of PanoramaConnectorAuth from a JSON string
|
||||
panorama_connector_auth_instance = PanoramaConnectorAuth.from_json(json)
|
||||
# print the JSON string representation of the object
|
||||
print(PanoramaConnectorAuth.to_json())
|
||||
|
||||
# convert the object into a dict
|
||||
panorama_connector_auth_dict = panorama_connector_auth_instance.to_dict()
|
||||
# create an instance of PanoramaConnectorAuth from a dict
|
||||
panorama_connector_auth_from_dict = PanoramaConnectorAuth.from_dict(panorama_connector_auth_dict)
|
||||
```
|
||||
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
|
||||
|
||||
|
||||
31
thousandeyes-sdk-connectors/docs/PanoramaConnectors.md
Normal file
31
thousandeyes-sdk-connectors/docs/PanoramaConnectors.md
Normal file
@ -0,0 +1,31 @@
|
||||
# PanoramaConnectors
|
||||
|
||||
Collection of Panorama connectors.
|
||||
|
||||
## Properties
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
**items** | [**List[PanoramaConnector]**](PanoramaConnector.md) | | [optional]
|
||||
**links** | [**SelfLinks**](SelfLinks.md) | | [optional]
|
||||
|
||||
## Example
|
||||
|
||||
```python
|
||||
from thousandeyes_sdk.connectors.models.panorama_connectors import PanoramaConnectors
|
||||
|
||||
# TODO update the JSON string below
|
||||
json = "{}"
|
||||
# create an instance of PanoramaConnectors from a JSON string
|
||||
panorama_connectors_instance = PanoramaConnectors.from_json(json)
|
||||
# print the JSON string representation of the object
|
||||
print(PanoramaConnectors.to_json())
|
||||
|
||||
# convert the object into a dict
|
||||
panorama_connectors_dict = panorama_connectors_instance.to_dict()
|
||||
# create an instance of PanoramaConnectors from a dict
|
||||
panorama_connectors_from_dict = PanoramaConnectors.from_dict(panorama_connectors_dict)
|
||||
```
|
||||
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
|
||||
|
||||
|
||||
609
thousandeyes-sdk-connectors/docs/PanoramaConnectorsApi.md
Normal file
609
thousandeyes-sdk-connectors/docs/PanoramaConnectorsApi.md
Normal file
@ -0,0 +1,609 @@
|
||||
# thousandeyes_sdk.connectors.PanoramaConnectorsApi
|
||||
|
||||
All URIs are relative to *https://api.thousandeyes.com/v7*
|
||||
|
||||
Method | HTTP request | Description
|
||||
------------- | ------------- | -------------
|
||||
[**create_panorama_connector**](PanoramaConnectorsApi.md#create_panorama_connector) | **POST** /connectors/panorama | Create Panorama connector
|
||||
[**delete_panorama_connector**](PanoramaConnectorsApi.md#delete_panorama_connector) | **DELETE** /connectors/panorama/{id} | Delete Panorama connector
|
||||
[**get_panorama_connector**](PanoramaConnectorsApi.md#get_panorama_connector) | **GET** /connectors/panorama/{id} | Retrieve Panorama connector
|
||||
[**get_panorama_connector_operations**](PanoramaConnectorsApi.md#get_panorama_connector_operations) | **GET** /connectors/panorama/{id}/operations | List operation IDs for Panorama connector
|
||||
[**get_panorama_connectors**](PanoramaConnectorsApi.md#get_panorama_connectors) | **GET** /connectors/panorama | List Panorama connectors
|
||||
[**set_panorama_connector_operations**](PanoramaConnectorsApi.md#set_panorama_connector_operations) | **PUT** /connectors/panorama/{id}/operations | Assign operations to Panorama connector
|
||||
[**update_panorama_connector**](PanoramaConnectorsApi.md#update_panorama_connector) | **PUT** /connectors/panorama/{id} | Update Panorama connector
|
||||
|
||||
|
||||
# **create_panorama_connector**
|
||||
> PanoramaConnector create_panorama_connector(panorama_connector, aid=aid)
|
||||
|
||||
Create Panorama connector
|
||||
|
||||
Creates a new Panorama connector.
|
||||
|
||||
### Example
|
||||
|
||||
* Bearer Authentication (BearerAuth):
|
||||
|
||||
```python
|
||||
import thousandeyes_sdk.connectors
|
||||
from thousandeyes_sdk.connectors.models.panorama_connector import PanoramaConnector
|
||||
from thousandeyes_sdk.connectors.rest import ApiException
|
||||
from pprint import pprint
|
||||
|
||||
# Defining the host is optional and defaults to https://api.thousandeyes.com/v7
|
||||
# See configuration.py for a list of all supported configuration parameters.
|
||||
configuration = thousandeyes_sdk.core.Configuration(
|
||||
host = "https://api.thousandeyes.com/v7"
|
||||
)
|
||||
|
||||
# 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 = thousandeyes_sdk.core.Configuration(
|
||||
access_token = os.environ["BEARER_TOKEN"]
|
||||
)
|
||||
|
||||
# Enter a context with an instance of the API client
|
||||
with thousandeyes_sdk.core.ApiClient(configuration) as api_client:
|
||||
# Create an instance of the API class
|
||||
api_instance = thousandeyes_sdk.connectors.PanoramaConnectorsApi(api_client)
|
||||
panorama_connector = {"type":"panorama","name":"Branch Panorama","target":"https://panorama.example.com","authentication":{"username":"panorama-user","password":"<panorama-password>","keyTtl":40,"type":"pan-key-gen"}} # PanoramaConnector | Panorama connector configuration.
|
||||
aid = '1234' # 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 Panorama connector
|
||||
api_response = api_instance.create_panorama_connector(panorama_connector, aid=aid)
|
||||
print("The response of PanoramaConnectorsApi->create_panorama_connector:\n")
|
||||
pprint(api_response)
|
||||
except Exception as e:
|
||||
print("Exception when calling PanoramaConnectorsApi->create_panorama_connector: %s\n" % e)
|
||||
```
|
||||
|
||||
|
||||
|
||||
### Parameters
|
||||
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**panorama_connector** | [**PanoramaConnector**](PanoramaConnector.md)| Panorama connector configuration. |
|
||||
**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
|
||||
|
||||
[**PanoramaConnector**](PanoramaConnector.md)
|
||||
|
||||
### Authorization
|
||||
|
||||
[BearerAuth](../README.md#BearerAuth)
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: application/json
|
||||
- **Accept**: application/hal+json, application/json, application/problem+json
|
||||
|
||||
### HTTP response details
|
||||
|
||||
| Status code | Description | Response headers |
|
||||
|-------------|-------------|------------------|
|
||||
**201** | The created Panorama connector. | - |
|
||||
**400** | Bad Request | - |
|
||||
**401** | Unauthorized | - |
|
||||
**403** | Insufficient permissions to query endpoint | - |
|
||||
**404** | Not found | - |
|
||||
**500** | Internal server error | - |
|
||||
|
||||
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
|
||||
|
||||
# **delete_panorama_connector**
|
||||
> delete_panorama_connector(id, aid=aid)
|
||||
|
||||
Delete Panorama connector
|
||||
|
||||
Deletes the Panorama connector specified by ID.
|
||||
|
||||
### Example
|
||||
|
||||
* Bearer Authentication (BearerAuth):
|
||||
|
||||
```python
|
||||
import thousandeyes_sdk.connectors
|
||||
from thousandeyes_sdk.connectors.rest import ApiException
|
||||
from pprint import pprint
|
||||
|
||||
# Defining the host is optional and defaults to https://api.thousandeyes.com/v7
|
||||
# See configuration.py for a list of all supported configuration parameters.
|
||||
configuration = thousandeyes_sdk.core.Configuration(
|
||||
host = "https://api.thousandeyes.com/v7"
|
||||
)
|
||||
|
||||
# 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 = thousandeyes_sdk.core.Configuration(
|
||||
access_token = os.environ["BEARER_TOKEN"]
|
||||
)
|
||||
|
||||
# Enter a context with an instance of the API client
|
||||
with thousandeyes_sdk.core.ApiClient(configuration) as api_client:
|
||||
# Create an instance of the API class
|
||||
api_instance = thousandeyes_sdk.connectors.PanoramaConnectorsApi(api_client)
|
||||
id = 'cb1b8033-ea2d-4e9b-a920-fe87850693cf' # str | The connector ID.
|
||||
aid = '1234' # 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 Panorama connector
|
||||
api_instance.delete_panorama_connector(id, aid=aid)
|
||||
except Exception as e:
|
||||
print("Exception when calling PanoramaConnectorsApi->delete_panorama_connector: %s\n" % e)
|
||||
```
|
||||
|
||||
|
||||
|
||||
### Parameters
|
||||
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**id** | **str**| The connector 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](../README.md#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 | - |
|
||||
**500** | Internal server error | - |
|
||||
|
||||
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
|
||||
|
||||
# **get_panorama_connector**
|
||||
> PanoramaConnector get_panorama_connector(id, aid=aid)
|
||||
|
||||
Retrieve Panorama connector
|
||||
|
||||
Retrieves details of a Panorama connector by its ID.
|
||||
|
||||
### Example
|
||||
|
||||
* Bearer Authentication (BearerAuth):
|
||||
|
||||
```python
|
||||
import thousandeyes_sdk.connectors
|
||||
from thousandeyes_sdk.connectors.models.panorama_connector import PanoramaConnector
|
||||
from thousandeyes_sdk.connectors.rest import ApiException
|
||||
from pprint import pprint
|
||||
|
||||
# Defining the host is optional and defaults to https://api.thousandeyes.com/v7
|
||||
# See configuration.py for a list of all supported configuration parameters.
|
||||
configuration = thousandeyes_sdk.core.Configuration(
|
||||
host = "https://api.thousandeyes.com/v7"
|
||||
)
|
||||
|
||||
# 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 = thousandeyes_sdk.core.Configuration(
|
||||
access_token = os.environ["BEARER_TOKEN"]
|
||||
)
|
||||
|
||||
# Enter a context with an instance of the API client
|
||||
with thousandeyes_sdk.core.ApiClient(configuration) as api_client:
|
||||
# Create an instance of the API class
|
||||
api_instance = thousandeyes_sdk.connectors.PanoramaConnectorsApi(api_client)
|
||||
id = 'cb1b8033-ea2d-4e9b-a920-fe87850693cf' # str | The connector ID.
|
||||
aid = '1234' # 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 Panorama connector
|
||||
api_response = api_instance.get_panorama_connector(id, aid=aid)
|
||||
print("The response of PanoramaConnectorsApi->get_panorama_connector:\n")
|
||||
pprint(api_response)
|
||||
except Exception as e:
|
||||
print("Exception when calling PanoramaConnectorsApi->get_panorama_connector: %s\n" % e)
|
||||
```
|
||||
|
||||
|
||||
|
||||
### Parameters
|
||||
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**id** | **str**| The connector 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
|
||||
|
||||
[**PanoramaConnector**](PanoramaConnector.md)
|
||||
|
||||
### Authorization
|
||||
|
||||
[BearerAuth](../README.md#BearerAuth)
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: Not defined
|
||||
- **Accept**: application/hal+json, application/json, application/problem+json
|
||||
|
||||
### HTTP response details
|
||||
|
||||
| Status code | Description | Response headers |
|
||||
|-------------|-------------|------------------|
|
||||
**200** | Panorama connector details. | - |
|
||||
**400** | Bad Request | - |
|
||||
**401** | Unauthorized | - |
|
||||
**403** | Insufficient permissions to query endpoint | - |
|
||||
**404** | Not found | - |
|
||||
**500** | Internal server error | - |
|
||||
|
||||
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
|
||||
|
||||
# **get_panorama_connector_operations**
|
||||
> Assignments get_panorama_connector_operations(id, aid=aid)
|
||||
|
||||
List operation IDs for Panorama connector
|
||||
|
||||
Returns a list of operation IDs assigned to a Panorama connector.
|
||||
|
||||
### Example
|
||||
|
||||
* Bearer Authentication (BearerAuth):
|
||||
|
||||
```python
|
||||
import thousandeyes_sdk.connectors
|
||||
from thousandeyes_sdk.connectors.models.assignments import Assignments
|
||||
from thousandeyes_sdk.connectors.rest import ApiException
|
||||
from pprint import pprint
|
||||
|
||||
# Defining the host is optional and defaults to https://api.thousandeyes.com/v7
|
||||
# See configuration.py for a list of all supported configuration parameters.
|
||||
configuration = thousandeyes_sdk.core.Configuration(
|
||||
host = "https://api.thousandeyes.com/v7"
|
||||
)
|
||||
|
||||
# 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 = thousandeyes_sdk.core.Configuration(
|
||||
access_token = os.environ["BEARER_TOKEN"]
|
||||
)
|
||||
|
||||
# Enter a context with an instance of the API client
|
||||
with thousandeyes_sdk.core.ApiClient(configuration) as api_client:
|
||||
# Create an instance of the API class
|
||||
api_instance = thousandeyes_sdk.connectors.PanoramaConnectorsApi(api_client)
|
||||
id = 'cb1b8033-ea2d-4e9b-a920-fe87850693cf' # str | The connector ID.
|
||||
aid = '1234' # 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 operation IDs for Panorama connector
|
||||
api_response = api_instance.get_panorama_connector_operations(id, aid=aid)
|
||||
print("The response of PanoramaConnectorsApi->get_panorama_connector_operations:\n")
|
||||
pprint(api_response)
|
||||
except Exception as e:
|
||||
print("Exception when calling PanoramaConnectorsApi->get_panorama_connector_operations: %s\n" % e)
|
||||
```
|
||||
|
||||
|
||||
|
||||
### Parameters
|
||||
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**id** | **str**| The connector 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
|
||||
|
||||
[**Assignments**](Assignments.md)
|
||||
|
||||
### Authorization
|
||||
|
||||
[BearerAuth](../README.md#BearerAuth)
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: Not defined
|
||||
- **Accept**: application/hal+json, application/json, application/problem+json
|
||||
|
||||
### HTTP response details
|
||||
|
||||
| Status code | Description | Response headers |
|
||||
|-------------|-------------|------------------|
|
||||
**200** | Operation IDs assigned to the Panorama connector. | - |
|
||||
**400** | Bad Request | - |
|
||||
**401** | Unauthorized | - |
|
||||
**403** | Insufficient permissions to query endpoint | - |
|
||||
**404** | Not found | - |
|
||||
**500** | Internal server error | - |
|
||||
|
||||
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
|
||||
|
||||
# **get_panorama_connectors**
|
||||
> PanoramaConnectors get_panorama_connectors(aid=aid)
|
||||
|
||||
List Panorama connectors
|
||||
|
||||
Returns a list of Panorama connectors in the specified account group. If no account group is specified, the user’s default account group is used.
|
||||
|
||||
### Example
|
||||
|
||||
* Bearer Authentication (BearerAuth):
|
||||
|
||||
```python
|
||||
import thousandeyes_sdk.connectors
|
||||
from thousandeyes_sdk.connectors.models.panorama_connectors import PanoramaConnectors
|
||||
from thousandeyes_sdk.connectors.rest import ApiException
|
||||
from pprint import pprint
|
||||
|
||||
# Defining the host is optional and defaults to https://api.thousandeyes.com/v7
|
||||
# See configuration.py for a list of all supported configuration parameters.
|
||||
configuration = thousandeyes_sdk.core.Configuration(
|
||||
host = "https://api.thousandeyes.com/v7"
|
||||
)
|
||||
|
||||
# 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 = thousandeyes_sdk.core.Configuration(
|
||||
access_token = os.environ["BEARER_TOKEN"]
|
||||
)
|
||||
|
||||
# Enter a context with an instance of the API client
|
||||
with thousandeyes_sdk.core.ApiClient(configuration) as api_client:
|
||||
# Create an instance of the API class
|
||||
api_instance = thousandeyes_sdk.connectors.PanoramaConnectorsApi(api_client)
|
||||
aid = '1234' # 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 Panorama connectors
|
||||
api_response = api_instance.get_panorama_connectors(aid=aid)
|
||||
print("The response of PanoramaConnectorsApi->get_panorama_connectors:\n")
|
||||
pprint(api_response)
|
||||
except Exception as e:
|
||||
print("Exception when calling PanoramaConnectorsApi->get_panorama_connectors: %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
|
||||
|
||||
[**PanoramaConnectors**](PanoramaConnectors.md)
|
||||
|
||||
### Authorization
|
||||
|
||||
[BearerAuth](../README.md#BearerAuth)
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: Not defined
|
||||
- **Accept**: application/hal+json, application/json, application/problem+json
|
||||
|
||||
### HTTP response details
|
||||
|
||||
| Status code | Description | Response headers |
|
||||
|-------------|-------------|------------------|
|
||||
**200** | A list of Panorama connectors. | - |
|
||||
**400** | Bad Request | - |
|
||||
**401** | Unauthorized | - |
|
||||
**403** | Insufficient permissions to query endpoint | - |
|
||||
**404** | Not found | - |
|
||||
**500** | Internal server error | - |
|
||||
|
||||
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
|
||||
|
||||
# **set_panorama_connector_operations**
|
||||
> Assignments set_panorama_connector_operations(id, request_body, aid=aid)
|
||||
|
||||
Assign operations to Panorama connector
|
||||
|
||||
Assigns operations to a Panorama connector. This replaces any existing assignments. Passing an empty array removes all operation assignments from the connector.
|
||||
|
||||
### Example
|
||||
|
||||
* Bearer Authentication (BearerAuth):
|
||||
|
||||
```python
|
||||
import thousandeyes_sdk.connectors
|
||||
from thousandeyes_sdk.connectors.models.assignments import Assignments
|
||||
from thousandeyes_sdk.connectors.rest import ApiException
|
||||
from pprint import pprint
|
||||
|
||||
# Defining the host is optional and defaults to https://api.thousandeyes.com/v7
|
||||
# See configuration.py for a list of all supported configuration parameters.
|
||||
configuration = thousandeyes_sdk.core.Configuration(
|
||||
host = "https://api.thousandeyes.com/v7"
|
||||
)
|
||||
|
||||
# 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 = thousandeyes_sdk.core.Configuration(
|
||||
access_token = os.environ["BEARER_TOKEN"]
|
||||
)
|
||||
|
||||
# Enter a context with an instance of the API client
|
||||
with thousandeyes_sdk.core.ApiClient(configuration) as api_client:
|
||||
# Create an instance of the API class
|
||||
api_instance = thousandeyes_sdk.connectors.PanoramaConnectorsApi(api_client)
|
||||
id = 'cb1b8033-ea2d-4e9b-a920-fe87850693cf' # str | The connector ID.
|
||||
request_body = ["ca39314d-eb4f-496f-9435-b5d20b1bfbff","a32cfbab-32f6-41d8-9027-7127cba965dd"] # List[str] | List of operation IDs to assign to the connector.
|
||||
aid = '1234' # 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:
|
||||
# Assign operations to Panorama connector
|
||||
api_response = api_instance.set_panorama_connector_operations(id, request_body, aid=aid)
|
||||
print("The response of PanoramaConnectorsApi->set_panorama_connector_operations:\n")
|
||||
pprint(api_response)
|
||||
except Exception as e:
|
||||
print("Exception when calling PanoramaConnectorsApi->set_panorama_connector_operations: %s\n" % e)
|
||||
```
|
||||
|
||||
|
||||
|
||||
### Parameters
|
||||
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**id** | **str**| The connector ID. |
|
||||
**request_body** | [**List[str]**](str.md)| List of operation IDs to assign to the connector. |
|
||||
**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
|
||||
|
||||
[**Assignments**](Assignments.md)
|
||||
|
||||
### Authorization
|
||||
|
||||
[BearerAuth](../README.md#BearerAuth)
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: application/json
|
||||
- **Accept**: application/hal+json, application/json, application/problem+json
|
||||
|
||||
### HTTP response details
|
||||
|
||||
| Status code | Description | Response headers |
|
||||
|-------------|-------------|------------------|
|
||||
**200** | Operations assigned successfully. | - |
|
||||
**400** | Bad Request | - |
|
||||
**401** | Unauthorized | - |
|
||||
**403** | Insufficient permissions to query endpoint | - |
|
||||
**404** | Not found | - |
|
||||
**500** | Internal server error | - |
|
||||
|
||||
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
|
||||
|
||||
# **update_panorama_connector**
|
||||
> PanoramaConnector update_panorama_connector(id, panorama_connector, aid=aid)
|
||||
|
||||
Update Panorama connector
|
||||
|
||||
Replaces the Panorama connector specified by ID. The request must include the complete connector configuration, including authentication credentials; existing credentials are not retained when authentication is omitted.
|
||||
|
||||
### Example
|
||||
|
||||
* Bearer Authentication (BearerAuth):
|
||||
|
||||
```python
|
||||
import thousandeyes_sdk.connectors
|
||||
from thousandeyes_sdk.connectors.models.panorama_connector import PanoramaConnector
|
||||
from thousandeyes_sdk.connectors.rest import ApiException
|
||||
from pprint import pprint
|
||||
|
||||
# Defining the host is optional and defaults to https://api.thousandeyes.com/v7
|
||||
# See configuration.py for a list of all supported configuration parameters.
|
||||
configuration = thousandeyes_sdk.core.Configuration(
|
||||
host = "https://api.thousandeyes.com/v7"
|
||||
)
|
||||
|
||||
# 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 = thousandeyes_sdk.core.Configuration(
|
||||
access_token = os.environ["BEARER_TOKEN"]
|
||||
)
|
||||
|
||||
# Enter a context with an instance of the API client
|
||||
with thousandeyes_sdk.core.ApiClient(configuration) as api_client:
|
||||
# Create an instance of the API class
|
||||
api_instance = thousandeyes_sdk.connectors.PanoramaConnectorsApi(api_client)
|
||||
id = 'cb1b8033-ea2d-4e9b-a920-fe87850693cf' # str | The connector ID.
|
||||
panorama_connector = {"type":"panorama","name":"Branch Panorama","target":"https://panorama.example.com","authentication":{"username":"panorama-user","password":"<panorama-password>","keyTtl":40,"type":"pan-key-gen"}} # PanoramaConnector |
|
||||
aid = '1234' # 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 Panorama connector
|
||||
api_response = api_instance.update_panorama_connector(id, panorama_connector, aid=aid)
|
||||
print("The response of PanoramaConnectorsApi->update_panorama_connector:\n")
|
||||
pprint(api_response)
|
||||
except Exception as e:
|
||||
print("Exception when calling PanoramaConnectorsApi->update_panorama_connector: %s\n" % e)
|
||||
```
|
||||
|
||||
|
||||
|
||||
### Parameters
|
||||
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**id** | **str**| The connector ID. |
|
||||
**panorama_connector** | [**PanoramaConnector**](PanoramaConnector.md)| |
|
||||
**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
|
||||
|
||||
[**PanoramaConnector**](PanoramaConnector.md)
|
||||
|
||||
### Authorization
|
||||
|
||||
[BearerAuth](../README.md#BearerAuth)
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: application/json
|
||||
- **Accept**: application/hal+json, application/json, application/problem+json
|
||||
|
||||
### HTTP response details
|
||||
|
||||
| Status code | Description | Response headers |
|
||||
|-------------|-------------|------------------|
|
||||
**200** | The updated Panorama connector. | - |
|
||||
**400** | Bad Request | - |
|
||||
**401** | Unauthorized | - |
|
||||
**403** | Insufficient permissions to query endpoint | - |
|
||||
**404** | Not found | - |
|
||||
**500** | Internal server error | - |
|
||||
|
||||
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
|
||||
|
||||
@ -0,0 +1,33 @@
|
||||
# PanoramaKeyGenAuthentication
|
||||
|
||||
Authentication using credentials to generate a Panorama API key.
|
||||
|
||||
## Properties
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
**username** | **str** | Username used to generate the Panorama API key. |
|
||||
**password** | **str** | Password used to generate the Panorama API key. |
|
||||
**key_ttl** | **int** | Time to live for the generated Panorama API key, in minutes. |
|
||||
**type** | **str** | |
|
||||
|
||||
## Example
|
||||
|
||||
```python
|
||||
from thousandeyes_sdk.connectors.models.panorama_key_gen_authentication import PanoramaKeyGenAuthentication
|
||||
|
||||
# TODO update the JSON string below
|
||||
json = "{}"
|
||||
# create an instance of PanoramaKeyGenAuthentication from a JSON string
|
||||
panorama_key_gen_authentication_instance = PanoramaKeyGenAuthentication.from_json(json)
|
||||
# print the JSON string representation of the object
|
||||
print(PanoramaKeyGenAuthentication.to_json())
|
||||
|
||||
# convert the object into a dict
|
||||
panorama_key_gen_authentication_dict = panorama_key_gen_authentication_instance.to_dict()
|
||||
# create an instance of PanoramaKeyGenAuthentication from a dict
|
||||
panorama_key_gen_authentication_from_dict = PanoramaKeyGenAuthentication.from_dict(panorama_key_gen_authentication_dict)
|
||||
```
|
||||
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
|
||||
|
||||
|
||||
@ -0,0 +1,31 @@
|
||||
# PanoramaTokenAuthentication
|
||||
|
||||
Authentication using an existing Panorama API key.
|
||||
|
||||
## Properties
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
**token** | **str** | Panorama API key used for authentication. |
|
||||
**type** | **str** | Authentication type. |
|
||||
|
||||
## Example
|
||||
|
||||
```python
|
||||
from thousandeyes_sdk.connectors.models.panorama_token_authentication import PanoramaTokenAuthentication
|
||||
|
||||
# TODO update the JSON string below
|
||||
json = "{}"
|
||||
# create an instance of PanoramaTokenAuthentication from a JSON string
|
||||
panorama_token_authentication_instance = PanoramaTokenAuthentication.from_json(json)
|
||||
# print the JSON string representation of the object
|
||||
print(PanoramaTokenAuthentication.to_json())
|
||||
|
||||
# convert the object into a dict
|
||||
panorama_token_authentication_dict = panorama_token_authentication_instance.to_dict()
|
||||
# create an instance of PanoramaTokenAuthentication from a dict
|
||||
panorama_token_authentication_from_dict = PanoramaTokenAuthentication.from_dict(panorama_token_authentication_dict)
|
||||
```
|
||||
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
|
||||
|
||||
|
||||
@ -18,6 +18,7 @@ from thousandeyes_sdk.connectors.api.credential_vault_operations_api import Cred
|
||||
from thousandeyes_sdk.connectors.api.cyber_ark_conjur_connectors_api import CyberArkConjurConnectorsApi
|
||||
from thousandeyes_sdk.connectors.api.generic_connectors_api import GenericConnectorsApi
|
||||
from thousandeyes_sdk.connectors.api.operation_connectors_api import OperationConnectorsApi
|
||||
from thousandeyes_sdk.connectors.api.panorama_connectors_api import PanoramaConnectorsApi
|
||||
from thousandeyes_sdk.connectors.api.webhook_operations_api import WebhookOperationsApi
|
||||
|
||||
|
||||
@ -45,6 +46,11 @@ from thousandeyes_sdk.connectors.models.operation_category import OperationCateg
|
||||
from thousandeyes_sdk.connectors.models.operation_status import OperationStatus
|
||||
from thousandeyes_sdk.connectors.models.operation_type import OperationType
|
||||
from thousandeyes_sdk.connectors.models.other_token_authentication import OtherTokenAuthentication
|
||||
from thousandeyes_sdk.connectors.models.panorama_connector import PanoramaConnector
|
||||
from thousandeyes_sdk.connectors.models.panorama_connector_auth import PanoramaConnectorAuth
|
||||
from thousandeyes_sdk.connectors.models.panorama_connectors import PanoramaConnectors
|
||||
from thousandeyes_sdk.connectors.models.panorama_key_gen_authentication import PanoramaKeyGenAuthentication
|
||||
from thousandeyes_sdk.connectors.models.panorama_token_authentication import PanoramaTokenAuthentication
|
||||
from thousandeyes_sdk.connectors.models.self_links import SelfLinks
|
||||
from thousandeyes_sdk.connectors.models.unauthorized_error import UnauthorizedError
|
||||
from thousandeyes_sdk.connectors.models.validation_error import ValidationError
|
||||
|
||||
@ -5,5 +5,6 @@ from thousandeyes_sdk.connectors.api.credential_vault_operations_api import Cred
|
||||
from thousandeyes_sdk.connectors.api.cyber_ark_conjur_connectors_api import CyberArkConjurConnectorsApi
|
||||
from thousandeyes_sdk.connectors.api.generic_connectors_api import GenericConnectorsApi
|
||||
from thousandeyes_sdk.connectors.api.operation_connectors_api import OperationConnectorsApi
|
||||
from thousandeyes_sdk.connectors.api.panorama_connectors_api import PanoramaConnectorsApi
|
||||
from thousandeyes_sdk.connectors.api.webhook_operations_api import WebhookOperationsApi
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -36,6 +36,11 @@ from thousandeyes_sdk.connectors.models.operation_category import OperationCateg
|
||||
from thousandeyes_sdk.connectors.models.operation_status import OperationStatus
|
||||
from thousandeyes_sdk.connectors.models.operation_type import OperationType
|
||||
from thousandeyes_sdk.connectors.models.other_token_authentication import OtherTokenAuthentication
|
||||
from thousandeyes_sdk.connectors.models.panorama_connector import PanoramaConnector
|
||||
from thousandeyes_sdk.connectors.models.panorama_connector_auth import PanoramaConnectorAuth
|
||||
from thousandeyes_sdk.connectors.models.panorama_connectors import PanoramaConnectors
|
||||
from thousandeyes_sdk.connectors.models.panorama_key_gen_authentication import PanoramaKeyGenAuthentication
|
||||
from thousandeyes_sdk.connectors.models.panorama_token_authentication import PanoramaTokenAuthentication
|
||||
from thousandeyes_sdk.connectors.models.self_links import SelfLinks
|
||||
from thousandeyes_sdk.connectors.models.unauthorized_error import UnauthorizedError
|
||||
from thousandeyes_sdk.connectors.models.validation_error import ValidationError
|
||||
|
||||
@ -0,0 +1,118 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
Integrations API
|
||||
|
||||
**Note:** The Webhook Operations APIs are not available for ThousandEyes for Government instance. Manage connectors and operations.
|
||||
|
||||
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
||||
|
||||
Do not edit the class manually.
|
||||
""" # noqa: E501
|
||||
|
||||
|
||||
from __future__ import annotations
|
||||
import pprint
|
||||
import re # noqa: F401
|
||||
import json
|
||||
|
||||
from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr, field_validator
|
||||
from typing import Any, ClassVar, Dict, List, Optional
|
||||
from thousandeyes_sdk.connectors.models.panorama_connector_auth import PanoramaConnectorAuth
|
||||
from thousandeyes_sdk.connectors.models.self_links import SelfLinks
|
||||
from typing import Optional, Set
|
||||
from typing_extensions import Self
|
||||
|
||||
class PanoramaConnector(BaseModel):
|
||||
"""
|
||||
Palo Alto Networks Panorama connector configuration.
|
||||
""" # noqa: E501
|
||||
id: Optional[StrictStr] = Field(default=None, description="Unique ID of the Panorama connector.")
|
||||
type: StrictStr = Field(description="Connector type.")
|
||||
name: StrictStr = Field(description="Name of the Panorama connector.")
|
||||
target: StrictStr = Field(description="URL of the Panorama instance.")
|
||||
last_modified_date: Optional[StrictInt] = Field(default=None, description="Time when the connector was last modified, in milliseconds since the Unix epoch.", alias="lastModifiedDate")
|
||||
authentication: PanoramaConnectorAuth
|
||||
links: Optional[SelfLinks] = Field(default=None, alias="_links")
|
||||
__properties: ClassVar[List[str]] = ["id", "type", "name", "target", "lastModifiedDate", "authentication", "_links"]
|
||||
|
||||
@field_validator('type')
|
||||
def type_validate_enum(cls, value):
|
||||
"""Validates the enum"""
|
||||
if value not in set(['panorama', 'unknown']):
|
||||
raise ValueError("must be one of enum values ('panorama', 'unknown')")
|
||||
return value
|
||||
|
||||
model_config = ConfigDict(
|
||||
populate_by_name=True,
|
||||
validate_assignment=True,
|
||||
protected_namespaces=(),
|
||||
extra="allow",
|
||||
)
|
||||
|
||||
|
||||
def to_str(self) -> str:
|
||||
"""Returns the string representation of the model using alias"""
|
||||
return pprint.pformat(self.model_dump(by_alias=True))
|
||||
|
||||
def to_json(self) -> str:
|
||||
"""Returns the JSON representation of the model using alias"""
|
||||
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
||||
return self.model_dump_json(by_alias=True, exclude_unset=True, exclude_none=True)
|
||||
|
||||
@classmethod
|
||||
def from_json(cls, json_str: str) -> Optional[Self]:
|
||||
"""Create an instance of PanoramaConnector from a JSON string"""
|
||||
return cls.from_dict(json.loads(json_str))
|
||||
|
||||
def to_dict(self) -> Dict[str, Any]:
|
||||
"""Return the dictionary representation of the model using alias.
|
||||
|
||||
This has the following differences from calling pydantic's
|
||||
`self.model_dump(by_alias=True)`:
|
||||
|
||||
* `None` is only added to the output dict for nullable fields that
|
||||
were set at model initialization. Other fields with value `None`
|
||||
are ignored.
|
||||
* OpenAPI `readOnly` fields are excluded.
|
||||
* OpenAPI `readOnly` fields are excluded.
|
||||
"""
|
||||
excluded_fields: Set[str] = set([
|
||||
"id",
|
||||
"last_modified_date",
|
||||
])
|
||||
|
||||
_dict = self.model_dump(
|
||||
by_alias=True,
|
||||
exclude=excluded_fields,
|
||||
exclude_none=True,
|
||||
)
|
||||
# override the default output from pydantic by calling `to_dict()` of authentication
|
||||
if self.authentication:
|
||||
_dict['authentication'] = self.authentication.to_dict()
|
||||
# override the default output from pydantic by calling `to_dict()` of links
|
||||
if self.links:
|
||||
_dict['_links'] = self.links.to_dict()
|
||||
return _dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
||||
"""Create an instance of PanoramaConnector from a dict"""
|
||||
if obj is None:
|
||||
return None
|
||||
|
||||
if not isinstance(obj, dict):
|
||||
return cls.model_validate(obj)
|
||||
|
||||
_obj = cls.model_validate({
|
||||
"id": obj.get("id"),
|
||||
"type": obj.get("type"),
|
||||
"name": obj.get("name"),
|
||||
"target": obj.get("target"),
|
||||
"lastModifiedDate": obj.get("lastModifiedDate"),
|
||||
"authentication": PanoramaConnectorAuth.from_dict(obj["authentication"]) if obj.get("authentication") is not None else None,
|
||||
"_links": SelfLinks.from_dict(obj["_links"]) if obj.get("_links") is not None else None
|
||||
})
|
||||
return _obj
|
||||
|
||||
|
||||
@ -0,0 +1,143 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
Integrations API
|
||||
|
||||
**Note:** The Webhook Operations APIs are not available for ThousandEyes for Government instance. Manage connectors and operations.
|
||||
|
||||
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
||||
|
||||
Do not edit the class manually.
|
||||
""" # noqa: E501
|
||||
|
||||
|
||||
from __future__ import annotations
|
||||
import json
|
||||
import pprint
|
||||
from pydantic import BaseModel, ConfigDict, Field, StrictStr, ValidationError, field_validator
|
||||
from typing import Any, List, Optional
|
||||
from thousandeyes_sdk.connectors.models.panorama_key_gen_authentication import PanoramaKeyGenAuthentication
|
||||
from thousandeyes_sdk.connectors.models.panorama_token_authentication import PanoramaTokenAuthentication
|
||||
from pydantic import StrictStr, Field, model_serializer
|
||||
from typing import Union, List, Set, Optional, Dict
|
||||
from typing_extensions import Literal, Self
|
||||
|
||||
PANORAMACONNECTORAUTH_ONE_OF_SCHEMAS = ["PanoramaKeyGenAuthentication", "PanoramaTokenAuthentication"]
|
||||
|
||||
class PanoramaConnectorAuth(BaseModel):
|
||||
"""
|
||||
Authentication configuration for the Panorama connector.
|
||||
"""
|
||||
# data type: PanoramaTokenAuthentication
|
||||
oneof_schema_1_validator: Optional[PanoramaTokenAuthentication] = None
|
||||
# data type: PanoramaKeyGenAuthentication
|
||||
oneof_schema_2_validator: Optional[PanoramaKeyGenAuthentication] = None
|
||||
actual_instance: Optional[Union[PanoramaKeyGenAuthentication, PanoramaTokenAuthentication]] = None
|
||||
one_of_schemas: Set[str] = { "PanoramaKeyGenAuthentication", "PanoramaTokenAuthentication" }
|
||||
|
||||
model_config = ConfigDict(
|
||||
validate_assignment=True,
|
||||
protected_namespaces=(),
|
||||
)
|
||||
|
||||
|
||||
discriminator_value_class_map: Dict[str, str] = {
|
||||
}
|
||||
|
||||
def __init__(self, *args, **kwargs) -> None:
|
||||
if args:
|
||||
if len(args) > 1:
|
||||
raise ValueError("If a position argument is used, only 1 is allowed to set `actual_instance`")
|
||||
if kwargs:
|
||||
raise ValueError("If a position argument is used, keyword arguments cannot be used.")
|
||||
super().__init__(actual_instance=args[0])
|
||||
else:
|
||||
super().__init__(**kwargs)
|
||||
|
||||
@field_validator('actual_instance')
|
||||
def actual_instance_must_validate_oneof(cls, v):
|
||||
instance = PanoramaConnectorAuth.model_construct()
|
||||
error_messages = []
|
||||
match = 0
|
||||
# validate data type: PanoramaTokenAuthentication
|
||||
if not isinstance(v, PanoramaTokenAuthentication):
|
||||
error_messages.append(f"Error! Input type `{type(v)}` is not `PanoramaTokenAuthentication`")
|
||||
else:
|
||||
match += 1
|
||||
# validate data type: PanoramaKeyGenAuthentication
|
||||
if not isinstance(v, PanoramaKeyGenAuthentication):
|
||||
error_messages.append(f"Error! Input type `{type(v)}` is not `PanoramaKeyGenAuthentication`")
|
||||
else:
|
||||
match += 1
|
||||
if match > 1:
|
||||
# more than 1 match
|
||||
raise ValueError("Multiple matches found when setting `actual_instance` in PanoramaConnectorAuth with oneOf schemas: PanoramaKeyGenAuthentication, PanoramaTokenAuthentication. Details: " + ", ".join(error_messages))
|
||||
elif match == 0:
|
||||
# no match
|
||||
raise ValueError("No match found when setting `actual_instance` in PanoramaConnectorAuth with oneOf schemas: PanoramaKeyGenAuthentication, PanoramaTokenAuthentication. Details: " + ", ".join(error_messages))
|
||||
else:
|
||||
return v
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls, obj: Union[str, Dict[str, Any]]) -> Self:
|
||||
return cls.from_json(json.dumps(obj))
|
||||
|
||||
@classmethod
|
||||
def from_json(cls, json_str: str) -> Self:
|
||||
"""Returns the object represented by the json string"""
|
||||
instance = cls.model_construct()
|
||||
error_messages = []
|
||||
match = 0
|
||||
|
||||
# deserialize data into PanoramaTokenAuthentication
|
||||
try:
|
||||
instance.actual_instance = PanoramaTokenAuthentication.from_json(json_str)
|
||||
match += 1
|
||||
except (ValidationError, ValueError) as e:
|
||||
error_messages.append(str(e))
|
||||
# deserialize data into PanoramaKeyGenAuthentication
|
||||
try:
|
||||
instance.actual_instance = PanoramaKeyGenAuthentication.from_json(json_str)
|
||||
match += 1
|
||||
except (ValidationError, ValueError) as e:
|
||||
error_messages.append(str(e))
|
||||
|
||||
if match > 1:
|
||||
# more than 1 match
|
||||
raise ValueError("Multiple matches found when deserializing the JSON string into PanoramaConnectorAuth with oneOf schemas: PanoramaKeyGenAuthentication, PanoramaTokenAuthentication. Details: " + ", ".join(error_messages))
|
||||
elif match == 0:
|
||||
# no match
|
||||
raise ValueError("No match found when deserializing the JSON string into PanoramaConnectorAuth with oneOf schemas: PanoramaKeyGenAuthentication, PanoramaTokenAuthentication. Details: " + ", ".join(error_messages))
|
||||
else:
|
||||
return instance
|
||||
|
||||
@model_serializer(when_used="json")
|
||||
def serialize_model(self):
|
||||
return json.loads(self.to_json())
|
||||
|
||||
def to_json(self) -> str:
|
||||
"""Returns the JSON representation of the actual instance"""
|
||||
if self.actual_instance is None:
|
||||
return "null"
|
||||
|
||||
if hasattr(self.actual_instance, "to_json") and callable(self.actual_instance.to_json):
|
||||
return self.actual_instance.to_json()
|
||||
else:
|
||||
return json.dumps(self.actual_instance)
|
||||
|
||||
def to_dict(self) -> Optional[Union[Dict[str, Any], PanoramaKeyGenAuthentication, PanoramaTokenAuthentication]]:
|
||||
"""Returns the dict representation of the actual instance"""
|
||||
if self.actual_instance is None:
|
||||
return None
|
||||
|
||||
if hasattr(self.actual_instance, "to_dict") and callable(self.actual_instance.to_dict):
|
||||
return self.actual_instance.to_dict()
|
||||
else:
|
||||
# primitive type
|
||||
return self.actual_instance
|
||||
|
||||
def to_str(self) -> str:
|
||||
"""Returns the string representation of the actual instance"""
|
||||
return pprint.pformat(self.model_dump())
|
||||
|
||||
|
||||
@ -0,0 +1,101 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
Integrations API
|
||||
|
||||
**Note:** The Webhook Operations APIs are not available for ThousandEyes for Government instance. Manage connectors and operations.
|
||||
|
||||
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
||||
|
||||
Do not edit the class manually.
|
||||
""" # noqa: E501
|
||||
|
||||
|
||||
from __future__ import annotations
|
||||
import pprint
|
||||
import re # noqa: F401
|
||||
import json
|
||||
|
||||
from pydantic import BaseModel, ConfigDict, Field
|
||||
from typing import Any, ClassVar, Dict, List, Optional
|
||||
from thousandeyes_sdk.connectors.models.panorama_connector import PanoramaConnector
|
||||
from thousandeyes_sdk.connectors.models.self_links import SelfLinks
|
||||
from typing import Optional, Set
|
||||
from typing_extensions import Self
|
||||
|
||||
class PanoramaConnectors(BaseModel):
|
||||
"""
|
||||
Collection of Panorama connectors.
|
||||
""" # noqa: E501
|
||||
items: Optional[List[PanoramaConnector]] = None
|
||||
links: Optional[SelfLinks] = Field(default=None, alias="_links")
|
||||
__properties: ClassVar[List[str]] = ["items", "_links"]
|
||||
|
||||
model_config = ConfigDict(
|
||||
populate_by_name=True,
|
||||
validate_assignment=True,
|
||||
protected_namespaces=(),
|
||||
extra="allow",
|
||||
)
|
||||
|
||||
|
||||
def to_str(self) -> str:
|
||||
"""Returns the string representation of the model using alias"""
|
||||
return pprint.pformat(self.model_dump(by_alias=True))
|
||||
|
||||
def to_json(self) -> str:
|
||||
"""Returns the JSON representation of the model using alias"""
|
||||
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
||||
return self.model_dump_json(by_alias=True, exclude_unset=True, exclude_none=True)
|
||||
|
||||
@classmethod
|
||||
def from_json(cls, json_str: str) -> Optional[Self]:
|
||||
"""Create an instance of PanoramaConnectors from a JSON string"""
|
||||
return cls.from_dict(json.loads(json_str))
|
||||
|
||||
def to_dict(self) -> Dict[str, Any]:
|
||||
"""Return the dictionary representation of the model using alias.
|
||||
|
||||
This has the following differences from calling pydantic's
|
||||
`self.model_dump(by_alias=True)`:
|
||||
|
||||
* `None` is only added to the output dict for nullable fields that
|
||||
were set at model initialization. Other fields with value `None`
|
||||
are ignored.
|
||||
"""
|
||||
excluded_fields: Set[str] = set([
|
||||
])
|
||||
|
||||
_dict = self.model_dump(
|
||||
by_alias=True,
|
||||
exclude=excluded_fields,
|
||||
exclude_none=True,
|
||||
)
|
||||
# override the default output from pydantic by calling `to_dict()` of each item in items (list)
|
||||
_items = []
|
||||
if self.items:
|
||||
for _item in self.items:
|
||||
if _item:
|
||||
_items.append(_item.to_dict())
|
||||
_dict['items'] = _items
|
||||
# override the default output from pydantic by calling `to_dict()` of links
|
||||
if self.links:
|
||||
_dict['_links'] = self.links.to_dict()
|
||||
return _dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
||||
"""Create an instance of PanoramaConnectors from a dict"""
|
||||
if obj is None:
|
||||
return None
|
||||
|
||||
if not isinstance(obj, dict):
|
||||
return cls.model_validate(obj)
|
||||
|
||||
_obj = cls.model_validate({
|
||||
"items": [PanoramaConnector.from_dict(_item) for _item in obj["items"]] if obj.get("items") is not None else None,
|
||||
"_links": SelfLinks.from_dict(obj["_links"]) if obj.get("_links") is not None else None
|
||||
})
|
||||
return _obj
|
||||
|
||||
|
||||
@ -0,0 +1,101 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
Integrations API
|
||||
|
||||
**Note:** The Webhook Operations APIs are not available for ThousandEyes for Government instance. Manage connectors and operations.
|
||||
|
||||
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
||||
|
||||
Do not edit the class manually.
|
||||
""" # noqa: E501
|
||||
|
||||
|
||||
from __future__ import annotations
|
||||
import pprint
|
||||
import re # noqa: F401
|
||||
import json
|
||||
|
||||
from pydantic import BaseModel, ConfigDict, Field, SecretStr, StrictStr, field_validator
|
||||
from typing import Any, ClassVar, Dict, List
|
||||
from typing_extensions import Annotated
|
||||
from typing import Optional, Set
|
||||
from typing_extensions import Self
|
||||
|
||||
class PanoramaKeyGenAuthentication(BaseModel):
|
||||
"""
|
||||
Authentication using credentials to generate a Panorama API key.
|
||||
""" # noqa: E501
|
||||
username: StrictStr = Field(description="Username used to generate the Panorama API key.")
|
||||
password: SecretStr = Field(description="Password used to generate the Panorama API key.")
|
||||
key_ttl: Annotated[int, Field(strict=True, ge=30)] = Field(description="Time to live for the generated Panorama API key, in minutes.", alias="keyTtl")
|
||||
type: StrictStr
|
||||
__properties: ClassVar[List[str]] = ["username", "password", "keyTtl", "type"]
|
||||
|
||||
@field_validator('type')
|
||||
def type_validate_enum(cls, value):
|
||||
"""Validates the enum"""
|
||||
if value not in set(['pan-key-gen', 'unknown']):
|
||||
raise ValueError("must be one of enum values ('pan-key-gen', 'unknown')")
|
||||
return value
|
||||
|
||||
model_config = ConfigDict(
|
||||
populate_by_name=True,
|
||||
validate_assignment=True,
|
||||
protected_namespaces=(),
|
||||
extra="allow",
|
||||
)
|
||||
|
||||
|
||||
def to_str(self) -> str:
|
||||
"""Returns the string representation of the model using alias"""
|
||||
return pprint.pformat(self.model_dump(by_alias=True))
|
||||
|
||||
def to_json(self) -> str:
|
||||
"""Returns the JSON representation of the model using alias"""
|
||||
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
||||
return self.model_dump_json(by_alias=True, exclude_unset=True, exclude_none=True)
|
||||
|
||||
@classmethod
|
||||
def from_json(cls, json_str: str) -> Optional[Self]:
|
||||
"""Create an instance of PanoramaKeyGenAuthentication from a JSON string"""
|
||||
return cls.from_dict(json.loads(json_str))
|
||||
|
||||
def to_dict(self) -> Dict[str, Any]:
|
||||
"""Return the dictionary representation of the model using alias.
|
||||
|
||||
This has the following differences from calling pydantic's
|
||||
`self.model_dump(by_alias=True)`:
|
||||
|
||||
* `None` is only added to the output dict for nullable fields that
|
||||
were set at model initialization. Other fields with value `None`
|
||||
are ignored.
|
||||
"""
|
||||
excluded_fields: Set[str] = set([
|
||||
])
|
||||
|
||||
_dict = self.model_dump(
|
||||
by_alias=True,
|
||||
exclude=excluded_fields,
|
||||
exclude_none=True,
|
||||
)
|
||||
return _dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
||||
"""Create an instance of PanoramaKeyGenAuthentication from a dict"""
|
||||
if obj is None:
|
||||
return None
|
||||
|
||||
if not isinstance(obj, dict):
|
||||
return cls.model_validate(obj)
|
||||
|
||||
_obj = cls.model_validate({
|
||||
"username": obj.get("username"),
|
||||
"password": obj.get("password"),
|
||||
"keyTtl": obj.get("keyTtl"),
|
||||
"type": obj.get("type")
|
||||
})
|
||||
return _obj
|
||||
|
||||
|
||||
@ -0,0 +1,96 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
Integrations API
|
||||
|
||||
**Note:** The Webhook Operations APIs are not available for ThousandEyes for Government instance. Manage connectors and operations.
|
||||
|
||||
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
||||
|
||||
Do not edit the class manually.
|
||||
""" # noqa: E501
|
||||
|
||||
|
||||
from __future__ import annotations
|
||||
import pprint
|
||||
import re # noqa: F401
|
||||
import json
|
||||
|
||||
from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator
|
||||
from typing import Any, ClassVar, Dict, List
|
||||
from typing import Optional, Set
|
||||
from typing_extensions import Self
|
||||
|
||||
class PanoramaTokenAuthentication(BaseModel):
|
||||
"""
|
||||
Authentication using an existing Panorama API key.
|
||||
""" # noqa: E501
|
||||
token: StrictStr = Field(description="Panorama API key used for authentication.")
|
||||
type: StrictStr = Field(description="Authentication type.")
|
||||
__properties: ClassVar[List[str]] = ["token", "type"]
|
||||
|
||||
@field_validator('type')
|
||||
def type_validate_enum(cls, value):
|
||||
"""Validates the enum"""
|
||||
if value not in set(['other-token', 'unknown']):
|
||||
raise ValueError("must be one of enum values ('other-token', 'unknown')")
|
||||
return value
|
||||
|
||||
model_config = ConfigDict(
|
||||
populate_by_name=True,
|
||||
validate_assignment=True,
|
||||
protected_namespaces=(),
|
||||
extra="allow",
|
||||
)
|
||||
|
||||
|
||||
def to_str(self) -> str:
|
||||
"""Returns the string representation of the model using alias"""
|
||||
return pprint.pformat(self.model_dump(by_alias=True))
|
||||
|
||||
def to_json(self) -> str:
|
||||
"""Returns the JSON representation of the model using alias"""
|
||||
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
||||
return self.model_dump_json(by_alias=True, exclude_unset=True, exclude_none=True)
|
||||
|
||||
@classmethod
|
||||
def from_json(cls, json_str: str) -> Optional[Self]:
|
||||
"""Create an instance of PanoramaTokenAuthentication from a JSON string"""
|
||||
return cls.from_dict(json.loads(json_str))
|
||||
|
||||
def to_dict(self) -> Dict[str, Any]:
|
||||
"""Return the dictionary representation of the model using alias.
|
||||
|
||||
This has the following differences from calling pydantic's
|
||||
`self.model_dump(by_alias=True)`:
|
||||
|
||||
* `None` is only added to the output dict for nullable fields that
|
||||
were set at model initialization. Other fields with value `None`
|
||||
are ignored.
|
||||
"""
|
||||
excluded_fields: Set[str] = set([
|
||||
])
|
||||
|
||||
_dict = self.model_dump(
|
||||
by_alias=True,
|
||||
exclude=excluded_fields,
|
||||
exclude_none=True,
|
||||
)
|
||||
return _dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
||||
"""Create an instance of PanoramaTokenAuthentication from a dict"""
|
||||
if obj is None:
|
||||
return None
|
||||
|
||||
if not isinstance(obj, dict):
|
||||
return cls.model_validate(obj)
|
||||
|
||||
_obj = cls.model_validate({
|
||||
"token": obj.get("token"),
|
||||
"type": obj.get("type")
|
||||
})
|
||||
return _obj
|
||||
|
||||
|
||||
7
thousandeyes-sdk-connectors/test/conftest.py
Normal file
7
thousandeyes-sdk-connectors/test/conftest.py
Normal file
@ -0,0 +1,7 @@
|
||||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
_repo_root = Path(__file__).resolve().parents[2]
|
||||
_core_test_support = _repo_root / "thousandeyes-sdk-core" / "test"
|
||||
if str(_core_test_support) not in sys.path:
|
||||
sys.path.insert(0, str(_core_test_support))
|
||||
37
thousandeyes-sdk-connectors/test/integration_test_utils.py
Normal file
37
thousandeyes-sdk-connectors/test/integration_test_utils.py
Normal file
@ -0,0 +1,37 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
Integrations API
|
||||
|
||||
**Note:** The Webhook Operations APIs are not available for ThousandEyes for Government instance. Manage connectors and operations.
|
||||
|
||||
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
||||
|
||||
Do not edit the class manually.
|
||||
""" # noqa: E501
|
||||
|
||||
|
||||
import unittest
|
||||
|
||||
from thousandeyes_sdk.core.api_client import ApiClient
|
||||
from thousandeyes_sdk.core.configuration import Configuration
|
||||
from sdk_test_support.mock_server import ERROR_STATUS_HEADER, OPERATION_ID_HEADER, MockApiServer
|
||||
|
||||
from .mock_manifest import OPERATION_MANIFEST
|
||||
|
||||
|
||||
class IntegrationTestBase(unittest.TestCase):
|
||||
def setUp(self) -> None:
|
||||
self.server = MockApiServer(OPERATION_MANIFEST)
|
||||
self.server.start()
|
||||
configuration = Configuration(host=self.server.base_url, access_token="test-token")
|
||||
self.api_client = ApiClient(configuration=configuration)
|
||||
|
||||
def tearDown(self) -> None:
|
||||
self.server.stop()
|
||||
|
||||
def te_headers(self, operation_id: str, error_status=None):
|
||||
headers = {OPERATION_ID_HEADER: operation_id}
|
||||
if error_status is not None:
|
||||
headers[ERROR_STATUS_HEADER] = error_status
|
||||
return headers
|
||||
4206
thousandeyes-sdk-connectors/test/mock_manifest.py
Normal file
4206
thousandeyes-sdk-connectors/test/mock_manifest.py
Normal file
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -230,7 +230,7 @@ class TestCyberArkConjurConnectorsApi(unittest.TestCase):
|
||||
def test_set_conjur_connector_operations_models_validation(self) -> None:
|
||||
"""Test case for set_conjur_connector_operations request and response models"""
|
||||
request_body_json = """
|
||||
["ca39314d-eb4f-496f-9435-b5d20b1bfbff","a32cfbab-32f6-41d8-9027-7127cba965dd"]
|
||||
[ "ca39314d-eb4f-496f-9435-b5d20b1bfbff", "a32cfbab-32f6-41d8-9027-7127cba965dd" ]
|
||||
"""
|
||||
|
||||
request_loaded_json = json.loads(request_body_json)
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -260,7 +260,7 @@ class TestGenericConnectorsApi(unittest.TestCase):
|
||||
def test_set_generic_connector_operations_models_validation(self) -> None:
|
||||
"""Test case for set_generic_connector_operations request and response models"""
|
||||
request_body_json = """
|
||||
["ca39314d-eb4f-496f-9435-b5d20b1bfbff","a32cfbab-32f6-41d8-9027-7127cba965dd"]
|
||||
[ "ca39314d-eb4f-496f-9435-b5d20b1bfbff", "a32cfbab-32f6-41d8-9027-7127cba965dd" ]
|
||||
"""
|
||||
|
||||
request_loaded_json = json.loads(request_body_json)
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -55,7 +55,7 @@ class TestOperationConnectorsApi(unittest.TestCase):
|
||||
def test_set_operation_connectors_models_validation(self) -> None:
|
||||
"""Test case for set_operation_connectors request and response models"""
|
||||
request_body_json = """
|
||||
["ca39314d-eb4f-496f-9435-b5d20b1bfbff"]
|
||||
[ "ca39314d-eb4f-496f-9435-b5d20b1bfbff" ]
|
||||
"""
|
||||
|
||||
request_loaded_json = json.loads(request_body_json)
|
||||
|
||||
@ -0,0 +1,499 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
Integrations API
|
||||
|
||||
**Note:** The Webhook Operations APIs are not available for ThousandEyes for Government instance. Manage connectors and operations.
|
||||
|
||||
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
||||
|
||||
Do not edit the class manually.
|
||||
""" # noqa: E501
|
||||
|
||||
|
||||
import json
|
||||
import unittest
|
||||
import thousandeyes_sdk.connectors.models
|
||||
|
||||
from thousandeyes_sdk.core.exceptions import ApiException
|
||||
from thousandeyes_sdk.connectors.api.operation_connectors_api import OperationConnectorsApi
|
||||
from .integration_test_utils import IntegrationTestBase
|
||||
from .test_utils import assert_constructed_model_matches_example_json
|
||||
|
||||
|
||||
class TestOperationConnectorsApiIntegration(IntegrationTestBase):
|
||||
"""OperationConnectorsApi integration test stubs"""
|
||||
|
||||
def setUp(self) -> None:
|
||||
super().setUp()
|
||||
self.api = OperationConnectorsApi(self.api_client)
|
||||
|
||||
|
||||
def test_get_operation_connectors_happy_path(self) -> None:
|
||||
"""Integration test for get_operation_connectors success path"""
|
||||
type = 'webhooks'
|
||||
id = 'cb1b8033-ea2d-4e9b-a920-fe87850693cf'
|
||||
aid = '1234'
|
||||
response_body_json = """
|
||||
{
|
||||
"_links" : {
|
||||
"self" : {
|
||||
"hreflang" : "hreflang",
|
||||
"templated" : true,
|
||||
"profile" : "profile",
|
||||
"name" : "name",
|
||||
"href" : "https://api.thousandeyes.com/v7/link/to/resource/id",
|
||||
"type" : "type",
|
||||
"deprecation" : "deprecation",
|
||||
"title" : "title"
|
||||
}
|
||||
},
|
||||
"items" : [ "ca39314d-eb4f-496f-9435-b5d20b1bfbff", "ca39314d-eb4f-496f-9435-b5d20b1bfbff" ]
|
||||
}
|
||||
"""
|
||||
expected_response = json.loads(response_body_json)
|
||||
response = self.api.get_operation_connectors(
|
||||
|
||||
type=type,
|
||||
|
||||
id=id,
|
||||
|
||||
aid=aid,
|
||||
|
||||
_headers=self.te_headers("get_operation_connectors"),
|
||||
)
|
||||
assert_constructed_model_matches_example_json(response, expected_response)
|
||||
|
||||
|
||||
def test_get_operation_connectors_error_400(self) -> None:
|
||||
"""Integration test for get_operation_connectors error path (HTTP 400)"""
|
||||
type = 'webhooks'
|
||||
id = 'cb1b8033-ea2d-4e9b-a920-fe87850693cf'
|
||||
aid = '1234'
|
||||
error_body_json = """
|
||||
{
|
||||
"instance" : "instance",
|
||||
"detail" : "detail",
|
||||
"type" : "type",
|
||||
"title" : "title",
|
||||
"errors" : [ {
|
||||
"code" : "code",
|
||||
"field" : "field",
|
||||
"message" : "message"
|
||||
}, {
|
||||
"code" : "code",
|
||||
"field" : "field",
|
||||
"message" : "message"
|
||||
} ],
|
||||
"status" : 0
|
||||
}
|
||||
"""
|
||||
expected_error = json.loads(error_body_json)
|
||||
with self.assertRaises(
|
||||
ApiException.exception_class_for_http_status(400)
|
||||
) as context:
|
||||
self.api.get_operation_connectors(
|
||||
|
||||
type=type,
|
||||
|
||||
id=id,
|
||||
|
||||
aid=aid,
|
||||
|
||||
_headers=self.te_headers("get_operation_connectors", error_status="400"),
|
||||
)
|
||||
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
|
||||
|
||||
|
||||
def test_get_operation_connectors_error_401(self) -> None:
|
||||
"""Integration test for get_operation_connectors error path (HTTP 401)"""
|
||||
type = 'webhooks'
|
||||
id = 'cb1b8033-ea2d-4e9b-a920-fe87850693cf'
|
||||
aid = '1234'
|
||||
error_body_json = """
|
||||
{
|
||||
"error_description" : "Invalid access token",
|
||||
"error" : "invalid_token"
|
||||
}
|
||||
"""
|
||||
expected_error = json.loads(error_body_json)
|
||||
with self.assertRaises(
|
||||
ApiException.exception_class_for_http_status(401)
|
||||
) as context:
|
||||
self.api.get_operation_connectors(
|
||||
|
||||
type=type,
|
||||
|
||||
id=id,
|
||||
|
||||
aid=aid,
|
||||
|
||||
_headers=self.te_headers("get_operation_connectors", error_status="401"),
|
||||
)
|
||||
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
|
||||
|
||||
|
||||
def test_get_operation_connectors_error_403(self) -> None:
|
||||
"""Integration test for get_operation_connectors error path (HTTP 403)"""
|
||||
type = 'webhooks'
|
||||
id = 'cb1b8033-ea2d-4e9b-a920-fe87850693cf'
|
||||
aid = '1234'
|
||||
error_body_json = """
|
||||
{
|
||||
"instance" : "instance",
|
||||
"detail" : "detail",
|
||||
"type" : "type",
|
||||
"title" : "title",
|
||||
"status" : 6
|
||||
}
|
||||
"""
|
||||
expected_error = json.loads(error_body_json)
|
||||
with self.assertRaises(
|
||||
ApiException.exception_class_for_http_status(403)
|
||||
) as context:
|
||||
self.api.get_operation_connectors(
|
||||
|
||||
type=type,
|
||||
|
||||
id=id,
|
||||
|
||||
aid=aid,
|
||||
|
||||
_headers=self.te_headers("get_operation_connectors", error_status="403"),
|
||||
)
|
||||
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
|
||||
|
||||
|
||||
def test_get_operation_connectors_error_404(self) -> None:
|
||||
"""Integration test for get_operation_connectors error path (HTTP 404)"""
|
||||
type = 'webhooks'
|
||||
id = 'cb1b8033-ea2d-4e9b-a920-fe87850693cf'
|
||||
aid = '1234'
|
||||
error_body_json = """
|
||||
{
|
||||
"instance" : "instance",
|
||||
"detail" : "detail",
|
||||
"type" : "type",
|
||||
"title" : "title",
|
||||
"status" : 6
|
||||
}
|
||||
"""
|
||||
expected_error = json.loads(error_body_json)
|
||||
with self.assertRaises(
|
||||
ApiException.exception_class_for_http_status(404)
|
||||
) as context:
|
||||
self.api.get_operation_connectors(
|
||||
|
||||
type=type,
|
||||
|
||||
id=id,
|
||||
|
||||
aid=aid,
|
||||
|
||||
_headers=self.te_headers("get_operation_connectors", error_status="404"),
|
||||
)
|
||||
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
|
||||
|
||||
|
||||
def test_get_operation_connectors_error_500(self) -> None:
|
||||
"""Integration test for get_operation_connectors error path (HTTP 500)"""
|
||||
type = 'webhooks'
|
||||
id = 'cb1b8033-ea2d-4e9b-a920-fe87850693cf'
|
||||
aid = '1234'
|
||||
error_body_json = """
|
||||
{
|
||||
"instance" : "instance",
|
||||
"detail" : "detail",
|
||||
"type" : "type",
|
||||
"title" : "title",
|
||||
"status" : 6
|
||||
}
|
||||
"""
|
||||
expected_error = json.loads(error_body_json)
|
||||
with self.assertRaises(
|
||||
ApiException.exception_class_for_http_status(500)
|
||||
) as context:
|
||||
self.api.get_operation_connectors(
|
||||
|
||||
type=type,
|
||||
|
||||
id=id,
|
||||
|
||||
aid=aid,
|
||||
|
||||
_headers=self.te_headers("get_operation_connectors", error_status="500"),
|
||||
)
|
||||
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
|
||||
|
||||
|
||||
|
||||
|
||||
def test_set_operation_connectors_happy_path(self) -> None:
|
||||
"""Integration test for set_operation_connectors success path"""
|
||||
request_body_json = """
|
||||
|
||||
[ "ca39314d-eb4f-496f-9435-b5d20b1bfbff" ]
|
||||
|
||||
"""
|
||||
request_body = json.loads(request_body_json)
|
||||
type = 'webhooks'
|
||||
id = 'cb1b8033-ea2d-4e9b-a920-fe87850693cf'
|
||||
confirm_disabled_objects = False
|
||||
aid = '1234'
|
||||
response_body_json = """
|
||||
{
|
||||
"_links" : {
|
||||
"self" : {
|
||||
"hreflang" : "hreflang",
|
||||
"templated" : true,
|
||||
"profile" : "profile",
|
||||
"name" : "name",
|
||||
"href" : "https://api.thousandeyes.com/v7/link/to/resource/id",
|
||||
"type" : "type",
|
||||
"deprecation" : "deprecation",
|
||||
"title" : "title"
|
||||
}
|
||||
},
|
||||
"items" : [ "ca39314d-eb4f-496f-9435-b5d20b1bfbff", "ca39314d-eb4f-496f-9435-b5d20b1bfbff" ]
|
||||
}
|
||||
"""
|
||||
expected_response = json.loads(response_body_json)
|
||||
response = self.api.set_operation_connectors(
|
||||
|
||||
type=type,
|
||||
|
||||
id=id,
|
||||
|
||||
request_body=request_body,
|
||||
|
||||
confirm_disabled_objects=confirm_disabled_objects,
|
||||
|
||||
aid=aid,
|
||||
|
||||
_headers=self.te_headers("set_operation_connectors"),
|
||||
)
|
||||
assert_constructed_model_matches_example_json(response, expected_response)
|
||||
|
||||
|
||||
def test_set_operation_connectors_error_400(self) -> None:
|
||||
"""Integration test for set_operation_connectors error path (HTTP 400)"""
|
||||
request_body_json = """
|
||||
|
||||
[ "ca39314d-eb4f-496f-9435-b5d20b1bfbff" ]
|
||||
|
||||
"""
|
||||
request_body = json.loads(request_body_json)
|
||||
type = 'webhooks'
|
||||
id = 'cb1b8033-ea2d-4e9b-a920-fe87850693cf'
|
||||
confirm_disabled_objects = False
|
||||
aid = '1234'
|
||||
error_body_json = """
|
||||
{
|
||||
"instance" : "instance",
|
||||
"detail" : "detail",
|
||||
"type" : "type",
|
||||
"title" : "title",
|
||||
"errors" : [ {
|
||||
"code" : "code",
|
||||
"field" : "field",
|
||||
"message" : "message"
|
||||
}, {
|
||||
"code" : "code",
|
||||
"field" : "field",
|
||||
"message" : "message"
|
||||
} ],
|
||||
"status" : 0
|
||||
}
|
||||
"""
|
||||
expected_error = json.loads(error_body_json)
|
||||
with self.assertRaises(
|
||||
ApiException.exception_class_for_http_status(400)
|
||||
) as context:
|
||||
self.api.set_operation_connectors(
|
||||
|
||||
type=type,
|
||||
|
||||
id=id,
|
||||
|
||||
request_body=request_body,
|
||||
|
||||
confirm_disabled_objects=confirm_disabled_objects,
|
||||
|
||||
aid=aid,
|
||||
|
||||
_headers=self.te_headers("set_operation_connectors", error_status="400"),
|
||||
)
|
||||
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
|
||||
|
||||
|
||||
def test_set_operation_connectors_error_401(self) -> None:
|
||||
"""Integration test for set_operation_connectors error path (HTTP 401)"""
|
||||
request_body_json = """
|
||||
|
||||
[ "ca39314d-eb4f-496f-9435-b5d20b1bfbff" ]
|
||||
|
||||
"""
|
||||
request_body = json.loads(request_body_json)
|
||||
type = 'webhooks'
|
||||
id = 'cb1b8033-ea2d-4e9b-a920-fe87850693cf'
|
||||
confirm_disabled_objects = False
|
||||
aid = '1234'
|
||||
error_body_json = """
|
||||
{
|
||||
"error_description" : "Invalid access token",
|
||||
"error" : "invalid_token"
|
||||
}
|
||||
"""
|
||||
expected_error = json.loads(error_body_json)
|
||||
with self.assertRaises(
|
||||
ApiException.exception_class_for_http_status(401)
|
||||
) as context:
|
||||
self.api.set_operation_connectors(
|
||||
|
||||
type=type,
|
||||
|
||||
id=id,
|
||||
|
||||
request_body=request_body,
|
||||
|
||||
confirm_disabled_objects=confirm_disabled_objects,
|
||||
|
||||
aid=aid,
|
||||
|
||||
_headers=self.te_headers("set_operation_connectors", error_status="401"),
|
||||
)
|
||||
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
|
||||
|
||||
|
||||
def test_set_operation_connectors_error_403(self) -> None:
|
||||
"""Integration test for set_operation_connectors error path (HTTP 403)"""
|
||||
request_body_json = """
|
||||
|
||||
[ "ca39314d-eb4f-496f-9435-b5d20b1bfbff" ]
|
||||
|
||||
"""
|
||||
request_body = json.loads(request_body_json)
|
||||
type = 'webhooks'
|
||||
id = 'cb1b8033-ea2d-4e9b-a920-fe87850693cf'
|
||||
confirm_disabled_objects = False
|
||||
aid = '1234'
|
||||
error_body_json = """
|
||||
{
|
||||
"instance" : "instance",
|
||||
"detail" : "detail",
|
||||
"type" : "type",
|
||||
"title" : "title",
|
||||
"status" : 6
|
||||
}
|
||||
"""
|
||||
expected_error = json.loads(error_body_json)
|
||||
with self.assertRaises(
|
||||
ApiException.exception_class_for_http_status(403)
|
||||
) as context:
|
||||
self.api.set_operation_connectors(
|
||||
|
||||
type=type,
|
||||
|
||||
id=id,
|
||||
|
||||
request_body=request_body,
|
||||
|
||||
confirm_disabled_objects=confirm_disabled_objects,
|
||||
|
||||
aid=aid,
|
||||
|
||||
_headers=self.te_headers("set_operation_connectors", error_status="403"),
|
||||
)
|
||||
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
|
||||
|
||||
|
||||
def test_set_operation_connectors_error_404(self) -> None:
|
||||
"""Integration test for set_operation_connectors error path (HTTP 404)"""
|
||||
request_body_json = """
|
||||
|
||||
[ "ca39314d-eb4f-496f-9435-b5d20b1bfbff" ]
|
||||
|
||||
"""
|
||||
request_body = json.loads(request_body_json)
|
||||
type = 'webhooks'
|
||||
id = 'cb1b8033-ea2d-4e9b-a920-fe87850693cf'
|
||||
confirm_disabled_objects = False
|
||||
aid = '1234'
|
||||
error_body_json = """
|
||||
{
|
||||
"instance" : "instance",
|
||||
"detail" : "detail",
|
||||
"type" : "type",
|
||||
"title" : "title",
|
||||
"status" : 6
|
||||
}
|
||||
"""
|
||||
expected_error = json.loads(error_body_json)
|
||||
with self.assertRaises(
|
||||
ApiException.exception_class_for_http_status(404)
|
||||
) as context:
|
||||
self.api.set_operation_connectors(
|
||||
|
||||
type=type,
|
||||
|
||||
id=id,
|
||||
|
||||
request_body=request_body,
|
||||
|
||||
confirm_disabled_objects=confirm_disabled_objects,
|
||||
|
||||
aid=aid,
|
||||
|
||||
_headers=self.te_headers("set_operation_connectors", error_status="404"),
|
||||
)
|
||||
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
|
||||
|
||||
|
||||
def test_set_operation_connectors_error_500(self) -> None:
|
||||
"""Integration test for set_operation_connectors error path (HTTP 500)"""
|
||||
request_body_json = """
|
||||
|
||||
[ "ca39314d-eb4f-496f-9435-b5d20b1bfbff" ]
|
||||
|
||||
"""
|
||||
request_body = json.loads(request_body_json)
|
||||
type = 'webhooks'
|
||||
id = 'cb1b8033-ea2d-4e9b-a920-fe87850693cf'
|
||||
confirm_disabled_objects = False
|
||||
aid = '1234'
|
||||
error_body_json = """
|
||||
{
|
||||
"instance" : "instance",
|
||||
"detail" : "detail",
|
||||
"type" : "type",
|
||||
"title" : "title",
|
||||
"status" : 6
|
||||
}
|
||||
"""
|
||||
expected_error = json.loads(error_body_json)
|
||||
with self.assertRaises(
|
||||
ApiException.exception_class_for_http_status(500)
|
||||
) as context:
|
||||
self.api.set_operation_connectors(
|
||||
|
||||
type=type,
|
||||
|
||||
id=id,
|
||||
|
||||
request_body=request_body,
|
||||
|
||||
confirm_disabled_objects=confirm_disabled_objects,
|
||||
|
||||
aid=aid,
|
||||
|
||||
_headers=self.te_headers("set_operation_connectors", error_status="500"),
|
||||
)
|
||||
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
314
thousandeyes-sdk-connectors/test/test_panorama_connectors_api.py
Normal file
314
thousandeyes-sdk-connectors/test/test_panorama_connectors_api.py
Normal file
@ -0,0 +1,314 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
Integrations API
|
||||
|
||||
**Note:** The Webhook Operations APIs are not available for ThousandEyes for Government instance. Manage connectors and operations.
|
||||
|
||||
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
||||
|
||||
Do not edit the class manually.
|
||||
""" # noqa: E501
|
||||
|
||||
|
||||
import json
|
||||
import unittest
|
||||
import thousandeyes_sdk.connectors.models
|
||||
|
||||
from .test_utils import assert_constructed_model_matches_example_json
|
||||
from thousandeyes_sdk.connectors.api.panorama_connectors_api import PanoramaConnectorsApi
|
||||
|
||||
|
||||
class TestPanoramaConnectorsApi(unittest.TestCase):
|
||||
"""PanoramaConnectorsApi unit test stubs"""
|
||||
|
||||
def setUp(self) -> None:
|
||||
self.api = PanoramaConnectorsApi()
|
||||
|
||||
def tearDown(self) -> None:
|
||||
pass
|
||||
|
||||
def test_create_panorama_connector_models_validation(self) -> None:
|
||||
"""Test case for create_panorama_connector request and response models"""
|
||||
request_body_json = """
|
||||
{
|
||||
"lastModifiedDate" : 1770293655756,
|
||||
"_links" : {
|
||||
"self" : {
|
||||
"hreflang" : "hreflang",
|
||||
"templated" : true,
|
||||
"profile" : "profile",
|
||||
"name" : "name",
|
||||
"href" : "https://api.thousandeyes.com/v7/link/to/resource/id",
|
||||
"type" : "type",
|
||||
"deprecation" : "deprecation",
|
||||
"title" : "title"
|
||||
}
|
||||
},
|
||||
"name" : "Branch Panorama",
|
||||
"id" : "cb1b8033-ea2d-4e9b-a920-fe87850693cf",
|
||||
"type" : "panorama",
|
||||
"target" : "https://panorama.example.com",
|
||||
"authentication" : {
|
||||
"type" : "other-token",
|
||||
"token" : "token"
|
||||
}
|
||||
}
|
||||
"""
|
||||
|
||||
request_loaded_json = json.loads(request_body_json)
|
||||
request_from_json = thousandeyes_sdk.connectors.models.PanoramaConnector.from_json(request_body_json)
|
||||
assert_constructed_model_matches_example_json(request_from_json, request_loaded_json)
|
||||
|
||||
response_body_json = """
|
||||
{
|
||||
"lastModifiedDate" : 1770293655756,
|
||||
"_links" : {
|
||||
"self" : {
|
||||
"hreflang" : "hreflang",
|
||||
"templated" : true,
|
||||
"profile" : "profile",
|
||||
"name" : "name",
|
||||
"href" : "https://api.thousandeyes.com/v7/link/to/resource/id",
|
||||
"type" : "type",
|
||||
"deprecation" : "deprecation",
|
||||
"title" : "title"
|
||||
}
|
||||
},
|
||||
"name" : "Branch Panorama",
|
||||
"id" : "cb1b8033-ea2d-4e9b-a920-fe87850693cf",
|
||||
"type" : "panorama",
|
||||
"target" : "https://panorama.example.com",
|
||||
"authentication" : {
|
||||
"type" : "other-token",
|
||||
"token" : "token"
|
||||
}
|
||||
}"""
|
||||
|
||||
response_loaded_json = json.loads(response_body_json)
|
||||
response_from_json = thousandeyes_sdk.connectors.models.PanoramaConnector.from_json(response_body_json)
|
||||
assert_constructed_model_matches_example_json(response_from_json, response_loaded_json)
|
||||
|
||||
def test_delete_panorama_connector_models_validation(self) -> None:
|
||||
"""Test case for delete_panorama_connector request and response models"""
|
||||
|
||||
|
||||
def test_get_panorama_connector_models_validation(self) -> None:
|
||||
"""Test case for get_panorama_connector request and response models"""
|
||||
|
||||
response_body_json = """
|
||||
{
|
||||
"lastModifiedDate" : 1770293655756,
|
||||
"_links" : {
|
||||
"self" : {
|
||||
"hreflang" : "hreflang",
|
||||
"templated" : true,
|
||||
"profile" : "profile",
|
||||
"name" : "name",
|
||||
"href" : "https://api.thousandeyes.com/v7/link/to/resource/id",
|
||||
"type" : "type",
|
||||
"deprecation" : "deprecation",
|
||||
"title" : "title"
|
||||
}
|
||||
},
|
||||
"name" : "Branch Panorama",
|
||||
"id" : "cb1b8033-ea2d-4e9b-a920-fe87850693cf",
|
||||
"type" : "panorama",
|
||||
"target" : "https://panorama.example.com",
|
||||
"authentication" : {
|
||||
"type" : "other-token",
|
||||
"token" : "token"
|
||||
}
|
||||
}"""
|
||||
|
||||
response_loaded_json = json.loads(response_body_json)
|
||||
response_from_json = thousandeyes_sdk.connectors.models.PanoramaConnector.from_json(response_body_json)
|
||||
assert_constructed_model_matches_example_json(response_from_json, response_loaded_json)
|
||||
|
||||
def test_get_panorama_connector_operations_models_validation(self) -> None:
|
||||
"""Test case for get_panorama_connector_operations request and response models"""
|
||||
|
||||
response_body_json = """
|
||||
{
|
||||
"_links" : {
|
||||
"self" : {
|
||||
"hreflang" : "hreflang",
|
||||
"templated" : true,
|
||||
"profile" : "profile",
|
||||
"name" : "name",
|
||||
"href" : "https://api.thousandeyes.com/v7/link/to/resource/id",
|
||||
"type" : "type",
|
||||
"deprecation" : "deprecation",
|
||||
"title" : "title"
|
||||
}
|
||||
},
|
||||
"items" : [ "ca39314d-eb4f-496f-9435-b5d20b1bfbff", "ca39314d-eb4f-496f-9435-b5d20b1bfbff" ]
|
||||
}"""
|
||||
|
||||
response_loaded_json = json.loads(response_body_json)
|
||||
response_from_json = thousandeyes_sdk.connectors.models.Assignments.from_json(response_body_json)
|
||||
assert_constructed_model_matches_example_json(response_from_json, response_loaded_json)
|
||||
|
||||
def test_get_panorama_connectors_models_validation(self) -> None:
|
||||
"""Test case for get_panorama_connectors request and response models"""
|
||||
|
||||
response_body_json = """
|
||||
{
|
||||
"_links" : {
|
||||
"self" : {
|
||||
"hreflang" : "hreflang",
|
||||
"templated" : true,
|
||||
"profile" : "profile",
|
||||
"name" : "name",
|
||||
"href" : "https://api.thousandeyes.com/v7/link/to/resource/id",
|
||||
"type" : "type",
|
||||
"deprecation" : "deprecation",
|
||||
"title" : "title"
|
||||
}
|
||||
},
|
||||
"items" : [ {
|
||||
"lastModifiedDate" : 1770293655756,
|
||||
"_links" : {
|
||||
"self" : {
|
||||
"hreflang" : "hreflang",
|
||||
"templated" : true,
|
||||
"profile" : "profile",
|
||||
"name" : "name",
|
||||
"href" : "https://api.thousandeyes.com/v7/link/to/resource/id",
|
||||
"type" : "type",
|
||||
"deprecation" : "deprecation",
|
||||
"title" : "title"
|
||||
}
|
||||
},
|
||||
"name" : "Branch Panorama",
|
||||
"id" : "cb1b8033-ea2d-4e9b-a920-fe87850693cf",
|
||||
"type" : "panorama",
|
||||
"target" : "https://panorama.example.com",
|
||||
"authentication" : {
|
||||
"type" : "other-token",
|
||||
"token" : "token"
|
||||
}
|
||||
}, {
|
||||
"lastModifiedDate" : 1770293655756,
|
||||
"_links" : {
|
||||
"self" : {
|
||||
"hreflang" : "hreflang",
|
||||
"templated" : true,
|
||||
"profile" : "profile",
|
||||
"name" : "name",
|
||||
"href" : "https://api.thousandeyes.com/v7/link/to/resource/id",
|
||||
"type" : "type",
|
||||
"deprecation" : "deprecation",
|
||||
"title" : "title"
|
||||
}
|
||||
},
|
||||
"name" : "Branch Panorama",
|
||||
"id" : "cb1b8033-ea2d-4e9b-a920-fe87850693cf",
|
||||
"type" : "panorama",
|
||||
"target" : "https://panorama.example.com",
|
||||
"authentication" : {
|
||||
"type" : "other-token",
|
||||
"token" : "token"
|
||||
}
|
||||
} ]
|
||||
}"""
|
||||
|
||||
response_loaded_json = json.loads(response_body_json)
|
||||
response_from_json = thousandeyes_sdk.connectors.models.PanoramaConnectors.from_json(response_body_json)
|
||||
assert_constructed_model_matches_example_json(response_from_json, response_loaded_json)
|
||||
|
||||
def test_set_panorama_connector_operations_models_validation(self) -> None:
|
||||
"""Test case for set_panorama_connector_operations request and response models"""
|
||||
request_body_json = """
|
||||
[ "ca39314d-eb4f-496f-9435-b5d20b1bfbff", "a32cfbab-32f6-41d8-9027-7127cba965dd" ]
|
||||
"""
|
||||
|
||||
request_loaded_json = json.loads(request_body_json)
|
||||
request_from_json = json.loads(request_body_json)
|
||||
self.assertEqual(request_from_json, request_loaded_json)
|
||||
|
||||
response_body_json = """
|
||||
{
|
||||
"_links" : {
|
||||
"self" : {
|
||||
"hreflang" : "hreflang",
|
||||
"templated" : true,
|
||||
"profile" : "profile",
|
||||
"name" : "name",
|
||||
"href" : "https://api.thousandeyes.com/v7/link/to/resource/id",
|
||||
"type" : "type",
|
||||
"deprecation" : "deprecation",
|
||||
"title" : "title"
|
||||
}
|
||||
},
|
||||
"items" : [ "ca39314d-eb4f-496f-9435-b5d20b1bfbff", "ca39314d-eb4f-496f-9435-b5d20b1bfbff" ]
|
||||
}"""
|
||||
|
||||
response_loaded_json = json.loads(response_body_json)
|
||||
response_from_json = thousandeyes_sdk.connectors.models.Assignments.from_json(response_body_json)
|
||||
assert_constructed_model_matches_example_json(response_from_json, response_loaded_json)
|
||||
|
||||
def test_update_panorama_connector_models_validation(self) -> None:
|
||||
"""Test case for update_panorama_connector request and response models"""
|
||||
request_body_json = """
|
||||
{
|
||||
"lastModifiedDate" : 1770293655756,
|
||||
"_links" : {
|
||||
"self" : {
|
||||
"hreflang" : "hreflang",
|
||||
"templated" : true,
|
||||
"profile" : "profile",
|
||||
"name" : "name",
|
||||
"href" : "https://api.thousandeyes.com/v7/link/to/resource/id",
|
||||
"type" : "type",
|
||||
"deprecation" : "deprecation",
|
||||
"title" : "title"
|
||||
}
|
||||
},
|
||||
"name" : "Branch Panorama",
|
||||
"id" : "cb1b8033-ea2d-4e9b-a920-fe87850693cf",
|
||||
"type" : "panorama",
|
||||
"target" : "https://panorama.example.com",
|
||||
"authentication" : {
|
||||
"type" : "other-token",
|
||||
"token" : "token"
|
||||
}
|
||||
}
|
||||
"""
|
||||
|
||||
request_loaded_json = json.loads(request_body_json)
|
||||
request_from_json = thousandeyes_sdk.connectors.models.PanoramaConnector.from_json(request_body_json)
|
||||
assert_constructed_model_matches_example_json(request_from_json, request_loaded_json)
|
||||
|
||||
response_body_json = """
|
||||
{
|
||||
"lastModifiedDate" : 1770293655756,
|
||||
"_links" : {
|
||||
"self" : {
|
||||
"hreflang" : "hreflang",
|
||||
"templated" : true,
|
||||
"profile" : "profile",
|
||||
"name" : "name",
|
||||
"href" : "https://api.thousandeyes.com/v7/link/to/resource/id",
|
||||
"type" : "type",
|
||||
"deprecation" : "deprecation",
|
||||
"title" : "title"
|
||||
}
|
||||
},
|
||||
"name" : "Branch Panorama",
|
||||
"id" : "cb1b8033-ea2d-4e9b-a920-fe87850693cf",
|
||||
"type" : "panorama",
|
||||
"target" : "https://panorama.example.com",
|
||||
"authentication" : {
|
||||
"type" : "other-token",
|
||||
"token" : "token"
|
||||
}
|
||||
}"""
|
||||
|
||||
response_loaded_json = json.loads(response_body_json)
|
||||
response_from_json = thousandeyes_sdk.connectors.models.PanoramaConnector.from_json(response_body_json)
|
||||
assert_constructed_model_matches_example_json(response_from_json, response_loaded_json)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
File diff suppressed because it is too large
Load Diff
@ -2,15 +2,36 @@
|
||||
|
||||
import json
|
||||
import unittest
|
||||
from typing import Any
|
||||
|
||||
from pydantic import BaseModel
|
||||
|
||||
|
||||
def _project_onto_constructed(expected: Any, constructed: Any) -> Any:
|
||||
"""Keep only example fields that appear in the constructed model output."""
|
||||
if isinstance(constructed, dict):
|
||||
if not isinstance(expected, dict):
|
||||
return expected
|
||||
return {
|
||||
key: _project_onto_constructed(expected.get(key), value)
|
||||
for key, value in constructed.items()
|
||||
}
|
||||
if isinstance(constructed, list):
|
||||
if not isinstance(expected, list):
|
||||
return expected
|
||||
return [
|
||||
_project_onto_constructed(expected[index], value)
|
||||
for index, value in enumerate(constructed)
|
||||
]
|
||||
return expected
|
||||
|
||||
|
||||
def assert_constructed_model_matches_example_json(model: BaseModel, loaded_json: dict):
|
||||
test_case = unittest.TestCase()
|
||||
test_case.maxDiff = None
|
||||
test_case.assertIsNotNone(model)
|
||||
constructed_json = json.loads(model.to_json())
|
||||
sorted_loaded_json = json.dumps(loaded_json, sort_keys=True)
|
||||
projected_loaded_json = _project_onto_constructed(loaded_json, constructed_json)
|
||||
sorted_loaded_json = json.dumps(projected_loaded_json, sort_keys=True)
|
||||
sorted_constructed_json = json.dumps(constructed_json, sort_keys=True)
|
||||
test_case.assertEqual(sorted_loaded_json, sorted_constructed_json)
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -30,5 +30,9 @@ src/thousandeyes_sdk/credentials/models/validation_error.py
|
||||
src/thousandeyes_sdk/credentials/models/validation_error_item.py
|
||||
src/thousandeyes_sdk/credentials/py.typed
|
||||
test/__init__.py
|
||||
test/conftest.py
|
||||
test/integration_test_utils.py
|
||||
test/mock_manifest.py
|
||||
test/test_credentials_api.py
|
||||
test/test_credentials_api_integration.py
|
||||
test/test_utils.py
|
||||
|
||||
@ -13,7 +13,7 @@ For more information about credentials, see [Working With Secure Credentials](ht
|
||||
|
||||
This Python package is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project:
|
||||
|
||||
- API version: 7.0.96
|
||||
- API version: 7.0.99
|
||||
- Generator version: 7.6.0
|
||||
- Build package: com.thousandeyes.api.codegen.ThousandeyesPythonGenerator
|
||||
|
||||
|
||||
7
thousandeyes-sdk-credentials/test/conftest.py
Normal file
7
thousandeyes-sdk-credentials/test/conftest.py
Normal file
@ -0,0 +1,7 @@
|
||||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
_repo_root = Path(__file__).resolve().parents[2]
|
||||
_core_test_support = _repo_root / "thousandeyes-sdk-core" / "test"
|
||||
if str(_core_test_support) not in sys.path:
|
||||
sys.path.insert(0, str(_core_test_support))
|
||||
37
thousandeyes-sdk-credentials/test/integration_test_utils.py
Normal file
37
thousandeyes-sdk-credentials/test/integration_test_utils.py
Normal file
@ -0,0 +1,37 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
Credentials API
|
||||
|
||||
Manage credentials for transaction tests using the Credentials API. The following permissions are required to access Credentials API operations: * `Settings Tests Read` for read operations. * `Settings Tests Update` for write operations. * `View sensitive data in web transaction scripts` to view the encrypted value property of credentials. * `Settings Tests Create Transaction (Tx) Tests` to create credentials. For more information about credentials, see [Working With Secure Credentials](https://docs.thousandeyes.com/product-documentation/browser-synthetics/transaction-tests/getting-started/working-with-secure-credentials).
|
||||
|
||||
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
||||
|
||||
Do not edit the class manually.
|
||||
""" # noqa: E501
|
||||
|
||||
|
||||
import unittest
|
||||
|
||||
from thousandeyes_sdk.core.api_client import ApiClient
|
||||
from thousandeyes_sdk.core.configuration import Configuration
|
||||
from sdk_test_support.mock_server import ERROR_STATUS_HEADER, OPERATION_ID_HEADER, MockApiServer
|
||||
|
||||
from .mock_manifest import OPERATION_MANIFEST
|
||||
|
||||
|
||||
class IntegrationTestBase(unittest.TestCase):
|
||||
def setUp(self) -> None:
|
||||
self.server = MockApiServer(OPERATION_MANIFEST)
|
||||
self.server.start()
|
||||
configuration = Configuration(host=self.server.base_url, access_token="test-token")
|
||||
self.api_client = ApiClient(configuration=configuration)
|
||||
|
||||
def tearDown(self) -> None:
|
||||
self.server.stop()
|
||||
|
||||
def te_headers(self, operation_id: str, error_status=None):
|
||||
headers = {OPERATION_ID_HEADER: operation_id}
|
||||
if error_status is not None:
|
||||
headers[ERROR_STATUS_HEADER] = error_status
|
||||
return headers
|
||||
604
thousandeyes-sdk-credentials/test/mock_manifest.py
Normal file
604
thousandeyes-sdk-credentials/test/mock_manifest.py
Normal file
@ -0,0 +1,604 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
Credentials API
|
||||
|
||||
Manage credentials for transaction tests using the Credentials API. The following permissions are required to access Credentials API operations: * `Settings Tests Read` for read operations. * `Settings Tests Update` for write operations. * `View sensitive data in web transaction scripts` to view the encrypted value property of credentials. * `Settings Tests Create Transaction (Tx) Tests` to create credentials. For more information about credentials, see [Working With Secure Credentials](https://docs.thousandeyes.com/product-documentation/browser-synthetics/transaction-tests/getting-started/working-with-secure-credentials).
|
||||
|
||||
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
||||
|
||||
Do not edit the class manually.
|
||||
""" # noqa: E501
|
||||
|
||||
|
||||
import json
|
||||
|
||||
from sdk_test_support.mock_server_types import ErrorResponseExpectation, OperationExpectation
|
||||
|
||||
OPERATION_MANIFEST = {
|
||||
|
||||
"create_credential": OperationExpectation(
|
||||
operation_id="create_credential",
|
||||
method="POST",
|
||||
path="/credentials",
|
||||
path_param_examples={
|
||||
},
|
||||
success_status=201,
|
||||
success_body=json.loads("""
|
||||
|
||||
{
|
||||
"_links" : {
|
||||
"self" : {
|
||||
"hreflang" : "hreflang",
|
||||
"templated" : true,
|
||||
"profile" : "profile",
|
||||
"name" : "name",
|
||||
"href" : "https://api.thousandeyes.com/v7/link/to/resource/id",
|
||||
"type" : "type",
|
||||
"deprecation" : "deprecation",
|
||||
"title" : "title"
|
||||
}
|
||||
},
|
||||
"name" : "Example Credential",
|
||||
"id" : "3247"
|
||||
}
|
||||
|
||||
"""),
|
||||
|
||||
success_content_type="application/json",
|
||||
|
||||
request_body_example=json.loads("""
|
||||
|
||||
{
|
||||
"name" : "Example Credential 1",
|
||||
"value" : "Example Credential 1 Password"
|
||||
}
|
||||
|
||||
"""),
|
||||
error_responses={
|
||||
|
||||
"400": ErrorResponseExpectation(
|
||||
status=400,
|
||||
body=json.loads("""
|
||||
{
|
||||
"instance" : "instance",
|
||||
"detail" : "detail",
|
||||
"type" : "type",
|
||||
"title" : "title",
|
||||
"errors" : [ {
|
||||
"code" : "code",
|
||||
"field" : "field",
|
||||
"message" : "message"
|
||||
}, {
|
||||
"code" : "code",
|
||||
"field" : "field",
|
||||
"message" : "message"
|
||||
} ],
|
||||
"status" : 0
|
||||
}"""),
|
||||
content_type="application/json",
|
||||
),
|
||||
|
||||
"401": ErrorResponseExpectation(
|
||||
status=401,
|
||||
body=json.loads("""
|
||||
{
|
||||
"error_description" : "Invalid access token",
|
||||
"error" : "invalid_token"
|
||||
}"""),
|
||||
content_type="application/json",
|
||||
),
|
||||
|
||||
"403": ErrorResponseExpectation(
|
||||
status=403,
|
||||
body=json.loads("""
|
||||
{
|
||||
"instance" : "instance",
|
||||
"detail" : "detail",
|
||||
"type" : "type",
|
||||
"title" : "title",
|
||||
"status" : 0
|
||||
}"""),
|
||||
content_type="application/json",
|
||||
),
|
||||
|
||||
"404": ErrorResponseExpectation(
|
||||
status=404,
|
||||
body=json.loads("""
|
||||
{
|
||||
"instance" : "instance",
|
||||
"detail" : "detail",
|
||||
"type" : "type",
|
||||
"title" : "title",
|
||||
"status" : 0
|
||||
}"""),
|
||||
content_type="application/json",
|
||||
),
|
||||
|
||||
"429": ErrorResponseExpectation(
|
||||
status=429,
|
||||
body=json.loads("""
|
||||
{
|
||||
"instance" : "instance",
|
||||
"detail" : "detail",
|
||||
"type" : "type",
|
||||
"title" : "title",
|
||||
"status" : 0
|
||||
}"""),
|
||||
content_type="application/json",
|
||||
),
|
||||
|
||||
"500": ErrorResponseExpectation(
|
||||
status=500,
|
||||
body=json.loads("""
|
||||
{
|
||||
"instance" : "instance",
|
||||
"detail" : "detail",
|
||||
"type" : "type",
|
||||
"title" : "title",
|
||||
"status" : 0
|
||||
}"""),
|
||||
content_type="application/json",
|
||||
),
|
||||
|
||||
},
|
||||
),
|
||||
|
||||
"delete_credential": OperationExpectation(
|
||||
operation_id="delete_credential",
|
||||
method="DELETE",
|
||||
path="/credentials/{id}",
|
||||
path_param_examples={
|
||||
"id": '3247',
|
||||
},
|
||||
success_status=204,
|
||||
success_body=None,
|
||||
success_content_type="application/json",
|
||||
request_body_example=None,
|
||||
error_responses={
|
||||
|
||||
"401": ErrorResponseExpectation(
|
||||
status=401,
|
||||
body=json.loads("""
|
||||
{
|
||||
"error_description" : "Invalid access token",
|
||||
"error" : "invalid_token"
|
||||
}"""),
|
||||
content_type="application/json",
|
||||
),
|
||||
|
||||
"403": ErrorResponseExpectation(
|
||||
status=403,
|
||||
body=json.loads("""
|
||||
{
|
||||
"instance" : "instance",
|
||||
"detail" : "detail",
|
||||
"type" : "type",
|
||||
"title" : "title",
|
||||
"status" : 0
|
||||
}"""),
|
||||
content_type="application/json",
|
||||
),
|
||||
|
||||
"404": ErrorResponseExpectation(
|
||||
status=404,
|
||||
body=json.loads("""
|
||||
{
|
||||
"instance" : "instance",
|
||||
"detail" : "detail",
|
||||
"type" : "type",
|
||||
"title" : "title",
|
||||
"status" : 0
|
||||
}"""),
|
||||
content_type="application/json",
|
||||
),
|
||||
|
||||
"429": ErrorResponseExpectation(
|
||||
status=429,
|
||||
body=json.loads("""
|
||||
{
|
||||
"instance" : "instance",
|
||||
"detail" : "detail",
|
||||
"type" : "type",
|
||||
"title" : "title",
|
||||
"status" : 0
|
||||
}"""),
|
||||
content_type="application/json",
|
||||
),
|
||||
|
||||
"500": ErrorResponseExpectation(
|
||||
status=500,
|
||||
body=json.loads("""
|
||||
{
|
||||
"instance" : "instance",
|
||||
"detail" : "detail",
|
||||
"type" : "type",
|
||||
"title" : "title",
|
||||
"status" : 0
|
||||
}"""),
|
||||
content_type="application/json",
|
||||
),
|
||||
|
||||
},
|
||||
),
|
||||
|
||||
"get_credential": OperationExpectation(
|
||||
operation_id="get_credential",
|
||||
method="GET",
|
||||
path="/credentials/{id}",
|
||||
path_param_examples={
|
||||
"id": '3247',
|
||||
},
|
||||
success_status=200,
|
||||
success_body=json.loads("""
|
||||
|
||||
{
|
||||
"_links" : {
|
||||
"self" : {
|
||||
"hreflang" : "hreflang",
|
||||
"templated" : true,
|
||||
"profile" : "profile",
|
||||
"name" : "name",
|
||||
"href" : "https://api.thousandeyes.com/v7/link/to/resource/id",
|
||||
"type" : "type",
|
||||
"deprecation" : "deprecation",
|
||||
"title" : "title"
|
||||
}
|
||||
},
|
||||
"name" : "Example Credential",
|
||||
"id" : "3247",
|
||||
"value" : "rwhR12uDm1Im47p5IVXgzz4ORgC7m48ajzzeWVUt"
|
||||
}
|
||||
|
||||
"""),
|
||||
|
||||
success_content_type="application/json",
|
||||
|
||||
request_body_example=None,
|
||||
error_responses={
|
||||
|
||||
"400": ErrorResponseExpectation(
|
||||
status=400,
|
||||
body=json.loads("""
|
||||
{
|
||||
"instance" : "instance",
|
||||
"detail" : "detail",
|
||||
"type" : "type",
|
||||
"title" : "title",
|
||||
"errors" : [ {
|
||||
"code" : "code",
|
||||
"field" : "field",
|
||||
"message" : "message"
|
||||
}, {
|
||||
"code" : "code",
|
||||
"field" : "field",
|
||||
"message" : "message"
|
||||
} ],
|
||||
"status" : 0
|
||||
}"""),
|
||||
content_type="application/json",
|
||||
),
|
||||
|
||||
"401": ErrorResponseExpectation(
|
||||
status=401,
|
||||
body=json.loads("""
|
||||
{
|
||||
"error_description" : "Invalid access token",
|
||||
"error" : "invalid_token"
|
||||
}"""),
|
||||
content_type="application/json",
|
||||
),
|
||||
|
||||
"403": ErrorResponseExpectation(
|
||||
status=403,
|
||||
body=json.loads("""
|
||||
{
|
||||
"instance" : "instance",
|
||||
"detail" : "detail",
|
||||
"type" : "type",
|
||||
"title" : "title",
|
||||
"status" : 0
|
||||
}"""),
|
||||
content_type="application/json",
|
||||
),
|
||||
|
||||
"404": ErrorResponseExpectation(
|
||||
status=404,
|
||||
body=json.loads("""
|
||||
{
|
||||
"instance" : "instance",
|
||||
"detail" : "detail",
|
||||
"type" : "type",
|
||||
"title" : "title",
|
||||
"status" : 0
|
||||
}"""),
|
||||
content_type="application/json",
|
||||
),
|
||||
|
||||
"429": ErrorResponseExpectation(
|
||||
status=429,
|
||||
body=json.loads("""
|
||||
{
|
||||
"instance" : "instance",
|
||||
"detail" : "detail",
|
||||
"type" : "type",
|
||||
"title" : "title",
|
||||
"status" : 0
|
||||
}"""),
|
||||
content_type="application/json",
|
||||
),
|
||||
|
||||
"500": ErrorResponseExpectation(
|
||||
status=500,
|
||||
body=json.loads("""
|
||||
{
|
||||
"instance" : "instance",
|
||||
"detail" : "detail",
|
||||
"type" : "type",
|
||||
"title" : "title",
|
||||
"status" : 0
|
||||
}"""),
|
||||
content_type="application/json",
|
||||
),
|
||||
|
||||
},
|
||||
),
|
||||
|
||||
"get_credentials": OperationExpectation(
|
||||
operation_id="get_credentials",
|
||||
method="GET",
|
||||
path="/credentials",
|
||||
path_param_examples={
|
||||
},
|
||||
success_status=200,
|
||||
success_body=json.loads("""
|
||||
|
||||
{
|
||||
"credentials" : [ {
|
||||
"_links" : {
|
||||
"self" : {
|
||||
"hreflang" : "hreflang",
|
||||
"templated" : true,
|
||||
"profile" : "profile",
|
||||
"name" : "name",
|
||||
"href" : "https://api.thousandeyes.com/v7/link/to/resource/id",
|
||||
"type" : "type",
|
||||
"deprecation" : "deprecation",
|
||||
"title" : "title"
|
||||
}
|
||||
},
|
||||
"name" : "Example Credential",
|
||||
"id" : "3247",
|
||||
"value" : "rwhR12uDm1Im47p5IVXgzz4ORgC7m48ajzzeWVUt"
|
||||
}, {
|
||||
"_links" : {
|
||||
"self" : {
|
||||
"hreflang" : "hreflang",
|
||||
"templated" : true,
|
||||
"profile" : "profile",
|
||||
"name" : "name",
|
||||
"href" : "https://api.thousandeyes.com/v7/link/to/resource/id",
|
||||
"type" : "type",
|
||||
"deprecation" : "deprecation",
|
||||
"title" : "title"
|
||||
}
|
||||
},
|
||||
"name" : "Example Credential",
|
||||
"id" : "3247",
|
||||
"value" : "rwhR12uDm1Im47p5IVXgzz4ORgC7m48ajzzeWVUt"
|
||||
} ],
|
||||
"_links" : {
|
||||
"self" : {
|
||||
"hreflang" : "hreflang",
|
||||
"templated" : true,
|
||||
"profile" : "profile",
|
||||
"name" : "name",
|
||||
"href" : "https://api.thousandeyes.com/v7/link/to/resource/id",
|
||||
"type" : "type",
|
||||
"deprecation" : "deprecation",
|
||||
"title" : "title"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
"""),
|
||||
|
||||
success_content_type="application/json",
|
||||
|
||||
request_body_example=None,
|
||||
error_responses={
|
||||
|
||||
"401": ErrorResponseExpectation(
|
||||
status=401,
|
||||
body=json.loads("""
|
||||
{
|
||||
"error_description" : "Invalid access token",
|
||||
"error" : "invalid_token"
|
||||
}"""),
|
||||
content_type="application/json",
|
||||
),
|
||||
|
||||
"403": ErrorResponseExpectation(
|
||||
status=403,
|
||||
body=json.loads("""
|
||||
{
|
||||
"instance" : "instance",
|
||||
"detail" : "detail",
|
||||
"type" : "type",
|
||||
"title" : "title",
|
||||
"status" : 0
|
||||
}"""),
|
||||
content_type="application/json",
|
||||
),
|
||||
|
||||
"404": ErrorResponseExpectation(
|
||||
status=404,
|
||||
body=json.loads("""
|
||||
{
|
||||
"instance" : "instance",
|
||||
"detail" : "detail",
|
||||
"type" : "type",
|
||||
"title" : "title",
|
||||
"status" : 0
|
||||
}"""),
|
||||
content_type="application/json",
|
||||
),
|
||||
|
||||
"429": ErrorResponseExpectation(
|
||||
status=429,
|
||||
body=json.loads("""
|
||||
{
|
||||
"instance" : "instance",
|
||||
"detail" : "detail",
|
||||
"type" : "type",
|
||||
"title" : "title",
|
||||
"status" : 0
|
||||
}"""),
|
||||
content_type="application/json",
|
||||
),
|
||||
|
||||
"500": ErrorResponseExpectation(
|
||||
status=500,
|
||||
body=json.loads("""
|
||||
{
|
||||
"instance" : "instance",
|
||||
"detail" : "detail",
|
||||
"type" : "type",
|
||||
"title" : "title",
|
||||
"status" : 0
|
||||
}"""),
|
||||
content_type="application/json",
|
||||
),
|
||||
|
||||
},
|
||||
),
|
||||
|
||||
"update_credential": OperationExpectation(
|
||||
operation_id="update_credential",
|
||||
method="PUT",
|
||||
path="/credentials/{id}",
|
||||
path_param_examples={
|
||||
"id": '3247',
|
||||
},
|
||||
success_status=200,
|
||||
success_body=json.loads("""
|
||||
|
||||
{
|
||||
"_links" : {
|
||||
"self" : {
|
||||
"hreflang" : "hreflang",
|
||||
"templated" : true,
|
||||
"profile" : "profile",
|
||||
"name" : "name",
|
||||
"href" : "https://api.thousandeyes.com/v7/link/to/resource/id",
|
||||
"type" : "type",
|
||||
"deprecation" : "deprecation",
|
||||
"title" : "title"
|
||||
}
|
||||
},
|
||||
"name" : "Example Credential",
|
||||
"id" : "3247"
|
||||
}
|
||||
|
||||
"""),
|
||||
|
||||
success_content_type="application/json",
|
||||
|
||||
request_body_example=json.loads("""
|
||||
|
||||
{
|
||||
"name" : "Example Credential 1",
|
||||
"value" : "Example Credential 1 Password"
|
||||
}
|
||||
|
||||
"""),
|
||||
error_responses={
|
||||
|
||||
"400": ErrorResponseExpectation(
|
||||
status=400,
|
||||
body=json.loads("""
|
||||
{
|
||||
"instance" : "instance",
|
||||
"detail" : "detail",
|
||||
"type" : "type",
|
||||
"title" : "title",
|
||||
"errors" : [ {
|
||||
"code" : "code",
|
||||
"field" : "field",
|
||||
"message" : "message"
|
||||
}, {
|
||||
"code" : "code",
|
||||
"field" : "field",
|
||||
"message" : "message"
|
||||
} ],
|
||||
"status" : 0
|
||||
}"""),
|
||||
content_type="application/json",
|
||||
),
|
||||
|
||||
"401": ErrorResponseExpectation(
|
||||
status=401,
|
||||
body=json.loads("""
|
||||
{
|
||||
"error_description" : "Invalid access token",
|
||||
"error" : "invalid_token"
|
||||
}"""),
|
||||
content_type="application/json",
|
||||
),
|
||||
|
||||
"403": ErrorResponseExpectation(
|
||||
status=403,
|
||||
body=json.loads("""
|
||||
{
|
||||
"instance" : "instance",
|
||||
"detail" : "detail",
|
||||
"type" : "type",
|
||||
"title" : "title",
|
||||
"status" : 0
|
||||
}"""),
|
||||
content_type="application/json",
|
||||
),
|
||||
|
||||
"404": ErrorResponseExpectation(
|
||||
status=404,
|
||||
body=json.loads("""
|
||||
{
|
||||
"instance" : "instance",
|
||||
"detail" : "detail",
|
||||
"type" : "type",
|
||||
"title" : "title",
|
||||
"status" : 0
|
||||
}"""),
|
||||
content_type="application/json",
|
||||
),
|
||||
|
||||
"429": ErrorResponseExpectation(
|
||||
status=429,
|
||||
body=json.loads("""
|
||||
{
|
||||
"instance" : "instance",
|
||||
"detail" : "detail",
|
||||
"type" : "type",
|
||||
"title" : "title",
|
||||
"status" : 0
|
||||
}"""),
|
||||
content_type="application/json",
|
||||
),
|
||||
|
||||
"500": ErrorResponseExpectation(
|
||||
status=500,
|
||||
body=json.loads("""
|
||||
{
|
||||
"instance" : "instance",
|
||||
"detail" : "detail",
|
||||
"type" : "type",
|
||||
"title" : "title",
|
||||
"status" : 0
|
||||
}"""),
|
||||
content_type="application/json",
|
||||
),
|
||||
|
||||
},
|
||||
),
|
||||
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@ -2,15 +2,36 @@
|
||||
|
||||
import json
|
||||
import unittest
|
||||
from typing import Any
|
||||
|
||||
from pydantic import BaseModel
|
||||
|
||||
|
||||
def _project_onto_constructed(expected: Any, constructed: Any) -> Any:
|
||||
"""Keep only example fields that appear in the constructed model output."""
|
||||
if isinstance(constructed, dict):
|
||||
if not isinstance(expected, dict):
|
||||
return expected
|
||||
return {
|
||||
key: _project_onto_constructed(expected.get(key), value)
|
||||
for key, value in constructed.items()
|
||||
}
|
||||
if isinstance(constructed, list):
|
||||
if not isinstance(expected, list):
|
||||
return expected
|
||||
return [
|
||||
_project_onto_constructed(expected[index], value)
|
||||
for index, value in enumerate(constructed)
|
||||
]
|
||||
return expected
|
||||
|
||||
|
||||
def assert_constructed_model_matches_example_json(model: BaseModel, loaded_json: dict):
|
||||
test_case = unittest.TestCase()
|
||||
test_case.maxDiff = None
|
||||
test_case.assertIsNotNone(model)
|
||||
constructed_json = json.loads(model.to_json())
|
||||
sorted_loaded_json = json.dumps(loaded_json, sort_keys=True)
|
||||
projected_loaded_json = _project_onto_constructed(loaded_json, constructed_json)
|
||||
sorted_loaded_json = json.dumps(projected_loaded_json, sort_keys=True)
|
||||
sorted_constructed_json = json.dumps(constructed_json, sort_keys=True)
|
||||
test_case.assertEqual(sorted_loaded_json, sorted_constructed_json)
|
||||
|
||||
@ -32,6 +32,9 @@ docs/ApiGraphletPoint.md
|
||||
docs/ApiGroupedBarchartWidget.md
|
||||
docs/ApiHeatmapWidget.md
|
||||
docs/ApiListWidget.md
|
||||
docs/ApiListWidgetRow.md
|
||||
docs/ApiListWidgetRowLinks.md
|
||||
docs/ApiListWidgetRowValue.md
|
||||
docs/ApiMultiMetricColumn.md
|
||||
docs/ApiMultiMetricColumnData.md
|
||||
docs/ApiMultiMetricTableWidget.md
|
||||
@ -52,6 +55,7 @@ docs/ApiTestTableData.md
|
||||
docs/ApiTestTableGraphletsData.md
|
||||
docs/ApiTestTableWidget.md
|
||||
docs/ApiTimeseriesWidget.md
|
||||
docs/ApiTimeseriesWidgetProperties.md
|
||||
docs/ApiWidget.md
|
||||
docs/ApiWidgetData.md
|
||||
docs/ApiWidgetDataPoint.md
|
||||
@ -103,6 +107,7 @@ docs/MultiMetricsTableDatasource.md
|
||||
docs/NumbersCardDatasource.md
|
||||
docs/PaginationLinks.md
|
||||
docs/PieChartDatasource.md
|
||||
docs/RefreshRate.md
|
||||
docs/ScalableWidget.md
|
||||
docs/SelfLinks.md
|
||||
docs/StackedAreaChartDatasource.md
|
||||
@ -159,6 +164,9 @@ src/thousandeyes_sdk/dashboards/models/api_graphlet_point.py
|
||||
src/thousandeyes_sdk/dashboards/models/api_grouped_barchart_widget.py
|
||||
src/thousandeyes_sdk/dashboards/models/api_heatmap_widget.py
|
||||
src/thousandeyes_sdk/dashboards/models/api_list_widget.py
|
||||
src/thousandeyes_sdk/dashboards/models/api_list_widget_row.py
|
||||
src/thousandeyes_sdk/dashboards/models/api_list_widget_row_links.py
|
||||
src/thousandeyes_sdk/dashboards/models/api_list_widget_row_value.py
|
||||
src/thousandeyes_sdk/dashboards/models/api_multi_metric_column.py
|
||||
src/thousandeyes_sdk/dashboards/models/api_multi_metric_column_data.py
|
||||
src/thousandeyes_sdk/dashboards/models/api_multi_metric_table_widget.py
|
||||
@ -179,6 +187,7 @@ src/thousandeyes_sdk/dashboards/models/api_test_table_data.py
|
||||
src/thousandeyes_sdk/dashboards/models/api_test_table_graphlets_data.py
|
||||
src/thousandeyes_sdk/dashboards/models/api_test_table_widget.py
|
||||
src/thousandeyes_sdk/dashboards/models/api_timeseries_widget.py
|
||||
src/thousandeyes_sdk/dashboards/models/api_timeseries_widget_properties.py
|
||||
src/thousandeyes_sdk/dashboards/models/api_widget.py
|
||||
src/thousandeyes_sdk/dashboards/models/api_widget_data.py
|
||||
src/thousandeyes_sdk/dashboards/models/api_widget_data_point.py
|
||||
@ -227,6 +236,7 @@ src/thousandeyes_sdk/dashboards/models/multi_metrics_table_datasource.py
|
||||
src/thousandeyes_sdk/dashboards/models/numbers_card_datasource.py
|
||||
src/thousandeyes_sdk/dashboards/models/pagination_links.py
|
||||
src/thousandeyes_sdk/dashboards/models/pie_chart_datasource.py
|
||||
src/thousandeyes_sdk/dashboards/models/refresh_rate.py
|
||||
src/thousandeyes_sdk/dashboards/models/scalable_widget.py
|
||||
src/thousandeyes_sdk/dashboards/models/self_links.py
|
||||
src/thousandeyes_sdk/dashboards/models/stacked_area_chart_datasource.py
|
||||
@ -246,7 +256,13 @@ src/thousandeyes_sdk/dashboards/models/widget_measure_type.py
|
||||
src/thousandeyes_sdk/dashboards/models/widget_position.py
|
||||
src/thousandeyes_sdk/dashboards/py.typed
|
||||
test/__init__.py
|
||||
test/conftest.py
|
||||
test/integration_test_utils.py
|
||||
test/mock_manifest.py
|
||||
test/test_dashboard_snapshots_api.py
|
||||
test/test_dashboard_snapshots_api_integration.py
|
||||
test/test_dashboards_api.py
|
||||
test/test_dashboards_api_integration.py
|
||||
test/test_dashboards_filters_api.py
|
||||
test/test_dashboards_filters_api_integration.py
|
||||
test/test_utils.py
|
||||
|
||||
@ -3,7 +3,7 @@ Manage ThousandEyes Dashboards.
|
||||
|
||||
This Python package is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project:
|
||||
|
||||
- API version: 7.0.96
|
||||
- API version: 7.0.99
|
||||
- Generator version: 7.6.0
|
||||
- Build package: com.thousandeyes.api.codegen.ThousandeyesPythonGenerator
|
||||
|
||||
@ -149,6 +149,9 @@ Class | Method | HTTP request | Description
|
||||
- [ApiGroupedBarchartWidget](https://github.com/thousandeyes/thousandeyes-sdk-python//tree/main/thousandeyes-sdk-dashboards/docs/ApiGroupedBarchartWidget.md)
|
||||
- [ApiHeatmapWidget](https://github.com/thousandeyes/thousandeyes-sdk-python//tree/main/thousandeyes-sdk-dashboards/docs/ApiHeatmapWidget.md)
|
||||
- [ApiListWidget](https://github.com/thousandeyes/thousandeyes-sdk-python//tree/main/thousandeyes-sdk-dashboards/docs/ApiListWidget.md)
|
||||
- [ApiListWidgetRow](https://github.com/thousandeyes/thousandeyes-sdk-python//tree/main/thousandeyes-sdk-dashboards/docs/ApiListWidgetRow.md)
|
||||
- [ApiListWidgetRowLinks](https://github.com/thousandeyes/thousandeyes-sdk-python//tree/main/thousandeyes-sdk-dashboards/docs/ApiListWidgetRowLinks.md)
|
||||
- [ApiListWidgetRowValue](https://github.com/thousandeyes/thousandeyes-sdk-python//tree/main/thousandeyes-sdk-dashboards/docs/ApiListWidgetRowValue.md)
|
||||
- [ApiMultiMetricColumn](https://github.com/thousandeyes/thousandeyes-sdk-python//tree/main/thousandeyes-sdk-dashboards/docs/ApiMultiMetricColumn.md)
|
||||
- [ApiMultiMetricColumnData](https://github.com/thousandeyes/thousandeyes-sdk-python//tree/main/thousandeyes-sdk-dashboards/docs/ApiMultiMetricColumnData.md)
|
||||
- [ApiMultiMetricTableWidget](https://github.com/thousandeyes/thousandeyes-sdk-python//tree/main/thousandeyes-sdk-dashboards/docs/ApiMultiMetricTableWidget.md)
|
||||
@ -169,6 +172,7 @@ Class | Method | HTTP request | Description
|
||||
- [ApiTestTableGraphletsData](https://github.com/thousandeyes/thousandeyes-sdk-python//tree/main/thousandeyes-sdk-dashboards/docs/ApiTestTableGraphletsData.md)
|
||||
- [ApiTestTableWidget](https://github.com/thousandeyes/thousandeyes-sdk-python//tree/main/thousandeyes-sdk-dashboards/docs/ApiTestTableWidget.md)
|
||||
- [ApiTimeseriesWidget](https://github.com/thousandeyes/thousandeyes-sdk-python//tree/main/thousandeyes-sdk-dashboards/docs/ApiTimeseriesWidget.md)
|
||||
- [ApiTimeseriesWidgetProperties](https://github.com/thousandeyes/thousandeyes-sdk-python//tree/main/thousandeyes-sdk-dashboards/docs/ApiTimeseriesWidgetProperties.md)
|
||||
- [ApiWidget](https://github.com/thousandeyes/thousandeyes-sdk-python//tree/main/thousandeyes-sdk-dashboards/docs/ApiWidget.md)
|
||||
- [ApiWidgetData](https://github.com/thousandeyes/thousandeyes-sdk-python//tree/main/thousandeyes-sdk-dashboards/docs/ApiWidgetData.md)
|
||||
- [ApiWidgetDataPoint](https://github.com/thousandeyes/thousandeyes-sdk-python//tree/main/thousandeyes-sdk-dashboards/docs/ApiWidgetDataPoint.md)
|
||||
@ -217,6 +221,7 @@ Class | Method | HTTP request | Description
|
||||
- [NumbersCardDatasource](https://github.com/thousandeyes/thousandeyes-sdk-python//tree/main/thousandeyes-sdk-dashboards/docs/NumbersCardDatasource.md)
|
||||
- [PaginationLinks](https://github.com/thousandeyes/thousandeyes-sdk-python//tree/main/thousandeyes-sdk-dashboards/docs/PaginationLinks.md)
|
||||
- [PieChartDatasource](https://github.com/thousandeyes/thousandeyes-sdk-python//tree/main/thousandeyes-sdk-dashboards/docs/PieChartDatasource.md)
|
||||
- [RefreshRate](https://github.com/thousandeyes/thousandeyes-sdk-python//tree/main/thousandeyes-sdk-dashboards/docs/RefreshRate.md)
|
||||
- [ScalableWidget](https://github.com/thousandeyes/thousandeyes-sdk-python//tree/main/thousandeyes-sdk-dashboards/docs/ScalableWidget.md)
|
||||
- [SelfLinks](https://github.com/thousandeyes/thousandeyes-sdk-python//tree/main/thousandeyes-sdk-dashboards/docs/SelfLinks.md)
|
||||
- [StackedAreaChartDatasource](https://github.com/thousandeyes/thousandeyes-sdk-python//tree/main/thousandeyes-sdk-dashboards/docs/StackedAreaChartDatasource.md)
|
||||
|
||||
@ -30,6 +30,7 @@ Name | Type | Description | Notes
|
||||
**is_global_override** | **bool** | When set to `true`, the defaultTimespan is used and overrides the widget's timespan. If set to `false`, the the widget's timespan is used. | [optional]
|
||||
**is_migrated_report** | **bool** | True if this dashboard was previously a report. | [optional] [readonly]
|
||||
**layout** | [**DashboardLayout**](DashboardLayout.md) | | [optional]
|
||||
**refresh_rate** | [**RefreshRate**](RefreshRate.md) | | [optional]
|
||||
**links** | [**DashboardLinks**](DashboardLinks.md) | | [optional]
|
||||
|
||||
## Example
|
||||
|
||||
30
thousandeyes-sdk-dashboards/docs/ApiListWidgetRow.md
Normal file
30
thousandeyes-sdk-dashboards/docs/ApiListWidgetRow.md
Normal file
@ -0,0 +1,30 @@
|
||||
# ApiListWidgetRow
|
||||
|
||||
A row in a **List** widget. Property names are dimension display labels mapped to their values for that row.
|
||||
|
||||
## Properties
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
**links** | [**ApiListWidgetRowLinks**](ApiListWidgetRowLinks.md) | | [optional]
|
||||
|
||||
## Example
|
||||
|
||||
```python
|
||||
from thousandeyes_sdk.dashboards.models.api_list_widget_row import ApiListWidgetRow
|
||||
|
||||
# TODO update the JSON string below
|
||||
json = "{}"
|
||||
# create an instance of ApiListWidgetRow from a JSON string
|
||||
api_list_widget_row_instance = ApiListWidgetRow.from_json(json)
|
||||
# print the JSON string representation of the object
|
||||
print(ApiListWidgetRow.to_json())
|
||||
|
||||
# convert the object into a dict
|
||||
api_list_widget_row_dict = api_list_widget_row_instance.to_dict()
|
||||
# create an instance of ApiListWidgetRow from a dict
|
||||
api_list_widget_row_from_dict = ApiListWidgetRow.from_dict(api_list_widget_row_dict)
|
||||
```
|
||||
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
|
||||
|
||||
|
||||
30
thousandeyes-sdk-dashboards/docs/ApiListWidgetRowLinks.md
Normal file
30
thousandeyes-sdk-dashboards/docs/ApiListWidgetRowLinks.md
Normal file
@ -0,0 +1,30 @@
|
||||
# ApiListWidgetRowLinks
|
||||
|
||||
Links for a **List** widget row.
|
||||
|
||||
## Properties
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
**data** | [**Link**](Link.md) | | [optional]
|
||||
|
||||
## Example
|
||||
|
||||
```python
|
||||
from thousandeyes_sdk.dashboards.models.api_list_widget_row_links import ApiListWidgetRowLinks
|
||||
|
||||
# TODO update the JSON string below
|
||||
json = "{}"
|
||||
# create an instance of ApiListWidgetRowLinks from a JSON string
|
||||
api_list_widget_row_links_instance = ApiListWidgetRowLinks.from_json(json)
|
||||
# print the JSON string representation of the object
|
||||
print(ApiListWidgetRowLinks.to_json())
|
||||
|
||||
# convert the object into a dict
|
||||
api_list_widget_row_links_dict = api_list_widget_row_links_instance.to_dict()
|
||||
# create an instance of ApiListWidgetRowLinks from a dict
|
||||
api_list_widget_row_links_from_dict = ApiListWidgetRowLinks.from_dict(api_list_widget_row_links_dict)
|
||||
```
|
||||
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
|
||||
|
||||
|
||||
29
thousandeyes-sdk-dashboards/docs/ApiListWidgetRowValue.md
Normal file
29
thousandeyes-sdk-dashboards/docs/ApiListWidgetRowValue.md
Normal file
@ -0,0 +1,29 @@
|
||||
# ApiListWidgetRowValue
|
||||
|
||||
Dimension display label mapped to its value for this row.
|
||||
|
||||
## Properties
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
|
||||
## Example
|
||||
|
||||
```python
|
||||
from thousandeyes_sdk.dashboards.models.api_list_widget_row_value import ApiListWidgetRowValue
|
||||
|
||||
# TODO update the JSON string below
|
||||
json = "{}"
|
||||
# create an instance of ApiListWidgetRowValue from a JSON string
|
||||
api_list_widget_row_value_instance = ApiListWidgetRowValue.from_json(json)
|
||||
# print the JSON string representation of the object
|
||||
print(ApiListWidgetRowValue.to_json())
|
||||
|
||||
# convert the object into a dict
|
||||
api_list_widget_row_value_dict = api_list_widget_row_value_instance.to_dict()
|
||||
# create an instance of ApiListWidgetRowValue from a dict
|
||||
api_list_widget_row_value_from_dict = ApiListWidgetRowValue.from_dict(api_list_widget_row_value_dict)
|
||||
```
|
||||
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
|
||||
|
||||
|
||||
@ -24,9 +24,10 @@ Name | Type | Description | Notes
|
||||
**max_scale** | **float** | Maximum scale configured in the widget. | [optional]
|
||||
**unit** | [**ApiWidgetFixedYScalePrefix**](ApiWidgetFixedYScalePrefix.md) | | [optional]
|
||||
**type** | **str** | Time Series: Line widget type. |
|
||||
**show_timeseries_overall_baseline** | **bool** | Displays the overall baseline if set to `true`. | [optional]
|
||||
**show_timeseries_overall_baseline** | **bool** | Displays the overall baseline when set to `true`. | [optional] [default to False]
|
||||
**group_by** | [**ApiAggregateProperty**](ApiAggregateProperty.md) | | [optional]
|
||||
**is_timeseries_one_chart_per_line** | **bool** | Displays a separate chart for each line if set to `true`. | [optional]
|
||||
**is_timeseries_one_chart_per_line** | **bool** | Displays a separate chart for each line when set to `true`. | [optional] [default to False]
|
||||
**show_zoom_slider** | **bool** | Displays the zoom slider on the time axis when set to `true`. | [optional] [default to False]
|
||||
**data_source** | [**TimeseriesDatasource**](TimeseriesDatasource.md) | | [optional]
|
||||
|
||||
## Example
|
||||
|
||||
@ -0,0 +1,34 @@
|
||||
# ApiTimeseriesWidgetProperties
|
||||
|
||||
|
||||
## Properties
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
**type** | **str** | Time Series: Line widget type. |
|
||||
**show_timeseries_overall_baseline** | **bool** | Displays the overall baseline when set to `true`. | [optional] [default to False]
|
||||
**group_by** | [**ApiAggregateProperty**](ApiAggregateProperty.md) | | [optional]
|
||||
**is_timeseries_one_chart_per_line** | **bool** | Displays a separate chart for each line when set to `true`. | [optional] [default to False]
|
||||
**show_zoom_slider** | **bool** | Displays the zoom slider on the time axis when set to `true`. | [optional] [default to False]
|
||||
**data_source** | [**TimeseriesDatasource**](TimeseriesDatasource.md) | | [optional]
|
||||
|
||||
## Example
|
||||
|
||||
```python
|
||||
from thousandeyes_sdk.dashboards.models.api_timeseries_widget_properties import ApiTimeseriesWidgetProperties
|
||||
|
||||
# TODO update the JSON string below
|
||||
json = "{}"
|
||||
# create an instance of ApiTimeseriesWidgetProperties from a JSON string
|
||||
api_timeseries_widget_properties_instance = ApiTimeseriesWidgetProperties.from_json(json)
|
||||
# print the JSON string representation of the object
|
||||
print(ApiTimeseriesWidgetProperties.to_json())
|
||||
|
||||
# convert the object into a dict
|
||||
api_timeseries_widget_properties_dict = api_timeseries_widget_properties_instance.to_dict()
|
||||
# create an instance of ApiTimeseriesWidgetProperties from a dict
|
||||
api_timeseries_widget_properties_from_dict = ApiTimeseriesWidgetProperties.from_dict(api_timeseries_widget_properties_dict)
|
||||
```
|
||||
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
|
||||
|
||||
|
||||
@ -50,8 +50,9 @@ Name | Type | Description | Notes
|
||||
**show_submetrics** | **bool** | Controls how metrics with submetric components are displayed. If `true` (default), the widget displays one chart per group. If `false`, the widget displays all submetrics in a single chart. For metrics without submetric components, this field is ignored and returned as `null`. | [optional] [default to True]
|
||||
**filter** | [**ApiWidgetFilterApiTestTableFilterKey**](ApiWidgetFilterApiTestTableFilterKey.md) | | [optional]
|
||||
**exclude** | [**ApiWidgetFilterApiTestTableFilterKey**](ApiWidgetFilterApiTestTableFilterKey.md) | | [optional]
|
||||
**show_timeseries_overall_baseline** | **bool** | Displays the overall baseline if set to `true`. | [optional]
|
||||
**is_timeseries_one_chart_per_line** | **bool** | Displays a separate chart for each line if set to `true`. | [optional]
|
||||
**show_timeseries_overall_baseline** | **bool** | Displays the overall baseline when set to `true`. | [optional] [default to False]
|
||||
**is_timeseries_one_chart_per_line** | **bool** | Displays a separate chart for each line when set to `true`. | [optional] [default to False]
|
||||
**show_zoom_slider** | **bool** | Displays the zoom slider on the time axis when set to `true`. | [optional] [default to False]
|
||||
|
||||
## Example
|
||||
|
||||
|
||||
@ -17,6 +17,8 @@ Name | Type | Description | Notes
|
||||
**alerts** | [**List[ApiAlertListAlert]**](ApiAlertListAlert.md) | | [optional]
|
||||
**summary** | [**ApiAgentStatusSummary**](ApiAgentStatusSummary.md) | | [optional]
|
||||
**agents** | [**List[ApiAgentStatusAgent]**](ApiAgentStatusAgent.md) | | [optional]
|
||||
**rows** | [**List[ApiListWidgetRow]**](ApiListWidgetRow.md) | Detailed information about each row in the **List** widget. | [optional]
|
||||
**legend** | **Dict[str, int]** | Map of legend labels to their counts for the **List** widget. | [optional]
|
||||
**status** | **str** | Message for not fully configured card or no data. | [optional]
|
||||
|
||||
## Example
|
||||
|
||||
@ -23,6 +23,7 @@ Name | Type | Description | Notes
|
||||
**is_global_override** | **bool** | When set to `true`, the defaultTimespan is used and overrides the widget's timespan. If set to `false`, the the widget's timespan is used. | [optional]
|
||||
**is_migrated_report** | **bool** | True if this dashboard was previously a report. | [optional] [readonly]
|
||||
**layout** | [**DashboardLayout**](DashboardLayout.md) | | [optional]
|
||||
**refresh_rate** | [**RefreshRate**](RefreshRate.md) | | [optional]
|
||||
**links** | [**DashboardLinks**](DashboardLinks.md) | | [optional]
|
||||
|
||||
## Example
|
||||
|
||||
@ -316,7 +316,7 @@ with thousandeyes_sdk.core.ApiClient(configuration) as api_client:
|
||||
max = 10 # float | Optionally specify the maximum number of objects to retrieve. This only applies to the **Alert List** and **Test Table** Widgets. * The default for the **Alert List** widget is set by its limitBy configuration. * The default value for the **Test Table** widget is 10. (optional)
|
||||
cursor = 'bGFzdFJvdW5kSWQ9MTY4MTQxMDQ4MA' # str | An optional pagination cursor. This parameter should not not be used directly. Instead, use the `_links` returned by the API. This feature is only available in the **Test Table** widget. (optional)
|
||||
sort = 'alertStatus' # str | Optional sorting parameter with attributes listed comma-separated. This only applies to the **Alert List** and **Test Table** Widgets. * For the **Alert List** widget, you can sort by `alertStatus` or `startTime`. The default is `alertStatus`. * For the **Test Table** widget, you can sort by `alertStatus`, `testName`, or `testType`. The sequence might vary from the web application. The default sort attribute is `alertStatus`. (optional)
|
||||
order = thousandeyes_sdk.dashboards.DashboardOrder() # DashboardOrder | Optional sorting order parameter that accepts either `asc` (ascending) or `desc` (descending) values. This only applies to the **Alert List** and **Test Table** Widgets. (optional)
|
||||
order = 'asc' # DashboardOrder | Optional sorting order parameter that accepts either `asc` (ascending) or `desc` (descending) values. This only applies to the **Alert List** and **Test Table** Widgets. (optional)
|
||||
|
||||
try:
|
||||
# Retrieve dashboard widget data
|
||||
|
||||
12
thousandeyes-sdk-dashboards/docs/RefreshRate.md
Normal file
12
thousandeyes-sdk-dashboards/docs/RefreshRate.md
Normal file
@ -0,0 +1,12 @@
|
||||
# RefreshRate
|
||||
|
||||
Auto-refresh interval for a dashboard. Use `off` to disable auto-refresh.
|
||||
|
||||
## Properties
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
|
||||
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
|
||||
|
||||
|
||||
@ -51,6 +51,9 @@ from thousandeyes_sdk.dashboards.models.api_graphlet_point import ApiGraphletPoi
|
||||
from thousandeyes_sdk.dashboards.models.api_grouped_barchart_widget import ApiGroupedBarchartWidget
|
||||
from thousandeyes_sdk.dashboards.models.api_heatmap_widget import ApiHeatmapWidget
|
||||
from thousandeyes_sdk.dashboards.models.api_list_widget import ApiListWidget
|
||||
from thousandeyes_sdk.dashboards.models.api_list_widget_row import ApiListWidgetRow
|
||||
from thousandeyes_sdk.dashboards.models.api_list_widget_row_links import ApiListWidgetRowLinks
|
||||
from thousandeyes_sdk.dashboards.models.api_list_widget_row_value import ApiListWidgetRowValue
|
||||
from thousandeyes_sdk.dashboards.models.api_multi_metric_column import ApiMultiMetricColumn
|
||||
from thousandeyes_sdk.dashboards.models.api_multi_metric_column_data import ApiMultiMetricColumnData
|
||||
from thousandeyes_sdk.dashboards.models.api_multi_metric_table_widget import ApiMultiMetricTableWidget
|
||||
@ -71,6 +74,7 @@ from thousandeyes_sdk.dashboards.models.api_test_table_data import ApiTestTableD
|
||||
from thousandeyes_sdk.dashboards.models.api_test_table_graphlets_data import ApiTestTableGraphletsData
|
||||
from thousandeyes_sdk.dashboards.models.api_test_table_widget import ApiTestTableWidget
|
||||
from thousandeyes_sdk.dashboards.models.api_timeseries_widget import ApiTimeseriesWidget
|
||||
from thousandeyes_sdk.dashboards.models.api_timeseries_widget_properties import ApiTimeseriesWidgetProperties
|
||||
from thousandeyes_sdk.dashboards.models.api_widget import ApiWidget
|
||||
from thousandeyes_sdk.dashboards.models.api_widget_data import ApiWidgetData
|
||||
from thousandeyes_sdk.dashboards.models.api_widget_data_point import ApiWidgetDataPoint
|
||||
@ -119,6 +123,7 @@ from thousandeyes_sdk.dashboards.models.multi_metrics_table_datasource import Mu
|
||||
from thousandeyes_sdk.dashboards.models.numbers_card_datasource import NumbersCardDatasource
|
||||
from thousandeyes_sdk.dashboards.models.pagination_links import PaginationLinks
|
||||
from thousandeyes_sdk.dashboards.models.pie_chart_datasource import PieChartDatasource
|
||||
from thousandeyes_sdk.dashboards.models.refresh_rate import RefreshRate
|
||||
from thousandeyes_sdk.dashboards.models.scalable_widget import ScalableWidget
|
||||
from thousandeyes_sdk.dashboards.models.self_links import SelfLinks
|
||||
from thousandeyes_sdk.dashboards.models.stacked_area_chart_datasource import StackedAreaChartDatasource
|
||||
|
||||
@ -44,6 +44,9 @@ from thousandeyes_sdk.dashboards.models.api_graphlet_point import ApiGraphletPoi
|
||||
from thousandeyes_sdk.dashboards.models.api_grouped_barchart_widget import ApiGroupedBarchartWidget
|
||||
from thousandeyes_sdk.dashboards.models.api_heatmap_widget import ApiHeatmapWidget
|
||||
from thousandeyes_sdk.dashboards.models.api_list_widget import ApiListWidget
|
||||
from thousandeyes_sdk.dashboards.models.api_list_widget_row import ApiListWidgetRow
|
||||
from thousandeyes_sdk.dashboards.models.api_list_widget_row_links import ApiListWidgetRowLinks
|
||||
from thousandeyes_sdk.dashboards.models.api_list_widget_row_value import ApiListWidgetRowValue
|
||||
from thousandeyes_sdk.dashboards.models.api_multi_metric_column import ApiMultiMetricColumn
|
||||
from thousandeyes_sdk.dashboards.models.api_multi_metric_column_data import ApiMultiMetricColumnData
|
||||
from thousandeyes_sdk.dashboards.models.api_multi_metric_table_widget import ApiMultiMetricTableWidget
|
||||
@ -64,6 +67,7 @@ from thousandeyes_sdk.dashboards.models.api_test_table_data import ApiTestTableD
|
||||
from thousandeyes_sdk.dashboards.models.api_test_table_graphlets_data import ApiTestTableGraphletsData
|
||||
from thousandeyes_sdk.dashboards.models.api_test_table_widget import ApiTestTableWidget
|
||||
from thousandeyes_sdk.dashboards.models.api_timeseries_widget import ApiTimeseriesWidget
|
||||
from thousandeyes_sdk.dashboards.models.api_timeseries_widget_properties import ApiTimeseriesWidgetProperties
|
||||
from thousandeyes_sdk.dashboards.models.api_widget import ApiWidget
|
||||
from thousandeyes_sdk.dashboards.models.api_widget_data import ApiWidgetData
|
||||
from thousandeyes_sdk.dashboards.models.api_widget_data_point import ApiWidgetDataPoint
|
||||
@ -112,6 +116,7 @@ from thousandeyes_sdk.dashboards.models.multi_metrics_table_datasource import Mu
|
||||
from thousandeyes_sdk.dashboards.models.numbers_card_datasource import NumbersCardDatasource
|
||||
from thousandeyes_sdk.dashboards.models.pagination_links import PaginationLinks
|
||||
from thousandeyes_sdk.dashboards.models.pie_chart_datasource import PieChartDatasource
|
||||
from thousandeyes_sdk.dashboards.models.refresh_rate import RefreshRate
|
||||
from thousandeyes_sdk.dashboards.models.scalable_widget import ScalableWidget
|
||||
from thousandeyes_sdk.dashboards.models.self_links import SelfLinks
|
||||
from thousandeyes_sdk.dashboards.models.stacked_area_chart_datasource import StackedAreaChartDatasource
|
||||
|
||||
@ -23,6 +23,7 @@ from thousandeyes_sdk.dashboards.models.api_widget import ApiWidget
|
||||
from thousandeyes_sdk.dashboards.models.dashboard_layout import DashboardLayout
|
||||
from thousandeyes_sdk.dashboards.models.dashboard_links import DashboardLinks
|
||||
from thousandeyes_sdk.dashboards.models.default_timespan import DefaultTimespan
|
||||
from thousandeyes_sdk.dashboards.models.refresh_rate import RefreshRate
|
||||
from typing import Optional, Set
|
||||
from typing_extensions import Self
|
||||
|
||||
@ -54,8 +55,9 @@ class ApiDashboard(BaseModel):
|
||||
is_global_override: Optional[StrictBool] = Field(default=None, description="When set to `true`, the defaultTimespan is used and overrides the widget's timespan. If set to `false`, the the widget's timespan is used.", alias="isGlobalOverride")
|
||||
is_migrated_report: Optional[StrictBool] = Field(default=None, description="True if this dashboard was previously a report.", alias="isMigratedReport")
|
||||
layout: Optional[DashboardLayout] = None
|
||||
refresh_rate: Optional[RefreshRate] = Field(default=None, alias="refreshRate")
|
||||
links: Optional[DashboardLinks] = Field(default=None, alias="_links")
|
||||
__properties: ClassVar[List[str]] = ["globalFilterId", "accountId", "createdBy", "modifiedBy", "modifiedDate", "globalOverride", "migratedReport", "apiLink", "dashboardId", "title", "isBuiltIn", "aid", "dashboardCreatedBy", "dashboardModifiedBy", "dashboardModifiedDate", "isPrivate", "isDefaultForUser", "isDefaultForAccount", "widgets", "description", "defaultTimespan", "isGlobalOverride", "isMigratedReport", "layout", "_links"]
|
||||
__properties: ClassVar[List[str]] = ["globalFilterId", "accountId", "createdBy", "modifiedBy", "modifiedDate", "globalOverride", "migratedReport", "apiLink", "dashboardId", "title", "isBuiltIn", "aid", "dashboardCreatedBy", "dashboardModifiedBy", "dashboardModifiedDate", "isPrivate", "isDefaultForUser", "isDefaultForAccount", "widgets", "description", "defaultTimespan", "isGlobalOverride", "isMigratedReport", "layout", "refreshRate", "_links"]
|
||||
|
||||
model_config = ConfigDict(
|
||||
populate_by_name=True,
|
||||
@ -177,6 +179,7 @@ class ApiDashboard(BaseModel):
|
||||
"isGlobalOverride": obj.get("isGlobalOverride"),
|
||||
"isMigratedReport": obj.get("isMigratedReport"),
|
||||
"layout": DashboardLayout.from_dict(obj["layout"]) if obj.get("layout") is not None else None,
|
||||
"refreshRate": obj.get("refreshRate"),
|
||||
"_links": DashboardLinks.from_dict(obj["_links"]) if obj.get("_links") is not None else None
|
||||
})
|
||||
return _obj
|
||||
|
||||
@ -0,0 +1,104 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
Dashboards API
|
||||
|
||||
Manage ThousandEyes Dashboards.
|
||||
|
||||
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
||||
|
||||
Do not edit the class manually.
|
||||
""" # noqa: E501
|
||||
|
||||
|
||||
from __future__ import annotations
|
||||
import pprint
|
||||
import re # noqa: F401
|
||||
import json
|
||||
|
||||
from pydantic import BaseModel, ConfigDict, Field
|
||||
from typing import Any, ClassVar, Dict, List, Optional
|
||||
from thousandeyes_sdk.dashboards.models.api_list_widget_row_links import ApiListWidgetRowLinks
|
||||
from typing import Optional, Set
|
||||
from typing_extensions import Self
|
||||
|
||||
class ApiListWidgetRow(BaseModel):
|
||||
"""
|
||||
A row in a **List** widget. Property names are dimension display labels mapped to their values for that row.
|
||||
""" # noqa: E501
|
||||
links: Optional[ApiListWidgetRowLinks] = Field(default=None, alias="_links")
|
||||
additional_properties: Dict[str, Any] = {}
|
||||
__properties: ClassVar[List[str]] = ["_links"]
|
||||
|
||||
model_config = ConfigDict(
|
||||
populate_by_name=True,
|
||||
validate_assignment=True,
|
||||
protected_namespaces=(),
|
||||
extra="allow",
|
||||
)
|
||||
|
||||
|
||||
def to_str(self) -> str:
|
||||
"""Returns the string representation of the model using alias"""
|
||||
return pprint.pformat(self.model_dump(by_alias=True))
|
||||
|
||||
def to_json(self) -> str:
|
||||
"""Returns the JSON representation of the model using alias"""
|
||||
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
||||
return self.model_dump_json(by_alias=True, exclude_unset=True, exclude_none=True)
|
||||
|
||||
@classmethod
|
||||
def from_json(cls, json_str: str) -> Optional[Self]:
|
||||
"""Create an instance of ApiListWidgetRow from a JSON string"""
|
||||
return cls.from_dict(json.loads(json_str))
|
||||
|
||||
def to_dict(self) -> Dict[str, Any]:
|
||||
"""Return the dictionary representation of the model using alias.
|
||||
|
||||
This has the following differences from calling pydantic's
|
||||
`self.model_dump(by_alias=True)`:
|
||||
|
||||
* `None` is only added to the output dict for nullable fields that
|
||||
were set at model initialization. Other fields with value `None`
|
||||
are ignored.
|
||||
* Fields in `self.additional_properties` are added to the output dict.
|
||||
"""
|
||||
excluded_fields: Set[str] = set([
|
||||
"additional_properties",
|
||||
])
|
||||
|
||||
_dict = self.model_dump(
|
||||
by_alias=True,
|
||||
exclude=excluded_fields,
|
||||
exclude_none=True,
|
||||
)
|
||||
# override the default output from pydantic by calling `to_dict()` of links
|
||||
if self.links:
|
||||
_dict['_links'] = self.links.to_dict()
|
||||
# puts key-value pairs in additional_properties in the top level
|
||||
if self.additional_properties is not None:
|
||||
for _key, _value in self.additional_properties.items():
|
||||
_dict[_key] = _value
|
||||
|
||||
return _dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
||||
"""Create an instance of ApiListWidgetRow from a dict"""
|
||||
if obj is None:
|
||||
return None
|
||||
|
||||
if not isinstance(obj, dict):
|
||||
return cls.model_validate(obj)
|
||||
|
||||
_obj = cls.model_validate({
|
||||
"_links": ApiListWidgetRowLinks.from_dict(obj["_links"]) if obj.get("_links") is not None else None
|
||||
})
|
||||
# store additional fields in additional_properties
|
||||
for _key in obj.keys():
|
||||
if _key not in cls.__properties:
|
||||
_obj.additional_properties[_key] = obj.get(_key)
|
||||
|
||||
return _obj
|
||||
|
||||
|
||||
@ -0,0 +1,91 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
Dashboards API
|
||||
|
||||
Manage ThousandEyes Dashboards.
|
||||
|
||||
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
||||
|
||||
Do not edit the class manually.
|
||||
""" # noqa: E501
|
||||
|
||||
|
||||
from __future__ import annotations
|
||||
import pprint
|
||||
import re # noqa: F401
|
||||
import json
|
||||
|
||||
from pydantic import BaseModel, ConfigDict
|
||||
from typing import Any, ClassVar, Dict, List, Optional
|
||||
from thousandeyes_sdk.dashboards.models.link import Link
|
||||
from typing import Optional, Set
|
||||
from typing_extensions import Self
|
||||
|
||||
class ApiListWidgetRowLinks(BaseModel):
|
||||
"""
|
||||
Links for a **List** widget row.
|
||||
""" # noqa: E501
|
||||
data: Optional[Link] = None
|
||||
__properties: ClassVar[List[str]] = ["data"]
|
||||
|
||||
model_config = ConfigDict(
|
||||
populate_by_name=True,
|
||||
validate_assignment=True,
|
||||
protected_namespaces=(),
|
||||
extra="allow",
|
||||
)
|
||||
|
||||
|
||||
def to_str(self) -> str:
|
||||
"""Returns the string representation of the model using alias"""
|
||||
return pprint.pformat(self.model_dump(by_alias=True))
|
||||
|
||||
def to_json(self) -> str:
|
||||
"""Returns the JSON representation of the model using alias"""
|
||||
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
||||
return self.model_dump_json(by_alias=True, exclude_unset=True, exclude_none=True)
|
||||
|
||||
@classmethod
|
||||
def from_json(cls, json_str: str) -> Optional[Self]:
|
||||
"""Create an instance of ApiListWidgetRowLinks from a JSON string"""
|
||||
return cls.from_dict(json.loads(json_str))
|
||||
|
||||
def to_dict(self) -> Dict[str, Any]:
|
||||
"""Return the dictionary representation of the model using alias.
|
||||
|
||||
This has the following differences from calling pydantic's
|
||||
`self.model_dump(by_alias=True)`:
|
||||
|
||||
* `None` is only added to the output dict for nullable fields that
|
||||
were set at model initialization. Other fields with value `None`
|
||||
are ignored.
|
||||
"""
|
||||
excluded_fields: Set[str] = set([
|
||||
])
|
||||
|
||||
_dict = self.model_dump(
|
||||
by_alias=True,
|
||||
exclude=excluded_fields,
|
||||
exclude_none=True,
|
||||
)
|
||||
# override the default output from pydantic by calling `to_dict()` of data
|
||||
if self.data:
|
||||
_dict['data'] = self.data.to_dict()
|
||||
return _dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
||||
"""Create an instance of ApiListWidgetRowLinks from a dict"""
|
||||
if obj is None:
|
||||
return None
|
||||
|
||||
if not isinstance(obj, dict):
|
||||
return cls.model_validate(obj)
|
||||
|
||||
_obj = cls.model_validate({
|
||||
"data": Link.from_dict(obj["data"]) if obj.get("data") is not None else None
|
||||
})
|
||||
return _obj
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user