{-# 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.CloudSearch.DeleteAnalysisScheme
-- 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 an analysis scheme. For more information, see
-- <http://docs.aws.amazon.com/cloudsearch/latest/developerguide/configuring-analysis-schemes.html Configuring Analysis Schemes>
-- in the /Amazon CloudSearch Developer Guide/.
module Amazonka.CloudSearch.DeleteAnalysisScheme
  ( -- * Creating a Request
    DeleteAnalysisScheme (..),
    newDeleteAnalysisScheme,

    -- * Request Lenses
    deleteAnalysisScheme_domainName,
    deleteAnalysisScheme_analysisSchemeName,

    -- * Destructuring the Response
    DeleteAnalysisSchemeResponse (..),
    newDeleteAnalysisSchemeResponse,

    -- * Response Lenses
    deleteAnalysisSchemeResponse_httpStatus,
    deleteAnalysisSchemeResponse_analysisScheme,
  )
where

import Amazonka.CloudSearch.Types
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response

-- | Container for the parameters to the @DeleteAnalysisScheme@ operation.
-- Specifies the name of the domain you want to update and the analysis
-- scheme you want to delete.
--
-- /See:/ 'newDeleteAnalysisScheme' smart constructor.
data DeleteAnalysisScheme = DeleteAnalysisScheme'
  { DeleteAnalysisScheme -> Text
domainName :: Prelude.Text,
    -- | The name of the analysis scheme you want to delete.
    DeleteAnalysisScheme -> Text
analysisSchemeName :: Prelude.Text
  }
  deriving (DeleteAnalysisScheme -> DeleteAnalysisScheme -> Bool
(DeleteAnalysisScheme -> DeleteAnalysisScheme -> Bool)
-> (DeleteAnalysisScheme -> DeleteAnalysisScheme -> Bool)
-> Eq DeleteAnalysisScheme
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteAnalysisScheme -> DeleteAnalysisScheme -> Bool
$c/= :: DeleteAnalysisScheme -> DeleteAnalysisScheme -> Bool
== :: DeleteAnalysisScheme -> DeleteAnalysisScheme -> Bool
$c== :: DeleteAnalysisScheme -> DeleteAnalysisScheme -> Bool
Prelude.Eq, ReadPrec [DeleteAnalysisScheme]
ReadPrec DeleteAnalysisScheme
Int -> ReadS DeleteAnalysisScheme
ReadS [DeleteAnalysisScheme]
(Int -> ReadS DeleteAnalysisScheme)
-> ReadS [DeleteAnalysisScheme]
-> ReadPrec DeleteAnalysisScheme
-> ReadPrec [DeleteAnalysisScheme]
-> Read DeleteAnalysisScheme
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteAnalysisScheme]
$creadListPrec :: ReadPrec [DeleteAnalysisScheme]
readPrec :: ReadPrec DeleteAnalysisScheme
$creadPrec :: ReadPrec DeleteAnalysisScheme
readList :: ReadS [DeleteAnalysisScheme]
$creadList :: ReadS [DeleteAnalysisScheme]
readsPrec :: Int -> ReadS DeleteAnalysisScheme
$creadsPrec :: Int -> ReadS DeleteAnalysisScheme
Prelude.Read, Int -> DeleteAnalysisScheme -> ShowS
[DeleteAnalysisScheme] -> ShowS
DeleteAnalysisScheme -> String
(Int -> DeleteAnalysisScheme -> ShowS)
-> (DeleteAnalysisScheme -> String)
-> ([DeleteAnalysisScheme] -> ShowS)
-> Show DeleteAnalysisScheme
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteAnalysisScheme] -> ShowS
$cshowList :: [DeleteAnalysisScheme] -> ShowS
show :: DeleteAnalysisScheme -> String
$cshow :: DeleteAnalysisScheme -> String
showsPrec :: Int -> DeleteAnalysisScheme -> ShowS
$cshowsPrec :: Int -> DeleteAnalysisScheme -> ShowS
Prelude.Show, (forall x. DeleteAnalysisScheme -> Rep DeleteAnalysisScheme x)
-> (forall x. Rep DeleteAnalysisScheme x -> DeleteAnalysisScheme)
-> Generic DeleteAnalysisScheme
forall x. Rep DeleteAnalysisScheme x -> DeleteAnalysisScheme
forall x. DeleteAnalysisScheme -> Rep DeleteAnalysisScheme x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DeleteAnalysisScheme x -> DeleteAnalysisScheme
$cfrom :: forall x. DeleteAnalysisScheme -> Rep DeleteAnalysisScheme x
Prelude.Generic)

