"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""

from .basesdk import BaseSDK
from outpost_sdk import errors, models, utils
from outpost_sdk._hooks import HookContext
from outpost_sdk.types import OptionalNullable, UNSET
from typing import Any, List, Mapping, Optional, Union


class Destinations(BaseSDK):
    r"""Destinations are the endpoints where events are sent. Each destination is associated with a tenant and can be configured to receive specific event topics.

    ```json
    {
    \"id\": \"des_12345\", // Control plane generated ID or user provided ID
    \"type\": \"webhooks\", // Type of the destination
    \"topics\": [\"user.created\", \"user.updated\"], // Topics of events this destination is eligible for
    \"config\": {
    // Destination type specific configuration. Schema of depends on type
    \"url\": \"https://example.com/webhooks/user\"
    },
    \"credentials\": {
    // Destination type specific credentials. AES encrypted. Schema depends on type
    \"secret\": \"some***********\"
    },
    \"disabled_at\": null, // null or ISO date if disabled
    \"created_at\": \"2024-01-01T00:00:00Z\" // Date the destination was created
    }
    ```

    The `topics` array can contain either a list of topics or a wildcard `*` implying that all topics are supported. If you do not wish to implement topics for your application, you set all destination topics to `*`.

    By default all destination `credentials` are obfuscated and the values cannot be read. This does not apply to the `webhook` type destination secret and each destination can expose their own obfuscation logic.

    """

    def list(
        self,
        *,
        tenant_id: Optional[str] = None,
        type_: Optional[Union[models.Type, models.TypeTypedDict]] = None,
        topics: Optional[
            Union[
                models.ListTenantDestinationsTopics,
                models.ListTenantDestinationsTopicsTypedDict,
            ]
        ] = None,
        retries: OptionalNullable[utils.RetryConfig] = UNSET,
        server_url: Optional[str] = None,
        timeout_ms: Optional[int] = None,
        http_headers: Optional[Mapping[str, str]] = None,
    ) -> List[models.Destination]:
        r"""List Destinations

        Return a list of the destinations for the tenant. The endpoint is not paged.

        :param tenant_id: The ID of the tenant. Required when using AdminApiKey authentication.
        :param type: Filter destinations by type(s).
        :param topics: Filter destinations by supported topic(s).
        :param retries: Override the default retry configuration for this method
        :param server_url: Override the default server URL for this method
        :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
        :param http_headers: Additional headers to set or replace on requests.
        """
        base_url = None
        url_variables = None
        if timeout_ms is None:
            timeout_ms = self.sdk_configuration.timeout_ms

        if server_url is not None:
            base_url = server_url
        else:
            base_url = self._get_url(base_url, url_variables)

        request = models.ListTenantDestinationsRequest(
            tenant_id=tenant_id,
            type=type_,
            topics=topics,
        )

        req = self._build_request(
            method="GET",
            path="/{tenant_id}/destinations",
            base_url=base_url,
            url_variables=url_variables,
            request=request,
            request_body_required=False,
            request_has_path_params=True,
            request_has_query_params=True,
            user_agent_header="user-agent",
            accept_header_value="application/json",
            http_headers=http_headers,
            _globals=models.ListTenantDestinationsGlobals(
                tenant_id=self.sdk_configuration.globals.tenant_id,
            ),
            security=self.sdk_configuration.security,
            timeout_ms=timeout_ms,
        )

        if retries == UNSET:
            if self.sdk_configuration.retry_config is not UNSET:
                retries = self.sdk_configuration.retry_config

        retry_config = None
        if isinstance(retries, utils.RetryConfig):
            retry_config = (retries, ["429", "500", "502", "503", "504"])

        http_res = self.do_request(
            hook_ctx=HookContext(
                base_url=base_url or "",
                operation_id="listTenantDestinations",
                oauth2_scopes=[],
                security_source=self.sdk_configuration.security,
            ),
            request=req,
            error_status_codes=[
                "400",
                "401",
                "403",
                "404",
                "407",
                "408",
                "413",
                "414",
                "415",
                "422",
                "429",
                "431",
                "4XX",
                "500",
                "501",
                "502",
                "503",
                "504",
                "505",
                "506",
                "507",
                "508",
                "510",
                "511",
                "5XX",
            ],
            retry_config=retry_config,
        )

        response_data: Any = None
        if utils.match_response(http_res, "200", "application/json"):
            return utils.unmarshal_json(http_res.text, List[models.Destination])
        if utils.match_response(http_res, ["401", "403", "407"], "application/json"):
            response_data = utils.unmarshal_json(
                http_res.text, errors.UnauthorizedErrorData
            )
            raise errors.UnauthorizedError(data=response_data)
        if utils.match_response(http_res, "408", "application/json"):
            response_data = utils.unmarshal_json(
                http_res.text, errors.TimeoutErrorTData
            )
            raise errors.TimeoutErrorT(data=response_data)
        if utils.match_response(http_res, "429", "application/json"):
            response_data = utils.unmarshal_json(
                http_res.text, errors.RateLimitedErrorData
            )
            raise errors.RateLimitedError(data=response_data)
        if utils.match_response(
            http_res, ["400", "413", "414", "415", "422", "431"], "application/json"
        ):
            response_data = utils.unmarshal_json(
                http_res.text, errors.BadRequestErrorData
            )
            raise errors.BadRequestError(data=response_data)
        if utils.match_response(http_res, "504", "application/json"):
            response_data = utils.unmarshal_json(
                http_res.text, errors.TimeoutErrorTData
            )
            raise errors.TimeoutErrorT(data=response_data)
        if utils.match_response(http_res, ["501", "505"], "application/json"):
            response_data = utils.unmarshal_json(
                http_res.text, errors.NotFoundErrorData
            )
            raise errors.NotFoundError(data=response_data)
        if utils.match_response(
            http_res, ["500", "502", "503", "506", "507", "508"], "application/json"
        ):
            response_data = utils.unmarshal_json(
                http_res.text, errors.InternalServerErrorData
            )
            raise errors.InternalServerError(data=response_data)
        if utils.match_response(http_res, "510", "application/json"):
            response_data = utils.unmarshal_json(
                http_res.text, errors.BadRequestErrorData
            )
            raise errors.BadRequestError(data=response_data)
        if utils.match_response(http_res, "511", "application/json"):
            response_data = utils.unmarshal_json(
                http_res.text, errors.UnauthorizedErrorData
            )
            raise errors.UnauthorizedError(data=response_data)
        if utils.match_response(http_res, ["404", "4XX"], "*"):
            http_res_text = utils.stream_to_text(http_res)
            raise errors.APIError(
                "API error occurred", http_res.status_code, http_res_text, http_res
            )
        if utils.match_response(http_res, "5XX", "*"):
            http_res_text = utils.stream_to_text(http_res)
            raise errors.APIError(
                "API error occurred", http_res.status_code, http_res_text, http_res
            )

        content_type = http_res.headers.get("Content-Type")
        http_res_text = utils.stream_to_text(http_res)
        raise errors.APIError(
            f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
            http_res.status_code,
            http_res_text,
            http_res,
        )

    async def list_async(
        self,
        *,
        tenant_id: Optional[str] = None,
        type_: Optional[Union[models.Type, models.TypeTypedDict]] = None,
        topics: Optional[
            Union[
                models.ListTenantDestinationsTopics,
                models.ListTenantDestinationsTopicsTypedDict,
            ]
        ] = None,
        retries: OptionalNullable[utils.RetryConfig] = UNSET,
        server_url: Optional[str] = None,
        timeout_ms: Optional[int] = None,
        http_headers: Optional[Mapping[str, str]] = None,
    ) -> List[models.Destination]:
        r"""List Destinations

        Return a list of the destinations for the tenant. The endpoint is not paged.

        :param tenant_id: The ID of the tenant. Required when using AdminApiKey authentication.
        :param type: Filter destinations by type(s).
        :param topics: Filter destinations by supported topic(s).
        :param retries: Override the default retry configuration for this method
        :param server_url: Override the default server URL for this method
        :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
        :param http_headers: Additional headers to set or replace on requests.
        """
        base_url = None
        url_variables = None
        if timeout_ms is None:
            timeout_ms = self.sdk_configuration.timeout_ms

        if server_url is not None:
            base_url = server_url
        else:
            base_url = self._get_url(base_url, url_variables)

        request = models.ListTenantDestinationsRequest(
            tenant_id=tenant_id,
            type=type_,
            topics=topics,
        )

        req = self._build_request_async(
            method="GET",
            path="/{tenant_id}/destinations",
            base_url=base_url,
            url_variables=url_variables,
            request=request,
            request_body_required=False,
            request_has_path_params=True,
            request_has_query_params=True,
            user_agent_header="user-agent",
            accept_header_value="application/json",
            http_headers=http_headers,
            _globals=models.ListTenantDestinationsGlobals(
                tenant_id=self.sdk_configuration.globals.tenant_id,
            ),
            security=self.sdk_configuration.security,
            timeout_ms=timeout_ms,
        )

        if retries == UNSET:
            if self.sdk_configuration.retry_config is not UNSET:
                retries = self.sdk_configuration.retry_config

        retry_config = None
        if isinstance(retries, utils.RetryConfig):
            retry_config = (retries, ["429", "500", "502", "503", "504"])

        http_res = await self.do_request_async(
            hook_ctx=HookContext(
                base_url=base_url or "",
                operation_id="listTenantDestinations",
                oauth2_scopes=[],
                security_source=self.sdk_configuration.security,
            ),
            request=req,
            error_status_codes=[
                "400",
                "401",
                "403",
                "404",
                "407",
                "408",
                "413",
                "414",
                "415",
                "422",
                "429",
                "431",
                "4XX",
                "500",
                "501",
                "502",
                "503",
                "504",
                "505",
                "506",
                "507",
                "508",
                "510",
                "511",
                "5XX",
            ],
            retry_config=retry_config,
        )

        response_data: Any = None
        if utils.match_response(http_res, "200", "application/json"):
            return utils.unmarshal_json(http_res.text, List[models.Destination])
        if utils.match_response(http_res, ["401", "403", "407"], "application/json"):
            response_data = utils.unmarshal_json(
                http_res.text, errors.UnauthorizedErrorData
            )
            raise errors.UnauthorizedError(data=response_data)
        if utils.match_response(http_res, "408", "application/json"):
            response_data = utils.unmarshal_json(
                http_res.text, errors.TimeoutErrorTData
            )
            raise errors.TimeoutErrorT(data=response_data)
        if utils.match_response(http_res, "429", "application/json"):
            response_data = utils.unmarshal_json(
                http_res.text, errors.RateLimitedErrorData
            )
            raise errors.RateLimitedError(data=response_data)
        if utils.match_response(
            http_res, ["400", "413", "414", "415", "422", "431"], "application/json"
        ):
            response_data = utils.unmarshal_json(
                http_res.text, errors.BadRequestErrorData
            )
            raise errors.BadRequestError(data=response_data)
        if utils.match_response(http_res, "504", "application/json"):
            response_data = utils.unmarshal_json(
                http_res.text, errors.TimeoutErrorTData
            )
            raise errors.TimeoutErrorT(data=response_data)
        if utils.match_response(http_res, ["501", "505"], "application/json"):
            response_data = utils.unmarshal_json(
                http_res.text, errors.NotFoundErrorData
            )
            raise errors.NotFoundError(data=response_data)
        if utils.match_response(
            http_res, ["500", "502", "503", "506", "507", "508"], "application/json"
        ):
            response_data = utils.unmarshal_json(
                http_res.text, errors.InternalServerErrorData
            )
            raise errors.InternalServerError(data=response_data)
        if utils.match_response(http_res, "510", "application/json"):
            response_data = utils.unmarshal_json(
                http_res.text, errors.BadRequestErrorData
            )
            raise errors.BadRequestError(data=response_data)
        if utils.match_response(http_res, "511", "application/json"):
            response_data = utils.unmarshal_json(
                http_res.text, errors.UnauthorizedErrorData
            )
            raise errors.UnauthorizedError(data=response_data)
        if utils.match_response(http_res, ["404", "4XX"], "*"):
            http_res_text = await utils.stream_to_text_async(http_res)
            raise errors.APIError(
                "API error occurred", http_res.status_code, http_res_text, http_res
            )
        if utils.match_response(http_res, "5XX", "*"):
            http_res_text = await utils.stream_to_text_async(http_res)
            raise errors.APIError(
                "API error occurred", http_res.status_code, http_res_text, http_res
            )

        content_type = http_res.headers.get("Content-Type")
        http_res_text = await utils.stream_to_text_async(http_res)
        raise errors.APIError(
            f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
            http_res.status_code,
            http_res_text,
            http_res,
        )

    def create(
        self,
        *,
        destination_create: Union[
            models.DestinationCreate, models.DestinationCreateTypedDict
        ],
        tenant_id: Optional[str] = None,
        retries: OptionalNullable[utils.RetryConfig] = UNSET,
        server_url: Optional[str] = None,
        timeout_ms: Optional[int] = None,
        http_headers: Optional[Mapping[str, str]] = None,
    ) -> models.Destination:
        r"""Create Destination

        Creates a new destination for the tenant. The request body structure depends on the `type`.

        :param destination_create:
        :param tenant_id: The ID of the tenant. Required when using AdminApiKey authentication.
        :param retries: Override the default retry configuration for this method
        :param server_url: Override the default server URL for this method
        :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
        :param http_headers: Additional headers to set or replace on requests.
        """
        base_url = None
        url_variables = None
        if timeout_ms is None:
            timeout_ms = self.sdk_configuration.timeout_ms

        if server_url is not None:
            base_url = server_url
        else:
            base_url = self._get_url(base_url, url_variables)

        request = models.CreateTenantDestinationRequest(
            tenant_id=tenant_id,
            destination_create=utils.get_pydantic_model(
                destination_create, models.DestinationCreate
            ),
        )

        req = self._build_request(
            method="POST",
            path="/{tenant_id}/destinations",
            base_url=base_url,
            url_variables=url_variables,
            request=request,
            request_body_required=True,
            request_has_path_params=True,
            request_has_query_params=True,
            user_agent_header="user-agent",
            accept_header_value="application/json",
            http_headers=http_headers,
            _globals=models.CreateTenantDestinationGlobals(
                tenant_id=self.sdk_configuration.globals.tenant_id,
            ),
            security=self.sdk_configuration.security,
            get_serialized_body=lambda: utils.serialize_request_body(
                request.destination_create,
                False,
                False,
                "json",
                models.DestinationCreate,
            ),
            timeout_ms=timeout_ms,
        )

        if retries == UNSET:
            if self.sdk_configuration.retry_config is not UNSET:
                retries = self.sdk_configuration.retry_config

        retry_config = None
        if isinstance(retries, utils.RetryConfig):
            retry_config = (retries, ["429", "500", "502", "503", "504"])

        http_res = self.do_request(
            hook_ctx=HookContext(
                base_url=base_url or "",
                operation_id="createTenantDestination",
                oauth2_scopes=[],
                security_source=self.sdk_configuration.security,
            ),
            request=req,
            error_status_codes=[
                "400",
                "401",
                "403",
                "404",
                "407",
                "408",
                "413",
                "414",
                "415",
                "422",
                "429",
                "431",
                "4XX",
                "500",
                "501",
                "502",
                "503",
                "504",
                "505",
                "506",
                "507",
                "508",
                "510",
                "511",
                "5XX",
            ],
            retry_config=retry_config,
        )

        response_data: Any = None
        if utils.match_response(http_res, "201", "application/json"):
            return utils.unmarshal_json(http_res.text, models.Destination)
        if utils.match_response(http_res, ["401", "403", "407"], "application/json"):
            response_data = utils.unmarshal_json(
                http_res.text, errors.UnauthorizedErrorData
            )
            raise errors.UnauthorizedError(data=response_data)
        if utils.match_response(http_res, "408", "application/json"):
            response_data = utils.unmarshal_json(
                http_res.text, errors.TimeoutErrorTData
            )
            raise errors.TimeoutErrorT(data=response_data)
        if utils.match_response(http_res, "429", "application/json"):
            response_data = utils.unmarshal_json(
                http_res.text, errors.RateLimitedErrorData
            )
            raise errors.RateLimitedError(data=response_data)
        if utils.match_response(
            http_res, ["413", "414", "415", "422", "431"], "application/json"
        ):
            response_data = utils.unmarshal_json(
                http_res.text, errors.BadRequestErrorData
            )
            raise errors.BadRequestError(data=response_data)
        if utils.match_response(http_res, "504", "application/json"):
            response_data = utils.unmarshal_json(
                http_res.text, errors.TimeoutErrorTData
            )
            raise errors.TimeoutErrorT(data=response_data)
        if utils.match_response(http_res, ["501", "505"], "application/json"):
            response_data = utils.unmarshal_json(
                http_res.text, errors.NotFoundErrorData
            )
            raise errors.NotFoundError(data=response_data)
        if utils.match_response(
            http_res, ["500", "502", "503", "506", "507", "508"], "application/json"
        ):
            response_data = utils.unmarshal_json(
                http_res.text, errors.InternalServerErrorData
            )
            raise errors.InternalServerError(data=response_data)
        if utils.match_response(http_res, "510", "application/json"):
            response_data = utils.unmarshal_json(
                http_res.text, errors.BadRequestErrorData
            )
            raise errors.BadRequestError(data=response_data)
        if utils.match_response(http_res, "511", "application/json"):
            response_data = utils.unmarshal_json(
                http_res.text, errors.UnauthorizedErrorData
            )
            raise errors.UnauthorizedError(data=response_data)
        if utils.match_response(http_res, ["400", "404", "4XX"], "*"):
            http_res_text = utils.stream_to_text(http_res)
            raise errors.APIError(
                "API error occurred", http_res.status_code, http_res_text, http_res
            )
        if utils.match_response(http_res, "5XX", "*"):
            http_res_text = utils.stream_to_text(http_res)
            raise errors.APIError(
                "API error occurred", http_res.status_code, http_res_text, http_res
            )

        content_type = http_res.headers.get("Content-Type")
        http_res_text = utils.stream_to_text(http_res)
        raise errors.APIError(
            f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
            http_res.status_code,
            http_res_text,
            http_res,
        )

    async def create_async(
        self,
        *,
        destination_create: Union[
            models.DestinationCreate, models.DestinationCreateTypedDict
        ],
        tenant_id: Optional[str] = None,
        retries: OptionalNullable[utils.RetryConfig] = UNSET,
        server_url: Optional[str] = None,
        timeout_ms: Optional[int] = None,
        http_headers: Optional[Mapping[str, str]] = None,
    ) -> models.Destination:
        r"""Create Destination

        Creates a new destination for the tenant. The request body structure depends on the `type`.

        :param destination_create:
        :param tenant_id: The ID of the tenant. Required when using AdminApiKey authentication.
        :param retries: Override the default retry configuration for this method
        :param server_url: Override the default server URL for this method
        :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
        :param http_headers: Additional headers to set or replace on requests.
        """
        base_url = None
        url_variables = None
        if timeout_ms is None:
            timeout_ms = self.sdk_configuration.timeout_ms

        if server_url is not None:
            base_url = server_url
        else:
            base_url = self._get_url(base_url, url_variables)

        request = models.CreateTenantDestinationRequest(
            tenant_id=tenant_id,
            destination_create=utils.get_pydantic_model(
                destination_create, models.DestinationCreate
            ),
        )

        req = self._build_request_async(
            method="POST",
            path="/{tenant_id}/destinations",
            base_url=base_url,
            url_variables=url_variables,
            request=request,
            request_body_required=True,
            request_has_path_params=True,
            request_has_query_params=True,
            user_agent_header="user-agent",
            accept_header_value="application/json",
            http_headers=http_headers,
            _globals=models.CreateTenantDestinationGlobals(
                tenant_id=self.sdk_configuration.globals.tenant_id,
            ),
            security=self.sdk_configuration.security,
            get_serialized_body=lambda: utils.serialize_request_body(
                request.destination_create,
                False,
                False,
                "json",
                models.DestinationCreate,
            ),
            timeout_ms=timeout_ms,
        )

        if retries == UNSET:
            if self.sdk_configuration.retry_config is not UNSET:
                retries = self.sdk_configuration.retry_config

        retry_config = None
        if isinstance(retries, utils.RetryConfig):
            retry_config = (retries, ["429", "500", "502", "503", "504"])

        http_res = await self.do_request_async(
            hook_ctx=HookContext(
                base_url=base_url or "",
                operation_id="createTenantDestination",
                oauth2_scopes=[],
                security_source=self.sdk_configuration.security,
            ),
            request=req,
            error_status_codes=[
                "400",
                "401",
                "403",
                "404",
                "407",
                "408",
                "413",
                "414",
                "415",
                "422",
                "429",
                "431",
                "4XX",
                "500",
                "501",
                "502",
                "503",
                "504",
                "505",
                "506",
                "507",
                "508",
                "510",
                "511",
                "5XX",
            ],
            retry_config=retry_config,
        )

        response_data: Any = None
        if utils.match_response(http_res, "201", "application/json"):
            return utils.unmarshal_json(http_res.text, models.Destination)
        if utils.match_response(http_res, ["401", "403", "407"], "application/json"):
            response_data = utils.unmarshal_json(
                http_res.text, errors.UnauthorizedErrorData
            )
            raise errors.UnauthorizedError(data=response_data)
        if utils.match_response(http_res, "408", "application/json"):
            response_data = utils.unmarshal_json(
                http_res.text, errors.TimeoutErrorTData
            )
            raise errors.TimeoutErrorT(data=response_data)
        if utils.match_response(http_res, "429", "application/json"):
            response_data = utils.unmarshal_json(
                http_res.text, errors.RateLimitedErrorData
            )
            raise errors.RateLimitedError(data=response_data)
        if utils.match_response(
            http_res, ["413", "414", "415", "422", "431"], "application/json"
        ):
            response_data = utils.unmarshal_json(
                http_res.text, errors.BadRequestErrorData
            )
            raise errors.BadRequestError(data=response_data)
        if utils.match_response(http_res, "504", "application/json"):
            response_data = utils.unmarshal_json(
                http_res.text, errors.TimeoutErrorTData
            )
            raise errors.TimeoutErrorT(data=response_data)
        if utils.match_response(http_res, ["501", "505"], "application/json"):
            response_data = utils.unmarshal_json(
                http_res.text, errors.NotFoundErrorData
            )
            raise errors.NotFoundError(data=response_data)
        if utils.match_response(
            http_res, ["500", "502", "503", "506", "507", "508"], "application/json"
        ):
            response_data = utils.unmarshal_json(
                http_res.text, errors.InternalServerErrorData
            )
            raise errors.InternalServerError(data=response_data)
        if utils.match_response(http_res, "510", "application/json"):
            response_data = utils.unmarshal_json(
                http_res.text, errors.BadRequestErrorData
            )
            raise errors.BadRequestError(data=response_data)
        if utils.match_response(http_res, "511", "application/json"):
            response_data = utils.unmarshal_json(
                http_res.text, errors.UnauthorizedErrorData
            )
            raise errors.UnauthorizedError(data=response_data)
        if utils.match_response(http_res, ["400", "404", "4XX"], "*"):
            http_res_text = await utils.stream_to_text_async(http_res)
            raise errors.APIError(
                "API error occurred", http_res.status_code, http_res_text, http_res
            )
        if utils.match_response(http_res, "5XX", "*"):
            http_res_text = await utils.stream_to_text_async(http_res)
            raise errors.APIError(
                "API error occurred", http_res.status_code, http_res_text, http_res
            )

        content_type = http_res.headers.get("Content-Type")
        http_res_text = await utils.stream_to_text_async(http_res)
        raise errors.APIError(
            f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
            http_res.status_code,
            http_res_text,
            http_res,
        )

    def get(
        self,
        *,
        destination_id: str,
        tenant_id: Optional[str] = None,
        retries: OptionalNullable[utils.RetryConfig] = UNSET,
        server_url: Optional[str] = None,
        timeout_ms: Optional[int] = None,
        http_headers: Optional[Mapping[str, str]] = None,
    ) -> models.Destination:
        r"""Get Destination

        Retrieves details for a specific destination.

        :param destination_id: The ID of the destination.
        :param tenant_id: The ID of the tenant. Required when using AdminApiKey authentication.
        :param retries: Override the default retry configuration for this method
        :param server_url: Override the default server URL for this method
        :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
        :param http_headers: Additional headers to set or replace on requests.
        """
        base_url = None
        url_variables = None
        if timeout_ms is None:
            timeout_ms = self.sdk_configuration.timeout_ms

        if server_url is not None:
            base_url = server_url
        else:
            base_url = self._get_url(base_url, url_variables)

        request = models.GetTenantDestinationRequest(
            tenant_id=tenant_id,
            destination_id=destination_id,
        )

        req = self._build_request(
            method="GET",
            path="/{tenant_id}/destinations/{destination_id}",
            base_url=base_url,
            url_variables=url_variables,
            request=request,
            request_body_required=False,
            request_has_path_params=True,
            request_has_query_params=True,
            user_agent_header="user-agent",
            accept_header_value="application/json",
            http_headers=http_headers,
            _globals=models.GetTenantDestinationGlobals(
                tenant_id=self.sdk_configuration.globals.tenant_id,
            ),
            security=self.sdk_configuration.security,
            timeout_ms=timeout_ms,
        )

        if retries == UNSET:
            if self.sdk_configuration.retry_config is not UNSET:
                retries = self.sdk_configuration.retry_config

        retry_config = None
        if isinstance(retries, utils.RetryConfig):
            retry_config = (retries, ["429", "500", "502", "503", "504"])

        http_res = self.do_request(
            hook_ctx=HookContext(
                base_url=base_url or "",
                operation_id="getTenantDestination",
                oauth2_scopes=[],
                security_source=self.sdk_configuration.security,
            ),
            request=req,
            error_status_codes=[
                "400",
                "401",
                "403",
                "404",
                "407",
                "408",
                "413",
                "414",
                "415",
                "422",
                "429",
                "431",
                "4XX",
                "500",
                "501",
                "502",
                "503",
                "504",
                "505",
                "506",
                "507",
                "508",
                "510",
                "511",
                "5XX",
            ],
            retry_config=retry_config,
        )

        response_data: Any = None
        if utils.match_response(http_res, "200", "application/json"):
            return utils.unmarshal_json(http_res.text, models.Destination)
        if utils.match_response(http_res, ["401", "403", "407"], "application/json"):
            response_data = utils.unmarshal_json(
                http_res.text, errors.UnauthorizedErrorData
            )
            raise errors.UnauthorizedError(data=response_data)
        if utils.match_response(http_res, "408", "application/json"):
            response_data = utils.unmarshal_json(
                http_res.text, errors.TimeoutErrorTData
            )
            raise errors.TimeoutErrorT(data=response_data)
        if utils.match_response(http_res, "429", "application/json"):
            response_data = utils.unmarshal_json(
                http_res.text, errors.RateLimitedErrorData
            )
            raise errors.RateLimitedError(data=response_data)
        if utils.match_response(
            http_res, ["400", "413", "414", "415", "422", "431"], "application/json"
        ):
            response_data = utils.unmarshal_json(
                http_res.text, errors.BadRequestErrorData
            )
            raise errors.BadRequestError(data=response_data)
        if utils.match_response(http_res, "504", "application/json"):
            response_data = utils.unmarshal_json(
                http_res.text, errors.TimeoutErrorTData
            )
            raise errors.TimeoutErrorT(data=response_data)
        if utils.match_response(http_res, ["501", "505"], "application/json"):
            response_data = utils.unmarshal_json(
                http_res.text, errors.NotFoundErrorData
            )
            raise errors.NotFoundError(data=response_data)
        if utils.match_response(
            http_res, ["500", "502", "503", "506", "507", "508"], "application/json"
        ):
            response_data = utils.unmarshal_json(
                http_res.text, errors.InternalServerErrorData
            )
            raise errors.InternalServerError(data=response_data)
        if utils.match_response(http_res, "510", "application/json"):
            response_data = utils.unmarshal_json(
                http_res.text, errors.BadRequestErrorData
            )
            raise errors.BadRequestError(data=response_data)
        if utils.match_response(http_res, "511", "application/json"):
            response_data = utils.unmarshal_json(
                http_res.text, errors.UnauthorizedErrorData
            )
            raise errors.UnauthorizedError(data=response_data)
        if utils.match_response(http_res, ["404", "4XX"], "*"):
            http_res_text = utils.stream_to_text(http_res)
            raise errors.APIError(
                "API error occurred", http_res.status_code, http_res_text, http_res
            )
        if utils.match_response(http_res, "5XX", "*"):
            http_res_text = utils.stream_to_text(http_res)
            raise errors.APIError(
                "API error occurred", http_res.status_code, http_res_text, http_res
            )

        content_type = http_res.headers.get("Content-Type")
        http_res_text = utils.stream_to_text(http_res)
        raise errors.APIError(
            f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
            http_res.status_code,
            http_res_text,
            http_res,
        )

    async def get_async(
        self,
        *,
        destination_id: str,
        tenant_id: Optional[str] = None,
        retries: OptionalNullable[utils.RetryConfig] = UNSET,
        server_url: Optional[str] = None,
        timeout_ms: Optional[int] = None,
        http_headers: Optional[Mapping[str, str]] = None,
    ) -> models.Destination:
        r"""Get Destination

        Retrieves details for a specific destination.

        :param destination_id: The ID of the destination.
        :param tenant_id: The ID of the tenant. Required when using AdminApiKey authentication.
        :param retries: Override the default retry configuration for this method
        :param server_url: Override the default server URL for this method
        :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
        :param http_headers: Additional headers to set or replace on requests.
        """
        base_url = None
        url_variables = None
        if timeout_ms is None:
            timeout_ms = self.sdk_configuration.timeout_ms

        if server_url is not None:
            base_url = server_url
        else:
            base_url = self._get_url(base_url, url_variables)

        request = models.GetTenantDestinationRequest(
            tenant_id=tenant_id,
            destination_id=destination_id,
        )

        req = self._build_request_async(
            method="GET",
            path="/{tenant_id}/destinations/{destination_id}",
            base_url=base_url,
            url_variables=url_variables,
            request=request,
            request_body_required=False,
            request_has_path_params=True,
            request_has_query_params=True,
            user_agent_header="user-agent",
            accept_header_value="application/json",
            http_headers=http_headers,
            _globals=models.GetTenantDestinationGlobals(
                tenant_id=self.sdk_configuration.globals.tenant_id,
            ),
            security=self.sdk_configuration.security,
            timeout_ms=timeout_ms,
        )

        if retries == UNSET:
            if self.sdk_configuration.retry_config is not UNSET:
                retries = self.sdk_configuration.retry_config

        retry_config = None
        if isinstance(retries, utils.RetryConfig):
            retry_config = (retries, ["429", "500", "502", "503", "504"])

        http_res = await self.do_request_async(
            hook_ctx=HookContext(
                base_url=base_url or "",
                operation_id="getTenantDestination",
                oauth2_scopes=[],
                security_source=self.sdk_configuration.security,
            ),
            request=req,
            error_status_codes=[
                "400",
                "401",
                "403",
                "404",
                "407",
                "408",
                "413",
                "414",
                "415",
                "422",
                "429",
                "431",
                "4XX",
                "500",
                "501",
                "502",
                "503",
                "504",
                "505",
                "506",
                "507",
                "508",
                "510",
                "511",
                "5XX",
            ],
            retry_config=retry_config,
        )

        response_data: Any = None
        if utils.match_response(http_res, "200", "application/json"):
            return utils.unmarshal_json(http_res.text, models.Destination)
        if utils.match_response(http_res, ["401", "403", "407"], "application/json"):
            response_data = utils.unmarshal_json(
                http_res.text, errors.UnauthorizedErrorData
            )
            raise errors.UnauthorizedError(data=response_data)
        if utils.match_response(http_res, "408", "application/json"):
            response_data = utils.unmarshal_json(
                http_res.text, errors.TimeoutErrorTData
            )
            raise errors.TimeoutErrorT(data=response_data)
        if utils.match_response(http_res, "429", "application/json"):
            response_data = utils.unmarshal_json(
                http_res.text, errors.RateLimitedErrorData
            )
            raise errors.RateLimitedError(data=response_data)
        if utils.match_response(
            http_res, ["400", "413", "414", "415", "422", "431"], "application/json"
        ):
            response_data = utils.unmarshal_json(
                http_res.text, errors.BadRequestErrorData
            )
            raise errors.BadRequestError(data=response_data)
        if utils.match_response(http_res, "504", "application/json"):
            response_data = utils.unmarshal_json(
                http_res.text, errors.TimeoutErrorTData
            )
            raise errors.TimeoutErrorT(data=response_data)
        if utils.match_response(http_res, ["501", "505"], "application/json"):
            response_data = utils.unmarshal_json(
                http_res.text, errors.NotFoundErrorData
            )
            raise errors.NotFoundError(data=response_data)
        if utils.match_response(
            http_res, ["500", "502", "503", "506", "507", "508"], "application/json"
        ):
            response_data = utils.unmarshal_json(
                http_res.text, errors.InternalServerErrorData
            )
            raise errors.InternalServerError(data=response_data)
        if utils.match_response(http_res, "510", "application/json"):
            response_data = utils.unmarshal_json(
                http_res.text, errors.BadRequestErrorData
            )
            raise errors.BadRequestError(data=response_data)
        if utils.match_response(http_res, "511", "application/json"):
            response_data = utils.unmarshal_json(
                http_res.text, errors.UnauthorizedErrorData
            )
            raise errors.UnauthorizedError(data=response_data)
        if utils.match_response(http_res, ["404", "4XX"], "*"):
            http_res_text = await utils.stream_to_text_async(http_res)
            raise errors.APIError(
                "API error occurred", http_res.status_code, http_res_text, http_res
            )
        if utils.match_response(http_res, "5XX", "*"):
            http_res_text = await utils.stream_to_text_async(http_res)
            raise errors.APIError(
                "API error occurred", http_res.status_code, http_res_text, http_res
            )

        content_type = http_res.headers.get("Content-Type")
        http_res_text = await utils.stream_to_text_async(http_res)
        raise errors.APIError(
            f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
            http_res.status_code,
            http_res_text,
            http_res,
        )

    def update(
        self,
        *,
        destination_id: str,
        destination_update: Union[
            models.DestinationUpdate, models.DestinationUpdateTypedDict
        ],
        tenant_id: Optional[str] = None,
        retries: OptionalNullable[utils.RetryConfig] = UNSET,
        server_url: Optional[str] = None,
        timeout_ms: Optional[int] = None,
        http_headers: Optional[Mapping[str, str]] = None,
    ) -> models.UpdateTenantDestinationResponse:
        r"""Update Destination

        Updates the configuration of an existing destination. The request body structure depends on the destination's `type`. Type itself cannot be updated. May return an OAuth redirect URL for certain types.

        :param destination_id: The ID of the destination.
        :param destination_update:
        :param tenant_id: The ID of the tenant. Required when using AdminApiKey authentication.
        :param retries: Override the default retry configuration for this method
        :param server_url: Override the default server URL for this method
        :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
        :param http_headers: Additional headers to set or replace on requests.
        """
        base_url = None
        url_variables = None
        if timeout_ms is None:
            timeout_ms = self.sdk_configuration.timeout_ms

        if server_url is not None:
            base_url = server_url
        else:
            base_url = self._get_url(base_url, url_variables)

        request = models.UpdateTenantDestinationRequest(
            tenant_id=tenant_id,
            destination_id=destination_id,
            destination_update=utils.get_pydantic_model(
                destination_update, models.DestinationUpdate
            ),
        )

        req = self._build_request(
            method="PATCH",
            path="/{tenant_id}/destinations/{destination_id}",
            base_url=base_url,
            url_variables=url_variables,
            request=request,
            request_body_required=True,
            request_has_path_params=True,
            request_has_query_params=True,
            user_agent_header="user-agent",
            accept_header_value="application/json",
            http_headers=http_headers,
            _globals=models.UpdateTenantDestinationGlobals(
                tenant_id=self.sdk_configuration.globals.tenant_id,
            ),
            security=self.sdk_configuration.security,
            get_serialized_body=lambda: utils.serialize_request_body(
                request.destination_update,
                False,
                False,
                "json",
                models.DestinationUpdate,
            ),
            timeout_ms=timeout_ms,
        )

        if retries == UNSET:
            if self.sdk_configuration.retry_config is not UNSET:
                retries = self.sdk_configuration.retry_config

        retry_config = None
        if isinstance(retries, utils.RetryConfig):
            retry_config = (retries, ["429", "500", "502", "503", "504"])

        http_res = self.do_request(
            hook_ctx=HookContext(
                base_url=base_url or "",
                operation_id="updateTenantDestination",
                oauth2_scopes=[],
                security_source=self.sdk_configuration.security,
            ),
            request=req,
            error_status_codes=[
                "400",
                "401",
                "403",
                "404",
                "407",
                "408",
                "413",
                "414",
                "415",
                "422",
                "429",
                "431",
                "4XX",
                "500",
                "501",
                "502",
                "503",
                "504",
                "505",
                "506",
                "507",
                "508",
                "510",
                "511",
                "5XX",
            ],
            retry_config=retry_config,
        )

        response_data: Any = None
        if utils.match_response(http_res, "200", "application/json"):
            return utils.unmarshal_json(
                http_res.text, models.UpdateTenantDestinationResponse
            )
        if utils.match_response(http_res, ["401", "403", "407"], "application/json"):
            response_data = utils.unmarshal_json(
                http_res.text, errors.UnauthorizedErrorData
            )
            raise errors.UnauthorizedError(data=response_data)
        if utils.match_response(http_res, "408", "application/json"):
            response_data = utils.unmarshal_json(
                http_res.text, errors.TimeoutErrorTData
            )
            raise errors.TimeoutErrorT(data=response_data)
        if utils.match_response(http_res, "429", "application/json"):
            response_data = utils.unmarshal_json(
                http_res.text, errors.RateLimitedErrorData
            )
            raise errors.RateLimitedError(data=response_data)
        if utils.match_response(
            http_res, ["413", "414", "415", "422", "431"], "application/json"
        ):
            response_data = utils.unmarshal_json(
                http_res.text, errors.BadRequestErrorData
            )
            raise errors.BadRequestError(data=response_data)
        if utils.match_response(http_res, "504", "application/json"):
            response_data = utils.unmarshal_json(
                http_res.text, errors.TimeoutErrorTData
            )
            raise errors.TimeoutErrorT(data=response_data)
        if utils.match_response(http_res, ["501", "505"], "application/json"):
            response_data = utils.unmarshal_json(
                http_res.text, errors.NotFoundErrorData
            )
            raise errors.NotFoundError(data=response_data)
        if utils.match_response(
            http_res, ["500", "502", "503", "506", "507", "508"], "application/json"
        ):
            response_data = utils.unmarshal_json(
                http_res.text, errors.InternalServerErrorData
            )
            raise errors.InternalServerError(data=response_data)
        if utils.match_response(http_res, "510", "application/json"):
            response_data = utils.unmarshal_json(
                http_res.text, errors.BadRequestErrorData
            )
            raise errors.BadRequestError(data=response_data)
        if utils.match_response(http_res, "511", "application/json"):
            response_data = utils.unmarshal_json(
                http_res.text, errors.UnauthorizedErrorData
            )
            raise errors.UnauthorizedError(data=response_data)
        if utils.match_response(http_res, ["400", "404", "4XX"], "*"):
            http_res_text = utils.stream_to_text(http_res)
            raise errors.APIError(
                "API error occurred", http_res.status_code, http_res_text, http_res
            )
        if utils.match_response(http_res, "5XX", "*"):
            http_res_text = utils.stream_to_text(http_res)
            raise errors.APIError(
                "API error occurred", http_res.status_code, http_res_text, http_res
            )

        content_type = http_res.headers.get("Content-Type")
        http_res_text = utils.stream_to_text(http_res)
        raise errors.APIError(
            f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
            http_res.status_code,
            http_res_text,
            http_res,
        )

    async def update_async(
        self,
        *,
        destination_id: str,
        destination_update: Union[
            models.DestinationUpdate, models.DestinationUpdateTypedDict
        ],
        tenant_id: Optional[str] = None,
        retries: OptionalNullable[utils.RetryConfig] = UNSET,
        server_url: Optional[str] = None,
        timeout_ms: Optional[int] = None,
        http_headers: Optional[Mapping[str, str]] = None,
    ) -> models.UpdateTenantDestinationResponse:
        r"""Update Destination

        Updates the configuration of an existing destination. The request body structure depends on the destination's `type`. Type itself cannot be updated. May return an OAuth redirect URL for certain types.

        :param destination_id: The ID of the destination.
        :param destination_update:
        :param tenant_id: The ID of the tenant. Required when using AdminApiKey authentication.
        :param retries: Override the default retry configuration for this method
        :param server_url: Override the default server URL for this method
        :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
        :param http_headers: Additional headers to set or replace on requests.
        """
        base_url = None
        url_variables = None
        if timeout_ms is None:
            timeout_ms = self.sdk_configuration.timeout_ms

        if server_url is not None:
            base_url = server_url
        else:
            base_url = self._get_url(base_url, url_variables)

        request = models.UpdateTenantDestinationRequest(
            tenant_id=tenant_id,
            destination_id=destination_id,
            destination_update=utils.get_pydantic_model(
                destination_update, models.DestinationUpdate
            ),
        )

        req = self._build_request_async(
            method="PATCH",
            path="/{tenant_id}/destinations/{destination_id}",
            base_url=base_url,
            url_variables=url_variables,
            request=request,
            request_body_required=True,
            request_has_path_params=True,
            request_has_query_params=True,
            user_agent_header="user-agent",
            accept_header_value="application/json",
            http_headers=http_headers,
            _globals=models.UpdateTenantDestinationGlobals(
                tenant_id=self.sdk_configuration.globals.tenant_id,
            ),
            security=self.sdk_configuration.security,
            get_serialized_body=lambda: utils.serialize_request_body(
                request.destination_update,
                False,
                False,
                "json",
                models.DestinationUpdate,
            ),
            timeout_ms=timeout_ms,
        )

        if retries == UNSET:
            if self.sdk_configuration.retry_config is not UNSET:
                retries = self.sdk_configuration.retry_config

        retry_config = None
        if isinstance(retries, utils.RetryConfig):
            retry_config = (retries, ["429", "500", "502", "503", "504"])

        http_res = await self.do_request_async(
            hook_ctx=HookContext(
                base_url=base_url or "",
                operation_id="updateTenantDestination",
                oauth2_scopes=[],
                security_source=self.sdk_configuration.security,
            ),
            request=req,
            error_status_codes=[
                "400",
                "401",
                "403",
                "404",
                "407",
                "408",
                "413",
                "414",
                "415",
                "422",
                "429",
                "431",
                "4XX",
                "500",
                "501",
                "502",
                "503",
                "504",
                "505",
                "506",
                "507",
                "508",
                "510",
                "511",
                "5XX",
            ],
            retry_config=retry_config,
        )

        response_data: Any = None
        if utils.match_response(http_res, "200", "application/json"):
            return utils.unmarshal_json(
                http_res.text, models.UpdateTenantDestinationResponse
            )
        if utils.match_response(http_res, ["401", "403", "407"], "application/json"):
            response_data = utils.unmarshal_json(
                http_res.text, errors.UnauthorizedErrorData
            )
            raise errors.UnauthorizedError(data=response_data)
        if utils.match_response(http_res, "408", "application/json"):
            response_data = utils.unmarshal_json(
                http_res.text, errors.TimeoutErrorTData
            )
            raise errors.TimeoutErrorT(data=response_data)
        if utils.match_response(http_res, "429", "application/json"):
            response_data = utils.unmarshal_json(
                http_res.text, errors.RateLimitedErrorData
            )
            raise errors.RateLimitedError(data=response_data)
        if utils.match_response(
            http_res, ["413", "414", "415", "422", "431"], "application/json"
        ):
            response_data = utils.unmarshal_json(
                http_res.text, errors.BadRequestErrorData
            )
            raise errors.BadRequestError(data=response_data)
        if utils.match_response(http_res, "504", "application/json"):
            response_data = utils.unmarshal_json(
                http_res.text, errors.TimeoutErrorTData
            )
            raise errors.TimeoutErrorT(data=response_data)
        if utils.match_response(http_res, ["501", "505"], "application/json"):
            response_data = utils.unmarshal_json(
                http_res.text, errors.NotFoundErrorData
            )
            raise errors.NotFoundError(data=response_data)
        if utils.match_response(
            http_res, ["500", "502", "503", "506", "507", "508"], "application/json"
        ):
            response_data = utils.unmarshal_json(
                http_res.text, errors.InternalServerErrorData
            )
            raise errors.InternalServerError(data=response_data)
        if utils.match_response(http_res, "510", "application/json"):
            response_data = utils.unmarshal_json(
                http_res.text, errors.BadRequestErrorData
            )
            raise errors.BadRequestError(data=response_data)
        if utils.match_response(http_res, "511", "application/json"):
            response_data = utils.unmarshal_json(
                http_res.text, errors.UnauthorizedErrorData
            )
            raise errors.UnauthorizedError(data=response_data)
        if utils.match_response(http_res, ["400", "404", "4XX"], "*"):
            http_res_text = await utils.stream_to_text_async(http_res)
            raise errors.APIError(
                "API error occurred", http_res.status_code, http_res_text, http_res
            )
        if utils.match_response(http_res, "5XX", "*"):
            http_res_text = await utils.stream_to_text_async(http_res)
            raise errors.APIError(
                "API error occurred", http_res.status_code, http_res_text, http_res
            )

        content_type = http_res.headers.get("Content-Type")
        http_res_text = await utils.stream_to_text_async(http_res)
        raise errors.APIError(
            f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
            http_res.status_code,
            http_res_text,
            http_res,
        )

    def delete(
        self,
        *,
        destination_id: str,
        tenant_id: Optional[str] = None,
        retries: OptionalNullable[utils.RetryConfig] = UNSET,
        server_url: Optional[str] = None,
        timeout_ms: Optional[int] = None,
        http_headers: Optional[Mapping[str, str]] = None,
    ) -> models.SuccessResponse:
        r"""Delete Destination

        Deletes a specific destination.

        :param destination_id: The ID of the destination.
        :param tenant_id: The ID of the tenant. Required when using AdminApiKey authentication.
        :param retries: Override the default retry configuration for this method
        :param server_url: Override the default server URL for this method
        :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
        :param http_headers: Additional headers to set or replace on requests.
        """
        base_url = None
        url_variables = None
        if timeout_ms is None:
            timeout_ms = self.sdk_configuration.timeout_ms

        if server_url is not None:
            base_url = server_url
        else:
            base_url = self._get_url(base_url, url_variables)

        request = models.DeleteTenantDestinationRequest(
            tenant_id=tenant_id,
            destination_id=destination_id,
        )

        req = self._build_request(
            method="DELETE",
            path="/{tenant_id}/destinations/{destination_id}",
            base_url=base_url,
            url_variables=url_variables,
            request=request,
            request_body_required=False,
            request_has_path_params=True,
            request_has_query_params=True,
            user_agent_header="user-agent",
            accept_header_value="application/json",
            http_headers=http_headers,
            _globals=models.DeleteTenantDestinationGlobals(
                tenant_id=self.sdk_configuration.globals.tenant_id,
            ),
            security=self.sdk_configuration.security,
            timeout_ms=timeout_ms,
        )

        if retries == UNSET:
            if self.sdk_configuration.retry_config is not UNSET:
                retries = self.sdk_configuration.retry_config

        retry_config = None
        if isinstance(retries, utils.RetryConfig):
            retry_config = (retries, ["429", "500", "502", "503", "504"])

        http_res = self.do_request(
            hook_ctx=HookContext(
                base_url=base_url or "",
                operation_id="deleteTenantDestination",
                oauth2_scopes=[],
                security_source=self.sdk_configuration.security,
            ),
            request=req,
            error_status_codes=[
                "400",
                "401",
                "403",
                "404",
                "407",
                "408",
                "413",
                "414",
                "415",
                "422",
                "429",
                "431",
                "4XX",
                "500",
                "501",
                "502",
                "503",
                "504",
                "505",
                "506",
                "507",
                "508",
                "510",
                "511",
                "5XX",
            ],
            retry_config=retry_config,
        )

        response_data: Any = None
        if utils.match_response(http_res, "200", "application/json"):
            return utils.unmarshal_json(http_res.text, models.SuccessResponse)
        if utils.match_response(http_res, ["401", "403", "407"], "application/json"):
            response_data = utils.unmarshal_json(
                http_res.text, errors.UnauthorizedErrorData
            )
            raise errors.UnauthorizedError(data=response_data)
        if utils.match_response(http_res, "408", "application/json"):
            response_data = utils.unmarshal_json(
                http_res.text, errors.TimeoutErrorTData
            )
            raise errors.TimeoutErrorT(data=response_data)
        if utils.match_response(http_res, "429", "application/json"):
            response_data = utils.unmarshal_json(
                http_res.text, errors.RateLimitedErrorData
            )
            raise errors.RateLimitedError(data=response_data)
        if utils.match_response(
            http_res, ["400", "413", "414", "415", "422", "431"], "application/json"
        ):
            response_data = utils.unmarshal_json(
                http_res.text, errors.BadRequestErrorData
            )
            raise errors.BadRequestError(data=response_data)
        if utils.match_response(http_res, "504", "application/json"):
            response_data = utils.unmarshal_json(
                http_res.text, errors.TimeoutErrorTData
            )
            raise errors.TimeoutErrorT(data=response_data)
        if utils.match_response(http_res, ["501", "505"], "application/json"):
            response_data = utils.unmarshal_json(
                http_res.text, errors.NotFoundErrorData
            )
            raise errors.NotFoundError(data=response_data)
        if utils.match_response(
            http_res, ["500", "502", "503", "506", "507", "508"], "application/json"
        ):
            response_data = utils.unmarshal_json(
                http_res.text, errors.InternalServerErrorData
            )
            raise errors.InternalServerError(data=response_data)
        if utils.match_response(http_res, "510", "application/json"):
            response_data = utils.unmarshal_json(
                http_res.text, errors.BadRequestErrorData
            )
            raise errors.BadRequestError(data=response_data)
        if utils.match_response(http_res, "511", "application/json"):
            response_data = utils.unmarshal_json(
                http_res.text, errors.UnauthorizedErrorData
            )
            raise errors.UnauthorizedError(data=response_data)
        if utils.match_response(http_res, ["404", "4XX"], "*"):
            http_res_text = utils.stream_to_text(http_res)
            raise errors.APIError(
                "API error occurred", http_res.status_code, http_res_text, http_res
            )
        if utils.match_response(http_res, "5XX", "*"):
            http_res_text = utils.stream_to_text(http_res)
            raise errors.APIError(
                "API error occurred", http_res.status_code, http_res_text, http_res
            )

        content_type = http_res.headers.get("Content-Type")
        http_res_text = utils.stream_to_text(http_res)
        raise errors.APIError(
            f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
            http_res.status_code,
            http_res_text,
            http_res,
        )

    async def delete_async(
        self,
        *,
        destination_id: str,
        tenant_id: Optional[str] = None,
        retries: OptionalNullable[utils.RetryConfig] = UNSET,
        server_url: Optional[str] = None,
        timeout_ms: Optional[int] = None,
        http_headers: Optional[Mapping[str, str]] = None,
    ) -> models.SuccessResponse:
        r"""Delete Destination

        Deletes a specific destination.

        :param destination_id: The ID of the destination.
        :param tenant_id: The ID of the tenant. Required when using AdminApiKey authentication.
        :param retries: Override the default retry configuration for this method
        :param server_url: Override the default server URL for this method
        :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
        :param http_headers: Additional headers to set or replace on requests.
        """
        base_url = None
        url_variables = None
        if timeout_ms is None:
            timeout_ms = self.sdk_configuration.timeout_ms

        if server_url is not None:
            base_url = server_url
        else:
            base_url = self._get_url(base_url, url_variables)

        request = models.DeleteTenantDestinationRequest(
            tenant_id=tenant_id,
            destination_id=destination_id,
        )

        req = self._build_request_async(
            method="DELETE",
            path="/{tenant_id}/destinations/{destination_id}",
            base_url=base_url,
            url_variables=url_variables,
            request=request,
            request_body_required=False,
            request_has_path_params=True,
            request_has_query_params=True,
            user_agent_header="user-agent",
            accept_header_value="application/json",
            http_headers=http_headers,
            _globals=models.DeleteTenantDestinationGlobals(
                tenant_id=self.sdk_configuration.globals.tenant_id,
            ),
            security=self.sdk_configuration.security,
            timeout_ms=timeout_ms,
        )

        if retries == UNSET:
            if self.sdk_configuration.retry_config is not UNSET:
                retries = self.sdk_configuration.retry_config

        retry_config = None
        if isinstance(retries, utils.RetryConfig):
            retry_config = (retries, ["429", "500", "502", "503", "504"])

        http_res = await self.do_request_async(
            hook_ctx=HookContext(
                base_url=base_url or "",
                operation_id="deleteTenantDestination",
                oauth2_scopes=[],
                security_source=self.sdk_configuration.security,
            ),
            request=req,
            error_status_codes=[
                "400",
                "401",
                "403",
                "404",
                "407",
                "408",
                "413",
                "414",
                "415",
                "422",
                "429",
                "431",
                "4XX",
                "500",
                "501",
                "502",
                "503",
                "504",
                "505",
                "506",
                "507",
                "508",
                "510",
                "511",
                "5XX",
            ],
            retry_config=retry_config,
        )

        response_data: Any = None
        if utils.match_response(http_res, "200", "application/json"):
            return utils.unmarshal_json(http_res.text, models.SuccessResponse)
        if utils.match_response(http_res, ["401", "403", "407"], "application/json"):
            response_data = utils.unmarshal_json(
                http_res.text, errors.UnauthorizedErrorData
            )
            raise errors.UnauthorizedError(data=response_data)
        if utils.match_response(http_res, "408", "application/json"):
            response_data = utils.unmarshal_json(
                http_res.text, errors.TimeoutErrorTData
            )
            raise errors.TimeoutErrorT(data=response_data)
        if utils.match_response(http_res, "429", "application/json"):
            response_data = utils.unmarshal_json(
                http_res.text, errors.RateLimitedErrorData
            )
            raise errors.RateLimitedError(data=response_data)
        if utils.match_response(
            http_res, ["400", "413", "414", "415", "422", "431"], "application/json"
        ):
            response_data = utils.unmarshal_json(
                http_res.text, errors.BadRequestErrorData
            )
            raise errors.BadRequestError(data=response_data)
        if utils.match_response(http_res, "504", "application/json"):
            response_data = utils.unmarshal_json(
                http_res.text, errors.TimeoutErrorTData
            )
            raise errors.TimeoutErrorT(data=response_data)
        if utils.match_response(http_res, ["501", "505"], "application/json"):
            response_data = utils.unmarshal_json(
                http_res.text, errors.NotFoundErrorData
            )
            raise errors.NotFoundError(data=response_data)
        if utils.match_response(
            http_res, ["500", "502", "503", "506", "507", "508"], "application/json"
        ):
            response_data = utils.unmarshal_json(
                http_res.text, errors.InternalServerErrorData
            )
            raise errors.InternalServerError(data=response_data)
        if utils.match_response(http_res, "510", "application/json"):
            response_data = utils.unmarshal_json(
                http_res.text, errors.BadRequestErrorData
            )
            raise errors.BadRequestError(data=response_data)
        if utils.match_response(http_res, "511", "application/json"):
            response_data = utils.unmarshal_json(
                http_res.text, errors.UnauthorizedErrorData
            )
            raise errors.UnauthorizedError(data=response_data)
        if utils.match_response(http_res, ["404", "4XX"], "*"):
            http_res_text = await utils.stream_to_text_async(http_res)
            raise errors.APIError(
                "API error occurred", http_res.status_code, http_res_text, http_res
            )
        if utils.match_response(http_res, "5XX", "*"):
            http_res_text = await utils.stream_to_text_async(http_res)
            raise errors.APIError(
                "API error occurred", http_res.status_code, http_res_text, http_res
            )

        content_type = http_res.headers.get("Content-Type")
        http_res_text = await utils.stream_to_text_async(http_res)
        raise errors.APIError(
            f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
            http_res.status_code,
            http_res_text,
            http_res,
        )

    def enable(
        self,
        *,
        destination_id: str,
        tenant_id: Optional[str] = None,
        retries: OptionalNullable[utils.RetryConfig] = UNSET,
        server_url: Optional[str] = None,
        timeout_ms: Optional[int] = None,
        http_headers: Optional[Mapping[str, str]] = None,
    ) -> models.Destination:
        r"""Enable Destination

        Enables a previously disabled destination.

        :param destination_id: The ID of the destination.
        :param tenant_id: The ID of the tenant. Required when using AdminApiKey authentication.
        :param retries: Override the default retry configuration for this method
        :param server_url: Override the default server URL for this method
        :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
        :param http_headers: Additional headers to set or replace on requests.
        """
        base_url = None
        url_variables = None
        if timeout_ms is None:
            timeout_ms = self.sdk_configuration.timeout_ms

        if server_url is not None:
            base_url = server_url
        else:
            base_url = self._get_url(base_url, url_variables)

        request = models.EnableTenantDestinationRequest(
            tenant_id=tenant_id,
            destination_id=destination_id,
        )

        req = self._build_request(
            method="PUT",
            path="/{tenant_id}/destinations/{destination_id}/enable",
            base_url=base_url,
            url_variables=url_variables,
            request=request,
            request_body_required=False,
            request_has_path_params=True,
            request_has_query_params=True,
            user_agent_header="user-agent",
            accept_header_value="application/json",
            http_headers=http_headers,
            _globals=models.EnableTenantDestinationGlobals(
                tenant_id=self.sdk_configuration.globals.tenant_id,
            ),
            security=self.sdk_configuration.security,
            timeout_ms=timeout_ms,
        )

        if retries == UNSET:
            if self.sdk_configuration.retry_config is not UNSET:
                retries = self.sdk_configuration.retry_config

        retry_config = None
        if isinstance(retries, utils.RetryConfig):
            retry_config = (retries, ["429", "500", "502", "503", "504"])

        http_res = self.do_request(
            hook_ctx=HookContext(
                base_url=base_url or "",
                operation_id="enableTenantDestination",
                oauth2_scopes=[],
                security_source=self.sdk_configuration.security,
            ),
            request=req,
            error_status_codes=[
                "400",
                "401",
                "403",
                "404",
                "407",
                "408",
                "413",
                "414",
                "415",
                "422",
                "429",
                "431",
                "4XX",
                "500",
                "501",
                "502",
                "503",
                "504",
                "505",
                "506",
                "507",
                "508",
                "510",
                "511",
                "5XX",
            ],
            retry_config=retry_config,
        )

        response_data: Any = None
        if utils.match_response(http_res, "200", "application/json"):
            return utils.unmarshal_json(http_res.text, models.Destination)
        if utils.match_response(http_res, ["401", "403", "407"], "application/json"):
            response_data = utils.unmarshal_json(
                http_res.text, errors.UnauthorizedErrorData
            )
            raise errors.UnauthorizedError(data=response_data)
        if utils.match_response(http_res, "408", "application/json"):
            response_data = utils.unmarshal_json(
                http_res.text, errors.TimeoutErrorTData
            )
            raise errors.TimeoutErrorT(data=response_data)
        if utils.match_response(http_res, "429", "application/json"):
            response_data = utils.unmarshal_json(
                http_res.text, errors.RateLimitedErrorData
            )
            raise errors.RateLimitedError(data=response_data)
        if utils.match_response(
            http_res, ["400", "413", "414", "415", "422", "431"], "application/json"
        ):
            response_data = utils.unmarshal_json(
                http_res.text, errors.BadRequestErrorData
            )
            raise errors.BadRequestError(data=response_data)
        if utils.match_response(http_res, "504", "application/json"):
            response_data = utils.unmarshal_json(
                http_res.text, errors.TimeoutErrorTData
            )
            raise errors.TimeoutErrorT(data=response_data)
        if utils.match_response(http_res, ["501", "505"], "application/json"):
            response_data = utils.unmarshal_json(
                http_res.text, errors.NotFoundErrorData
            )
            raise errors.NotFoundError(data=response_data)
        if utils.match_response(
            http_res, ["500", "502", "503", "506", "507", "508"], "application/json"
        ):
            response_data = utils.unmarshal_json(
                http_res.text, errors.InternalServerErrorData
            )
            raise errors.InternalServerError(data=response_data)
        if utils.match_response(http_res, "510", "application/json"):
            response_data = utils.unmarshal_json(
                http_res.text, errors.BadRequestErrorData
            )
            raise errors.BadRequestError(data=response_data)
        if utils.match_response(http_res, "511", "application/json"):
            response_data = utils.unmarshal_json(
                http_res.text, errors.UnauthorizedErrorData
            )
            raise errors.UnauthorizedError(data=response_data)
        if utils.match_response(http_res, ["404", "4XX"], "*"):
            http_res_text = utils.stream_to_text(http_res)
            raise errors.APIError(
                "API error occurred", http_res.status_code, http_res_text, http_res
            )
        if utils.match_response(http_res, "5XX", "*"):
            http_res_text = utils.stream_to_text(http_res)
            raise errors.APIError(
                "API error occurred", http_res.status_code, http_res_text, http_res
            )

        content_type = http_res.headers.get("Content-Type")
        http_res_text = utils.stream_to_text(http_res)
        raise errors.APIError(
            f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
            http_res.status_code,
            http_res_text,
            http_res,
        )

    async def enable_async(
        self,
        *,
        destination_id: str,
        tenant_id: Optional[str] = None,
        retries: OptionalNullable[utils.RetryConfig] = UNSET,
        server_url: Optional[str] = None,
        timeout_ms: Optional[int] = None,
        http_headers: Optional[Mapping[str, str]] = None,
    ) -> models.Destination:
        r"""Enable Destination

        Enables a previously disabled destination.

        :param destination_id: The ID of the destination.
        :param tenant_id: The ID of the tenant. Required when using AdminApiKey authentication.
        :param retries: Override the default retry configuration for this method
        :param server_url: Override the default server URL for this method
        :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
        :param http_headers: Additional headers to set or replace on requests.
        """
        base_url = None
        url_variables = None
        if timeout_ms is None:
            timeout_ms = self.sdk_configuration.timeout_ms

        if server_url is not None:
            base_url = server_url
        else:
            base_url = self._get_url(base_url, url_variables)

        request = models.EnableTenantDestinationRequest(
            tenant_id=tenant_id,
            destination_id=destination_id,
        )

        req = self._build_request_async(
            method="PUT",
            path="/{tenant_id}/destinations/{destination_id}/enable",
            base_url=base_url,
            url_variables=url_variables,
            request=request,
            request_body_required=False,
            request_has_path_params=True,
            request_has_query_params=True,
            user_agent_header="user-agent",
            accept_header_value="application/json",
            http_headers=http_headers,
            _globals=models.EnableTenantDestinationGlobals(
                tenant_id=self.sdk_configuration.globals.tenant_id,
            ),
            security=self.sdk_configuration.security,
            timeout_ms=timeout_ms,
        )

        if retries == UNSET:
            if self.sdk_configuration.retry_config is not UNSET:
                retries = self.sdk_configuration.retry_config

        retry_config = None
        if isinstance(retries, utils.RetryConfig):
            retry_config = (retries, ["429", "500", "502", "503", "504"])

        http_res = await self.do_request_async(
            hook_ctx=HookContext(
                base_url=base_url or "",
                operation_id="enableTenantDestination",
                oauth2_scopes=[],
                security_source=self.sdk_configuration.security,
            ),
            request=req,
            error_status_codes=[
                "400",
                "401",
                "403",
                "404",
                "407",
                "408",
                "413",
                "414",
                "415",
                "422",
                "429",
                "431",
                "4XX",
                "500",
                "501",
                "502",
                "503",
                "504",
                "505",
                "506",
                "507",
                "508",
                "510",
                "511",
                "5XX",
            ],
            retry_config=retry_config,
        )

        response_data: Any = None
        if utils.match_response(http_res, "200", "application/json"):
            return utils.unmarshal_json(http_res.text, models.Destination)
        if utils.match_response(http_res, ["401", "403", "407"], "application/json"):
            response_data = utils.unmarshal_json(
                http_res.text, errors.UnauthorizedErrorData
            )
            raise errors.UnauthorizedError(data=response_data)
        if utils.match_response(http_res, "408", "application/json"):
            response_data = utils.unmarshal_json(
                http_res.text, errors.TimeoutErrorTData
            )
            raise errors.TimeoutErrorT(data=response_data)
        if utils.match_response(http_res, "429", "application/json"):
            response_data = utils.unmarshal_json(
                http_res.text, errors.RateLimitedErrorData
            )
            raise errors.RateLimitedError(data=response_data)
        if utils.match_response(
            http_res, ["400", "413", "414", "415", "422", "431"], "application/json"
        ):
            response_data = utils.unmarshal_json(
                http_res.text, errors.BadRequestErrorData
            )
            raise errors.BadRequestError(data=response_data)
        if utils.match_response(http_res, "504", "application/json"):
            response_data = utils.unmarshal_json(
                http_res.text, errors.TimeoutErrorTData
            )
            raise errors.TimeoutErrorT(data=response_data)
        if utils.match_response(http_res, ["501", "505"], "application/json"):
            response_data = utils.unmarshal_json(
                http_res.text, errors.NotFoundErrorData
            )
            raise errors.NotFoundError(data=response_data)
        if utils.match_response(
            http_res, ["500", "502", "503", "506", "507", "508"], "application/json"
        ):
            response_data = utils.unmarshal_json(
                http_res.text, errors.InternalServerErrorData
            )
            raise errors.InternalServerError(data=response_data)
        if utils.match_response(http_res, "510", "application/json"):
            response_data = utils.unmarshal_json(
                http_res.text, errors.BadRequestErrorData
            )
            raise errors.BadRequestError(data=response_data)
        if utils.match_response(http_res, "511", "application/json"):
            response_data = utils.unmarshal_json(
                http_res.text, errors.UnauthorizedErrorData
            )
            raise errors.UnauthorizedError(data=response_data)
        if utils.match_response(http_res, ["404", "4XX"], "*"):
            http_res_text = await utils.stream_to_text_async(http_res)
            raise errors.APIError(
                "API error occurred", http_res.status_code, http_res_text, http_res
            )
        if utils.match_response(http_res, "5XX", "*"):
            http_res_text = await utils.stream_to_text_async(http_res)
            raise errors.APIError(
                "API error occurred", http_res.status_code, http_res_text, http_res
            )

        content_type = http_res.headers.get("Content-Type")
        http_res_text = await utils.stream_to_text_async(http_res)
        raise errors.APIError(
            f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
            http_res.status_code,
            http_res_text,
            http_res,
        )

    def disable(
        self,
        *,
        destination_id: str,
        tenant_id: Optional[str] = None,
        retries: OptionalNullable[utils.RetryConfig] = UNSET,
        server_url: Optional[str] = None,
        timeout_ms: Optional[int] = None,
        http_headers: Optional[Mapping[str, str]] = None,
    ) -> models.Destination:
        r"""Disable Destination

        Disables a previously enabled destination.

        :param destination_id: The ID of the destination.
        :param tenant_id: The ID of the tenant. Required when using AdminApiKey authentication.
        :param retries: Override the default retry configuration for this method
        :param server_url: Override the default server URL for this method
        :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
        :param http_headers: Additional headers to set or replace on requests.
        """
        base_url = None
        url_variables = None
        if timeout_ms is None:
            timeout_ms = self.sdk_configuration.timeout_ms

        if server_url is not None:
            base_url = server_url
        else:
            base_url = self._get_url(base_url, url_variables)

        request = models.DisableTenantDestinationRequest(
            tenant_id=tenant_id,
            destination_id=destination_id,
        )

        req = self._build_request(
            method="PUT",
            path="/{tenant_id}/destinations/{destination_id}/disable",
            base_url=base_url,
            url_variables=url_variables,
            request=request,
            request_body_required=False,
            request_has_path_params=True,
            request_has_query_params=True,
            user_agent_header="user-agent",
            accept_header_value="application/json",
            http_headers=http_headers,
            _globals=models.DisableTenantDestinationGlobals(
                tenant_id=self.sdk_configuration.globals.tenant_id,
            ),
            security=self.sdk_configuration.security,
            timeout_ms=timeout_ms,
        )

        if retries == UNSET:
            if self.sdk_configuration.retry_config is not UNSET:
                retries = self.sdk_configuration.retry_config

        retry_config = None
        if isinstance(retries, utils.RetryConfig):
            retry_config = (retries, ["429", "500", "502", "503", "504"])

        http_res = self.do_request(
            hook_ctx=HookContext(
                base_url=base_url or "",
                operation_id="disableTenantDestination",
                oauth2_scopes=[],
                security_source=self.sdk_configuration.security,
            ),
            request=req,
            error_status_codes=[
                "400",
                "401",
                "403",
                "404",
                "407",
                "408",
                "413",
                "414",
                "415",
                "422",
                "429",
                "431",
                "4XX",
                "500",
                "501",
                "502",
                "503",
                "504",
                "505",
                "506",
                "507",
                "508",
                "510",
                "511",
                "5XX",
            ],
            retry_config=retry_config,
        )

        response_data: Any = None
        if utils.match_response(http_res, "200", "application/json"):
            return utils.unmarshal_json(http_res.text, models.Destination)
        if utils.match_response(http_res, ["401", "403", "407"], "application/json"):
            response_data = utils.unmarshal_json(
                http_res.text, errors.UnauthorizedErrorData
            )
            raise errors.UnauthorizedError(data=response_data)
        if utils.match_response(http_res, "408", "application/json"):
            response_data = utils.unmarshal_json(
                http_res.text, errors.TimeoutErrorTData
            )
            raise errors.TimeoutErrorT(data=response_data)
        if utils.match_response(http_res, "429", "application/json"):
            response_data = utils.unmarshal_json(
                http_res.text, errors.RateLimitedErrorData
            )
            raise errors.RateLimitedError(data=response_data)
        if utils.match_response(
            http_res, ["400", "413", "414", "415", "422", "431"], "application/json"
        ):
            response_data = utils.unmarshal_json(
                http_res.text, errors.BadRequestErrorData
            )
            raise errors.BadRequestError(data=response_data)
        if utils.match_response(http_res, "504", "application/json"):
            response_data = utils.unmarshal_json(
                http_res.text, errors.TimeoutErrorTData
            )
            raise errors.TimeoutErrorT(data=response_data)
        if utils.match_response(http_res, ["501", "505"], "application/json"):
            response_data = utils.unmarshal_json(
                http_res.text, errors.NotFoundErrorData
            )
            raise errors.NotFoundError(data=response_data)
        if utils.match_response(
            http_res, ["500", "502", "503", "506", "507", "508"], "application/json"
        ):
            response_data = utils.unmarshal_json(
                http_res.text, errors.InternalServerErrorData
            )
            raise errors.InternalServerError(data=response_data)
        if utils.match_response(http_res, "510", "application/json"):
            response_data = utils.unmarshal_json(
                http_res.text, errors.BadRequestErrorData
            )
            raise errors.BadRequestError(data=response_data)
        if utils.match_response(http_res, "511", "application/json"):
            response_data = utils.unmarshal_json(
                http_res.text, errors.UnauthorizedErrorData
            )
            raise errors.UnauthorizedError(data=response_data)
        if utils.match_response(http_res, ["404", "4XX"], "*"):
            http_res_text = utils.stream_to_text(http_res)
            raise errors.APIError(
                "API error occurred", http_res.status_code, http_res_text, http_res
            )
        if utils.match_response(http_res, "5XX", "*"):
            http_res_text = utils.stream_to_text(http_res)
            raise errors.APIError(
                "API error occurred", http_res.status_code, http_res_text, http_res
            )

        content_type = http_res.headers.get("Content-Type")
        http_res_text = utils.stream_to_text(http_res)
        raise errors.APIError(
            f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
            http_res.status_code,
            http_res_text,
            http_res,
        )

    async def disable_async(
        self,
        *,
        destination_id: str,
        tenant_id: Optional[str] = None,
        retries: OptionalNullable[utils.RetryConfig] = UNSET,
        server_url: Optional[str] = None,
        timeout_ms: Optional[int] = None,
        http_headers: Optional[Mapping[str, str]] = None,
    ) -> models.Destination:
        r"""Disable Destination

        Disables a previously enabled destination.

        :param destination_id: The ID of the destination.
        :param tenant_id: The ID of the tenant. Required when using AdminApiKey authentication.
        :param retries: Override the default retry configuration for this method
        :param server_url: Override the default server URL for this method
        :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
        :param http_headers: Additional headers to set or replace on requests.
        """
        base_url = None
        url_variables = None
        if timeout_ms is None:
            timeout_ms = self.sdk_configuration.timeout_ms

        if server_url is not None:
            base_url = server_url
        else:
            base_url = self._get_url(base_url, url_variables)

        request = models.DisableTenantDestinationRequest(
            tenant_id=tenant_id,
            destination_id=destination_id,
        )

        req = self._build_request_async(
            method="PUT",
            path="/{tenant_id}/destinations/{destination_id}/disable",
            base_url=base_url,
            url_variables=url_variables,
            request=request,
            request_body_required=False,
            request_has_path_params=True,
            request_has_query_params=True,
            user_agent_header="user-agent",
            accept_header_value="application/json",
            http_headers=http_headers,
            _globals=models.DisableTenantDestinationGlobals(
                tenant_id=self.sdk_configuration.globals.tenant_id,
            ),
            security=self.sdk_configuration.security,
            timeout_ms=timeout_ms,
        )

        if retries == UNSET:
            if self.sdk_configuration.retry_config is not UNSET:
                retries = self.sdk_configuration.retry_config

        retry_config = None
        if isinstance(retries, utils.RetryConfig):
            retry_config = (retries, ["429", "500", "502", "503", "504"])

        http_res = await self.do_request_async(
            hook_ctx=HookContext(
                base_url=base_url or "",
                operation_id="disableTenantDestination",
                oauth2_scopes=[],
                security_source=self.sdk_configuration.security,
            ),
            request=req,
            error_status_codes=[
                "400",
                "401",
                "403",
                "404",
                "407",
                "408",
                "413",
                "414",
                "415",
                "422",
                "429",
                "431",
                "4XX",
                "500",
                "501",
                "502",
                "503",
                "504",
                "505",
                "506",
                "507",
                "508",
                "510",
                "511",
                "5XX",
            ],
            retry_config=retry_config,
        )

        response_data: Any = None
        if utils.match_response(http_res, "200", "application/json"):
            return utils.unmarshal_json(http_res.text, models.Destination)
        if utils.match_response(http_res, ["401", "403", "407"], "application/json"):
            response_data = utils.unmarshal_json(
                http_res.text, errors.UnauthorizedErrorData
            )
            raise errors.UnauthorizedError(data=response_data)
        if utils.match_response(http_res, "408", "application/json"):
            response_data = utils.unmarshal_json(
                http_res.text, errors.TimeoutErrorTData
            )
            raise errors.TimeoutErrorT(data=response_data)
        if utils.match_response(http_res, "429", "application/json"):
            response_data = utils.unmarshal_json(
                http_res.text, errors.RateLimitedErrorData
            )
            raise errors.RateLimitedError(data=response_data)
        if utils.match_response(
            http_res, ["400", "413", "414", "415", "422", "431"], "application/json"
        ):
            response_data = utils.unmarshal_json(
                http_res.text, errors.BadRequestErrorData
            )
            raise errors.BadRequestError(data=response_data)
        if utils.match_response(http_res, "504", "application/json"):
            response_data = utils.unmarshal_json(
                http_res.text, errors.TimeoutErrorTData
            )
            raise errors.TimeoutErrorT(data=response_data)
        if utils.match_response(http_res, ["501", "505"], "application/json"):
            response_data = utils.unmarshal_json(
                http_res.text, errors.NotFoundErrorData
            )
            raise errors.NotFoundError(data=response_data)
        if utils.match_response(
            http_res, ["500", "502", "503", "506", "507", "508"], "application/json"
        ):
            response_data = utils.unmarshal_json(
                http_res.text, errors.InternalServerErrorData
            )
            raise errors.InternalServerError(data=response_data)
        if utils.match_response(http_res, "510", "application/json"):
            response_data = utils.unmarshal_json(
                http_res.text, errors.BadRequestErrorData
            )
            raise errors.BadRequestError(data=response_data)
        if utils.match_response(http_res, "511", "application/json"):
            response_data = utils.unmarshal_json(
                http_res.text, errors.UnauthorizedErrorData
            )
            raise errors.UnauthorizedError(data=response_data)
        if utils.match_response(http_res, ["404", "4XX"], "*"):
            http_res_text = await utils.stream_to_text_async(http_res)
            raise errors.APIError(
                "API error occurred", http_res.status_code, http_res_text, http_res
            )
        if utils.match_response(http_res, "5XX", "*"):
            http_res_text = await utils.stream_to_text_async(http_res)
            raise errors.APIError(
                "API error occurred", http_res.status_code, http_res_text, http_res
            )

        content_type = http_res.headers.get("Content-Type")
        http_res_text = await utils.stream_to_text_async(http_res)
        raise errors.APIError(
            f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
            http_res.status_code,
            http_res_text,
            http_res,
        )
