{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# OPTIONS_GHC -fno-warn-unused-binds #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
{-# OPTIONS_GHC -fno-warn-unused-matches #-}

-- Derived from AWS service descriptions, licensed under Apache 2.0.

-- |
-- Module      : Amazonka.LexV2Models.DeleteSlotType
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Deletes a slot type from a bot locale.
--
-- If a slot is using the slot type, Amazon Lex throws a
-- @ResourceInUseException@ exception. To avoid the exception, set the
-- @skipResourceInUseCheck@ parameter to @true@.
module Amazonka.LexV2Models.DeleteSlotType
  ( -- * Creating a Request
    DeleteSlotType (..),
    newDeleteSlotType,

    -- * Request Lenses
    deleteSlotType_skipResourceInUseCheck,
    deleteSlotType_slotTypeId,
    deleteSlotType_botId,
    deleteSlotType_botVersion,
    deleteSlotType_localeId,

    -- * Destructuring the Response
    DeleteSlotTypeResponse (..),
    newDeleteSlotTypeResponse,
  )
where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.LexV2Models.Types
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response

-- | /See:/ 'newDeleteSlotType' smart constructor.
data DeleteSlotType = DeleteSlotType'
  { -- | By default, the @DeleteSlotType@ operations throws a
    -- @ResourceInUseException@ exception if you try to delete a slot type used
    -- by a slot. Set the @skipResourceInUseCheck@ parameter to @true@ to skip
    -- this check and remove the slot type even if a slot uses it.
    DeleteSlotType -> Maybe Bool
skipResourceInUseCheck :: Prelude.Maybe Prelude.Bool,
    -- | The identifier of the slot type to delete.
    DeleteSlotType -> Text
slotTypeId :: Prelude.Text,
    -- | The identifier of the bot associated with the slot type.
    DeleteSlotType -> Text
botId :: Prelude.Text,
    -- | The version of the bot associated with the slot type.
    DeleteSlotType -> Text
botVersion :: Prelude.Text,
    -- | The identifier of the language and locale that the slot type will be
    -- deleted from. The string must match one of the supported locales. For
    -- more information, see
    -- <https://docs.aws.amazon.com/lexv2/latest/dg/how-languages.html Supported languages>.
    DeleteSlotType -> Text
localeId :: Prelude.Text
  }
  deriving (DeleteSlotType -> DeleteSlotType -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteSlotType -> DeleteSlotType -> Bool
$c/= :: DeleteSlotType -> DeleteSlotType -> Bool
== :: DeleteSlotType -> DeleteSlotType -> Bool
$c== :: DeleteSlotType -> DeleteSlotType -> Bool
Prelude.Eq, ReadPrec [DeleteSlotType]
ReadPrec DeleteSlotType
Int -> ReadS DeleteSlotType
ReadS [DeleteSlotType]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteSlotType]
$creadListPrec :: ReadPrec [DeleteSlotType]
readPrec :: ReadPrec DeleteSlotType
$creadPrec :: ReadPrec DeleteSlotType
readList :: ReadS [DeleteSlotType]
$creadList :: ReadS [DeleteSlotType]
readsPrec :: Int -> ReadS DeleteSlotType
$creadsPrec :: Int -> ReadS DeleteSlotType
Prelude.Read, Int -> DeleteSlotType -> ShowS
[DeleteSlotType] -> ShowS
DeleteSlotType -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteSlotType] -> ShowS
$cshowList :: [DeleteSlotType] -> ShowS
show :: DeleteSlotType -> String
$cshow :: DeleteSlotType -> String
showsPrec :: Int -> DeleteSlotType -> ShowS
$cshowsPrec :: Int -> DeleteSlotType -> ShowS
Prelude.Show, forall x. Rep DeleteSlotType x -> DeleteSlotType
forall x. DeleteSlotType -> Rep DeleteSlotType x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DeleteSlotType x -> DeleteSlotType
$cfrom :: forall x. DeleteSlotType -> Rep DeleteSlotType x
Prelude.Generic)