-- |
-- Create a value of 'DeleteAnalysisScheme' 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:
--
-- 'domainName', 'deleteAnalysisScheme_domainName' - Undocumented member.
--
-- 'analysisSchemeName', 'deleteAnalysisScheme_analysisSchemeName' - The name of the analysis scheme you want to delete.
newDeleteAnalysisScheme ::
  -- | 'domainName'
  Prelude.Text ->
  -- | 'analysisSchemeName'
  Prelude.Text ->
  DeleteAnalysisScheme
newDeleteAnalysisScheme :: Text -> Text -> DeleteAnalysisScheme
newDeleteAnalysisScheme
  Text
pDomainName_
  Text
pAnalysisSchemeName_ =
    DeleteAnalysisScheme' :: Text -> Text -> DeleteAnalysisScheme
DeleteAnalysisScheme'
      { $sel:domainName:DeleteAnalysisScheme' :: Text
domainName = Text
pDomainName_,
        $sel:analysisSchemeName:DeleteAnalysisScheme' :: Text
analysisSchemeName = Text
pAnalysisSchemeName_
      }

-- | Undocumented member.
deleteAnalysisScheme_domainName :: Lens.Lens' DeleteAnalysisScheme Prelude.Text
deleteAnalysisScheme_domainName :: (Text -> f Text) -> DeleteAnalysisScheme -> f DeleteAnalysisScheme
deleteAnalysisScheme_domainName = (DeleteAnalysisScheme -> Text)
-> (DeleteAnalysisScheme -> Text -> DeleteAnalysisScheme)
-> Lens DeleteAnalysisScheme DeleteAnalysisScheme Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteAnalysisScheme' {Text
domainName :: Text
$sel:domainName:DeleteAnalysisScheme' :: DeleteAnalysisScheme -> Text
domainName} -> Text
domainName) (\s :: DeleteAnalysisScheme
s@DeleteAnalysisScheme' {} Text
a -> DeleteAnalysisScheme
s {$sel:domainName:DeleteAnalysisScheme' :: Text
domainName = Text
a} :: DeleteAnalysisScheme)

-- | The name of the analysis scheme you want to delete.
deleteAnalysisScheme_analysisSchemeName :: Lens.Lens' DeleteAnalysisScheme Prelude.Text
deleteAnalysisScheme_analysisSchemeName :: (Text -> f Text) -> DeleteAnalysisScheme -> f DeleteAnalysisScheme
deleteAnalysisScheme_analysisSchemeName = (DeleteAnalysisScheme -> Text)
-> (DeleteAnalysisScheme -> Text -> DeleteAnalysisScheme)
-> Lens DeleteAnalysisScheme DeleteAnalysisScheme Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteAnalysisScheme' {Text
analysisSchemeName :: Text
$sel:analysisSchemeName:DeleteAnalysisScheme' :: DeleteAnalysisScheme -> Text
analysisSchemeName} -> Text
analysisSchemeName) (\s :: DeleteAnalysisScheme
s@DeleteAnalysisScheme' {} Text
a -> DeleteAnalysisScheme
s {$sel:analysisSchemeName:DeleteAnalysisScheme' :: Text
analysisSchemeName = Text
a} :: DeleteAnalysisScheme)

