mirror of
https://github.com/thousandeyes/thousandeyes-sdk-python.git
synced 2026-09-19 08:03:56 +00:00
Some checks failed
Python CI / build (push) Has been cancelled
Co-authored-by: API Team <api-team@thousandeyes.com>
2904 lines
117 KiB
Python
2904 lines
117 KiB
Python
# coding: utf-8
|
|
|
|
"""
|
|
Cloud Insights Integrations API
|
|
|
|
**Note:** All Cloud Insights APIs are not available for ThousandEyes for Government instance. The Cloud Insights Integrations API lets you programmatically manage **AWS** and **Azure** monitoring integrations in ThousandEyes. ### What You Can Do - **List** all integrations. - **Get** details for a specific integration. - **Delete** an existing integration. - **Create** integrations for: - **AWS**: inventory monitoring and flow logs monitoring. - **Azure**: inventory monitoring and flow logs monitoring. - **Update** integrations for: - **Azure**: inventory monitoring and flow logs monitoring. - **Fetch AWS IAM policy documents** required to configure AWS inventory and flow-logs integrations. - **Retrieve** the current AWS and Azure integration policy settings to understand which AWS and Azure resource groups, AWS regions, Azure subscription rules are enabled and whether CloudTrail is enabled for Cloud Insights for inventory monitoring. - **Update** policy settings to change the approved AWS resource groups, AWS regions, and Azure subscription rules that ThousandEyes should inventory. ### Scope and Tenancy All operations are scoped to the authenticated account group. Responses include only resources associated with that group. ### Payloads and formats - **Requests:** `application/json` - **Responses:** primarily `application/hal+json` for resource representations and `application/json` for policy documents. - HAL responses include `_links` with a `self` relation for direct navigation. ### Integration Types - **Inventory monitoring** - AWS: reads inventory and network topology via read-only IAM permissions. - Azure: authenticates with a Service Principal to read inventory and network topology. - **Flow logs monitoring** - AWS: reads flow logs from S3 buckets and uses SNS for notifications. - Azure: reads flow logs via **Service Bus Queue** (`serviceBusQueueUrl`). ### Policy Helpers (AWS) Dedicated endpoints return **Trusted Policy**, **Permissions Policy**, and **SNS Topic Access Policy** documents to simplify role setup for inventory and flow logs integrations. ### Notes - All example values in this specification are **fictitious**. For more information about Cloud Insights, see [Cloud Insights](https://docs.thousandeyes.com/product-documentation/cloud-insights).
|
|
|
|
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
|
|
|
Do not edit the class manually.
|
|
""" # noqa: E501
|
|
|
|
|
|
import json
|
|
import unittest
|
|
import thousandeyes_sdk.cloud_insights_integrations.models
|
|
|
|
from thousandeyes_sdk.core.exceptions import ApiException
|
|
from thousandeyes_sdk.cloud_insights_integrations.api.cloud_insights_integrations_api import CloudInsightsIntegrationsApi
|
|
from .integration_test_utils import IntegrationTestBase
|
|
from .test_utils import assert_constructed_model_matches_example_json
|
|
|
|
|
|
class TestCloudInsightsIntegrationsApiIntegration(IntegrationTestBase):
|
|
"""CloudInsightsIntegrationsApi integration test stubs"""
|
|
|
|
def setUp(self) -> None:
|
|
super().setUp()
|
|
self.api = CloudInsightsIntegrationsApi(self.api_client)
|
|
|
|
|
|
def test_create_aws_flow_logs_monitoring_integration_happy_path(self) -> None:
|
|
"""Integration test for create_aws_flow_logs_monitoring_integration success path"""
|
|
request_body_json = """
|
|
|
|
{
|
|
"roleArn" : "arn:aws:iam::01234567890:role/aws-flow-logs-ro",
|
|
"name" : "integration name",
|
|
"snsTopicsArns" : [ "arn:aws:sns:us-east-1:01234567890:SNS-Topic-US", "arn:aws:sns:eu-central-1:01234567890:SNS-Topic-EU" ]
|
|
}
|
|
|
|
"""
|
|
aws_flow_logs_integration_request = thousandeyes_sdk.cloud_insights_integrations.models.AwsFlowLogsIntegrationRequest.from_json(request_body_json)
|
|
aid = '1234'
|
|
response_body_json = """
|
|
{
|
|
"monitoringType" : "inventory-monitoring",
|
|
"_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"
|
|
}
|
|
},
|
|
"roleArn" : "arn:aws:iam::01234567890:role/aws-monitoring-ro",
|
|
"name" : "integration name",
|
|
"externalId" : "37d8f861cffd34212b5a34466564da1f80b01a30",
|
|
"snsTopicsArns" : [ "arn:aws:sns:us-east-1:01234567890:SNS-Topic-US", "arn:aws:sns:eu-central-1:01234567890:SNS-Topic-EU" ],
|
|
"id" : "e9c3bf02-a48c-4aa8-9e5f-898800d6f569"
|
|
}
|
|
"""
|
|
expected_response = json.loads(response_body_json)
|
|
response = self.api.create_aws_flow_logs_monitoring_integration(
|
|
|
|
aws_flow_logs_integration_request=aws_flow_logs_integration_request,
|
|
|
|
aid=aid,
|
|
|
|
_headers=self.te_headers("create_aws_flow_logs_monitoring_integration"),
|
|
)
|
|
assert_constructed_model_matches_example_json(response, expected_response)
|
|
|
|
|
|
def test_create_aws_flow_logs_monitoring_integration_error_400(self) -> None:
|
|
"""Integration test for create_aws_flow_logs_monitoring_integration error path (HTTP 400)"""
|
|
request_body_json = """
|
|
|
|
{
|
|
"roleArn" : "arn:aws:iam::01234567890:role/aws-flow-logs-ro",
|
|
"name" : "integration name",
|
|
"snsTopicsArns" : [ "arn:aws:sns:us-east-1:01234567890:SNS-Topic-US", "arn:aws:sns:eu-central-1:01234567890:SNS-Topic-EU" ]
|
|
}
|
|
|
|
"""
|
|
aws_flow_logs_integration_request = thousandeyes_sdk.cloud_insights_integrations.models.AwsFlowLogsIntegrationRequest.from_json(request_body_json)
|
|
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.create_aws_flow_logs_monitoring_integration(
|
|
|
|
aws_flow_logs_integration_request=aws_flow_logs_integration_request,
|
|
|
|
aid=aid,
|
|
|
|
_headers=self.te_headers("create_aws_flow_logs_monitoring_integration", error_status="400"),
|
|
)
|
|
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
|
|
|
|
|
|
def test_create_aws_flow_logs_monitoring_integration_error_401(self) -> None:
|
|
"""Integration test for create_aws_flow_logs_monitoring_integration error path (HTTP 401)"""
|
|
request_body_json = """
|
|
|
|
{
|
|
"roleArn" : "arn:aws:iam::01234567890:role/aws-flow-logs-ro",
|
|
"name" : "integration name",
|
|
"snsTopicsArns" : [ "arn:aws:sns:us-east-1:01234567890:SNS-Topic-US", "arn:aws:sns:eu-central-1:01234567890:SNS-Topic-EU" ]
|
|
}
|
|
|
|
"""
|
|
aws_flow_logs_integration_request = thousandeyes_sdk.cloud_insights_integrations.models.AwsFlowLogsIntegrationRequest.from_json(request_body_json)
|
|
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.create_aws_flow_logs_monitoring_integration(
|
|
|
|
aws_flow_logs_integration_request=aws_flow_logs_integration_request,
|
|
|
|
aid=aid,
|
|
|
|
_headers=self.te_headers("create_aws_flow_logs_monitoring_integration", error_status="401"),
|
|
)
|
|
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
|
|
|
|
|
|
def test_create_aws_flow_logs_monitoring_integration_error_403(self) -> None:
|
|
"""Integration test for create_aws_flow_logs_monitoring_integration error path (HTTP 403)"""
|
|
request_body_json = """
|
|
|
|
{
|
|
"roleArn" : "arn:aws:iam::01234567890:role/aws-flow-logs-ro",
|
|
"name" : "integration name",
|
|
"snsTopicsArns" : [ "arn:aws:sns:us-east-1:01234567890:SNS-Topic-US", "arn:aws:sns:eu-central-1:01234567890:SNS-Topic-EU" ]
|
|
}
|
|
|
|
"""
|
|
aws_flow_logs_integration_request = thousandeyes_sdk.cloud_insights_integrations.models.AwsFlowLogsIntegrationRequest.from_json(request_body_json)
|
|
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.create_aws_flow_logs_monitoring_integration(
|
|
|
|
aws_flow_logs_integration_request=aws_flow_logs_integration_request,
|
|
|
|
aid=aid,
|
|
|
|
_headers=self.te_headers("create_aws_flow_logs_monitoring_integration", error_status="403"),
|
|
)
|
|
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
|
|
|
|
|
|
def test_create_aws_flow_logs_monitoring_integration_error_404(self) -> None:
|
|
"""Integration test for create_aws_flow_logs_monitoring_integration error path (HTTP 404)"""
|
|
request_body_json = """
|
|
|
|
{
|
|
"roleArn" : "arn:aws:iam::01234567890:role/aws-flow-logs-ro",
|
|
"name" : "integration name",
|
|
"snsTopicsArns" : [ "arn:aws:sns:us-east-1:01234567890:SNS-Topic-US", "arn:aws:sns:eu-central-1:01234567890:SNS-Topic-EU" ]
|
|
}
|
|
|
|
"""
|
|
aws_flow_logs_integration_request = thousandeyes_sdk.cloud_insights_integrations.models.AwsFlowLogsIntegrationRequest.from_json(request_body_json)
|
|
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.create_aws_flow_logs_monitoring_integration(
|
|
|
|
aws_flow_logs_integration_request=aws_flow_logs_integration_request,
|
|
|
|
aid=aid,
|
|
|
|
_headers=self.te_headers("create_aws_flow_logs_monitoring_integration", error_status="404"),
|
|
)
|
|
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
|
|
|
|
|
|
def test_create_aws_flow_logs_monitoring_integration_error_429(self) -> None:
|
|
"""Integration test for create_aws_flow_logs_monitoring_integration error path (HTTP 429)"""
|
|
request_body_json = """
|
|
|
|
{
|
|
"roleArn" : "arn:aws:iam::01234567890:role/aws-flow-logs-ro",
|
|
"name" : "integration name",
|
|
"snsTopicsArns" : [ "arn:aws:sns:us-east-1:01234567890:SNS-Topic-US", "arn:aws:sns:eu-central-1:01234567890:SNS-Topic-EU" ]
|
|
}
|
|
|
|
"""
|
|
aws_flow_logs_integration_request = thousandeyes_sdk.cloud_insights_integrations.models.AwsFlowLogsIntegrationRequest.from_json(request_body_json)
|
|
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.create_aws_flow_logs_monitoring_integration(
|
|
|
|
aws_flow_logs_integration_request=aws_flow_logs_integration_request,
|
|
|
|
aid=aid,
|
|
|
|
_headers=self.te_headers("create_aws_flow_logs_monitoring_integration", error_status="429"),
|
|
)
|
|
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
|
|
|
|
|
|
def test_create_aws_flow_logs_monitoring_integration_error_500(self) -> None:
|
|
"""Integration test for create_aws_flow_logs_monitoring_integration error path (HTTP 500)"""
|
|
request_body_json = """
|
|
|
|
{
|
|
"roleArn" : "arn:aws:iam::01234567890:role/aws-flow-logs-ro",
|
|
"name" : "integration name",
|
|
"snsTopicsArns" : [ "arn:aws:sns:us-east-1:01234567890:SNS-Topic-US", "arn:aws:sns:eu-central-1:01234567890:SNS-Topic-EU" ]
|
|
}
|
|
|
|
"""
|
|
aws_flow_logs_integration_request = thousandeyes_sdk.cloud_insights_integrations.models.AwsFlowLogsIntegrationRequest.from_json(request_body_json)
|
|
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.create_aws_flow_logs_monitoring_integration(
|
|
|
|
aws_flow_logs_integration_request=aws_flow_logs_integration_request,
|
|
|
|
aid=aid,
|
|
|
|
_headers=self.te_headers("create_aws_flow_logs_monitoring_integration", error_status="500"),
|
|
)
|
|
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
|
|
|
|
|
|
|
|
|
|
def test_create_aws_inventory_monitoring_integration_happy_path(self) -> None:
|
|
"""Integration test for create_aws_inventory_monitoring_integration success path"""
|
|
request_body_json = """
|
|
|
|
{
|
|
"roleArn" : "arn:aws:iam::01234567890:role/aws-inventory-ro",
|
|
"name" : "integration name"
|
|
}
|
|
|
|
"""
|
|
aws_inventory_integration_request = thousandeyes_sdk.cloud_insights_integrations.models.AwsInventoryIntegrationRequest.from_json(request_body_json)
|
|
aid = '1234'
|
|
response_body_json = """
|
|
{
|
|
"monitoringType" : "inventory-monitoring",
|
|
"_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"
|
|
}
|
|
},
|
|
"roleArn" : "arn:aws:iam::01234567890:role/aws-monitoring-ro",
|
|
"name" : "integration name",
|
|
"externalId" : "37d8f861cffd34212b5a34466564da1f80b01a30",
|
|
"snsTopicsArns" : [ "arn:aws:sns:us-east-1:01234567890:SNS-Topic-US", "arn:aws:sns:eu-central-1:01234567890:SNS-Topic-EU" ],
|
|
"id" : "e9c3bf02-a48c-4aa8-9e5f-898800d6f569"
|
|
}
|
|
"""
|
|
expected_response = json.loads(response_body_json)
|
|
response = self.api.create_aws_inventory_monitoring_integration(
|
|
|
|
aws_inventory_integration_request=aws_inventory_integration_request,
|
|
|
|
aid=aid,
|
|
|
|
_headers=self.te_headers("create_aws_inventory_monitoring_integration"),
|
|
)
|
|
assert_constructed_model_matches_example_json(response, expected_response)
|
|
|
|
|
|
def test_create_aws_inventory_monitoring_integration_error_400(self) -> None:
|
|
"""Integration test for create_aws_inventory_monitoring_integration error path (HTTP 400)"""
|
|
request_body_json = """
|
|
|
|
{
|
|
"roleArn" : "arn:aws:iam::01234567890:role/aws-inventory-ro",
|
|
"name" : "integration name"
|
|
}
|
|
|
|
"""
|
|
aws_inventory_integration_request = thousandeyes_sdk.cloud_insights_integrations.models.AwsInventoryIntegrationRequest.from_json(request_body_json)
|
|
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.create_aws_inventory_monitoring_integration(
|
|
|
|
aws_inventory_integration_request=aws_inventory_integration_request,
|
|
|
|
aid=aid,
|
|
|
|
_headers=self.te_headers("create_aws_inventory_monitoring_integration", error_status="400"),
|
|
)
|
|
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
|
|
|
|
|
|
def test_create_aws_inventory_monitoring_integration_error_401(self) -> None:
|
|
"""Integration test for create_aws_inventory_monitoring_integration error path (HTTP 401)"""
|
|
request_body_json = """
|
|
|
|
{
|
|
"roleArn" : "arn:aws:iam::01234567890:role/aws-inventory-ro",
|
|
"name" : "integration name"
|
|
}
|
|
|
|
"""
|
|
aws_inventory_integration_request = thousandeyes_sdk.cloud_insights_integrations.models.AwsInventoryIntegrationRequest.from_json(request_body_json)
|
|
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.create_aws_inventory_monitoring_integration(
|
|
|
|
aws_inventory_integration_request=aws_inventory_integration_request,
|
|
|
|
aid=aid,
|
|
|
|
_headers=self.te_headers("create_aws_inventory_monitoring_integration", error_status="401"),
|
|
)
|
|
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
|
|
|
|
|
|
def test_create_aws_inventory_monitoring_integration_error_403(self) -> None:
|
|
"""Integration test for create_aws_inventory_monitoring_integration error path (HTTP 403)"""
|
|
request_body_json = """
|
|
|
|
{
|
|
"roleArn" : "arn:aws:iam::01234567890:role/aws-inventory-ro",
|
|
"name" : "integration name"
|
|
}
|
|
|
|
"""
|
|
aws_inventory_integration_request = thousandeyes_sdk.cloud_insights_integrations.models.AwsInventoryIntegrationRequest.from_json(request_body_json)
|
|
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.create_aws_inventory_monitoring_integration(
|
|
|
|
aws_inventory_integration_request=aws_inventory_integration_request,
|
|
|
|
aid=aid,
|
|
|
|
_headers=self.te_headers("create_aws_inventory_monitoring_integration", error_status="403"),
|
|
)
|
|
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
|
|
|
|
|
|
def test_create_aws_inventory_monitoring_integration_error_404(self) -> None:
|
|
"""Integration test for create_aws_inventory_monitoring_integration error path (HTTP 404)"""
|
|
request_body_json = """
|
|
|
|
{
|
|
"roleArn" : "arn:aws:iam::01234567890:role/aws-inventory-ro",
|
|
"name" : "integration name"
|
|
}
|
|
|
|
"""
|
|
aws_inventory_integration_request = thousandeyes_sdk.cloud_insights_integrations.models.AwsInventoryIntegrationRequest.from_json(request_body_json)
|
|
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.create_aws_inventory_monitoring_integration(
|
|
|
|
aws_inventory_integration_request=aws_inventory_integration_request,
|
|
|
|
aid=aid,
|
|
|
|
_headers=self.te_headers("create_aws_inventory_monitoring_integration", error_status="404"),
|
|
)
|
|
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
|
|
|
|
|
|
def test_create_aws_inventory_monitoring_integration_error_429(self) -> None:
|
|
"""Integration test for create_aws_inventory_monitoring_integration error path (HTTP 429)"""
|
|
request_body_json = """
|
|
|
|
{
|
|
"roleArn" : "arn:aws:iam::01234567890:role/aws-inventory-ro",
|
|
"name" : "integration name"
|
|
}
|
|
|
|
"""
|
|
aws_inventory_integration_request = thousandeyes_sdk.cloud_insights_integrations.models.AwsInventoryIntegrationRequest.from_json(request_body_json)
|
|
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.create_aws_inventory_monitoring_integration(
|
|
|
|
aws_inventory_integration_request=aws_inventory_integration_request,
|
|
|
|
aid=aid,
|
|
|
|
_headers=self.te_headers("create_aws_inventory_monitoring_integration", error_status="429"),
|
|
)
|
|
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
|
|
|
|
|
|
def test_create_aws_inventory_monitoring_integration_error_500(self) -> None:
|
|
"""Integration test for create_aws_inventory_monitoring_integration error path (HTTP 500)"""
|
|
request_body_json = """
|
|
|
|
{
|
|
"roleArn" : "arn:aws:iam::01234567890:role/aws-inventory-ro",
|
|
"name" : "integration name"
|
|
}
|
|
|
|
"""
|
|
aws_inventory_integration_request = thousandeyes_sdk.cloud_insights_integrations.models.AwsInventoryIntegrationRequest.from_json(request_body_json)
|
|
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.create_aws_inventory_monitoring_integration(
|
|
|
|
aws_inventory_integration_request=aws_inventory_integration_request,
|
|
|
|
aid=aid,
|
|
|
|
_headers=self.te_headers("create_aws_inventory_monitoring_integration", error_status="500"),
|
|
)
|
|
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
|
|
|
|
|
|
|
|
|
|
def test_create_azure_flow_logs_monitoring_integration_happy_path(self) -> None:
|
|
"""Integration test for create_azure_flow_logs_monitoring_integration success path"""
|
|
request_body_json = """
|
|
|
|
{
|
|
"password" : "p9z4Q~U7LkdX1yZr3TcB6fJqG8aM0sDeT5R9hVnKw",
|
|
"appId" : "2f9b2a1c-6d87-4c92-9d51-37efc93c0a4f",
|
|
"name" : "integration name",
|
|
"azureTenantId" : "e3a72c9b-42b1-4e0b-9b9f-7f6a3b2a1c44",
|
|
"serviceBusQueueUrl" : "https://your-service-bus-namespace.servicebus.windows.net/your-queue-name"
|
|
}
|
|
|
|
"""
|
|
azure_flow_logs_integration_request = thousandeyes_sdk.cloud_insights_integrations.models.AzureFlowLogsIntegrationRequest.from_json(request_body_json)
|
|
aid = '1234'
|
|
response_body_json = """
|
|
{
|
|
"password" : "********",
|
|
"monitoringType" : "azure-inventory-monitoring",
|
|
"_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"
|
|
}
|
|
},
|
|
"appId" : "2f9b2a1c-6d87-4c92-9d51-37efc93c0a4f",
|
|
"name" : "integration name",
|
|
"id" : "e9c3bf02-a48c-4aa8-9e5f-898800d6f569",
|
|
"azureTenantId" : "e3a72c9b-42b1-4e0b-9b9f-7f6a3b2a1c44",
|
|
"serviceBusQueueUrl" : "https://your-service-bus-namespace.servicebus.windows.net/your-queue-name"
|
|
}
|
|
"""
|
|
expected_response = json.loads(response_body_json)
|
|
response = self.api.create_azure_flow_logs_monitoring_integration(
|
|
|
|
azure_flow_logs_integration_request=azure_flow_logs_integration_request,
|
|
|
|
aid=aid,
|
|
|
|
_headers=self.te_headers("create_azure_flow_logs_monitoring_integration"),
|
|
)
|
|
assert_constructed_model_matches_example_json(response, expected_response)
|
|
|
|
|
|
def test_create_azure_flow_logs_monitoring_integration_error_400(self) -> None:
|
|
"""Integration test for create_azure_flow_logs_monitoring_integration error path (HTTP 400)"""
|
|
request_body_json = """
|
|
|
|
{
|
|
"password" : "p9z4Q~U7LkdX1yZr3TcB6fJqG8aM0sDeT5R9hVnKw",
|
|
"appId" : "2f9b2a1c-6d87-4c92-9d51-37efc93c0a4f",
|
|
"name" : "integration name",
|
|
"azureTenantId" : "e3a72c9b-42b1-4e0b-9b9f-7f6a3b2a1c44",
|
|
"serviceBusQueueUrl" : "https://your-service-bus-namespace.servicebus.windows.net/your-queue-name"
|
|
}
|
|
|
|
"""
|
|
azure_flow_logs_integration_request = thousandeyes_sdk.cloud_insights_integrations.models.AzureFlowLogsIntegrationRequest.from_json(request_body_json)
|
|
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.create_azure_flow_logs_monitoring_integration(
|
|
|
|
azure_flow_logs_integration_request=azure_flow_logs_integration_request,
|
|
|
|
aid=aid,
|
|
|
|
_headers=self.te_headers("create_azure_flow_logs_monitoring_integration", error_status="400"),
|
|
)
|
|
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
|
|
|
|
|
|
def test_create_azure_flow_logs_monitoring_integration_error_401(self) -> None:
|
|
"""Integration test for create_azure_flow_logs_monitoring_integration error path (HTTP 401)"""
|
|
request_body_json = """
|
|
|
|
{
|
|
"password" : "p9z4Q~U7LkdX1yZr3TcB6fJqG8aM0sDeT5R9hVnKw",
|
|
"appId" : "2f9b2a1c-6d87-4c92-9d51-37efc93c0a4f",
|
|
"name" : "integration name",
|
|
"azureTenantId" : "e3a72c9b-42b1-4e0b-9b9f-7f6a3b2a1c44",
|
|
"serviceBusQueueUrl" : "https://your-service-bus-namespace.servicebus.windows.net/your-queue-name"
|
|
}
|
|
|
|
"""
|
|
azure_flow_logs_integration_request = thousandeyes_sdk.cloud_insights_integrations.models.AzureFlowLogsIntegrationRequest.from_json(request_body_json)
|
|
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.create_azure_flow_logs_monitoring_integration(
|
|
|
|
azure_flow_logs_integration_request=azure_flow_logs_integration_request,
|
|
|
|
aid=aid,
|
|
|
|
_headers=self.te_headers("create_azure_flow_logs_monitoring_integration", error_status="401"),
|
|
)
|
|
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
|
|
|
|
|
|
def test_create_azure_flow_logs_monitoring_integration_error_403(self) -> None:
|
|
"""Integration test for create_azure_flow_logs_monitoring_integration error path (HTTP 403)"""
|
|
request_body_json = """
|
|
|
|
{
|
|
"password" : "p9z4Q~U7LkdX1yZr3TcB6fJqG8aM0sDeT5R9hVnKw",
|
|
"appId" : "2f9b2a1c-6d87-4c92-9d51-37efc93c0a4f",
|
|
"name" : "integration name",
|
|
"azureTenantId" : "e3a72c9b-42b1-4e0b-9b9f-7f6a3b2a1c44",
|
|
"serviceBusQueueUrl" : "https://your-service-bus-namespace.servicebus.windows.net/your-queue-name"
|
|
}
|
|
|
|
"""
|
|
azure_flow_logs_integration_request = thousandeyes_sdk.cloud_insights_integrations.models.AzureFlowLogsIntegrationRequest.from_json(request_body_json)
|
|
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.create_azure_flow_logs_monitoring_integration(
|
|
|
|
azure_flow_logs_integration_request=azure_flow_logs_integration_request,
|
|
|
|
aid=aid,
|
|
|
|
_headers=self.te_headers("create_azure_flow_logs_monitoring_integration", error_status="403"),
|
|
)
|
|
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
|
|
|
|
|
|
def test_create_azure_flow_logs_monitoring_integration_error_404(self) -> None:
|
|
"""Integration test for create_azure_flow_logs_monitoring_integration error path (HTTP 404)"""
|
|
request_body_json = """
|
|
|
|
{
|
|
"password" : "p9z4Q~U7LkdX1yZr3TcB6fJqG8aM0sDeT5R9hVnKw",
|
|
"appId" : "2f9b2a1c-6d87-4c92-9d51-37efc93c0a4f",
|
|
"name" : "integration name",
|
|
"azureTenantId" : "e3a72c9b-42b1-4e0b-9b9f-7f6a3b2a1c44",
|
|
"serviceBusQueueUrl" : "https://your-service-bus-namespace.servicebus.windows.net/your-queue-name"
|
|
}
|
|
|
|
"""
|
|
azure_flow_logs_integration_request = thousandeyes_sdk.cloud_insights_integrations.models.AzureFlowLogsIntegrationRequest.from_json(request_body_json)
|
|
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.create_azure_flow_logs_monitoring_integration(
|
|
|
|
azure_flow_logs_integration_request=azure_flow_logs_integration_request,
|
|
|
|
aid=aid,
|
|
|
|
_headers=self.te_headers("create_azure_flow_logs_monitoring_integration", error_status="404"),
|
|
)
|
|
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
|
|
|
|
|
|
def test_create_azure_flow_logs_monitoring_integration_error_429(self) -> None:
|
|
"""Integration test for create_azure_flow_logs_monitoring_integration error path (HTTP 429)"""
|
|
request_body_json = """
|
|
|
|
{
|
|
"password" : "p9z4Q~U7LkdX1yZr3TcB6fJqG8aM0sDeT5R9hVnKw",
|
|
"appId" : "2f9b2a1c-6d87-4c92-9d51-37efc93c0a4f",
|
|
"name" : "integration name",
|
|
"azureTenantId" : "e3a72c9b-42b1-4e0b-9b9f-7f6a3b2a1c44",
|
|
"serviceBusQueueUrl" : "https://your-service-bus-namespace.servicebus.windows.net/your-queue-name"
|
|
}
|
|
|
|
"""
|
|
azure_flow_logs_integration_request = thousandeyes_sdk.cloud_insights_integrations.models.AzureFlowLogsIntegrationRequest.from_json(request_body_json)
|
|
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.create_azure_flow_logs_monitoring_integration(
|
|
|
|
azure_flow_logs_integration_request=azure_flow_logs_integration_request,
|
|
|
|
aid=aid,
|
|
|
|
_headers=self.te_headers("create_azure_flow_logs_monitoring_integration", error_status="429"),
|
|
)
|
|
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
|
|
|
|
|
|
def test_create_azure_flow_logs_monitoring_integration_error_500(self) -> None:
|
|
"""Integration test for create_azure_flow_logs_monitoring_integration error path (HTTP 500)"""
|
|
request_body_json = """
|
|
|
|
{
|
|
"password" : "p9z4Q~U7LkdX1yZr3TcB6fJqG8aM0sDeT5R9hVnKw",
|
|
"appId" : "2f9b2a1c-6d87-4c92-9d51-37efc93c0a4f",
|
|
"name" : "integration name",
|
|
"azureTenantId" : "e3a72c9b-42b1-4e0b-9b9f-7f6a3b2a1c44",
|
|
"serviceBusQueueUrl" : "https://your-service-bus-namespace.servicebus.windows.net/your-queue-name"
|
|
}
|
|
|
|
"""
|
|
azure_flow_logs_integration_request = thousandeyes_sdk.cloud_insights_integrations.models.AzureFlowLogsIntegrationRequest.from_json(request_body_json)
|
|
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.create_azure_flow_logs_monitoring_integration(
|
|
|
|
azure_flow_logs_integration_request=azure_flow_logs_integration_request,
|
|
|
|
aid=aid,
|
|
|
|
_headers=self.te_headers("create_azure_flow_logs_monitoring_integration", error_status="500"),
|
|
)
|
|
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
|
|
|
|
|
|
|
|
|
|
def test_create_azure_inventory_monitoring_integration_happy_path(self) -> None:
|
|
"""Integration test for create_azure_inventory_monitoring_integration success path"""
|
|
request_body_json = """
|
|
|
|
{
|
|
"password" : "p9z4Q~U7LkdX1yZr3TcB6fJqG8aM0sDeT5R9hVnKw",
|
|
"appId" : "2f9b2a1c-6d87-4c92-9d51-37efc93c0a4f",
|
|
"name" : "integration name",
|
|
"azureTenantId" : "e3a72c9b-42b1-4e0b-9b9f-7f6a3b2a1c44"
|
|
}
|
|
|
|
"""
|
|
azure_inventory_integration_request = thousandeyes_sdk.cloud_insights_integrations.models.AzureInventoryIntegrationRequest.from_json(request_body_json)
|
|
aid = '1234'
|
|
response_body_json = """
|
|
{
|
|
"password" : "********",
|
|
"monitoringType" : "azure-inventory-monitoring",
|
|
"_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"
|
|
}
|
|
},
|
|
"appId" : "2f9b2a1c-6d87-4c92-9d51-37efc93c0a4f",
|
|
"name" : "integration name",
|
|
"id" : "e9c3bf02-a48c-4aa8-9e5f-898800d6f569",
|
|
"azureTenantId" : "e3a72c9b-42b1-4e0b-9b9f-7f6a3b2a1c44",
|
|
"serviceBusQueueUrl" : "https://your-service-bus-namespace.servicebus.windows.net/your-queue-name"
|
|
}
|
|
"""
|
|
expected_response = json.loads(response_body_json)
|
|
response = self.api.create_azure_inventory_monitoring_integration(
|
|
|
|
azure_inventory_integration_request=azure_inventory_integration_request,
|
|
|
|
aid=aid,
|
|
|
|
_headers=self.te_headers("create_azure_inventory_monitoring_integration"),
|
|
)
|
|
assert_constructed_model_matches_example_json(response, expected_response)
|
|
|
|
|
|
def test_create_azure_inventory_monitoring_integration_error_400(self) -> None:
|
|
"""Integration test for create_azure_inventory_monitoring_integration error path (HTTP 400)"""
|
|
request_body_json = """
|
|
|
|
{
|
|
"password" : "p9z4Q~U7LkdX1yZr3TcB6fJqG8aM0sDeT5R9hVnKw",
|
|
"appId" : "2f9b2a1c-6d87-4c92-9d51-37efc93c0a4f",
|
|
"name" : "integration name",
|
|
"azureTenantId" : "e3a72c9b-42b1-4e0b-9b9f-7f6a3b2a1c44"
|
|
}
|
|
|
|
"""
|
|
azure_inventory_integration_request = thousandeyes_sdk.cloud_insights_integrations.models.AzureInventoryIntegrationRequest.from_json(request_body_json)
|
|
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.create_azure_inventory_monitoring_integration(
|
|
|
|
azure_inventory_integration_request=azure_inventory_integration_request,
|
|
|
|
aid=aid,
|
|
|
|
_headers=self.te_headers("create_azure_inventory_monitoring_integration", error_status="400"),
|
|
)
|
|
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
|
|
|
|
|
|
def test_create_azure_inventory_monitoring_integration_error_401(self) -> None:
|
|
"""Integration test for create_azure_inventory_monitoring_integration error path (HTTP 401)"""
|
|
request_body_json = """
|
|
|
|
{
|
|
"password" : "p9z4Q~U7LkdX1yZr3TcB6fJqG8aM0sDeT5R9hVnKw",
|
|
"appId" : "2f9b2a1c-6d87-4c92-9d51-37efc93c0a4f",
|
|
"name" : "integration name",
|
|
"azureTenantId" : "e3a72c9b-42b1-4e0b-9b9f-7f6a3b2a1c44"
|
|
}
|
|
|
|
"""
|
|
azure_inventory_integration_request = thousandeyes_sdk.cloud_insights_integrations.models.AzureInventoryIntegrationRequest.from_json(request_body_json)
|
|
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.create_azure_inventory_monitoring_integration(
|
|
|
|
azure_inventory_integration_request=azure_inventory_integration_request,
|
|
|
|
aid=aid,
|
|
|
|
_headers=self.te_headers("create_azure_inventory_monitoring_integration", error_status="401"),
|
|
)
|
|
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
|
|
|
|
|
|
def test_create_azure_inventory_monitoring_integration_error_403(self) -> None:
|
|
"""Integration test for create_azure_inventory_monitoring_integration error path (HTTP 403)"""
|
|
request_body_json = """
|
|
|
|
{
|
|
"password" : "p9z4Q~U7LkdX1yZr3TcB6fJqG8aM0sDeT5R9hVnKw",
|
|
"appId" : "2f9b2a1c-6d87-4c92-9d51-37efc93c0a4f",
|
|
"name" : "integration name",
|
|
"azureTenantId" : "e3a72c9b-42b1-4e0b-9b9f-7f6a3b2a1c44"
|
|
}
|
|
|
|
"""
|
|
azure_inventory_integration_request = thousandeyes_sdk.cloud_insights_integrations.models.AzureInventoryIntegrationRequest.from_json(request_body_json)
|
|
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.create_azure_inventory_monitoring_integration(
|
|
|
|
azure_inventory_integration_request=azure_inventory_integration_request,
|
|
|
|
aid=aid,
|
|
|
|
_headers=self.te_headers("create_azure_inventory_monitoring_integration", error_status="403"),
|
|
)
|
|
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
|
|
|
|
|
|
def test_create_azure_inventory_monitoring_integration_error_404(self) -> None:
|
|
"""Integration test for create_azure_inventory_monitoring_integration error path (HTTP 404)"""
|
|
request_body_json = """
|
|
|
|
{
|
|
"password" : "p9z4Q~U7LkdX1yZr3TcB6fJqG8aM0sDeT5R9hVnKw",
|
|
"appId" : "2f9b2a1c-6d87-4c92-9d51-37efc93c0a4f",
|
|
"name" : "integration name",
|
|
"azureTenantId" : "e3a72c9b-42b1-4e0b-9b9f-7f6a3b2a1c44"
|
|
}
|
|
|
|
"""
|
|
azure_inventory_integration_request = thousandeyes_sdk.cloud_insights_integrations.models.AzureInventoryIntegrationRequest.from_json(request_body_json)
|
|
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.create_azure_inventory_monitoring_integration(
|
|
|
|
azure_inventory_integration_request=azure_inventory_integration_request,
|
|
|
|
aid=aid,
|
|
|
|
_headers=self.te_headers("create_azure_inventory_monitoring_integration", error_status="404"),
|
|
)
|
|
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
|
|
|
|
|
|
def test_create_azure_inventory_monitoring_integration_error_429(self) -> None:
|
|
"""Integration test for create_azure_inventory_monitoring_integration error path (HTTP 429)"""
|
|
request_body_json = """
|
|
|
|
{
|
|
"password" : "p9z4Q~U7LkdX1yZr3TcB6fJqG8aM0sDeT5R9hVnKw",
|
|
"appId" : "2f9b2a1c-6d87-4c92-9d51-37efc93c0a4f",
|
|
"name" : "integration name",
|
|
"azureTenantId" : "e3a72c9b-42b1-4e0b-9b9f-7f6a3b2a1c44"
|
|
}
|
|
|
|
"""
|
|
azure_inventory_integration_request = thousandeyes_sdk.cloud_insights_integrations.models.AzureInventoryIntegrationRequest.from_json(request_body_json)
|
|
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.create_azure_inventory_monitoring_integration(
|
|
|
|
azure_inventory_integration_request=azure_inventory_integration_request,
|
|
|
|
aid=aid,
|
|
|
|
_headers=self.te_headers("create_azure_inventory_monitoring_integration", error_status="429"),
|
|
)
|
|
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
|
|
|
|
|
|
def test_create_azure_inventory_monitoring_integration_error_500(self) -> None:
|
|
"""Integration test for create_azure_inventory_monitoring_integration error path (HTTP 500)"""
|
|
request_body_json = """
|
|
|
|
{
|
|
"password" : "p9z4Q~U7LkdX1yZr3TcB6fJqG8aM0sDeT5R9hVnKw",
|
|
"appId" : "2f9b2a1c-6d87-4c92-9d51-37efc93c0a4f",
|
|
"name" : "integration name",
|
|
"azureTenantId" : "e3a72c9b-42b1-4e0b-9b9f-7f6a3b2a1c44"
|
|
}
|
|
|
|
"""
|
|
azure_inventory_integration_request = thousandeyes_sdk.cloud_insights_integrations.models.AzureInventoryIntegrationRequest.from_json(request_body_json)
|
|
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.create_azure_inventory_monitoring_integration(
|
|
|
|
azure_inventory_integration_request=azure_inventory_integration_request,
|
|
|
|
aid=aid,
|
|
|
|
_headers=self.te_headers("create_azure_inventory_monitoring_integration", error_status="500"),
|
|
)
|
|
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
|
|
|
|
|
|
|
|
|
|
def test_delete_aws_monitoring_integration_happy_path(self) -> None:
|
|
"""Integration test for delete_aws_monitoring_integration success path"""
|
|
integration_id = 'e9c3bf02-a48c-4aa8-9e5f-898800d6f569'
|
|
aid = '1234'
|
|
response = self.api.delete_aws_monitoring_integration_with_http_info(
|
|
|
|
integration_id=integration_id,
|
|
|
|
aid=aid,
|
|
|
|
_headers=self.te_headers("delete_aws_monitoring_integration"),
|
|
)
|
|
self.assertEqual(204, response.status_code)
|
|
self.assertIsNone(response.data)
|
|
|
|
|
|
def test_delete_aws_monitoring_integration_error_400(self) -> None:
|
|
"""Integration test for delete_aws_monitoring_integration error path (HTTP 400)"""
|
|
integration_id = 'e9c3bf02-a48c-4aa8-9e5f-898800d6f569'
|
|
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.delete_aws_monitoring_integration(
|
|
|
|
integration_id=integration_id,
|
|
|
|
aid=aid,
|
|
|
|
_headers=self.te_headers("delete_aws_monitoring_integration", error_status="400"),
|
|
)
|
|
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
|
|
|
|
|
|
def test_delete_aws_monitoring_integration_error_401(self) -> None:
|
|
"""Integration test for delete_aws_monitoring_integration error path (HTTP 401)"""
|
|
integration_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.delete_aws_monitoring_integration(
|
|
|
|
integration_id=integration_id,
|
|
|
|
aid=aid,
|
|
|
|
_headers=self.te_headers("delete_aws_monitoring_integration", error_status="401"),
|
|
)
|
|
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
|
|
|
|
|
|
def test_delete_aws_monitoring_integration_error_403(self) -> None:
|
|
"""Integration test for delete_aws_monitoring_integration error path (HTTP 403)"""
|
|
integration_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.delete_aws_monitoring_integration(
|
|
|
|
integration_id=integration_id,
|
|
|
|
aid=aid,
|
|
|
|
_headers=self.te_headers("delete_aws_monitoring_integration", error_status="403"),
|
|
)
|
|
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
|
|
|
|
|
|
def test_delete_aws_monitoring_integration_error_404(self) -> None:
|
|
"""Integration test for delete_aws_monitoring_integration error path (HTTP 404)"""
|
|
integration_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.delete_aws_monitoring_integration(
|
|
|
|
integration_id=integration_id,
|
|
|
|
aid=aid,
|
|
|
|
_headers=self.te_headers("delete_aws_monitoring_integration", error_status="404"),
|
|
)
|
|
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
|
|
|
|
|
|
def test_delete_aws_monitoring_integration_error_429(self) -> None:
|
|
"""Integration test for delete_aws_monitoring_integration error path (HTTP 429)"""
|
|
integration_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.delete_aws_monitoring_integration(
|
|
|
|
integration_id=integration_id,
|
|
|
|
aid=aid,
|
|
|
|
_headers=self.te_headers("delete_aws_monitoring_integration", error_status="429"),
|
|
)
|
|
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
|
|
|
|
|
|
def test_delete_aws_monitoring_integration_error_500(self) -> None:
|
|
"""Integration test for delete_aws_monitoring_integration error path (HTTP 500)"""
|
|
integration_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.delete_aws_monitoring_integration(
|
|
|
|
integration_id=integration_id,
|
|
|
|
aid=aid,
|
|
|
|
_headers=self.te_headers("delete_aws_monitoring_integration", error_status="500"),
|
|
)
|
|
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
|
|
|
|
|
|
|
|
|
|
def test_delete_azure_monitoring_integration_happy_path(self) -> None:
|
|
"""Integration test for delete_azure_monitoring_integration success path"""
|
|
integration_id = 'e9c3bf02-a48c-4aa8-9e5f-898800d6f569'
|
|
aid = '1234'
|
|
response = self.api.delete_azure_monitoring_integration_with_http_info(
|
|
|
|
integration_id=integration_id,
|
|
|
|
aid=aid,
|
|
|
|
_headers=self.te_headers("delete_azure_monitoring_integration"),
|
|
)
|
|
self.assertEqual(204, response.status_code)
|
|
self.assertIsNone(response.data)
|
|
|
|
|
|
def test_delete_azure_monitoring_integration_error_400(self) -> None:
|
|
"""Integration test for delete_azure_monitoring_integration error path (HTTP 400)"""
|
|
integration_id = 'e9c3bf02-a48c-4aa8-9e5f-898800d6f569'
|
|
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.delete_azure_monitoring_integration(
|
|
|
|
integration_id=integration_id,
|
|
|
|
aid=aid,
|
|
|
|
_headers=self.te_headers("delete_azure_monitoring_integration", error_status="400"),
|
|
)
|
|
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
|
|
|
|
|
|
def test_delete_azure_monitoring_integration_error_401(self) -> None:
|
|
"""Integration test for delete_azure_monitoring_integration error path (HTTP 401)"""
|
|
integration_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.delete_azure_monitoring_integration(
|
|
|
|
integration_id=integration_id,
|
|
|
|
aid=aid,
|
|
|
|
_headers=self.te_headers("delete_azure_monitoring_integration", error_status="401"),
|
|
)
|
|
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
|
|
|
|
|
|
def test_delete_azure_monitoring_integration_error_403(self) -> None:
|
|
"""Integration test for delete_azure_monitoring_integration error path (HTTP 403)"""
|
|
integration_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.delete_azure_monitoring_integration(
|
|
|
|
integration_id=integration_id,
|
|
|
|
aid=aid,
|
|
|
|
_headers=self.te_headers("delete_azure_monitoring_integration", error_status="403"),
|
|
)
|
|
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
|
|
|
|
|
|
def test_delete_azure_monitoring_integration_error_404(self) -> None:
|
|
"""Integration test for delete_azure_monitoring_integration error path (HTTP 404)"""
|
|
integration_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.delete_azure_monitoring_integration(
|
|
|
|
integration_id=integration_id,
|
|
|
|
aid=aid,
|
|
|
|
_headers=self.te_headers("delete_azure_monitoring_integration", error_status="404"),
|
|
)
|
|
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
|
|
|
|
|
|
def test_delete_azure_monitoring_integration_error_429(self) -> None:
|
|
"""Integration test for delete_azure_monitoring_integration error path (HTTP 429)"""
|
|
integration_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.delete_azure_monitoring_integration(
|
|
|
|
integration_id=integration_id,
|
|
|
|
aid=aid,
|
|
|
|
_headers=self.te_headers("delete_azure_monitoring_integration", error_status="429"),
|
|
)
|
|
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
|
|
|
|
|
|
def test_delete_azure_monitoring_integration_error_500(self) -> None:
|
|
"""Integration test for delete_azure_monitoring_integration error path (HTTP 500)"""
|
|
integration_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.delete_azure_monitoring_integration(
|
|
|
|
integration_id=integration_id,
|
|
|
|
aid=aid,
|
|
|
|
_headers=self.te_headers("delete_azure_monitoring_integration", error_status="500"),
|
|
)
|
|
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
|
|
|
|
|
|
|
|
|
|
def test_get_all_aws_monitoring_integrations_happy_path(self) -> None:
|
|
"""Integration test for get_all_aws_monitoring_integrations 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"
|
|
}
|
|
},
|
|
"integrations" : [ {
|
|
"monitoringType" : "inventory-monitoring",
|
|
"_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"
|
|
}
|
|
},
|
|
"roleArn" : "arn:aws:iam::01234567890:role/aws-monitoring-ro",
|
|
"name" : "integration name",
|
|
"externalId" : "37d8f861cffd34212b5a34466564da1f80b01a30",
|
|
"snsTopicsArns" : [ "arn:aws:sns:us-east-1:01234567890:SNS-Topic-US", "arn:aws:sns:eu-central-1:01234567890:SNS-Topic-EU" ],
|
|
"id" : "e9c3bf02-a48c-4aa8-9e5f-898800d6f569"
|
|
}, {
|
|
"monitoringType" : "inventory-monitoring",
|
|
"_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"
|
|
}
|
|
},
|
|
"roleArn" : "arn:aws:iam::01234567890:role/aws-monitoring-ro",
|
|
"name" : "integration name",
|
|
"externalId" : "37d8f861cffd34212b5a34466564da1f80b01a30",
|
|
"snsTopicsArns" : [ "arn:aws:sns:us-east-1:01234567890:SNS-Topic-US", "arn:aws:sns:eu-central-1:01234567890:SNS-Topic-EU" ],
|
|
"id" : "e9c3bf02-a48c-4aa8-9e5f-898800d6f569"
|
|
} ]
|
|
}
|
|
"""
|
|
expected_response = json.loads(response_body_json)
|
|
response = self.api.get_all_aws_monitoring_integrations(
|
|
|
|
aid=aid,
|
|
|
|
_headers=self.te_headers("get_all_aws_monitoring_integrations"),
|
|
)
|
|
assert_constructed_model_matches_example_json(response, expected_response)
|
|
|
|
|
|
def test_get_all_aws_monitoring_integrations_error_401(self) -> None:
|
|
"""Integration test for get_all_aws_monitoring_integrations 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_all_aws_monitoring_integrations(
|
|
|
|
aid=aid,
|
|
|
|
_headers=self.te_headers("get_all_aws_monitoring_integrations", error_status="401"),
|
|
)
|
|
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
|
|
|
|
|
|
def test_get_all_aws_monitoring_integrations_error_403(self) -> None:
|
|
"""Integration test for get_all_aws_monitoring_integrations 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_all_aws_monitoring_integrations(
|
|
|
|
aid=aid,
|
|
|
|
_headers=self.te_headers("get_all_aws_monitoring_integrations", error_status="403"),
|
|
)
|
|
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
|
|
|
|
|
|
def test_get_all_aws_monitoring_integrations_error_404(self) -> None:
|
|
"""Integration test for get_all_aws_monitoring_integrations 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_all_aws_monitoring_integrations(
|
|
|
|
aid=aid,
|
|
|
|
_headers=self.te_headers("get_all_aws_monitoring_integrations", error_status="404"),
|
|
)
|
|
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
|
|
|
|
|
|
def test_get_all_aws_monitoring_integrations_error_429(self) -> None:
|
|
"""Integration test for get_all_aws_monitoring_integrations 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_all_aws_monitoring_integrations(
|
|
|
|
aid=aid,
|
|
|
|
_headers=self.te_headers("get_all_aws_monitoring_integrations", error_status="429"),
|
|
)
|
|
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
|
|
|
|
|
|
def test_get_all_aws_monitoring_integrations_error_500(self) -> None:
|
|
"""Integration test for get_all_aws_monitoring_integrations 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_all_aws_monitoring_integrations(
|
|
|
|
aid=aid,
|
|
|
|
_headers=self.te_headers("get_all_aws_monitoring_integrations", error_status="500"),
|
|
)
|
|
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
|
|
|
|
|
|
|
|
|
|
def test_get_all_azure_monitoring_integrations_happy_path(self) -> None:
|
|
"""Integration test for get_all_azure_monitoring_integrations 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"
|
|
}
|
|
},
|
|
"integrations" : [ {
|
|
"password" : "********",
|
|
"monitoringType" : "azure-inventory-monitoring",
|
|
"_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"
|
|
}
|
|
},
|
|
"appId" : "2f9b2a1c-6d87-4c92-9d51-37efc93c0a4f",
|
|
"name" : "integration name",
|
|
"id" : "e9c3bf02-a48c-4aa8-9e5f-898800d6f569",
|
|
"azureTenantId" : "e3a72c9b-42b1-4e0b-9b9f-7f6a3b2a1c44",
|
|
"serviceBusQueueUrl" : "https://your-service-bus-namespace.servicebus.windows.net/your-queue-name"
|
|
}, {
|
|
"password" : "********",
|
|
"monitoringType" : "azure-inventory-monitoring",
|
|
"_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"
|
|
}
|
|
},
|
|
"appId" : "2f9b2a1c-6d87-4c92-9d51-37efc93c0a4f",
|
|
"name" : "integration name",
|
|
"id" : "e9c3bf02-a48c-4aa8-9e5f-898800d6f569",
|
|
"azureTenantId" : "e3a72c9b-42b1-4e0b-9b9f-7f6a3b2a1c44",
|
|
"serviceBusQueueUrl" : "https://your-service-bus-namespace.servicebus.windows.net/your-queue-name"
|
|
} ]
|
|
}
|
|
"""
|
|
expected_response = json.loads(response_body_json)
|
|
response = self.api.get_all_azure_monitoring_integrations(
|
|
|
|
aid=aid,
|
|
|
|
_headers=self.te_headers("get_all_azure_monitoring_integrations"),
|
|
)
|
|
assert_constructed_model_matches_example_json(response, expected_response)
|
|
|
|
|
|
def test_get_all_azure_monitoring_integrations_error_401(self) -> None:
|
|
"""Integration test for get_all_azure_monitoring_integrations 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_all_azure_monitoring_integrations(
|
|
|
|
aid=aid,
|
|
|
|
_headers=self.te_headers("get_all_azure_monitoring_integrations", error_status="401"),
|
|
)
|
|
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
|
|
|
|
|
|
def test_get_all_azure_monitoring_integrations_error_403(self) -> None:
|
|
"""Integration test for get_all_azure_monitoring_integrations 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_all_azure_monitoring_integrations(
|
|
|
|
aid=aid,
|
|
|
|
_headers=self.te_headers("get_all_azure_monitoring_integrations", error_status="403"),
|
|
)
|
|
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
|
|
|
|
|
|
def test_get_all_azure_monitoring_integrations_error_404(self) -> None:
|
|
"""Integration test for get_all_azure_monitoring_integrations 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_all_azure_monitoring_integrations(
|
|
|
|
aid=aid,
|
|
|
|
_headers=self.te_headers("get_all_azure_monitoring_integrations", error_status="404"),
|
|
)
|
|
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
|
|
|
|
|
|
def test_get_all_azure_monitoring_integrations_error_429(self) -> None:
|
|
"""Integration test for get_all_azure_monitoring_integrations 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_all_azure_monitoring_integrations(
|
|
|
|
aid=aid,
|
|
|
|
_headers=self.te_headers("get_all_azure_monitoring_integrations", error_status="429"),
|
|
)
|
|
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
|
|
|
|
|
|
def test_get_all_azure_monitoring_integrations_error_500(self) -> None:
|
|
"""Integration test for get_all_azure_monitoring_integrations 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_all_azure_monitoring_integrations(
|
|
|
|
aid=aid,
|
|
|
|
_headers=self.te_headers("get_all_azure_monitoring_integrations", error_status="500"),
|
|
)
|
|
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
|
|
|
|
|
|
|
|
|
|
def test_get_aws_monitoring_integration_happy_path(self) -> None:
|
|
"""Integration test for get_aws_monitoring_integration success path"""
|
|
integration_id = 'e9c3bf02-a48c-4aa8-9e5f-898800d6f569'
|
|
aid = '1234'
|
|
response_body_json = """
|
|
{
|
|
"monitoringType" : "inventory-monitoring",
|
|
"_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"
|
|
}
|
|
},
|
|
"roleArn" : "arn:aws:iam::01234567890:role/aws-monitoring-ro",
|
|
"name" : "integration name",
|
|
"externalId" : "37d8f861cffd34212b5a34466564da1f80b01a30",
|
|
"snsTopicsArns" : [ "arn:aws:sns:us-east-1:01234567890:SNS-Topic-US", "arn:aws:sns:eu-central-1:01234567890:SNS-Topic-EU" ],
|
|
"id" : "e9c3bf02-a48c-4aa8-9e5f-898800d6f569"
|
|
}
|
|
"""
|
|
expected_response = json.loads(response_body_json)
|
|
response = self.api.get_aws_monitoring_integration(
|
|
|
|
integration_id=integration_id,
|
|
|
|
aid=aid,
|
|
|
|
_headers=self.te_headers("get_aws_monitoring_integration"),
|
|
)
|
|
assert_constructed_model_matches_example_json(response, expected_response)
|
|
|
|
|
|
def test_get_aws_monitoring_integration_error_401(self) -> None:
|
|
"""Integration test for get_aws_monitoring_integration error path (HTTP 401)"""
|
|
integration_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_aws_monitoring_integration(
|
|
|
|
integration_id=integration_id,
|
|
|
|
aid=aid,
|
|
|
|
_headers=self.te_headers("get_aws_monitoring_integration", error_status="401"),
|
|
)
|
|
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
|
|
|
|
|
|
def test_get_aws_monitoring_integration_error_403(self) -> None:
|
|
"""Integration test for get_aws_monitoring_integration error path (HTTP 403)"""
|
|
integration_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_aws_monitoring_integration(
|
|
|
|
integration_id=integration_id,
|
|
|
|
aid=aid,
|
|
|
|
_headers=self.te_headers("get_aws_monitoring_integration", error_status="403"),
|
|
)
|
|
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
|
|
|
|
|
|
def test_get_aws_monitoring_integration_error_404(self) -> None:
|
|
"""Integration test for get_aws_monitoring_integration error path (HTTP 404)"""
|
|
integration_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_aws_monitoring_integration(
|
|
|
|
integration_id=integration_id,
|
|
|
|
aid=aid,
|
|
|
|
_headers=self.te_headers("get_aws_monitoring_integration", error_status="404"),
|
|
)
|
|
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
|
|
|
|
|
|
def test_get_aws_monitoring_integration_error_429(self) -> None:
|
|
"""Integration test for get_aws_monitoring_integration error path (HTTP 429)"""
|
|
integration_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_aws_monitoring_integration(
|
|
|
|
integration_id=integration_id,
|
|
|
|
aid=aid,
|
|
|
|
_headers=self.te_headers("get_aws_monitoring_integration", error_status="429"),
|
|
)
|
|
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
|
|
|
|
|
|
def test_get_aws_monitoring_integration_error_500(self) -> None:
|
|
"""Integration test for get_aws_monitoring_integration error path (HTTP 500)"""
|
|
integration_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_aws_monitoring_integration(
|
|
|
|
integration_id=integration_id,
|
|
|
|
aid=aid,
|
|
|
|
_headers=self.te_headers("get_aws_monitoring_integration", error_status="500"),
|
|
)
|
|
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
|
|
|
|
|
|
|
|
|
|
def test_get_azure_monitoring_integration_happy_path(self) -> None:
|
|
"""Integration test for get_azure_monitoring_integration success path"""
|
|
integration_id = 'e9c3bf02-a48c-4aa8-9e5f-898800d6f569'
|
|
aid = '1234'
|
|
response_body_json = """
|
|
{
|
|
"password" : "********",
|
|
"monitoringType" : "azure-inventory-monitoring",
|
|
"_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"
|
|
}
|
|
},
|
|
"appId" : "2f9b2a1c-6d87-4c92-9d51-37efc93c0a4f",
|
|
"name" : "integration name",
|
|
"id" : "e9c3bf02-a48c-4aa8-9e5f-898800d6f569",
|
|
"azureTenantId" : "e3a72c9b-42b1-4e0b-9b9f-7f6a3b2a1c44",
|
|
"serviceBusQueueUrl" : "https://your-service-bus-namespace.servicebus.windows.net/your-queue-name"
|
|
}
|
|
"""
|
|
expected_response = json.loads(response_body_json)
|
|
response = self.api.get_azure_monitoring_integration(
|
|
|
|
integration_id=integration_id,
|
|
|
|
aid=aid,
|
|
|
|
_headers=self.te_headers("get_azure_monitoring_integration"),
|
|
)
|
|
assert_constructed_model_matches_example_json(response, expected_response)
|
|
|
|
|
|
def test_get_azure_monitoring_integration_error_401(self) -> None:
|
|
"""Integration test for get_azure_monitoring_integration error path (HTTP 401)"""
|
|
integration_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_azure_monitoring_integration(
|
|
|
|
integration_id=integration_id,
|
|
|
|
aid=aid,
|
|
|
|
_headers=self.te_headers("get_azure_monitoring_integration", error_status="401"),
|
|
)
|
|
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
|
|
|
|
|
|
def test_get_azure_monitoring_integration_error_403(self) -> None:
|
|
"""Integration test for get_azure_monitoring_integration error path (HTTP 403)"""
|
|
integration_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_azure_monitoring_integration(
|
|
|
|
integration_id=integration_id,
|
|
|
|
aid=aid,
|
|
|
|
_headers=self.te_headers("get_azure_monitoring_integration", error_status="403"),
|
|
)
|
|
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
|
|
|
|
|
|
def test_get_azure_monitoring_integration_error_404(self) -> None:
|
|
"""Integration test for get_azure_monitoring_integration error path (HTTP 404)"""
|
|
integration_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_azure_monitoring_integration(
|
|
|
|
integration_id=integration_id,
|
|
|
|
aid=aid,
|
|
|
|
_headers=self.te_headers("get_azure_monitoring_integration", error_status="404"),
|
|
)
|
|
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
|
|
|
|
|
|
def test_get_azure_monitoring_integration_error_429(self) -> None:
|
|
"""Integration test for get_azure_monitoring_integration error path (HTTP 429)"""
|
|
integration_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_azure_monitoring_integration(
|
|
|
|
integration_id=integration_id,
|
|
|
|
aid=aid,
|
|
|
|
_headers=self.te_headers("get_azure_monitoring_integration", error_status="429"),
|
|
)
|
|
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
|
|
|
|
|
|
def test_get_azure_monitoring_integration_error_500(self) -> None:
|
|
"""Integration test for get_azure_monitoring_integration error path (HTTP 500)"""
|
|
integration_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_azure_monitoring_integration(
|
|
|
|
integration_id=integration_id,
|
|
|
|
aid=aid,
|
|
|
|
_headers=self.te_headers("get_azure_monitoring_integration", error_status="500"),
|
|
)
|
|
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
|
|
|
|
|
|
|
|
|
|
def test_update_azure_flow_logs_monitoring_integration_happy_path(self) -> None:
|
|
"""Integration test for update_azure_flow_logs_monitoring_integration success path"""
|
|
request_body_json = """
|
|
|
|
{
|
|
"password" : "p9z4Q~U7LkdX1yZr3TcB6fJqG8aM0sDeT5R9hVnKw",
|
|
"appId" : "2f9b2a1c-6d87-4c92-9d51-37efc93c0a4f",
|
|
"name" : "integration name",
|
|
"azureTenantId" : "e3a72c9b-42b1-4e0b-9b9f-7f6a3b2a1c44",
|
|
"serviceBusQueueUrl" : "https://your-service-bus-namespace.servicebus.windows.net/your-queue-name"
|
|
}
|
|
|
|
"""
|
|
azure_flow_logs_integration_request = thousandeyes_sdk.cloud_insights_integrations.models.AzureFlowLogsIntegrationRequest.from_json(request_body_json)
|
|
integration_id = 'e9c3bf02-a48c-4aa8-9e5f-898800d6f569'
|
|
aid = '1234'
|
|
response_body_json = """
|
|
{
|
|
"password" : "********",
|
|
"monitoringType" : "azure-inventory-monitoring",
|
|
"_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"
|
|
}
|
|
},
|
|
"appId" : "2f9b2a1c-6d87-4c92-9d51-37efc93c0a4f",
|
|
"name" : "integration name",
|
|
"id" : "e9c3bf02-a48c-4aa8-9e5f-898800d6f569",
|
|
"azureTenantId" : "e3a72c9b-42b1-4e0b-9b9f-7f6a3b2a1c44",
|
|
"serviceBusQueueUrl" : "https://your-service-bus-namespace.servicebus.windows.net/your-queue-name"
|
|
}
|
|
"""
|
|
expected_response = json.loads(response_body_json)
|
|
response = self.api.update_azure_flow_logs_monitoring_integration(
|
|
|
|
integration_id=integration_id,
|
|
|
|
azure_flow_logs_integration_request=azure_flow_logs_integration_request,
|
|
|
|
aid=aid,
|
|
|
|
_headers=self.te_headers("update_azure_flow_logs_monitoring_integration"),
|
|
)
|
|
assert_constructed_model_matches_example_json(response, expected_response)
|
|
|
|
|
|
def test_update_azure_flow_logs_monitoring_integration_error_400(self) -> None:
|
|
"""Integration test for update_azure_flow_logs_monitoring_integration error path (HTTP 400)"""
|
|
request_body_json = """
|
|
|
|
{
|
|
"password" : "p9z4Q~U7LkdX1yZr3TcB6fJqG8aM0sDeT5R9hVnKw",
|
|
"appId" : "2f9b2a1c-6d87-4c92-9d51-37efc93c0a4f",
|
|
"name" : "integration name",
|
|
"azureTenantId" : "e3a72c9b-42b1-4e0b-9b9f-7f6a3b2a1c44",
|
|
"serviceBusQueueUrl" : "https://your-service-bus-namespace.servicebus.windows.net/your-queue-name"
|
|
}
|
|
|
|
"""
|
|
azure_flow_logs_integration_request = thousandeyes_sdk.cloud_insights_integrations.models.AzureFlowLogsIntegrationRequest.from_json(request_body_json)
|
|
integration_id = 'e9c3bf02-a48c-4aa8-9e5f-898800d6f569'
|
|
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.update_azure_flow_logs_monitoring_integration(
|
|
|
|
integration_id=integration_id,
|
|
|
|
azure_flow_logs_integration_request=azure_flow_logs_integration_request,
|
|
|
|
aid=aid,
|
|
|
|
_headers=self.te_headers("update_azure_flow_logs_monitoring_integration", error_status="400"),
|
|
)
|
|
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
|
|
|
|
|
|
def test_update_azure_flow_logs_monitoring_integration_error_401(self) -> None:
|
|
"""Integration test for update_azure_flow_logs_monitoring_integration error path (HTTP 401)"""
|
|
request_body_json = """
|
|
|
|
{
|
|
"password" : "p9z4Q~U7LkdX1yZr3TcB6fJqG8aM0sDeT5R9hVnKw",
|
|
"appId" : "2f9b2a1c-6d87-4c92-9d51-37efc93c0a4f",
|
|
"name" : "integration name",
|
|
"azureTenantId" : "e3a72c9b-42b1-4e0b-9b9f-7f6a3b2a1c44",
|
|
"serviceBusQueueUrl" : "https://your-service-bus-namespace.servicebus.windows.net/your-queue-name"
|
|
}
|
|
|
|
"""
|
|
azure_flow_logs_integration_request = thousandeyes_sdk.cloud_insights_integrations.models.AzureFlowLogsIntegrationRequest.from_json(request_body_json)
|
|
integration_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.update_azure_flow_logs_monitoring_integration(
|
|
|
|
integration_id=integration_id,
|
|
|
|
azure_flow_logs_integration_request=azure_flow_logs_integration_request,
|
|
|
|
aid=aid,
|
|
|
|
_headers=self.te_headers("update_azure_flow_logs_monitoring_integration", error_status="401"),
|
|
)
|
|
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
|
|
|
|
|
|
def test_update_azure_flow_logs_monitoring_integration_error_403(self) -> None:
|
|
"""Integration test for update_azure_flow_logs_monitoring_integration error path (HTTP 403)"""
|
|
request_body_json = """
|
|
|
|
{
|
|
"password" : "p9z4Q~U7LkdX1yZr3TcB6fJqG8aM0sDeT5R9hVnKw",
|
|
"appId" : "2f9b2a1c-6d87-4c92-9d51-37efc93c0a4f",
|
|
"name" : "integration name",
|
|
"azureTenantId" : "e3a72c9b-42b1-4e0b-9b9f-7f6a3b2a1c44",
|
|
"serviceBusQueueUrl" : "https://your-service-bus-namespace.servicebus.windows.net/your-queue-name"
|
|
}
|
|
|
|
"""
|
|
azure_flow_logs_integration_request = thousandeyes_sdk.cloud_insights_integrations.models.AzureFlowLogsIntegrationRequest.from_json(request_body_json)
|
|
integration_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.update_azure_flow_logs_monitoring_integration(
|
|
|
|
integration_id=integration_id,
|
|
|
|
azure_flow_logs_integration_request=azure_flow_logs_integration_request,
|
|
|
|
aid=aid,
|
|
|
|
_headers=self.te_headers("update_azure_flow_logs_monitoring_integration", error_status="403"),
|
|
)
|
|
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
|
|
|
|
|
|
def test_update_azure_flow_logs_monitoring_integration_error_404(self) -> None:
|
|
"""Integration test for update_azure_flow_logs_monitoring_integration error path (HTTP 404)"""
|
|
request_body_json = """
|
|
|
|
{
|
|
"password" : "p9z4Q~U7LkdX1yZr3TcB6fJqG8aM0sDeT5R9hVnKw",
|
|
"appId" : "2f9b2a1c-6d87-4c92-9d51-37efc93c0a4f",
|
|
"name" : "integration name",
|
|
"azureTenantId" : "e3a72c9b-42b1-4e0b-9b9f-7f6a3b2a1c44",
|
|
"serviceBusQueueUrl" : "https://your-service-bus-namespace.servicebus.windows.net/your-queue-name"
|
|
}
|
|
|
|
"""
|
|
azure_flow_logs_integration_request = thousandeyes_sdk.cloud_insights_integrations.models.AzureFlowLogsIntegrationRequest.from_json(request_body_json)
|
|
integration_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.update_azure_flow_logs_monitoring_integration(
|
|
|
|
integration_id=integration_id,
|
|
|
|
azure_flow_logs_integration_request=azure_flow_logs_integration_request,
|
|
|
|
aid=aid,
|
|
|
|
_headers=self.te_headers("update_azure_flow_logs_monitoring_integration", error_status="404"),
|
|
)
|
|
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
|
|
|
|
|
|
def test_update_azure_flow_logs_monitoring_integration_error_429(self) -> None:
|
|
"""Integration test for update_azure_flow_logs_monitoring_integration error path (HTTP 429)"""
|
|
request_body_json = """
|
|
|
|
{
|
|
"password" : "p9z4Q~U7LkdX1yZr3TcB6fJqG8aM0sDeT5R9hVnKw",
|
|
"appId" : "2f9b2a1c-6d87-4c92-9d51-37efc93c0a4f",
|
|
"name" : "integration name",
|
|
"azureTenantId" : "e3a72c9b-42b1-4e0b-9b9f-7f6a3b2a1c44",
|
|
"serviceBusQueueUrl" : "https://your-service-bus-namespace.servicebus.windows.net/your-queue-name"
|
|
}
|
|
|
|
"""
|
|
azure_flow_logs_integration_request = thousandeyes_sdk.cloud_insights_integrations.models.AzureFlowLogsIntegrationRequest.from_json(request_body_json)
|
|
integration_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.update_azure_flow_logs_monitoring_integration(
|
|
|
|
integration_id=integration_id,
|
|
|
|
azure_flow_logs_integration_request=azure_flow_logs_integration_request,
|
|
|
|
aid=aid,
|
|
|
|
_headers=self.te_headers("update_azure_flow_logs_monitoring_integration", error_status="429"),
|
|
)
|
|
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
|
|
|
|
|
|
def test_update_azure_flow_logs_monitoring_integration_error_500(self) -> None:
|
|
"""Integration test for update_azure_flow_logs_monitoring_integration error path (HTTP 500)"""
|
|
request_body_json = """
|
|
|
|
{
|
|
"password" : "p9z4Q~U7LkdX1yZr3TcB6fJqG8aM0sDeT5R9hVnKw",
|
|
"appId" : "2f9b2a1c-6d87-4c92-9d51-37efc93c0a4f",
|
|
"name" : "integration name",
|
|
"azureTenantId" : "e3a72c9b-42b1-4e0b-9b9f-7f6a3b2a1c44",
|
|
"serviceBusQueueUrl" : "https://your-service-bus-namespace.servicebus.windows.net/your-queue-name"
|
|
}
|
|
|
|
"""
|
|
azure_flow_logs_integration_request = thousandeyes_sdk.cloud_insights_integrations.models.AzureFlowLogsIntegrationRequest.from_json(request_body_json)
|
|
integration_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.update_azure_flow_logs_monitoring_integration(
|
|
|
|
integration_id=integration_id,
|
|
|
|
azure_flow_logs_integration_request=azure_flow_logs_integration_request,
|
|
|
|
aid=aid,
|
|
|
|
_headers=self.te_headers("update_azure_flow_logs_monitoring_integration", error_status="500"),
|
|
)
|
|
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
|
|
|
|
|
|
|
|
|
|
def test_update_azure_inventory_monitoring_integration_happy_path(self) -> None:
|
|
"""Integration test for update_azure_inventory_monitoring_integration success path"""
|
|
request_body_json = """
|
|
|
|
{
|
|
"password" : "p9z4Q~U7LkdX1yZr3TcB6fJqG8aM0sDeT5R9hVnKw",
|
|
"appId" : "2f9b2a1c-6d87-4c92-9d51-37efc93c0a4f",
|
|
"name" : "integration name",
|
|
"azureTenantId" : "e3a72c9b-42b1-4e0b-9b9f-7f6a3b2a1c44"
|
|
}
|
|
|
|
"""
|
|
azure_inventory_integration_request = thousandeyes_sdk.cloud_insights_integrations.models.AzureInventoryIntegrationRequest.from_json(request_body_json)
|
|
integration_id = 'e9c3bf02-a48c-4aa8-9e5f-898800d6f569'
|
|
aid = '1234'
|
|
response_body_json = """
|
|
{
|
|
"password" : "********",
|
|
"monitoringType" : "azure-inventory-monitoring",
|
|
"_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"
|
|
}
|
|
},
|
|
"appId" : "2f9b2a1c-6d87-4c92-9d51-37efc93c0a4f",
|
|
"name" : "integration name",
|
|
"id" : "e9c3bf02-a48c-4aa8-9e5f-898800d6f569",
|
|
"azureTenantId" : "e3a72c9b-42b1-4e0b-9b9f-7f6a3b2a1c44",
|
|
"serviceBusQueueUrl" : "https://your-service-bus-namespace.servicebus.windows.net/your-queue-name"
|
|
}
|
|
"""
|
|
expected_response = json.loads(response_body_json)
|
|
response = self.api.update_azure_inventory_monitoring_integration(
|
|
|
|
integration_id=integration_id,
|
|
|
|
azure_inventory_integration_request=azure_inventory_integration_request,
|
|
|
|
aid=aid,
|
|
|
|
_headers=self.te_headers("update_azure_inventory_monitoring_integration"),
|
|
)
|
|
assert_constructed_model_matches_example_json(response, expected_response)
|
|
|
|
|
|
def test_update_azure_inventory_monitoring_integration_error_400(self) -> None:
|
|
"""Integration test for update_azure_inventory_monitoring_integration error path (HTTP 400)"""
|
|
request_body_json = """
|
|
|
|
{
|
|
"password" : "p9z4Q~U7LkdX1yZr3TcB6fJqG8aM0sDeT5R9hVnKw",
|
|
"appId" : "2f9b2a1c-6d87-4c92-9d51-37efc93c0a4f",
|
|
"name" : "integration name",
|
|
"azureTenantId" : "e3a72c9b-42b1-4e0b-9b9f-7f6a3b2a1c44"
|
|
}
|
|
|
|
"""
|
|
azure_inventory_integration_request = thousandeyes_sdk.cloud_insights_integrations.models.AzureInventoryIntegrationRequest.from_json(request_body_json)
|
|
integration_id = 'e9c3bf02-a48c-4aa8-9e5f-898800d6f569'
|
|
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.update_azure_inventory_monitoring_integration(
|
|
|
|
integration_id=integration_id,
|
|
|
|
azure_inventory_integration_request=azure_inventory_integration_request,
|
|
|
|
aid=aid,
|
|
|
|
_headers=self.te_headers("update_azure_inventory_monitoring_integration", error_status="400"),
|
|
)
|
|
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
|
|
|
|
|
|
def test_update_azure_inventory_monitoring_integration_error_401(self) -> None:
|
|
"""Integration test for update_azure_inventory_monitoring_integration error path (HTTP 401)"""
|
|
request_body_json = """
|
|
|
|
{
|
|
"password" : "p9z4Q~U7LkdX1yZr3TcB6fJqG8aM0sDeT5R9hVnKw",
|
|
"appId" : "2f9b2a1c-6d87-4c92-9d51-37efc93c0a4f",
|
|
"name" : "integration name",
|
|
"azureTenantId" : "e3a72c9b-42b1-4e0b-9b9f-7f6a3b2a1c44"
|
|
}
|
|
|
|
"""
|
|
azure_inventory_integration_request = thousandeyes_sdk.cloud_insights_integrations.models.AzureInventoryIntegrationRequest.from_json(request_body_json)
|
|
integration_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.update_azure_inventory_monitoring_integration(
|
|
|
|
integration_id=integration_id,
|
|
|
|
azure_inventory_integration_request=azure_inventory_integration_request,
|
|
|
|
aid=aid,
|
|
|
|
_headers=self.te_headers("update_azure_inventory_monitoring_integration", error_status="401"),
|
|
)
|
|
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
|
|
|
|
|
|
def test_update_azure_inventory_monitoring_integration_error_403(self) -> None:
|
|
"""Integration test for update_azure_inventory_monitoring_integration error path (HTTP 403)"""
|
|
request_body_json = """
|
|
|
|
{
|
|
"password" : "p9z4Q~U7LkdX1yZr3TcB6fJqG8aM0sDeT5R9hVnKw",
|
|
"appId" : "2f9b2a1c-6d87-4c92-9d51-37efc93c0a4f",
|
|
"name" : "integration name",
|
|
"azureTenantId" : "e3a72c9b-42b1-4e0b-9b9f-7f6a3b2a1c44"
|
|
}
|
|
|
|
"""
|
|
azure_inventory_integration_request = thousandeyes_sdk.cloud_insights_integrations.models.AzureInventoryIntegrationRequest.from_json(request_body_json)
|
|
integration_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.update_azure_inventory_monitoring_integration(
|
|
|
|
integration_id=integration_id,
|
|
|
|
azure_inventory_integration_request=azure_inventory_integration_request,
|
|
|
|
aid=aid,
|
|
|
|
_headers=self.te_headers("update_azure_inventory_monitoring_integration", error_status="403"),
|
|
)
|
|
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
|
|
|
|
|
|
def test_update_azure_inventory_monitoring_integration_error_404(self) -> None:
|
|
"""Integration test for update_azure_inventory_monitoring_integration error path (HTTP 404)"""
|
|
request_body_json = """
|
|
|
|
{
|
|
"password" : "p9z4Q~U7LkdX1yZr3TcB6fJqG8aM0sDeT5R9hVnKw",
|
|
"appId" : "2f9b2a1c-6d87-4c92-9d51-37efc93c0a4f",
|
|
"name" : "integration name",
|
|
"azureTenantId" : "e3a72c9b-42b1-4e0b-9b9f-7f6a3b2a1c44"
|
|
}
|
|
|
|
"""
|
|
azure_inventory_integration_request = thousandeyes_sdk.cloud_insights_integrations.models.AzureInventoryIntegrationRequest.from_json(request_body_json)
|
|
integration_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.update_azure_inventory_monitoring_integration(
|
|
|
|
integration_id=integration_id,
|
|
|
|
azure_inventory_integration_request=azure_inventory_integration_request,
|
|
|
|
aid=aid,
|
|
|
|
_headers=self.te_headers("update_azure_inventory_monitoring_integration", error_status="404"),
|
|
)
|
|
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
|
|
|
|
|
|
def test_update_azure_inventory_monitoring_integration_error_429(self) -> None:
|
|
"""Integration test for update_azure_inventory_monitoring_integration error path (HTTP 429)"""
|
|
request_body_json = """
|
|
|
|
{
|
|
"password" : "p9z4Q~U7LkdX1yZr3TcB6fJqG8aM0sDeT5R9hVnKw",
|
|
"appId" : "2f9b2a1c-6d87-4c92-9d51-37efc93c0a4f",
|
|
"name" : "integration name",
|
|
"azureTenantId" : "e3a72c9b-42b1-4e0b-9b9f-7f6a3b2a1c44"
|
|
}
|
|
|
|
"""
|
|
azure_inventory_integration_request = thousandeyes_sdk.cloud_insights_integrations.models.AzureInventoryIntegrationRequest.from_json(request_body_json)
|
|
integration_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.update_azure_inventory_monitoring_integration(
|
|
|
|
integration_id=integration_id,
|
|
|
|
azure_inventory_integration_request=azure_inventory_integration_request,
|
|
|
|
aid=aid,
|
|
|
|
_headers=self.te_headers("update_azure_inventory_monitoring_integration", error_status="429"),
|
|
)
|
|
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
|
|
|
|
|
|
def test_update_azure_inventory_monitoring_integration_error_500(self) -> None:
|
|
"""Integration test for update_azure_inventory_monitoring_integration error path (HTTP 500)"""
|
|
request_body_json = """
|
|
|
|
{
|
|
"password" : "p9z4Q~U7LkdX1yZr3TcB6fJqG8aM0sDeT5R9hVnKw",
|
|
"appId" : "2f9b2a1c-6d87-4c92-9d51-37efc93c0a4f",
|
|
"name" : "integration name",
|
|
"azureTenantId" : "e3a72c9b-42b1-4e0b-9b9f-7f6a3b2a1c44"
|
|
}
|
|
|
|
"""
|
|
azure_inventory_integration_request = thousandeyes_sdk.cloud_insights_integrations.models.AzureInventoryIntegrationRequest.from_json(request_body_json)
|
|
integration_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.update_azure_inventory_monitoring_integration(
|
|
|
|
integration_id=integration_id,
|
|
|
|
azure_inventory_integration_request=azure_inventory_integration_request,
|
|
|
|
aid=aid,
|
|
|
|
_headers=self.te_headers("update_azure_inventory_monitoring_integration", error_status="500"),
|
|
)
|
|
assert_constructed_model_matches_example_json(context.exception.data, expected_error)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if __name__ == '__main__':
|
|
unittest.main()
|