-- |
-- Create a value of 'DeleteSlotType' with all optional fields omitted.
--
-- Use <https://hackage.haskell.org/package/generic-lens generic-lens> or <https://hackage.haskell.org/package/optics optics> to modify other optional fields.
--
-- The following record fields are available, with the corresponding lenses provided
-- for backwards compatibility:
--
-- 'skipResourceInUseCheck', 'deleteSlotType_skipResourceInUseCheck' - By default, the @DeleteSlotType@ operations throws a
-- @ResourceInUseException@ exception if you try to delete a slot type used
-- by a slot. Set the @skipResourceInUseCheck@ parameter to @true@ to skip
-- this check and remove the slot type even if a slot uses it.
--
-- 'slotTypeId', 'deleteSlotType_slotTypeId' - The identifier of the slot type to delete.
--
-- 'botId', 'deleteSlotType_botId' - The identifier of the bot associated with the slot type.
--
-- 'botVersion', 'deleteSlotType_botVersion' - The version of the bot associated with the slot type.
--
-- 'localeId', 'deleteSlotType_localeId' - The identifier of the language and locale that the slot type will be
-- deleted from. The string must match one of the supported locales. For
-- more information, see
-- <https://docs.aws.amazon.com/lexv2/latest/dg/how-languages.html Supported languages>.
newDeleteSlotType ::
  -- | 'slotTypeId'
  Prelude.Text ->
  -- | 'botId'
  Prelude.Text ->
  -- | 'botVersion'
  Prelude.Text ->
  -- | 'localeId'
  Prelude.Text ->
  DeleteSlotType
newDeleteSlotType :: Text -> Text -> Text -> Text -> DeleteSlotType
newDeleteSlotType
  Text
pSlotTypeId_
  Text
pBotId_
  Text
pBotVersion_
  Text
pLocaleId_ =
    DeleteSlotType'
      { $sel:skipResourceInUseCheck:DeleteSlotType' :: Maybe Bool
skipResourceInUseCheck =
          forall a. Maybe a
Prelude.Nothing,
        $sel:slotTypeId:DeleteSlotType' :: Text
slotTypeId = Text
pSlotTypeId_,
        $sel:botId:DeleteSlotType' :: Text
botId = Text
pBotId_,
        $sel:botVersion:DeleteSlotType' :: Text
botVersion = Text
pBotVersion_,
        $sel:localeId:DeleteSlotType' :: Text
localeId = Text
pLocaleId_
      }

-- | By default, the @DeleteSlotType@ operations throws a
-- @ResourceInUseException@ exception if you try to delete a slot type used
-- by a slot. Set the @skipResourceInUseCheck@ parameter to @true@ to skip
-- this check and remove the slot type even if a slot uses it.
deleteSlotType_skipResourceInUseCheck :: Lens.Lens' DeleteSlotType (Prelude.Maybe Prelude.Bool)
deleteSlotType_skipResourceInUseCheck :: Lens' DeleteSlotType (Maybe Bool)
deleteSlotType_skipResourceInUseCheck = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteSlotType' {Maybe Bool
skipResourceInUseCheck :: Maybe Bool
$sel:skipResourceInUseCheck:DeleteSlotType' :: DeleteSlotType -> Maybe Bool
skipResourceInUseCheck} -> Maybe Bool
skipResourceInUseCheck) (\s :: DeleteSlotType
s@DeleteSlotType' {} Maybe Bool
a -> DeleteSlotType
s {$sel:skipResourceInUseCheck:DeleteSlotType' :: Maybe Bool
skipResourceInUseCheck = Maybe Bool
a} :: DeleteSlotType)

-- | The identifier of the slot type to delete.
deleteSlotType_slotTypeId :: Lens.Lens' DeleteSlotType Prelude.Text
deleteSlotType_slotTypeId :: Lens' DeleteSlotType Text
deleteSlotType_slotTypeId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteSlotType' {Text
slotTypeId :: Text
$sel:slotTypeId:DeleteSlotType' :: DeleteSlotType -> Text
slotTypeId} -> Text
slotTypeId) (\s :: DeleteSlotType
s@DeleteSlotType' {} Text
a -> DeleteSlotType
s {$sel:slotTypeId:DeleteSlotType' :: Text
slotTypeId = Text
a} :: DeleteSlotType)

-- | The identifier of the bot associated with the slot type.
deleteSlotType_botId :: Lens.Lens' DeleteSlotType Prelude.Text
deleteSlotType_botId :: Lens' DeleteSlotType Text
deleteSlotType_botId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteSlotType' {Text
botId :: Text
$sel:botId:DeleteSlotType' :: DeleteSlotType -> Text
botId} -> Text
botId) (\s :: DeleteSlotType
s@DeleteSlotType' {} Text
a -> DeleteSlotType
s {$sel:botId:DeleteSlotType' :: Text
botId = Text
a} :: DeleteSlotType)

