{-# 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.Wisdom.DeleteContent
-- 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 the content.
module Amazonka.Wisdom.DeleteContent
  ( -- * Creating a Request
    DeleteContent (..),
    newDeleteContent,

    -- * Request Lenses
    deleteContent_contentId,
    deleteContent_knowledgeBaseId,

    -- * Destructuring the Response
    DeleteContentResponse (..),
    newDeleteContentResponse,

    -- * Response Lenses
    deleteContentResponse_httpStatus,
  )
where

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
import Amazonka.Wisdom.Types

-- | /See:/ 'newDeleteContent' smart constructor.
data DeleteContent = DeleteContent'
  { -- | The identifier of the content. Can be either the ID or the ARN. URLs
    -- cannot contain the ARN.
    DeleteContent -> Text
contentId :: Prelude.Text,
    -- | The the identifier of the knowledge base. Can be either the ID or the
    -- ARN. URLs cannot contain the ARN.
    DeleteContent -> Text
knowledgeBaseId :: Prelude.Text
  }
  deriving (DeleteContent -> DeleteContent -> Bool
(DeleteContent -> DeleteContent -> Bool)
-> (DeleteContent -> DeleteContent -> Bool) -> Eq DeleteContent
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteContent -> DeleteContent -> Bool
$c/= :: DeleteContent -> DeleteContent -> Bool
== :: DeleteContent -> DeleteContent -> Bool
$c== :: DeleteContent -> DeleteContent -> Bool
Prelude.Eq, ReadPrec [DeleteContent]
ReadPrec DeleteContent
Int -> ReadS DeleteContent
ReadS [DeleteContent]
(Int -> ReadS DeleteContent)
-> ReadS [DeleteContent]
-> ReadPrec DeleteContent
-> ReadPrec [DeleteContent]
-> Read DeleteContent
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteContent]
$creadListPrec :: ReadPrec [DeleteContent]
readPrec :: ReadPrec DeleteContent
$creadPrec :: ReadPrec DeleteContent
readList :: ReadS [DeleteContent]
$creadList :: ReadS [DeleteContent]
readsPrec :: Int -> ReadS DeleteContent
$creadsPrec :: Int -> ReadS DeleteContent
Prelude.Read, Int -> DeleteContent -> ShowS
[DeleteContent] -> ShowS
DeleteContent -> String
(Int -> DeleteContent -> ShowS)
-> (DeleteContent -> String)
-> ([DeleteContent] -> ShowS)
-> Show DeleteContent
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteContent] -> ShowS
$cshowList :: [DeleteContent] -> ShowS
show :: DeleteContent -> String
$cshow :: DeleteContent -> String
showsPrec :: Int -> DeleteContent -> ShowS
$cshowsPrec :: Int -> DeleteContent -> ShowS
Prelude.Show, (forall x. DeleteContent -> Rep DeleteContent x)
-> (forall x. Rep DeleteContent x -> DeleteContent)
-> Generic DeleteContent
forall x. Rep DeleteContent x -> DeleteContent
forall x. DeleteContent -> Rep DeleteContent x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DeleteContent x -> DeleteContent
$cfrom :: forall x. DeleteContent -> Rep DeleteContent x
Prelude.Generic)

-- |
-- Create a value of 'DeleteContent' 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:
--
-- 'contentId', 'deleteContent_contentId' - The identifier of the content. Can be either the ID or the ARN. URLs
-- cannot contain the ARN.
--
-- 'knowledgeBaseId', 'deleteContent_knowledgeBaseId' - The the identifier of the knowledge base. Can be either the ID or the
-- ARN. URLs cannot contain the ARN.
newDeleteContent ::
  -- | 'contentId'
  Prelude.Text ->
  -- | 'knowledgeBaseId'
  Prelude.Text ->
  DeleteContent
newDeleteContent :: Text -> Text -> DeleteContent
newDeleteContent Text
pContentId_ Text
pKnowledgeBaseId_ =
  DeleteContent' :: Text -> Text -> DeleteContent