instance Core.AWSRequest DeleteAnalysisScheme where
  type
    AWSResponse DeleteAnalysisScheme =
      DeleteAnalysisSchemeResponse
  request :: DeleteAnalysisScheme -> Request DeleteAnalysisScheme
request = Service -> DeleteAnalysisScheme -> Request DeleteAnalysisScheme
forall a. ToRequest a => Service -> a -> Request a
Request.postQuery Service
defaultService
  response :: Logger
-> Service
-> Proxy DeleteAnalysisScheme
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DeleteAnalysisScheme)))
response =
    Text
-> (Int
    -> ResponseHeaders
    -> [Node]
    -> Either String (AWSResponse DeleteAnalysisScheme))
-> Logger
-> Service
-> Proxy DeleteAnalysisScheme
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DeleteAnalysisScheme)))
forall (m :: * -> *) a.
MonadResource m =>
Text
-> (Int
    -> ResponseHeaders -> [Node] -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveXMLWrapper
      Text
"DeleteAnalysisSchemeResult"
      ( \Int
s ResponseHeaders
h [Node]
x ->
          Int -> AnalysisSchemeStatus -> DeleteAnalysisSchemeResponse
DeleteAnalysisSchemeResponse'
            (Int -> AnalysisSchemeStatus -> DeleteAnalysisSchemeResponse)
-> Either String Int
-> Either
     String (AnalysisSchemeStatus -> DeleteAnalysisSchemeResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Int -> Either String Int
forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (Int -> Int
forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
            Either
  String (AnalysisSchemeStatus -> DeleteAnalysisSchemeResponse)
-> Either String AnalysisSchemeStatus
-> Either String DeleteAnalysisSchemeResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String AnalysisSchemeStatus
forall a. FromXML a => [Node] -> Text -> Either String a
Core..@ Text
"AnalysisScheme")
      )

instance Prelude.Hashable DeleteAnalysisScheme

instance Prelude.NFData DeleteAnalysisScheme

instance Core.ToHeaders DeleteAnalysisScheme where
  toHeaders :: DeleteAnalysisScheme -> ResponseHeaders
toHeaders = ResponseHeaders -> DeleteAnalysisScheme -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const ResponseHeaders
forall a. Monoid a => a
Prelude.mempty

instance Core.ToPath DeleteAnalysisScheme where
  toPath :: DeleteAnalysisScheme -> ByteString
toPath = ByteString -> DeleteAnalysisScheme -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"

instance Core.ToQuery DeleteAnalysisScheme where
  toQuery :: DeleteAnalysisScheme -> QueryString
toQuery DeleteAnalysisScheme' {Text
analysisSchemeName :: Text
domainName :: Text
$sel:analysisSchemeName:DeleteAnalysisScheme' :: DeleteAnalysisScheme -> Text
$sel:domainName:DeleteAnalysisScheme' :: DeleteAnalysisScheme -> Text
..} =
    [QueryString] -> QueryString
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"Action"
          ByteString -> ByteString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: (ByteString
"DeleteAnalysisScheme" :: Prelude.ByteString),
        ByteString
"Version"
          ByteString -> ByteString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: (ByteString
"2013-01-01" :: Prelude.ByteString),
        ByteString
"DomainName" ByteString -> Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Text
domainName,
        ByteString
"AnalysisSchemeName" ByteString -> Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Text
analysisSchemeName
      ]

