mirror of
https://github.com/thousandeyes/thousandeyes-sdk-python.git
synced 2025-12-06 07:55:31 +00:00
913 lines
39 KiB
Python
913 lines
39 KiB
Python
# coding: utf-8
|
|
|
|
"""
|
|
Emulation API
|
|
|
|
The Emulation API facilitates the retrieval of user-agent strings for HTTP, pageload, and transaction tests. It also enables the retrieval and addition of emulated devices for pageload and transaction tests. To access Emulation API endpoints, the following permissions are required: * `Settings Tests Read` for read operations. * `Settings Tests Update` for write operations.
|
|
|
|
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
|
|
|
Do not edit the class manually.
|
|
""" # noqa: E501
|
|
|
|
import warnings
|
|
from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt
|
|
from typing import Any, Dict, List, Optional, Tuple, Union
|
|
from typing_extensions import Annotated
|
|
from importlib.metadata import version
|
|
|
|
import thousandeyes_sdk.emulation.models
|
|
|
|
from pydantic import Field, StrictStr
|
|
from typing import List, Optional
|
|
from typing_extensions import Annotated
|
|
from thousandeyes_sdk.emulation.models.emulated_device import EmulatedDevice
|
|
from thousandeyes_sdk.emulation.models.emulated_device_response import EmulatedDeviceResponse
|
|
from thousandeyes_sdk.emulation.models.emulated_device_responses import EmulatedDeviceResponses
|
|
from thousandeyes_sdk.emulation.models.expand_emulated_device_options import ExpandEmulatedDeviceOptions
|
|
from thousandeyes_sdk.emulation.models.user_agents import UserAgents
|
|
|
|
from thousandeyes_sdk.core.api_client import ApiClient, RequestSerialized
|
|
from thousandeyes_sdk.core.api_response import ApiResponse
|
|
from thousandeyes_sdk.core.rest import RESTResponseType
|
|
|
|
|
|
class EmulationApi:
|
|
"""NOTE: This class is auto generated by OpenAPI Generator
|
|
Ref: https://openapi-generator.tech
|
|
|
|
Do not edit the class manually.
|
|
"""
|
|
|
|
def __init__(self, api_client=None) -> None:
|
|
if api_client is None:
|
|
api_client = ApiClient.get_default()
|
|
api_client.user_agent = "ThousandEyesSDK-Python/{0}".format(version("thousandeyes-sdk-emulation"))
|
|
self.api_client = api_client
|
|
|
|
|
|
@validate_call
|
|
def create_emulated_device(
|
|
self,
|
|
emulated_device: EmulatedDevice,
|
|
aid: Annotated[Optional[StrictStr], Field(description="A unique identifier associated with your account group. You can retrieve your `AccountGroupId` from the `/account-groups` endpoint. Note that you must be assigned to the target account group. Specifying this parameter without being assigned to the target account group will result in an error response.")] = None,
|
|
_request_timeout: Union[
|
|
None,
|
|
Annotated[StrictFloat, Field(gt=0)],
|
|
Tuple[
|
|
Annotated[StrictFloat, Field(gt=0)],
|
|
Annotated[StrictFloat, Field(gt=0)]
|
|
]
|
|
] = None,
|
|
_request_auth: Optional[Dict[StrictStr, Any]] = None,
|
|
_content_type: Optional[StrictStr] = None,
|
|
_headers: Optional[Dict[StrictStr, Any]] = None,
|
|
_host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
|
|
) -> EmulatedDeviceResponse:
|
|
"""Create emulated device
|
|
|
|
Creates a new device for emulation.
|
|
|
|
:param emulated_device: (required)
|
|
:type emulated_device: EmulatedDevice
|
|
:param aid: A unique identifier associated with your account group. You can retrieve your `AccountGroupId` from the `/account-groups` endpoint. Note that you must be assigned to the target account group. Specifying this parameter without being assigned to the target account group will result in an error response.
|
|
:type aid: str
|
|
:param _request_timeout: timeout setting for this request. If one
|
|
number provided, it will be total request
|
|
timeout. It can also be a pair (tuple) of
|
|
(connection, read) timeouts.
|
|
:type _request_timeout: int, tuple(int, int), optional
|
|
:param _request_auth: set to override the auth_settings for an a single
|
|
request; this effectively ignores the
|
|
authentication in the spec for a single request.
|
|
:type _request_auth: dict, optional
|
|
:param _content_type: force content-type for the request.
|
|
:type _content_type: str, Optional
|
|
:param _headers: set to override the headers for a single
|
|
request; this effectively ignores the headers
|
|
in the spec for a single request.
|
|
:type _headers: dict, optional
|
|
:param _host_index: set to override the host_index for a single
|
|
request; this effectively ignores the host_index
|
|
in the spec for a single request.
|
|
:type _host_index: int, optional
|
|
:return: Returns the result object.
|
|
""" # noqa: E501
|
|
|
|
_param = self._create_emulated_device_serialize(
|
|
emulated_device=emulated_device,
|
|
aid=aid,
|
|
_request_auth=_request_auth,
|
|
_content_type=_content_type,
|
|
_headers=_headers,
|
|
_host_index=_host_index
|
|
)
|
|
|
|
_response_types_map: Dict[str, Optional[str]] = {
|
|
'201': "EmulatedDeviceResponse",
|
|
'401': "UnauthorizedError",
|
|
'403': "Error",
|
|
'404': "Error",
|
|
'429': "Error",
|
|
'500': "Error",
|
|
}
|
|
response_data = self.api_client.call_api(
|
|
*_param,
|
|
_request_timeout=_request_timeout
|
|
)
|
|
response_data.read()
|
|
return self.api_client.response_deserialize(
|
|
response_data=response_data,
|
|
response_types_map=_response_types_map,
|
|
models=thousandeyes_sdk.emulation.models,
|
|
).data
|
|
|
|
|
|
@validate_call
|
|
def create_emulated_device_with_http_info(
|
|
self,
|
|
emulated_device: EmulatedDevice,
|
|
aid: Annotated[Optional[StrictStr], Field(description="A unique identifier associated with your account group. You can retrieve your `AccountGroupId` from the `/account-groups` endpoint. Note that you must be assigned to the target account group. Specifying this parameter without being assigned to the target account group will result in an error response.")] = None,
|
|
_request_timeout: Union[
|
|
None,
|
|
Annotated[StrictFloat, Field(gt=0)],
|
|
Tuple[
|
|
Annotated[StrictFloat, Field(gt=0)],
|
|
Annotated[StrictFloat, Field(gt=0)]
|
|
]
|
|
] = None,
|
|
_request_auth: Optional[Dict[StrictStr, Any]] = None,
|
|
_content_type: Optional[StrictStr] = None,
|
|
_headers: Optional[Dict[StrictStr, Any]] = None,
|
|
_host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
|
|
) -> ApiResponse[EmulatedDeviceResponse]:
|
|
"""Create emulated device
|
|
|
|
Creates a new device for emulation.
|
|
|
|
:param emulated_device: (required)
|
|
:type emulated_device: EmulatedDevice
|
|
:param aid: A unique identifier associated with your account group. You can retrieve your `AccountGroupId` from the `/account-groups` endpoint. Note that you must be assigned to the target account group. Specifying this parameter without being assigned to the target account group will result in an error response.
|
|
:type aid: str
|
|
:param _request_timeout: timeout setting for this request. If one
|
|
number provided, it will be total request
|
|
timeout. It can also be a pair (tuple) of
|
|
(connection, read) timeouts.
|
|
:type _request_timeout: int, tuple(int, int), optional
|
|
:param _request_auth: set to override the auth_settings for an a single
|
|
request; this effectively ignores the
|
|
authentication in the spec for a single request.
|
|
:type _request_auth: dict, optional
|
|
:param _content_type: force content-type for the request.
|
|
:type _content_type: str, Optional
|
|
:param _headers: set to override the headers for a single
|
|
request; this effectively ignores the headers
|
|
in the spec for a single request.
|
|
:type _headers: dict, optional
|
|
:param _host_index: set to override the host_index for a single
|
|
request; this effectively ignores the host_index
|
|
in the spec for a single request.
|
|
:type _host_index: int, optional
|
|
:return: Returns the result object.
|
|
""" # noqa: E501
|
|
|
|
_param = self._create_emulated_device_serialize(
|
|
emulated_device=emulated_device,
|
|
aid=aid,
|
|
_request_auth=_request_auth,
|
|
_content_type=_content_type,
|
|
_headers=_headers,
|
|
_host_index=_host_index
|
|
)
|
|
|
|
_response_types_map: Dict[str, Optional[str]] = {
|
|
'201': "EmulatedDeviceResponse",
|
|
'401': "UnauthorizedError",
|
|
'403': "Error",
|
|
'404': "Error",
|
|
'429': "Error",
|
|
'500': "Error",
|
|
}
|
|
response_data = self.api_client.call_api(
|
|
*_param,
|
|
_request_timeout=_request_timeout
|
|
)
|
|
response_data.read()
|
|
return self.api_client.response_deserialize(
|
|
response_data=response_data,
|
|
response_types_map=_response_types_map,
|
|
models=thousandeyes_sdk.emulation.models,
|
|
)
|
|
|
|
|
|
@validate_call
|
|
def create_emulated_device_without_preload_content(
|
|
self,
|
|
emulated_device: EmulatedDevice,
|
|
aid: Annotated[Optional[StrictStr], Field(description="A unique identifier associated with your account group. You can retrieve your `AccountGroupId` from the `/account-groups` endpoint. Note that you must be assigned to the target account group. Specifying this parameter without being assigned to the target account group will result in an error response.")] = None,
|
|
_request_timeout: Union[
|
|
None,
|
|
Annotated[StrictFloat, Field(gt=0)],
|
|
Tuple[
|
|
Annotated[StrictFloat, Field(gt=0)],
|
|
Annotated[StrictFloat, Field(gt=0)]
|
|
]
|
|
] = None,
|
|
_request_auth: Optional[Dict[StrictStr, Any]] = None,
|
|
_content_type: Optional[StrictStr] = None,
|
|
_headers: Optional[Dict[StrictStr, Any]] = None,
|
|
_host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
|
|
) -> RESTResponseType:
|
|
"""Create emulated device
|
|
|
|
Creates a new device for emulation.
|
|
|
|
:param emulated_device: (required)
|
|
:type emulated_device: EmulatedDevice
|
|
:param aid: A unique identifier associated with your account group. You can retrieve your `AccountGroupId` from the `/account-groups` endpoint. Note that you must be assigned to the target account group. Specifying this parameter without being assigned to the target account group will result in an error response.
|
|
:type aid: str
|
|
:param _request_timeout: timeout setting for this request. If one
|
|
number provided, it will be total request
|
|
timeout. It can also be a pair (tuple) of
|
|
(connection, read) timeouts.
|
|
:type _request_timeout: int, tuple(int, int), optional
|
|
:param _request_auth: set to override the auth_settings for an a single
|
|
request; this effectively ignores the
|
|
authentication in the spec for a single request.
|
|
:type _request_auth: dict, optional
|
|
:param _content_type: force content-type for the request.
|
|
:type _content_type: str, Optional
|
|
:param _headers: set to override the headers for a single
|
|
request; this effectively ignores the headers
|
|
in the spec for a single request.
|
|
:type _headers: dict, optional
|
|
:param _host_index: set to override the host_index for a single
|
|
request; this effectively ignores the host_index
|
|
in the spec for a single request.
|
|
:type _host_index: int, optional
|
|
:return: Returns the result object.
|
|
""" # noqa: E501
|
|
|
|
_param = self._create_emulated_device_serialize(
|
|
emulated_device=emulated_device,
|
|
aid=aid,
|
|
_request_auth=_request_auth,
|
|
_content_type=_content_type,
|
|
_headers=_headers,
|
|
_host_index=_host_index
|
|
)
|
|
|
|
_response_types_map: Dict[str, Optional[str]] = {
|
|
'201': "EmulatedDeviceResponse",
|
|
'401': "UnauthorizedError",
|
|
'403': "Error",
|
|
'404': "Error",
|
|
'429': "Error",
|
|
'500': "Error",
|
|
}
|
|
response_data = self.api_client.call_api(
|
|
*_param,
|
|
_request_timeout=_request_timeout
|
|
)
|
|
return response_data.response
|
|
|
|
|
|
def _create_emulated_device_serialize(
|
|
self,
|
|
emulated_device,
|
|
aid,
|
|
_request_auth,
|
|
_content_type,
|
|
_headers,
|
|
_host_index,
|
|
) -> RequestSerialized:
|
|
|
|
_host = None
|
|
|
|
_collection_formats: Dict[str, str] = {
|
|
}
|
|
|
|
_path_params: Dict[str, str] = {}
|
|
_query_params: List[Tuple[str, str]] = []
|
|
_header_params: Dict[str, Optional[str]] = _headers or {}
|
|
_form_params: List[Tuple[str, str]] = []
|
|
_files: Dict[str, Union[str, bytes]] = {}
|
|
_body_params: Optional[bytes] = None
|
|
|
|
# process the path parameters
|
|
# process the query parameters
|
|
if aid is not None:
|
|
|
|
_query_params.append(('aid', aid))
|
|
|
|
# process the header parameters
|
|
# process the form parameters
|
|
# process the body parameter
|
|
if emulated_device is not None:
|
|
_body_params = emulated_device
|
|
|
|
|
|
# set the HTTP header `Accept`
|
|
_header_params['Accept'] = self.api_client.select_header_accept(
|
|
[
|
|
'application/hal+json',
|
|
'application/json',
|
|
'application/problem+json'
|
|
]
|
|
)
|
|
|
|
# set the HTTP header `Content-Type`
|
|
if _content_type:
|
|
_header_params['Content-Type'] = _content_type
|
|
else:
|
|
_default_content_type = (
|
|
self.api_client.select_header_content_type(
|
|
[
|
|
'application/json'
|
|
]
|
|
)
|
|
)
|
|
if _default_content_type is not None:
|
|
_header_params['Content-Type'] = _default_content_type
|
|
|
|
# authentication setting
|
|
_auth_settings: List[str] = [
|
|
'BearerAuth'
|
|
]
|
|
|
|
return self.api_client.param_serialize(
|
|
method='POST',
|
|
resource_path='/emulated-devices',
|
|
path_params=_path_params,
|
|
query_params=_query_params,
|
|
header_params=_header_params,
|
|
body=_body_params,
|
|
post_params=_form_params,
|
|
files=_files,
|
|
auth_settings=_auth_settings,
|
|
collection_formats=_collection_formats,
|
|
_host=_host,
|
|
_request_auth=_request_auth
|
|
)
|
|
|
|
|
|
|
|
|
|
@validate_call
|
|
def get_emulated_devices(
|
|
self,
|
|
expand: Annotated[Optional[List[ExpandEmulatedDeviceOptions]], Field(description="Optional query parameter that controls whether user-agent templates are included in the response. By default, user-agent templates are not included. To include them, add `?expand=user-agent` to the request. ")] = None,
|
|
_request_timeout: Union[
|
|
None,
|
|
Annotated[StrictFloat, Field(gt=0)],
|
|
Tuple[
|
|
Annotated[StrictFloat, Field(gt=0)],
|
|
Annotated[StrictFloat, Field(gt=0)]
|
|
]
|
|
] = None,
|
|
_request_auth: Optional[Dict[StrictStr, Any]] = None,
|
|
_content_type: Optional[StrictStr] = None,
|
|
_headers: Optional[Dict[StrictStr, Any]] = None,
|
|
_host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
|
|
) -> EmulatedDeviceResponses:
|
|
"""List emulated devices
|
|
|
|
Retrieves a list of emulated devices available for browser tests.
|
|
|
|
:param expand: Optional query parameter that controls whether user-agent templates are included in the response. By default, user-agent templates are not included. To include them, add `?expand=user-agent` to the request.
|
|
:type expand: List[ExpandEmulatedDeviceOptions]
|
|
:param _request_timeout: timeout setting for this request. If one
|
|
number provided, it will be total request
|
|
timeout. It can also be a pair (tuple) of
|
|
(connection, read) timeouts.
|
|
:type _request_timeout: int, tuple(int, int), optional
|
|
:param _request_auth: set to override the auth_settings for an a single
|
|
request; this effectively ignores the
|
|
authentication in the spec for a single request.
|
|
:type _request_auth: dict, optional
|
|
:param _content_type: force content-type for the request.
|
|
:type _content_type: str, Optional
|
|
:param _headers: set to override the headers for a single
|
|
request; this effectively ignores the headers
|
|
in the spec for a single request.
|
|
:type _headers: dict, optional
|
|
:param _host_index: set to override the host_index for a single
|
|
request; this effectively ignores the host_index
|
|
in the spec for a single request.
|
|
:type _host_index: int, optional
|
|
:return: Returns the result object.
|
|
""" # noqa: E501
|
|
|
|
_param = self._get_emulated_devices_serialize(
|
|
expand=expand,
|
|
_request_auth=_request_auth,
|
|
_content_type=_content_type,
|
|
_headers=_headers,
|
|
_host_index=_host_index
|
|
)
|
|
|
|
_response_types_map: Dict[str, Optional[str]] = {
|
|
'200': "EmulatedDeviceResponses",
|
|
'401': "UnauthorizedError",
|
|
'403': "Error",
|
|
'404': "Error",
|
|
'429': "Error",
|
|
'500': "Error",
|
|
}
|
|
response_data = self.api_client.call_api(
|
|
*_param,
|
|
_request_timeout=_request_timeout
|
|
)
|
|
response_data.read()
|
|
return self.api_client.response_deserialize(
|
|
response_data=response_data,
|
|
response_types_map=_response_types_map,
|
|
models=thousandeyes_sdk.emulation.models,
|
|
).data
|
|
|
|
|
|
@validate_call
|
|
def get_emulated_devices_with_http_info(
|
|
self,
|
|
expand: Annotated[Optional[List[ExpandEmulatedDeviceOptions]], Field(description="Optional query parameter that controls whether user-agent templates are included in the response. By default, user-agent templates are not included. To include them, add `?expand=user-agent` to the request. ")] = None,
|
|
_request_timeout: Union[
|
|
None,
|
|
Annotated[StrictFloat, Field(gt=0)],
|
|
Tuple[
|
|
Annotated[StrictFloat, Field(gt=0)],
|
|
Annotated[StrictFloat, Field(gt=0)]
|
|
]
|
|
] = None,
|
|
_request_auth: Optional[Dict[StrictStr, Any]] = None,
|
|
_content_type: Optional[StrictStr] = None,
|
|
_headers: Optional[Dict[StrictStr, Any]] = None,
|
|
_host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
|
|
) -> ApiResponse[EmulatedDeviceResponses]:
|
|
"""List emulated devices
|
|
|
|
Retrieves a list of emulated devices available for browser tests.
|
|
|
|
:param expand: Optional query parameter that controls whether user-agent templates are included in the response. By default, user-agent templates are not included. To include them, add `?expand=user-agent` to the request.
|
|
:type expand: List[ExpandEmulatedDeviceOptions]
|
|
:param _request_timeout: timeout setting for this request. If one
|
|
number provided, it will be total request
|
|
timeout. It can also be a pair (tuple) of
|
|
(connection, read) timeouts.
|
|
:type _request_timeout: int, tuple(int, int), optional
|
|
:param _request_auth: set to override the auth_settings for an a single
|
|
request; this effectively ignores the
|
|
authentication in the spec for a single request.
|
|
:type _request_auth: dict, optional
|
|
:param _content_type: force content-type for the request.
|
|
:type _content_type: str, Optional
|
|
:param _headers: set to override the headers for a single
|
|
request; this effectively ignores the headers
|
|
in the spec for a single request.
|
|
:type _headers: dict, optional
|
|
:param _host_index: set to override the host_index for a single
|
|
request; this effectively ignores the host_index
|
|
in the spec for a single request.
|
|
:type _host_index: int, optional
|
|
:return: Returns the result object.
|
|
""" # noqa: E501
|
|
|
|
_param = self._get_emulated_devices_serialize(
|
|
expand=expand,
|
|
_request_auth=_request_auth,
|
|
_content_type=_content_type,
|
|
_headers=_headers,
|
|
_host_index=_host_index
|
|
)
|
|
|
|
_response_types_map: Dict[str, Optional[str]] = {
|
|
'200': "EmulatedDeviceResponses",
|
|
'401': "UnauthorizedError",
|
|
'403': "Error",
|
|
'404': "Error",
|
|
'429': "Error",
|
|
'500': "Error",
|
|
}
|
|
response_data = self.api_client.call_api(
|
|
*_param,
|
|
_request_timeout=_request_timeout
|
|
)
|
|
response_data.read()
|
|
return self.api_client.response_deserialize(
|
|
response_data=response_data,
|
|
response_types_map=_response_types_map,
|
|
models=thousandeyes_sdk.emulation.models,
|
|
)
|
|
|
|
|
|
@validate_call
|
|
def get_emulated_devices_without_preload_content(
|
|
self,
|
|
expand: Annotated[Optional[List[ExpandEmulatedDeviceOptions]], Field(description="Optional query parameter that controls whether user-agent templates are included in the response. By default, user-agent templates are not included. To include them, add `?expand=user-agent` to the request. ")] = None,
|
|
_request_timeout: Union[
|
|
None,
|
|
Annotated[StrictFloat, Field(gt=0)],
|
|
Tuple[
|
|
Annotated[StrictFloat, Field(gt=0)],
|
|
Annotated[StrictFloat, Field(gt=0)]
|
|
]
|
|
] = None,
|
|
_request_auth: Optional[Dict[StrictStr, Any]] = None,
|
|
_content_type: Optional[StrictStr] = None,
|
|
_headers: Optional[Dict[StrictStr, Any]] = None,
|
|
_host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
|
|
) -> RESTResponseType:
|
|
"""List emulated devices
|
|
|
|
Retrieves a list of emulated devices available for browser tests.
|
|
|
|
:param expand: Optional query parameter that controls whether user-agent templates are included in the response. By default, user-agent templates are not included. To include them, add `?expand=user-agent` to the request.
|
|
:type expand: List[ExpandEmulatedDeviceOptions]
|
|
:param _request_timeout: timeout setting for this request. If one
|
|
number provided, it will be total request
|
|
timeout. It can also be a pair (tuple) of
|
|
(connection, read) timeouts.
|
|
:type _request_timeout: int, tuple(int, int), optional
|
|
:param _request_auth: set to override the auth_settings for an a single
|
|
request; this effectively ignores the
|
|
authentication in the spec for a single request.
|
|
:type _request_auth: dict, optional
|
|
:param _content_type: force content-type for the request.
|
|
:type _content_type: str, Optional
|
|
:param _headers: set to override the headers for a single
|
|
request; this effectively ignores the headers
|
|
in the spec for a single request.
|
|
:type _headers: dict, optional
|
|
:param _host_index: set to override the host_index for a single
|
|
request; this effectively ignores the host_index
|
|
in the spec for a single request.
|
|
:type _host_index: int, optional
|
|
:return: Returns the result object.
|
|
""" # noqa: E501
|
|
|
|
_param = self._get_emulated_devices_serialize(
|
|
expand=expand,
|
|
_request_auth=_request_auth,
|
|
_content_type=_content_type,
|
|
_headers=_headers,
|
|
_host_index=_host_index
|
|
)
|
|
|
|
_response_types_map: Dict[str, Optional[str]] = {
|
|
'200': "EmulatedDeviceResponses",
|
|
'401': "UnauthorizedError",
|
|
'403': "Error",
|
|
'404': "Error",
|
|
'429': "Error",
|
|
'500': "Error",
|
|
}
|
|
response_data = self.api_client.call_api(
|
|
*_param,
|
|
_request_timeout=_request_timeout
|
|
)
|
|
return response_data.response
|
|
|
|
|
|
def _get_emulated_devices_serialize(
|
|
self,
|
|
expand,
|
|
_request_auth,
|
|
_content_type,
|
|
_headers,
|
|
_host_index,
|
|
) -> RequestSerialized:
|
|
|
|
_host = None
|
|
|
|
_collection_formats: Dict[str, str] = {
|
|
'expand': 'csv',
|
|
}
|
|
|
|
_path_params: Dict[str, str] = {}
|
|
_query_params: List[Tuple[str, str]] = []
|
|
_header_params: Dict[str, Optional[str]] = _headers or {}
|
|
_form_params: List[Tuple[str, str]] = []
|
|
_files: Dict[str, Union[str, bytes]] = {}
|
|
_body_params: Optional[bytes] = None
|
|
|
|
# process the path parameters
|
|
# process the query parameters
|
|
if expand is not None:
|
|
|
|
_query_params.append(('expand', expand))
|
|
|
|
# process the header parameters
|
|
# process the form parameters
|
|
# process the body parameter
|
|
|
|
|
|
# set the HTTP header `Accept`
|
|
_header_params['Accept'] = self.api_client.select_header_accept(
|
|
[
|
|
'application/hal+json',
|
|
'application/json',
|
|
'application/problem+json'
|
|
]
|
|
)
|
|
|
|
|
|
# authentication setting
|
|
_auth_settings: List[str] = [
|
|
'BearerAuth'
|
|
]
|
|
|
|
return self.api_client.param_serialize(
|
|
method='GET',
|
|
resource_path='/emulated-devices',
|
|
path_params=_path_params,
|
|
query_params=_query_params,
|
|
header_params=_header_params,
|
|
body=_body_params,
|
|
post_params=_form_params,
|
|
files=_files,
|
|
auth_settings=_auth_settings,
|
|
collection_formats=_collection_formats,
|
|
_host=_host,
|
|
_request_auth=_request_auth
|
|
)
|
|
|
|
|
|
|
|
|
|
@validate_call
|
|
def get_user_agents(
|
|
self,
|
|
aid: Annotated[Optional[StrictStr], Field(description="A unique identifier associated with your account group. You can retrieve your `AccountGroupId` from the `/account-groups` endpoint. Note that you must be assigned to the target account group. Specifying this parameter without being assigned to the target account group will result in an error response.")] = None,
|
|
_request_timeout: Union[
|
|
None,
|
|
Annotated[StrictFloat, Field(gt=0)],
|
|
Tuple[
|
|
Annotated[StrictFloat, Field(gt=0)],
|
|
Annotated[StrictFloat, Field(gt=0)]
|
|
]
|
|
] = None,
|
|
_request_auth: Optional[Dict[StrictStr, Any]] = None,
|
|
_content_type: Optional[StrictStr] = None,
|
|
_headers: Optional[Dict[StrictStr, Any]] = None,
|
|
_host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
|
|
) -> UserAgents:
|
|
"""List user-agents
|
|
|
|
Retrieves a list of user-agent strings.
|
|
|
|
:param aid: A unique identifier associated with your account group. You can retrieve your `AccountGroupId` from the `/account-groups` endpoint. Note that you must be assigned to the target account group. Specifying this parameter without being assigned to the target account group will result in an error response.
|
|
:type aid: str
|
|
:param _request_timeout: timeout setting for this request. If one
|
|
number provided, it will be total request
|
|
timeout. It can also be a pair (tuple) of
|
|
(connection, read) timeouts.
|
|
:type _request_timeout: int, tuple(int, int), optional
|
|
:param _request_auth: set to override the auth_settings for an a single
|
|
request; this effectively ignores the
|
|
authentication in the spec for a single request.
|
|
:type _request_auth: dict, optional
|
|
:param _content_type: force content-type for the request.
|
|
:type _content_type: str, Optional
|
|
:param _headers: set to override the headers for a single
|
|
request; this effectively ignores the headers
|
|
in the spec for a single request.
|
|
:type _headers: dict, optional
|
|
:param _host_index: set to override the host_index for a single
|
|
request; this effectively ignores the host_index
|
|
in the spec for a single request.
|
|
:type _host_index: int, optional
|
|
:return: Returns the result object.
|
|
""" # noqa: E501
|
|
|
|
_param = self._get_user_agents_serialize(
|
|
aid=aid,
|
|
_request_auth=_request_auth,
|
|
_content_type=_content_type,
|
|
_headers=_headers,
|
|
_host_index=_host_index
|
|
)
|
|
|
|
_response_types_map: Dict[str, Optional[str]] = {
|
|
'200': "UserAgents",
|
|
'401': "UnauthorizedError",
|
|
'403': "Error",
|
|
'404': "Error",
|
|
'429': "Error",
|
|
'500': "Error",
|
|
}
|
|
response_data = self.api_client.call_api(
|
|
*_param,
|
|
_request_timeout=_request_timeout
|
|
)
|
|
response_data.read()
|
|
return self.api_client.response_deserialize(
|
|
response_data=response_data,
|
|
response_types_map=_response_types_map,
|
|
models=thousandeyes_sdk.emulation.models,
|
|
).data
|
|
|
|
|
|
@validate_call
|
|
def get_user_agents_with_http_info(
|
|
self,
|
|
aid: Annotated[Optional[StrictStr], Field(description="A unique identifier associated with your account group. You can retrieve your `AccountGroupId` from the `/account-groups` endpoint. Note that you must be assigned to the target account group. Specifying this parameter without being assigned to the target account group will result in an error response.")] = None,
|
|
_request_timeout: Union[
|
|
None,
|
|
Annotated[StrictFloat, Field(gt=0)],
|
|
Tuple[
|
|
Annotated[StrictFloat, Field(gt=0)],
|
|
Annotated[StrictFloat, Field(gt=0)]
|
|
]
|
|
] = None,
|
|
_request_auth: Optional[Dict[StrictStr, Any]] = None,
|
|
_content_type: Optional[StrictStr] = None,
|
|
_headers: Optional[Dict[StrictStr, Any]] = None,
|
|
_host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
|
|
) -> ApiResponse[UserAgents]:
|
|
"""List user-agents
|
|
|
|
Retrieves a list of user-agent strings.
|
|
|
|
:param aid: A unique identifier associated with your account group. You can retrieve your `AccountGroupId` from the `/account-groups` endpoint. Note that you must be assigned to the target account group. Specifying this parameter without being assigned to the target account group will result in an error response.
|
|
:type aid: str
|
|
:param _request_timeout: timeout setting for this request. If one
|
|
number provided, it will be total request
|
|
timeout. It can also be a pair (tuple) of
|
|
(connection, read) timeouts.
|
|
:type _request_timeout: int, tuple(int, int), optional
|
|
:param _request_auth: set to override the auth_settings for an a single
|
|
request; this effectively ignores the
|
|
authentication in the spec for a single request.
|
|
:type _request_auth: dict, optional
|
|
:param _content_type: force content-type for the request.
|
|
:type _content_type: str, Optional
|
|
:param _headers: set to override the headers for a single
|
|
request; this effectively ignores the headers
|
|
in the spec for a single request.
|
|
:type _headers: dict, optional
|
|
:param _host_index: set to override the host_index for a single
|
|
request; this effectively ignores the host_index
|
|
in the spec for a single request.
|
|
:type _host_index: int, optional
|
|
:return: Returns the result object.
|
|
""" # noqa: E501
|
|
|
|
_param = self._get_user_agents_serialize(
|
|
aid=aid,
|
|
_request_auth=_request_auth,
|
|
_content_type=_content_type,
|
|
_headers=_headers,
|
|
_host_index=_host_index
|
|
)
|
|
|
|
_response_types_map: Dict[str, Optional[str]] = {
|
|
'200': "UserAgents",
|
|
'401': "UnauthorizedError",
|
|
'403': "Error",
|
|
'404': "Error",
|
|
'429': "Error",
|
|
'500': "Error",
|
|
}
|
|
response_data = self.api_client.call_api(
|
|
*_param,
|
|
_request_timeout=_request_timeout
|
|
)
|
|
response_data.read()
|
|
return self.api_client.response_deserialize(
|
|
response_data=response_data,
|
|
response_types_map=_response_types_map,
|
|
models=thousandeyes_sdk.emulation.models,
|
|
)
|
|
|
|
|
|
@validate_call
|
|
def get_user_agents_without_preload_content(
|
|
self,
|
|
aid: Annotated[Optional[StrictStr], Field(description="A unique identifier associated with your account group. You can retrieve your `AccountGroupId` from the `/account-groups` endpoint. Note that you must be assigned to the target account group. Specifying this parameter without being assigned to the target account group will result in an error response.")] = None,
|
|
_request_timeout: Union[
|
|
None,
|
|
Annotated[StrictFloat, Field(gt=0)],
|
|
Tuple[
|
|
Annotated[StrictFloat, Field(gt=0)],
|
|
Annotated[StrictFloat, Field(gt=0)]
|
|
]
|
|
] = None,
|
|
_request_auth: Optional[Dict[StrictStr, Any]] = None,
|
|
_content_type: Optional[StrictStr] = None,
|
|
_headers: Optional[Dict[StrictStr, Any]] = None,
|
|
_host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
|
|
) -> RESTResponseType:
|
|
"""List user-agents
|
|
|
|
Retrieves a list of user-agent strings.
|
|
|
|
:param aid: A unique identifier associated with your account group. You can retrieve your `AccountGroupId` from the `/account-groups` endpoint. Note that you must be assigned to the target account group. Specifying this parameter without being assigned to the target account group will result in an error response.
|
|
:type aid: str
|
|
:param _request_timeout: timeout setting for this request. If one
|
|
number provided, it will be total request
|
|
timeout. It can also be a pair (tuple) of
|
|
(connection, read) timeouts.
|
|
:type _request_timeout: int, tuple(int, int), optional
|
|
:param _request_auth: set to override the auth_settings for an a single
|
|
request; this effectively ignores the
|
|
authentication in the spec for a single request.
|
|
:type _request_auth: dict, optional
|
|
:param _content_type: force content-type for the request.
|
|
:type _content_type: str, Optional
|
|
:param _headers: set to override the headers for a single
|
|
request; this effectively ignores the headers
|
|
in the spec for a single request.
|
|
:type _headers: dict, optional
|
|
:param _host_index: set to override the host_index for a single
|
|
request; this effectively ignores the host_index
|
|
in the spec for a single request.
|
|
:type _host_index: int, optional
|
|
:return: Returns the result object.
|
|
""" # noqa: E501
|
|
|
|
_param = self._get_user_agents_serialize(
|
|
aid=aid,
|
|
_request_auth=_request_auth,
|
|
_content_type=_content_type,
|
|
_headers=_headers,
|
|
_host_index=_host_index
|
|
)
|
|
|
|
_response_types_map: Dict[str, Optional[str]] = {
|
|
'200': "UserAgents",
|
|
'401': "UnauthorizedError",
|
|
'403': "Error",
|
|
'404': "Error",
|
|
'429': "Error",
|
|
'500': "Error",
|
|
}
|
|
response_data = self.api_client.call_api(
|
|
*_param,
|
|
_request_timeout=_request_timeout
|
|
)
|
|
return response_data.response
|
|
|
|
|
|
def _get_user_agents_serialize(
|
|
self,
|
|
aid,
|
|
_request_auth,
|
|
_content_type,
|
|
_headers,
|
|
_host_index,
|
|
) -> RequestSerialized:
|
|
|
|
_host = None
|
|
|
|
_collection_formats: Dict[str, str] = {
|
|
}
|
|
|
|
_path_params: Dict[str, str] = {}
|
|
_query_params: List[Tuple[str, str]] = []
|
|
_header_params: Dict[str, Optional[str]] = _headers or {}
|
|
_form_params: List[Tuple[str, str]] = []
|
|
_files: Dict[str, Union[str, bytes]] = {}
|
|
_body_params: Optional[bytes] = None
|
|
|
|
# process the path parameters
|
|
# process the query parameters
|
|
if aid is not None:
|
|
|
|
_query_params.append(('aid', aid))
|
|
|
|
# process the header parameters
|
|
# process the form parameters
|
|
# process the body parameter
|
|
|
|
|
|
# set the HTTP header `Accept`
|
|
_header_params['Accept'] = self.api_client.select_header_accept(
|
|
[
|
|
'application/hal+json',
|
|
'application/json',
|
|
'application/problem+json'
|
|
]
|
|
)
|
|
|
|
|
|
# authentication setting
|
|
_auth_settings: List[str] = [
|
|
'BearerAuth'
|
|
]
|
|
|
|
return self.api_client.param_serialize(
|
|
method='GET',
|
|
resource_path='/user-agents',
|
|
path_params=_path_params,
|
|
query_params=_query_params,
|
|
header_params=_header_params,
|
|
body=_body_params,
|
|
post_params=_form_params,
|
|
files=_files,
|
|
auth_settings=_auth_settings,
|
|
collection_formats=_collection_formats,
|
|
_host=_host,
|
|
_request_auth=_request_auth
|
|
)
|
|
|
|
|