DeleteContent'
    { $sel:contentId:DeleteContent' :: Text
contentId = Text
pContentId_,
      $sel:knowledgeBaseId:DeleteContent' :: Text
knowledgeBaseId = Text
pKnowledgeBaseId_
    }

-- | The identifier of the content. Can be either the ID or the ARN. URLs
-- cannot contain the ARN.
deleteContent_contentId :: Lens.Lens' DeleteContent Prelude.Text
deleteContent_contentId :: (Text -> f Text) -> DeleteContent -> f DeleteContent
deleteContent_contentId = (DeleteContent -> Text)
-> (DeleteContent -> Text -> DeleteContent)
-> Lens DeleteContent DeleteContent Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteContent' {Text
contentId :: Text
$sel:contentId:DeleteContent' :: DeleteContent -> Text
contentId} -> Text
contentId) (\s :: DeleteContent
s@DeleteContent' {} Text
a -> DeleteContent
s {$sel:contentId:DeleteContent' :: Text
contentId = Text
a} :: DeleteContent)

-- | The the identifier of the knowledge base. Can be either the ID or the
-- ARN. URLs cannot contain the ARN.
deleteContent_knowledgeBaseId :: Lens.Lens' DeleteContent Prelude.Text
deleteContent_knowledgeBaseId :: (Text -> f Text) -> DeleteContent -> f DeleteContent
deleteContent_knowledgeBaseId = (DeleteContent -> Text)
-> (DeleteContent -> Text -> DeleteContent)
-> Lens DeleteContent DeleteContent Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteContent' {Text
knowledgeBaseId :: Text
$sel:knowledgeBaseId:DeleteContent' :: DeleteContent -> Text
knowledgeBaseId} -> Text
knowledgeBaseId) (\s :: DeleteContent
s@DeleteContent' {} Text
a -> DeleteContent
s {$sel:knowledgeBaseId:DeleteContent' :: Text
knowledgeBaseId = Text
a} :: DeleteContent)

instance Core.AWSRequest DeleteContent where
  type
    AWSResponse DeleteContent =
      DeleteContentResponse
  request :: DeleteContent -> Request DeleteContent
request = Service -> DeleteContent -> Request DeleteContent
forall a. ToRequest a => Service -> a -> Request a
Request.delete Service
defaultService
  response :: Logger
-> Service
-> Proxy DeleteContent
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DeleteContent)))
response =
    (Int
 -> ResponseHeaders
 -> ()
 -> Either String (AWSResponse DeleteContent))
-> Logger
-> Service
-> Proxy DeleteContent
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DeleteContent)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> () -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveEmpty
      ( \Int
s ResponseHeaders
h ()
x ->
          Int -> DeleteContentResponse
DeleteContentResponse'
            (Int -> DeleteContentResponse)
-> Either String Int -> Either String DeleteContentResponse
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))
      )

instance Prelude.Hashable DeleteContent

instance Prelude.NFData DeleteContent

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

instance Core.ToPath DeleteContent where
  toPath :: DeleteContent -> ByteString
toPath DeleteContent' {Text
knowledgeBaseId :: Text
contentId :: Text
$sel:knowledgeBaseId:DeleteContent' :: DeleteContent -> Text
$sel:contentId:DeleteContent' :: DeleteContent -> Text
..} =
    [ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"/knowledgeBases/",
        Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
knowledgeBaseId,
        ByteString
"/contents/",
        Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
contentId
      ]

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

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

-- |
-- Create a value of 'DeleteContentResponse' 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', 'deleteContentResponse_httpStatus' - The response's http status code.
newDeleteContentResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  DeleteContentResponse
newDeleteContentResponse :: Int -> DeleteContentResponse
newDeleteContentResponse Int
pHttpStatus_ =
  DeleteContentResponse' :: Int -> DeleteContentResponse
DeleteContentResponse' {$sel:httpStatus:DeleteContentResponse' :: Int
httpStatus = Int
pHttpStatus_}

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

instance Prelude.NFData DeleteContentResponse