# coding: utf-8

"""
    Event Detection API

    Event detection occurs when ThousandEyes identifies that error signals related to a component (proxy, network node, AS, server etc) have deviated from the baselines established by events. * To determine this, ThousandEyes takes the test results from all accounts groups within an organization, and analyzes that data. * Noisy test results (those that have too many errors in a short window) are removed until they stabilize, and the rest of the results are tagged with the components associated with that test result (for example, proxy, network, or server). * Next, any increase in failures from the test results and each component helps in determining the problem domain and which component may be at fault. * When this failure rate increases beyond a pre-defined threshold (set by the algorithm), an event is triggered and an email notification is sent to the user (if they've enabled email alerts).  With the Events API, you can perform the following tasks on the ThousandEyes platform: * **Retrieve Events**: Obtain a list of events and detailed information for each event. For more information about events, see [Event Detection](https://docs.thousandeyes.com/product-documentation/event-detection). 

    Generated by OpenAPI Generator (https://openapi-generator.tech)

    Do not edit the class manually.
"""  # noqa: E501


import json

from sdk_test_support.mock_server_types import ErrorResponseExpectation, OperationExpectation

OPERATION_MANIFEST = {

    "get_event": OperationExpectation(
        operation_id="get_event",
        method="GET",
        path="/events/{id}",
        path_param_examples={
            "id": 'e9c3bf02-a48c-4aa8-9e5f-898800d6f569',
        },
        success_status=200,
        success_body=json.loads("""

                {
                  "severity" : "medium",
                  "summary" : "Significant number of issues detected with 66.29.146.15",
                  "agentType" : "cloud-enterprise-agent",
                  "affectedTests" : {
                    "total" : 5,
                    "tests" : [ {
                      "affectedTargetIds" : [ "123", "1234" ],
                      "affectedAgentIds" : [ "2954", "2953" ],
                      "_links" : {
                        "test" : {
                          "hreflang" : "hreflang",
                          "templated" : true,
                          "profile" : "profile",
                          "name" : "name",
                          "href" : "https://api.thousandeyes.com/v7/link/to/resource/id",
                          "type" : "type",
                          "deprecation" : "deprecation",
                          "title" : "title"
                        }
                      },
                      "name" : "Google test",
                      "testType" : "agent-to-server",
                      "testId" : "226770"
                    }, {
                      "affectedTargetIds" : [ "123", "1234" ],
                      "affectedAgentIds" : [ "2954", "2953" ],
                      "_links" : {
                        "test" : {
                          "hreflang" : "hreflang",
                          "templated" : true,
                          "profile" : "profile",
                          "name" : "name",
                          "href" : "https://api.thousandeyes.com/v7/link/to/resource/id",
                          "type" : "type",
                          "deprecation" : "deprecation",
                          "title" : "title"
                        }
                      },
                      "name" : "Google test",
                      "testType" : "agent-to-server",
                      "testId" : "226770"
                    } ],
                    "inAccountGroup" : 2
                  },
                  "endDate" : "2020-04-23T13:43:16Z",
                  "_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"
                    }
                  },
                  "typeName" : "Network Issue",
                  "cause" : [ "Network Loss and/or High RTT" ],
                  "affectedTargets" : {
                    "total" : 5,
                    "inAccountGroup" : 2,
                    "targets" : [ {
                      "affectedAgentIds" : [ "2954", "2953" ],
                      "ip" : "216.239.32.10",
                      "name" : "google.com",
                      "affectedTestIds" : [ "123", "1234" ],
                      "serverId" : "123"
                    }, {
                      "affectedAgentIds" : [ "2954", "2953" ],
                      "ip" : "216.239.32.10",
                      "name" : "google.com",
                      "affectedTestIds" : [ "123", "1234" ],
                      "serverId" : "123"
                    } ]
                  },
                  "type" : "target",
                  "grouping" : {
                    "target" : "google.com"
                  },
                  "affectedAgents" : {
                    "total" : 5,
                    "inAccountGroup" : 2,
                    "agents" : [ {
                      "affectedTargetIds" : [ "123", "1234" ],
                      "agentId" : "2954",
                      "_links" : {
                        "agent" : {
                          "hreflang" : "hreflang",
                          "templated" : true,
                          "profile" : "profile",
                          "name" : "name",
                          "href" : "https://api.thousandeyes.com/v7/link/to/resource/id",
                          "type" : "type",
                          "deprecation" : "deprecation",
                          "title" : "title"
                        }
                      },
                      "countryCode" : "BR",
                      "name" : "São Paulo, Brazil - agent",
                      "location" : "São Paulo, Brazil",
                      "affectedTestIds" : [ "2954", "2953" ],
                      "type" : "enterprise"
                    }, {
                      "affectedTargetIds" : [ "123", "1234" ],
                      "agentId" : "2954",
                      "_links" : {
                        "agent" : {
                          "hreflang" : "hreflang",
                          "templated" : true,
                          "profile" : "profile",
                          "name" : "name",
                          "href" : "https://api.thousandeyes.com/v7/link/to/resource/id",
                          "type" : "type",
                          "deprecation" : "deprecation",
                          "title" : "title"
                        }
                      },
                      "countryCode" : "BR",
                      "name" : "São Paulo, Brazil - agent",
                      "location" : "São Paulo, Brazil",
                      "affectedTestIds" : [ "2954", "2953" ],
                      "type" : "enterprise"
                    } ]
                  },
                  "id" : "e9c3bf02-a48c-4aa8-9e5f-898800d6f569",
                  "state" : "resolved",
                  "aid" : "1234",
                  "startDate" : "2020-04-23T13:43:16Z"
                }

                """),

        success_content_type="application/json",

        request_body_example=None,
        error_responses={

            "401": ErrorResponseExpectation(
                status=401,
                body=json.loads("""
                {
                  "error_description" : "Invalid access token",
                  "error" : "invalid_token"
                }"""),
                content_type="application/json",
            ),

            "403": ErrorResponseExpectation(
                status=403,
                body=json.loads("""
                {
                  "instance" : "instance",
                  "detail" : "detail",
                  "type" : "type",
                  "title" : "title",
                  "status" : 6
                }"""),
                content_type="application/json",
            ),

            "404": ErrorResponseExpectation(
                status=404,
                body=json.loads("""
                {
                  "instance" : "instance",
                  "detail" : "detail",
                  "type" : "type",
                  "title" : "title",
                  "status" : 6
                }"""),
                content_type="application/json",
            ),

            "429": ErrorResponseExpectation(
                status=429,
                body=json.loads("""
                {
                  "instance" : "instance",
                  "detail" : "detail",
                  "type" : "type",
                  "title" : "title",
                  "status" : 6
                }"""),
                content_type="application/json",
            ),

            "500": ErrorResponseExpectation(
                status=500,
                body=json.loads("""
                {
                  "instance" : "instance",
                  "detail" : "detail",
                  "type" : "type",
                  "title" : "title",
                  "status" : 6
                }"""),
                content_type="application/json",
            ),

            "502": ErrorResponseExpectation(
                status=502,
                body=json.loads("""
                {
                  "instance" : "instance",
                  "detail" : "detail",
                  "type" : "type",
                  "title" : "title",
                  "status" : 6
                }"""),
                content_type="application/json",
            ),

        },
    ),

    "get_events": OperationExpectation(
        operation_id="get_events",
        method="GET",
        path="/events",
        path_param_examples={
        },
        success_status=200,
        success_body=json.loads("""

                {
                  "endDate" : "2022-07-18T22:00:54Z",
                  "_links" : {
                    "next" : {
                      "hreflang" : "hreflang",
                      "templated" : true,
                      "profile" : "profile",
                      "name" : "name",
                      "href" : "https://api.thousandeyes.com/v7/link/to/resource/id",
                      "type" : "type",
                      "deprecation" : "deprecation",
                      "title" : "title"
                    },
                    "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"
                    }
                  },
                  "aid" : "1234",
                  "startDate" : "2022-07-17T22:00:54Z",
                  "events" : [ {
                    "severity" : "medium",
                    "agentType" : "cloud-enterprise-agent",
                    "affectedTests" : {
                      "total" : 5,
                      "inAccountGroup" : 2
                    },
                    "endDate" : "2020-04-23T13:43:16Z",
                    "_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"
                      }
                    },
                    "typeName" : "Network Issue",
                    "title" : "Affecting destinations in google.com",
                    "type" : "target",
                    "affectedTargets" : {
                      "total" : 5,
                      "inAccountGroup" : 2
                    },
                    "affectedAgents" : {
                      "total" : 5,
                      "inAccountGroup" : 2
                    },
                    "id" : "e9c3bf02-a48c-4aa8-9e5f-898800d6f569",
                    "state" : "resolved",
                    "startDate" : "2020-04-23T13:43:16Z"
                  }, {
                    "severity" : "medium",
                    "agentType" : "cloud-enterprise-agent",
                    "affectedTests" : {
                      "total" : 5,
                      "inAccountGroup" : 2
                    },
                    "endDate" : "2020-04-23T13:43:16Z",
                    "_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"
                      }
                    },
                    "typeName" : "Network Issue",
                    "title" : "Affecting destinations in google.com",
                    "type" : "target",
                    "affectedTargets" : {
                      "total" : 5,
                      "inAccountGroup" : 2
                    },
                    "affectedAgents" : {
                      "total" : 5,
                      "inAccountGroup" : 2
                    },
                    "id" : "e9c3bf02-a48c-4aa8-9e5f-898800d6f569",
                    "state" : "resolved",
                    "startDate" : "2020-04-23T13:43:16Z"
                  } ]
                }

                """),

        success_content_type="application/json",

        request_body_example=None,
        error_responses={

            "400": ErrorResponseExpectation(
                status=400,
                body=json.loads("""
                {
                  "instance" : "instance",
                  "detail" : "detail",
                  "type" : "type",
                  "title" : "title",
                  "errors" : [ {
                    "code" : "code",
                    "field" : "field",
                    "message" : "message"
                  }, {
                    "code" : "code",
                    "field" : "field",
                    "message" : "message"
                  } ],
                  "status" : 0
                }"""),
                content_type="application/json",
            ),

            "401": ErrorResponseExpectation(
                status=401,
                body=json.loads("""
                {
                  "error_description" : "Invalid access token",
                  "error" : "invalid_token"
                }"""),
                content_type="application/json",
            ),

            "403": ErrorResponseExpectation(
                status=403,
                body=json.loads("""
                {
                  "instance" : "instance",
                  "detail" : "detail",
                  "type" : "type",
                  "title" : "title",
                  "status" : 6
                }"""),
                content_type="application/json",
            ),

            "404": ErrorResponseExpectation(
                status=404,
                body=json.loads("""
                {
                  "instance" : "instance",
                  "detail" : "detail",
                  "type" : "type",
                  "title" : "title",
                  "status" : 6
                }"""),
                content_type="application/json",
            ),

            "429": ErrorResponseExpectation(
                status=429,
                body=json.loads("""
                {
                  "instance" : "instance",
                  "detail" : "detail",
                  "type" : "type",
                  "title" : "title",
                  "status" : 6
                }"""),
                content_type="application/json",
            ),

            "500": ErrorResponseExpectation(
                status=500,
                body=json.loads("""
                {
                  "instance" : "instance",
                  "detail" : "detail",
                  "type" : "type",
                  "title" : "title",
                  "status" : 6
                }"""),
                content_type="application/json",
            ),

            "502": ErrorResponseExpectation(
                status=502,
                body=json.loads("""
                {
                  "instance" : "instance",
                  "detail" : "detail",
                  "type" : "type",
                  "title" : "title",
                  "status" : 6
                }"""),
                content_type="application/json",
            ),

        },
    ),

}