-- | The version of the bot associated with the slot type.
deleteSlotType_botVersion :: Lens.Lens' DeleteSlotType Prelude.Text
deleteSlotType_botVersion :: Lens' DeleteSlotType Text
deleteSlotType_botVersion = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteSlotType' {Text
botVersion :: Text
$sel:botVersion:DeleteSlotType' :: DeleteSlotType -> Text
botVersion} -> Text
botVersion) (\s :: DeleteSlotType
s@DeleteSlotType' {} Text
a -> DeleteSlotType
s {$sel:botVersion:DeleteSlotType' :: Text
botVersion = Text
a} :: DeleteSlotType)

-- | The identifier of the language and locale that the slot type will be
-- deleted from. The string must match one of the supported locales. For
-- more information, see
-- <https://docs.aws.amazon.com/lexv2/latest/dg/how-languages.html Supported languages>.
deleteSlotType_localeId :: Lens.Lens' DeleteSlotType Prelude.Text
deleteSlotType_localeId :: Lens' DeleteSlotType Text
deleteSlotType_localeId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteSlotType' {Text
localeId :: Text
$sel:localeId:DeleteSlotType' :: DeleteSlotType -> Text
localeId} -> Text
localeId) (\s :: DeleteSlotType
s@DeleteSlotType' {} Text
a -> DeleteSlotType
s {$sel:localeId:DeleteSlotType' :: Text
localeId = Text
a} :: DeleteSlotType)

instance Core.AWSRequest DeleteSlotType where
  type
    AWSResponse DeleteSlotType =
      DeleteSlotTypeResponse
  request :: (Service -> Service) -> DeleteSlotType -> Request DeleteSlotType
request Service -> Service
overrides =
    forall a. ToRequest a => Service -> a -> Request a
Request.delete (Service -> Service
overrides Service
defaultService)
  response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy DeleteSlotType
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DeleteSlotType)))
response =
    forall (m :: * -> *) a.
MonadResource m =>
AWSResponse a
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveNull DeleteSlotTypeResponse
DeleteSlotTypeResponse'

instance Prelude.Hashable DeleteSlotType where
  hashWithSalt :: Int -> DeleteSlotType -> Int
hashWithSalt Int
_salt DeleteSlotType' {Maybe Bool
Text
localeId :: Text
botVersion :: Text
botId :: Text
slotTypeId :: Text
skipResourceInUseCheck :: Maybe Bool
$sel:localeId:DeleteSlotType' :: DeleteSlotType -> Text
$sel:botVersion:DeleteSlotType' :: DeleteSlotType -> Text
$sel:botId:DeleteSlotType' :: DeleteSlotType -> Text
$sel:slotTypeId:DeleteSlotType' :: DeleteSlotType -> Text
$sel:skipResourceInUseCheck:DeleteSlotType' :: DeleteSlotType -> Maybe Bool
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Bool
skipResourceInUseCheck
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
slotTypeId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
botId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
botVersion
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
localeId

instance Prelude.NFData DeleteSlotType where
  rnf :: DeleteSlotType -> ()
rnf DeleteSlotType' {Maybe Bool
Text
localeId :: Text
botVersion :: Text
botId :: Text
slotTypeId :: Text
skipResourceInUseCheck :: Maybe Bool
$sel:localeId:DeleteSlotType' :: DeleteSlotType -> Text
$sel:botVersion:DeleteSlotType' :: DeleteSlotType -> Text
$sel:botId:DeleteSlotType' :: DeleteSlotType -> Text
$sel:slotTypeId:DeleteSlotType' :: DeleteSlotType -> Text
$sel:skipResourceInUseCheck:DeleteSlotType' :: DeleteSlotType -> Maybe Bool
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Bool
skipResourceInUseCheck
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
slotTypeId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
botId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
botVersion
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
localeId

instance Data.ToHeaders DeleteSlotType where
  toHeaders :: DeleteSlotType -> [Header]
toHeaders =
    forall a b. a -> b -> a
Prelude.const
      ( forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"Content-Type"
              forall a. ToHeader a => HeaderName -> a -> [Header]
Data.=# ( ByteString
"application/x-amz-json-1.1" ::
                          Prelude.ByteString
                      )
          ]
      )

instance Data.ToPath DeleteSlotType where
  toPath :: DeleteSlotType -> ByteString
toPath DeleteSlotType' {Maybe Bool
Text
localeId :: Text
botVersion :: Text
botId :: Text
slotTypeId :: Text
skipResourceInUseCheck :: Maybe Bool
$sel:localeId:DeleteSlotType' :: DeleteSlotType -> Text
$sel:botVersion:DeleteSlotType' :: DeleteSlotType -> Text
$sel:botId:DeleteSlotType' :: DeleteSlotType -> Text
$sel:slotTypeId:DeleteSlotType' :: DeleteSlotType -> Text
$sel:skipResourceInUseCheck:DeleteSlotType' :: DeleteSlotType -> Maybe Bool
..} =
    forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"/bots/",
        forall a. ToByteString a => a -> ByteString