-- | The result of a @DeleteAnalysisScheme@ request. Contains the status of
-- the deleted analysis scheme.
--
-- /See:/ 'newDeleteAnalysisSchemeResponse' smart constructor.
data DeleteAnalysisSchemeResponse = DeleteAnalysisSchemeResponse'
  { -- | The response's http status code.
    DeleteAnalysisSchemeResponse -> Int
httpStatus :: Prelude.Int,
    -- | The status of the analysis scheme being deleted.
    DeleteAnalysisSchemeResponse -> AnalysisSchemeStatus
analysisScheme :: AnalysisSchemeStatus
  }
  deriving (DeleteAnalysisSchemeResponse
-> DeleteAnalysisSchemeResponse -> Bool
(DeleteAnalysisSchemeResponse
 -> DeleteAnalysisSchemeResponse -> Bool)
-> (DeleteAnalysisSchemeResponse
    -> DeleteAnalysisSchemeResponse -> Bool)
-> Eq DeleteAnalysisSchemeResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteAnalysisSchemeResponse
-> DeleteAnalysisSchemeResponse -> Bool
$c/= :: DeleteAnalysisSchemeResponse
-> DeleteAnalysisSchemeResponse -> Bool
== :: DeleteAnalysisSchemeResponse
-> DeleteAnalysisSchemeResponse -> Bool
$c== :: DeleteAnalysisSchemeResponse
-> DeleteAnalysisSchemeResponse -> Bool
Prelude.Eq, ReadPrec [DeleteAnalysisSchemeResponse]
ReadPrec DeleteAnalysisSchemeResponse
Int -> ReadS DeleteAnalysisSchemeResponse
ReadS [DeleteAnalysisSchemeResponse]
(Int -> ReadS DeleteAnalysisSchemeResponse)
-> ReadS [DeleteAnalysisSchemeResponse]
-> ReadPrec DeleteAnalysisSchemeResponse
-> ReadPrec [DeleteAnalysisSchemeResponse]
-> Read DeleteAnalysisSchemeResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteAnalysisSchemeResponse]
$creadListPrec :: ReadPrec [DeleteAnalysisSchemeResponse]
readPrec :: ReadPrec DeleteAnalysisSchemeResponse
$creadPrec :: ReadPrec DeleteAnalysisSchemeResponse
readList :: ReadS [DeleteAnalysisSchemeResponse]
$creadList :: ReadS [DeleteAnalysisSchemeResponse]
readsPrec :: Int -> ReadS DeleteAnalysisSchemeResponse
$creadsPrec :: Int -> ReadS DeleteAnalysisSchemeResponse
Prelude.Read, Int -> DeleteAnalysisSchemeResponse -> ShowS
[DeleteAnalysisSchemeResponse] -> ShowS
DeleteAnalysisSchemeResponse -> String
(Int -> DeleteAnalysisSchemeResponse -> ShowS)
-> (DeleteAnalysisSchemeResponse -> String)
-> ([DeleteAnalysisSchemeResponse] -> ShowS)
-> Show DeleteAnalysisSchemeResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteAnalysisSchemeResponse] -> ShowS
$cshowList :: [DeleteAnalysisSchemeResponse] -> ShowS
show :: DeleteAnalysisSchemeResponse -> String
$cshow :: DeleteAnalysisSchemeResponse -> String
showsPrec :: Int -> DeleteAnalysisSchemeResponse -> ShowS
$cshowsPrec :: Int -> DeleteAnalysisSchemeResponse -> ShowS
Prelude.Show, (forall x.
 DeleteAnalysisSchemeResponse -> Rep DeleteAnalysisSchemeResponse x)
-> (forall x.
    Rep DeleteAnalysisSchemeResponse x -> DeleteAnalysisSchemeResponse)
-> Generic DeleteAnalysisSchemeResponse
forall x.
Rep DeleteAnalysisSchemeResponse x -> DeleteAnalysisSchemeResponse
forall x.
DeleteAnalysisSchemeResponse -> Rep DeleteAnalysisSchemeResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DeleteAnalysisSchemeResponse x -> DeleteAnalysisSchemeResponse
$cfrom :: forall x.
DeleteAnalysisSchemeResponse -> Rep DeleteAnalysisSchemeResponse x
Prelude.Generic)

-- |
-- Create a value of 'DeleteAnalysisSchemeResponse' 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:
--
-- 'httpStatus', 'deleteAnalysisSchemeResponse_httpStatus' - The response's http status code.
--
-- 'analysisScheme', 'deleteAnalysisSchemeResponse_analysisScheme' - The status of the analysis scheme being deleted.
newDeleteAnalysisSchemeResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  -- | 'analysisScheme'
  AnalysisSchemeStatus ->
  DeleteAnalysisSchemeResponse
