{-# 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.LexModels.DeleteSlotType
-- Copyright   : (c) 2013-2021 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Deletes all versions of the slot type, including the @$LATEST@ version.
-- To delete a specific version of the slot type, use the
-- DeleteSlotTypeVersion operation.
--
-- You can delete a version of a slot type only if it is not referenced. To
-- delete a slot type that is referred to in one or more intents, you must
-- remove those references first.
--
-- If you get the @ResourceInUseException@ exception, the exception
-- provides an example reference that shows the intent where the slot type
-- is referenced. To remove the reference to the slot type, either update
-- the intent or delete it. If you get the same exception when you attempt
-- to delete the slot type again, repeat until the slot type has no
-- references and the @DeleteSlotType@ call is successful.
--
-- This operation requires permission for the @lex:DeleteSlotType@ action.
module Amazonka.LexModels.DeleteSlotType
  ( -- * Creating a Request
    DeleteSlotType (..),
    newDeleteSlotType,

    -- * Request Lenses
    deleteSlotType_name,

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

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.LexModels.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'
  { -- | The name of the slot type. The name is case sensitive.
    DeleteSlotType -> Text
name :: Prelude.Text
  }
  deriving (DeleteSlotType -> DeleteSlotType -> Bool
(DeleteSlotType -> DeleteSlotType -> Bool)
-> (DeleteSlotType -> DeleteSlotType -> Bool) -> Eq DeleteSlotType
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]
(Int -> ReadS DeleteSlotType)
-> ReadS [DeleteSlotType]
-> ReadPrec DeleteSlotType
-> ReadPrec [DeleteSlotType]
-> Read 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
(Int -> DeleteSlotType -> ShowS)
-> (DeleteSlotType -> String)
-> ([DeleteSlotType] -> ShowS)
-> Show DeleteSlotType
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. DeleteSlotType -> Rep DeleteSlotType x)
-> (forall x. Rep DeleteSlotType x -> DeleteSlotType)
-> Generic DeleteSlotType
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:
--
-- 'name', 'deleteSlotType_name' - The name of the slot type. The name is case sensitive.
newDeleteSlotType ::
  -- | 'name'
  Prelude.Text ->
  DeleteSlotType
newDeleteSlotType :: Text -> DeleteSlotType
newDeleteSlotType Text
pName_ =
  DeleteSlotType' :: Text -> DeleteSlotType
DeleteSlotType' {$sel:name:DeleteSlotType' :: Text
name = Text
pName_}

-- | The name of the slot type. The name is case sensitive.
deleteSlotType_name :: Lens.Lens' DeleteSlotType Prelude.Text
deleteSlotType_name :: (Text -> f Text) -> DeleteSlotType -> f DeleteSlotType
deleteSlotType_name = (DeleteSlotType -> Text)
-> (DeleteSlotType -> Text -> DeleteSlotType)
-> Lens DeleteSlotType DeleteSlotType Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteSlotType' {Text
name :: Text
$sel:name:DeleteSlotType' :: DeleteSlotType -> Text
name} -> Text
name) (\s :: DeleteSlotType
s@DeleteSlotType' {} Text
a -> DeleteSlotType
s {$sel:name:DeleteSlotType' :: Text
name = Text
a} :: DeleteSlotType)

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

instance Prelude.Hashable DeleteSlotType

instance Prelude.NFData DeleteSlotType

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

instance Core.ToPath DeleteSlotType where
  toPath :: DeleteSlotType -> ByteString
toPath DeleteSlotType' {Text
name :: Text
$sel:name:DeleteSlotType' :: DeleteSlotType -> Text
..} =
    [ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat [ByteString
"/slottypes/", Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
name]

instance Core.ToQuery DeleteSlotType where
  toQuery :: DeleteSlotType -> QueryString
toQuery = QueryString -> DeleteSlotType -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty

-- | /See:/ 'newDeleteSlotTypeResponse' smart constructor.
data DeleteSlotTypeResponse = DeleteSlotTypeResponse'
  {
  }
  deriving (DeleteSlotTypeResponse -> DeleteSlotTypeResponse -> Bool
(DeleteSlotTypeResponse -> DeleteSlotTypeResponse -> Bool)
-> (DeleteSlotTypeResponse -> DeleteSlotTypeResponse -> Bool)
-> Eq DeleteSlotTypeResponse
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]
(Int -> ReadS DeleteSlotTypeResponse)
-> ReadS [DeleteSlotTypeResponse]
-> ReadPrec DeleteSlotTypeResponse
-> ReadPrec [DeleteSlotTypeResponse]
-> Read 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
(Int -> DeleteSlotTypeResponse -> ShowS)
-> (DeleteSlotTypeResponse -> String)
-> ([DeleteSlotTypeResponse] -> ShowS)
-> Show DeleteSlotTypeResponse
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. DeleteSlotTypeResponse -> Rep DeleteSlotTypeResponse x)
-> (forall x.
    Rep DeleteSlotTypeResponse x -> DeleteSlotTypeResponse)
-> Generic DeleteSlotTypeResponse
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