Data.toBS Text
botId,
        ByteString
"/botversions/",
        forall a. ToByteString a => a -> ByteString
Data.toBS Text
botVersion,
        ByteString
"/botlocales/",
        forall a. ToByteString a => a -> ByteString
Data.toBS Text
localeId,
        ByteString
"/slottypes/",
        forall a. ToByteString a => a -> ByteString
Data.toBS Text
slotTypeId,
        ByteString
"/"
      ]

instance Data.ToQuery DeleteSlotType where
  toQuery :: DeleteSlotType -> QueryString
toQuery DeleteSlotType' {Maybe Bool
Text
localeId :: Text
botVersion :: Text
botId :: Text
slotTypeId :: Text
skipResourceInUseCheck :: Maybe Bool
$sel:localeId:DeleteSlotType' :: DeleteSlotType -> Text
$sel:botVersion:DeleteSlotType' :: DeleteSlotType -> Text
$sel:botId:DeleteSlotType' :: DeleteSlotType -> Text
$sel:slotTypeId:DeleteSlotType' :: DeleteSlotType -> Text
$sel:skipResourceInUseCheck:DeleteSlotType' :: DeleteSlotType -> Maybe Bool
..} =
    forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"skipResourceInUseCheck"
          forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Bool
skipResourceInUseCheck
      ]

-- | /See:/ 'newDeleteSlotTypeResponse' smart constructor.
data DeleteSlotTypeResponse = DeleteSlotTypeResponse'
  {
  }
  deriving (DeleteSlotTypeResponse -> DeleteSlotTypeResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteSlotTypeResponse -> DeleteSlotTypeResponse -> Bool
$c/= :: DeleteSlotTypeResponse -> DeleteSlotTypeResponse -> Bool
== :: DeleteSlotTypeResponse -> DeleteSlotTypeResponse -> Bool
$c== :: DeleteSlotTypeResponse -> DeleteSlotTypeResponse -> Bool
Prelude.Eq, ReadPrec [DeleteSlotTypeResponse]
ReadPrec DeleteSlotTypeResponse
Int -> ReadS DeleteSlotTypeResponse
ReadS [DeleteSlotTypeResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteSlotTypeResponse]
$creadListPrec :: ReadPrec [DeleteSlotTypeResponse]
readPrec :: ReadPrec DeleteSlotTypeResponse
$creadPrec :: ReadPrec DeleteSlotTypeResponse
readList :: ReadS [DeleteSlotTypeResponse]
$creadList :: ReadS [DeleteSlotTypeResponse]
readsPrec :: Int -> ReadS DeleteSlotTypeResponse
$creadsPrec :: Int -> ReadS DeleteSlotTypeResponse
Prelude.Read, Int -> DeleteSlotTypeResponse -> ShowS
[DeleteSlotTypeResponse] -> ShowS
DeleteSlotTypeResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteSlotTypeResponse] -> ShowS
$cshowList :: [DeleteSlotTypeResponse] -> ShowS
show :: DeleteSlotTypeResponse -> String
$cshow :: DeleteSlotTypeResponse -> String
showsPrec :: Int -> DeleteSlotTypeResponse -> ShowS
$cshowsPrec :: Int -> DeleteSlotTypeResponse -> ShowS
Prelude.Show, forall x. Rep DeleteSlotTypeResponse x -> DeleteSlotTypeResponse
forall x. DeleteSlotTypeResponse -> Rep DeleteSlotTypeResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DeleteSlotTypeResponse x -> DeleteSlotTypeResponse
$cfrom :: forall x. DeleteSlotTypeResponse -> Rep DeleteSlotTypeResponse x
Prelude.Generic)

-- |
-- Create a value of 'DeleteSlotTypeResponse' with all optional fields omitted.
--
-- Use <https://hackage.haskell.org/package/generic-lens generic-lens> or <https://hackage.haskell.org/package/optics optics> to modify other optional fields.
newDeleteSlotTypeResponse ::
  DeleteSlotTypeResponse
newDeleteSlotTypeResponse :: DeleteSlotTypeResponse
newDeleteSlotTypeResponse = DeleteSlotTypeResponse
DeleteSlotTypeResponse'

instance Prelude.NFData DeleteSlotTypeResponse where
  rnf :: DeleteSlotTypeResponse -> ()
rnf DeleteSlotTypeResponse
_ = ()