{-# 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.DeleteBotVersion
-- 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 a specific version of a bot. To delete all versions of a bot,
-- use the DeleteBot operation.
--
-- This operation requires permissions for the @lex:DeleteBotVersion@
-- action.
module Amazonka.LexModels.DeleteBotVersion
  ( -- * Creating a Request
    DeleteBotVersion (..),
    newDeleteBotVersion,

    -- * Request Lenses
    deleteBotVersion_name,
    deleteBotVersion_version,

    -- * Destructuring the Response
    DeleteBotVersionResponse (..),
    newDeleteBotVersionResponse,
  )
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:/ 'newDeleteBotVersion' smart constructor.
data DeleteBotVersion = DeleteBotVersion'
  { -- | The name of the bot.
    DeleteBotVersion -> Text
name :: Prelude.Text,
    -- | The version of the bot to delete. You cannot delete the @$LATEST@
    -- version of the bot. To delete the @$LATEST@ version, use the DeleteBot
    -- operation.
    DeleteBotVersion -> Text
version :: Prelude.Text
  }
  deriving (DeleteBotVersion -> DeleteBotVersion -> Bool
(DeleteBotVersion -> DeleteBotVersion -> Bool)
-> (DeleteBotVersion -> DeleteBotVersion -> Bool)
-> Eq DeleteBotVersion
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteBotVersion -> DeleteBotVersion -> Bool
$c/= :: DeleteBotVersion -> DeleteBotVersion -> Bool
== :: DeleteBotVersion -> DeleteBotVersion -> Bool
$c== :: DeleteBotVersion -> DeleteBotVersion -> Bool
Prelude.Eq, ReadPrec [DeleteBotVersion]
ReadPrec DeleteBotVersion
Int -> ReadS DeleteBotVersion
ReadS [DeleteBotVersion]
(Int -> ReadS DeleteBotVersion)
-> ReadS [DeleteBotVersion]
-> ReadPrec DeleteBotVersion
-> ReadPrec [DeleteBotVersion]
-> Read DeleteBotVersion
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteBotVersion]
$creadListPrec :: ReadPrec [DeleteBotVersion]
readPrec :: ReadPrec DeleteBotVersion
$creadPrec :: ReadPrec DeleteBotVersion
readList :: ReadS [DeleteBotVersion]
$creadList :: ReadS [DeleteBotVersion]
readsPrec :: Int -> ReadS DeleteBotVersion
$creadsPrec :: Int -> ReadS DeleteBotVersion
Prelude.Read, Int -> DeleteBotVersion -> ShowS
[DeleteBotVersion] -> ShowS
DeleteBotVersion -> String
(Int -> DeleteBotVersion -> ShowS)
-> (DeleteBotVersion -> String)
-> ([DeleteBotVersion] -> ShowS)
-> Show DeleteBotVersion
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteBotVersion] -> ShowS
$cshowList :: [DeleteBotVersion] -> ShowS
show :: DeleteBotVersion -> String
$cshow :: DeleteBotVersion -> String
showsPrec :: Int -> DeleteBotVersion -> ShowS
$cshowsPrec :: Int -> DeleteBotVersion -> ShowS
Prelude.Show, (forall x. DeleteBotVersion -> Rep DeleteBotVersion x)
-> (forall x. Rep DeleteBotVersion x -> DeleteBotVersion)
-> Generic DeleteBotVersion
forall x. Rep DeleteBotVersion x -> DeleteBotVersion
forall x. DeleteBotVersion -> Rep DeleteBotVersion x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DeleteBotVersion x -> DeleteBotVersion
$cfrom :: forall x. DeleteBotVersion -> Rep DeleteBotVersion x
Prelude.Generic)

-- |
-- Create a value of 'DeleteBotVersion' 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', 'deleteBotVersion_name' - The name of the bot.
--
-- 'version', 'deleteBotVersion_version' - The version of the bot to delete. You cannot delete the @$LATEST@
-- version of the bot. To delete the @$LATEST@ version, use the DeleteBot
-- operation.
newDeleteBotVersion ::
  -- | 'name'
  Prelude.Text ->
  -- | 'version'
  Prelude.Text ->
  DeleteBotVersion
newDeleteBotVersion :: Text -> Text -> DeleteBotVersion
newDeleteBotVersion Text
pName_ Text
pVersion_ =
  DeleteBotVersion' :: Text -> Text -> DeleteBotVersion
DeleteBotVersion'
    { $sel:name:DeleteBotVersion' :: Text
name = Text
pName_,
      $sel:version:DeleteBotVersion' :: Text
version = Text
pVersion_
    }

-- | The name of the bot.
deleteBotVersion_name :: Lens.Lens' DeleteBotVersion Prelude.Text
deleteBotVersion_name :: (Text -> f Text) -> DeleteBotVersion -> f DeleteBotVersion
deleteBotVersion_name = (DeleteBotVersion -> Text)
-> (DeleteBotVersion -> Text -> DeleteBotVersion)
-> Lens DeleteBotVersion DeleteBotVersion Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteBotVersion' {Text
name :: Text
$sel:name:DeleteBotVersion' :: DeleteBotVersion -> Text
name} -> Text
name) (\s :: DeleteBotVersion
s@DeleteBotVersion' {} Text
a -> DeleteBotVersion
s {$sel:name:DeleteBotVersion' :: Text
name = Text
a} :: DeleteBotVersion)

-- | The version of the bot to delete. You cannot delete the @$LATEST@
-- version of the bot. To delete the @$LATEST@ version, use the DeleteBot
-- operation.
deleteBotVersion_version :: Lens.Lens' DeleteBotVersion Prelude.Text
deleteBotVersion_version :: (Text -> f Text) -> DeleteBotVersion -> f DeleteBotVersion
deleteBotVersion_version = (DeleteBotVersion -> Text)
-> (DeleteBotVersion -> Text -> DeleteBotVersion)
-> Lens DeleteBotVersion DeleteBotVersion Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteBotVersion' {Text
version :: Text
$sel:version:DeleteBotVersion' :: DeleteBotVersion -> Text
version} -> Text
version) (\s :: DeleteBotVersion
s@DeleteBotVersion' {} Text
a -> DeleteBotVersion
s {$sel:version:DeleteBotVersion' :: Text
version = Text
a} :: DeleteBotVersion)

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

instance Prelude.Hashable DeleteBotVersion

instance Prelude.NFData DeleteBotVersion

instance Core.ToHeaders DeleteBotVersion where
  toHeaders :: DeleteBotVersion -> [Header]
toHeaders =
    [Header] -> DeleteBotVersion -> [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 DeleteBotVersion where
  toPath :: DeleteBotVersion -> ByteString
toPath DeleteBotVersion' {Text
version :: Text
name :: Text
$sel:version:DeleteBotVersion' :: DeleteBotVersion -> Text
$sel:name:DeleteBotVersion' :: DeleteBotVersion -> Text
..} =
    [ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"/bots/",
        Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
name,
        ByteString
"/versions/",
        Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
version
      ]

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

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

-- |
-- Create a value of 'DeleteBotVersionResponse' 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.
newDeleteBotVersionResponse ::
  DeleteBotVersionResponse
newDeleteBotVersionResponse :: DeleteBotVersionResponse
newDeleteBotVersionResponse =
  DeleteBotVersionResponse
DeleteBotVersionResponse'

instance Prelude.NFData DeleteBotVersionResponse