# coding: utf-8

"""
    Agents API

     ## Overview Manage all agents available to your account in ThousandEyes, including both Cloud and Enterprise Agents.

    The version of the OpenAPI document: 7.0.0
    Generated by OpenAPI Generator (https://openapi-generator.tech)

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


import io
import warnings

from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt
from typing import Dict, List, Optional, Tuple, Union, Any

try:
    from typing import Annotated
except ImportError:
    from typing_extensions import Annotated

from pydantic import Field
from typing_extensions import Annotated
from pydantic import StrictStr

from typing import List, Optional

from agents_api.models.agent_details_expand import AgentDetailsExpand
from agents_api.models.assign_enterprise_agent_cluster_request import AssignEnterpriseAgentClusterRequest
from agents_api.models.get_agent_details200_response import GetAgentDetails200Response
from agents_api.models.get_agents200_response import GetAgents200Response
from agents_api.models.unassign_enterprise_agent_from_cluster_request import UnassignEnterpriseAgentFromClusterRequest

from agents_api.api_client import ApiClient
from agents_api.api_response import ApiResponse
from agents_api.rest import RESTResponseType


class EnterpriseAgentClusterApi:
    """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()
        self.api_client = api_client


    @validate_call
    def assign_enterprise_agent_cluster(
        self,
        agent_id: Annotated[StrictStr, Field(description="Unique ID for the Enterprise Agent cluster to add new agents to.")],
        assign_enterprise_agent_cluster_request: AssignEnterpriseAgentClusterRequest,
        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,
        expand: Annotated[Optional[List[AgentDetailsExpand]], Field(description="Optional parameter, off by default. Indicates which agent sub-resource to expand. For example, if you wish to expand the `clusterMembers` sub-resource, pass the `?expand=cluster-member` query.")] = 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,
    ) -> GetAgentDetails200Response:
        """Add member to Enterprise Agent cluster

        Adding a member to an Enterprise Agent cluster converts a standalone Enterprise Agent to an Enterprise Agent cluster. If the agent represented by the path {agentId} is not already a cluster, it will be converted to a cluster.  The response will be a single Enterprise Agent Cluster. The converted Enterprise Agents will become cluster members, and can be returned using the `?expand=cluster-member` parameter.  This endpoint requires users to have the `Edit agents in account group` permission.  Upon successful cluster creation, the response includes:  * Information about the new cluster in the response body.  * Each cluster member receives a unique `memberId` within the cluster.  * The `memberId` value is not linked to the original `agentId` used in the request URL or POST body.  * The cluster name is based on the agent whose `agentId` is present in the request URL.  **Example - converting a single agent** ``` curl -X POST https://api.thousandeyes.com/v7/agents/64965/cluster/assign  -H \"Authorization: Bearer $Bearer_token\"  ````  **Example - converting multiple agents** ``` curl https://api.thousandeyes.com/v7/agents/64965/cluster/assign \\ '{\"agents\":[   \"2277\",   \"1234\" ]}' \\ -H \"content-type:application/json\" \\ -H \"Authorization: Bearer $Bearer_token\"  ````

        :param agent_id: Unique ID for the Enterprise Agent cluster to add new agents to. (required)
        :type agent_id: str
        :param assign_enterprise_agent_cluster_request: (required)
        :type assign_enterprise_agent_cluster_request: AssignEnterpriseAgentClusterRequest
        :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 expand: Optional parameter, off by default. Indicates which agent sub-resource to expand. For example, if you wish to expand the `clusterMembers` sub-resource, pass the `?expand=cluster-member` query.
        :type expand: List[AgentDetailsExpand]
        :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._assign_enterprise_agent_cluster_serialize(
            agent_id=agent_id,
            assign_enterprise_agent_cluster_request=assign_enterprise_agent_cluster_request,
            aid=aid,
            expand=expand,
            _request_auth=_request_auth,
            _content_type=_content_type,
            _headers=_headers,
            _host_index=_host_index
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '200': "GetAgentDetails200Response",
            '400': "Error",
            '401': "UnauthorizedError",
            '403': "Error",
            '404': "Error",
            '429': "Error",
            '500': "Error",
            '502': "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,
        ).data


    @validate_call
    def assign_enterprise_agent_cluster_with_http_info(
        self,
        agent_id: Annotated[StrictStr, Field(description="Unique ID for the Enterprise Agent cluster to add new agents to.")],
        assign_enterprise_agent_cluster_request: AssignEnterpriseAgentClusterRequest,
        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,
        expand: Annotated[Optional[List[AgentDetailsExpand]], Field(description="Optional parameter, off by default. Indicates which agent sub-resource to expand. For example, if you wish to expand the `clusterMembers` sub-resource, pass the `?expand=cluster-member` query.")] = 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[GetAgentDetails200Response]:
        """Add member to Enterprise Agent cluster

        Adding a member to an Enterprise Agent cluster converts a standalone Enterprise Agent to an Enterprise Agent cluster. If the agent represented by the path {agentId} is not already a cluster, it will be converted to a cluster.  The response will be a single Enterprise Agent Cluster. The converted Enterprise Agents will become cluster members, and can be returned using the `?expand=cluster-member` parameter.  This endpoint requires users to have the `Edit agents in account group` permission.  Upon successful cluster creation, the response includes:  * Information about the new cluster in the response body.  * Each cluster member receives a unique `memberId` within the cluster.  * The `memberId` value is not linked to the original `agentId` used in the request URL or POST body.  * The cluster name is based on the agent whose `agentId` is present in the request URL.  **Example - converting a single agent** ``` curl -X POST https://api.thousandeyes.com/v7/agents/64965/cluster/assign  -H \"Authorization: Bearer $Bearer_token\"  ````  **Example - converting multiple agents** ``` curl https://api.thousandeyes.com/v7/agents/64965/cluster/assign \\ '{\"agents\":[   \"2277\",   \"1234\" ]}' \\ -H \"content-type:application/json\" \\ -H \"Authorization: Bearer $Bearer_token\"  ````

        :param agent_id: Unique ID for the Enterprise Agent cluster to add new agents to. (required)
        :type agent_id: str
        :param assign_enterprise_agent_cluster_request: (required)
        :type assign_enterprise_agent_cluster_request: AssignEnterpriseAgentClusterRequest
        :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 expand: Optional parameter, off by default. Indicates which agent sub-resource to expand. For example, if you wish to expand the `clusterMembers` sub-resource, pass the `?expand=cluster-member` query.
        :type expand: List[AgentDetailsExpand]
        :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._assign_enterprise_agent_cluster_serialize(
            agent_id=agent_id,
            assign_enterprise_agent_cluster_request=assign_enterprise_agent_cluster_request,
            aid=aid,
            expand=expand,
            _request_auth=_request_auth,
            _content_type=_content_type,
            _headers=_headers,
            _host_index=_host_index
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '200': "GetAgentDetails200Response",
            '400': "Error",
            '401': "UnauthorizedError",
            '403': "Error",
            '404': "Error",
            '429': "Error",
            '500': "Error",
            '502': "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,
        )


    @validate_call
    def assign_enterprise_agent_cluster_without_preload_content(
        self,
        agent_id: Annotated[StrictStr, Field(description="Unique ID for the Enterprise Agent cluster to add new agents to.")],
        assign_enterprise_agent_cluster_request: AssignEnterpriseAgentClusterRequest,
        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,
        expand: Annotated[Optional[List[AgentDetailsExpand]], Field(description="Optional parameter, off by default. Indicates which agent sub-resource to expand. For example, if you wish to expand the `clusterMembers` sub-resource, pass the `?expand=cluster-member` query.")] = 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:
        """Add member to Enterprise Agent cluster

        Adding a member to an Enterprise Agent cluster converts a standalone Enterprise Agent to an Enterprise Agent cluster. If the agent represented by the path {agentId} is not already a cluster, it will be converted to a cluster.  The response will be a single Enterprise Agent Cluster. The converted Enterprise Agents will become cluster members, and can be returned using the `?expand=cluster-member` parameter.  This endpoint requires users to have the `Edit agents in account group` permission.  Upon successful cluster creation, the response includes:  * Information about the new cluster in the response body.  * Each cluster member receives a unique `memberId` within the cluster.  * The `memberId` value is not linked to the original `agentId` used in the request URL or POST body.  * The cluster name is based on the agent whose `agentId` is present in the request URL.  **Example - converting a single agent** ``` curl -X POST https://api.thousandeyes.com/v7/agents/64965/cluster/assign  -H \"Authorization: Bearer $Bearer_token\"  ````  **Example - converting multiple agents** ``` curl https://api.thousandeyes.com/v7/agents/64965/cluster/assign \\ '{\"agents\":[   \"2277\",   \"1234\" ]}' \\ -H \"content-type:application/json\" \\ -H \"Authorization: Bearer $Bearer_token\"  ````

        :param agent_id: Unique ID for the Enterprise Agent cluster to add new agents to. (required)
        :type agent_id: str
        :param assign_enterprise_agent_cluster_request: (required)
        :type assign_enterprise_agent_cluster_request: AssignEnterpriseAgentClusterRequest
        :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 expand: Optional parameter, off by default. Indicates which agent sub-resource to expand. For example, if you wish to expand the `clusterMembers` sub-resource, pass the `?expand=cluster-member` query.
        :type expand: List[AgentDetailsExpand]
        :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._assign_enterprise_agent_cluster_serialize(
            agent_id=agent_id,
            assign_enterprise_agent_cluster_request=assign_enterprise_agent_cluster_request,
            aid=aid,
            expand=expand,
            _request_auth=_request_auth,
            _content_type=_content_type,
            _headers=_headers,
            _host_index=_host_index
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '200': "GetAgentDetails200Response",
            '400': "Error",
            '401': "UnauthorizedError",
            '403': "Error",
            '404': "Error",
            '429': "Error",
            '500': "Error",
            '502': "Error",
            
            
        }
        response_data = self.api_client.call_api(
            *_param,
            _request_timeout=_request_timeout
        )
        return response_data.response


    def _assign_enterprise_agent_cluster_serialize(
        self,
        agent_id,
        assign_enterprise_agent_cluster_request,
        aid,
        expand,
        _request_auth,
        _content_type,
        _headers,
        _host_index,
    ) -> Tuple:

        _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, str] = {}
        _body_params: Optional[bytes] = None

        # process the path parameters
        if agent_id is not None:
            _path_params['agentId'] = agent_id
        # process the query parameters
        if aid is not None:
            
            _query_params.append(('aid', aid))
            
        if expand is not None:
            
            _query_params.append(('expand', expand))
            
        # process the header parameters
        # process the form parameters
        # process the body parameter
        if assign_enterprise_agent_cluster_request is not None:
            _body_params = assign_enterprise_agent_cluster_request


        # set the HTTP header `Accept`
        _header_params['Accept'] = self.api_client.select_header_accept(
            [
                'application/hal+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='/v7/agents/{agentId}/cluster/assign',
            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 unassign_enterprise_agent_from_cluster(
        self,
        agent_id: Annotated[StrictStr, Field(description="Unique ID for the Enterprise Agent cluster to remove agents from.")],
        unassign_enterprise_agent_from_cluster_request: UnassignEnterpriseAgentFromClusterRequest,
        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,
        expand: Annotated[Optional[List[AgentDetailsExpand]], Field(description="Optional parameter, off by default. Indicates which agent sub-resource to expand. For example, if you wish to expand the `clusterMembers` sub-resource, pass the `?expand=cluster-member` query.")] = 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,
    ) -> GetAgents200Response:
        """Remove member from Enterprise Agent cluster

        Converts a cluster with a single or multiple Enterprise Agent members back to a standalone Enterprise Agent(s). This endpoint can also be used to remove one or more members from an Enterprise Agent cluster. Removed members revert to being standalone Enterprise Agents. If all members are removed from the cluster, the Enterprise Agent Cluster is deleted.  The response is an list of agents, containing both the Enterprise Agent Cluster (if it still exists), and the removed members, now as standalone Enterprise Agents. This endpoint is exclusive to Enterprise Agent clusters and can be accessed only by users with the `Edit agents in account group` permission.  On successful completion, the response contains the following information:  * The updated cluster information is provided in the response body, unless all members are removed from the cluster.  * Information about each removed member, now a standalone agent.  * When a non-last member is removed from the cluster, it receives a new `agentId` value. This new `agentId` is different from the `agentId` the agent had before joining the cluster, and it is also unrelated to the `memberId` value the agent had while being a part of the cluster.  * If all members are removed from the cluster, the cluster itself is converted back to a standalone Enterprise Agent too. Such standalone agent inherits the old cluster’s `agentId` value. The last `memberId` listed in the POST body inherits the cluster’s `agentId` value.  **Example - removing a single member** ``` curl -X POST https://api.thousandeyes.com/v7/agents/64965/cluster/unassign   \\ '{\"members\":[\"55974\"]}' \\ -H \"content-type:application/json\" \\ -H \"Authorization: Bearer $Bearer_token\"  ```  **Example - removing multiple members** ``` curl https://api.thousandeyes.com/v7/agents/64965/cluster/unassign \\ '{\"members\":[     \"55974\",     \"12313\"]  }' \\ -H \"content-type:application/json\" \\ -H \"Authorization: Bearer $Bearer_token\"  ```

        :param agent_id: Unique ID for the Enterprise Agent cluster to remove agents from. (required)
        :type agent_id: str
        :param unassign_enterprise_agent_from_cluster_request: (required)
        :type unassign_enterprise_agent_from_cluster_request: UnassignEnterpriseAgentFromClusterRequest
        :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 expand: Optional parameter, off by default. Indicates which agent sub-resource to expand. For example, if you wish to expand the `clusterMembers` sub-resource, pass the `?expand=cluster-member` query.
        :type expand: List[AgentDetailsExpand]
        :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._unassign_enterprise_agent_from_cluster_serialize(
            agent_id=agent_id,
            unassign_enterprise_agent_from_cluster_request=unassign_enterprise_agent_from_cluster_request,
            aid=aid,
            expand=expand,
            _request_auth=_request_auth,
            _content_type=_content_type,
            _headers=_headers,
            _host_index=_host_index
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '200': "GetAgents200Response",
            '400': "Error",
            '401': "UnauthorizedError",
            '403': "Error",
            '404': "Error",
            '429': "Error",
            '500': "Error",
            '502': "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,
        ).data


    @validate_call
    def unassign_enterprise_agent_from_cluster_with_http_info(
        self,
        agent_id: Annotated[StrictStr, Field(description="Unique ID for the Enterprise Agent cluster to remove agents from.")],
        unassign_enterprise_agent_from_cluster_request: UnassignEnterpriseAgentFromClusterRequest,
        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,
        expand: Annotated[Optional[List[AgentDetailsExpand]], Field(description="Optional parameter, off by default. Indicates which agent sub-resource to expand. For example, if you wish to expand the `clusterMembers` sub-resource, pass the `?expand=cluster-member` query.")] = 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[GetAgents200Response]:
        """Remove member from Enterprise Agent cluster

        Converts a cluster with a single or multiple Enterprise Agent members back to a standalone Enterprise Agent(s). This endpoint can also be used to remove one or more members from an Enterprise Agent cluster. Removed members revert to being standalone Enterprise Agents. If all members are removed from the cluster, the Enterprise Agent Cluster is deleted.  The response is an list of agents, containing both the Enterprise Agent Cluster (if it still exists), and the removed members, now as standalone Enterprise Agents. This endpoint is exclusive to Enterprise Agent clusters and can be accessed only by users with the `Edit agents in account group` permission.  On successful completion, the response contains the following information:  * The updated cluster information is provided in the response body, unless all members are removed from the cluster.  * Information about each removed member, now a standalone agent.  * When a non-last member is removed from the cluster, it receives a new `agentId` value. This new `agentId` is different from the `agentId` the agent had before joining the cluster, and it is also unrelated to the `memberId` value the agent had while being a part of the cluster.  * If all members are removed from the cluster, the cluster itself is converted back to a standalone Enterprise Agent too. Such standalone agent inherits the old cluster’s `agentId` value. The last `memberId` listed in the POST body inherits the cluster’s `agentId` value.  **Example - removing a single member** ``` curl -X POST https://api.thousandeyes.com/v7/agents/64965/cluster/unassign   \\ '{\"members\":[\"55974\"]}' \\ -H \"content-type:application/json\" \\ -H \"Authorization: Bearer $Bearer_token\"  ```  **Example - removing multiple members** ``` curl https://api.thousandeyes.com/v7/agents/64965/cluster/unassign \\ '{\"members\":[     \"55974\",     \"12313\"]  }' \\ -H \"content-type:application/json\" \\ -H \"Authorization: Bearer $Bearer_token\"  ```

        :param agent_id: Unique ID for the Enterprise Agent cluster to remove agents from. (required)
        :type agent_id: str
        :param unassign_enterprise_agent_from_cluster_request: (required)
        :type unassign_enterprise_agent_from_cluster_request: UnassignEnterpriseAgentFromClusterRequest
        :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 expand: Optional parameter, off by default. Indicates which agent sub-resource to expand. For example, if you wish to expand the `clusterMembers` sub-resource, pass the `?expand=cluster-member` query.
        :type expand: List[AgentDetailsExpand]
        :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._unassign_enterprise_agent_from_cluster_serialize(
            agent_id=agent_id,
            unassign_enterprise_agent_from_cluster_request=unassign_enterprise_agent_from_cluster_request,
            aid=aid,
            expand=expand,
            _request_auth=_request_auth,
            _content_type=_content_type,
            _headers=_headers,
            _host_index=_host_index
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '200': "GetAgents200Response",
            '400': "Error",
            '401': "UnauthorizedError",
            '403': "Error",
            '404': "Error",
            '429': "Error",
            '500': "Error",
            '502': "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,
        )


    @validate_call
    def unassign_enterprise_agent_from_cluster_without_preload_content(
        self,
        agent_id: Annotated[StrictStr, Field(description="Unique ID for the Enterprise Agent cluster to remove agents from.")],
        unassign_enterprise_agent_from_cluster_request: UnassignEnterpriseAgentFromClusterRequest,
        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,
        expand: Annotated[Optional[List[AgentDetailsExpand]], Field(description="Optional parameter, off by default. Indicates which agent sub-resource to expand. For example, if you wish to expand the `clusterMembers` sub-resource, pass the `?expand=cluster-member` query.")] = 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:
        """Remove member from Enterprise Agent cluster

        Converts a cluster with a single or multiple Enterprise Agent members back to a standalone Enterprise Agent(s). This endpoint can also be used to remove one or more members from an Enterprise Agent cluster. Removed members revert to being standalone Enterprise Agents. If all members are removed from the cluster, the Enterprise Agent Cluster is deleted.  The response is an list of agents, containing both the Enterprise Agent Cluster (if it still exists), and the removed members, now as standalone Enterprise Agents. This endpoint is exclusive to Enterprise Agent clusters and can be accessed only by users with the `Edit agents in account group` permission.  On successful completion, the response contains the following information:  * The updated cluster information is provided in the response body, unless all members are removed from the cluster.  * Information about each removed member, now a standalone agent.  * When a non-last member is removed from the cluster, it receives a new `agentId` value. This new `agentId` is different from the `agentId` the agent had before joining the cluster, and it is also unrelated to the `memberId` value the agent had while being a part of the cluster.  * If all members are removed from the cluster, the cluster itself is converted back to a standalone Enterprise Agent too. Such standalone agent inherits the old cluster’s `agentId` value. The last `memberId` listed in the POST body inherits the cluster’s `agentId` value.  **Example - removing a single member** ``` curl -X POST https://api.thousandeyes.com/v7/agents/64965/cluster/unassign   \\ '{\"members\":[\"55974\"]}' \\ -H \"content-type:application/json\" \\ -H \"Authorization: Bearer $Bearer_token\"  ```  **Example - removing multiple members** ``` curl https://api.thousandeyes.com/v7/agents/64965/cluster/unassign \\ '{\"members\":[     \"55974\",     \"12313\"]  }' \\ -H \"content-type:application/json\" \\ -H \"Authorization: Bearer $Bearer_token\"  ```

        :param agent_id: Unique ID for the Enterprise Agent cluster to remove agents from. (required)
        :type agent_id: str
        :param unassign_enterprise_agent_from_cluster_request: (required)
        :type unassign_enterprise_agent_from_cluster_request: UnassignEnterpriseAgentFromClusterRequest
        :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 expand: Optional parameter, off by default. Indicates which agent sub-resource to expand. For example, if you wish to expand the `clusterMembers` sub-resource, pass the `?expand=cluster-member` query.
        :type expand: List[AgentDetailsExpand]
        :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._unassign_enterprise_agent_from_cluster_serialize(
            agent_id=agent_id,
            unassign_enterprise_agent_from_cluster_request=unassign_enterprise_agent_from_cluster_request,
            aid=aid,
            expand=expand,
            _request_auth=_request_auth,
            _content_type=_content_type,
            _headers=_headers,
            _host_index=_host_index
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '200': "GetAgents200Response",
            '400': "Error",
            '401': "UnauthorizedError",
            '403': "Error",
            '404': "Error",
            '429': "Error",
            '500': "Error",
            '502': "Error",
            
            
        }
        response_data = self.api_client.call_api(
            *_param,
            _request_timeout=_request_timeout
        )
        return response_data.response


    def _unassign_enterprise_agent_from_cluster_serialize(
        self,
        agent_id,
        unassign_enterprise_agent_from_cluster_request,
        aid,
        expand,
        _request_auth,
        _content_type,
        _headers,
        _host_index,
    ) -> Tuple:

        _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, str] = {}
        _body_params: Optional[bytes] = None

        # process the path parameters
        if agent_id is not None:
            _path_params['agentId'] = agent_id
        # process the query parameters
        if aid is not None:
            
            _query_params.append(('aid', aid))
            
        if expand is not None:
            
            _query_params.append(('expand', expand))
            
        # process the header parameters
        # process the form parameters
        # process the body parameter
        if unassign_enterprise_agent_from_cluster_request is not None:
            _body_params = unassign_enterprise_agent_from_cluster_request


        # set the HTTP header `Accept`
        _header_params['Accept'] = self.api_client.select_header_accept(
            [
                'application/hal+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='/v7/agents/{agentId}/cluster/unassign',
            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
        )