newDeleteAnalysisSchemeResponse :: Int -> AnalysisSchemeStatus -> DeleteAnalysisSchemeResponse
newDeleteAnalysisSchemeResponse
  Int
pHttpStatus_
  AnalysisSchemeStatus
pAnalysisScheme_ =
    DeleteAnalysisSchemeResponse' :: Int -> AnalysisSchemeStatus -> DeleteAnalysisSchemeResponse
DeleteAnalysisSchemeResponse'
      { $sel:httpStatus:DeleteAnalysisSchemeResponse' :: Int
httpStatus =
          Int
pHttpStatus_,
        $sel:analysisScheme:DeleteAnalysisSchemeResponse' :: AnalysisSchemeStatus
analysisScheme = AnalysisSchemeStatus
pAnalysisScheme_
      }

-- | The response's http status code.
deleteAnalysisSchemeResponse_httpStatus :: Lens.Lens' DeleteAnalysisSchemeResponse Prelude.Int
deleteAnalysisSchemeResponse_httpStatus :: (Int -> f Int)
-> DeleteAnalysisSchemeResponse -> f DeleteAnalysisSchemeResponse
deleteAnalysisSchemeResponse_httpStatus = (DeleteAnalysisSchemeResponse -> Int)
-> (DeleteAnalysisSchemeResponse
    -> Int -> DeleteAnalysisSchemeResponse)
-> Lens
     DeleteAnalysisSchemeResponse DeleteAnalysisSchemeResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteAnalysisSchemeResponse' {Int
httpStatus :: Int
$sel:httpStatus:DeleteAnalysisSchemeResponse' :: DeleteAnalysisSchemeResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: DeleteAnalysisSchemeResponse
s@DeleteAnalysisSchemeResponse' {} Int
a -> DeleteAnalysisSchemeResponse
s {$sel:httpStatus:DeleteAnalysisSchemeResponse' :: Int
httpStatus = Int
a} :: DeleteAnalysisSchemeResponse)

-- | The status of the analysis scheme being deleted.
deleteAnalysisSchemeResponse_analysisScheme :: Lens.Lens' DeleteAnalysisSchemeResponse AnalysisSchemeStatus
deleteAnalysisSchemeResponse_analysisScheme :: (AnalysisSchemeStatus -> f AnalysisSchemeStatus)
-> DeleteAnalysisSchemeResponse -> f DeleteAnalysisSchemeResponse
deleteAnalysisSchemeResponse_analysisScheme = (DeleteAnalysisSchemeResponse -> AnalysisSchemeStatus)
-> (DeleteAnalysisSchemeResponse
    -> AnalysisSchemeStatus -> DeleteAnalysisSchemeResponse)
-> Lens
     DeleteAnalysisSchemeResponse
     DeleteAnalysisSchemeResponse
     AnalysisSchemeStatus
     AnalysisSchemeStatus
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteAnalysisSchemeResponse' {AnalysisSchemeStatus
analysisScheme :: AnalysisSchemeStatus
$sel:analysisScheme:DeleteAnalysisSchemeResponse' :: DeleteAnalysisSchemeResponse -> AnalysisSchemeStatus
analysisScheme} -> AnalysisSchemeStatus
analysisScheme) (\s :: DeleteAnalysisSchemeResponse
s@DeleteAnalysisSchemeResponse' {} AnalysisSchemeStatus
a -> DeleteAnalysisSchemeResponse
s {$sel:analysisScheme:DeleteAnalysisSchemeResponse' :: AnalysisSchemeStatus
analysisScheme = AnalysisSchemeStatus
a} :: DeleteAnalysisSchemeResponse)

instance Prelude.NFData DeleteAnalysisSchemeResponse